mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
![Emilio Cobos Álvarez](/assets/img/avatar_default.png)
This makes our behavior a bit closer to Blink / WebKit. This patch fixes multiple issues: First, fixes the caret movement getting stuck on a <select> element inside an editor. This is because of the IsRootOfAnonymousSubtree() check that I'm removing. Instead of that, consider NAC unselectable in UsedUserSelect, just like generated content. This makes us jump across it correctly, and doesn't regress the test-case that was added in bug 989012. Second, it allows to select nodes with user-select: none as long as you're on an editor. This matches WebKit and Blink. It's something you could do earlier regardless with user-select: all on the parent, which is why the reporter's test-case worked before my patch. I think being able to jump across these and delete them on an editor is the right thing to do. It adds tests for all this plus the same thing working for non-editable contents (there was no pre-existing test for that). Differential Revision: https://phabricator.services.mozilla.com/D18494
34 lines
902 B
HTML
34 lines
902 B
HTML
<!doctype html>
|
|
<html class="reftest-wait">
|
|
<title>Can delete non-editable content in an editor</title>
|
|
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<style>
|
|
div:focus {
|
|
outline: 3px solid blue;
|
|
}
|
|
</style>
|
|
<div contenteditable="true" spellcheck="false">
|
|
xx
|
|
<span contenteditable="false">
|
|
NOT EDITABLE
|
|
</span>
|
|
xxx
|
|
</div>
|
|
<script>
|
|
SimpleTest.waitForFocus(function() {
|
|
document.querySelector('[contenteditable="true"]').focus();
|
|
requestAnimationFrame(function() {
|
|
// Move after the two x
|
|
for (let i = 0; i < 2; ++i)
|
|
synthesizeKey("KEY_ArrowRight");
|
|
// Select whitespace + <span>
|
|
for (let i = 0; i < 2; ++i)
|
|
synthesizeKey("KEY_ArrowRight", { shiftKey: true });
|
|
// Rip it off.
|
|
synthesizeKey("KEY_Delete");
|
|
document.documentElement.removeAttribute("class");
|
|
});
|
|
});
|
|
</script>
|