When caret is [] in the following html then we use [shift] + [arrow right], Gecko select non-editable text and "C" character. This behaviour is different of Blink and WebKit. They select only non-editable element by this operation. ``` <div contenteditable>A[]<span contenteditable=false><B</span>C</div> ``` Another example is `<img>` element with `contenteditable=false`. If this `<img>` element is editable, [shift] + [arrow right] doesn't select "C" character, but if this `<img>` element isn't editable, [shift] + [arrow right] selects additional "C" character on Gecko. ``` <div contenteditable>A[]<img contenteditable=false src=... />C</div> ``` So I would like to change this behaviour to Blink/Webkit way. `PeekOffsetForCharacter` is looking for selection end. When it is selecting elements, if traversed frame/content has non-select frame/content, we select first character of editable text. But when we already have selected element, it is unnecessary to select editable text. Also, bug1524266-4.html is unfortunately work now and we don't support white space compression for this situation (bug 1670518). Even if inner span is editable, we don't compress white space. So we need a workaround for this test. Differential Revision: https://phabricator.services.mozilla.com/D93300
31 lines
891 B
HTML
31 lines
891 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>
|