[iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Apr 2019 06:39:30 +0000 (06:39 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Apr 2019 06:39:30 +0000 (06:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197275
<rdar://problem/50211019>

Reviewed by Simon Fraser.

Source/WebCore:

This setting makes it easier to investigate the autosizing work we've been doing
in https://bugs.webkit.org/show_bug.cgi?id=197250.

* page/Settings.yaml:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/WebPreferences.h:

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

Source/WebCore/ChangeLog
Source/WebCore/page/Settings.yaml
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/TextAutoSizing.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/WebPreferences.h

index c0e5df1..201a9fd 100644 (file)
@@ -1,5 +1,22 @@
 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
+        https://bugs.webkit.org/show_bug.cgi?id=197275
+        <rdar://problem/50211019>
+
+        Reviewed by Simon Fraser.
+
+        This setting makes it easier to investigate the autosizing work we've been doing
+        in https://bugs.webkit.org/show_bug.cgi?id=197250.
+
+        * page/Settings.yaml:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::adjustComputedFontSizes):
+        * rendering/TextAutoSizing.cpp:
+        (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
+
+2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [iOS] Implement idempotent mode for text autosizing
         https://bugs.webkit.org/show_bug.cgi?id=197250
         <rdar://problem/50211034>
index e47d7eb..c07efd3 100644 (file)
@@ -444,6 +444,10 @@ textAutosizingUsesIdempotentMode:
   initial: defaultTextAutosizingUsesIdempotentMode()
   onChange: setNeedsRecalcStyleInAllFrames
   conditional: TEXT_AUTOSIZING
+forceAutoBehaviorForTextSizeAdjust:
+  initial: false
+  onChange: setNeedsRecalcStyleInAllFrames
+  conditional: TEXT_AUTOSIZING
 
 subpixelAntialiasedLayerTextEnabled:
   initial: false
index 766591c..af5ce7c 100644 (file)
@@ -3815,7 +3815,7 @@ void RenderBlockFlow::adjustComputedFontSizes(float size, float visibleWidth, fl
                 candidateNewSize = roundf(std::min(minFontSize, specifiedSize * lineTextMultiplier));
             }
 
-            if (candidateNewSize > specifiedSize && candidateNewSize != fontDescription.computedSize() && text.textNode() && oldStyle.textSizeAdjust().isAuto())
+            if (candidateNewSize > specifiedSize && candidateNewSize != fontDescription.computedSize() && text.textNode() && (text.document().settings().forceAutoBehaviorForTextSizeAdjust() || oldStyle.textSizeAdjust().isAuto()))
                 document().textAutoSizing().addTextNode(*text.textNode(), candidateNewSize);
         }
 
index 3ba130d..a15efa0 100644 (file)
@@ -76,7 +76,7 @@ auto TextAutoSizingValue::adjustTextNodeSizes() -> StillHasNodes
     Vector<Text*> nodesForRemoval;
     for (auto& textNode : m_autoSizedNodes) {
         auto* renderer = textNode->renderer();
-        if (!renderer || !renderer->style().textSizeAdjust().isAuto() || !renderer->candidateComputedTextSize())
+        if (!renderer || (!textNode->document().settings().forceAutoBehaviorForTextSizeAdjust() && !renderer->style().textSizeAdjust().isAuto()) || !renderer->candidateComputedTextSize())
             nodesForRemoval.append(textNode.get());
     }
 
index 6024024..0c67f75 100644 (file)
@@ -1,5 +1,16 @@
 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
+        https://bugs.webkit.org/show_bug.cgi?id=197275
+        <rdar://problem/50211019>
+
+        Reviewed by Simon Fraser.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/WebPreferences.h:
+
+2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
+
         [iOS] Implement idempotent mode for text autosizing
         https://bugs.webkit.org/show_bug.cgi?id=197250
         <rdar://problem/50211034>
index ff9da3b..82deda8 100644 (file)
@@ -433,11 +433,6 @@ UsesEncodingDetector:
   type: bool
   defaultValue: false
 
-TextAutosizingEnabled:
-  type: bool
-  defaultValue: WebCore::Settings::defaultTextAutosizingEnabled()
-  condition: ENABLE(TEXT_AUTOSIZING)
-
 AggressiveTileRetentionEnabled:
   type: bool
   defaultValue: false
@@ -1650,6 +1645,22 @@ ApplePayRemoteUIEnabled:
   humanReadableName: "Apple Pay Remote UI"
   type: bool
 
+TextAutosizingEnabled:
+  type: bool
+  defaultValue: WebCore::Settings::defaultTextAutosizingEnabled()
+  condition: ENABLE(TEXT_AUTOSIZING)
+  humanReadableName: "Text Autosizing"
+  humanReadableDescription: "Enable text autosizing, which increases text size so as to be more easily read"
+  category: internal
+
+ForceAutoBehaviorForTextSizeAdjust:
+  type: bool
+  defaultValue: false
+  condition: ENABLE(TEXT_AUTOSIZING)
+  humanReadableName: "Force text-size-adjust to auto"
+  humanReadableDescription: "Force -webkit-text-size-adjust to behave like auto, which means web authors can't opt-out of text autosizing heuristics"
+  category: internal
+
 # Deprecated
 
 ICECandidateFilteringEnabled:
index 317f740..e7f7f8a 100644 (file)
@@ -30,6 +30,7 @@
 #include "APIObject.h"
 #include "WebPreferencesDefinitions.h"
 #include "WebPreferencesStore.h"
+#include <WebCore/Settings.h>
 #include <wtf/HashSet.h>
 #include <wtf/RefPtr.h>