Implement customelementregistry element global attribute [chromium/src : main]

0 views
Skip to first unread message

Jayson Chen (Gerrit)

unread,
Feb 20, 2026, 1:30:17 PM (7 days ago) Feb 20
to Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
Attention needed from Mason Freed

Jayson Chen added 1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Jayson Chen . resolved

The detailed HTML spec is still being sorted out. This is an impl based off the current safari's implementation and WPTs.

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
Gerrit-Change-Number: 7596421
Gerrit-PatchSet: 2
Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Feb 2026 18:30:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
Feb 23, 2026, 6:58:13 PM (4 days ago) Feb 23
to Jayson Chen, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
Attention needed from Jayson Chen

Mason Freed added 1 comment

File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
Line 1107, Patchset 2 (Latest): has_customelementregistry_attr = true;
Mason Freed . unresolved

Interesting that we need to support this in the XML parser. Can you clarify why we need that? Normally, the `AttributeChanged` or `ParseAttribute` paths in the HTML elements would take care of HTML attributes added during XML document parsing. And I'd hope we could avoid touching the parsers at all for this. But let me know what's special about this one, perhaps I missed it.

Open in Gerrit

Related details

Attention is currently required from:
  • Jayson Chen
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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Comment-Date: Mon, 23 Feb 2026 23:58:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jayson Chen (Gerrit)

    unread,
    Feb 23, 2026, 9:01:06 PM (4 days ago) Feb 23
    to Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Mason Freed

    Jayson Chen added 1 comment

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1107, Patchset 2 (Latest): has_customelementregistry_attr = true;
    Mason Freed . unresolved

    Interesting that we need to support this in the XML parser. Can you clarify why we need that? Normally, the `AttributeChanged` or `ParseAttribute` paths in the HTML elements would take care of HTML attributes added during XML document parsing. And I'd hope we could avoid touching the parsers at all for this. But let me know what's special about this one, perhaps I missed it.

    Jayson Chen

    My understanding is that we'd need to do the parser change here given that later when we're creating the element in xml parser we'd need to know whether we're using global registry or null registry. In the code change below I tried to make sure we're adding minimal amount of work to regular xml parsing path. Let me know if this answered your question.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 02:00:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Feb 24, 2026, 11:10:50 AM (4 days ago) Feb 24
    to Jayson Chen, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Jayson Chen

    Mason Freed added 1 comment

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1107, Patchset 2 (Latest): has_customelementregistry_attr = true;
    Mason Freed . unresolved

    Interesting that we need to support this in the XML parser. Can you clarify why we need that? Normally, the `AttributeChanged` or `ParseAttribute` paths in the HTML elements would take care of HTML attributes added during XML document parsing. And I'd hope we could avoid touching the parsers at all for this. But let me know what's special about this one, perhaps I missed it.

    Jayson Chen

    My understanding is that we'd need to do the parser change here given that later when we're creating the element in xml parser we'd need to know whether we're using global registry or null registry. In the code change below I tried to make sure we're adding minimal amount of work to regular xml parsing path. Let me know if this answered your question.

    Mason Freed

    So in both AttributeChanged and ParseAttribute, there's a params flag that tells you it's coming from the parser. That's the usual way to handle element/attribute creation when you need to do something different from the parser. E.g.

    https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_link_element.cc;l=206;drc=75bd37cd98d8654e740d5b267c1be6fbf81c6ede

    Do you think that approach might work here? Both the XML and HTML parsers, when creating elements and attributes, should go through that one path. Which would mean you wouldn't need to modify the parser code directly. If it works, it's a better approach.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jayson Chen
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 16:10:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jayson Chen (Gerrit)

    unread,
    Feb 24, 2026, 3:32:21 PM (3 days ago) Feb 24
    to Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Mason Freed

    Jayson Chen added 1 comment

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1107, Patchset 2 (Latest): has_customelementregistry_attr = true;
    Mason Freed . unresolved

    Interesting that we need to support this in the XML parser. Can you clarify why we need that? Normally, the `AttributeChanged` or `ParseAttribute` paths in the HTML elements would take care of HTML attributes added during XML document parsing. And I'd hope we could avoid touching the parsers at all for this. But let me know what's special about this one, perhaps I missed it.

    Jayson Chen

    My understanding is that we'd need to do the parser change here given that later when we're creating the element in xml parser we'd need to know whether we're using global registry or null registry. In the code change below I tried to make sure we're adding minimal amount of work to regular xml parsing path. Let me know if this answered your question.

    Mason Freed

    So in both AttributeChanged and ParseAttribute, there's a params flag that tells you it's coming from the parser. That's the usual way to handle element/attribute creation when you need to do something different from the parser. E.g.

    https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_link_element.cc;l=206;drc=75bd37cd98d8654e740d5b267c1be6fbf81c6ede

    Do you think that approach might work here? Both the XML and HTML parsers, when creating elements and attributes, should go through that one path. Which would mean you wouldn't need to modify the parser code directly. If it works, it's a better approach.

    Jayson Chen

    I don't think it will work here. In line 1147, we do need to resolve the registry before we can look up the custom element definition. It will be awkward if we assume global registry, create the element and let the element get upgraded then realize in AttributeChanged that it should actually use a null registry and shouldn't be upgraded.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 20:32:15 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Feb 25, 2026, 4:43:31 PM (2 days ago) Feb 25
    to Jayson Chen, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Jayson Chen

    Mason Freed added 3 comments

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1107, Patchset 2 (Latest): has_customelementregistry_attr = true;
    Mason Freed . resolved

    Interesting that we need to support this in the XML parser. Can you clarify why we need that? Normally, the `AttributeChanged` or `ParseAttribute` paths in the HTML elements would take care of HTML attributes added during XML document parsing. And I'd hope we could avoid touching the parsers at all for this. But let me know what's special about this one, perhaps I missed it.

    Jayson Chen

    My understanding is that we'd need to do the parser change here given that later when we're creating the element in xml parser we'd need to know whether we're using global registry or null registry. In the code change below I tried to make sure we're adding minimal amount of work to regular xml parsing path. Let me know if this answered your question.

    Mason Freed

    So in both AttributeChanged and ParseAttribute, there's a params flag that tells you it's coming from the parser. That's the usual way to handle element/attribute creation when you need to do something different from the parser. E.g.

    https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/html_link_element.cc;l=206;drc=75bd37cd98d8654e740d5b267c1be6fbf81c6ede

    Do you think that approach might work here? Both the XML and HTML parsers, when creating elements and attributes, should go through that one path. Which would mean you wouldn't need to modify the parser code directly. If it works, it's a better approach.

    Jayson Chen

    I don't think it will work here. In line 1147, we do need to resolve the registry before we can look up the custom element definition. It will be awkward if we assume global registry, create the element and let the element get upgraded then realize in AttributeChanged that it should actually use a null registry and shouldn't be upgraded.

    Mason Freed

    Ok. Yeah. You're right - thanks for discussing it. That was the key thing - you need to know the definition before you even create the element.

    Line 1120, Patchset 2 (Latest): CustomElementRegistry::DefaultRegistry(current_node_->GetDocument());
    Mason Freed . unresolved

    Since this isn't just a trivial getter, and you'll throw it away in several cases below, perhaps just start with `nullptr` and assign it if the feature is disabled?

    Line 1124, Patchset 2 (Latest): // that we've seen the attribute so descendants will check their parent.
    Mason Freed . unresolved

    This is kind of a funny optimization. It means that once the attribute has been seen just once anywhere in a document, the branch below gets executed for all of the rest of the document. Not just within that subtree. That kind of feels odd, unless you think this is really a performance bottleneck? (Usually XML document parsing isn't on most benchmarks, or most common web usage.)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jayson Chen
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 21:43:25 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jayson Chen (Gerrit)

    unread,
    Feb 26, 2026, 5:23:18 PM (2 days ago) Feb 26
    to Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Mason Freed

    Jayson Chen added 2 comments

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1120, Patchset 2 (Latest): CustomElementRegistry::DefaultRegistry(current_node_->GetDocument());
    Mason Freed . unresolved

    Since this isn't just a trivial getter, and you'll throw it away in several cases below, perhaps just start with `nullptr` and assign it if the feature is disabled?

    Jayson Chen

    My assumption is that the cases that throw the default registry away are fairly rare (using custom element registry attribute in xml), so I thought it'd make sense to just start with `DefaultRegistry`.

    Line 1124, Patchset 2 (Latest): // that we've seen the attribute so descendants will check their parent.
    Mason Freed . unresolved

    This is kind of a funny optimization. It means that once the attribute has been seen just once anywhere in a document, the branch below gets executed for all of the rest of the document. Not just within that subtree. That kind of feels odd, unless you think this is really a performance bottleneck? (Usually XML document parsing isn't on most benchmarks, or most common web usage.)

    Jayson Chen

    I think a more naive approach is that we always look at the parent element to get the registry, so the global registry will be passed down from the root element. I'm not entirely sure how much I should worry about its performance impact tbh, but if we don't think this is something we should worry, we can keep the code simple and just grab the registry from the parent element to avoid over-complicating things.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Thu, 26 Feb 2026 22:23:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Mason Freed (Gerrit)

    unread,
    Feb 27, 2026, 6:01:18 PM (7 hours ago) Feb 27
    to Jayson Chen, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Jayson Chen

    Mason Freed voted and added 3 comments

    Votes added by Mason Freed

    Code-Review+1

    3 comments

    Patchset-level comments
    Mason Freed . resolved

    I'll LGTM this, but see the comments.

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1120, Patchset 2 (Latest): CustomElementRegistry::DefaultRegistry(current_node_->GetDocument());
    Mason Freed . unresolved

    Since this isn't just a trivial getter, and you'll throw it away in several cases below, perhaps just start with `nullptr` and assign it if the feature is disabled?

    Jayson Chen

    My assumption is that the cases that throw the default registry away are fairly rare (using custom element registry attribute in xml), so I thought it'd make sense to just start with `DefaultRegistry`.

    Mason Freed

    I'm ok as-is, but I guess also there's no downside really. I think the alternative would be just as readable, and wouldn't do as much work in the `has_customelementregistry_attr` case.

    Line 1124, Patchset 2 (Latest): // that we've seen the attribute so descendants will check their parent.
    Mason Freed . unresolved

    This is kind of a funny optimization. It means that once the attribute has been seen just once anywhere in a document, the branch below gets executed for all of the rest of the document. Not just within that subtree. That kind of feels odd, unless you think this is really a performance bottleneck? (Usually XML document parsing isn't on most benchmarks, or most common web usage.)

    Jayson Chen

    I think a more naive approach is that we always look at the parent element to get the registry, so the global registry will be passed down from the root element. I'm not entirely sure how much I should worry about its performance impact tbh, but if we don't think this is something we should worry, we can keep the code simple and just grab the registry from the parent element to avoid over-complicating things.

    Mason Freed

    I'd (always) err on that side. Do the easy-to-understand thing first, and then optimize later (if needed).

    At the minimum, if you're going to keep this approach, rename the variable from `saw_customelementregistry_attr_` to something like `document_contains_custom_element_registries_`.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jayson Chen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement 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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
    Gerrit-Change-Number: 7596421
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 23:01:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jayson Chen (Gerrit)

    unread,
    Feb 27, 2026, 10:03:56 PM (2 hours ago) Feb 27
    to Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, kouhei...@chromium.org, loading-rev...@chromium.org
    Attention needed from Mason Freed

    Jayson Chen added 3 comments

    Patchset-level comments
    File-level comment, Patchset 2:
    Jayson Chen . resolved

    Updated the impl so it's easier to understand.

    File third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
    Line 1120, Patchset 2: CustomElementRegistry::DefaultRegistry(current_node_->GetDocument());
    Mason Freed . resolved

    Since this isn't just a trivial getter, and you'll throw it away in several cases below, perhaps just start with `nullptr` and assign it if the feature is disabled?

    Jayson Chen

    My assumption is that the cases that throw the default registry away are fairly rare (using custom element registry attribute in xml), so I thought it'd make sense to just start with `DefaultRegistry`.

    Mason Freed

    I'm ok as-is, but I guess also there's no downside really. I think the alternative would be just as readable, and wouldn't do as much work in the `has_customelementregistry_attr` case.

    Jayson Chen

    Done

    Line 1124, Patchset 2: // that we've seen the attribute so descendants will check their parent.
    Mason Freed . resolved

    This is kind of a funny optimization. It means that once the attribute has been seen just once anywhere in a document, the branch below gets executed for all of the rest of the document. Not just within that subtree. That kind of feels odd, unless you think this is really a performance bottleneck? (Usually XML document parsing isn't on most benchmarks, or most common web usage.)

    Jayson Chen

    I think a more naive approach is that we always look at the parent element to get the registry, so the global registry will be passed down from the root element. I'm not entirely sure how much I should worry about its performance impact tbh, but if we don't think this is something we should worry, we can keep the code simple and just grab the registry from the parent element to avoid over-complicating things.

    Mason Freed

    I'd (always) err on that side. Do the easy-to-understand thing first, and then optimize later (if needed).

    At the minimum, if you're going to keep this approach, rename the variable from `saw_customelementregistry_attr_` to something like `document_contains_custom_element_registries_`.

    Jayson Chen

    Yea totally understand. I think I'm just a bit worried about performance given what happened with SCER, but agree that we can start with the easy-to-understand approach first.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    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: Ie0ecaa6758b6e2336007ea45bc3e12dcf73f76a6
      Gerrit-Change-Number: 7596421
      Gerrit-PatchSet: 3
      Gerrit-Owner: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-Attention: Mason Freed <mas...@chromium.org>
      Gerrit-Comment-Date: Sat, 28 Feb 2026 03:03:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages