Title: [224559] trunk/Source/WebCore
Revision
224559
Author
za...@apple.com
Date
2017-11-07 16:29:33 -0800 (Tue, 07 Nov 2017)

Log Message

[LayoutState cleanup] Rename enable/disableLayoutState
https://bugs.webkit.org/show_bug.cgi?id=179399
<rdar://problem/35400245>

Reviewed by Antti Koivisto.

It only enables/disables paint offset caching.

No change in functionality.

* page/LayoutContext.cpp:
(WebCore::LayoutContext::pushLayoutState):
(WebCore::LayoutContext::checkLayoutState):
* page/LayoutContext.h:
(WebCore::LayoutContext::isPaintOffsetCacheEnabled const):
(WebCore::LayoutContext::disablePaintOffsetCache):
(WebCore::LayoutContext::enablePaintOffsetCache):
(WebCore::LayoutContext::layoutStateEnabled const): Deleted.
(WebCore::LayoutContext::disableLayoutState): Deleted.
(WebCore::LayoutContext::enableLayoutState): Deleted.
* rendering/LayoutState.cpp:
(WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
(WebCore::LayoutStateMaintainer::push):
(WebCore::LayoutStateMaintainer::pop):
(WebCore::LayoutStateDisabler::LayoutStateDisabler):
(WebCore::LayoutStateDisabler::~LayoutStateDisabler):
(WebCore::shouldDisablePaintOffsetCacheForSubtree):
(WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
(WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
(WebCore::shouldDisableLayoutStateForSubtree): Deleted.
* rendering/LayoutState.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer const):
(WebCore::RenderBox::computeRectForRepaint const):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::clippedOverflowRectForRepaint const):
(WebCore::RenderInline::computeRectForRepaint const):
(WebCore::RenderInline::mapLocalToContainer const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::computeRectForRepaint const):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::layout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224558 => 224559)


--- trunk/Source/WebCore/ChangeLog	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/ChangeLog	2017-11-08 00:29:33 UTC (rev 224559)
@@ -1,3 +1,52 @@
+2017-11-07  Zalan Bujtas  <za...@apple.com>
+
+        [LayoutState cleanup] Rename enable/disableLayoutState
+        https://bugs.webkit.org/show_bug.cgi?id=179399
+        <rdar://problem/35400245>
+
+        Reviewed by Antti Koivisto.
+
+        It only enables/disables paint offset caching.
+
+        No change in functionality.
+
+        * page/LayoutContext.cpp:
+        (WebCore::LayoutContext::pushLayoutState):
+        (WebCore::LayoutContext::checkLayoutState):
+        * page/LayoutContext.h:
+        (WebCore::LayoutContext::isPaintOffsetCacheEnabled const):
+        (WebCore::LayoutContext::disablePaintOffsetCache):
+        (WebCore::LayoutContext::enablePaintOffsetCache):
+        (WebCore::LayoutContext::layoutStateEnabled const): Deleted.
+        (WebCore::LayoutContext::disableLayoutState): Deleted.
+        (WebCore::LayoutContext::enableLayoutState): Deleted.
+        * rendering/LayoutState.cpp:
+        (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
+        (WebCore::LayoutStateMaintainer::push):
+        (WebCore::LayoutStateMaintainer::pop):
+        (WebCore::LayoutStateDisabler::LayoutStateDisabler):
+        (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
+        (WebCore::shouldDisablePaintOffsetCacheForSubtree):
+        (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
+        (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
+        (WebCore::shouldDisableLayoutStateForSubtree): Deleted.
+        * rendering/LayoutState.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::mapLocalToContainer const):
+        (WebCore::RenderBox::computeRectForRepaint const):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::clippedOverflowRectForRepaint const):
+        (WebCore::RenderInline::computeRectForRepaint const):
+        (WebCore::RenderInline::mapLocalToContainer const):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositions):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::computeRectForRepaint const):
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::layout):
+        * rendering/svg/RenderSVGForeignObject.cpp:
+        (WebCore::RenderSVGForeignObject::layout):
+
 2017-11-07  Brady Eidson  <beid...@apple.com>
 
         Implement "UpdateWorkerState" and use it

