[css-lists] Override reversed attribute of <ol> by counter-reset's value [chromium/src : main]

0 views
Skip to first unread message

Minseong Kim (Gerrit)

unread,
Dec 15, 2025, 7:45:58 AM (4 days ago) Dec 15
to Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Daniil Sakhapov

Minseong Kim added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Minseong Kim . resolved

Hello. Would you review this CL, please?

Open in Gerrit

Related details

Attention is currently required from:
  • Daniil Sakhapov
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic2dc0661b9c57dfbd021c0f52b6e7ec0a2070c9d
Gerrit-Change-Number: 7233512
Gerrit-PatchSet: 4
Gerrit-Owner: Minseong Kim <jja0...@gmail.com>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Minseong Kim <jja0...@gmail.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Dec 2025 12:45:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniil Sakhapov (Gerrit)

unread,
Dec 16, 2025, 7:20:26 AM (3 days ago) Dec 16
to Minseong Kim, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Minseong Kim and Rune Lillesveen

Daniil Sakhapov added 1 comment

Patchset-level comments
Daniil Sakhapov . unresolved

I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

Open in Gerrit

Related details

Attention is currently required from:
  • Minseong Kim
  • Rune Lillesveen
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic2dc0661b9c57dfbd021c0f52b6e7ec0a2070c9d
    Gerrit-Change-Number: 7233512
    Gerrit-PatchSet: 4
    Gerrit-Owner: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Attention: Minseong Kim <jja0...@gmail.com>
    Gerrit-Comment-Date: Tue, 16 Dec 2025 12:20:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    Dec 16, 2025, 10:04:18 AM (3 days ago) Dec 16
    to Minseong Kim, Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Minseong Kim

    Rune Lillesveen added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Minseong Kim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic2dc0661b9c57dfbd021c0f52b6e7ec0a2070c9d
    Gerrit-Change-Number: 7233512
    Gerrit-PatchSet: 4
    Gerrit-Owner: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Minseong Kim <jja0...@gmail.com>
    Gerrit-Comment-Date: Tue, 16 Dec 2025 15:04:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniil Sakhapov (Gerrit)

    unread,
    Dec 16, 2025, 10:17:17 AM (3 days ago) Dec 16
    to Minseong Kim, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Minseong Kim

    Daniil Sakhapov added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Daniil Sakhapov

    Yes, you got that right.
    In this case, will a CSS cascade thing make sense?
    If we detect this need to override, we need to call UpdateItems() for HTMLOListElement, which causes calls to SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(), so doing it from RecalcOwnStyle should by fine?

    Gerrit-Comment-Date: Tue, 16 Dec 2025 15:17:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    Comment-In-Reply-To: Rune Lillesveen <fut...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    Dec 16, 2025, 10:54:06 AM (3 days ago) Dec 16
    to Minseong Kim, Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Minseong Kim

    Rune Lillesveen added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Daniil Sakhapov

    Yes, you got that right.
    In this case, will a CSS cascade thing make sense?
    If we detect this need to override, we need to call UpdateItems() for HTMLOListElement, which causes calls to SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(), so doing it from RecalcOwnStyle should by fine?

    Rune Lillesveen

    When is UpdateItems() called (lifecycle-wise)?

    Could you spell out all the cascade-dependencies here?

    Gerrit-Comment-Date: Tue, 16 Dec 2025 15:53:52 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniil Sakhapov (Gerrit)

    unread,
    Dec 16, 2025, 11:11:18 AM (3 days ago) Dec 16
    to Minseong Kim, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Minseong Kim

    Daniil Sakhapov added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Daniil Sakhapov

    Yes, you got that right.
    In this case, will a CSS cascade thing make sense?
    If we detect this need to override, we need to call UpdateItems() for HTMLOListElement, which causes calls to SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(), so doing it from RecalcOwnStyle should by fine?

    Rune Lillesveen

    When is UpdateItems() called (lifecycle-wise)?

    Could you spell out all the cascade-dependencies here?

    Daniil Sakhapov

    So `reversed` on <ol> is called from Element::ParseAttribute (so, html parsing time?) and it sets SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation() for <li>s via UpdateItems().
    Then we have our `counter-reset`, which should override `reset` and call UpdateItems() for <ol>.
    I guess that's it.

    Gerrit-Comment-Date: Tue, 16 Dec 2025 16:11:05 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    Dec 17, 2025, 4:07:54 AM (2 days ago) Dec 17
    to Minseong Kim, Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Minseong Kim

    Rune Lillesveen added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Daniil Sakhapov

    Yes, you got that right.
    In this case, will a CSS cascade thing make sense?
    If we detect this need to override, we need to call UpdateItems() for HTMLOListElement, which causes calls to SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(), so doing it from RecalcOwnStyle should by fine?

    Rune Lillesveen

    When is UpdateItems() called (lifecycle-wise)?

    Could you spell out all the cascade-dependencies here?

    Daniil Sakhapov

    So `reversed` on <ol> is called from Element::ParseAttribute (so, html parsing time?) and it sets SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation() for <li>s via UpdateItems().
    Then we have our `counter-reset`, which should override `reset` and call UpdateItems() for <ol>.
    I guess that's it.

    Rune Lillesveen

    That didn't answer my questions.

    When, in the lifecycle, is UpdateItems called? Related to CSS counters?

    And the cascade part:

    Is it possible to express this behavior as presentation style for `reversed`, so that UpdateItems rely on computed styles instead of the attribute directly? (This is why I ask about when UpdateItems() is called).

    Gerrit-Comment-Date: Wed, 17 Dec 2025 09:07:37 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Minseong Kim (Gerrit)

    unread,
    Dec 17, 2025, 8:39:23 PM (2 days ago) Dec 17
    to Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Daniil Sakhapov and Rune Lillesveen

    Minseong Kim added 1 comment

    Patchset-level comments
    Daniil Sakhapov . unresolved

    I think the correct approach here would be to override the reversed attribute with style info during style recalc, e.g. in Element::RecalcOwnStyle. @fut...@chromium.org, wdyt?

    Rune Lillesveen

    I don't know at which level of the CSS cascade things happen here. Would it make sense to do this as a CSS cascade thing that sets some value/flag on the ComputedStyle instead? That is, the `reversed` attribute causes some presentation style which is overridable by the CSS property?

    And that computed CSS value is the source of truth for reversing instead of the attribute?

    Daniil Sakhapov

    Yes, you got that right.
    In this case, will a CSS cascade thing make sense?
    If we detect this need to override, we need to call UpdateItems() for HTMLOListElement, which causes calls to SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation(), so doing it from RecalcOwnStyle should by fine?

    Rune Lillesveen

    When is UpdateItems() called (lifecycle-wise)?

    Could you spell out all the cascade-dependencies here?

    Daniil Sakhapov

    So `reversed` on <ol> is called from Element::ParseAttribute (so, html parsing time?) and it sets SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation() for <li>s via UpdateItems().
    Then we have our `counter-reset`, which should override `reset` and call UpdateItems() for <ol>.
    I guess that's it.

    Rune Lillesveen

    That didn't answer my questions.

    When, in the lifecycle, is UpdateItems called? Related to CSS counters?

    And the cascade part:

    Is it possible to express this behavior as presentation style for `reversed`, so that UpdateItems rely on computed styles instead of the attribute directly? (This is why I ask about when UpdateItems() is called).

    Minseong Kim

    When, in the lifecycle, is UpdateItems called? Related to CSS counters?


    IIUC, as @sakh...@chromium.org said, it's only called from `Element::ParseAttribute` when the element set/add/remove attributes. So, I think the call site of `UpdateItemValues()` has no relations with the CSS counters.. right?

    And that computed CSS value is the source of truth for reversing instead of the attribute?


    I totally agree with you. I'll test that it is possible to make `UpdateItemValues()` rely on computed styles instead of the attribute directly.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniil Sakhapov
    • Rune Lillesveen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic2dc0661b9c57dfbd021c0f52b6e7ec0a2070c9d
    Gerrit-Change-Number: 7233512
    Gerrit-PatchSet: 4
    Gerrit-Owner: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Comment-Date: Thu, 18 Dec 2025 01:38:50 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Minseong Kim (Gerrit)

    unread,
    Dec 17, 2025, 9:56:46 PM (2 days ago) Dec 17
    to Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Patchset-level comments
    Minseong Kim

    FYI, `UpdateItemValues` is a method on `HTMLOListElement` that is called when the `start` or `reversed` attributes of an <ol> are modified. Its primary role is to invalidate the cached numerical values (ordinals) of the list items. This forces a recalculation during the next layout phase. The recalculation logic, found in `ListItemOrdinal` class (specifically the `CalcValue` method), directly considers CSS properties like counter-set and counter-increment alongside the HTML attributes.

    Gerrit-Comment-Date: Thu, 18 Dec 2025 02:56:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Daniil Sakhapov <sakh...@chromium.org>
    Comment-In-Reply-To: Rune Lillesveen <fut...@chromium.org>
    Comment-In-Reply-To: Minseong Kim <jja0...@gmail.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    Dec 18, 2025, 4:07:55 AM (yesterday) Dec 18
    to Minseong Kim, Rune Lillesveen, Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Daniil Sakhapov and Minseong Kim

    Rune Lillesveen added 1 comment

    Patchset-level comments
    Rune Lillesveen

    FYI, `UpdateItemValues` is a method on `HTMLOListElement` that is called when the `start` or `reversed` attributes of an <ol> are modified. Its primary role is to invalidate the cached numerical values (ordinals) of the list items. This forces a recalculation during the next layout phase. The recalculation logic, found in `ListItemOrdinal` class (specifically the `CalcValue` method), directly considers CSS properties like counter-set and counter-increment alongside the HTML attributes.

    Right. It's confusing that it's called UpdateItemValues(). It should probably be named InvalidateItemValues() instead.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniil Sakhapov
    • Minseong Kim
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic2dc0661b9c57dfbd021c0f52b6e7ec0a2070c9d
    Gerrit-Change-Number: 7233512
    Gerrit-PatchSet: 4
    Gerrit-Owner: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Minseong Kim <jja0...@gmail.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Attention: Minseong Kim <jja0...@gmail.com>
    Gerrit-Comment-Date: Thu, 18 Dec 2025 09:07:39 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages