Bug 1088467 - Avoid adding space for bullet with list-style: none. r=surkov, a=lmandel
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 24 Oct 2014 01:10:00 +0200
changeset 225819 2e54d90546ce
parent 225818 0811a9056ec4
child 225820 34988fa0f0d8
push id4026
push userryanvm@gmail.com
push date2014-10-26 22:32 +0000
treeherdermozilla-beta@410afcc51b13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, lmandel
bugs1088467
milestone34.0
Bug 1088467 - Avoid adding space for bullet with list-style: none. r=surkov, a=lmandel
accessible/tests/mochitest/text/test_hypertext.html
layout/generic/nsBulletFrame.cpp
--- a/accessible/tests/mochitest/text/test_hypertext.html
+++ b/accessible/tests/mochitest/text/test_hypertext.html
@@ -1,16 +1,19 @@
 <!DOCTYPE html>
 <html>
 <head>
   <title>nsIAccessibleText getText related function tests for rich text</title>
   <link rel="stylesheet" type="text/css"
         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 
   <style>
+    #listitemnone {
+      list-style-type: none;
+    }
     h6.gencontent:before {
       content: "aga"
     }
   </style>
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript"
@@ -62,23 +65,27 @@
       testTextAtOffset(0, BOUNDARY_LINE_START, "line ", 0, 5,
                        "hypertext4", kTodo, kOk, kTodo);
 
       //////////////////////////////////////////////////////////////////////////
       // list
       //////////////////////////////////////////////////////////////////////////
 
       IDs = [ "list" ];
-      testCharacterCount(IDs, 1);
-      testText(IDs, 0, 1, kEmbedChar);
+      testCharacterCount(IDs, 2);
+      testText(IDs, 0, 2, kEmbedChar + kEmbedChar);
 
       IDs = [ "listitem" ];
       testCharacterCount(IDs, 6);
       testText(IDs, 0, 6, "1. foo");
 
+      IDs = [ "listitemnone" ];
+      testCharacterCount(IDs, 3);
+      testText(IDs, 0, 3, "bar");
+
       testText(["testbr"], 0, 3, "foo");
 
       testTextAtOffset(2, nsIAccessibleText.BOUNDARY_CHAR, "o", 2, 3, "testbr",
                        kOk, kOk, kOk);
       testTextAtOffset(2, nsIAccessibleText.BOUNDARY_WORD_START, "foo\n", 0, 4,
                        "testbr", kTodo, kOk, kTodo);
       testTextBeforeOffset(2, nsIAccessibleText.BOUNDARY_LINE_START, "foo\n",
                            0, 4, "testbr", kTodo, kOk, kTodo);
@@ -112,17 +119,20 @@
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <div id="nulltext"></div>
 
   <div id="hypertext">hello <a>friend</a> see <img></div>
   <div id="hypertext2">hello <a>friend</a> see <input></div>
-  <ol id="list"><li id="listitem">foo</li></ol>
+  <ol id="list">
+    <li id="listitem">foo</li>
+    <li id="listitemnone">bar</li>
+  </ol>
 
   <div id="hypertext3">line
 <!-- haha -->
 <!-- hahaha -->
 <h6>heading</h6>
   </div>
 
   <div id="hypertext4">line
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -832,17 +832,19 @@ nsBulletFrame::GetLogicalBaseline(Writin
 
 void
 nsBulletFrame::GetSpokenText(nsAString& aText)
 {
   CounterStyle* style = StyleList()->GetCounterStyle();
   bool isBullet;
   style->GetSpokenCounterText(mOrdinal, GetWritingMode(), aText, isBullet);
   if (isBullet) {
-    aText.Append(' ');
+    if (!style->IsNone()) {
+      aText.Append(' ');
+    }
   } else {
     nsAutoString prefix, suffix;
     style->GetPrefix(prefix);
     style->GetSuffix(suffix);
     aText = prefix + aText + suffix;
   }
 }