Modified: trunk/Source/WebCore/page/LayoutContext.cpp (224558 => 224559)


--- trunk/Source/WebCore/page/LayoutContext.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/page/LayoutContext.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -558,7 +558,7 @@
     
 void LayoutContext::pushLayoutState(RenderElement& root)
 {
-    ASSERT(!m_layoutStateDisableCount);
+    ASSERT(!m_paintOffsetCacheDisableCount);
     ASSERT(!m_layoutState);
 
     m_layoutState = std::make_unique<LayoutState>(root);
@@ -600,7 +600,7 @@
 void LayoutContext::checkLayoutState()
 {
     ASSERT(layoutDeltaMatches(LayoutSize()));
-    ASSERT(!m_layoutStateDisableCount);
+    ASSERT(!m_paintOffsetCacheDisableCount);
 }
 #endif
 

Modified: trunk/Source/WebCore/page/LayoutContext.h (224558 => 224559)


--- trunk/Source/WebCore/page/LayoutContext.h	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/page/LayoutContext.h	2017-11-08 00:29:33 UTC (rev 224559)
@@ -94,7 +94,7 @@
     void popLayoutState(RenderObject&);
     LayoutState* layoutState() const { return m_layoutState.get(); }
     // Returns true if layoutState should be used for its cached offset and clip.
-    bool layoutStateEnabled() const { return !m_layoutStateDisableCount && m_layoutState; }
+    bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && m_layoutState; }
 #ifndef NDEBUG
     void checkLayoutState();
 #endif
@@ -141,8 +141,8 @@
     // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around).
     // Note that even when disabled, LayoutState is still used to store layoutDelta.
     // These functions may only be accessed by LayoutStateMaintainer or LayoutStateDisabler.
-    void disableLayoutState() { m_layoutStateDisableCount++; }
-    void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; }
+    void disablePaintOffsetCache() { m_paintOffsetCacheDisableCount++; }
+    void enablePaintOffsetCache() { ASSERT(m_paintOffsetCacheDisableCount > 0); m_paintOffsetCacheDisableCount--; }
 
     Frame& frame() const;
     FrameView& view() const;
@@ -167,7 +167,7 @@
     int m_layoutDisallowedCount { 0 };
     WeakPtr<RenderElement> m_subtreeLayoutRoot;
     std::unique_ptr<LayoutState> m_layoutState;
-    unsigned m_layoutStateDisableCount { 0 };
+    unsigned m_paintOffsetCacheDisableCount { 0 };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/LayoutState.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -218,9 +218,9 @@
     m_lineGridOffset = m_layoutOffset;
 }
 
-LayoutStateMaintainer::LayoutStateMaintainer(RenderBox& root, LayoutSize offset, bool disableState, LayoutUnit pageHeight, bool pageHeightChanged)
+LayoutStateMaintainer::LayoutStateMaintainer(RenderBox& root, LayoutSize offset, bool disablePaintOffsetCache, LayoutUnit pageHeight, bool pageHeightChanged)
     : m_layoutContext(root.view().frameView().layoutContext())
-    , m_disabled(disableState)
+    , m_paintOffsetCacheIsDisabled(disablePaintOffsetCache)
 {
     push(root, offset, pageHeight, pageHeightChanged);
 }
@@ -246,8 +246,8 @@
     m_didPushLayoutState = m_layoutContext.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
     if (!m_didPushLayoutState)
         return;
-    if (m_disabled)
-        m_layoutContext.disableLayoutState();
+    if (m_paintOffsetCacheIsDisabled)
+        m_layoutContext.disablePaintOffsetCache();
 }
 
 void LayoutStateMaintainer::pop()
