[SVG] Disallow Unitless Lengths in CSS Variable Substitution for `SVGLength` [chromium/src : main]

0 views
Skip to first unread message

Divyansh Mangal (Gerrit)

unread,
Jan 7, 2026, 3:30:42 AM (8 days ago) Jan 7
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Line 249, Patchset 7: MakeGarbageCollected<CSSUnparsedDeclarationValue>(variable_data);
Fredrik Söderquist . unresolved

This seems to exploit unwanted behavior (not specifying a parser context yields a strict-mode context). See https://issues.chromium.org/41471328 .

Also, my take-away from the discussion is that this should follow the quirks-mode of the document? I guess that will work out ATM because we always override the parsing mode for the relevant properties? (Which makes me wonder why this happens to work...)

Divyansh Mangal

Also, my take-away from the discussion is that this should follow the quirks-mode of the document? I guess that will work out ATM because we always override the parsing mode for the relevant properties? (Which makes me wonder why this happens to work...)

I see your point and agree with it, but to get QuirksMode in SVGLength class, I would need the document object here, which I don't think we have the access here.
One way I could think is to have a new function `SetValueAsString(string, quirksmode)` and make the caller responsible for passing the quirks mode, but that way I think I will need to make 2-3 similar changes in the call hierarchy?

As for why this happens to work, I am not entirely sure, I mainly checked the function https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/properties/css_parsing_utils.cc;drc=98ea873bd650963ffde5b098841b9949b5688823;l=1183 which allows unitless length for `kSVGAttributeMode` and hence I added the svg context parser earlier.

Anders Hartvoll Ruud

This seems to exploit unwanted behavior.

Indeed.

Also, my take-away from the discussion is that this should follow the quirks-mode of the document?

Does that mean CSS _properties_ should not allow unitless (in standards mode) even when specified literally?

Example: https://jsbin.com/zeyewezeve/edit?html,output

Is `stroke-width: 10` valid here?

Which makes me wonder why this happens to work...

We appear to only test `width` and `height`; it probably doesn't work for properties that override the mode. (We should test them as well.)

One way I could think is to have a new function SetValueAsString(string, quirksmode) and make the caller responsible for passing the quirks mode, but that way I think I will need to make 2-3 similar changes in the call hierarchy?

In that case, maybe you can pass the actual `CSSParserContext` associated with the document to also get proper use-counting (etc). (`document.ElementSheet().Contents()->ParserContext()`)

Divyansh Mangal

In that case, maybe you can pass the actual `CSSParserContext` associated with the document to also get proper use-counting (etc). (`document.ElementSheet().Contents()->ParserContext()`)

I tried the idea of passing the actual `CSSParserContext`, though it ended up resulting in lot of plumbing as you can see in the patchset. @f...@opera.com, is this a good way of passing `CSSParserContext` to `SetValueAsString`?


> Does that mean CSS properties should not allow unitless (in standards mode) even when specified literally?
>
> Example: https://jsbin.com/zeyewezeve/edit?html,output
>
> Is stroke-width: 10 valid here?

That's a very valid use case that you suggested @and...@chromium.org, based on the discussion i think it should be disallowed as well, but I can ask this from folks from gecko and webkit, in case I am missing something.

As you mentioned it's rendering in Chromium, because we explicitly override the mode for stroke-width https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc;drc=a340ed8f2a4d05131c7438f608e37fbb64937600;l=9772

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
Gerrit-Change-Number: 7274991
Gerrit-PatchSet: 8
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Wed, 07 Jan 2026 08:30:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 7, 2026, 3:33:33 AM (8 days ago) Jan 7
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Line 244, Patchset 8 (Latest): // The SVG parser context allows unitless lengths, but CSS variable
// resolution occurs during the cascade phase where unitless lengths
// are forbidden. To maintain consistent CSS behavior and avoid SVG-
// specific quirks, we deliberately omit the parser context.
Divyansh Mangal . unresolved

