Changeset 222588 in webkit


Ignore:
Timestamp:
Sep 27, 2017 5:25:59 PM (7 years ago)
Author:
mmaxfield@apple.com
Message:

Minimum font size may cause elements to have an infinite line-height
https://bugs.webkit.org/show_bug.cgi?id=177573
<rdar://problem/34573792>

Reviewed by Dan Bernstein.

Source/WebCore:

When minimum font size is specified, we were trying to preserve the ratio of specified font-size
and specified line-height in order to boost the computed font size proportionately to the font-size
boost. However, this doesn't work when the specified font-size is 0, because the ratio between
line-height and font-size is infinite.

The most straightforward solution is just to make small font-sizes opt out of the line-height
adjustment because the result would be too big.

Test: fast/text/line-height-minimumFontSize-text-small-font-size.html

  • css/StyleBuilderCustom.h:

(WebCore::computeLineHeightMultiplierDueToFontSize):
(WebCore::StyleBuilderCustom::applyValueLineHeight):

LayoutTests:

  • fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt: Added.
  • fast/text/line-height-minimumFontSize-text-small-font-size.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r222587 r222588  
     12017-09-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Minimum font size may cause elements to have an infinite line-height
     4        https://bugs.webkit.org/show_bug.cgi?id=177573
     5        <rdar://problem/34573792>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * fast/text/line-height-minimumFontSize-text-small-font-size-expected.txt: Added.
     10        * fast/text/line-height-minimumFontSize-text-small-font-size.html: Added.
     11
    1122017-09-27  Matt Lewis  <jlewis3@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r222584 r222588  
     12017-09-27  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Minimum font size may cause elements to have an infinite line-height
     4        https://bugs.webkit.org/show_bug.cgi?id=177573
     5        <rdar://problem/34573792>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        When minimum font size is specified, we were trying to preserve the ratio of specified font-size
     10        and specified line-height in order to boost the computed font size proportionately to the font-size
     11        boost. However, this doesn't work when the specified font-size is 0, because the ratio between
     12        line-height and font-size is infinite.
     13
     14        The most straightforward solution is just to make small font-sizes opt out of the line-height
     15        adjustment because the result would be too big.
     16
     17        Test: fast/text/line-height-minimumFontSize-text-small-font-size.html
     18
     19        * css/StyleBuilderCustom.h:
     20        (WebCore::computeLineHeightMultiplierDueToFontSize):
     21        (WebCore::StyleBuilderCustom::applyValueLineHeight):
     22
    1232017-09-27  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/css/StyleBuilderCustom.h

    r220685 r222588  
    671671        if (minimumFontSize > 0) {
    672672            auto specifiedFontSize = computeBaseSpecifiedFontSize(document, style, percentageAutosizingEnabled);
    673             if (specifiedFontSize < minimumFontSize) {
     673            // Small font sizes cause a preposterously large (near infinity) line-height. Add a fuzz-factor of 1px which opts out of
     674            // boosted line-height.
     675            if (specifiedFontSize < minimumFontSize && specifiedFontSize >= 1) {
    674676                // FIXME: There are two settings which are relevant here: minimum font size, and minimum logical font size (as
    675677                // well as things like the zoom property, text zoom on the page, and text autosizing). The minimum logical font
     
    707709        if (multiplier == 1)
    708710            computedLineHeight = lineHeight.value();
    709         else {
    710             std::optional<Length> lineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, multiplier);
    711             ASSERT(static_cast<bool>(lineHeight));
    712             computedLineHeight = lineHeight.value();
    713         }
     711        else
     712            computedLineHeight = StyleBuilderConverter::convertLineHeight(styleResolver, value, multiplier).value();
    714713    }
    715714
Note: See TracChangeset for help on using the changeset viewer.