diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-05-22 18:38:33 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-07-31 15:59:58 -0400 |
commit | 1115c63bf788dad121f65cf465ebf73562b4d029 (patch) | |
tree | 11447919a62454e454c78db034baf5f053f23532 /editor/libeditor/EditorBase.cpp | |
parent | 1c0c7cf583e6adda168cf59cad3aad3e38e7c058 (diff) | |
download | UXP-1115c63bf788dad121f65cf465ebf73562b4d029.tar UXP-1115c63bf788dad121f65cf465ebf73562b4d029.tar.gz UXP-1115c63bf788dad121f65cf465ebf73562b4d029.tar.lz UXP-1115c63bf788dad121f65cf465ebf73562b4d029.tar.xz UXP-1115c63bf788dad121f65cf465ebf73562b4d029.zip |
Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version.
Ref: Bug 1324996
Diffstat (limited to 'editor/libeditor/EditorBase.cpp')
-rw-r--r-- | editor/libeditor/EditorBase.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 7212e7c93..60df3571e 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -2330,11 +2330,9 @@ EditorBase::CloneAttributes(Element* aDest, RefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes(); while (RefPtr<Attr> attr = destAttributes->Item(0)) { if (destInBody) { - RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)), - attr->NodeName()); + RemoveAttribute(aDest, attr->NodeInfo()->NameAtom()); } else { - ErrorResult ignored; - aDest->RemoveAttribute(attr->NodeName(), ignored); + aDest->UnsetAttr(kNameSpaceID_None, attr->NodeInfo()->NameAtom(), true); } } @@ -2346,13 +2344,13 @@ EditorBase::CloneAttributes(Element* aDest, nsAutoString value; attr->GetValue(value); if (destInBody) { - SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)), - attr->NodeName(), value, false); + SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value, + false); } else { // The element is not inserted in the document yet, we don't want to put // a transaction on the UndoStack - SetAttributeOrEquivalent(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)), - attr->NodeName(), value, true); + SetAttributeOrEquivalent(aDest, attr->NodeInfo()->NameAtom(), value, + true); } } } |