[Extra zoom mode] Make boosted text autosizing values switchable at runtime
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2018 18:55:40 +0000 (18:55 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2018 18:55:40 +0000 (18:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184092
<rdar://problem/38939917>

Reviewed by Tim Horton.

Source/WebCore:

In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are
currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may
want to opt in or out of boosted text autosizing values and just use the existing values.

This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text
autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and
then trigger style recalculation.

Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime

* page/Settings.yaml:
* page/SettingsBase.cpp:
(WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged):
(WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted.
(WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted.
(WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted.

Changed these to constant values instead of helper functions, and also introduced boosted text autosizing
constants for use in extra zoom mode.

* page/SettingsBase.h:
(WebCore::SettingsBase::oneLineTextMultiplierCoefficient const):
(WebCore::SettingsBase::multiLineTextMultiplierCoefficient const):
(WebCore::SettingsBase::maxTextAutosizingScaleIncrease const):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::extraDefaultStyleSheet):

Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important
is breaking many websites that positioned text such that it is positioned within layout viewport bounds without
text autosizing.

Source/WebKit:

Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
normal text autosizing values.

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
(-[WKPreferences _shouldEnableTextAutosizingBoost]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

Add an API test to check that toggling the boosted text autosizing preference causes text to lay out larger than
it would with normal text autosizing.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm: Added.
(TEST):

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/Settings.yaml
Source/WebCore/page/SettingsBase.cpp
Source/WebCore/page/SettingsBase.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm [new file with mode: 0644]

index 36a52bd..d708a5d 100644 (file)
@@ -1,3 +1,42 @@
+2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Extra zoom mode] Make boosted text autosizing values switchable at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=184092
+        <rdar://problem/38939917>
+
+        Reviewed by Tim Horton.
+
+        In r228697, we introduced a new set of boosted text autosizing constants tuned for extra zoom mode, which are
+        currently hard-coded as default values in SettingsBase. However, we've since identified cases where clients may
+        want to opt in or out of boosted text autosizing values and just use the existing values.
+
+        This replaces settings to adjust text autosizing constants with a flag to enable or disable boosted text
+        autosizing; when changed, we update all three text autosizing parameters to their default or boosted values, and
+        then trigger style recalculation.
+
+        Test: TextAutosizingBoost.ChangeAutosizingBoostAtRuntime
+
+        * page/Settings.yaml:
+        * page/SettingsBase.cpp:
+        (WebCore::SettingsBase::shouldEnableTextAutosizingBoostChanged):
+        (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient): Deleted.
+        (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient): Deleted.
+        (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease): Deleted.
+
+        Changed these to constant values instead of helper functions, and also introduced boosted text autosizing
+        constants for use in extra zoom mode.
+
+        * page/SettingsBase.h:
+        (WebCore::SettingsBase::oneLineTextMultiplierCoefficient const):
+        (WebCore::SettingsBase::multiLineTextMultiplierCoefficient const):
+        (WebCore::SettingsBase::maxTextAutosizingScaleIncrease const):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::extraDefaultStyleSheet):
+
+        Tweak the stylesheet to make `-webkit-text-size-adjust: auto` overridable by web content. Adding the !important
+        is breaking many websites that positioned text such that it is positioned within layout viewport bounds without
+        text autosizing.
+
 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
 
         Avoid uninitialized mach ports
index 1fa74a1..d89b4ea 100644 (file)
@@ -715,20 +715,11 @@ touchEventEmulationEnabled:
   getter: isTouchEventEmulationEnabled
   conditional: TOUCH_EVENTS
 
-oneLineTextMultiplierCoefficient:
-  type: float
-  initial: defaultOneLineTextMultiplierCoefficient()
-  conditional: TEXT_AUTOSIZING
-
-multiLineTextMultiplierCoefficient:
-  type: float
-  initial: defaultMultiLineTextMultiplierCoefficient()
-  conditional: TEXT_AUTOSIZING
-
-maxTextAutosizingScaleIncrease:
-  type: float
-  initial: defaultMaxTextAutosizingScaleIncrease()
+shouldEnableTextAutosizingBoost:
+  type: bool
+  initial: false
   conditional: TEXT_AUTOSIZING
+  onChange: shouldEnableTextAutosizingBoostChanged
 
 mediaCapabilitiesEnabled:
   initial: false
index 59f9818..1c5c038 100644 (file)
@@ -94,33 +94,6 @@ bool SettingsBase::defaultTextAutosizingEnabled()
 }
 #endif
 
-float SettingsBase::defaultOneLineTextMultiplierCoefficient()
-{
-#if ENABLE(EXTRA_ZOOM_MODE)
-    return 2.23125f;
-#else
-    return 1.7f;
-#endif
-}
-
-float SettingsBase::defaultMultiLineTextMultiplierCoefficient()
-{
-#if ENABLE(EXTRA_ZOOM_MODE)
-    return 2.48125f;
-#else
-    return 1.95f;
-#endif
-}
-
-float SettingsBase::defaultMaxTextAutosizingScaleIncrease()
-{
-#if ENABLE(EXTRA_ZOOM_MODE)
-    return 5.0f;
-#else
-    return 1.7f;
-#endif
-}
-
 bool SettingsBase::defaultDownloadableBinaryFontsEnabled()
 {
 #if ENABLE(EXTRA_ZOOM_MODE)
@@ -333,6 +306,23 @@ void SettingsBase::pluginsEnabledChanged()
     Page::refreshPlugins(false);
 }
 
+#if ENABLE(TEXT_AUTOSIZING)
+
+void SettingsBase::shouldEnableTextAutosizingBoostChanged()
+{
+    if (!m_page)
+        return;
+
+    bool boostAutosizing = m_page->settings().shouldEnableTextAutosizingBoost();
+    m_oneLineTextMultiplierCoefficient = boostAutosizing ? boostedOneLineTextMultiplierCoefficient : defaultOneLineTextMultiplierCoefficient;
+    m_multiLineTextMultiplierCoefficient = boostAutosizing ? boostedMultiLineTextMultiplierCoefficient : defaultMultiLineTextMultiplierCoefficient;
+    m_maxTextAutosizingScaleIncrease = boostAutosizing ? boostedMaxTextAutosizingScaleIncrease : defaultMaxTextAutosizingScaleIncrease;
+
+    setNeedsRecalcStyleInAllFrames();
+}
+
+#endif
+
 void SettingsBase::userStyleSheetLocationChanged()
 {
     if (m_page)
index c077265..192b715 100644 (file)
@@ -114,14 +114,19 @@ public:
 
     WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
     WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
-    WEBCORE_EXPORT static float defaultOneLineTextMultiplierCoefficient();
-    WEBCORE_EXPORT static float defaultMultiLineTextMultiplierCoefficient();
-    WEBCORE_EXPORT static float defaultMaxTextAutosizingScaleIncrease();
     WEBCORE_EXPORT static bool defaultDownloadableBinaryFontsEnabled();
 
     static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
     static const unsigned defaultMaximumRenderTreeDepth = 512;
 
+#if ENABLE(TEXT_AUTOSIZING)
+    constexpr static const float boostedOneLineTextMultiplierCoefficient = 2.23125f;
+    constexpr static const float boostedMultiLineTextMultiplierCoefficient = 2.48125f;
+    constexpr static const float boostedMaxTextAutosizingScaleIncrease = 5.0f;
+    constexpr static const float defaultOneLineTextMultiplierCoefficient = 1.7f;
+    constexpr static const float defaultMultiLineTextMultiplierCoefficient = 1.95f;
+    constexpr static const float defaultMaxTextAutosizingScaleIncrease = 1.7f;
+#endif
 
     WEBCORE_EXPORT void setStandardFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
     WEBCORE_EXPORT const AtomicString& standardFontFamily(UScriptCode = USCRIPT_COMMON) const;
@@ -150,6 +155,12 @@ public:
     WEBCORE_EXPORT void setLayoutInterval(Seconds);
     Seconds layoutInterval() const { return m_layoutInterval; }
 
+#if ENABLE(TEXT_AUTOSIZING)
+    float oneLineTextMultiplierCoefficient() const { return m_oneLineTextMultiplierCoefficient; }
+    float multiLineTextMultiplierCoefficient() const { return m_multiLineTextMultiplierCoefficient; }
+    float maxTextAutosizingScaleIncrease() const { return m_maxTextAutosizingScaleIncrease; }
+#endif
+
     WEBCORE_EXPORT static const String& defaultMediaContentTypesRequiringHardwareSupport();
     WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>&);
     WEBCORE_EXPORT void setMediaContentTypesRequiringHardwareSupport(const String&);
@@ -178,6 +189,9 @@ protected:
     void hiddenPageDOMTimerThrottlingStateChanged();
     void hiddenPageCSSAnimationSuspensionEnabledChanged();
     void resourceUsageOverlayVisibleChanged();
+#if ENABLE(TEXT_AUTOSIZING)
+    void shouldEnableTextAutosizingBoostChanged();
+#endif
 
     Page* m_page;
 
@@ -188,6 +202,12 @@ protected:
     Timer m_setImageLoadingSettingsTimer;
 
     Vector<ContentType> m_mediaContentTypesRequiringHardwareSupport;
+
+#if ENABLE(TEXT_AUTOSIZING)
+    float m_oneLineTextMultiplierCoefficient { defaultOneLineTextMultiplierCoefficient };
+    float m_multiLineTextMultiplierCoefficient { defaultMultiLineTextMultiplierCoefficient };
+    float m_maxTextAutosizingScaleIncrease { defaultMaxTextAutosizingScaleIncrease };
+#endif
 };
 
 } // namespace WebCore
