Rename RenderStyle::fontSize() to RenderStyle::computedFontPixelSize()
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Jul 2017 06:08:41 +0000 (06:08 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Jul 2017 06:08:41 +0000 (06:08 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderRubyRun.cpp
Source/WebCore/rendering/RenderRubyText.cpp
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/TextDecorationPainter.cpp
Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/style/InlineTextBoxStyle.cpp
Source/WebCore/style/StyleTreeResolver.cpp
Source/WebCore/svg/SVGLengthContext.cpp

index 5cb4c82..009e8db 100644 (file)
@@ -1,5 +1,72 @@
 2017-07-15  Myles C. Maxfield  <mmaxfield@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  <mmaxfield@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>
index 8119d08..9e51c5c 100644 (file)
@@ -87,7 +87,7 @@ static AtkAttributeSet* getAttributeSetForAccessibilityObject(const Accessibilit
     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);
index 5277935..323a252 100644 (file)
@@ -1007,7 +1007,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
 
     // 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())
index 786faa6..4e2455f 100644 (file)
@@ -63,11 +63,11 @@ public:
     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); }
index 951f658..2b4149a 100644 (file)
@@ -3117,7 +3117,7 @@ static RenderStyle styleForFirstLetter(const RenderElement& firstLetterBlock, co
         // 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);
index 0428ada..b620a7b 100644 (file)
@@ -314,7 +314,7 @@ static bool shouldOverhang(bool firstLine, const RenderObject* renderer, const R
         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 @@ void RenderRubyRun::getOverhang(bool firstLine, RenderObject* startRenderer, Ren
     // 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)
index 2fc437e..73e690e 100644 (file)
@@ -82,7 +82,7 @@ void RenderRubyText::adjustInlineDirectionLineBounds(int expansionOpportunityCou
     // 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;
index 04e0bee..18a2452 100644 (file)
@@ -1027,7 +1027,7 @@ static void adjustSearchFieldIconStyle(RenderThemePart themePart, RenderStyle& s
 
     // 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 @@ static void adjustSearchFieldIconStyle(RenderThemePart themePart, RenderStyle& s
     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 @@ static bool paintSearchFieldIcon(RenderThemeGtk* theme, RenderThemePart themePar
     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) {
index 0900fc4..c7016f6 100644 (file)
@@ -357,7 +357,7 @@ void RenderThemeIOS::adjustCheckboxStyle(StyleResolver&, RenderStyle& style, con
     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 @@ void RenderThemeIOS::adjustRadioStyle(StyleResolver&, RenderStyle& style, const
     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 });
index 16498ad..11f9d7c 100644 (file)
@@ -792,7 +792,7 @@ bool RenderThemeMac::controlSupportsTints(const RenderObject& o) const
 
 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 @@ void RenderThemeMac::setFontFromControlSize(StyleResolver&, RenderStyle& style,
 
 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 @@ bool RenderThemeMac::paintMenuListButtonDecorations(const RenderBox& renderer, c
     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 @@ LengthBox RenderThemeMac::popupInternalPaddingBox(const RenderStyle& style) cons
     }
 
     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 @@ PopupMenuStyle::PopupMenuSize RenderThemeMac::popupMenuSize(const RenderStyle& s
 
 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?
index 34e8078..41e92cf 100644 (file)
@@ -899,7 +899,7 @@ bool RenderThemeWin::paintSearchFieldCancelButton(const RenderBox& o, const Pain
 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::adjustSearchFieldDecorationPartStyle(StyleResolver&, Render
 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 @@ bool RenderThemeWin::paintSearchFieldResultsDecorationPart(const RenderBox& o, c
 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);
index f771d09..cc8acd0 100644 (file)
@@ -258,7 +258,7 @@ void TextDecorationPainter::paintTextDecoration(const TextRun& textRun, const Fl
     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 @@ void TextDecorationPainter::paintTextDecoration(const TextRun& textRun, const Fl
         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) {
index c4bebc2..c9ac06e 100644 (file)
@@ -78,7 +78,7 @@ void RenderMathMLRow::computeLineVerticalStretch(LayoutUnit& ascent, LayoutUnit&
 
     // We ensure a minimal stretch size.
     if (ascent + descent <= 0) {
-        ascent = style().fontSize();
+        ascent = style().computedFontPixelSize();
         descent = 0;
     }
 }
index ce51d3f..a1371bd 100644 (file)
@@ -1498,9 +1498,9 @@ float RenderStyle::computedFontSize() const
     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 @@ int RenderStyle::computedLineHeight() const
         return fontMetrics().lineSpacing();
 
     if (lh.isPercentOrCalculated())
-        return minimumValueForLength(lh, fontSize());
+        return minimumValueForLength(lh, computedFontPixelSize());
 
     return clampTo<int>(lh.value());
 }
index 4b215a9..bf09400 100644 (file)
@@ -348,7 +348,7 @@ public:
     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)
index abbb1f9..80d21d8 100644 (file)
@@ -110,7 +110,7 @@ GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const I
     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 visualOverflowForDecorations(const RenderStyle& lineStyle, const I
     GlyphOverflow overflowResult;
     
     if (decorationStyle == TextDecorationStyleWavy) {
-        getWavyStrokeParameters(lineStyle.fontSize(), controlPointDistance, step);
+        getWavyStrokeParameters(lineStyle.computedFontPixelSize(), controlPointDistance, step);
         wavyOffset = wavyOffsetFromDecoration();
         overflowResult.left = strokeThickness;
         overflowResult.right = strokeThickness;
index 71d7642..1dea7a2 100644 (file)
@@ -194,7 +194,7 @@ ElementUpdate TreeResolver::resolveElement(Element& element)
         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();
index fff1e87..89ee868 100644 (file)
@@ -242,7 +242,7 @@ ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToEMS(float value)
     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 @@ ExceptionOr<float> SVGLengthContext::convertValueFromEMSToUserUnits(float value)
     if (!style)
         return Exception { NOT_SUPPORTED_ERR };
 
-    return value * style->fontSize();
+    return value * style->computedFontPixelSize();
 }
 
 ExceptionOr<float> SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const