Bug 1573907 - Make non-list-items not increment the start value for <ol reversed>. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 15 Aug 2019 09:54:21 +0000
changeset 488212 0bc9d6bfeb5a08b9dfe2f03c897e564478982e36
parent 488211 a9bdb526a7a01e0984c2bf8c888e8d8ffc69c5c4
child 488213 31e37db859a9add93c95c0be256f799c1e515fc7
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 - Make non-list-items not increment the start value for <ol reversed>. r=mats Differential Revision: https://phabricator.services.mozilla.com/D42084
layout/base/nsCounterManager.cpp
testing/web-platform/tests/css/css-lists/li-value-reversed-004-ref.html
testing/web-platform/tests/css/css-lists/li-value-reversed-004.html
testing/web-platform/tests/css/css-lists/li-value-reversed-005.html
--- a/layout/base/nsCounterManager.cpp
+++ b/layout/base/nsCounterManager.cpp
@@ -172,17 +172,18 @@ 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->mScopeStart && node->mScopeStart->IsContentBasedReset()) {
+               node->mScopeStart && node->mScopeStart->IsContentBasedReset() &&
+               node->mPseudoFrame->StyleDisplay()->IsListItem()) {
       ++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-004-ref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<ol>
+ <li value=2>two
+ <div></div>
+ <li value=0>zero
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-004.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<title>Non-list items with explicit list-item counter increments don't increment the ol reversed start 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-004-ref.html">
+<ol reversed>
+ <li>two
+ <div style="counter-increment: list-item -1"></div>
+ <li>zero
+</ol>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-lists/li-value-reversed-005.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<title>Non-list items with explicit list-item counter increments don't increment the ol reversed start 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-004-ref.html">
+<ol reversed>
+ <li>two
+ <div style="counter-increment: list-item 1; counter-set: list-item 1"></div>
+ <li>zero
+</ol>