-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 274097.6@webkit-2024.2-embargoed (446b237f7e06). rdar://1…
…15001663 Prevent selection repaint in the middle of multicolumn flow destruction https://bugs.webkit.org/show_bug.cgi?id=263180 Reviewed by Alan Baradlay. During multicolumn fragmented flow destruction, spanners are moved back to their original DOM position in the tree. This is done through calls to RenderTreeBuilderBlock::Block::detach(RenderBlockFlow&), which also calls the more general RenderBlock ::detach() method for each spanner. The former method results in the destruction of the spanner placeholders and the merging of the necessary multicolumn sets, but this is not done immediately, so the tree is temporarily inconsistent, before the RenderBlock detach() method is called. RenderTreeBuilderBlock::Block::detach(RenderBlock&), however, might inadvertely end up triggering a repaint of the selection that the tree is not ready for. I assume that this is an oversight from the possibility that this method gets called during RenderBlockFlow detachment. This repaint happens because RenderTreeBuilder::detachFromRenderElement() clears the selection if the child being detached is to be destroyed. As WillBeDestroyed::Yes is the default value in the definition of detachFromRenderElement(), this is assumed to be the case, even when that's not what happens during fragmented flow destruction. The problem with this is that the selection repaint will eventually find itself needing a consistent tree, and the fact that multicolumn sets are not merged yet and there are spanners without a placehoder will break assumptions made in RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded(). Fix this by making it possible for both detach() methods to propagate WillBeDestroyed, with a default value of WillBeDestroyed::Yes to preserve current behavior everywhere, but explicitly passing WillBeDestroyed::No during fragmented flow destruction when detaching spanners, as this is what is actually happening. This prevents the selection repaint from happening before the tree is in a consistent state. * LayoutTests/fast/block/multicolumn-with-outline-auto-expected.txt: Added. * LayoutTests/fast/block/multicolumn-with-outline-auto.html: Added. * Source/WebCore/rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::detach): * Source/WebCore/rendering/updating/RenderTreeBuilder.h: * Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp: (WebCore::RenderTreeBuilder::Block::detach): * Source/WebCore/rendering/updating/RenderTreeBuilderBlock.h: * Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp: (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow): Canonical link: https://commits.webkit.org/274097.6@webkit-2024.2-embargoed Canonical link: https://commits.webkit.org/272448.648@safari-7618-branch
- Loading branch information
1 parent
29dc10b
commit 00414cb
Showing
7 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
LayoutTests/fast/block/multicolumn-with-outline-auto-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
HOCUS | ||
POCUS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<style> | ||
* { rotate: 180deg; outline-style: auto; column-span: all;} | ||
*:focus-within { columns: 2; } | ||
</style> | ||
<script> | ||
function f0() { | ||
window.find("POCUS"); | ||
keygen.replaceWith("HOCUS"); | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
|
||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
</script> | ||
<keygen id="keygen" onfocusin="f0()" autofocus="" contenteditable="true"/> | ||
<dir> | ||
<div id="div"> | ||
<label id="label">POCUS</label> | ||
</div> | ||
</dir> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters