Title: [223622] trunk/Source/WebCore
Revision
223622
Author
za...@apple.com
Date
2017-10-18 12:19:38 -0700 (Wed, 18 Oct 2017)

Log Message

[FrameView::layout cleanup] Move root/body marking dirty logic to a separate function
https://bugs.webkit.org/show_bug.cgi?id=178477
<rdar://problem/35056478>

Reviewed by Simon Fraser.

No change in functionality.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223621 => 223622)


--- trunk/Source/WebCore/ChangeLog	2017-10-18 19:14:51 UTC (rev 223621)
+++ trunk/Source/WebCore/ChangeLog	2017-10-18 19:19:38 UTC (rev 223622)
@@ -1,3 +1,18 @@
+2017-10-18  Zalan Bujtas  <za...@apple.com>
+
+        [FrameView::layout cleanup] Move root/body marking dirty logic to a separate function
+        https://bugs.webkit.org/show_bug.cgi?id=178477
+        <rdar://problem/35056478>
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::markRootOrBodyRendererDirty const):
+        (WebCore::FrameView::layout):
+        * page/FrameView.h:
+
 2017-10-18  Keith Miller  <keith_mil...@apple.com>
 
         Setup WebCore build to start using unified sources.

Modified: trunk/Source/WebCore/page/FrameView.cpp (223621 => 223622)


--- trunk/Source/WebCore/page/FrameView.cpp	2017-10-18 19:14:51 UTC (rev 223621)
+++ trunk/Source/WebCore/page/FrameView.cpp	2017-10-18 19:19:38 UTC (rev 223622)
@@ -1336,6 +1336,18 @@
     return !layoutRoot || !layoutRoot->needsLayout();
 }
 
+void FrameView::markRootOrBodyRendererDirty() const
+{
+    auto& document = *frame().document();
+    RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : nullptr;
+    auto* body = document.bodyOrFrameset();
+    RenderBox* bodyRenderer = rootRenderer && body ? body->renderBox() : nullptr;
+    if (bodyRenderer && bodyRenderer->stretchesToViewport())
+        bodyRenderer->setChildNeedsLayout();
+    else if (rootRenderer && rootRenderer->stretchesToViewport())
+        rootRenderer->setChildNeedsLayout();
+}
+
 void FrameView::layout(bool allowSubtreeLayout)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!frame().document()->inRenderTreeUpdate());
@@ -1476,23 +1488,14 @@
                     setScrollbarModes(hMode, vMode);
             }
 
-            LayoutSize oldSize = m_size;
+            auto oldSize = m_size;
             m_size = layoutSize();
-
             if (oldSize != m_size) {
                 LOG(Layout, "  layout size changed from %.3fx%.3f to %.3fx%.3f", oldSize.width().toFloat(), oldSize.height().toFloat(), m_size.width().toFloat(), m_size.height().toFloat());
                 m_needsFullRepaint = true;
-                if (!m_firstLayout) {
-                    RenderBox* rootRenderer = document.documentElement() ? document.documentElement()->renderBox() : nullptr;
-                    auto* body = document.bodyOrFrameset();
-                    RenderBox* bodyRenderer = rootRenderer && body ? body->renderBox() : nullptr;
-                    if (bodyRenderer && bodyRenderer->stretchesToViewport())
-                        bodyRenderer->setChildNeedsLayout();
-                    else if (rootRenderer && rootRenderer->stretchesToViewport())
-                        rootRenderer->setChildNeedsLayout();
-                }
+                if (!m_firstLayout)
+                    markRootOrBodyRendererDirty();
             }
-
             m_layoutPhase = InPreLayout;
         }
 

Modified: trunk/Source/WebCore/page/FrameView.h (223621 => 223622)


--- trunk/Source/WebCore/page/FrameView.h	2017-10-18 19:14:51 UTC (rev 223621)
+++ trunk/Source/WebCore/page/FrameView.h	2017-10-18 19:19:38 UTC (rev 223622)
@@ -766,6 +766,8 @@
     void startLayoutAtMainFrameViewIfNeeded(bool allowSubtreeLayout);
     bool frameFlatteningEnabled() const;
     bool isFrameFlatteningValidForThisFrame() const;
+    
+    void markRootOrBodyRendererDirty() const;
 
     bool qualifiesAsVisuallyNonEmpty() const;
     bool isViewForDocumentInFrame() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to