Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r166457 - Preserve selection end positions in directionOfSelection
<http://webkit.org/b/104813> <rdar://problem/13666417> Reviewed by Brent Fulgham. Merged from Blink (patch by kenrb@chromium.org): https://src.chromium.org/viewvc/blink?revision=150621&view=revision http://crbug.com/164263 VisibleSelection::visibleStart() and VisibleSelection::visibleEnd() can both cause layouts, which has the potential to invalidate any rendertree-based objects. This was causing a problem in FrameSelection::directionOfSelection(), where a reference to a lineBox was being held across a call to visibleEnd(). This patch ensures that the any layout is completed before linebox references are retrieved. Source/WebCore: Test: editing/selection/layout-during-move-selection-crash.html * editing/FrameSelection.cpp: (WebCore::FrameSelection::directionOfSelection): LayoutTests: * editing/selection/layout-during-move-selection-crash-expected.txt: Added. * editing/selection/layout-during-move-selection-crash.html: Added.
- Loading branch information
1 parent
41d51b9
commit 3b8d173
Showing
5 changed files
with
90 additions
and
4 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/editing/selection/layout-during-move-selection-crash-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 @@ | ||
|
||
button PASS, if no crash or assert in debug | ||
|
29 changes: 29 additions & 0 deletions
29
LayoutTests/editing/selection/layout-during-move-selection-crash.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,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<span id=span1></span><button id=button1>button</button> | ||
<style> | ||
.embedStyle { min-height: 13pc; -webkit-transition: 10s; } | ||
</style> | ||
<script> | ||
function runTest() { | ||
div1 = document.createElement("div"); | ||
document.body.appendChild(div1); | ||
embed1 = document.createElementNS("http://www.w3.org/1999/xhtml", "embed"); | ||
document.body.offsetTop; | ||
embed1.setAttribute("class", "embedStyle"); | ||
span1.appendChild(embed1); | ||
embed1.setAttribute("type", "block"); | ||
document.body.offsetTop; | ||
r = document.createRange(); | ||
r.setStart(button1, 0); | ||
r.setEnd(div1, div1.childNodes.length); | ||
window.getSelection().addRange(r); | ||
o = r.extractContents(); | ||
document.body.appendChild(o); | ||
window.getSelection().modify("move", "Right", "character"); | ||
|
||
if (window.testRunner) testRunner.dumpAsText(); | ||
} | ||
document.addEventListener("DOMContentLoaded", runTest, false); | ||
</script>PASS, if no crash or assert in debug | ||
</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