diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-05-22 17:13:33 -0400 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-08-07 21:29:16 +0000 |
commit | 4f03fb2798d85a7d4671a79521d8483af3345db5 (patch) | |
tree | 0108a7b8db4d86628d319d458fac62244cded528 /editor/libeditor/HTMLEditRules.cpp | |
parent | 3dd316f739db2a0c37d7d7403d983d65a094ec4d (diff) | |
download | UXP-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/HTMLEditRules.cpp')
-rw-r--r-- | editor/libeditor/HTMLEditRules.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/editor/libeditor/HTMLEditRules.cpp b/editor/libeditor/HTMLEditRules.cpp index d3cbb8775..b6f95f503 100644 --- a/editor/libeditor/HTMLEditRules.cpp +++ b/editor/libeditor/HTMLEditRules.cpp @@ -839,19 +839,18 @@ HTMLEditRules::GetAlignment(bool* aMixed, NS_ENSURE_TRUE(nodeToExamine, NS_ERROR_NULL_POINTER); - NS_NAMED_LITERAL_STRING(typeAttrName, "align"); nsCOMPtr<Element> blockParent = htmlEditor->GetBlock(*nodeToExamine); NS_ENSURE_TRUE(blockParent, NS_ERROR_FAILURE); if (htmlEditor->IsCSSEnabled() && htmlEditor->mCSSEditUtils->IsCSSEditableProperty(blockParent, nullptr, - &typeAttrName)) { + nsGkAtoms::align)) { // We are in CSS mode and we know how to align this element with CSS nsAutoString value; // Let's get the value(s) of text-align or margin-left/margin-right htmlEditor->mCSSEditUtils->GetCSSEquivalentToHTMLInlineStyleSet( - blockParent, nullptr, &typeAttrName, value, CSSEditUtils::eComputed); + blockParent, nullptr, nsGkAtoms::align, value, CSSEditUtils::eComputed); if (value.EqualsLiteral("center") || value.EqualsLiteral("-moz-center") || value.EqualsLiteral("auto auto")) { @@ -4755,7 +4754,7 @@ HTMLEditRules::WillAlign(Selection& aSelection, NS_ENSURE_SUCCESS(rv, rv); if (useCSS) { htmlEditor->mCSSEditUtils->SetCSSEquivalentToHTMLStyle( - curNode->AsElement(), nullptr, &NS_LITERAL_STRING("align"), + curNode->AsElement(), nullptr, nsGkAtoms::align, &aAlignType, false); curDiv = nullptr; continue; @@ -7125,9 +7124,9 @@ HTMLEditRules::CacheInlineStyles(nsIDOMNode* aNode) isSet, &outValue); } else { NS_ENSURE_STATE(mHTMLEditor); - mHTMLEditor->mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet(aNode, - mCachedStyles[j].tag, &(mCachedStyles[j].attr), isSet, outValue, - CSSEditUtils::eComputed); + isSet = mHTMLEditor->mCSSEditUtils->IsCSSEquivalentToHTMLInlineStyleSet( + aNode, mCachedStyles[j].tag, &(mCachedStyles[j].attr), outValue, + CSSEditUtils::eComputed); } if (isSet) { mCachedStyles[j].mPresent = true; |