Title: [219544] trunk/Source/WebCore
Revision
219544
Author
mmaxfi...@apple.com
Date
2017-07-15 23:08:41 -0700 (Sat, 15 Jul 2017)

Log Message

Rename RenderStyle::fontSize() to RenderStyle::computedFontPixelSize()
https://bugs.webkit.org/show_bug.cgi?id=174509

Reviewed by Simon Fraser.

We have three font size functions:
- computedFontSize(): returns a float
- specifiedFontSize(): also returns a float
- fontSize(): returns the rounded computedFontSize()

FontDescription uses the convention of labelling rounded values as "pixel",
so a better name font fontSize() is computedFontPixelSize().

Also, because font sizes can never be negative, switch the type from an int
to an unsigned.

No new tests because there is no behavior change.

* accessibility/atk/WebKitAccessibleInterfaceText.cpp:
(getAttributeSetForAccessibilityObject):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::computedPixelSize):
(WebCore::FontDescription::fontSelectionRequest):
* rendering/RenderBlock.cpp:
(WebCore::styleForFirstLetter):
* rendering/RenderRubyRun.cpp:
(WebCore::shouldOverhang):
(WebCore::RenderRubyRun::getOverhang):
* rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
* rendering/RenderThemeGtk.cpp:
(WebCore::adjustSearchFieldIconStyle):
(WebCore::paintSearchFieldIcon):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustCheckboxStyle):
(WebCore::RenderThemeIOS::adjustRadioStyle):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::controlSizeForFont):
(WebCore::RenderThemeMac::controlSizeForSystemFont):
(WebCore::RenderThemeMac::paintMenuListButtonDecorations):
(WebCore::RenderThemeMac::popupInternalPaddingBox):
(WebCore::RenderThemeMac::adjustMenuListButtonStyle):
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle):
(WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle):
(WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle):
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::computeLineVerticalStretch):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::computedFontPixelSize):
(WebCore::RenderStyle::computedLineHeight):
(WebCore::RenderStyle::fontSize): Deleted.
* rendering/style/RenderStyle.h:
* style/InlineTextBoxStyle.cpp:
(WebCore::visualOverflowForDecorations):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
* svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS):
(WebCore::SVGLengthContext::convertValueFromEMSToUserUnits):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219543 => 219544)


--- trunk/Source/WebCore/ChangeLog	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/ChangeLog	2017-07-16 06:08:41 UTC (rev 219544)
@@ -1,5 +1,72 @@
 2017-07-15  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        Rename RenderStyle::fontSize() to RenderStyle::computedFontPixelSize()
+        https://bugs.webkit.org/show_bug.cgi?id=174509
+
+        Reviewed by Simon Fraser.
+
+        We have three font size functions:
+        - computedFontSize(): returns a float
+        - specifiedFontSize(): also returns a float
+        - fontSize(): returns the rounded computedFontSize()
+
+        FontDescription uses the convention of labelling rounded values as "pixel",
+        so a better name font fontSize() is computedFontPixelSize().
+
+        Also, because font sizes can never be negative, switch the type from an int
+        to an unsigned.
+
+        No new tests because there is no behavior change.
+
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
+        (getAttributeSetForAccessibilityObject):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * platform/graphics/FontDescription.h:
+        (WebCore::FontDescription::computedPixelSize):
+        (WebCore::FontDescription::fontSelectionRequest):
+        * rendering/RenderBlock.cpp:
+        (WebCore::styleForFirstLetter):
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::shouldOverhang):
+        (WebCore::RenderRubyRun::getOverhang):
+        * rendering/RenderRubyText.cpp:
+        (WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::adjustSearchFieldIconStyle):
+        (WebCore::paintSearchFieldIcon):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::adjustCheckboxStyle):
+        (WebCore::RenderThemeIOS::adjustRadioStyle):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::controlSizeForFont):
+        (WebCore::RenderThemeMac::controlSizeForSystemFont):
+        (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
+        (WebCore::RenderThemeMac::popupInternalPaddingBox):
+        (WebCore::RenderThemeMac::adjustMenuListButtonStyle):
+        * rendering/RenderThemeWin.cpp:
+        (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle):
+        (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle):
+        (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle):
+        * rendering/TextDecorationPainter.cpp:
+        (WebCore::TextDecorationPainter::paintTextDecoration):
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::computeLineVerticalStretch):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::computedFontPixelSize):
+        (WebCore::RenderStyle::computedLineHeight):
+        (WebCore::RenderStyle::fontSize): Deleted.
+        * rendering/style/RenderStyle.h:
+        * style/InlineTextBoxStyle.cpp:
+        (WebCore::visualOverflowForDecorations):
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::resolveElement):
+        * svg/SVGLengthContext.cpp:
+        (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS):
+        (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits):
+
+2017-07-15  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         line-height: <number> gets visually applied twice when text autosizing is in effect
         https://bugs.webkit.org/show_bug.cgi?id=174536
         <rdar://problem/33338259>

Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (219543 => 219544)