TODO(dmangal): Update the comment based on the solution

Gerrit-Comment-Date: Wed, 07 Jan 2026 08:33:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Jan 7, 2026, 8:40:35 AM (7 days ago) Jan 7
to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Fredrik Söderquist

In that case, maybe you can pass the actual `CSSParserContext` associated with the document to also get proper use-counting (etc). (`document.ElementSheet().Contents()->ParserContext()`)

I tried the idea of passing the actual `CSSParserContext`, though it ended up resulting in lot of plumbing as you can see in the patchset. @f...@opera.com, is this a good way of passing `CSSParserContext` to `SetValueAsString`?


> Does that mean CSS properties should not allow unitless (in standards mode) even when specified literally?
>
> Example: https://jsbin.com/zeyewezeve/edit?html,output
>
> Is stroke-width: 10 valid here?

It shouldn't be, but it currently is (see `Element::EnsureMutableInlineStyle`). This used be issue 40658704, but that was closed in favor of issue 40869667 which was then closed (although I don't think it's actually been fixed - proof in the function referenced above...).

(I'm honestly not sure why we have all these mode overrides everywhere...)

As for forwarding the document's parser context, it would be better to limit it to just `SVGAnimatedLength`.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Wed, 07 Jan 2026 13:40:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 8, 2026, 3:48:10 AM (7 days ago) Jan 8
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Line 244, Patchset 8: // The SVG parser context allows unitless lengths, but CSS variable

// resolution occurs during the cascade phase where unitless lengths
// are forbidden. To maintain consistent CSS behavior and avoid SVG-
// specific quirks, we deliberately omit the parser context.
Divyansh Mangal . resolved

TODO(dmangal): Update the comment based on the solution

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
Gerrit-Change-Number: 7274991
Gerrit-PatchSet: 9
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Comment-Date: Thu, 08 Jan 2026 08:47:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 8, 2026, 4:33:38 AM (6 days ago) Jan 8
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Divyansh Mangal

It shouldn't be, but it currently is (see Element::EnsureMutableInlineStyle). This used be issue 40658704, but that was closed in favor of issue 40869667 which was then closed (although I don't think it's actually been fixed - proof in the function referenced above...).

I have started conversation with folks from Gecko regarding stroke-width
https://github.com/web-platform-tests/wpt/pull/56390#issuecomment-3722873859,
I agree we should not allow unitless for stroke-width as well but will probably handle that in a different CL based on the discussion above. Should I still go ahead and create a new Chromium issue for this?

As for forwarding the document's parser context, it would be better to limit it to just SVGAnimatedLength.

Restricted the passing as suggested.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
Gerrit-Change-Number: 7274991
Gerrit-PatchSet: 12
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Thu, 08 Jan 2026 09:33:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Jan 8, 2026, 7:39:46 AM (6 days ago) Jan 8
to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 1 comment

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12 (Latest): Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . unresolved

We shouldn't store this. This costs memory for all `SVGLength`.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Thu, 08 Jan 2026 12:39:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Jan 8, 2026, 7:40:33 AM (6 days ago) Jan 8
to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 1 comment

File third_party/blink/renderer/core/svg/svg_length.cc
Fredrik Söderquist

We should add a test for the quirks-mode case.

Gerrit-Comment-Date: Thu, 08 Jan 2026 12:40:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 9, 2026, 4:25:08 AM (6 days ago) Jan 9
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 2 comments

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12: Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . unresolved

We shouldn't store this. This costs memory for all `SVGLength`.

Divyansh Mangal

I removed the variable but to pass the Parser Context while restricting to `SVGAnimatedLength` I have to duplicate the code from `UpdateBaseValueFromAttribute` into `SVGAnimatedLength::AttributeChanged` and change it accordingly. I am not very confident about this approach given this TODO there but let me know your thoughts on this.

```
// TODO: Use UpdateBaseValueFromAttribute() when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```
File third_party/blink/renderer/core/svg/svg_length.cc
Divyansh Mangal

Added the test.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
Gerrit-Change-Number: 7274991
Gerrit-PatchSet: 15
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 09:24:38 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Jan 9, 2026, 7:19:40 AM (5 days ago) Jan 9
to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 7 comments

File third_party/blink/renderer/core/svg/properties/svg_animated_property.h
Line 115, Patchset 15 (Latest): enum ContentAttributeState : unsigned {
// The content attribute is not set (hasAttribute(...) === false).
kNotSet,

// The content attribute is set (hasAttribute(...) === true).
kHasValue,

// The SVG DOM base value has been changed and is waiting to be
// synchronized to content attribute storage.
kUnsynchronizedValue,

// The SVG DOM base value has been changed such that the content attribute
// would be removed, and is waiting to be synchronized to content attribute
// storage.
kUnsynchronizedRemoval,
};

void SetContentAttributeState(ContentAttributeState content_attribute_state) {
content_attribute_state_ = content_attribute_state;
}
Fredrik Söderquist . unresolved

I think we could make these protected instead of adding a new function.

Line 97, Patchset 15 (Latest): void SetAttributeStateFromValue(const String& value);
Fredrik Söderquist . unresolved

Can be protected. However, see below.

File third_party/blink/renderer/core/svg/svg_animated_length.cc
Line 60, Patchset 15 (Latest): ContextElement() ? ContextElement()->GetParserContext() : nullptr);
Fredrik Söderquist . unresolved

The context element can't be null here.

File third_party/blink/renderer/core/svg/svg_element.cc
Line 1220, Patchset 15 (Latest): return GetDocument().ElementSheet().Contents()->ParserContext();
Fredrik Söderquist . unresolved

Let's just use this directly in the one spot where it is used.

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12: Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . unresolved

We shouldn't store this. This costs memory for all `SVGLength`.

Divyansh Mangal

I removed the variable but to pass the Parser Context while restricting to `SVGAnimatedLength` I have to duplicate the code from `UpdateBaseValueFromAttribute` into `SVGAnimatedLength::AttributeChanged` and change it accordingly. I am not very confident about this approach given this TODO there but let me know your thoughts on this.

```
// TODO: Use UpdateBaseValueFromAttribute() when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```
Fredrik Söderquist

You could probably also add the ability of passing a parameter-pack to `UpdateBaseValueFromAttribute`.

File third_party/blink/web_tests/external/wpt/svg/styling/css-var-on-length-attributes-quirk.html
Line 1, Patchset 15 (Latest):<!DOCTYPE quirks-mode>
Fredrik Söderquist . unresolved

Just drop this, and make sure to note it's testing quirks mode.

Line 2, Patchset 15 (Latest):<title>Usage of css var() on circle radius attribute (units not specified and document in quirks mode)</title>
Fredrik Söderquist . unresolved

I think the parenthesis can be dropped.

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 12:19:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 10, 2026, 10:04:40 AM (4 days ago) Jan 10
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 6 comments

File third_party/blink/renderer/core/svg/properties/svg_animated_property.h
Line 115, Patchset 15: enum ContentAttributeState : unsigned {

// The content attribute is not set (hasAttribute(...) === false).
kNotSet,

// The content attribute is set (hasAttribute(...) === true).
kHasValue,

// The SVG DOM base value has been changed and is waiting to be
// synchronized to content attribute storage.
kUnsynchronizedValue,

// The SVG DOM base value has been changed such that the content attribute
// would be removed, and is waiting to be synchronized to content attribute
// storage.
kUnsynchronizedRemoval,
};

void SetContentAttributeState(ContentAttributeState content_attribute_state) {
content_attribute_state_ = content_attribute_state;
}
Fredrik Söderquist . resolved

I think we could make these protected instead of adding a new function.

Divyansh Mangal

Done

Line 97, Patchset 15: void SetAttributeStateFromValue(const String& value);
Fredrik Söderquist . resolved

