Loading layout/xul/base/src/nsBox.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -999,6 +999,17 @@ nsBox::GetOrientation(PRBool& aIsHorizontal) return NS_OK; } NS_IMETHODIMP nsBox::GetDirection(PRBool& aIsNormal) { nsIFrame* frame = nsnull; GetFrame(&frame); nsFrameState state; frame->GetFrameState(&state); aIsNormal = (state & NS_STATE_IS_DIRECTION_NORMAL); return NS_OK; } nsresult nsBox::SyncLayout(nsBoxLayoutState& aState) { Loading layout/xul/base/src/nsBox.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public: NS_IMETHOD GetHAlign(Halignment& aAlign); NS_IMETHOD GetInset(nsMargin& aInset); NS_IMETHOD GetOrientation(PRBool& aIsHorizontal); NS_IMETHOD GetDirection(PRBool& aIsNormal); NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); Loading layout/xul/base/src/nsBoxFrame.cpp +56 −1 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ nsBoxFrame::IsHorizontal() const return mState & NS_STATE_IS_HORIZONTAL; } PRBool nsBoxFrame::IsNormalDirection() const { return mState & NS_STATE_IS_DIRECTION_NORMAL; } /** * Initialize us. This is a good time to get the alignment of the box Loading Loading @@ -370,6 +375,13 @@ nsBoxFrameInner::CacheAttributes() else mOuter->mState &= ~NS_STATE_IS_HORIZONTAL; PRBool normal = PR_TRUE; mOuter->GetInitialDirection(normal); if (normal) mOuter->mState |= NS_STATE_IS_DIRECTION_NORMAL; else mOuter->mState &= ~NS_STATE_IS_DIRECTION_NORMAL; mOuter->GetInitialVAlignment(mValign); mOuter->GetInitialHAlignment(mHalign); Loading Loading @@ -634,6 +646,42 @@ nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal) } } void nsBoxFrame::GetInitialDirection(PRBool& aIsNormal) { nsAutoString value; nsCOMPtr<nsIContent> content; GetContentOf(getter_AddRefs(content)); if (!content) return; if (IsHorizontal()) { // For horizontal boxes only, we initialize our value based off the CSS 'direction' property. // This means that BiDI users will end up with horizontally inverted chrome. const nsStyleVisibility* vis; GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); aIsNormal = (vis->mDirection == NS_STYLE_DIRECTION_LTR); // If text runs RTL then so do we. } else aIsNormal = PR_TRUE; // Assume a normal direction in the vertical case. // Now check the style system to see if we should invert aIsNormal. const nsStyleXUL* boxInfo; GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)boxInfo); if (boxInfo->mBoxDirection == NS_STYLE_BOX_DIRECTION_REVERSE) aIsNormal = !aIsNormal; // Invert our direction. // Now see if we have an attribute. The attribute overrides // the style system value. if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::dir, value)) { if (value.EqualsIgnoreCase("reverse")) aIsNormal = !aIsNormal; // Invert our direction. } } /* Returns true if it was set. */ PRBool Loading Loading @@ -1222,7 +1270,7 @@ nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext, aAttribute == nsXULAtoms::equalsize || aAttribute == nsXULAtoms::autostretch) { if (aAttribute == nsXULAtoms::orient || aAttribute == nsXULAtoms::debug || aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::valign) { if (aAttribute == nsXULAtoms::orient || aAttribute == nsXULAtoms::dir || aAttribute == nsXULAtoms::debug || aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::valign) { mInner->mValign = nsBoxFrame::vAlign_Top; mInner->mHalign = nsBoxFrame::hAlign_Left; Loading @@ -1233,6 +1281,13 @@ nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext, else mState &= ~NS_STATE_IS_HORIZONTAL; PRBool normal = PR_TRUE; GetInitialDirection(normal); if (normal) mState |= NS_STATE_IS_DIRECTION_NORMAL; else mState &= ~NS_STATE_IS_DIRECTION_NORMAL; GetInitialVAlignment(mInner->mValign); GetInitialHAlignment(mInner->mHalign); Loading layout/xul/base/src/nsBoxFrame.h +4 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class nsHTMLInfo; #define NS_STATE_IS_COLLAPSED 0x10000000 #define NS_STATE_STYLE_CHANGE 0x20000000 #define NS_STATE_EQUAL_SIZE 0x40000000 #define NS_STATE_IS_DIRECTION_NORMAL 0x80000000 class nsBoxFrame : public nsContainerFrame, public nsContainerBox { Loading Loading @@ -155,6 +156,7 @@ public: nsDidReflowStatus aStatus); virtual PRBool IsHorizontal() const; virtual PRBool IsNormalDirection() const; virtual ~nsBoxFrame(); Loading Loading @@ -200,6 +202,7 @@ protected: virtual PRBool GetInitialEqualSize(PRBool& aEqualSize); virtual void GetInitialOrientation(PRBool& aIsHorizontal); virtual void GetInitialDirection(PRBool& aIsNormal); virtual PRBool GetInitialHAlignment(Halignment& aHalign); virtual PRBool GetInitialVAlignment(Valignment& aValign); virtual PRBool GetInitialAutoStretch(PRBool& aStretch); Loading layout/xul/base/src/nsIBox.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): * David Hyatt (hyatt@netscape.com) */ /** Loading Loading @@ -95,6 +96,7 @@ public: NS_IMETHOD GetVAlign(Valignment& aAlign) = 0; NS_IMETHOD GetHAlign(Halignment& aAlign) = 0; NS_IMETHOD GetOrientation(PRBool& aIsHorizontal)=0; NS_IMETHOD GetDirection(PRBool& aIsNormal)=0; NS_IMETHOD Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE)=0; NS_IMETHOD NeedsRecalc()=0; NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox)=0; Loading Loading
layout/xul/base/src/nsBox.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -999,6 +999,17 @@ nsBox::GetOrientation(PRBool& aIsHorizontal) return NS_OK; } NS_IMETHODIMP nsBox::GetDirection(PRBool& aIsNormal) { nsIFrame* frame = nsnull; GetFrame(&frame); nsFrameState state; frame->GetFrameState(&state); aIsNormal = (state & NS_STATE_IS_DIRECTION_NORMAL); return NS_OK; } nsresult nsBox::SyncLayout(nsBoxLayoutState& aState) { Loading
layout/xul/base/src/nsBox.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public: NS_IMETHOD GetHAlign(Halignment& aAlign); NS_IMETHOD GetInset(nsMargin& aInset); NS_IMETHOD GetOrientation(PRBool& aIsHorizontal); NS_IMETHOD GetDirection(PRBool& aIsNormal); NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize); Loading
layout/xul/base/src/nsBoxFrame.cpp +56 −1 Original line number Diff line number Diff line Loading @@ -290,6 +290,11 @@ nsBoxFrame::IsHorizontal() const return mState & NS_STATE_IS_HORIZONTAL; } PRBool nsBoxFrame::IsNormalDirection() const { return mState & NS_STATE_IS_DIRECTION_NORMAL; } /** * Initialize us. This is a good time to get the alignment of the box Loading Loading @@ -370,6 +375,13 @@ nsBoxFrameInner::CacheAttributes() else mOuter->mState &= ~NS_STATE_IS_HORIZONTAL; PRBool normal = PR_TRUE; mOuter->GetInitialDirection(normal); if (normal) mOuter->mState |= NS_STATE_IS_DIRECTION_NORMAL; else mOuter->mState &= ~NS_STATE_IS_DIRECTION_NORMAL; mOuter->GetInitialVAlignment(mValign); mOuter->GetInitialHAlignment(mHalign); Loading Loading @@ -634,6 +646,42 @@ nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal) } } void nsBoxFrame::GetInitialDirection(PRBool& aIsNormal) { nsAutoString value; nsCOMPtr<nsIContent> content; GetContentOf(getter_AddRefs(content)); if (!content) return; if (IsHorizontal()) { // For horizontal boxes only, we initialize our value based off the CSS 'direction' property. // This means that BiDI users will end up with horizontally inverted chrome. const nsStyleVisibility* vis; GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis); aIsNormal = (vis->mDirection == NS_STYLE_DIRECTION_LTR); // If text runs RTL then so do we. } else aIsNormal = PR_TRUE; // Assume a normal direction in the vertical case. // Now check the style system to see if we should invert aIsNormal. const nsStyleXUL* boxInfo; GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)boxInfo); if (boxInfo->mBoxDirection == NS_STYLE_BOX_DIRECTION_REVERSE) aIsNormal = !aIsNormal; // Invert our direction. // Now see if we have an attribute. The attribute overrides // the style system value. if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::dir, value)) { if (value.EqualsIgnoreCase("reverse")) aIsNormal = !aIsNormal; // Invert our direction. } } /* Returns true if it was set. */ PRBool Loading Loading @@ -1222,7 +1270,7 @@ nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext, aAttribute == nsXULAtoms::equalsize || aAttribute == nsXULAtoms::autostretch) { if (aAttribute == nsXULAtoms::orient || aAttribute == nsXULAtoms::debug || aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::valign) { if (aAttribute == nsXULAtoms::orient || aAttribute == nsXULAtoms::dir || aAttribute == nsXULAtoms::debug || aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::valign) { mInner->mValign = nsBoxFrame::vAlign_Top; mInner->mHalign = nsBoxFrame::hAlign_Left; Loading @@ -1233,6 +1281,13 @@ nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext, else mState &= ~NS_STATE_IS_HORIZONTAL; PRBool normal = PR_TRUE; GetInitialDirection(normal); if (normal) mState |= NS_STATE_IS_DIRECTION_NORMAL; else mState &= ~NS_STATE_IS_DIRECTION_NORMAL; GetInitialVAlignment(mInner->mValign); GetInitialHAlignment(mInner->mHalign); Loading
layout/xul/base/src/nsBoxFrame.h +4 −1 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class nsHTMLInfo; #define NS_STATE_IS_COLLAPSED 0x10000000 #define NS_STATE_STYLE_CHANGE 0x20000000 #define NS_STATE_EQUAL_SIZE 0x40000000 #define NS_STATE_IS_DIRECTION_NORMAL 0x80000000 class nsBoxFrame : public nsContainerFrame, public nsContainerBox { Loading Loading @@ -155,6 +156,7 @@ public: nsDidReflowStatus aStatus); virtual PRBool IsHorizontal() const; virtual PRBool IsNormalDirection() const; virtual ~nsBoxFrame(); Loading Loading @@ -200,6 +202,7 @@ protected: virtual PRBool GetInitialEqualSize(PRBool& aEqualSize); virtual void GetInitialOrientation(PRBool& aIsHorizontal); virtual void GetInitialDirection(PRBool& aIsNormal); virtual PRBool GetInitialHAlignment(Halignment& aHalign); virtual PRBool GetInitialVAlignment(Valignment& aValign); virtual PRBool GetInitialAutoStretch(PRBool& aStretch); Loading
layout/xul/base/src/nsIBox.h +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): * David Hyatt (hyatt@netscape.com) */ /** Loading Loading @@ -95,6 +96,7 @@ public: NS_IMETHOD GetVAlign(Valignment& aAlign) = 0; NS_IMETHOD GetHAlign(Halignment& aAlign) = 0; NS_IMETHOD GetOrientation(PRBool& aIsHorizontal)=0; NS_IMETHOD GetDirection(PRBool& aIsNormal)=0; NS_IMETHOD Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE)=0; NS_IMETHOD NeedsRecalc()=0; NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox)=0; Loading