--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -87,7 +87,7 @@
     auto* style = &renderer->style();
 
     AtkAttributeSet* result = nullptr;
-    GUniquePtr<gchar> buffer(g_strdup_printf("%i", style->fontSize()));
+    GUniquePtr<gchar> buffer(g_strdup_printf("%i", style->computedFontPixelSize()));
     result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_SIZE), buffer.get());
 
     Color bgColor = style->visitedDependentColor(CSSPropertyBackgroundColor);

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (219543 => 219544)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -1007,7 +1007,7 @@
 
     // Important: Intrinsic margins get added to controls before the theme has adjusted the style, since the theme will
     // alter fonts and heights/widths.
-    if (is<HTMLFormControlElement>(element) && style.fontSize() >= 11) {
+    if (is<HTMLFormControlElement>(element) && style.computedFontPixelSize() >= 11) {
         // Don't apply intrinsic margins to image buttons. The designer knows how big the images are,
         // so we have to treat all image buttons as though they were explicitly sized.
         if (!is<HTMLInputElement>(*element) || !downcast<HTMLInputElement>(*element).isImageButton())

Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (219543 => 219544)


--- trunk/Source/WebCore/platform/graphics/FontDescription.h	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h	2017-07-16 06:08:41 UTC (rev 219544)
@@ -63,11 +63,11 @@
     bool operator!=(const FontDescription& other) const { return !(*this == other); }
 
     float computedSize() const { return m_computedSize; }
+    unsigned computedPixelSize() const { return unsigned(m_computedSize + 0.5f); }
     FontSelectionValue italic() const { return m_fontSelectionRequest.slope; }
     FontSelectionValue stretch() const { return m_fontSelectionRequest.width; }
     FontSelectionValue weight() const { return m_fontSelectionRequest.weight; }
     FontSelectionRequest fontSelectionRequest() const { return m_fontSelectionRequest; }
-    int computedPixelSize() const { return int(m_computedSize + 0.5f); }
     FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
     TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); }
     UScriptCode script() const { return static_cast<UScriptCode>(m_script); }

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -3117,7 +3117,7 @@
         // Set the font to be one line too big and then ratchet back to get to a precise fit. We can't just set the desired font size based off font height metrics
         // because many fonts bake ascent into the font metrics. Therefore we have to look at actual measured cap height values in order to know when we have a good fit.
         auto newFontDescription = firstLetterStyle.fontDescription();
-        float capRatio = firstLetterStyle.fontMetrics().floatCapHeight() / firstLetterStyle.fontSize();
+        float capRatio = firstLetterStyle.fontMetrics().floatCapHeight() / firstLetterStyle.computedFontPixelSize();
         float startingFontSize = ((firstLetterStyle.initialLetterHeight() - 1) * lineHeight + paragraph->style().fontMetrics().capHeight()) / capRatio;
         newFontDescription.setSpecifiedSize(startingFontSize);
         newFontDescription.setComputedSize(startingFontSize);

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -314,7 +314,7 @@
         return false;
     const RenderStyle& rubyBaseStyle = firstLine ? rubyBase.firstLineStyle() : rubyBase.style();
     const RenderStyle& style = firstLine ? renderer->firstLineStyle() : renderer->style();
-    return style.fontSize() <= rubyBaseStyle.fontSize();
+    return style.computedFontPixelSize() <= rubyBaseStyle.computedFontPixelSize();
 }
 
 void RenderRubyRun::getOverhang(bool firstLine, RenderObject* startRenderer, RenderObject* endRenderer, float& startOverhang, float& endOverhang) const
