summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/HTMLStyleEditor.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-05-22 17:13:33 -0400
committerMoonchild <moonchild@palemoon.org>2020-08-07 21:29:16 +0000
commit4f03fb2798d85a7d4671a79521d8483af3345db5 (patch)
tree0108a7b8db4d86628d319d458fac62244cded528 /editor/libeditor/HTMLStyleEditor.cpp
parent3dd316f739db2a0c37d7d7403d983d65a094ec4d (diff)
downloadUXP-4f03fb2798d85a7d4671a79521d8483af3345db5.tar
UXP-4f03fb2798d85a7d4671a79521d8483af3345db5.tar.gz
UXP-4f03fb2798d85a7d4671a79521d8483af3345db5.tar.lz
UXP-4f03fb2798d85a7d4671a79521d8483af3345db5.tar.xz
UXP-4f03fb2798d85a7d4671a79521d8483af3345db5.zip
Issue #1621 - Part 1: CSSEditUtils should use atom for CSS property if possible.
There is a lot of string compare when using CSS property name. We should use nsGkAtoms instead. Ref: Bug 1323138
Diffstat (limited to 'editor/libeditor/HTMLStyleEditor.cpp')
-rw-r--r--editor/libeditor/HTMLStyleEditor.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/editor/libeditor/HTMLStyleEditor.cpp b/editor/libeditor/HTMLStyleEditor.cpp
index c81ca1c53..593ef3d27 100644
--- a/editor/libeditor/HTMLStyleEditor.cpp
+++ b/editor/libeditor/HTMLStyleEditor.cpp
@@ -429,7 +429,7 @@ HTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
mCSSEditUtils->IsCSSEditableProperty(&aNode, &aProperty,
aAttribute)) ||
// bgcolor is always done using CSS
- aAttribute->EqualsLiteral("bgcolor");
+ attrAtom == nsGkAtoms::bgcolor;
if (useCSS) {
nsCOMPtr<dom::Element> tmp;
@@ -444,12 +444,9 @@ HTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
}
// Add the CSS styles corresponding to the HTML style request
- int32_t count;
- nsresult rv =
- mCSSEditUtils->SetCSSEquivalentToHTMLStyle(tmp->AsDOMNode(),
- &aProperty, aAttribute,
- &aValue, &count, false);
- NS_ENSURE_SUCCESS(rv, rv);
+ mCSSEditUtils->SetCSSEquivalentToHTMLStyle(tmp,
+ &aProperty, attrAtom,
+ &aValue, false);
return NS_OK;
}
@@ -574,8 +571,9 @@ HTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
// in this implementation for the node; let's check if it carries those
// CSS styles
nsAutoString firstValue;
- mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(GetAsDOMNode(node),
- aProperty, aAttribute, isSet, firstValue, CSSEditUtils::eSpecified);
+ isSet = mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(
+ node, aProperty, aAttribute, firstValue,
+ CSSEditUtils::eSpecified);
}
if (// node is the correct inline prop
(aProperty && node->IsHTMLElement(aProperty)) ||
@@ -794,15 +792,17 @@ HTMLEditor::RemoveStyleInside(nsIContent& aNode,
// the HTML style defined by aProperty/aAttribute has a CSS equivalence in
// this implementation for the node aNode; let's check if it carries those
// css styles
+ nsCOMPtr<nsIAtom> attribute =
+ aAttribute ? NS_Atomize(*aAttribute) : nullptr;
nsAutoString propertyValue;
bool isSet = mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(&aNode,
- aProperty, aAttribute, propertyValue, CSSEditUtils::eSpecified);
+ aProperty, attribute, propertyValue, CSSEditUtils::eSpecified);
if (isSet && aNode.IsElement()) {
// yes, tmp has the corresponding css declarations in its style attribute
// let's remove them
mCSSEditUtils->RemoveCSSEquivalentToHTMLStyle(aNode.AsElement(),
aProperty,
- aAttribute,
+ attribute,
&propertyValue,
false);
// remove the node if it is a span or font, if its style attribute is