mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Prevent elements with no layout box from modifying counters
This commit is contained in:
parent
898e3bd898
commit
696ccc1aa9
Notes:
github-actions[bot]
2024-07-26 10:05:23 +00:00
Author: https://github.com/AtkinsSJ
Commit: 696ccc1aa9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/720
Reviewed-by: https://github.com/tcl3
3 changed files with 82 additions and 0 deletions
|
@ -2718,6 +2718,13 @@ void Element::resolve_counters(CSS::StyleProperties& style)
|
|||
// 1. Existing counters are inherited from previous elements.
|
||||
inherit_counters();
|
||||
|
||||
// https://drafts.csswg.org/css-lists-3/#counters-without-boxes
|
||||
// An element that does not generate a box (for example, an element with display set to none,
|
||||
// or a pseudo-element with content set to none) cannot set, reset, or increment a counter.
|
||||
// The counter properties are still valid on such an element, but they must have no effect.
|
||||
if (style.display().is_none())
|
||||
return;
|
||||
|
||||
// 2. New counters are instantiated (counter-reset).
|
||||
auto counter_reset = style.counter_data(CSS::PropertyID::CounterReset);
|
||||
for (auto const& counter : counter_reset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue