Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r185838 - REGRESSION(r169105) Dangling renderer pointer in Sele…
…ctionSubtreeRoot::SelectionSubtreeData. https://bugs.webkit.org/show_bug.cgi?id=146116 rdar://problem/20959369 Reviewed by Brent Fulgham. This patch ensures that we don't adjust the selection unless the visual selection still matches this subtree root. When multiple selection roots are present we need to ensure that a RenderObject only shows up in one of them. RenderView::splitSelectionBetweenSubtrees(), as the name implies, splits the selection and sets the selection range (start/end) on each selection root. However, SelectionSubtreeRoot::adjustForVisibleSelection() later recomputes the range based on visible selection and that could end up collecting renderers as selection start/end from another selection subtree. RenderObject's holds the last selection state (RenderObject::setSelectionState). If we set a renderer first as "on selection border" and later "inside" using multiple selection roots, we can't clean up selections properly when this object gets destroyed. One of the roots ends up with a dangling RenderObject pointer. Source/WebCore: Test: fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees.html * rendering/SelectionSubtreeRoot.cpp: (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection): LayoutTests: * fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees-expected.txt: Added. * fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees.html: Added.
- Loading branch information
1 parent
3d4c91b
commit dab754b
Showing
5 changed files
with
91 additions
and
9 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
4 changes: 4 additions & 0 deletions
4
LayoutTests/fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees-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,4 @@ | ||
foo | ||
Pass if no crash or assert in debug. | ||
foobar | ||
|
19 changes: 19 additions & 0 deletions
19
LayoutTests/fast/regions/crash-when-renderer-is-in-multiple-selection-subtrees.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,19 @@ | ||
<html id="webtest0"> | ||
<head> | ||
<style> | ||
:last-child { -webkit-flow-into: foo; } | ||
</style> | ||
|
||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
document.write("foo<br>"); | ||
</script> | ||
</head> | ||
<body>Pass if no crash or assert in debug.<summary id="webtest5"><mathml><femerge></femerge></mathml>foobar<table></table></summary></body> | ||
<script> | ||
document.querySelector("#webtest0").appendChild(document.createElement("canvas")); | ||
document.execCommand("SelectAll"); | ||
document.getElementById("webtest5").appendChild(document.createElement("feconvolvematrix")); | ||
</script> | ||
</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
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