Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 88ab2ffaecd34c20e45e33a26b2a62c2e2f75ece
      
https://github.com/WebKit/WebKit/commit/88ab2ffaecd34c20e45e33a26b2a62c2e2f75ece
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_pseudo_content_marker.tentative-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-002.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-003.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-003b.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-006.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-008.tentative.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-015.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-016.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-intrinsic-contribution-001-expected.txt
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/rendering/RenderBlockFlow.h
    M Source/WebCore/rendering/RenderListItem.cpp
    M Source/WebCore/rendering/RenderListMarker.cpp
    M Source/WebCore/rendering/RenderListMarker.h
    M Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp
    M Source/WebCore/rendering/updating/RenderTreeBuilderList.h
    M Source/WebCore/style/PropertyAllowlist.cpp
    M Source/WebCore/style/computed/StyleComputedStyle.cpp

  Log Message:
  -----------
  [CSS] Support the content property on the ::marker pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=319211
<rdar://problem/182066124>

Reviewed by Antti Koivisto.

Per css-lists-3 §3.3, when `content` on a ::marker is not `normal` the marker 
box
contents are generated from the `content` property "exactly as for ::before" — 
an
anonymous sequence of strings, images, counters and quotes — taking precedence
over both list-style-image and list-style-type. WebCore already parsed `content`
on ::marker (it is in the marker property allowlist) but ignored it at layout 
and
paint time, always rendering the list-style marker instead.

RenderListMarker stays a childless RenderBox for the common bullet/number case.
When the computed ::marker style carries content data, RenderTreeBuilder::List
gives the marker a single anonymous inline-block RenderBlockFlow child that 
holds
the generated content, built by reusing

RenderTreeUpdater::GeneratedContent::createContentRenderers — the same machinery
::before/::after use. The marker lays that box out at its max-content width,
offsets it so its first-line baseline lands on the marker's primary-font 
baseline
(so the content sits on the list item's baseline, like a text marker), paints it
as an atomic inline across all phases, and records its visual/layout overflow.

Because `content` supersedes list-style, a content marker is never treated as an
image (isImage) or a bullet (widthUsesMetricsOfPrimaryFont), and its inline
margins follow the text path. `content: none` on ::marker suppresses the marker
box entirely. The marker is a text-decoration boundary, so a list's
text-decoration no longer propagates into generated marker content. `quotes` is
added to the ::marker property allowlist so open-quote/close-quote resolve 
against
per-marker quotes (without this, enabling `content` regresses 
marker-quotes.html).

The feature is gated behind the CSSMarkerContent preference (status: preview):
enabled in preview builds and layout tests, off by default in shipping. When
disabled, `content` on ::marker is ignored, exactly as before.

Still-failing related tests:
Pre-existing bugs:

  — the inside marker's max-content width is not propagated into the float's 
intrinsic width, so the item wraps.
  Pre-existing inside-marker-in-float behavior, not content.
  so it gets no marker and does not count in the list ordinal. Pre-existing, 
unrelated to content generation.
Needs work:

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Add the 
CSSMarkerContent
  preference (status: preview) gating the feature.
* Source/WebCore/rendering/RenderBlockFlow.h: Make firstLineBaseline() and 
lastLineBaseline() public so RenderListMarker can query its content container's 
baseline.
* Source/WebCore/rendering/RenderListItem.cpp:
(WebCore::RenderListItem::computeMarkerStyle): Reset textDecorationLineInEffect,
(WebCore::RenderListItem::computeMarkerStyle const):
  text-align and text-align-last so the originating element's text-decoration 
and
  text-align do not propagate into generated marker content (the marker is a
  boundary for both).
* Source/WebCore/rendering/RenderListMarker.h:
* Source/WebCore/rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::isImage const): False when the marker has generated
  content.
(WebCore::RenderListMarker::hasContent const): Added; gated on the 
CSSMarkerContent
  setting.
(WebCore::RenderListMarker::contentContainer const): Added.
(WebCore::RenderListMarker::paint): Paint the generated-content subtree as an
  atomic inline; let Selection/EventRegion/TextClip phases through.
(WebCore::RenderListMarker::layout): Lay out the content container when present.
(WebCore::RenderListMarker::layoutContentContainer): Added; shrink-to-fit the
  content, align its baseline, and record overflow.
(WebCore::RenderListMarker::updateContent): Content supersedes list-style.
(WebCore::RenderListMarker::computeIntrinsicLogicalWidthContributions): Derive 
the
  marker's widths from the content container.
(WebCore::RenderListMarker::updateInlineMargins): Treat content markers like 
text
  markers for outside margins.
(WebCore::RenderListMarker::widthUsesMetricsOfPrimaryFont const): False for 
content
  markers.
* Source/WebCore/rendering/updating/RenderTreeBuilderList.h:
* Source/WebCore/rendering/updating/RenderTreeBuilderList.cpp:
(WebCore::RenderTreeBuilder::List::updateItemMarker): Generate the marker when
  `content` requires it (gated on CSSMarkerContent) and suppress it on
  `content: none`; tear the content subtree down before restyling, then rebuild 
it
  (or restyle image/quote content) as the marker's content changes.
(WebCore::RenderTreeBuilder::List::buildMarkerContentRenderers): Added; builds 
the
  anonymous inline-block content subtree.
* Source/WebCore/style/PropertyAllowlist.cpp:
(WebCore::isValidMarkerStyleProperty): Allow the `quotes` property on ::marker.
(WebCore::Style::isValidMarkerStyleProperty):
* Source/WebCore/style/computed/StyleComputedStyle.cpp:
(WebCore::Style::ComputedStyle::createStyleInheritingFromPseudoStyle): Allow the
  Marker pseudo type (generated image/quote content inherits from the marker
  style).
* LayoutTests/TestExpectations: Unmark the now-passing marker-content tests,
  marker-quotes.html, marker-word-spacing.html and 
list-style-type-decimal-line-height.html;
  add marker-font-variant-numeric-default/normal.html; keep the still-failing 
ones listed above.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-intrinsic-contribution-001-expected.txt:
  Rebaseline: the custom-string/image ::marker width and inside-content-marker
  intrinsic-contribution subtests now pass.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-002.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-003.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-003b.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-006.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-008.tentative.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-015.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-content-016.html:
  Add a `fuzzy` annotation for sub-pixel antialiasing between inline-box 
generated
  content and the single-string reference.
* 
LayoutTests/imported/w3c/web-platform-tests/accname/name/comp_name_from_pseudo_content_marker.tentative-expected.txt:

Canonical link: https://commits.webkit.org/317211@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to