Bug 1097499 part 12 - Handle spacing sensibly for text-combine-upright. r=jfkthame
MozReview-Commit-ID: DSBMUcccfNi
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -3072,16 +3072,26 @@ static void FindClusterEnd(gfxTextRun* a
aPos->AdvanceOriginal(1);
}
aPos->AdvanceOriginal(-1);
}
void
PropertyProvider::ComputeJustification(Range aRange)
{
+ // Horizontal-in-vertical frame is orthogonal to the line, so it
+ // doesn't actually include any justification opportunity inside.
+ // Note: although the spec says such frame should be treated as a
+ // U+FFFC, which indicates it is justifiable on its sides, we don't
+ // do that because it is difficult to implement, and doesn't make
+ // any difference in common use cases.
+ if (mFrame->StyleContext()->IsTextCombined()) {
+ return;
+ }
+
bool isCJ = IsChineseOrJapanese(mFrame);
nsSkipCharsRunIterator run(
mStart, nsSkipCharsRunIterator::LENGTH_INCLUDES_SKIPPED, aRange.Length());
run.SetOriginalOffset(aRange.start);
mJustificationArrayStart = run.GetSkippedOffset();
MOZ_ASSERT(mJustificationAssignments.IsEmpty());
mJustificationAssignments.SetCapacity(aRange.Length());
@@ -3165,16 +3175,20 @@ PropertyProvider::GetSpacingInternal(Ran
NS_PRECONDITION(IsInBounds(mStart, mLength, aRange), "Range out of bounds");
uint32_t index;
for (index = 0; index < aRange.Length(); ++index) {
aSpacing[index].mBefore = 0.0;
aSpacing[index].mAfter = 0.0;
}
+ if (mFrame->StyleContext()->IsTextCombined()) {
+ return;
+ }
+
// Find our offset into the original+transformed string
gfxSkipCharsIterator start(mStart);
start.SetSkippedOffset(aRange.start);
// First, compute the word and letter spacing
if (mWordSpacing || mLetterSpacing) {
// Iterate over non-skipped characters
nsSkipCharsRunIterator run(