Fix HTMLFormControlElement::IsReadOnly for non-supporting elements. [chromium/src : main]

0 views
Skip to first unread message

Nan Lin (Gerrit)

unread,
Mar 31, 2026, 5:22:32 PM (2 days ago) Mar 31
to David Baron, Aaron Leventhal, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from David Baron

Nan Lin voted and added 1 comment

Votes added by Nan Lin

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Nan Lin . resolved

Hi David, could you PTAL, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • David Baron
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: I26dbb47151778253d81842d67133db800c9094ae
Gerrit-Change-Number: 7719160
Gerrit-PatchSet: 3
Gerrit-Owner: Nan Lin <lin...@chromium.org>
Gerrit-Reviewer: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Nan Lin <lin...@chromium.org>
Gerrit-CC: Aaron Leventhal <aleve...@google.com>
Gerrit-Attention: David Baron <dba...@chromium.org>
Gerrit-Comment-Date: Tue, 31 Mar 2026 21:22:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

David Baron (Gerrit)

unread,
Apr 1, 2026, 10:44:31 AM (20 hours ago) Apr 1
to Nan Lin, David Baron, Aaron Leventhal, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Nan Lin

David Baron added 1 comment

Patchset-level comments
David Baron . unresolved

I think this is mostly correct, except that I think form-associated custom elements *probably* go through this codepath as well, and they need to honor `readonly` too.

