Bug 723232 - nsHTMLEditRules::RelativeChangeIndentationOfElementNode removes divs with any one attribute; r=ehsan
authorMs2ger <ms2ger@gmail.com>
Fri, 10 Feb 2012 11:04:46 +0100
changeset 86511 7c974542dc5fea0d91cf3f5091efa25bba82201d
parent 86510 12f329c2b956f6622eb94540a5db38cfb667a4a1
child 86512 9ae088e8512d83786fe42d663dae1926a21d06ad
push id22025
push userMs2ger@gmail.com
push dateFri, 10 Feb 2012 10:06:36 +0000
treeherdermozilla-central@d73f5d77a645 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs723232
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 723232 - nsHTMLEditRules::RelativeChangeIndentationOfElementNode removes divs with any one attribute; r=ehsan
editor/libeditor/html/nsHTMLEditRules.cpp
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -8950,30 +8950,22 @@ nsHTMLEditRules::RelativeChangeIndentati
           mHTMLEditor->IsNodeInActiveEditor(node)) {
         // we deal with an editable DIV;
         // let's see if it is useless and if we can remove it
         nsCOMPtr<nsIDOMNamedNodeMap> attributeList;
         res = element->GetAttributes(getter_AddRefs(attributeList));
         NS_ENSURE_SUCCESS(res, res);
         PRUint32 count;
         attributeList->GetLength(&count);
-        if (!count) {
-          // the DIV has no attribute at all, let's remove it
+        if (!count ||
+            (1 == count && node->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdirty))) {
+          // the DIV has no attribute at all or just a _moz_dirty, let's remove it
           res = mHTMLEditor->RemoveContainer(element);
           NS_ENSURE_SUCCESS(res, res);
         }
-        else if (1 == count) {
-          nsCOMPtr<nsIDOMNode> styleAttributeNode;
-          res = attributeList->GetNamedItem(NS_LITERAL_STRING("style"), 
-                                            getter_AddRefs(styleAttributeNode));
-          if (!styleAttributeNode) {
-            res = mHTMLEditor->RemoveContainer(element);
-            NS_ENSURE_SUCCESS(res, res);
-          }
-        }
       }
     }
   }
   return NS_OK;
 }
 
 //
 // Support for Absolute Positioning