Diff
Modified: trunk/Source/WebCore/ChangeLog (267179 => 267180)
--- trunk/Source/WebCore/ChangeLog 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/ChangeLog 2020-09-17 02:59:56 UTC (rev 267180)
@@ -1,3 +1,54 @@
+2020-09-16 Zalan Bujtas <[email protected]>
+
+ [LFC] Remove partial invalidation
+ https://bugs.webkit.org/show_bug.cgi?id=216631
+
+ Reviewed by Simon Fraser.
+
+ Invalidation fails when the LayoutTree does not match the RenderTree structures (e.g. table wrapper box).
+ Since incremental layouts are not supported yet, it has a very little value. Let's remove it for now.
+
+ * layout/display/DisplayView.h:
+ * layout/integration/LayoutIntegrationLineLayout.h:
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::LayoutTree::LayoutTree):
+ (WebCore::Layout::TreeBuilder::buildLayoutTree):
+ (WebCore::Layout::TreeBuilder::TreeBuilder):
+ (WebCore::Layout::TreeBuilder::createReplacedBox):
+ (WebCore::Layout::TreeBuilder::createTextBox):
+ (WebCore::Layout::TreeBuilder::createLineBreakBox):
+ (WebCore::Layout::TreeBuilder::createContainer):
+ (WebCore::Layout::TreeBuilder::createLayoutBox):
+ (WebCore::Layout::printLayoutTreeForLiveDocuments):
+ (WebCore::Layout::LayoutTreeContent::LayoutTreeContent): Deleted.
+ (WebCore::Layout::LayoutTreeContent::addLayoutBoxForRenderer): Deleted.
+ (WebCore::Layout::TreeBuilder::buildTree): Deleted.
+ * layout/layouttree/LayoutTreeBuilder.h:
+ (WebCore::Layout::LayoutTree::root const):
+ (WebCore::Layout::LayoutTree::append):
+ (WebCore::Layout::LayoutTreeContent::rootLayoutBox const): Deleted.
+ (WebCore::Layout::LayoutTreeContent::rootLayoutBox): Deleted.
+ (WebCore::Layout::LayoutTreeContent::rootRenderer const): Deleted.
+ (WebCore::Layout::LayoutTreeContent::addBox): Deleted.
+ (WebCore::Layout::LayoutTreeContent::addContainer): Deleted.
+ (WebCore::Layout::LayoutTreeContent::layoutBoxForRenderer): Deleted.
+ (WebCore::Layout::LayoutTreeContent::layoutBoxForRenderer const): Deleted.
+ (WebCore::Layout::LayoutTreeContent::rendererForLayoutBox const): Deleted.
+ * page/FrameViewLayoutContext.cpp:
+ (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
+ (WebCore::FrameViewLayoutContext::invalidateLayoutTreeContent): Deleted.
+ (WebCore::FrameViewLayoutContext::invalidateLayoutState): Deleted.
+ * page/FrameViewLayoutContext.h:
+ (WebCore::FrameViewLayoutContext::layoutFormattingState const):
+ (WebCore::FrameViewLayoutContext::layoutTreeContent const): Deleted.
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::imageChanged):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
+ (WebCore::RenderTreeBuilder::detachFromRenderElement):
+ * rendering/updating/RenderTreeUpdater.cpp:
+ (WebCore::RenderTreeUpdater::updateRendererStyle):
+
2020-09-16 Ryosuke Niwa <[email protected]>
MutationObserverRegistration should be ref counted
Modified: trunk/Source/WebCore/layout/display/DisplayView.h (267179 => 267180)
--- trunk/Source/WebCore/layout/display/DisplayView.h 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/layout/display/DisplayView.h 2020-09-17 02:59:56 UTC (rev 267180)
@@ -40,7 +40,7 @@
namespace Layout {
class LayoutState;
-class LayoutTreeContent;
+class LayoutTree;
}
namespace Display {
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (267179 => 267180)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h 2020-09-17 02:59:56 UTC (rev 267180)
@@ -47,10 +47,6 @@
struct InlineContent;
}
-namespace Layout {
-class LayoutTreeContent;
-}
-
namespace LayoutIntegration {
class LineLayout {
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (267179 => 267180)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2020-09-17 02:59:56 UTC (rev 267180)
@@ -67,22 +67,11 @@
namespace WebCore {
namespace Layout {
-WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutTreeContent);
-LayoutTreeContent::LayoutTreeContent(const RenderBox& rootRenderer, std::unique_ptr<ContainerBox> rootLayoutBox)
- : m_rootRenderer(rootRenderer)
- , m_rootLayoutBox(WTFMove(rootLayoutBox))
+WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutTree);
+LayoutTree::LayoutTree()
{
}
-LayoutTreeContent::~LayoutTreeContent() = default;
-
-
-void LayoutTreeContent::addLayoutBoxForRenderer(const RenderObject& renderer, Box& layoutBox)
-{
- m_renderObjectToLayoutBox.add(&renderer, &layoutBox);
- m_layoutBoxToRenderObject.add(&layoutBox, &renderer);
-}
-
static void appendChild(ContainerBox& parent, Box& newChild)
{
if (!parent.hasChild()) {
@@ -123,34 +112,32 @@
return true;
}
-std::unique_ptr<Layout::LayoutTreeContent> TreeBuilder::buildLayoutTree(const RenderView& renderView)
+std::unique_ptr<Layout::LayoutTree> TreeBuilder::buildLayoutTree(const RenderView& renderView)
{
PhaseScope scope(Phase::Type::TreeBuilding);
- auto style = RenderStyle::clone(renderView.style());
- style.setLogicalWidth(Length(renderView.width(), Fixed));
- style.setLogicalHeight(Length(renderView.height(), Fixed));
+ auto rootStyle = RenderStyle::clone(renderView.style());
+ rootStyle.setLogicalWidth(Length(renderView.width(), Fixed));
+ rootStyle.setLogicalHeight(Length(renderView.height(), Fixed));
- auto layoutTreeContent = makeUnique<LayoutTreeContent>(renderView, makeUnique<InitialContainingBlock>(WTFMove(style)));
- TreeBuilder(*layoutTreeContent).buildTree();
- return layoutTreeContent;
+ auto rootLayoutBox = makeUnique<InitialContainingBlock>(WTFMove(rootStyle));
+ auto& rootContainer = *rootLayoutBox;
+ auto layoutTree = makeUnique<LayoutTree>();
+ layoutTree->append(WTFMove(rootLayoutBox));
+ TreeBuilder(*layoutTree).buildSubTree(renderView, rootContainer);
+ return layoutTree;
}
-TreeBuilder::TreeBuilder(LayoutTreeContent& layoutTreeContent)
- : m_layoutTreeContent(layoutTreeContent)
+TreeBuilder::TreeBuilder(LayoutTree& layoutTree)
+ : m_layoutTree(layoutTree)
{
}
-void TreeBuilder::buildTree()
-{
- buildSubTree(m_layoutTreeContent.rootRenderer(), m_layoutTreeContent.rootLayoutBox());
-}
-
Box& TreeBuilder::createReplacedBox(Optional<Box::ElementAttributes> elementAttributes, RenderStyle&& style)
{
auto newBox = makeUnique<ReplacedBox>(elementAttributes, WTFMove(style));
auto& box = *newBox;
- m_layoutTreeContent.addBox(WTFMove(newBox));
+ m_layoutTree.append(WTFMove(newBox));
return box;
}
@@ -158,7 +145,7 @@
{
auto newBox = makeUnique<InlineTextBox>(text, canUseSimplifiedTextMeasuring, WTFMove(style));
auto& box = *newBox;
- m_layoutTreeContent.addBox(WTFMove(newBox));
+ m_layoutTree.append(WTFMove(newBox));
return box;
}
@@ -166,7 +153,7 @@
{
auto newBox = makeUnique<Layout::LineBreakBox>(isOptional, WTFMove(style));
auto& box = *newBox;
- m_layoutTreeContent.addBox(WTFMove(newBox));
+ m_layoutTree.append(WTFMove(newBox));
return box;
}
@@ -174,7 +161,7 @@
{
auto newContainer = makeUnique<ContainerBox>(elementAttributes, WTFMove(style));
auto& container = *newContainer;
- m_layoutTreeContent.addContainer(WTFMove(newContainer));
+ m_layoutTree.append(WTFMove(newContainer));
return container;
}
@@ -299,7 +286,6 @@
if (childRenderer.isAnonymous())
childLayoutBox->setIsAnonymous();
}
- m_layoutTreeContent.addLayoutBoxForRenderer(childRenderer, *childLayoutBox);
return childLayoutBox;
}
@@ -547,8 +533,8 @@
fprintf(stderr, "%s\n", document->url().string().utf8().data());
// FIXME: Need to find a way to output geometry without layout context.
auto& renderView = *document->renderView();
- auto layoutTreeContent = TreeBuilder::buildLayoutTree(renderView);
- auto layoutState = LayoutState { *document, layoutTreeContent->rootLayoutBox() };
+ auto layoutTree = TreeBuilder::buildLayoutTree(renderView);
+ auto layoutState = LayoutState { *document, layoutTree->root() };
auto& layoutRoot = layoutState.root();
auto invalidationState = InvalidationState { };
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h (267179 => 267180)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h 2020-09-17 02:59:56 UTC (rev 267180)
@@ -44,48 +44,26 @@
class LayoutState;
-class LayoutTreeContent : public CanMakeWeakPtr<LayoutTreeContent> {
- WTF_MAKE_ISO_ALLOCATED(LayoutTreeContent);
+class LayoutTree {
+ WTF_MAKE_ISO_ALLOCATED(LayoutTree);
public:
- LayoutTreeContent(const RenderBox&, std::unique_ptr<ContainerBox>);
- ~LayoutTreeContent();
+ LayoutTree();
+ ~LayoutTree() = default;
- const ContainerBox& rootLayoutBox() const { return *m_rootLayoutBox; }
- ContainerBox& rootLayoutBox() { return *m_rootLayoutBox; }
- const RenderBox& rootRenderer() const { return m_rootRenderer; }
+ const ContainerBox& root() const { return downcast<ContainerBox>(*m_layoutBoxes[0]); }
+ void append(std::unique_ptr<Box> box) { m_layoutBoxes.append(WTFMove(box)); }
- void addBox(std::unique_ptr<Box> box)
- {
- ASSERT(!box->isContainerBox());
- m_boxes.add(WTFMove(box));
- }
- void addContainer(std::unique_ptr<ContainerBox> container) { m_containers.add(WTFMove(container)); }
-
- Box* layoutBoxForRenderer(const RenderObject& renderer) { return m_renderObjectToLayoutBox.get(&renderer); }
- const Box* layoutBoxForRenderer(const RenderObject& renderer) const { return m_renderObjectToLayoutBox.get(&renderer); }
-
- const RenderObject* rendererForLayoutBox(const Box& box) const { return m_layoutBoxToRenderObject.get(&box); }
-
- void addLayoutBoxForRenderer(const RenderObject&, Box&);
-
private:
- const RenderBox& m_rootRenderer;
- std::unique_ptr<ContainerBox> m_rootLayoutBox;
- HashSet<std::unique_ptr<Box>> m_boxes;
- HashSet<std::unique_ptr<ContainerBox>> m_containers;
-
- HashMap<const RenderObject*, Box*> m_renderObjectToLayoutBox;
- HashMap<const Box*, const RenderObject*> m_layoutBoxToRenderObject;
+ Vector<std::unique_ptr<Box>> m_layoutBoxes;
};
class TreeBuilder {
public:
- static std::unique_ptr<Layout::LayoutTreeContent> buildLayoutTree(const RenderView&);
+ static std::unique_ptr<Layout::LayoutTree> buildLayoutTree(const RenderView&);
private:
- TreeBuilder(LayoutTreeContent&);
+ TreeBuilder(LayoutTree&);
- void buildTree();
void buildSubTree(const RenderElement& parentRenderer, ContainerBox& parentContainer);
void buildTableStructure(const RenderTable& tableRenderer, ContainerBox& tableWrapperBox);
Box* createLayoutBox(const ContainerBox& parentContainer, const RenderObject& childRenderer);
@@ -95,7 +73,7 @@
Box& createLineBreakBox(bool isOptional, RenderStyle&&);
ContainerBox& createContainer(Optional<Box::ElementAttributes>, RenderStyle&&);
- LayoutTreeContent& m_layoutTreeContent;
+ LayoutTree& m_layoutTree;
};
#if ENABLE(TREE_DEBUGGING)
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.cpp (267179 => 267180)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.cpp 2020-09-17 02:59:56 UTC (rev 267180)
@@ -60,20 +60,13 @@
{
if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled())
return;
-
// FrameView::setContentsSize temporary disables layout.
if (m_disableSetNeedsLayoutCount)
return;
auto& renderView = *this->renderView();
- if (!m_layoutTreeContent) {
- m_layoutTreeContent = Layout::TreeBuilder::buildLayoutTree(renderView);
- // FIXME: New layout tree requires a new state for now.
- m_layoutState = nullptr;
- }
- if (!m_layoutState)
- m_layoutState = makeUnique<Layout::LayoutState>(*document(), m_layoutTreeContent->rootLayoutBox());
-
+ m_layoutTree = Layout::TreeBuilder::buildLayoutTree(renderView);
+ m_layoutState = makeUnique<Layout::LayoutState>(*document(), m_layoutTree->root());
// FIXME: This is not the real invalidation yet.
auto invalidationState = Layout::InvalidationState { };
auto layoutContext = Layout::LayoutContext { *m_layoutState };
@@ -89,21 +82,10 @@
descendant.clearNeedsLayout();
renderView.clearNeedsLayout();
}
-
#ifndef NDEBUG
Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree(*m_layoutState, renderView);
#endif
}
-
-void FrameViewLayoutContext::invalidateLayoutTreeContent()
-{
- m_layoutTreeContent = nullptr;
-}
-
-void FrameViewLayoutContext::invalidateLayoutState()
-{
- m_layoutState = nullptr;
-}
#endif
static bool isObjectAncestorContainerOf(RenderElement& ancestor, RenderElement& descendant)
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.h (267179 => 267180)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.h 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.h 2020-09-17 02:59:56 UTC (rev 267180)
@@ -45,7 +45,7 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
namespace Layout {
class LayoutState;
-class LayoutTreeContent;
+class LayoutTree;
}
#endif
@@ -118,9 +118,6 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
const Layout::LayoutState* layoutFormattingState() const { return m_layoutState.get(); }
- Layout::LayoutTreeContent* layoutTreeContent() const { return m_layoutTreeContent.get(); }
- void invalidateLayoutTreeContent();
- void invalidateLayoutState();
#endif
private:
@@ -192,7 +189,7 @@
LayoutStateStack m_layoutStateStack;
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
std::unique_ptr<Layout::LayoutState> m_layoutState;
- std::unique_ptr<Layout::LayoutTreeContent> m_layoutTreeContent;
+ std::unique_ptr<Layout::LayoutTree> m_layoutTree;
#endif
};
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (267179 => 267180)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2020-09-17 02:59:56 UTC (rev 267180)
@@ -307,11 +307,6 @@
repaintOrMarkForLayout(imageSizeChange, rect);
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->deferRecomputeIsIgnoredIfNeeded(element());
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled())
- view().frameView().layoutContext().invalidateLayoutTreeContent();
-#endif
}
void RenderImage::updateIntrinsicSizeIfNeeded(const LayoutSize& newSize)
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (267179 => 267180)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-09-17 02:59:56 UTC (rev 267180)
@@ -464,13 +464,6 @@
downcast<RenderBlockFlow>(parent).invalidateLineLayoutPath();
if (parent.hasOutlineAutoAncestor() || parent.outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On)
newChild->setHasOutlineAutoAncestor();
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
- if (parent.document().view())
- parent.document().view()->layoutContext().invalidateLayoutTreeContent();
-
- }
-#endif
}
void RenderTreeBuilder::move(RenderBoxModelObject& from, RenderBoxModelObject& to, RenderObject& child, RenderObject* beforeChild, NormalizeAfterInsertion normalizeAfterInsertion)
@@ -895,13 +888,6 @@
if (AXObjectCache* cache = parent.document().existingAXObjectCache())
cache->childrenChanged(&parent);
}
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
- if (parent.document().view())
- parent.document().view()->layoutContext().invalidateLayoutTreeContent();
-
- }
-#endif
return childToTake;
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (267179 => 267180)
--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2020-09-17 02:58:36 UTC (rev 267179)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp 2020-09-17 02:59:56 UTC (rev 267180)
@@ -296,17 +296,6 @@
auto oldStyle = RenderStyle::clone(renderer.style());
renderer.setStyle(WTFMove(newStyle), minimalStyleDifference);
m_builder.normalizeTreeAfterStyleChange(renderer, oldStyle);
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
- if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextEnabled()) {
- if (!m_document.view() || !m_document.view()->layoutContext().layoutTreeContent())
- return;
- auto& layoutContext = m_document.view()->layoutContext();
- if (minimalStyleDifference >= StyleDifference::LayoutPositionedMovementOnly || renderer.needsLayout())
- layoutContext.invalidateLayoutState();
- if (auto* layoutBox = layoutContext.layoutTreeContent()->layoutBoxForRenderer(renderer))
- layoutBox->updateStyle(renderer.style());
- }
-#endif
}
void RenderTreeUpdater::updateElementRenderer(Element& element, const Style::ElementUpdate& update)