Diff
Modified: trunk/Source/WebCore/ChangeLog (252486 => 252487)
--- trunk/Source/WebCore/ChangeLog 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/ChangeLog 2019-11-15 17:00:33 UTC (rev 252487)
@@ -1,3 +1,32 @@
+2019-11-15 Zalan Bujtas <[email protected]>
+
+ [LFC][Invalidation] Reuse FrameViewLayoutContext::m_layoutState for incremental layout
+ https://bugs.webkit.org/show_bug.cgi?id=204225
+ <rdar://problem/57227259>
+
+ Reviewed by Antti Koivisto.
+
+ Let's rely on the invalidation logic instead of reconstructing the layout state on each layout frame.
+
+ * layout/LayoutContext.cpp:
+ (WebCore::Layout::initializeLayoutState):
+ (WebCore::Layout::LayoutContext::runLayoutAndVerify):
+ (WebCore::Layout::LayoutContext::createLayoutState):
+ * layout/LayoutContext.h:
+ * layout/LayoutState.h:
+ (WebCore::Layout::LayoutState::rootRenderer const):
+ * layout/Verification.cpp:
+ (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::paintContents):
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
+ * page/FrameViewLayoutContext.h:
+ (WebCore::FrameViewLayoutContext::layoutFormattingState const):
+ (WebCore::FrameViewLayoutContext::initialLayoutState const): Deleted.
+ * rendering/updating/RenderTreeUpdater.cpp:
+ (WebCore::RenderTreeUpdater::updateRendererStyle):
+
2019-11-15 Simon Fraser <[email protected]>
The image is flashing if falls out and has an animation transform: rotate
Modified: trunk/Source/WebCore/layout/LayoutContext.cpp (252486 => 252487)
--- trunk/Source/WebCore/layout/LayoutContext.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/layout/LayoutContext.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -141,12 +141,18 @@
LayoutContext(layoutState).layout(invalidationState);
}
-std::unique_ptr<LayoutState> LayoutContext::runLayoutAndVerify(const RenderView& renderView)
+void LayoutContext::runLayoutAndVerify(LayoutState& layoutState)
{
+ runLayout(layoutState);
+#ifndef NDEBUG
+ LayoutContext::verifyAndOutputMismatchingLayoutTree(layoutState);
+#endif
+}
+
+std::unique_ptr<LayoutState> LayoutContext::createLayoutState(const RenderView& renderView)
+{
auto layoutState = makeUnique<LayoutState>(TreeBuilder::buildLayoutTree(renderView));
initializeLayoutState(*layoutState, renderView);
- runLayout(*layoutState);
- LayoutContext::verifyAndOutputMismatchingLayoutTree(*layoutState, renderView);
return layoutState;
}
Modified: trunk/Source/WebCore/layout/LayoutContext.h (252486 => 252487)
--- trunk/Source/WebCore/layout/LayoutContext.h 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/layout/LayoutContext.h 2019-11-15 17:00:33 UTC (rev 252487)
@@ -53,7 +53,8 @@
WTF_MAKE_ISO_ALLOCATED(LayoutContext);
public:
// FIXME: These are temporary entry points for LFC layout.
- static std::unique_ptr<LayoutState> runLayoutAndVerify(const RenderView&);
+ static std::unique_ptr<LayoutState> createLayoutState(const RenderView&);
+ static void runLayoutAndVerify(LayoutState&);
static void paint(const LayoutState&, GraphicsContext&, const IntRect& dirtyRect);
LayoutContext(LayoutState&);
@@ -66,7 +67,9 @@
LayoutState& layoutState() { return m_layoutState; }
// For testing purposes only
- static void verifyAndOutputMismatchingLayoutTree(const LayoutState&, const RenderView&);
+#ifndef NDEBUG
+ static void verifyAndOutputMismatchingLayoutTree(const LayoutState&);
+#endif
static void runLayout(LayoutState&);
LayoutState& m_layoutState;
Modified: trunk/Source/WebCore/layout/LayoutState.h (252486 => 252487)
--- trunk/Source/WebCore/layout/LayoutState.h 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/layout/LayoutState.h 2019-11-15 17:00:33 UTC (rev 252487)
@@ -73,7 +73,9 @@
bool inNoQuirksMode() const { return m_quirksMode == QuirksMode::No; }
const Container& root() const { return *m_layoutTreeContent.rootLayoutBox; }
-
+#ifndef NDEBUG
+ const RenderBox& rootRenderer() const { return m_layoutTreeContent.rootRenderer; }
+#endif
Box* layoutBoxForRenderer(const RenderObject& renderer) const { return m_layoutTreeContent.renderObjectToLayoutBox.get(&renderer); }
private:
Modified: trunk/Source/WebCore/layout/Verification.cpp (252486 => 252487)
--- trunk/Source/WebCore/layout/Verification.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/layout/Verification.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -28,6 +28,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+#ifndef NDEBUG
#include "DisplayBox.h"
#include "InlineFormattingState.h"
#include "InlineTextBox.h"
@@ -323,15 +324,16 @@
return mismtachingGeometry;
}
-void LayoutContext::verifyAndOutputMismatchingLayoutTree(const LayoutState& layoutState, const RenderView& renderView)
+void LayoutContext::verifyAndOutputMismatchingLayoutTree(const LayoutState& layoutState)
{
TextStream stream;
auto& layoutRoot = layoutState.root();
- auto mismatchingGeometry = verifyAndOutputSubtree(stream, layoutState, renderView, layoutRoot);
+ auto& rootRenderer = layoutState.rootRenderer();
+ auto mismatchingGeometry = verifyAndOutputSubtree(stream, layoutState, rootRenderer, layoutRoot);
if (!mismatchingGeometry)
return;
#if ENABLE(TREE_DEBUGGING)
- showRenderTree(&renderView);
+ showRenderTree(&rootRenderer);
showLayoutTree(layoutRoot, &layoutState);
#endif
WTFLogAlways("%s", stream.release().utf8().data());
@@ -342,3 +344,5 @@
}
#endif
+
+#endif
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (252486 => 252487)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -35,6 +35,7 @@
#include "LayoutBox.h"
#include "LayoutChildIterator.h"
#include "LayoutContainer.h"
+#include "LayoutContext.h"
#include "LayoutState.h"
#include "Logging.h"
#include <wtf/IsoMallocInlines.h>
Modified: trunk/Source/WebCore/page/FrameView.cpp (252486 => 252487)
--- trunk/Source/WebCore/page/FrameView.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/page/FrameView.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -4169,7 +4169,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
- if (auto* layoutState = layoutContext().initialLayoutState())
+ if (auto* layoutState = layoutContext().layoutFormattingState())
Layout::LayoutContext::paint(*layoutState, context, dirtyRect);
return;
}
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (252486 => 252487)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -55,7 +55,9 @@
{
if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled())
return;
- m_initialLayoutState = Layout::LayoutContext::runLayoutAndVerify(*renderView());
+ if (!m_layoutState)
+ m_layoutState = Layout::LayoutContext::createLayoutState(*renderView());
+ Layout::LayoutContext::runLayoutAndVerify(*m_layoutState);
}
#endif
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.h (252486 => 252487)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-11-15 17:00:33 UTC (rev 252487)
@@ -116,7 +116,7 @@
using LayoutStateStack = Vector<std::unique_ptr<RenderLayoutState>>;
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- const Layout::LayoutState* initialLayoutState() const { return m_initialLayoutState.get(); }
+ const Layout::LayoutState* layoutFormattingState() const { return m_layoutState.get(); }
#endif
private:
@@ -188,7 +188,7 @@
unsigned m_paintOffsetCacheDisableCount { 0 };
LayoutStateStack m_layoutStateStack;
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- std::unique_ptr<Layout::LayoutState> m_initialLayoutState;
+ std::unique_ptr<Layout::LayoutState> m_layoutState;
#endif
};
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (252486 => 252487)
--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2019-11-15 16:58:59 UTC (rev 252486)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2019-11-15 17:00:33 UTC (rev 252487)
@@ -297,9 +297,9 @@
m_builder.normalizeTreeAfterStyleChange(renderer, oldStyle);
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
- if (!m_document.view() || m_document.view()->layoutContext().initialLayoutState())
+ if (!m_document.view() || m_document.view()->layoutContext().layoutFormattingState())
return;
- if (auto* layoutBox = m_document.view()->layoutContext().initialLayoutState()->layoutBoxForRenderer(renderer))
+ if (auto* layoutBox = m_document.view()->layoutContext().layoutFormattingState()->layoutBoxForRenderer(renderer))
layoutBox->updateStyle(newStyle);
}
#endif