Can be protected. However, see below.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_animated_length.cc
Line 60, Patchset 15: ContextElement() ? ContextElement()->GetParserContext() : nullptr);
Fredrik Söderquist . resolved

The context element can't be null here.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_element.cc
Line 1220, Patchset 15: return GetDocument().ElementSheet().Contents()->ParserContext();
Fredrik Söderquist . resolved

Let's just use this directly in the one spot where it is used.

Divyansh Mangal

Done

File third_party/blink/web_tests/external/wpt/svg/styling/css-var-on-length-attributes-quirk.html
Line 1, Patchset 15:<!DOCTYPE quirks-mode>
Fredrik Söderquist . resolved

Just drop this, and make sure to note it's testing quirks mode.

Divyansh Mangal

Dropped this and I think title already contain the info for the quirks mode.

Line 2, Patchset 15:<title>Usage of css var() on circle radius attribute (units not specified and document in quirks mode)</title>
Fredrik Söderquist . resolved

I think the parenthesis can be dropped.

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
Gerrit-Change-Number: 7274991
Gerrit-PatchSet: 16
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Sat, 10 Jan 2026 15:04:03 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 10, 2026, 10:07:51 AM (4 days ago) Jan 10
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12: Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . unresolved

We shouldn't store this. This costs memory for all `SVGLength`.

Divyansh Mangal

I removed the variable but to pass the Parser Context while restricting to `SVGAnimatedLength` I have to duplicate the code from `UpdateBaseValueFromAttribute` into `SVGAnimatedLength::AttributeChanged` and change it accordingly. I am not very confident about this approach given this TODO there but let me know your thoughts on this.

```
// TODO: Use UpdateBaseValueFromAttribute() when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```
Fredrik Söderquist

You could probably also add the ability of passing a parameter-pack to `UpdateBaseValueFromAttribute`.

Divyansh Mangal

The parameter-pack suggestion did indeed help in reducing the duplicity, Do you think we should update the TODO as well because I am directly using `UpdateBaseValueFromAttribute` here? New TODO can be like

```
// TODO: Use correct validator when we can set proper initial


// values on error (for example 'auto' for 'rx' and 'ry').
```

Gerrit-Comment-Date: Sat, 10 Jan 2026 15:07:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Jan 12, 2026, 7:18:57 AM (2 days ago) Jan 12
to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 3 comments

File third_party/blink/renderer/core/svg/properties/svg_animated_property.h
Line 98, Patchset 16 (Latest): enum ContentAttributeState : unsigned {

// The content attribute is not set (hasAttribute(...) === false).
kNotSet,

// The content attribute is set (hasAttribute(...) === true).
kHasValue,

// The SVG DOM base value has been changed and is waiting to be
// synchronized to content attribute storage.
kUnsynchronizedValue,

// The SVG DOM base value has been changed such that the content attribute
// would be removed, and is waiting to be synchronized to content attribute
// storage.
kUnsynchronizedRemoval,
};

void SetContentAttributeState(ContentAttributeState content_attribute_state) {
content_attribute_state_ = content_attribute_state;
}
Fredrik Söderquist . unresolved

No need to move this now that we've updated `UpdateBaseValueFromAttribute()` instead.

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12: Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . unresolved

We shouldn't store this. This costs memory for all `SVGLength`.

Divyansh Mangal

I removed the variable but to pass the Parser Context while restricting to `SVGAnimatedLength` I have to duplicate the code from `UpdateBaseValueFromAttribute` into `SVGAnimatedLength::AttributeChanged` and change it accordingly. I am not very confident about this approach given this TODO there but let me know your thoughts on this.

```
// TODO: Use UpdateBaseValueFromAttribute() when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```
Fredrik Söderquist

You could probably also add the ability of passing a parameter-pack to `UpdateBaseValueFromAttribute`.

Divyansh Mangal

The parameter-pack suggestion did indeed help in reducing the duplicity, Do you think we should update the TODO as well because I am directly using `UpdateBaseValueFromAttribute` here? New TODO can be like

