Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r221128 - DeleteSelectionCommand should be robust when starting…
… and ending editable positions cannot be found https://bugs.webkit.org/show_bug.cgi?id=175914 <rdar://problem/29792688> Reviewed by Ryosuke Niwa. Source/WebCore: DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can happen when attempting to delete after selecting the contents within a canvas or output element with `read-write` `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust when editable start and end positions are missing. Test: editing/execCommand/forward-delete-read-write-canvas.html * editing/DeleteSelectionCommand.cpp: (WebCore::DeleteSelectionCommand::initializePositionData): Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails early if initializePositionData returned false. (WebCore::DeleteSelectionCommand::doApply): * editing/DeleteSelectionCommand.h: LayoutTests: Adds a new LayoutTest. This test passes if WebKit successfully loaded the page. * editing/execCommand/forward-delete-read-write-canvas-expected.txt: Added. * editing/execCommand/forward-delete-read-write-canvas.html: Added.
- Loading branch information
1 parent
9f69772
commit b23f031
Showing
6 changed files
with
56 additions
and
3 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
1 change: 1 addition & 0 deletions
1
LayoutTests/editing/execCommand/forward-delete-read-write-canvas-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 @@ | ||
PASS |
9 changes: 9 additions & 0 deletions
9
LayoutTests/editing/execCommand/forward-delete-read-write-canvas.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,9 @@ | ||
<code style="color: green">PASS</code> | ||
<canvas style="-webkit-user-modify: read-write"><span><input id="input"></input></span></canvas> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
input.focus(); | ||
input.remove(); | ||
document.execCommand("ForwardDelete"); | ||
</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
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