зеркало из https://github.com/mozilla/gecko-dev.git
Bug 655877 - Part 10: Ignore text-align and text-align-end in SVG text frames. r=roc
This commit is contained in:
Родитель
65b97328f1
Коммит
bd8a092ab9
|
@ -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!!!
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 =
|
||||
|
|
Загрузка…
Ссылка в новой задаче