```
// TODO: Use correct validator when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```

Fredrik Söderquist

Yes, that sounds like a good update.

File third_party/blink/renderer/core/svg/svg_length.cc
Line 249, Patchset 7: MakeGarbageCollected<CSSUnparsedDeclarationValue>(variable_data);
Fredrik Söderquist . resolved
Fredrik Söderquist

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Mon, 12 Jan 2026 12:18:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Jan 12, 2026, 8:21:35 AM (2 days ago) Jan 12
to Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Anders Hartvoll Ruud, Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 2 comments

File third_party/blink/renderer/core/svg/properties/svg_animated_property.h
Line 98, Patchset 16: enum ContentAttributeState : unsigned {

// The content attribute is not set (hasAttribute(...) === false).
kNotSet,

// The content attribute is set (hasAttribute(...) === true).
kHasValue,

// The SVG DOM base value has been changed and is waiting to be
// synchronized to content attribute storage.
kUnsynchronizedValue,

// The SVG DOM base value has been changed such that the content attribute
// would be removed, and is waiting to be synchronized to content attribute
// storage.
kUnsynchronizedRemoval,
};

void SetContentAttributeState(ContentAttributeState content_attribute_state) {
content_attribute_state_ = content_attribute_state;
}
Fredrik Söderquist . resolved

No need to move this now that we've updated `UpdateBaseValueFromAttribute()` instead.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_length.h
Line 148, Patchset 12: Member<const CSSParserContext> parser_context_;
Fredrik Söderquist . resolved

We shouldn't store this. This costs memory for all `SVGLength`.

Divyansh Mangal

I removed the variable but to pass the Parser Context while restricting to `SVGAnimatedLength` I have to duplicate the code from `UpdateBaseValueFromAttribute` into `SVGAnimatedLength::AttributeChanged` and change it accordingly. I am not very confident about this approach given this TODO there but let me know your thoughts on this.

```
// TODO: Use UpdateBaseValueFromAttribute() when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```
Fredrik Söderquist

You could probably also add the ability of passing a parameter-pack to `UpdateBaseValueFromAttribute`.

Divyansh Mangal

The parameter-pack suggestion did indeed help in reducing the duplicity, Do you think we should update the TODO as well because I am directly using `UpdateBaseValueFromAttribute` here? New TODO can be like

```
// TODO: Use correct validator when we can set proper initial
// values on error (for example 'auto' for 'rx' and 'ry').
```

Fredrik Söderquist

Yes, that sounds like a good update.

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
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: If7e69990c845642727e09c2956b07a8d78f0ebb4
    Gerrit-Change-Number: 7274991
    Gerrit-PatchSet: 17
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
    Gerrit-Comment-Date: Mon, 12 Jan 2026 13:21:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fredrik Söderquist (Gerrit)

    unread,
    Jan 12, 2026, 8:30:56 AM (2 days ago) Jan 12
    to Divyansh Mangal, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

    Fredrik Söderquist voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anders Hartvoll Ruud
    • Divyansh Mangal
    • Vinay Singh
    • Virali Purbey
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Comment-Date: Mon, 12 Jan 2026 13:30:41 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Blink W3C Test Autoroller (Gerrit)

    unread,
    Jan 12, 2026, 9:24:06 AM (2 days ago) Jan 12
    to Divyansh Mangal, Fredrik Söderquist, Olga Gerchikov, Menard, Alexis, AyeAye, Anders Hartvoll Ruud, Vinay Singh, Virali Purbey, Ragvesh Sharma, Dileep Maurya, Gaurav Kumar, Sejal Anand, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
    Attention needed from Anders Hartvoll Ruud, Divyansh Mangal, Vinay Singh and Virali Purbey

    Message from Blink W3C Test Autoroller

    Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/57125.

    When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

    WPT Export docs:
    https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

    Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Comment-Date: Mon, 12 Jan 2026 14:23:54 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages