Skip to content

Commit

Permalink
Cherry-pick 256843.7@webkit-2022.12-embargoed (3b92d70). rdar://10747…
Browse files Browse the repository at this point in the history
…5202

    Do not skip fragmented flow thread descendents
    https://bugs.webkit.org/show_bug.cgi?id=245374
    rdar://98438399

    Reviewed by Alan Baradlay.

    Do not skip fragmented flow thread descendents in initializeFragmentedFlowStateOnInsertion
    since its children may have a different state based on the inserted fragmented
    flow thread. When a fragmented flow thread is removed there is no effect on the inner
    fragmented flow threads so that behaviour is unchenged.

    * LayoutTests/fast/multicol/nested-columns-out-of-flow-crash-expected.txt: Added.
    * LayoutTests/fast/multicol/nested-columns-out-of-flow-crash.html: Added.
    * Source/WebCore/rendering/RenderObject.cpp:
    (WebCore::RenderObject::setFragmentedFlowStateIncludingDescendants):
    (WebCore::RenderObject::initializeFragmentedFlowStateOnInsertion):
    * Source/WebCore/rendering/RenderObject.h:

    Canonical link: https://commits.webkit.org/256843.7@webkit-2022.12-embargoed

Canonical link: https://commits.webkit.org/262444@main
  • Loading branch information
rwlbuis authored and EWS Buildbot Worker committed Mar 31, 2023
1 parent 8e4a125 commit ea15ace
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
@@ -0,0 +1 @@
Pass if no crash.
12 changes: 12 additions & 0 deletions LayoutTests/fast/multicol/nested-columns-out-of-flow-crash.html
@@ -0,0 +1,12 @@
<div style="column-count: 2">
<div style="position: relative">
<div style="column-count: 2">
<div style="position: absolute"></div>
</div>
</div>
</div>
Pass if no crash.
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
10 changes: 5 additions & 5 deletions Source/WebCore/rendering/RenderObject.cpp
Expand Up @@ -223,7 +223,7 @@ bool RenderObject::isBlockContainer() const
|| display == DisplayType::TableCaption) && !isRenderReplaced();
}

void RenderObject::setFragmentedFlowStateIncludingDescendants(FragmentedFlowState state, const RenderElement* fragmentedFlowRoot)
void RenderObject::setFragmentedFlowStateIncludingDescendants(FragmentedFlowState state, const RenderElement* fragmentedFlowRoot, SkipDescendentFragmentedFlow skipDescendentFragmentedFlow)
{
setFragmentedFlowState(state);

Expand All @@ -232,7 +232,7 @@ void RenderObject::setFragmentedFlowStateIncludingDescendants(FragmentedFlowStat

for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this))) {
// If the child is a fragmentation context it already updated the descendants flag accordingly.
if (child.isRenderFragmentedFlow())
if (child.isRenderFragmentedFlow() && skipDescendentFragmentedFlow == SkipDescendentFragmentedFlow::Yes)
continue;
if (fragmentedFlowRoot && child.isOutOfFlowPositioned()) {
// Fragmented status propagation stops at out-of-flow boundary.
Expand All @@ -248,8 +248,8 @@ void RenderObject::setFragmentedFlowStateIncludingDescendants(FragmentedFlowStat
if (!isInsideMulticolumnFlow())
continue;
}
ASSERT(state != child.fragmentedFlowState());
child.setFragmentedFlowStateIncludingDescendants(state, fragmentedFlowRoot);
ASSERT(skipDescendentFragmentedFlow == SkipDescendentFragmentedFlow::No || state != child.fragmentedFlowState());
child.setFragmentedFlowStateIncludingDescendants(state, fragmentedFlowRoot, skipDescendentFragmentedFlow);
}
}

Expand Down Expand Up @@ -292,7 +292,7 @@ void RenderObject::initializeFragmentedFlowStateOnInsertion()
return;

auto* enclosingFragmentedFlow = locateEnclosingFragmentedFlow();
setFragmentedFlowStateIncludingDescendants(computedState, enclosingFragmentedFlow ? enclosingFragmentedFlow->parent() : nullptr);
setFragmentedFlowStateIncludingDescendants(computedState, enclosingFragmentedFlow ? enclosingFragmentedFlow->parent() : nullptr, SkipDescendentFragmentedFlow::No);
}

void RenderObject::resetFragmentedFlowStateOnRemoval()
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/rendering/RenderObject.h
Expand Up @@ -297,7 +297,8 @@ class RenderObject : public CachedImageClient {
InsideInFragmentedFlow = 1,
};

void setFragmentedFlowStateIncludingDescendants(FragmentedFlowState, const RenderElement* fragmentedFlowRoot);
enum class SkipDescendentFragmentedFlow { No, Yes };
void setFragmentedFlowStateIncludingDescendants(FragmentedFlowState, const RenderElement* fragmentedFlowRoot, SkipDescendentFragmentedFlow = SkipDescendentFragmentedFlow::Yes);

FragmentedFlowState fragmentedFlowState() const { return m_bitfields.fragmentedFlowState(); }
void setFragmentedFlowState(FragmentedFlowState state) { m_bitfields.setFragmentedFlowState(state); }
Expand Down

0 comments on commit ea15ace

Please sign in to comment.