Diff
Modified: trunk/Source/WebCore/ChangeLog (271054 => 271055)
--- trunk/Source/WebCore/ChangeLog 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/ChangeLog 2020-12-22 18:11:42 UTC (rev 271055)
@@ -1,3 +1,30 @@
+2020-12-22 Antti Koivisto <[email protected]>
+
+ [LFC][Integration] Invalidate line layout path for children of inlines
+ https://bugs.webkit.org/show_bug.cgi?id=219639
+
+ Reviewed by Zalan Bujtas.
+
+ We currently assume you can just invalidate the direct parent.
+
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::blockContainer):
+ (WebCore::LayoutIntegration::LineLayout::containing):
+ * layout/integration/LayoutIntegrationLineLayout.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::insertedIntoTree):
+ (WebCore::RenderObject::willBeRemovedFromTree):
+
+ Invalidate here.
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::setText):
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
+ * rendering/updating/RenderTreeBuilderBlock.cpp:
+ (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
+ (WebCore::RenderTreeBuilder::Block::detach):
+
2020-12-22 Simon Fraser <[email protected]>
Sibling element wheel event regions can be wrong
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (271054 => 271055)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -68,25 +68,33 @@
LineLayout::~LineLayout() = default;
-LineLayout* LineLayout::containing(RenderObject& renderer)
+RenderBlockFlow* LineLayout::blockContainer(RenderObject& renderer)
{
- if (!renderer.isInline())
- return nullptr;
-
// FIXME: These fake renderers have their parent set but are not actually in the tree.
if (renderer.isReplica() || renderer.isRenderScrollbarPart())
return nullptr;
for (auto* parent = renderer.parent(); parent; parent = parent->parent()) {
+ if (!parent->childrenInline())
+ return nullptr;
if (is<RenderBlockFlow>(*parent))
- return downcast<RenderBlockFlow>(*parent).modernLineLayout();
- if (!is<RenderInline>(*parent))
- return nullptr;
+ return downcast<RenderBlockFlow>(parent);
}
return nullptr;
}
+LineLayout* LineLayout::containing(RenderObject& renderer)
+{
+ if (!renderer.isInline())
+ return nullptr;
+
+ if (auto* container = blockContainer(renderer))
+ return container->modernLineLayout();
+
+ return nullptr;
+}
+
const LineLayout* LineLayout::containing(const RenderObject& renderer)
{
return containing(const_cast<RenderObject&>(renderer));
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (271054 => 271055)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h 2020-12-22 18:11:42 UTC (rev 271055)
@@ -56,6 +56,7 @@
LineLayout(RenderBlockFlow&);
~LineLayout();
+ static RenderBlockFlow* blockContainer(RenderObject&);
static LineLayout* containing(RenderObject&);
static const LineLayout* containing(const RenderObject&);
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (271054 => 271055)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -456,6 +456,16 @@
return false;
}
+void RenderBlockFlow::setChildrenInline(bool value)
+{
+ if (childrenInline() && !value) {
+ setLineLayoutPath(UndeterminedPath);
+ m_lineLayout = WTF::Monostate();
+ }
+
+ RenderBlock::setChildrenInline(value);
+}
+
void RenderBlockFlow::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight)
{
ASSERT(needsLayout());
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (271054 => 271055)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2020-12-22 18:11:42 UTC (rev 271055)
@@ -340,6 +340,8 @@
RootInlineBox* firstRootBox() const { return complexLineLayout() ? complexLineLayout()->firstRootBox() : nullptr; }
RootInlineBox* lastRootBox() const { return complexLineLayout() ? complexLineLayout()->lastRootBox() : nullptr; }
+ void setChildrenInline(bool) final;
+
bool hasLines() const;
void invalidateLineLayoutPath() final;
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (271054 => 271055)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -1466,6 +1466,11 @@
void RenderObject::insertedIntoTree()
{
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto* container = LayoutIntegration::LineLayout::blockContainer(*this))
+ container->invalidateLineLayoutPath();
+#endif
+
// FIXME: We should ASSERT(isRooted()) here but generated content makes some out-of-order insertion.
if (!isFloating() && parent()->childrenInline())
parent()->dirtyLinesFromChangedChild(*this);
@@ -1473,6 +1478,11 @@
void RenderObject::willBeRemovedFromTree()
{
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto* container = LayoutIntegration::LineLayout::blockContainer(*this))
+ container->invalidateLineLayoutPath();
+#endif
+
// FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals which would need to be fixed first.
// Update cached boundaries in SVG renderers, if a child is removed.
parent()->setNeedsBoundariesUpdate();
Modified: trunk/Source/WebCore/rendering/RenderObject.h (271054 => 271055)
--- trunk/Source/WebCore/rendering/RenderObject.h 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2020-12-22 18:11:42 UTC (rev 271055)
@@ -284,7 +284,7 @@
bool everHadLayout() const { return m_bitfields.everHadLayout(); }
bool childrenInline() const { return m_bitfields.childrenInline(); }
- void setChildrenInline(bool b) { m_bitfields.setChildrenInline(b); }
+ virtual void setChildrenInline(bool b) { m_bitfields.setChildrenInline(b); }
enum FragmentedFlowState {
NotInsideFragmentedFlow = 0,
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (271054 => 271055)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -1461,9 +1461,11 @@
setNeedsLayoutAndPrefWidthsRecalc();
m_knownToHaveNoOverflowAndNoFallbackFonts = false;
- if (is<RenderBlockFlow>(*parent()))
- downcast<RenderBlockFlow>(*parent()).invalidateLineLayoutPath();
-
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+ if (auto* container = LayoutIntegration::LineLayout::blockContainer(*this))
+ container->invalidateLineLayoutPath();
+#endif
+
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->deferTextChangedIfNeeded(textNode());
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (271054 => 271055)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -460,8 +460,7 @@
if (AXObjectCache* cache = parent.document().axObjectCache())
cache->childrenChanged(&parent, newChild);
- if (is<RenderBlockFlow>(parent))
- downcast<RenderBlockFlow>(parent).invalidateLineLayoutPath();
+
if (parent.hasOutlineAutoAncestor() || parent.outlineStyleForRepaint().outlineStyleIsAuto() == OutlineIsAuto::On)
newChild->setHasOutlineAutoAncestor();
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp (271054 => 271055)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2020-12-22 16:48:30 UTC (rev 271054)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2020-12-22 18:11:42 UTC (rev 271055)
@@ -243,8 +243,6 @@
}
}
- parent.invalidateLineLayoutPath();
-
m_builder.attachToRenderElement(parent, WTFMove(child), beforeChild);
if (madeBoxesNonInline && is<RenderBlock>(parent.parent()) && parent.isAnonymousBlock())
@@ -292,8 +290,6 @@
auto next = makeWeakPtr(oldChild.nextSibling());
bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, prev.get(), next.get());
- parent.invalidateLineLayoutPath();
-
auto takenChild = m_builder.detachFromRenderElement(parent, oldChild);
if (canMergeAnonymousBlocks && prev && next) {