Bug 748315 - Part 2. SetAttributeOrEquivalent should remove CSS property when HTMLEditor::IsCSSEnabled() is false. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 25 Oct 2017 16:13:09 +0900
changeset 688288 e84566247b9b6c5fe85ced2af03f32923deafb19
parent 688287 4aec57935ea4ab6e8c300a8a58b3e0d0ef89aadf
child 688289 b3ed0d08c59912f3b50c923ad7adcfc895818cc5
push id86710
push userbmo:m_kato@ga2.so-net.ne.jp
push dateSun, 29 Oct 2017 14:07:30 +0000
reviewersmasayuki
bugs748315
milestone58.0a1
Bug 748315 - Part 2. SetAttributeOrEquivalent should remove CSS property when HTMLEditor::IsCSSEnabled() is false. r?masayuki SetAttributeOrEquivalent sets element's attribute when HTMLEditor::IsCSSEnabled() is false. It should remove the CSS property that is same behaviour too. MozReview-Commit-ID: ChKjlB7wI0Z
editor/libeditor/HTMLEditor.cpp
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -4181,16 +4181,21 @@ HTMLEditor::SetAttributeOrEquivalent(Ele
 {
   MOZ_ASSERT(aElement);
   MOZ_ASSERT(aAttribute);
 
   nsAutoScriptBlocker scriptBlocker;
 
   if (!IsCSSEnabled() || !mCSSEditUtils) {
     // we are not in an HTML+CSS editor; let's set the attribute the HTML way
+    if (mCSSEditUtils) {
+      mCSSEditUtils->RemoveCSSEquivalentToHTMLStyle(aElement, nullptr,
+                                                    aAttribute, nullptr,
+                                                    aSuppressTransaction);
+    }
     return aSuppressTransaction ?
              aElement->SetAttr(kNameSpaceID_None, aAttribute, aValue, true) :
              SetAttribute(aElement, aAttribute, aValue);
   }
 
   int32_t count =
     mCSSEditUtils->SetCSSEquivalentToHTMLStyle(aElement, nullptr,
                                                aAttribute, &aValue,