forked from mirrors/gecko-dev
Bug 1930050 - Make AutoRangeArray check the container type r=m_kato, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D228624
This commit is contained in:
parent
d177494855
commit
86ae9bb8ab
3 changed files with 23 additions and 0 deletions
|
|
@ -665,6 +665,7 @@ GetPointAtFirstContentOfLineOrParentHTMLBlockIfFirstContentOfBlock(
|
||||||
// If we're formatting a block, we should reformat first ancestor format
|
// If we're formatting a block, we should reformat first ancestor format
|
||||||
// block.
|
// block.
|
||||||
if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
|
if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
|
||||||
|
point.IsContainerElement() &&
|
||||||
HTMLEditUtils::IsFormatElementForFormatBlockCommand(
|
HTMLEditUtils::IsFormatElementForFormatBlockCommand(
|
||||||
*point.ContainerAs<Element>())) {
|
*point.ContainerAs<Element>())) {
|
||||||
point.Set(point.GetContainer());
|
point.Set(point.GetContainer());
|
||||||
|
|
@ -836,6 +837,7 @@ static EditorDOMPoint GetPointAfterFollowingLineBreakOrAtFollowingHTMLBlock(
|
||||||
// If we're formatting a block, we should reformat first ancestor format
|
// If we're formatting a block, we should reformat first ancestor format
|
||||||
// block.
|
// block.
|
||||||
if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
|
if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
|
||||||
|
point.IsContainerElement() &&
|
||||||
HTMLEditUtils::IsFormatElementForFormatBlockCommand(
|
HTMLEditUtils::IsFormatElementForFormatBlockCommand(
|
||||||
*point.ContainerAs<Element>())) {
|
*point.ContainerAs<Element>())) {
|
||||||
point.SetAfter(point.GetContainer());
|
point.SetAfter(point.GetContainer());
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,11 @@ class EditorDOMPointBase final {
|
||||||
return mParent && mParent->IsInNativeAnonymousSubtree();
|
return mParent && mParent->IsInNativeAnonymousSubtree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the container node is an element node.
|
||||||
|
*/
|
||||||
|
bool IsContainerElement() const { return mParent && mParent->IsElement(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IsContainerHTMLElement() returns true if the container node is an HTML
|
* IsContainerHTMLElement() returns true if the container node is an HTML
|
||||||
* element node and its node name is aTag.
|
* element node and its node name is aTag.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<script>
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
document.documentElement.contentEditable = "true";
|
||||||
|
document.execCommand("formatBlock", false, "h3");
|
||||||
|
}, {once: true});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
text
|
||||||
|
<!-- no-final-newline -->
|
||||||
Loading…
Reference in a new issue