Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[iOS] Web content process occasionally crashes under VisibleSelection…
…::adjustPositionForEnd https://bugs.webkit.org/show_bug.cgi?id=225072 rdar://77159489 Reviewed by Darin Adler. Source/WebCore: Add a helper method to check whether or not the given `Position` is in a tree scope. See WebKit/ChangeLog for more details. Test: editing/selection/ios/clear-selection-while-moving-selection-handles.html * dom/Position.h: (WebCore::Position::isInTreeScope const): Source/WebKit: Make `rangeForPointInRootViewCoordinates` robust in the case where the original selection may have become orphaned or null, by checking that the `targetNode` and existing `selectionStart` or `selectionEnd` are in a tree scope before accessing `treeScope()`. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::rangeForPointInRootViewCoordinates): LayoutTests: Add a layout test that programmatically clears the selection in the middle of changing it by moving selection handles. * editing/selection/ios/clear-selection-while-moving-selection-handles-expected.txt: Added. * editing/selection/ios/clear-selection-while-moving-selection-handles.html: Added. Canonical link: https://commits.webkit.org/237102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
103 additions
and
2 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
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,6 @@ | ||
PASS Did not crash | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmodtempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. | ||
This test verifies that programmatically clearing the text selection while interacting with selection handles does not cause a crash. |
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,48 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> | ||
<html> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<head> | ||
<script src="../../../resources/js-test.js"></script> | ||
<script src="../../../resources/ui-helper.js"></script> | ||
<style> | ||
body { | ||
margin: 0; | ||
font-size: 18px; | ||
} | ||
</style> | ||
<script> | ||
jsTestIsAsync = true; | ||
|
||
addEventListener("load", async () => { | ||
let target = document.getElementById("target"); | ||
await UIHelper.longPressElement(target); | ||
await UIHelper.waitForSelectionToAppear(); | ||
let grabberRect = await UIHelper.getSelectionEndGrabberViewRect(); | ||
let grabberLocationX = grabberRect.left + (grabberRect.width / 2); | ||
let grabberLocationY = grabberRect.top + (grabberRect.height / 2); | ||
|
||
selectionChangeCount = 0; | ||
document.addEventListener("selectionchange", () => { | ||
++selectionChangeCount; | ||
if (selectionChangeCount > 5 && getSelection().rangeCount) | ||
getSelection().removeAllRanges(); | ||
}); | ||
|
||
await UIHelper.sendEventStream(new UIHelper.EventStreamBuilder() | ||
.begin(grabberLocationX, grabberLocationY) | ||
.move(10, grabberLocationY, 1) | ||
.end(10, grabberLocationY) | ||
.takeResult()); | ||
|
||
testPassed("Did not crash"); | ||
finishJSTest(); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam | ||
<span id="target">nonumyeirmodtempor</span> invidunt ut labore et dolore magna aliquyam erat, | ||
sed diam voluptua. | ||
<p>This test verifies that programmatically clearing the text selection while interacting with selection handles does not cause a crash.</p> | ||
</body> | ||
</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
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