Changeset 247484 in webkit


Ignore:
Timestamp:
Jul 16, 2019 9:52:21 AM (5 years ago)
Author:
Wenson Hsieh
Message:

[Text autosizing] [iPadOS] Paragraph text on the front page of LinkedIn.com is not boosted
https://bugs.webkit.org/show_bug.cgi?id=199827
<rdar://problem/53152660>

Reviewed by Zalan Bujtas.

Source/WebCore:

After r247467, we try to avoid boosting some text that might cause vertical overflow due to line height
increasing inside a container that expects a fixed integer number of lines. However, in the case of
linkedin.com, the line height specified is a fixed value of 26px, which greatly exceeds the specified font size
of 14px. In this case, it's safe to boost font size, since doing so would not affect the line height at all.

To handle this case, don't avoid text autosizing due to the "fixed number of lines" heuristic if the line height
is fixed, and is much larger than the font size.

Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html

  • rendering/style/TextSizeAdjustment.cpp:

(WebCore::AutosizeStatus::updateStatus):

LayoutTests:

Add a new test case, inspired by paragraph text in a post on linkedin.com. This text should get autosized.

  • fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt:
  • fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247481 r247484  
     12019-07-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Text autosizing] [iPadOS] Paragraph text on the front page of LinkedIn.com is not boosted
     4        https://bugs.webkit.org/show_bug.cgi?id=199827
     5        <rdar://problem/53152660>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Add a new test case, inspired by paragraph text in a post on linkedin.com. This text should get autosized.
     10
     11        * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt:
     12        * fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html:
     13
    1142019-07-16  Rob Buis  <rbuis@igalia.com>
    215
  • trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt

    r247467 r247484  
    3535Checking target18:
    3636PASS result is 12
     37Checking target19:
     38PASS result is >= 13
    3739PASS successfullyParsed is true
    3840
     
    5759Test
    5860Test
     61Test
  • trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html

    r247467 r247484  
    3636    <span>Test</span>
    3737</div>
     38<div style="background: green; line-height: 20px; max-height: 20px; font-size: 12px;" id="target19">Test</div>
    3839<script>
    3940let result;
     
    7879check("target17", false);
    7980check("target18", false);
     81check("target19", true);
    8082</script>
    8183<script src="../../../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r247483 r247484  
     12019-07-16  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Text autosizing] [iPadOS] Paragraph text on the front page of LinkedIn.com is not boosted
     4        https://bugs.webkit.org/show_bug.cgi?id=199827
     5        <rdar://problem/53152660>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        After r247467, we try to avoid boosting some text that might cause vertical overflow due to line height
     10        increasing inside a container that expects a fixed integer number of lines. However, in the case of
     11        linkedin.com, the line height specified is a fixed value of 26px, which greatly exceeds the specified font size
     12        of 14px. In this case, it's safe to boost font size, since doing so would not affect the line height at all.
     13
     14        To handle this case, don't avoid text autosizing due to the "fixed number of lines" heuristic if the line height
     15        is fixed, and is much larger than the font size.
     16
     17        Test: fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html
     18
     19        * rendering/style/TextSizeAdjustment.cpp:
     20        (WebCore::AutosizeStatus::updateStatus):
     21
    1222019-07-16  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/rendering/style/TextSizeAdjustment.cpp

    r247467 r247484  
    5252
    5353        if (!style.lineHeight().isSpecified() || style.whiteSpace() == WhiteSpace::NoWrap)
     54            return false;
     55
     56        const float maximumDifferenceBetweenFixedLineHeightAndFontSize = 6;
     57        if (style.lineHeight().isFixed() && style.lineHeight().value() - style.fontDescription().specifiedSize() > maximumDifferenceBetweenFixedLineHeightAndFontSize)
    5458            return false;
    5559
Note: See TracChangeset for help on using the changeset viewer.