Bug 291780 - List outdent is not working properly; r=ehsan
authorFabien Cazenave <kaze@kompozer.net>
Fri, 02 Sep 2011 12:19:09 -0400
changeset 76469 056dda4ab249d62bec0815cccfead0a7c3763b93
parent 76468 2259e794ac809a0c44c04eeba4bd04f01abcaf9c
child 76470 cd28b53198eac2bc553853477e4a34f542c334fc
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersehsan
bugs291780
milestone9.0a1
Bug 291780 - List outdent is not working properly; r=ehsan
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/tests/test_bug291780.html
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -4046,17 +4046,17 @@ nsHTMLEditRules::WillOutdent(nsISelectio
         res = mHTMLEditor->RemoveBlockContainer(curNode);
         NS_ENSURE_SUCCESS(res, res);
         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 dealng with any curBlockQuote, and then
+        // So we need to finish up dealing with any curBlockQuote, and then
         // pop this list item.
         if (curBlockQuote)
         {
           res = OutdentPartOfBlock(curBlockQuote, firstBQChild, lastBQChild,
                                    curBlockQuoteIsIndentedWithCSS,
                                    address_of(rememberedLeftBQ),
                                    address_of(rememberedRightBQ));
           NS_ENSURE_SUCCESS(res, res);
@@ -4118,17 +4118,17 @@ nsHTMLEditRules::WillOutdent(nsISelectio
         else if (useCSS)
         {
           nsIAtom* marginProperty = MarginPropertyAtomForIndent(mHTMLEditor->mHTMLCSSUtils, curNode);
           nsAutoString value;
           mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(n, marginProperty, value);
           float f;
           nsCOMPtr<nsIAtom> unit;
           mHTMLEditor->mHTMLCSSUtils->ParseLength(value, &f, getter_AddRefs(unit));
-          if (f > 0)
+          if (f > 0 && !(nsHTMLEditUtils::IsList(curParent) && nsHTMLEditUtils::IsList(curNode)))
           {
             curBlockQuote = n;
             firstBQChild  = curNode;
             lastBQChild   = curNode;
             curBlockQuoteIsIndentedWithCSS = PR_TRUE;
             break;
           }
         }
--- a/editor/libeditor/html/tests/test_bug291780.html
+++ b/editor/libeditor/html/tests/test_bug291780.html
@@ -33,17 +33,17 @@ addLoadEvent(function() {
   var range = document.createRange();
   range.setStart(lis[1], 0);
   range.setEnd(lis[2], lis[2].childNodes.length);
   sel.addRange(range);
   document.execCommand("indent", false, false);
   var expected = '<ul style="margin-left: 40px;"><li>Item 1</li><ul><li>Item 2</li><li>Item 3</li></ul><li>Item 4</li></ul>';
   is(editor.innerHTML, expected, "indenting part of an already indented bulleted list");
   document.execCommand("outdent", false, false);
-  todo_is(editor.innerHTML, original, "outdenting the partially indented part of an already indented bulleted list"); 
+  is(editor.innerHTML, original, "outdenting the partially indented part of an already indented bulleted list"); 
 
   // done
   SimpleTest.finish();
 });
 
 </script>
 </pre>
 </body>