Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r186984 - REGRESSION (r169105): Do not assign a renderer to mul…
…tiple selection subtrees. https://bugs.webkit.org/show_bug.cgi?id=147038 rdar://problem/21819351 Reviewed by David Kilzer. A renderer should never be assigned to multiple selection subtrees. (Currently RenderObject maintains the last selection state.) RenderView::applySubtreeSelection() loops from the start to the end of the selection to find renderers that are inside the selection. However, in case of regions (when multiple selection roots are present) traversing the renderer tree by calling RenderObject::nextInPreOrder() could end up going across selection roots. This patch ensures that we assign renderers to a specific selection only when the current selection root and the renderer's selection root match. Source/WebCore: Test: fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2.html * rendering/RenderView.cpp: (WebCore::SelectionIterator::SelectionIterator): (WebCore::SelectionIterator::current): (WebCore::SelectionIterator::checkForSpanner): (WebCore::RenderView::applySubtreeSelection): LayoutTests: * fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2-expected.txt: Added. * fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2.html: Added.
- Loading branch information
1 parent
9b6dbb1
commit 7bba30d
Showing
5 changed files
with
104 additions
and
37 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
LayoutTests/fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2-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,3 @@ | ||
PASS if no assert or crash. | ||
|
||
foobar |
23 changes: 23 additions & 0 deletions
23
LayoutTests/fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees2.html
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,23 @@ | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
</script> | ||
<style> | ||
div { -webkit-flow-into: content-flow; } | ||
* { -webkit-flow-into: thread; } | ||
</style> | ||
<body onload="shuffle()"><p>PASS if no assert or crash.</p><div>content</div>foobar</body> | ||
<script> | ||
document.execCommand("SelectAll"); | ||
</script> | ||
<script> | ||
function shuffle() { | ||
var element = document.getElementsByTagName("div")[0]; | ||
element.parentNode.removeChild(element); | ||
document.body.offsetTop; | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
</script> |
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