Bug 1097499 part 12 - Handle spacing sensibly for text-combine-upright. r=jfkthame draft
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 24 Mar 2016 16:52:36 +0800
changeset 354607 3c592b11a04e25440ac9fcde2f43b74affe1b61a
parent 354606 9b95f410436c854888c450df167deda2544795ac
child 354608 926696f141e77e3197fcf24d963368337e6c1855
push id16138
push userxquan@mozilla.com
push dateThu, 21 Apr 2016 11:18:53 +0000
reviewersjfkthame
bugs1097499
milestone48.0a1
Bug 1097499 part 12 - Handle spacing sensibly for text-combine-upright. r=jfkthame MozReview-Commit-ID: DSBMUcccfNi
layout/generic/nsTextFrame.cpp
--- 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(