Title: [228697] trunk/Source/WebCore
Revision
228697
Author
timothy_hor...@apple.com
Date
2018-02-19 10:47:30 -0800 (Mon, 19 Feb 2018)

Log Message

Increase text autosizing constants for extra zoom mode
https://bugs.webkit.org/show_bug.cgi?id=182919
<rdar://problem/37671259>

Reviewed by Wenson Hsieh.

* page/Settings.yaml:
* page/SettingsBase.cpp:
(WebCore::SettingsBase::defaultMinimumZoomFontSize):
(WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient):
(WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient):
(WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease):
* page/SettingsBase.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::oneLineTextMultiplier):
(WebCore::textMultiplier):
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):
Make autosizing constants settings, and change their default values.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228696 => 228697)


--- trunk/Source/WebCore/ChangeLog	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/ChangeLog	2018-02-19 18:47:30 UTC (rev 228697)
@@ -1,3 +1,26 @@
+2018-02-19  Tim Horton  <timothy_hor...@apple.com>
+
+        Increase text autosizing constants for extra zoom mode
+        https://bugs.webkit.org/show_bug.cgi?id=182919
+        <rdar://problem/37671259>
+
+        Reviewed by Wenson Hsieh.
+
+        * page/Settings.yaml:
+        * page/SettingsBase.cpp:
+        (WebCore::SettingsBase::defaultMinimumZoomFontSize):
+        (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient):
+        (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient):
+        (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease):
+        * page/SettingsBase.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::oneLineTextMultiplier):
+        (WebCore::textMultiplier):
+        (WebCore::RenderBlockFlow::adjustComputedFontSizes):
+        * rendering/TextAutoSizing.cpp:
+        (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
+        Make autosizing constants settings, and change their default values.
+
 2018-02-17  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Accept null composite modes in keyframes

Modified: trunk/Source/WebCore/page/Settings.yaml (228696 => 228697)


--- trunk/Source/WebCore/page/Settings.yaml	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/page/Settings.yaml	2018-02-19 18:47:30 UTC (rev 228697)
@@ -711,6 +711,21 @@
   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()
+  conditional: TEXT_AUTOSIZING
+
 mediaCapabilitiesEnabled:
   initial: false
 

Modified: trunk/Source/WebCore/page/SettingsBase.cpp (228696 => 228697)


--- trunk/Source/WebCore/page/SettingsBase.cpp	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/page/SettingsBase.cpp	2018-02-19 18:47:30 UTC (rev 228697)
@@ -79,7 +79,11 @@
 
 float SettingsBase::defaultMinimumZoomFontSize()
 {
+#if ENABLE(EXTRA_ZOOM_MODE)
+    return 30;
+#else
     return 15;
+#endif
 }
 
 #if !PLATFORM(IOS)
@@ -89,6 +93,33 @@
 }
 #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
+}
+
 #if !PLATFORM(COCOA)
 const String& SettingsBase::defaultMediaContentTypesRequiringHardwareSupport()
 {

Modified: trunk/Source/WebCore/page/SettingsBase.h (228696 => 228697)


--- trunk/Source/WebCore/page/SettingsBase.h	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/page/SettingsBase.h	2018-02-19 18:47:30 UTC (rev 228697)
@@ -114,6 +114,9 @@
 
     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();
 
     static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
     static const unsigned defaultMaximumRenderTreeDepth = 512;

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (228696 => 228697)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2018-02-19 18:47:30 UTC (rev 228697)
@@ -3724,16 +3724,18 @@
     return false;
 }
 
-//  For now, we auto size single lines of text the same as multiple lines.
-//  We've been experimenting with low values for single lines of text.
-static inline float oneLineTextMultiplier(float specifiedSize)
+// For now, we auto size single lines of text the same as multiple lines.
+// We've been experimenting with low values for single lines of text.
+static inline float oneLineTextMultiplier(RenderObject& renderer, float specifiedSize)
 {
-    return std::max((1.0f / log10f(specifiedSize) * 1.7f), 1.0f);
+    const float coefficient = renderer.settings().oneLineTextMultiplierCoefficient();
+    return std::max((1.0f / log10f(specifiedSize) * coefficient), 1.0f);
 }
 
-static inline float textMultiplier(float specifiedSize)
+static inline float textMultiplier(RenderObject& renderer, float specifiedSize)
 {
-    return std::max((1.0f / log10f(specifiedSize) * 1.95f), 1.0f);
+    const float coefficient = renderer.settings().multiLineTextMultiplierCoefficient();
+    return std::max((1.0f / log10f(specifiedSize) * coefficient), 1.0f);
 }
 
 void RenderBlockFlow::adjustComputedFontSizes(float size, float visibleWidth)
@@ -3787,7 +3789,7 @@
             if (m_widthForTextAutosizing == -1)
                 m_widthForTextAutosizing = actualWidth;
 
-            float lineTextMultiplier = lineCount == ONE_LINE ? oneLineTextMultiplier(specifiedSize) : textMultiplier(specifiedSize);
+            float lineTextMultiplier = lineCount == ONE_LINE ? oneLineTextMultiplier(text, specifiedSize) : textMultiplier(text, specifiedSize);
             float candidateNewSize = roundf(std::min(minFontSize, specifiedSize * lineTextMultiplier));
             if (candidateNewSize > specifiedSize && candidateNewSize != fontDescription.computedSize() && text.textNode() && oldStyle.textSizeAdjust().isAuto())
                 document().textAutoSizing().addTextNode(*text.textNode(), candidateNewSize);

Modified: trunk/Source/WebCore/rendering/TextAutoSizing.cpp (228696 => 228697)


--- trunk/Source/WebCore/rendering/TextAutoSizing.cpp	2018-02-19 18:34:07 UTC (rev 228696)
+++ trunk/Source/WebCore/rendering/TextAutoSizing.cpp	2018-02-19 18:47:30 UTC (rev 228697)
@@ -37,6 +37,7 @@
 #include "RenderText.h"
 #include "RenderTextFragment.h"
 #include "RenderTreeBuilder.h"
+#include "Settings.h"
 #include "StyleResolver.h"
 
 namespace WebCore {
@@ -68,8 +69,6 @@
     m_autoSizedNodes.add(&node);
 }
 
-static const float maxScaleIncrease = 1.7f;
-
 auto TextAutoSizingValue::adjustTextNodeSizes() -> StillHasNodes
 {
     // Remove stale nodes. Nodes may have had their renderers detached. We'll also need to remove the style from the documents m_textAutoSizedNodes
@@ -108,6 +107,7 @@
             continue;
 
         float specifiedSize = renderer.style().fontDescription().specifiedSize();
+        float maxScaleIncrease = renderer.settings().maxTextAutosizingScaleIncrease();
         float scaleChange = averageSize / specifiedSize;
         if (scaleChange > maxScaleIncrease && firstPass) {
             firstPass = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to