Changeset 219543 in webkit


Ignore:
Timestamp:
Jul 15, 2017 10:52:30 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

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>

Reviewed by Simon Fraser.

Source/WebCore:

StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
"percentage" length. Then, when layout needs to know what the computed value of
line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
the computed font size.

With autosizing, the computed font size already incorporates the autosizing
multiplier, so we shouldn't also incorporate this multiplier into the percentage
value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
this double application by multiplying the percentage by the font-size's specified
value instead of its computed value, which is incorrect.

Test: fast/text-autosizing/line-height-number.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::lineHeightFromStyle):

  • css/StyleBuilderConverter.h:

(WebCore::StyleBuilderConverter::convertLineHeight):

LayoutTests:

  • fast/text-autosizing/line-height-number-expected.html: Added.
  • fast/text-autosizing/line-height-number.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r219536 r219543  
     12017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        line-height: <number> gets visually applied twice when text autosizing is in effect
     4        https://bugs.webkit.org/show_bug.cgi?id=174536
     5        <rdar://problem/33338259>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/text-autosizing/line-height-number-expected.html: Added.
     10        * fast/text-autosizing/line-height-number.html: Added.
     11
    1122017-07-14  Zan Dobersek  <zdobersek@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r219541 r219543  
     12017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        line-height: <number> gets visually applied twice when text autosizing is in effect
     4        https://bugs.webkit.org/show_bug.cgi?id=174536
     5        <rdar://problem/33338259>
     6
     7        Reviewed by Simon Fraser.
     8
     9        StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
     10        "percentage" length. Then, when layout needs to know what the computed value of
     11        line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
     12        the computed font size.
     13
     14        With autosizing, the computed font size already incorporates the autosizing
     15        multiplier, so we shouldn't also incorporate this multiplier into the percentage
     16        value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
     17        this double application by multiplying the percentage by the font-size's specified
     18        value instead of its computed value, which is incorrect.
     19
     20        Test: fast/text-autosizing/line-height-number.html
     21
     22        * css/CSSComputedStyleDeclaration.cpp:
     23        (WebCore::lineHeightFromStyle):
     24        * css/StyleBuilderConverter.h:
     25        (WebCore::StyleBuilderConverter::convertLineHeight):
     26
    1272017-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
    228
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r219315 r219543  
    19721972        // On the other hand, since font-size doesn't include the zoom factor, we really can't do
    19731973        // that here either.
    1974         return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style.fontDescription().specifiedSize()) / 100, style);
     1974        return zoomAdjustedPixelValue(static_cast<int>(length.percent() * style.fontDescription().computedSize()) / 100, style);
    19751975    }
    19761976    return zoomAdjustedPixelValue(floatValueForLength(length, 0), style);
  • trunk/Source/WebCore/css/StyleBuilderConverter.h

    r219539 r219543  
    14471447    }
    14481448    if (primitiveValue.isNumber())
    1449         return Length(primitiveValue.doubleValue() * multiplier * 100.0, Percent);
     1449        return Length(primitiveValue.doubleValue() * 100.0, Percent);
    14501450
    14511451    // FIXME: The parser should only emit the above types, so this should never be reached. We should change the
Note: See TracChangeset for help on using the changeset viewer.