Skip to content

Commit

Permalink
part 1: Make AutoMoveOneLineHandler make AutoRangeArray work with…
Browse files Browse the repository at this point in the history
… `BlockInlineCheck::UseComputedDisplayOutsideStyle

`AutoMoveOneLineHandler` uses `AutoRangeArray` API for block level edit
sub-actions.  Therefore, the source line is computed with
`BlockInlineCheck::UseHTMLDefaultStyle`.  However, the deletion handler works
with `BlockInlineCheck::UseComputedDisplayOutsideStyle`.  Therefore,
`AutoMoveOneLineHandler` may try to move different range.  In the reported
test case, it tries to move all content under the `<body>` into the
`<a display="table-header-group">` which is contained in the range.  Therefore,
the `movedContentRange` check fails after the destination becomes into an
orphan node which was removed to move.

This patch renames the API and adds a `BlockInlineCheck` parameter to work
with both ways and makes `AutoMoveOneLineHandler` specify
`BlockInlineCheck::UseComputedDisplayOutsideStyle` as same as the other delete
handlers.

Finally, same thing may happen in
`HTMLEditor::OnEndHandlingTopLevelEditSubActionInternal`.  This patch makes it
check whether the top-level edit sub-action is a block level one or not and
consider `BlockInlineCheck` with the result.

Depends on D194180

Differential Revision: https://phabricator.services.mozilla.com/D194181

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1865729
gecko-commit: edf9292c0bc9c671afa4de12648c16622e9d418c
gecko-reviewers: m_kato
  • Loading branch information
masayuki-nakano authored and moz-wptsync-bot committed Nov 27, 2023
1 parent 13e768d commit 51c42fc
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta char="utf-8">
<script>
addEventListener("load", () => {
document.documentElement.contentEditable = true;
getSelection().collapse(document.querySelector("svg"), document.querySelector("svg").childNodes.length);
document.execCommand("delete");
});
</script>
<body>
<svg>
<a display="table-header-group">
</a>
</svg></body></html>

0 comments on commit 51c42fc

Please sign in to comment.