Bug 1116635 - Fix interaction between ruby alignment and trimmed whitespace. r=roc

--HG--
extra : rebase_source : 02452c197129f05cee9ebf1a868c166c3b5c7880
extra : source : 0d467e9425a4a48d358e65227d6f5f0812e8dd0c
This commit is contained in:
Xidorn Quan 2015-01-07 12:47:09 +11:00
Родитель 58fd48c4de
Коммит 9a562a2e2b
5 изменённых файлов: 66 добавлений и 6 удалений

Просмотреть файл

@ -2504,6 +2504,21 @@ nsLineLayout::TrimTrailingWhiteSpace()
return 0 != deltaISize; return 0 != deltaISize;
} }
bool
nsLineLayout::PerFrameData::ParticipatesInJustification() const
{
if (mIsBullet || mIsEmpty || mSkipWhenTrimmingWhitespace) {
// Skip bullets, empty frames, and placeholders
return false;
}
if (mIsTextFrame && !mIsNonWhitespaceTextFrame &&
static_cast<nsTextFrame*>(mFrame)->IsAtEndOfLine()) {
// Skip trimmed whitespaces
return false;
}
return true;
}
struct nsLineLayout::JustificationComputationState struct nsLineLayout::JustificationComputationState
{ {
PerFrameData* mFirstParticipant; PerFrameData* mFirstParticipant;
@ -2578,6 +2593,7 @@ nsLineLayout::ComputeFrameJustification(PerSpanData* aPSD,
// and ruby align could be strange. // and ruby align could be strange.
prevAssign.mGapsAtEnd = 1; prevAssign.mGapsAtEnd = 1;
assign.mGapsAtStart = 1; assign.mGapsAtStart = 1;
aState.mCrossingRubyBaseBoundary = false;
} else if (!info.mIsStartJustifiable) { } else if (!info.mIsStartJustifiable) {
prevAssign.mGapsAtEnd = 2; prevAssign.mGapsAtEnd = 2;
assign.mGapsAtStart = 0; assign.mGapsAtStart = 0;
@ -2592,7 +2608,10 @@ nsLineLayout::ComputeFrameJustification(PerSpanData* aPSD,
} }
aState.mLastParticipant = pfd; aState.mLastParticipant = pfd;
aState.mCrossingRubyBaseBoundary = isRubyBase; }
if (isRubyBase) {
aState.mCrossingRubyBaseBoundary = true;
} }
if (firstChild) { if (firstChild) {

Просмотреть файл

@ -496,11 +496,7 @@ protected:
return mJustificationInfo.mIsEndJustifiable; return mJustificationInfo.mIsEndJustifiable;
} }
bool ParticipatesInJustification() const bool ParticipatesInJustification() const;
{
// Skip bullets and empty frames
return !mIsBullet && !mIsEmpty;
}
}; };
PerFrameData* mFrameFreeList; PerFrameData* mFrameFreeList;

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Bug 1116631 - Justification with ruby span</title>
<link rel="stylesheet" href="common.css">
<style>
div {
ruby-position: under left;
width: 300px; height: 100px;
-moz-text-align-last: justify;
overflow: auto;
text-decoration: underline;
}
</style>
</head>
<body>
<div><rb></rb><rb></rb><rt></rt><rt></rt></div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Bug 1116631 - Justification with ruby span</title>
<link rel="stylesheet" href="common.css">
<style>
div {
ruby-position: under left;
width: 300px; height: 100px;
-moz-text-align-last: justify;
overflow: auto;
text-decoration: underline;
}
</style>
</head>
<body>
<div>
<rb></rb><rb></rb>
<rt></rt><rt></rt>
<!-- -->
</div>
</body>
</html>

Просмотреть файл

@ -21,6 +21,7 @@ fuzzy-if(winWidget,28,1) == dynamic-removal-3.html dynamic-removal-3-ref.html #
== inlinize-blocks-4.html inlinize-blocks-4-ref.html == inlinize-blocks-4.html inlinize-blocks-4-ref.html
== inlinize-blocks-5.html inlinize-blocks-5-ref.html == inlinize-blocks-5.html inlinize-blocks-5-ref.html
== justification-1.html justification-1-ref.html == justification-1.html justification-1-ref.html
== justification-2.html justification-2-ref.html
== ruby-whitespace-1.html ruby-whitespace-1-ref.html == ruby-whitespace-1.html ruby-whitespace-1-ref.html
== ruby-whitespace-2.html ruby-whitespace-2-ref.html == ruby-whitespace-2.html ruby-whitespace-2-ref.html
== ruby-position-horizontal.html ruby-position-horizontal-ref.html == ruby-position-horizontal.html ruby-position-horizontal-ref.html