Bug 1117227 part 3 - Make nsTextFrame::MeasureCharClippedText use frame isize instead of width. r=roc
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 24 Apr 2015 10:15:32 +1200
changeset 240824 34d73ad5090a8fbaad4c80063156a193b9df8d8f
parent 240823 303979c9c80d53436b39ffdd1c6d332471e43292
child 240825 d33657df2b288d5612bf61587bc04654d77ac916
push id58940
push userxquan@mozilla.com
push dateThu, 23 Apr 2015 22:19:58 +0000
treeherdermozilla-inbound@58f1b4f600d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1117227
milestone40.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 1117227 part 3 - Make nsTextFrame::MeasureCharClippedText use frame isize instead of width. r=roc
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -6003,17 +6003,17 @@ nsTextFrame::MeasureCharClippedText(Prop
   *aSnappedLeftEdge = 0;
   *aSnappedRightEdge = 0;
   if (aLeftEdge <= 0 && aRightEdge <= 0) {
     return true;
   }
 
   uint32_t offset = *aStartOffset;
   uint32_t maxLength = *aMaxLength;
-  const nscoord frameWidth = GetSize().width;
+  const nscoord frameISize = ISize();
   const bool rtl = mTextRun->IsRightToLeft();
   gfxFloat advanceWidth = 0;
   const nscoord startEdge = rtl ? aRightEdge : aLeftEdge;
   if (startEdge > 0) {
     const gfxFloat maxAdvance = gfxFloat(startEdge);
     while (maxLength > 0) {
       uint32_t clusterLength =
         GetClusterLength(mTextRun, offset, maxLength, rtl);
@@ -6027,33 +6027,33 @@ nsTextFrame::MeasureCharClippedText(Prop
     }
     nscoord* snappedStartEdge = rtl ? aSnappedRightEdge : aSnappedLeftEdge;
     *snappedStartEdge = NSToCoordFloor(advanceWidth);
     *aStartOffset = offset;
   }
 
   const nscoord endEdge = rtl ? aLeftEdge : aRightEdge;
   if (endEdge > 0) {
-    const gfxFloat maxAdvance = gfxFloat(frameWidth - endEdge);
+    const gfxFloat maxAdvance = gfxFloat(frameISize - endEdge);
     while (maxLength > 0) {
       uint32_t clusterLength =
         GetClusterLength(mTextRun, offset, maxLength, rtl);
       gfxFloat nextAdvance = advanceWidth +
         mTextRun->GetAdvanceWidth(offset, clusterLength, &aProvider);
       if (nextAdvance > maxAdvance) {
         break;
       }
       // This cluster fits, include it.
       advanceWidth = nextAdvance;
       maxLength -= clusterLength;
       offset += clusterLength;
     }
     maxLength = offset - *aStartOffset;
     nscoord* snappedEndEdge = rtl ? aSnappedLeftEdge : aSnappedRightEdge;
-    *snappedEndEdge = NSToCoordFloor(gfxFloat(frameWidth) - advanceWidth);
+    *snappedEndEdge = NSToCoordFloor(gfxFloat(frameISize) - advanceWidth);
   }
   *aMaxLength = maxLength;
   return maxLength != 0;
 }
 
 void
 nsTextFrame::PaintShadows(nsCSSShadowArray* aShadow,
                           uint32_t aOffset, uint32_t aLength,