index 175a61e..33b5181 100644 (file)
@@ -1803,7 +1803,7 @@ bool RenderThemeIOS::paintAttachment(const RenderObject& renderer, const PaintIn
 
 String RenderThemeIOS::extraDefaultStyleSheet()
 {
-    return ASCIILiteral("* { -webkit-text-size-adjust: auto !important; -webkit-hyphens: auto !important; }");
+    return ASCIILiteral("* { -webkit-text-size-adjust: auto; -webkit-hyphens: auto !important; }");
 }
 
 #endif
index 68692a5..2038db5 100644 (file)
@@ -1,3 +1,20 @@
+2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Extra zoom mode] Make boosted text autosizing values switchable at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=184092
+        <rdar://problem/38939917>
+
+        Reviewed by Tim Horton.
+
+        Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
+        normal text autosizing values.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
+        (-[WKPreferences _shouldEnableTextAutosizingBoost]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
 
         Avoid uninitialized mach ports
index d826f5e..77be738 100644 (file)
@@ -1038,6 +1038,11 @@ VisibleDebugOverlayRegions:
   defaultValue: 0
   category: debug
 
+ShouldEnableTextAutosizingBoost:
+  type: bool
+  defaultValue: false
+  condition: ENABLE(TEXT_AUTOSIZING)
+
 ShouldAllowUserInstalledFonts:
   type: bool
   defaultValue: true
index de74a74..9ba3495 100644 (file)
@@ -1229,6 +1229,22 @@ static WebCore::EditableLinkBehavior toEditableLinkBehavior(_WKEditableLinkBehav
     return _preferences->domPasteAllowed();
 }
 
+- (void)_setShouldEnableTextAutosizingBoost:(BOOL)shouldEnableTextAutosizingBoost
+{
+#if ENABLE(TEXT_AUTOSIZING)
+    _preferences->setShouldEnableTextAutosizingBoost(shouldEnableTextAutosizingBoost);
+#endif
+}
+
+- (BOOL)_shouldEnableTextAutosizingBoost
+{
+#if ENABLE(TEXT_AUTOSIZING)
+    return _preferences->shouldEnableTextAutosizingBoost();
+#else
+    return NO;
+#endif
+}
+
 @end
 
 #endif // WK_API_ENABLED
index 6cbcd44..b631d98 100644 (file)
@@ -134,6 +134,8 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) {
 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 
+@property (nonatomic, setter=_setShouldEnableTextAutosizingBoost:) BOOL _shouldEnableTextAutosizingBoost WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 #if !TARGET_OS_IPHONE
 @property (nonatomic, setter=_setWebGLEnabled:) BOOL _webGLEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 @property (nonatomic, setter=_setJavaEnabledForLocalFiles:) BOOL _javaEnabledForLocalFiles WK_API_AVAILABLE(macosx(WK_MAC_TBA));
index c7b1e0e..db51f98 100644 (file)
@@ -1,3 +1,18 @@
+2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Extra zoom mode] Make boosted text autosizing values switchable at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=184092
+        <rdar://problem/38939917>
+
+        Reviewed by Tim Horton.
+
+        Add an API test to check that toggling the boosted text autosizing preference causes text to lay out larger than
+        it would with normal text autosizing.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm: Added.
+        (TEST):
+
 2018-03-28  Zalan Bujtas  <zalan@apple.com>
 
         [LayoutReloaded] InlineFormattingContext::_handleText should support runs on multiple lines
