Title: [223551] trunk/Source/WebCore
Revision
223551
Author
[email protected]
Date
2017-10-17 09:34:45 -0700 (Tue, 17 Oct 2017)

Log Message

[FrameView::layout cleanup] Move text auto sizing logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178391
<rdar://problem/35030264>

Reviewed by Antti Koivisto.

No change in functionality.

* page/FrameView.cpp:
(WebCore::applyTextSizingIfNeeded):
(WebCore::FrameView::layout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223550 => 223551)


--- trunk/Source/WebCore/ChangeLog	2017-10-17 16:20:26 UTC (rev 223550)
+++ trunk/Source/WebCore/ChangeLog	2017-10-17 16:34:45 UTC (rev 223551)
@@ -1,3 +1,17 @@
+2017-10-17  Zalan Bujtas  <[email protected]>
+
+        [FrameView::layout cleanup] Move text auto sizing logic to a separate function
+        https://bugs.webkit.org/show_bug.cgi?id=178391
+        <rdar://problem/35030264>
+
+        Reviewed by Antti Koivisto.
+
+        No change in functionality.
+
+        * page/FrameView.cpp:
+        (WebCore::applyTextSizingIfNeeded):
+        (WebCore::FrameView::layout):
+
 2017-10-17  Yoshiaki Jitsukawa  <[email protected]>
 
         [Curl] Forward declaration "class Cookie;" in CookieJarCurl.h should be "struct Cookie;"

Modified: trunk/Source/WebCore/page/FrameView.cpp (223550 => 223551)


--- trunk/Source/WebCore/page/FrameView.cpp	2017-10-17 16:20:26 UTC (rev 223550)
+++ trunk/Source/WebCore/page/FrameView.cpp	2017-10-17 16:34:45 UTC (rev 223551)
@@ -1300,6 +1300,28 @@
     ownerRenderer->view().frameView().scheduleRelayout();
 }
 
+#if ENABLE(TEXT_AUTOSIZING)
+static void applyTextSizingIfNeeded(RenderElement& layoutRoot)
+{
+    auto& settings = layoutRoot.settings();
+    if (!settings.textAutosizingEnabled() || layoutRoot.view().printing())
+        return;
+    auto minimumZoomFontSize = settings.minimumZoomFontSize();
+    if (!minimumZoomFontSize)
+        return;
+    auto textAutosizingWidth = layoutRoot.page().textAutosizingWidth();
+    if (auto overrideWidth = settings.textAutosizingWindowSizeOverride().width())
+        textAutosizingWidth = overrideWidth;
+    if (!textAutosizingWidth)
+        return;
+    layoutRoot.adjustComputedFontSizesOnBlocks(minimumZoomFontSize, textAutosizingWidth);
+    if (!layoutRoot.needsLayout())
+        return;
+    LOG(TextAutosizing, "Text Autosizing: minimumZoomFontSize=%.2f textAutosizingWidth=%.2f", minimumZoomFontSize, textAutosizingWidth);
+    layoutRoot.layout();
+}
+#endif
+
 void FrameView::layout(bool allowSubtree)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
@@ -1497,20 +1519,7 @@
         root->layout();
 
 #if ENABLE(TEXT_AUTOSIZING)
-        if (frame().settings().textAutosizingEnabled() && !root->view().printing()) {
-            float minimumZoomFontSize = frame().settings().minimumZoomFontSize();
-            float textAutosizingWidth = frame().page() ? frame().page()->textAutosizingWidth() : 0;
-            if (int overrideWidth = frame().settings().textAutosizingWindowSizeOverride().width())
-                textAutosizingWidth = overrideWidth;
-
-            LOG(TextAutosizing, "Text Autosizing: minimumZoomFontSize=%.2f textAutosizingWidth=%.2f", minimumZoomFontSize, textAutosizingWidth);
-            
-            if (minimumZoomFontSize && textAutosizingWidth) {
-                root->adjustComputedFontSizesOnBlocks(minimumZoomFontSize, textAutosizingWidth);
-                if (root->needsLayout())
-                    root->layout();
-            }
-        }
+        applyTextSizingIfNeeded(*root);
 #endif
 
         ASSERT(m_layoutPhase == InRenderTreeLayout);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to