@@ -353,7 +353,7 @@
     // We can overhang the ruby by no more than half the width of the neighboring text
     // and no more than half the font size.
     const RenderStyle& rubyTextStyle = firstLine ? rubyText->firstLineStyle() : rubyText->style();
-    float halfWidthOfFontSize = rubyTextStyle.fontSize() / 2.;
+    float halfWidthOfFontSize = rubyTextStyle.computedFontPixelSize() / 2.;
     if (startOverhang)
         startOverhang = std::min(startOverhang, std::min(downcast<RenderText>(*startRenderer).minLogicalWidth(), halfWidthOfFontSize));
     if (endOverhang)

Modified: trunk/Source/WebCore/rendering/RenderRubyText.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderRubyText.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderRubyText.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -82,7 +82,7 @@
     // ruby character on each side.
     float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportunityCount + 1);
     if (expansionOpportunityCount)
-        inset = std::min<float>(2 * style().fontSize(), inset);
+        inset = std::min<float>(2 * style().computedFontPixelSize(), inset);
 
     logicalLeft += inset / 2;
     logicalWidth -= inset;

Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -1027,7 +1027,7 @@
 
     // Get the icon size based on the font size.
     auto& icon = static_cast<RenderThemeIconGadget&>(themePart == EntryIconLeft ? searchEntryWidget.leftIcon() : searchEntryWidget.rightIcon());
-    icon.setIconSize(style.fontSize());
+    icon.setIconSize(style.computedFontPixelSize());
     IntSize preferredSize = icon.preferredSize();
     GtkBorder contentsBox = searchEntryWidget.entry().contentsBox();
     if (themePart == EntryIconLeft)
@@ -1074,7 +1074,7 @@
     gtk_style_context_get_padding(context.get(), gtk_style_context_get_state(context.get()), &padding);
 
     // Get the icon size based on the font size.