index acc1f86..3573626 100644 (file)
                F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */; };
                F44D06471F39627A001A0E29 /* EditorStateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44D06461F395C4D001A0E29 /* EditorStateTests.mm */; };
                F44D064A1F3962F2001A0E29 /* EditingTestHarness.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44D06491F3962E3001A0E29 /* EditingTestHarness.mm */; };
+               F45033F5206BEC95009351CE /* TextAutosizingBoost.mm in Sources */ = {isa = PBXBuildFile; fileRef = F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */; };
                F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */; };
                F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B662054C49500C26721 /* TestWKWebViewController.mm */; };
                F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */; };
                F44D06461F395C4D001A0E29 /* EditorStateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorStateTests.mm; sourceTree = "<group>"; };
                F44D06481F3962E3001A0E29 /* EditingTestHarness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingTestHarness.h; sourceTree = "<group>"; };
                F44D06491F3962E3001A0E29 /* EditingTestHarness.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditingTestHarness.mm; sourceTree = "<group>"; };
+               F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextAutosizingBoost.mm; sourceTree = "<group>"; };
                F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "DataTransferItem-getAsEntry.html"; sourceTree = "<group>"; };
                F4517B652054C49500C26721 /* TestWKWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewController.h; sourceTree = "<group>"; };
                F4517B662054C49500C26721 /* TestWKWebViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestWKWebViewController.mm; sourceTree = "<group>"; };
                                574F55CE204D3763002948C6 /* LocalAuthenticator.mm */,
                                7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */,
                                F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */,
