Bug 1277937 - Fix SELECTION_URLSTRIKEOUT. r=jfkthame, a=lizzard
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 07 Jun 2016 16:12:15 -0700
changeset 341645 109773972727d0665e1be98b4e733bc70fb1e069
parent 341644 839310c1fc4f83fd3a6bac496b074ebb0b47ff59
child 341646 e5301bb031fb4cc1f0ed334a1462a841b51d17c9
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame, lizzard
bugs1277937
milestone49.0a2
Bug 1277937 - Fix SELECTION_URLSTRIKEOUT. r=jfkthame, a=lizzard MozReview-Commit-ID: LumW94mTX4X
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5516,19 +5516,18 @@ nsTextFrame::DrawSelectionDecorations(gf
   PaintDecorationLineParams params;
   params.context = aContext;
   params.dirtyRect = aDirtyRect;
   params.pt = aPt;
   params.lineSize = Size(
       aWidth, ComputeSelectionUnderlineHeight(aTextPaintStyle.PresContext(),
                                               aFontMetrics, aType));
   params.ascent = aAscent;
-  gfxFloat offset = aDecoration == NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE ?
-                      aFontMetrics.underlineOffset : aFontMetrics.maxAscent;
-  params.offset = offset * aDecorationOffsetDir;
+  params.offset = aDecoration == NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE ?
+                  aFontMetrics.underlineOffset : aFontMetrics.maxAscent;
   params.decoration = aDecoration;
   params.decorationType = DecorationType::Selection;
   params.callbacks = aCallbacks;
   params.vertical = aVertical;
   params.descentLimit =
     ComputeDescentLimitForSelectionUnderline(aTextPaintStyle.PresContext(),
                                              aFontMetrics);
 
@@ -5608,24 +5607,25 @@ nsTextFrame::DrawSelectionDecorations(gf
       nscoord inflationMinFontSize =
         nsLayoutUtils::InflationMinFontSizeFor(this);
       float inflation =
         GetInflationForTextDecorations(this, inflationMinFontSize);
       const gfxFont::Metrics metrics =
         GetFirstFontMetrics(GetFontGroupForFrame(this, inflation), aVertical);
 
       relativeSize = 2.0f;
-      offset = metrics.strikeoutOffset + 0.5;
-      aDecoration = NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
+      params.offset = metrics.strikeoutOffset + 0.5;
+      params.decoration = NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
       break;
     }
     default:
       NS_WARNING("Requested selection decorations when there aren't any");
       return;
   }
+  params.offset *= aDecorationOffsetDir;
   params.lineSize.height *= relativeSize;
   params.icoordInFrame = (aVertical ? params.pt.y - aPt.y
                                     : params.pt.x - aPt.x) + aICoordInFrame;
   PaintDecorationLine(params);
 }
 
 /* static */
 bool