-    int fontSize = style.fontSize();
+    int fontSize = style.computedFontPixelSize();
     if (fontSize < gtkIconSizeMenu) {
         style.setWidth(Length(fontSize + (padding.left + padding.right), Fixed));
         style.setHeight(Length(fontSize + (padding.top + padding.bottom), Fixed));
@@ -1120,7 +1120,7 @@
     searchEntryWidget.entry().setState(themePartStateFlags(*theme, Entry, renderObject));
     auto& icon = static_cast<RenderThemeIconGadget&>(themePart == EntryIconLeft ? searchEntryWidget.leftIcon() : searchEntryWidget.rightIcon());
     icon.setState(themePartStateFlags(*theme, themePart, renderObject));
-    icon.setIconSize(renderObject.style().fontSize());
+    icon.setIconSize(renderObject.style().computedFontPixelSize());
     GtkBorder contentsBox = searchEntryWidget.entry().contentsBox();
     IntRect iconRect = rect;
     if (themePart == EntryIconLeft) {

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2017-07-16 06:08:41 UTC (rev 219544)
@@ -357,7 +357,7 @@
     if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
         return;
 
-    int size = std::max(style.fontSize(), 10);
+    int size = std::max(style.computedFontPixelSize(), 10U);
     style.setWidth({ size, Fixed });
     style.setHeight({ size, Fixed });
 }
@@ -460,7 +460,7 @@
     if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
         return;
 
-    int size = std::max(style.fontSize(), 10);
+    int size = std::max(style.computedFontPixelSize(), 10U);
     style.setWidth({ size, Fixed });
     style.setHeight({ size, Fixed });
     style.setBorderRadius({ size / 2, size / 2 });

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-07-16 06:08:41 UTC (rev 219544)
@@ -792,7 +792,7 @@
 
 NSControlSize RenderThemeMac::controlSizeForFont(const RenderStyle& style) const
 {
-    int fontSize = style.fontSize();
+    int fontSize = style.computedFontPixelSize();
     if (fontSize >= 16)
         return NSControlSizeRegular;
     if (fontSize >= 11)
@@ -867,7 +867,7 @@
 
 NSControlSize RenderThemeMac::controlSizeForSystemFont(const RenderStyle& style) const
 {
-    int fontSize = style.fontSize();
+    int fontSize = style.computedFontPixelSize();
     if (fontSize >= [NSFont systemFontSizeForControlSize:NSControlSizeRegular])
         return NSControlSizeRegular;
     if (fontSize >= [NSFont systemFontSizeForControlSize:NSControlSizeSmall])
@@ -1318,7 +1318,7 @@
     paintMenuListButtonGradients(renderer, paintInfo, bounds);
 
     // Since we actually know the size of the control here, we restrict the font scale to make sure the arrows will fit vertically in the bounds
-    float fontScale = std::min(renderer.style().fontSize() / baseFontSize, bounds.height() / (baseArrowHeight * 2 + baseSpaceBetweenArrows));
+    float fontScale = std::min(renderer.style().computedFontPixelSize() / baseFontSize, bounds.height() / (baseArrowHeight * 2 + baseSpaceBetweenArrows));
     float centerY = bounds.y() + bounds.height() / 2.0f;
     float arrowHeight = baseArrowHeight * fontScale;
     float arrowWidth = baseArrowWidth * fontScale;
@@ -1422,7 +1422,7 @@
     }
 
     if (style.appearance() == MenulistButtonPart) {
-        float arrowWidth = baseArrowWidth * (style.fontSize() / baseFontSize);
+        float arrowWidth = baseArrowWidth * (style.computedFontPixelSize() / baseFontSize);
         float rightPadding = ceilf(arrowWidth + (arrowPaddingBefore + arrowPaddingAfter + paddingBeforeSeparator) * style.effectiveZoom());
         float leftPadding = styledPopupPaddingLeft * style.effectiveZoom();
         if (style.direction() == RTL)
@@ -1454,7 +1454,7 @@
 
 void RenderThemeMac::adjustMenuListButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
 {
-    float fontScale = style.fontSize() / baseFontSize;
+    float fontScale = style.computedFontPixelSize() / baseFontSize;
 
     style.resetPadding();
     style.setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(baseBorderRadius + fontScale - 1))); // FIXME: Round up?

Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -899,7 +899,7 @@
 void RenderThemeWin::adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
 {
     // Scale the button size based on the font size
-    float fontScale = style.fontSize() / defaultControlFontPixelSize;
+    float fontScale = style.computedFontPixelSize() / defaultControlFontPixelSize;
     int cancelButtonSize = lroundf(min(max(minCancelButtonSize, defaultCancelButtonSize * fontScale), maxCancelButtonSize));
     style.setWidth(Length(cancelButtonSize, Fixed));
     style.setHeight(Length(cancelButtonSize, Fixed));
@@ -915,7 +915,7 @@
 void RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle& style, const Element*) const
 {
     // Scale the decoration size based on the font size
-    float fontScale = style.fontSize() / defaultControlFontPixelSize;
+    float fontScale = style.computedFontPixelSize() / defaultControlFontPixelSize;
     int magnifierSize = lroundf(min(max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale), 
                                      maxSearchFieldResultsDecorationSize));
     style.setWidth(Length(magnifierSize, Fixed));
@@ -947,7 +947,7 @@
 void RenderThemeWin::adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
 {
     // Scale the button size based on the font size
-    float fontScale = style.fontSize() / defaultControlFontPixelSize;
+    float fontScale = style.computedFontPixelSize() / defaultControlFontPixelSize;
     int magnifierHeight = lroundf(min(max(minSearchFieldResultsDecorationSize, defaultSearchFieldResultsDecorationSize * fontScale), 
                                    maxSearchFieldResultsDecorationSize));
     int magnifierWidth = lroundf(magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize);

Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -258,7 +258,7 @@
     UNUSED_PARAM(textOrigin);
 #endif
     ASSERT(m_font);
-    float textDecorationThickness = textDecorationStrokeThickness(m_lineStyle.fontSize());
+    float textDecorationThickness = textDecorationStrokeThickness(m_lineStyle.computedFontPixelSize());
     m_context.setStrokeThickness(textDecorationThickness);
     FloatPoint localOrigin = boxOrigin;
 
@@ -268,7 +268,7 @@
         auto strokeStyle = textDecorationStyleToStrokeStyle(style);
 
         if (style == TextDecorationStyleWavy)
-            strokeWavyTextDecoration(m_context, start, end, textDecorationThickness, m_lineStyle.fontSize());
+            strokeWavyTextDecoration(m_context, start, end, textDecorationThickness, m_lineStyle.computedFontPixelSize());
         else if (decoration == TextDecorationUnderline || decoration == TextDecorationOverline) {
 #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
             if ((m_lineStyle.textDecorationSkip() == TextDecorationSkipInk || m_lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && m_isHorizontal) {

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -78,7 +78,7 @@
 
     // We ensure a minimal stretch size.
     if (ascent + descent <= 0) {
-        ascent = style().fontSize();
+        ascent = style().computedFontPixelSize();
         descent = 0;
     }
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (219543 => 219544)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -1498,9 +1498,9 @@
     return fontDescription().computedSize();
 }
 
-int RenderStyle::fontSize() const
+unsigned RenderStyle::computedFontPixelSize() const
 {
-    return m_inheritedData->fontCascade.pixelSize();
+    return fontDescription().computedPixelSize();
 }
 
 const Length& RenderStyle::wordSpacing() const
@@ -1559,7 +1559,7 @@
         return fontMetrics().lineSpacing();
 
     if (lh.isPercentOrCalculated())
-        return minimumValueForLength(lh, fontSize());
+        return minimumValueForLength(lh, computedFontPixelSize());
 
     return clampTo<int>(lh.value());
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (219543 => 219544)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2017-07-16 06:08:41 UTC (rev 219544)
@@ -348,7 +348,7 @@
     WEBCORE_EXPORT const FontCascadeDescription& fontDescription() const;
     float specifiedFontSize() const;
     float computedFontSize() const;
-    int fontSize() const;
+    unsigned computedFontPixelSize() const;
     std::pair<FontOrientation, NonCJKGlyphOrientation> fontAndGlyphOrientation();
 
 #if ENABLE(VARIATION_FONTS)

Modified: trunk/Source/WebCore/style/InlineTextBoxStyle.cpp (219543 => 219544)


--- trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/style/InlineTextBoxStyle.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -110,7 +110,7 @@
     if (decoration == TextDecorationNone)
         return GlyphOverflow();
     
-    float strokeThickness = textDecorationStrokeThickness(lineStyle.fontSize());
+    float strokeThickness = textDecorationStrokeThickness(lineStyle.computedFontPixelSize());
     float controlPointDistance = 0;
     float step;
     float wavyOffset = 0;
@@ -120,7 +120,7 @@
     GlyphOverflow overflowResult;
     
     if (decorationStyle == TextDecorationStyleWavy) {
-        getWavyStrokeParameters(lineStyle.fontSize(), controlPointDistance, step);
+        getWavyStrokeParameters(lineStyle.computedFontPixelSize(), controlPointDistance, step);
         wavyOffset = wavyOffsetFromDecoration();
         overflowResult.left = strokeThickness;
         overflowResult.right = strokeThickness;

Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (219543 => 219544)


--- trunk/Source/WebCore/style/StyleTreeResolver.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -194,7 +194,7 @@
         m_documentElementStyle = RenderStyle::clonePtr(*update.style);
         scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
 
-        if (update.change != NoChange && existingStyle && existingStyle->fontSize() != update.style->fontSize()) {
+        if (update.change != NoChange && existingStyle && existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
             // "rem" units are relative to the document element's font size so we need to recompute everything.
             // In practice this is rare.
             scope().styleResolver.invalidateMatchedPropertiesCache();

Modified: trunk/Source/WebCore/svg/SVGLengthContext.cpp (219543 => 219544)


--- trunk/Source/WebCore/svg/SVGLengthContext.cpp	2017-07-16 05:52:30 UTC (rev 219543)
+++ trunk/Source/WebCore/svg/SVGLengthContext.cpp	2017-07-16 06:08:41 UTC (rev 219544)
@@ -242,7 +242,7 @@
     if (!style)
         return Exception { NOT_SUPPORTED_ERR };
 
-    float fontSize = style->fontSize();
+    float fontSize = style->computedFontPixelSize();
     if (!fontSize)
         return Exception { NOT_SUPPORTED_ERR };
 
@@ -255,7 +255,7 @@
     if (!style)
         return Exception { NOT_SUPPORTED_ERR };
 
-    return value * style->fontSize();
+    return value * style->computedFontPixelSize();
 }
 
 ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to