Title: [223712] trunk/Source/WebCore
Revision
223712
Author
[email protected]
Date
2017-10-19 14:23:13 -0700 (Thu, 19 Oct 2017)

Log Message

[FrameView::layout cleanup] Move scrollbars setup logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178394
<rdar://problem/35031066>

Reviewed by Antti Koivisto.

Decouple scrollbars setup and the unrelated first-layout logic.
FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time).

Covered by existing test cases.

* page/FrameView.cpp:
(WebCore::FrameView::adjustScrollbarsForLayout):
(WebCore::FrameView::layout):
* page/FrameView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223711 => 223712)


--- trunk/Source/WebCore/ChangeLog	2017-10-19 21:15:34 UTC (rev 223711)
+++ trunk/Source/WebCore/ChangeLog	2017-10-19 21:23:13 UTC (rev 223712)
@@ -1,3 +1,21 @@
+2017-10-19  Zalan Bujtas  <[email protected]>
+
+        [FrameView::layout cleanup] Move scrollbars setup logic to a separate function
+        https://bugs.webkit.org/show_bug.cgi?id=178394
+        <rdar://problem/35031066>
+
+        Reviewed by Antti Koivisto.
+
+        Decouple scrollbars setup and the unrelated first-layout logic.
+        FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time). 
+
+        Covered by existing test cases.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustScrollbarsForLayout):
+        (WebCore::FrameView::layout):
+        * page/FrameView.h:
+
 2017-10-19  Tim Horton  <[email protected]>
 
         Expand r209943 to suppress paste during provisional navigation as well

Modified: trunk/Source/WebCore/page/FrameView.cpp (223711 => 223712)


--- trunk/Source/WebCore/page/FrameView.cpp	2017-10-19 21:15:34 UTC (rev 223711)
+++ trunk/Source/WebCore/page/FrameView.cpp	2017-10-19 21:23:13 UTC (rev 223712)
@@ -1340,6 +1340,28 @@
         rootRenderer->setChildNeedsLayout();
 }
 
+void FrameView::adjustScrollbarsForLayout(bool isFirstLayout)
+{
+    ScrollbarMode hMode;
+    ScrollbarMode vMode;
+    calculateScrollbarModesForLayout(hMode, vMode);
+    if (isFirstLayout && !isLayoutNested()) {
+        setScrollbarsSuppressed(true);
+        // Set the initial vMode to AlwaysOn if we're auto.
+        if (vMode == ScrollbarAuto)
+            setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
+        // Set the initial hMode to AlwaysOff if we're auto.
+        if (hMode == ScrollbarAuto)
+            setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
+        ASSERT(frame().page());
+        if (frame().page()->expectsWheelEventTriggers())
+            scrollAnimator().setWheelEventTestTrigger(frame().page()->testTrigger());
+        setScrollbarModes(hMode, vMode);
+        setScrollbarsSuppressed(false, true);
+    } else if (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())
+        setScrollbarModes(hMode, vMode);
+}
+
 void FrameView::layout(bool allowSubtreeLayout)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
@@ -1436,33 +1458,12 @@
             if (m_firstLayout && !frame().ownerElement())
                 LOG(Layout, "FrameView %p elapsed time before first layout: %.3fs\n", this, document.timeSinceDocumentCreation().value());
 #endif
-            ScrollbarMode hMode;
-            ScrollbarMode vMode;    
-            calculateScrollbarModesForLayout(hMode, vMode);
-
-            if (m_firstLayout || (hMode != horizontalScrollbarMode() || vMode != verticalScrollbarMode())) {
-                if (m_firstLayout) {
-                    setScrollbarsSuppressed(true);
-
-                    m_firstLayout = false;
-                    m_firstLayoutCallbackPending = true;
-                    m_lastViewportSize = sizeForResizeEvent();
-                    m_lastZoomFactor = layoutRoot->style().zoom();
-
-                    // Set the initial vMode to AlwaysOn if we're auto.
-                    if (vMode == ScrollbarAuto)
-                        setVerticalScrollbarMode(ScrollbarAlwaysOn); // This causes a vertical scrollbar to appear.
-                    // Set the initial hMode to AlwaysOff if we're auto.
-                    if (hMode == ScrollbarAuto)
-                        setHorizontalScrollbarMode(ScrollbarAlwaysOff); // This causes a horizontal scrollbar to disappear.
-                    Page* page = frame().page();
-                    if (page && page->expectsWheelEventTriggers())
-                        scrollAnimator().setWheelEventTestTrigger(page->testTrigger());
-                    setScrollbarModes(hMode, vMode);
-                    setScrollbarsSuppressed(false, true);
-                } else
-                    setScrollbarModes(hMode, vMode);
+            if (m_firstLayout) {
+                m_lastViewportSize = sizeForResizeEvent();
+                m_lastZoomFactor = layoutRoot->style().zoom();
+                m_firstLayoutCallbackPending = true;
             }
+            adjustScrollbarsForLayout(m_firstLayout);
 
             auto oldSize = m_size;
             m_size = layoutSize();
@@ -1473,6 +1474,7 @@
                     markRootOrBodyRendererDirty();
             }
             m_layoutPhase = InPreLayout;
+            m_firstLayout = false;
         }
 
         ASSERT(allowSubtreeLayout || !isSubtreeLayout);

Modified: trunk/Source/WebCore/page/FrameView.h (223711 => 223712)


--- trunk/Source/WebCore/page/FrameView.h	2017-10-19 21:15:34 UTC (rev 223711)
+++ trunk/Source/WebCore/page/FrameView.h	2017-10-19 21:23:13 UTC (rev 223712)
@@ -735,6 +735,8 @@
     IntSize sizeForResizeEvent() const;
     void sendResizeEventIfNeeded();
 
+    void adjustScrollbarsForLayout(bool firstLayout);
+
     void handleDeferredScrollbarsUpdateAfterDirectionChange();
 
     void updateScrollableAreaSet();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to