+                               F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */,
                                F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */,
                                2E1B881E2040EE5300FFF6A9 /* ViewportSizingTests.mm */,
                                514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */,
                                7CCE7EAE1A411A3400447C4C /* TestsController.cpp in Sources */,
                                2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */,
                                F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */,
+                               F45033F5206BEC95009351CE /* TextAutosizingBoost.mm in Sources */,
                                93E6193B1F931B3A00AF245E /* TextCodec.cpp in Sources */,
                                CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */,
                                7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */,
diff --git a/Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm b/Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm
new file mode 100644 (file)
index 0000000..691c32b
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "TestWKWebView.h"
+#import <WebKit/WKPreferencesPrivate.h>
+
+#if WK_API_ENABLED && PLATFORM(IOS)
+
+TEST(TextAutosizingBoost, ChangeAutosizingBoostAtRuntime)
+{
+    static NSString *testMarkup = @"<meta name='viewport' content='width=device-width'><body style='margin: 0'><span id='top'>Hello world</span><br><span id='bottom'>Goodbye world</span></body>";
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 960, 360)]);
+    [webView synchronouslyLoadHTMLString:testMarkup];
+    CGSize regularSize {
+        roundf([[webView objectByEvaluatingJavaScript:@"document.getElementById('top').getBoundingClientRect().width"] floatValue]),
+        roundf([[webView objectByEvaluatingJavaScript:@"document.getElementById('top').getBoundingClientRect().height"] floatValue])
+    };
+
+    [webView configuration].preferences._shouldEnableTextAutosizingBoost = YES;
+    [webView waitForNextPresentationUpdate];
+    CGSize boostedSize {
+        roundf([[webView objectByEvaluatingJavaScript:@"document.getElementById('top').getBoundingClientRect().width"] floatValue]),
+        roundf([[webView objectByEvaluatingJavaScript:@"document.getElementById('top').getBoundingClientRect().height"] floatValue])
+    };
+
+    EXPECT_EQ(125, regularSize.width);
+    EXPECT_EQ(30, regularSize.height);
+    EXPECT_EQ(159, boostedSize.width);
+    EXPECT_EQ(38, boostedSize.height);
+}
+
+#endif // WK_API_ENABLED && PLATFORM(IOS)