diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 8a2a32da27f..0a3fdfea9f8 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -250,6 +250,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, break; } psd->mDirection = mBlockReflowState->mStyleDisplay->mDirection; + psd->mChangedFrameDirection = PR_FALSE; } void @@ -461,6 +462,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame, break; } psd->mDirection = aSpanReflowState->mStyleDisplay->mDirection; + psd->mChangedFrameDirection = PR_FALSE; // Switch to new span mCurrentSpan = psd; @@ -1900,6 +1902,20 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) pfd = pfd->mNext; } } + + if (NS_STYLE_DIRECTION_RTL == psd->mDirection && !psd->mChangedFrameDirection) { + psd->mChangedFrameDirection = PR_TRUE; + + /* Assume that all frames have been right aligned.*/ + PerFrameData* pfd = psd->mFirstFrame; + PRUint32 maxX = psd->mRightEdge; + while (nsnull != pfd) { + pfd->mBounds.x = maxX - pfd->mBounds.width; + pfd->mFrame->SetRect(pfd->mBounds); + maxX = pfd->mBounds.x; + pfd = pfd->mNext; + } + } } } diff --git a/mozilla/layout/generic/nsLineLayout.h b/mozilla/layout/generic/nsLineLayout.h index 8c2ade7c60f..d1b5636dcf6 100644 --- a/mozilla/layout/generic/nsLineLayout.h +++ b/mozilla/layout/generic/nsLineLayout.h @@ -296,6 +296,7 @@ public: const nsHTMLReflowState* mReflowState; PRBool mNoWrap; PRUint8 mDirection; + PRBool mChangedFrameDirection; nscoord mLeftEdge; nscoord mX; diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 8a2a32da27f..0a3fdfea9f8 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -250,6 +250,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, break; } psd->mDirection = mBlockReflowState->mStyleDisplay->mDirection; + psd->mChangedFrameDirection = PR_FALSE; } void @@ -461,6 +462,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame, break; } psd->mDirection = aSpanReflowState->mStyleDisplay->mDirection; + psd->mChangedFrameDirection = PR_FALSE; // Switch to new span mCurrentSpan = psd; @@ -1900,6 +1902,20 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) pfd = pfd->mNext; } } + + if (NS_STYLE_DIRECTION_RTL == psd->mDirection && !psd->mChangedFrameDirection) { + psd->mChangedFrameDirection = PR_TRUE; + + /* Assume that all frames have been right aligned.*/ + PerFrameData* pfd = psd->mFirstFrame; + PRUint32 maxX = psd->mRightEdge; + while (nsnull != pfd) { + pfd->mBounds.x = maxX - pfd->mBounds.width; + pfd->mFrame->SetRect(pfd->mBounds); + maxX = pfd->mBounds.x; + pfd = pfd->mNext; + } + } } } diff --git a/mozilla/layout/html/base/src/nsLineLayout.h b/mozilla/layout/html/base/src/nsLineLayout.h index 8c2ade7c60f..d1b5636dcf6 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.h +++ b/mozilla/layout/html/base/src/nsLineLayout.h @@ -296,6 +296,7 @@ public: const nsHTMLReflowState* mReflowState; PRBool mNoWrap; PRUint8 mDirection; + PRBool mChangedFrameDirection; nscoord mLeftEdge; nscoord mX;