зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1763292 - Make `WhiteSpaceVisibilityKeeper::NormalizeVisibleWhiteSpacesAt` check the DOM tree after inserting a `<br>` element r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D143016
This commit is contained in:
Родитель
a90673e931
Коммит
53d56a6994
|
@ -3090,6 +3090,10 @@ nsresult WhiteSpaceVisibilityKeeper::NormalizeVisibleWhiteSpacesAt(
|
|||
atPreviousCharOfEndOfVisibleWhiteSpaces =
|
||||
textFragmentData.GetPreviousEditableCharPoint(
|
||||
atEndOfVisibleWhiteSpaces);
|
||||
if (MOZ_UNLIKELY(NS_WARN_IF(
|
||||
!atPreviousCharOfEndOfVisibleWhiteSpaces.IsSet()))) {
|
||||
return NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE;
|
||||
}
|
||||
atPreviousCharOfPreviousCharOfEndOfVisibleWhiteSpaces =
|
||||
textFragmentData.GetPreviousEditableCharPoint(
|
||||
atPreviousCharOfEndOfVisibleWhiteSpaces);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html class="test-wait">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
try {
|
||||
function onDOMNodeInsertedOfContentEditable() {
|
||||
getSelection().collapse(document.querySelector("input"));
|
||||
document.execCommand("justifyCenter");
|
||||
document.querySelector("dl").addEventListener("DOMSubtreeModified", onDOMSubtreeModifiedOfDLElement);
|
||||
document.querySelector("dl").appendChild(document.querySelector("style"));
|
||||
}
|
||||
function onDOMSubtreeModifiedOfDLElement() {
|
||||
document.execCommand("delete");
|
||||
document.querySelector("label").appendChild(document.querySelector("input"));
|
||||
document.querySelector("dd[contenteditable]").addEventListener("DOMNodeInserted", onDOMNodeInsertedOfContentEditable);
|
||||
}
|
||||
addEventListener("load", () => {
|
||||
onDOMNodeInsertedOfContentEditable();
|
||||
document.documentElement.removeAttribute("class");
|
||||
});
|
||||
} catch (ex) {
|
||||
// maybe too many recursive exception would be thrown.
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body><label></label>
|
||||
<dl>
|
||||
<dd contenteditable>
|
||||
<style>@</style>
|
||||
<input>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче