diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 54de0260fdf4..e887a0949e79 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1575,11 +1575,14 @@ nsBlockFrame::MarkLineDirty(line_iterator aLine, const nsLineList* aLineList) * Test whether lines are certain to be aligned left so that we can make * resizing optimizations */ -bool static inline IsAlignedLeft(const PRUint8 aAlignment, - const PRUint8 aDirection, - const PRUint8 aUnicodeBidi) +static inline bool +IsAlignedLeft(PRUint8 aAlignment, + PRUint8 aDirection, + PRUint8 aUnicodeBidi, + nsIFrame* aFrame) { - return (NS_STYLE_TEXT_ALIGN_LEFT == aAlignment || + return (aFrame->IsSVGText() || + NS_STYLE_TEXT_ALIGN_LEFT == aAlignment || ((NS_STYLE_TEXT_ALIGN_DEFAULT == aAlignment && NS_STYLE_DIRECTION_LTR == aDirection) || (NS_STYLE_TEXT_ALIGN_END == aAlignment && @@ -1597,7 +1600,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) // The text must be left-aligned. IsAlignedLeft(styleText->mTextAlign, aState.mReflowState.mStyleVisibility->mDirection, - styleTextReset->mUnicodeBidi) && + styleTextReset->mUnicodeBidi, + this) && // The left content-edge must be a constant distance from the left // border-edge. !GetStylePadding()->mPadding.GetLeft().HasPercent(); @@ -1636,7 +1640,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) bool skipLastLine = NS_STYLE_TEXT_ALIGN_AUTO == styleText->mTextAlignLast || IsAlignedLeft(styleText->mTextAlignLast, aState.mReflowState.mStyleVisibility->mDirection, - styleTextReset->mUnicodeBidi); + styleTextReset->mUnicodeBidi, + this); for (line_iterator line = begin_lines(), line_end = end_lines(); line != line_end; @@ -4248,15 +4253,17 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, /** * text-align-last defaults to the same value as text-align when - * text-align-last is set to auto (unless when text-align is set to justify), + * text-align-last is set to auto (except when text-align is set to justify), * so in that case we don't need to set isLastLine. * * In other words, isLastLine really means isLastLineAndWeCare. */ - bool isLastLine = ((NS_STYLE_TEXT_ALIGN_AUTO != styleText->mTextAlignLast || - NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign) && - (aLineLayout.GetLineEndsInBR() || - IsLastLine(aState, aLine))); + bool isLastLine = + !IsSVGText() && + ((NS_STYLE_TEXT_ALIGN_AUTO != styleText->mTextAlignLast || + NS_STYLE_TEXT_ALIGN_JUSTIFY == styleText->mTextAlign) && + (aLineLayout.GetLineEndsInBR() || + IsLastLine(aState, aLine))); aLineLayout.HorizontalAlignFrames(aLine->mBounds, isLastLine); // XXX: not only bidi: right alignment can be broken after // RelativePositionFrames!!! diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 230060dd267b..b1a9f1e3240c 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -2472,7 +2472,8 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, #endif nscoord dx = 0; - if (remainingWidth > 0) { + if (remainingWidth > 0 && + !(mBlockReflowState->frame->IsSVGText())) { PRUint8 textAlign = mStyleText->mTextAlign; /* diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 914d4b553c72..f2aa602e7c6e 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -1773,7 +1773,8 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) nsTextFrame* nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex); bool enabledJustification = mLineContainer && (mLineContainer->GetStyleText()->mTextAlign == NS_STYLE_TEXT_ALIGN_JUSTIFY || - mLineContainer->GetStyleText()->mTextAlignLast == NS_STYLE_TEXT_ALIGN_JUSTIFY); + mLineContainer->GetStyleText()->mTextAlignLast == NS_STYLE_TEXT_ALIGN_JUSTIFY) && + !mLineContainer->IsSVGText(); // for word-break style switch (mLineContainer->GetStyleText()->mWordBreak) { @@ -7749,7 +7750,8 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, // Compute space and letter counts for justification, if required if (!textStyle->WhiteSpaceIsSignificant() && (lineContainer->GetStyleText()->mTextAlign == NS_STYLE_TEXT_ALIGN_JUSTIFY || - lineContainer->GetStyleText()->mTextAlignLast == NS_STYLE_TEXT_ALIGN_JUSTIFY)) { + lineContainer->GetStyleText()->mTextAlignLast == NS_STYLE_TEXT_ALIGN_JUSTIFY) && + !lineContainer->IsSVGText()) { AddStateBits(TEXT_JUSTIFICATION_ENABLED); // This will include a space for trailing whitespace, if any is present. // This is corrected for in nsLineLayout::TrimWhiteSpaceIn. PRInt32 numJustifiableCharacters =