Closed Bug 1648859 Opened 6 years ago Closed 6 years ago

[wpt-sync] Sync PR 24365 - [css-lists] Fix 'content: counter(list-item)' in pseudo-elements

Categories

(Core :: Layout: Generated Content, Lists, and Counters, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 24365 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/24365
Details from upstream follow.

Oriol Brufau <obrufau@igalia.com> wrote:

[css-lists] Fix 'content: counter(list-item)' in pseudo-elements

::before, ::after and ::marker pseudo-elements can use the counter()
function in the 'content' property in order to retrieve the value of a
counter. This was already working well, except for the automatic
'list-item' counter.

The problem was that in \<ol> elements, the counter was set to the start
value. For example, in '\<ol start="3">\<li>\</li>\</ol>', the counter was 3
in ol::before, but \<li> increments it, so it became 4 in li::before.
This patch sets it to the start value minus 1, according to the spec
https://drafts.csswg.org/css-lists/#ua-stylesheet

There was also the problem that list items would increment the value,
even in reversed lists. E.g. in '\<ol reversed>\<li>\</li>\<li>\</li>\</ol>',
the counter used to be 2 in ol::before, 3 in li:first-child::before,
and 4 in li:last-child::before. This patch checks whether the list item
is in a reversed list in order to decide if the value should be
incremented or decremented.

Bug: 796961

TEST=external/wpt/css/css-lists/counter-list-item.html
TEST=external/wpt/css/css-pseudo/marker-content-002.html
TEST=external/wpt/css/css-pseudo/marker-content-005.html

The former test is imported from WebKit.

Change-Id: I011499095379df547820eb6417f68ab61cf5a23d

Reviewed-on: https://chromium-review.googlesource.com/2270305
WPT-Export-Revision: 422ce7ee35a60389fbbd9ad95e89dcac9e048cc4

Component: web-platform-tests → Layout: Generated Content, Lists, and Counters
Product: Testing → Core

CI Results

Ran 12 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests

Status Summary

Firefox

PASS: 1
FAIL: 1

Chrome

FAIL: 1

Safari

PASS: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/css/css-lists/counter-list-item.html: FAIL [Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt], PASS [Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt, GitHub] (Chrome: FAIL, Safari: PASS)

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/effe6f91adaa [wpt PR 24365] - [css-lists] Fix 'content: counter(list-item)' in pseudo-elements, a=testonly https://hg.mozilla.org/integration/autoland/rev/8ef7ee99300a [wpt PR 24365] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.