[Text autosizing] [iPadOS] AutosizeStatus::idempotentTextSize returns the computed...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 05:10:54 +0000 (05:10 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jul 2019 05:10:54 +0000 (05:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199382
<rdar://problem/52483097>

Reviewed by Wenson Hsieh.

Adjust the font size on the style only when the autosized value is different from the computed value.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):

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

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp

index bd449d0..da5999f 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-01  Zalan Bujtas  <zalan@apple.com>
+
+        [Text autosizing] [iPadOS] AutosizeStatus::idempotentTextSize returns the computed font size in certain cases.
+        https://bugs.webkit.org/show_bug.cgi?id=199382
+        <rdar://problem/52483097>
+
+        Reviewed by Wenson Hsieh.
+
+        Adjust the font size on the style only when the autosized value is different from the computed value. 
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyleForTextAutosizing):
+
 2019-07-01  Chris Dumez  <cdumez@apple.com>
 
         It should not be possible to trigger a load while in the middle of restoring a page in PageCache
index 15bfbe8..0a14632 100644 (file)
@@ -913,11 +913,13 @@ void StyleResolver::adjustRenderStyleForTextAutosizing(RenderStyle& style, const
     auto fontDescription = style.fontDescription();
     auto initialComputedFontSize = fontDescription.computedSize(); 
     auto adjustedFontSize = AutosizeStatus::idempotentTextSize(fontDescription.specifiedSize(), initialScale);
+    if (initialComputedFontSize == adjustedFontSize)
+        return;
+
     fontDescription.setComputedSize(adjustedFontSize);
     style.setFontDescription(WTFMove(fontDescription));
     style.fontCascade().update(&document().fontSelector());
-    if (initialComputedFontSize != adjustedFontSize)
-        adjustLineHeightIfNeeded(adjustedFontSize);
+    adjustLineHeightIfNeeded(adjustedFontSize);
 }
 #endif