Bug 1358688 - Part 1: Don't unzoom text for font-size:larger/smaller ; r?emilio draft
authorManish Goregaokar <manishearth@gmail.com>
Fri, 28 Jul 2017 17:31:06 -0700
changeset 619790 de231c50d7021a10073cb2b7b4a56f0bc845409d
parent 619789 d65fe59f8cca5bb041d2246ef1605a150b7acf3b
child 619791 e8a37f244a9fd508284d0643bd701c4ab3367e7d
push id71810
push userbmo:manishearth@gmail.com
push dateWed, 02 Aug 2017 16:25:27 +0000
reviewersemilio
bugs1358688, 1361550
milestone56.0a1
Bug 1358688 - Part 1: Don't unzoom text for font-size:larger/smaller ; r?emilio This used to be necessary when larger/smaller did a table lookup. However as of bug 1361550 these are simple ratios and should be treated the same as em units. MozReview-Commit-ID: EVzHe0B878K
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3483,29 +3483,21 @@ nsRuleNode::SetFontSize(nsPresContext* a
     else if (NS_STYLE_FONT_SIZE_XXXLARGE == value) {
       // <font size="7"> is not specified in CSS, so we don't use eFontSize_CSS.
       *aSize = CalcFontPointSize(value, baseSize, aPresContext);
     }
     else if (NS_STYLE_FONT_SIZE_LARGER  == value ||
              NS_STYLE_FONT_SIZE_SMALLER == value) {
       aConditions.SetUncacheable();
 
-      // Un-zoom so we use the tables correctly.  We'll then rezoom due
-      // to the |zoom = true| above.
-      // Note that relative units here use the parent's size unadjusted
-      // for scriptlevel changes. A scriptlevel change between us and the parent
-      // is simply ignored.
-      nscoord parentSize = aParentSize;
-      if (aParentFont->mAllowZoom) {
-        parentSize = nsStyleFont::UnZoomText(aPresContext, parentSize);
-      }
-
       float factor = (NS_STYLE_FONT_SIZE_LARGER == value) ? 1.2f : (1.0f / 1.2f);
 
-      *aSize = parentSize * factor;
+      *aSize = NSToCoordFloorClamped(aParentSize * factor);
+
+      sizeIsZoomedAccordingToParent = true;
 
     } else {
       NS_NOTREACHED("unexpected value");
     }
   }
   else if (sizeValue->IsLengthUnit() ||
            sizeValue->GetUnit() == eCSSUnit_Percent ||
            sizeValue->IsCalcUnit()) {