Bug 1277937 - Fix SELECTION_URLSTRIKEOUT. r?jfkthame draft
authorXidorn Quan <quanxunzhen@gmail.com>
Sun, 05 Jun 2016 08:21:27 +0100
changeset 375508 2ad903b2da5d779aa3b28d911a9233d8bc2a8f5f
parent 375369 3e8ee3599a67edd971770af4982ad4b0fe77f073
child 522880 133450e061892ce43fd8ba5109819107e6a6dc53
push id20288
push userquanxunzhen@gmail.com
push dateSun, 05 Jun 2016 20:30:56 +0000
reviewersjfkthame
bugs1277937
milestone49.0a1
Bug 1277937 - Fix SELECTION_URLSTRIKEOUT. r?jfkthame 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