Manually implement !important inside -internal-auto-base() [chromium/src : main]

0 views
Skip to first unread message

Anders Hartvoll Ruud (Gerrit)

unread,
Jan 22, 2026, 3:55:14 PMJan 22
to Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar

Anders Hartvoll Ruud added 4 comments

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Anders Hartvoll Ruud . unresolved

I have a better idea:

We'll soon have new technology: The `revert-rule` keyword, https://github.com/w3c/csswg-drafts/blob/main/css-cascade-5/revert-rule-explainer.md

I think that will allow you do change e.g.:

```
/* TODO(crbug.com/357649033): This line-height rule can't be undone for
* customizable select multiple because we can't put !important inside
* -internal-auto-base(). */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: initial !important;
}
```

into:

```
/* This line-height rule CAN be undone for
* customizable select. */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: -internal-auto-base(initial, revert-rule) !important;
}
```

While this `line-height` declaration will always win the cascade (the whole thing is `!important`), we'll roll back to the previous winning declaration if the `revert-rule` branch is chosen.

I think this gives the behavior you want?

It requires making `revert-rule` valid in UA mode; it's behind a flag right now. (Expected shipment is Q1.)

File third_party/blink/renderer/core/css/resolver/style_adjuster.cc
Line 641, Patchset 7 (Latest): // This manually implements !important inside -internal-auto-base() because
// -internal-auto-base() doesn't support !important.
Anders Hartvoll Ruud . unresolved

I'm not sure that's a valid description of what's going on here.