I think it is a web-exposed behavior change, and it almost certainly needs both (a) [a `RuntimeEnabledFeatures` flag that can be used as a killswitch](https://groups.google.com/a/chromium.org/g/blink-dev/c/jhJLN9drXy4/m/RXCJx0-VCAAJ) if needed and (b) tests in WPT that fail without the change and pass with it (these don't need to be exhaustive but it's probably also good if they cover a few different cases) and (c) tests that `readonly` still works for form-associated custom elements which I *think* this change breaks (although I'm not 100% sure). (I don't think the unittests are particularly needed... although I basically always think that about unittests.)

I think it also intersects with the fix in https://issues.chromium.org/486228104 which is rolling out to stable within the next few days, but which appears to me to be incomplete since it doesn't have any per-input-type specific behavior but instead honors `readonly` for all `<input>` types (since they all inherit from `TextControlElement`).

I'm also curious whether this brings us closer in line with other browser engines or further away from them.

Open in Gerrit

Related details

Attention is currently required from:
  • Nan Lin
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: I26dbb47151778253d81842d67133db800c9094ae
    Gerrit-Change-Number: 7719160
    Gerrit-PatchSet: 3
    Gerrit-Owner: Nan Lin <lin...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Nan Lin <lin...@chromium.org>
    Gerrit-CC: Aaron Leventhal <aleve...@google.com>
    Gerrit-Attention: Nan Lin <lin...@chromium.org>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 14:44:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nan Lin (Gerrit)

    unread,
    Apr 1, 2026, 1:53:46 PM (17 hours ago) Apr 1
    to AyeAye, David Baron, Aaron Leventhal, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
    Attention needed from David Baron

    Nan Lin added 1 comment

    Patchset-level comments
    David Baron . unresolved

    I think this is mostly correct, except that I think form-associated custom elements *probably* go through this codepath as well, and they need to honor `readonly` too.

    I think it is a web-exposed behavior change, and it almost certainly needs both (a) [a `RuntimeEnabledFeatures` flag that can be used as a killswitch](https://groups.google.com/a/chromium.org/g/blink-dev/c/jhJLN9drXy4/m/RXCJx0-VCAAJ) if needed and (b) tests in WPT that fail without the change and pass with it (these don't need to be exhaustive but it's probably also good if they cover a few different cases) and (c) tests that `readonly` still works for form-associated custom elements which I *think* this change breaks (although I'm not 100% sure). (I don't think the unittests are particularly needed... although I basically always think that about unittests.)

    I think it also intersects with the fix in https://issues.chromium.org/486228104 which is rolling out to stable within the next few days, but which appears to me to be incomplete since it doesn't have any per-input-type specific behavior but instead honors `readonly` for all `<input>` types (since they all inherit from `TextControlElement`).

    I'm also curious whether this brings us closer in line with other browser engines or further away from them.

    Nan Lin

    Thanks David.

    I've looked into the concerns regarding web-exposed behavior. It appears that the change in this CL doesn't actually change web-exposed behaviors, e.g. CSS pseudo-classes and validation.

    CSS pseudo-classes: Elements like <button> already match :read-only because they are not editable. Blink's selector matching for these elements doesn't currently call `IsReadOnly()`, with <textarea> and <input> correctly checks the attibute as well as the supported input types. See the [WPT test](third_party/blink/web_tests/external/wpt/html/semantics/selectors/pseudo-classes/readwrite-readonly.html).

    Validation: I agree that the fix for crbug.com/486228104 is incomplete which doesn't handle unsupported input types. But this will not be fixed by this CL yet, as it doesn't call `IsReadOnly()`. I will fix this in a follow up CL.

    The updated logic may change callers, e.g. `AIPageContentAgent` which checks the readonly state of the element for page content extraction.

    I wrapped the updated logic in a runtime feature as a kill switch in case of unexpected behaviors. Does this make sense?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Baron
    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: I26dbb47151778253d81842d67133db800c9094ae
    Gerrit-Change-Number: 7719160
    Gerrit-PatchSet: 5
    Gerrit-Owner: Nan Lin <lin...@chromium.org>
    Gerrit-Reviewer: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Nan Lin <lin...@chromium.org>
    Gerrit-CC: Aaron Leventhal <aleve...@google.com>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 17:53:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nan Lin (Gerrit)

    unread,
    Apr 1, 2026, 2:04:53 PM (16 hours ago) Apr 1
    to AyeAye, David Baron, Aaron Leventhal, Chromium LUCI CQ, chromium...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
    Attention needed from David Baron

    Nan Lin added 1 comment

    Patchset-level comments
    David Baron . unresolved

    I think this is mostly correct, except that I think form-associated custom elements *probably* go through this codepath as well, and they need to honor `readonly` too.

    I think it is a web-exposed behavior change, and it almost certainly needs both (a) [a `RuntimeEnabledFeatures` flag that can be used as a killswitch](https://groups.google.com/a/chromium.org/g/blink-dev/c/jhJLN9drXy4/m/RXCJx0-VCAAJ) if needed and (b) tests in WPT that fail without the change and pass with it (these don't need to be exhaustive but it's probably also good if they cover a few different cases) and (c) tests that `readonly` still works for form-associated custom elements which I *think* this change breaks (although I'm not 100% sure). (I don't think the unittests are particularly needed... although I basically always think that about unittests.)

    I think it also intersects with the fix in https://issues.chromium.org/486228104 which is rolling out to stable within the next few days, but which appears to me to be incomplete since it doesn't have any per-input-type specific behavior but instead honors `readonly` for all `<input>` types (since they all inherit from `TextControlElement`).

    I'm also curious whether this brings us closer in line with other browser engines or further away from them.

    Nan Lin

    Thanks David.

    I've looked into the concerns regarding web-exposed behavior. It appears that the change in this CL doesn't actually change web-exposed behaviors, e.g. CSS pseudo-classes and validation.

    CSS pseudo-classes: Elements like <button> already match :read-only because they are not editable. Blink's selector matching for these elements doesn't currently call `IsReadOnly()`, with <textarea> and <input> correctly checks the attibute as well as the supported input types. See the [WPT test](third_party/blink/web_tests/external/wpt/html/semantics/selectors/pseudo-classes/readwrite-readonly.html).

    Validation: I agree that the fix for crbug.com/486228104 is incomplete which doesn't handle unsupported input types. But this will not be fixed by this CL yet, as it doesn't call `IsReadOnly()`. I will fix this in a follow up CL.

    The updated logic may change callers, e.g. `AIPageContentAgent` which checks the readonly state of the element for page content extraction.

    I wrapped the updated logic in a runtime feature as a kill switch in case of unexpected behaviors. Does this make sense?

    Nan Lin

    Form-associated custom elements are implemented with `ElementInternals` which doesn't go through `HTMLFormControlElement` code paths IIUC.

    Gerrit-Comment-Date: Wed, 01 Apr 2026 18:04:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nan Lin <lin...@chromium.org>
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages