::marker pseudo-element
Oriol Brufau obrufau@igalia.com
<ol> <ol>
  <li>foo</li>
  <li>bar</li>
  <li>baz</li>
 </ol><ul> <ul>
  <li>foo</li>
  <li>bar</li>
  <li>baz</li>
 </ul><li>HTML: semantically represented by <li> elements.
CSS: any element can be rendered as a list item.
li {
  display: list-item;
}They originate a ::marker pseudo-element.
Automatically increment a list-item counter.
Symbol or ordinal denoting the start of each list item.
Originated before the ::before.
Customized with list-style or ::marker.
list-style propertyShorthand of list-style-type, list-style-image, list-style-position.
Apply to the list item, not to the ::marker.
Propagated from ancestors via inheritance.
list-style-type: <counter-style>
decimal
lower-alpha
upper-roman
disc
square
none
list-style-type: <string>
"-"
"+"
"▸"
"★"
"foo bar"
Shipped in Chromium 79 (4.5 years after Firefox).
list-style-image: <image>
url(img/smiley.gif)
linear-gradient(blue, red)
list-style-position: inside | outside
Inside markers are normal inlines.
Outside markers are special block containers.
inside
inside
outside
outside
::marker pseudo-element::marker can be used to style list markers.
::marker {
  color: blue;
  font-size: 150%;
  font-style: italic;
}::marker exists in the element tree.
Can be used after ::slotted().
Similar to ::before and ::after.
Only a subset of properties apply to ::marker:
font-*, white-space, color, text-combine-upright, unicode-bidi, direction, animation-*, transition-*, content
Reason: marker layout is not fully defined.
The list of accepted properties is expected to grow.
content propertySpecifies the contents of the marker.
Takes precedence over list-style-type and list-style-image.
content: normal is the default.
content: none destroys the marker.
content examplenormal
none
"foo"
"foo" url(img/smiley.gif)
counter(list-item)
::marker {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}Also for ::before::marker and ::after::marker.
Let the parser accept selectors like
::marker::before::marker::after::marker::slotted(*)::markerAdd a new ValidPropertyFilter for ::marker
Analogous to ::cue and ::first-letter
::marker stylesMarkers used to be assigned a manually created ComputedStyle.
Assign the styles from ::marker instead.
content in LayoutNGAnalogous to ::before and ::after.
Ignore list-style in non-normal cases.
content: noneBoth none and normal used to be stored as nullptr.
New NoneContentData subclass of ContentData.
New ContentBehavesAsNormal and ContentPreventsBoxGeneration methods.
::marker {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}To normal, non-normal, LayoutNG and legacy markers.
 
 
 
::markerOnly elements could originate pseudos.
But ::before and ::after can be list items with a nested ::marker.
Nested selectors still don't work.
Markers with content: normal used to be anonymous boxes.
Exposed in devtools and getComputedStyle.
Performance up by 30-40%.
Layout bugs: 1048672, 1049633, 1051114
Selection bug: 1051685
Allow animation-* and transition-* properties.
But only animate allowed properties.
counter(list-item) inside <ol>Used to be 1 unit too big.
Already affected ::before and ::after.
content in legacyProblem: LayoutListMarker can't have children
Solution: new LayoutInsideListMarker and LayoutOutsideListMarker, based on LayoutInline and LayoutBlockFlow.
CL: 2109697, 2109771, 2110630, 2246514, 2252244, 2252041, 2252041, 2246573, 2258732
CSSMarkerPseudoElement flag enabled by default.
Chromium 86.0.4198.0
~100 patches in total
Several refactorings
Bug fixes
Tests
| Inside | Outside | |
|---|---|---|
| Legacy (normal) | LayoutListMarker : LayoutBox | |
| Legacy (custom) | LayoutInsideListMarker : LayoutInline | LayoutOutsideListMarker : LayoutBlockFlow | 
| LayoutNG | LayoutNGInsideListMarker : LayoutInline | LayoutNGOutsideListMarker : LayoutNGBlockFlowMixin<LayoutBlockFlow> | 
::before::marker and ::after::marker
Currently valid but ignored.
Complex refactoring of the style resolver.
<details> and <summary><details>
  <summary>Summary</summary>
  Details
</details>Summary
 Details 
The disclosure triangle should be a ::marker