Bug 1573907 - Fix interaction of <li value> inside <ol reversed>. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 15 Aug 2019 09:52:28 +0000
changeset 488211 a9bdb526a7a01e0984c2bf8c888e8d8ffc69c5c4
parent 488210 caf7bd7998b21577f3ddce32f8d794d60e1ba203
child 488212 0bc9d6bfeb5a08b9dfe2f03c897e564478982e36
push id113904
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:41:00 +0000
treeherdermozilla-inbound@b283a7ef186c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1573907
milestone70.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 1573907 - Fix interaction of <li value> inside <ol reversed>. r=mats The counting code was incrementing the start counter twice for <li value>, as it generates both an increment and a reset. We should instead only increment it once per list-item, that is, once per increment. Differential Revision: https://phabricator.services.mozilla.com/D42001
layout/base/nsCounterManager.cpp
testing/web-platform/tests/css/css-lists/li-value-reversed-001-ref.html
testing/web-platform/tests/css/css-lists/li-value-reversed-001.html
testing/web-platform/tests/css/css-lists/li-value-reversed-002-ref.html
testing/web-platform/tests/css/css-lists/li-value-reversed-002.html
testing/web-platform/tests/css/css-lists/li-value-reversed-003.html
--- a/layout/base/nsCounterManager.cpp
+++ b/layout/base/nsCounterManager.cpp
@@ -171,18 +171,17 @@ void nsCounterList::SetScope(nsCounterNo
 void nsCounterList::RecalcAll() {
   mDirty = false;
 
   // Setup the scope and calculate the default start value for <ol reversed>.
   for (nsCounterNode* node = First(); node; node = Next(node)) {
     SetScope(node);
     if (node->IsContentBasedReset()) {
       node->mValueAfter = 1;
-    } else if ((node->mType == nsCounterChangeNode::INCREMENT ||
-                node->mType == nsCounterChangeNode::SET) &&
+    } else if (node->mType == nsCounterChangeNode::INCREMENT &&
                node->mScopeStart && node->mScopeStart->IsContentBasedReset()) {
       ++node->mScopeStart->mValueAfter;
     }
   }
 
   for (nsCounterNode* node = First(); node; node = Next(node)) {
     node->Calc(this, /* aNotify = */ true);
   }
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-001-ref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<ol>
+ <li value=3>three
+ <li value=6>six
+ <li value=5>five
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-001.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<title>Interaction of ol reversed and list-item value</title>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1573907">
+<link rel="help" href="https://html.spec.whatwg.org/#attr-ol-reversed">
+<link rel="help" href="https://html.spec.whatwg.org/#ordinal-value">
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="match" href="li-value-reversed-001-ref.html">
+<ol reversed>
+ <li>three
+ <li value=6>six
+ <li>five
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-002-ref.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<ol>
+ <li value=6>six
+ <li value=5>five
+ <li value=7>seven
+ <li value=6>six
+ <li value=10>ten
+ <li value=9>nine
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-002.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<title>Interaction of ol reversed and list-item value</title>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1573907">
+<link rel="help" href="https://html.spec.whatwg.org/#attr-ol-reversed">
+<link rel="help" href="https://html.spec.whatwg.org/#ordinal-value">
+<link rel="author" title="L. David Baron" href="https://dbaron.org/">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="match" href="li-value-reversed-002-ref.html">
+<ol reversed>
+ <li>six
+ <li>five
+ <li value=7>seven
+ <li>six
+ <li value=10>ten
+ <li>nine
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-003.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>Interaction of ol reversed and list-item value</title>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1573907">
+<link rel="help" href="https://html.spec.whatwg.org/#attr-ol-reversed">
+<link rel="help" href="https://html.spec.whatwg.org/#ordinal-value">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="match" href="li-value-reversed-002-ref.html">
+<ol reversed>
+ <li>six
+ <li>five
+ <li style="counter-set: list-item 7">seven
+ <li style="counter-increment: list-item -1">six
+ <li style="counter-set: list-item 10; counter-increment: list-item 1">ten
+ <li>nine
+</ol>