Bug 1649121: part 9) Simplify GetMostAncestorListOrTableElement. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D81547
This commit is contained in:
Mirko Brodesser 2020-06-30 13:13:12 +00:00
parent 4477882999
commit fb374f2e74
2 changed files with 6 additions and 6 deletions

View File

@ -4476,10 +4476,10 @@ class HTMLEditor final : public TextEditor,
* element which is in aArrayOfListAndTableElements and they are * element which is in aArrayOfListAndTableElements and they are
* actually valid ancestor of at least one of aArrayOfTopMostChildContents. * actually valid ancestor of at least one of aArrayOfTopMostChildContents.
*/ */
Element* GetMostAncestorListOrTableElement( static Element* GetMostAncestorListOrTableElement(
const nsTArray<OwningNonNull<nsIContent>>& aArrayOfTopMostChildContents, const nsTArray<OwningNonNull<nsIContent>>& aArrayOfTopMostChildContents,
const nsTArray<OwningNonNull<Element>>& const nsTArray<OwningNonNull<Element>>&
aArrayOfListAndTableRelatedElements) const; aArrayOfListAndTableRelatedElements);
/** /**
* FindReplaceableTableElement() is a helper method of * FindReplaceableTableElement() is a helper method of

View File

@ -3122,15 +3122,15 @@ void HTMLEditor::AutoHTMLFragmentBoundariesFixer::
} }
} }
// static
Element* Element*
HTMLEditor::AutoHTMLFragmentBoundariesFixer::GetMostAncestorListOrTableElement( HTMLEditor::AutoHTMLFragmentBoundariesFixer::GetMostAncestorListOrTableElement(
const nsTArray<OwningNonNull<nsIContent>>& aArrayOfTopMostChildContents, const nsTArray<OwningNonNull<nsIContent>>& aArrayOfTopMostChildContents,
const nsTArray<OwningNonNull<Element>>& aArrayOfListAndTableRelatedElements) const nsTArray<OwningNonNull<Element>>&
const { aArrayOfListAndTableRelatedElements) {
Element* lastFoundAncestorListOrTableElement = nullptr; Element* lastFoundAncestorListOrTableElement = nullptr;
for (auto& content : aArrayOfTopMostChildContents) { for (auto& content : aArrayOfTopMostChildContents) {
if (HTMLEditUtils::IsAnyTableElement(content) && if (HTMLEditUtils::IsAnyTableElementButNotTable(content)) {
!content->IsHTMLElement(nsGkAtoms::table)) {
Element* tableElement = nullptr; Element* tableElement = nullptr;
for (Element* maybeTableElement = content->GetParentElement(); for (Element* maybeTableElement = content->GetParentElement();
maybeTableElement; maybeTableElement;