(It's hard to tell what's going on here, but it's not implementing !important.)

Line 647, Patchset 7 (Latest): builder.SetLineHeight(
Anders Hartvoll Ruud . unresolved

It's too late to set line-height during style adjustment. It needs to apply very early in the process due to `lh` units.

File third_party/blink/renderer/core/html/resources/html.css
Line 1019, Patchset 7 (Latest): line-height: -internal-auto-base(initial !important, unset);
Anders Hartvoll Ruud . unresolved

Isn't this just invalid here? (Specifically, `!`-tokens.)

In any case, you don't want to add `!important` here in _addition_ to style adjustment?

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement 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: If8f6673ab5c1ed0d07fa63ca10a6552f15bc6d11
Gerrit-Change-Number: 7396627
Gerrit-PatchSet: 7
Gerrit-Owner: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Jan 2026 20:54:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Joey Arhar (Gerrit)

unread,
Jan 23, 2026, 11:21:40 AMJan 23
to Anders Hartvoll Ruud, Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

Joey Arhar added 1 comment

Patchset-level comments
Anders Hartvoll Ruud . unresolved

I have a better idea:

We'll soon have new technology: The `revert-rule` keyword, https://github.com/w3c/csswg-drafts/blob/main/css-cascade-5/revert-rule-explainer.md

I think that will allow you do change e.g.:

```
/* TODO(crbug.com/357649033): This line-height rule can't be undone for
* customizable select multiple because we can't put !important inside
* -internal-auto-base(). */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: initial !important;
}
```

into:

```
/* This line-height rule CAN be undone for
* customizable select. */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: -internal-auto-base(initial, revert-rule) !important;
}
```

While this `line-height` declaration will always win the cascade (the whole thing is `!important`), we'll roll back to the previous winning declaration if the `revert-rule` branch is chosen.

I think this gives the behavior you want?

It requires making `revert-rule` valid in UA mode; it's behind a flag right now. (Expected shipment is Q1.)

Joey Arhar

If it means that authors can't override the value in auto appearance but can override in base appearance, then yes that will probably do it!

I'm happy to wait, this patch is much uglier

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement 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: If8f6673ab5c1ed0d07fa63ca10a6552f15bc6d11
Gerrit-Change-Number: 7396627
Gerrit-PatchSet: 7
Gerrit-Owner: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Comment-Date: Fri, 23 Jan 2026 16:21:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
Jan 23, 2026, 11:09:05 PMJan 23
to Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
Attention needed from Joey Arhar

Anders Hartvoll Ruud added 1 comment

Patchset-level comments
Anders Hartvoll Ruud . unresolved

I have a better idea:

We'll soon have new technology: The `revert-rule` keyword, https://github.com/w3c/csswg-drafts/blob/main/css-cascade-5/revert-rule-explainer.md

I think that will allow you do change e.g.:

```
/* TODO(crbug.com/357649033): This line-height rule can't be undone for
* customizable select multiple because we can't put !important inside
* -internal-auto-base(). */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: initial !important;
}
```

into:

```
/* This line-height rule CAN be undone for
* customizable select. */
select:-internal-list-box option,
select:-internal-list-box optgroup {
line-height: -internal-auto-base(initial, revert-rule) !important;
}
```

While this `line-height` declaration will always win the cascade (the whole thing is `!important`), we'll roll back to the previous winning declaration if the `revert-rule` branch is chosen.

I think this gives the behavior you want?

It requires making `revert-rule` valid in UA mode; it's behind a flag right now. (Expected shipment is Q1.)

Joey Arhar

If it means that authors can't override the value in auto appearance but can override in base appearance, then yes that will probably do it!

I'm happy to wait, this patch is much uglier

Anders Hartvoll Ruud

Hmm, looks this won't actually work. Let me think about it some more ...

Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement 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: If8f6673ab5c1ed0d07fa63ca10a6552f15bc6d11
Gerrit-Change-Number: 7396627
Gerrit-PatchSet: 7
Gerrit-Owner: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Joey Arhar <jar...@chromium.org>
Gerrit-Comment-Date: Sat, 24 Jan 2026 04:08:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
Jan 24, 2026, 12:29:47 AMJan 24
to Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
Patchset-level comments
Anders Hartvoll Ruud

OK, it *should* work, I just found a bug in `revert-rule`. https://issues.chromium.org/issues/478178033

Gerrit-Comment-Date: Sat, 24 Jan 2026 05:29:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
Comment-In-Reply-To: Joey Arhar <jar...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Joey Arhar (Gerrit)

unread,
Feb 20, 2026, 8:23:02 PMFeb 20
to Anders Hartvoll Ruud, Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

Joey Arhar added 4 comments

Patchset-level comments
File-level comment, Patchset 7:
Anders Hartvoll Ruud . resolved
Joey Arhar

Thanks so much, that did the trick!

File third_party/blink/renderer/core/css/resolver/style_adjuster.cc
Line 641, Patchset 7: // This manually implements !important inside -internal-auto-base() because

// -internal-auto-base() doesn't support !important.
Anders Hartvoll Ruud . resolved

I'm not sure that's a valid description of what's going on here.

(It's hard to tell what's going on here, but it's not implementing !important.)

Joey Arhar

Done

Line 647, Patchset 7: builder.SetLineHeight(
Anders Hartvoll Ruud . resolved

It's too late to set line-height during style adjustment. It needs to apply very early in the process due to `lh` units.

Joey Arhar

Done

File third_party/blink/renderer/core/html/resources/html.css
Line 1019, Patchset 7: line-height: -internal-auto-base(initial !important, unset);
Anders Hartvoll Ruud . resolved

Isn't this just invalid here? (Specifically, `!`-tokens.)

In any case, you don't want to add `!important` here in _addition_ to style adjustment?

Joey Arhar

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: If8f6673ab5c1ed0d07fa63ca10a6552f15bc6d11
    Gerrit-Change-Number: 7396627
    Gerrit-PatchSet: 8
    Gerrit-Owner: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Comment-Date: Sat, 21 Feb 2026 01:22:54 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Anders Hartvoll Ruud (Gerrit)

    unread,
    Feb 21, 2026, 3:45:34 AMFeb 21
    to Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
    Attention needed from Joey Arhar

    Anders Hartvoll Ruud voted and added 1 comment

    Votes added by Anders Hartvoll Ruud

    Code-Review+1

    1 comment

    Commit Message
    Line 7, Patchset 8 (Latest):Manually implement !important inside -internal-auto-base()
    Anders Hartvoll Ruud . unresolved

    Make update the description.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joey Arhar
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement 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: If8f6673ab5c1ed0d07fa63ca10a6552f15bc6d11
      Gerrit-Change-Number: 7396627
      Gerrit-PatchSet: 8
      Gerrit-Owner: Joey Arhar <jar...@chromium.org>
      Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
      Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
      Gerrit-CC: Menard, Alexis <alexis...@intel.com>
      Gerrit-Attention: Joey Arhar <jar...@chromium.org>
      Gerrit-Comment-Date: Sat, 21 Feb 2026 08:45:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anders Hartvoll Ruud (Gerrit)

      unread,
      Feb 21, 2026, 6:32:18 PMFeb 21
      to Menard, Alexis, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, apavlo...@chromium.org, blink-...@chromium.org
      Attention needed from Joey Arhar

      Anders Hartvoll Ruud added 1 comment

      Commit Message
      Line 7, Patchset 8 (Latest):Manually implement !important inside -internal-auto-base()
      Anders Hartvoll Ruud . unresolved

      Make update the description.

      Anders Hartvoll Ruud

      I meant: _Maybe_ update the description.

      ( XD )

      Gerrit-Comment-Date: Sat, 21 Feb 2026 23:32:00 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages