Title: [247484] trunk
Revision
247484
Author
wenson_hs...@apple.com
Date
2019-07-16 09:52:21 -0700 (Tue, 16 Jul 2019)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247483 => 247484)


--- trunk/LayoutTests/ChangeLog	2019-07-16 16:43:27 UTC (rev 247483)
+++ trunk/LayoutTests/ChangeLog	2019-07-16 16:52:21 UTC (rev 247484)
@@ -1,3 +1,16 @@
+2019-07-16  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [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.
+
+        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:
+
 2019-07-16  Rob Buis  <rb...@igalia.com>
 
         Remove support for beforeload on link=prefetch

Modified: trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt (247483 => 247484)


--- trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt	2019-07-16 16:43:27 UTC (rev 247483)
+++ trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates-expected.txt	2019-07-16 16:52:21 UTC (rev 247484)
@@ -34,6 +34,8 @@
 PASS result is 12
 Checking target18:
 PASS result is 12
+Checking target19:
+PASS result is >= 13
 PASS successfullyParsed is true
 
 TEST COMPLETE
@@ -56,3 +58,4 @@
 Test 
 Test 
 Test
+Test

Modified: trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html (247483 => 247484)


--- trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html	2019-07-16 16:43:27 UTC (rev 247483)
+++ trunk/LayoutTests/fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-candidates.html	2019-07-16 16:52:21 UTC (rev 247484)
@@ -35,6 +35,7 @@
     <br>
     <span>Test</span>
 </div>
+<div style="background: green; line-height: 20px; max-height: 20px; font-size: 12px;" id="target19">Test</div>
 <script>
 let result;
 function check(name, shouldGetAutosized) {
@@ -77,6 +78,7 @@
 check("target16", true);
 check("target17", false);
 check("target18", false);
+check("target19", true);
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (247483 => 247484)


--- trunk/Source/WebCore/ChangeLog	2019-07-16 16:43:27 UTC (rev 247483)
+++ trunk/Source/WebCore/ChangeLog	2019-07-16 16:52:21 UTC (rev 247484)
@@ -1,3 +1,24 @@
+2019-07-16  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [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.
+
+        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):
+
 2019-07-16  Zalan Bujtas  <za...@apple.com>
 
         [ContentChangeObserver] Cancel ongoing content observation when tap is failed/cancelled

Modified: trunk/Source/WebCore/rendering/style/TextSizeAdjustment.cpp (247483 => 247484)


--- trunk/Source/WebCore/rendering/style/TextSizeAdjustment.cpp	2019-07-16 16:43:27 UTC (rev 247483)
+++ trunk/Source/WebCore/rendering/style/TextSizeAdjustment.cpp	2019-07-16 16:52:21 UTC (rev 247484)
@@ -53,6 +53,10 @@
         if (!style.lineHeight().isSpecified() || style.whiteSpace() == WhiteSpace::NoWrap)
             return false;
 
+        const float maximumDifferenceBetweenFixedLineHeightAndFontSize = 6;
+        if (style.lineHeight().isFixed() && style.lineHeight().value() - style.fontDescription().specifiedSize() > maximumDifferenceBetweenFixedLineHeightAndFontSize)
+            return false;
+
         Optional<Length> heightOrMaxHeightAsLength;
         if (style.height().isFixed() && style.maxHeight().isAuto())
             heightOrMaxHeightAsLength = style.height();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to