Bug 1097499 part 12 - Handle spacing sensibly for text-combine-upright. r=jfkthame
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 22 Apr 2016 09:18:41 +1000
changeset 332279 d238e12a7f717b577ecceefa4e8e93951ee9437c
parent 332278 f851031ac21e42334c1e63cc20b3b4639ad98658
child 332280 45acf5ee3c4222765919340d3f7abace373bab56
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1097499
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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(