mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #1621 - Part 3: Use nsIAtom to change attirbute if possible.
We can replace old nsIEditor API with nsIAtom version. Ref: Bug 1324996
This commit is contained in:
parent
b6b2792a35
commit
ec1301a85d
7 changed files with 51 additions and 64 deletions
|
|
@ -744,8 +744,6 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
// if we weren't passed an attribute, then we want to
|
||||
// remove any matching inlinestyles entirely
|
||||
if (!aAttribute || aAttribute->IsEmpty()) {
|
||||
NS_NAMED_LITERAL_STRING(styleAttr, "style");
|
||||
NS_NAMED_LITERAL_STRING(classAttr, "class");
|
||||
|
||||
bool hasStyleAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::style);
|
||||
bool hasClassAttr = aNode.HasAttr(kNameSpaceID_None, nsGkAtoms::_class);
|
||||
|
|
@ -754,14 +752,14 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
// just remove the element... We need to create above the element
|
||||
// a span that will carry those styles or class, then we can delete
|
||||
// the node.
|
||||
nsCOMPtr<Element> spanNode =
|
||||
RefPtr<Element> spanNode =
|
||||
InsertContainerAbove(&aNode, nsGkAtoms::span);
|
||||
NS_ENSURE_STATE(spanNode);
|
||||
nsresult rv =
|
||||
CloneAttribute(styleAttr, spanNode->AsDOMNode(), aNode.AsDOMNode());
|
||||
CloneAttribute(nsGkAtoms::style, spanNode, aNode.AsElement());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv =
|
||||
CloneAttribute(classAttr, spanNode->AsDOMNode(), aNode.AsDOMNode());
|
||||
CloneAttribute(nsGkAtoms::_class, spanNode, aNode.AsElement());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsresult rv = RemoveContainer(&aNode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue