Commit 86ae9bb8 authored by Masayuki Nakano's avatar Masayuki Nakano
Browse files

Bug 1930050 - Make `AutoRangeArray` check the container type r=m_kato, a=dmeehan

parent d1774948
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -665,6 +665,7 @@ GetPointAtFirstContentOfLineOrParentHTMLBlockIfFirstContentOfBlock(
    // If we're formatting a block, we should reformat first ancestor format
    // block.
    if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
        point.IsContainerElement() &&
        HTMLEditUtils::IsFormatElementForFormatBlockCommand(
            *point.ContainerAs<Element>())) {
      point.Set(point.GetContainer());
@@ -836,6 +837,7 @@ static EditorDOMPoint GetPointAfterFollowingLineBreakOrAtFollowingHTMLBlock(
    // If we're formatting a block, we should reformat first ancestor format
    // block.
    if (aEditSubAction == EditSubAction::eFormatBlockForHTMLCommand &&
        point.IsContainerElement() &&
        HTMLEditUtils::IsFormatElementForFormatBlockCommand(
            *point.ContainerAs<Element>())) {
      point.SetAfter(point.GetContainer());
+5 −0
Original line number Diff line number Diff line
@@ -278,6 +278,11 @@ class EditorDOMPointBase final {
    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
   * element node and its node name is aTag.
+16 −0
Original line number Diff line number Diff line
<!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 -->
 No newline at end of file