@@ -259,22 +259,22 @@
     if (!m_didPushLayoutState)
         return;
     m_layoutContext.popLayoutState();
-    if (m_disabled)
-        m_layoutContext.enableLayoutState();
+    if (m_paintOffsetCacheIsDisabled)
+        m_layoutContext.enablePaintOffsetCache();
 }
 
 LayoutStateDisabler::LayoutStateDisabler(LayoutContext& layoutContext)
     : m_layoutContext(layoutContext)
 {
-    m_layoutContext.disableLayoutState();
+    m_layoutContext.disablePaintOffsetCache();
 }
 
 LayoutStateDisabler::~LayoutStateDisabler()
 {
-    m_layoutContext.enableLayoutState();
+    m_layoutContext.enablePaintOffsetCache();
 }
 
-static bool shouldDisableLayoutStateForSubtree(RenderElement& subtreeLayoutRoot)
+static bool shouldDisablePaintOffsetCacheForSubtree(RenderElement& subtreeLayoutRoot)
 {
     for (auto* renderer = &subtreeLayoutRoot; renderer; renderer = renderer->container()) {
         if (renderer->hasTransform() || renderer->hasReflection())
@@ -289,9 +289,9 @@
     if (m_subtreeLayoutRoot) {
         auto& layoutContext = m_subtreeLayoutRoot->view().frameView().layoutContext();
         layoutContext.pushLayoutState(*m_subtreeLayoutRoot);
-        if (shouldDisableLayoutStateForSubtree(*m_subtreeLayoutRoot)) {
-            layoutContext.disableLayoutState();
-            m_didDisableLayoutState = true;
+        if (shouldDisablePaintOffsetCacheForSubtree(*m_subtreeLayoutRoot)) {
+            layoutContext.disablePaintOffsetCache();
+            m_didDisablePaintOffsetCache = true;
         }
     }
 }
@@ -301,8 +301,8 @@
     if (m_subtreeLayoutRoot) {
         auto& layoutContext = m_subtreeLayoutRoot->view().frameView().layoutContext();
         layoutContext.popLayoutState(*m_subtreeLayoutRoot);
-        if (m_didDisableLayoutState)
-            layoutContext.enableLayoutState();
+        if (m_didDisablePaintOffsetCache)
+            layoutContext.enablePaintOffsetCache();
     }
 }
 

Modified: trunk/Source/WebCore/rendering/LayoutState.h (224558 => 224559)


--- trunk/Source/WebCore/rendering/LayoutState.h	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/LayoutState.h	2017-11-08 00:29:33 UTC (rev 224559)
@@ -143,7 +143,7 @@
 
 private:
     LayoutContext& m_layoutContext;
-    bool m_disabled { false };
+    bool m_paintOffsetCacheIsDisabled { false };
     bool m_didCallPush { false };
     bool m_didCallPop { false };
     bool m_didPushLayoutState { false };
@@ -156,7 +156,7 @@
 
 private:
     RenderElement* m_subtreeLayoutRoot { nullptr };
-    bool m_didDisableLayoutState { false };
+    bool m_didDisablePaintOffsetCache { false };
 };
 
 class LayoutStateDisabler {

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -1924,7 +1924,7 @@
     if (repaintContainer == this)
         return;
 
-    if (view().frameView().layoutContext().layoutStateEnabled() && !repaintContainer) {
+    if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repaintContainer) {
         auto* layoutState = view().frameView().layoutContext().layoutState();
         LayoutSize offset = layoutState->m_paintOffset + locationOffset();
         if (style().hasInFlowPosition() && layer())
@@ -2139,8 +2139,8 @@
     // physical coordinate space of the repaintContainer.
     LayoutRect adjustedRect = rect;
     const RenderStyle& styleToUse = style();
-    // LayoutState is only valid for root-relative, non-fixed position repainting
-    if (view().frameView().layoutContext().layoutStateEnabled() && !repaintContainer && styleToUse.position() != FixedPosition) {
+    // Paint offset cache is only valid for root-relative, non-fixed position repainting
+    if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repaintContainer && styleToUse.position() != FixedPosition) {
         auto* layoutState = view().frameView().layoutContext().layoutState();
 
         if (layer() && layer()->transform())

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -1165,7 +1165,7 @@
 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
     // Only first-letter renderers are allowed in here during layout. They mutate the tree triggering repaints.
-    ASSERT(!view().frameView().layoutContext().layoutStateEnabled() || style().styleType() == FIRST_LETTER || hasSelfPaintingLayer());
+    ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled() || style().styleType() == FIRST_LETTER || hasSelfPaintingLayer());
 
     if (!firstLineBoxIncludingCulling() && !continuation())
         return LayoutRect();
@@ -1220,9 +1220,9 @@
 
 LayoutRect RenderInline::computeRectForRepaint(const LayoutRect& rect, const RenderLayerModelObject* repaintContainer, RepaintContext context) const
 {
-    // LayoutState is only valid for root-relative repainting
+    // Repaint offset cache is only valid for root-relative repainting
     LayoutRect adjustedRect = rect;
-    if (view().frameView().layoutContext().layoutStateEnabled() && !repaintContainer) {
+    if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repaintContainer) {
         auto* layoutState = view().frameView().layoutContext().layoutState();
         if (style().hasInFlowPosition() && layer())
             adjustedRect.move(layer()->offsetForInFlowPosition());
@@ -1290,7 +1290,7 @@
     if (repaintContainer == this)
         return;
 
-    if (view().frameView().layoutContext().layoutStateEnabled() && !repaintContainer) {
+    if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repaintContainer) {
         auto* layoutState = view().frameView().layoutContext().layoutState();
         LayoutSize offset = layoutState->m_paintOffset;
         if (style().hasInFlowPosition() && layer())

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -514,10 +514,10 @@
         m_enclosingPaginationLayer = nullptr;
     
     if (m_hasVisibleContent) {
-        // FIXME: LayoutState does not work with RenderLayers as there is not a 1-to-1
+        // FIXME: Paint offset cache does not work with RenderLayers as there is not a 1-to-1
         // mapping between them and the RenderObjects. It would be neat to enable
         // LayoutState outside the layout() phase and use it here.
-        ASSERT(!renderer().view().frameView().layoutContext().layoutStateEnabled());
+        ASSERT(!renderer().view().frameView().layoutContext().isPaintOffsetCacheEnabled());
 
         RenderLayerModelObject* repaintContainer = renderer().containerForRepaint();
         

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -398,7 +398,7 @@
     if (repaintContainer == this)
         return rect;
     LayoutRect adjustedRect = rect;
-    if ((!view().frameView().layoutContext().layoutStateEnabled() || repaintContainer) && parent())
+    if ((!view().frameView().layoutContext().isPaintOffsetCacheEnabled() || repaintContainer) && parent())
         adjustedRect.moveBy(-parentBox()->location()); // Rows are in the same coordinate space, so don't add their offset in.
     return RenderBlockFlow::computeRectForRepaint(adjustedRect, repaintContainer, context);
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -55,8 +55,8 @@
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
 
-    // RenderSVGRoot disables layoutState for the SVG rendering tree.
-    ASSERT(!view().frameView().layoutContext().layoutStateEnabled());
+    // RenderSVGRoot disables paint offset cache for the SVG rendering tree.
+    ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled());
 
     LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this) || selfWillPaint());
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp (224558 => 224559)


--- trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2017-11-08 00:01:45 UTC (rev 224558)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp	2017-11-08 00:29:33 UTC (rev 224559)
@@ -134,7 +134,7 @@
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;
     ASSERT(needsLayout());
-    ASSERT(!view().frameView().layoutContext().layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.
+    ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled()); // RenderSVGRoot disables paint offset cache for the SVG rendering tree.
 
     LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to