Bug 1088467 - Avoid adding space for bullet with list-style: none. r=surkov
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 24 Oct 2014 01:10:00 +0200
changeset 212133 c72e16da125b6d37ea039c6807a76328a274d6c6
parent 212132 dd1811e791add863f1e80f16566c084b3c269c96
child 212134 3614d4d26e0b704e1b6864551ec5a31a57bbcf3a
push id50903
push usercbook@mozilla.com
push dateFri, 24 Oct 2014 12:42:08 +0000
treeherdermozilla-inbound@c72e16da125b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1088467
milestone36.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 1088467 - Avoid adding space for bullet with list-style: none. r=surkov
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
@@ -857,17 +857,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;
   }
 }