Bug 290026 - Outdent of List does not work properly; r=ehsan
authorFabien Cazenave <kaze@kompozer.net>
Fri, 02 Sep 2011 12:21:33 -0400
changeset 76442 cd28b53198eac2bc553853477e4a34f542c334fc
parent 76441 056dda4ab249d62bec0815cccfead0a7c3763b93
child 76443 a9b98324d35aec81dd0c8610fb330dfe9cfd342e
push id1664
push usereakhgari@mozilla.com
push dateFri, 02 Sep 2011 16:22:06 +0000
treeherdermozilla-inbound@cd28b53198ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs290026
milestone9.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 290026 - Outdent of List does not work properly; r=ehsan
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/tests/test_bug290026.html
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -4042,16 +4042,31 @@ nsHTMLEditRules::WillOutdent(nsISelectio
           NS_ENSURE_SUCCESS(res, res);
           curBlockQuote = 0;  firstBQChild = 0;  lastBQChild = 0;
           curBlockQuoteIsIndentedWithCSS = PR_FALSE;
         }
         res = mHTMLEditor->RemoveBlockContainer(curNode);
         NS_ENSURE_SUCCESS(res, res);
         continue;
       }
+      // is it a block with a 'margin' property?
+      if (useCSS && IsBlockNode(curNode))
+      {
+        nsIAtom* marginProperty = MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils, curNode);
+        nsAutoString value;
+        mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(curNode, marginProperty, value);
+        float f;
+        nsCOMPtr<nsIAtom> unit;
+        mHTMLEditor->mHTMLCSSUtils->ParseLength(value, &f, getter_AddRefs(unit));
+        if (f > 0)
+        {
+          RelativeChangeIndentationOfElementNode(curNode, -1);
+          continue;
+        }
+      }
       // is it a list item?
       if (nsHTMLEditUtils::IsListItem(curNode)) 
       {
         // if it is a list item, that means we are not outdenting whole list.
         // So we need to finish up dealing with any curBlockQuote, and then
         // pop this list item.
         if (curBlockQuote)
         {
--- a/editor/libeditor/html/tests/test_bug290026.html
+++ b/editor/libeditor/html/tests/test_bug290026.html
@@ -35,17 +35,17 @@ addLoadEvent(function() {
   sel.addRange(range);
   document.execCommand("indent", false, false);
   var oneindent = '<p></p><ul style="margin-left: 40px;"><li>Item 1</li><li>Item 2</li></ul><p></p>';
   is(editor.innerHTML, oneindent, "a once indented bulleted list");
   document.execCommand("indent", false, false);
   var twoindent = '<p></p><ul style="margin-left: 80px;"><li>Item 1</li><li>Item 2</li></ul><p></p>';
   is(editor.innerHTML, twoindent, "a twice indented bulleted list");
   document.execCommand("outdent", false, false);
-  todo_is(editor.innerHTML, oneindent, "outdenting a twice indented bulleted list");
+  is(editor.innerHTML, oneindent, "outdenting a twice indented bulleted list");
 
   // done
   SimpleTest.finish();
 });
 
 </script>
 </pre>
 </body>