[SVG] Propagate user languages preferences to SVG images for systemLanguage support [chromium/src : main]

0 views
Skip to first unread message

Divyansh Mangal (Gerrit)

unread,
Feb 19, 2026, 12:33:01 PM (yesterday) Feb 19
to (Julie)Jeongeun Kim, Nate Chapin, Kevin Babbitt, Vinay Singh, Philip Rogers, Ian Kilpatrick, Virali Purbey, Ragvesh Sharma, Sejal Anand, Gaurav Kumar, Dileep Maurya, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revi...@chromium.org, josiah...@chromium.org, yuzo+...@chromium.org, lucasrada...@google.com, dtseng...@chromium.org, abigailbk...@google.com, kyungjunle...@google.com, loading...@chromium.org, blink-revie...@chromium.org, francisjp...@google.com, nektar...@chromium.org, gavinp...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Divyansh Mangal, Ian Kilpatrick, Philip Rogers and Vinay Singh

Message from Divyansh Mangal

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Ian Kilpatrick
  • Philip Rogers
  • Vinay Singh
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: I68b96c12b19f6e7994913efe381561824df1e89a
Gerrit-Change-Number: 7579553
Gerrit-PatchSet: 7
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:32:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 19, 2026, 12:37:07 PM (yesterday) Feb 19
to (Julie)Jeongeun Kim, Nate Chapin, Kevin Babbitt, Vinay Singh, Philip Rogers, Ian Kilpatrick, Virali Purbey, Ragvesh Sharma, Sejal Anand, Gaurav Kumar, Dileep Maurya, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revi...@chromium.org, josiah...@chromium.org, yuzo+...@chromium.org, lucasrada...@google.com, dtseng...@chromium.org, abigailbk...@google.com, kyungjunle...@google.com, loading...@chromium.org, blink-revie...@chromium.org, francisjp...@google.com, nektar...@chromium.org, gavinp...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Ian Kilpatrick, Philip Rogers and Vinay Singh

Divyansh Mangal added 5 comments

Commit Message
Line 7, Patchset 7 (Latest):[SVG] Propagate user languages preferences to SVG images for
systemLanguage support

When an SVG is loaded as an image, it runs inside an isolated page
with an `SVGImageChromeClient` that inherits from
`EmptyChromeClient`. `EmptyChromeClient::AcceptLanguages()` returns
an empty string, which causes `SVGTests::IsValid()` to never match
any `systemLanguage` value. This means <switch> elements with
`systemLanguage` always fall through to the fallback branch in image
contexts.

In this CL, we fix this issue by overriding `AcceptLanguages()` on
`SVGImageChromeClient` and propagating the user language preferences
in `SVGImage::DataChanged()`, similar to how font settings and color
maps are already copied.
Divyansh Mangal . unresolved

TODO: This description and title would need to be updated if we decided to go with the new approach as being discussed in
https://chromium-review.googlesource.com/c/chromium/src/+/7579553/comment/5483f2b5_0cd9089a/

File third_party/blink/renderer/core/svg/graphics/svg_image.cc
Line 702, Patchset 6: // attributes like systemLanguage work correctly in image contexts.
Philip Rogers . unresolved

There's code for invalidating system languages (WebViewImpl::AcceptLanguagesChanged). Is there a clean way to wire up invalidation for when the accept languages change? If not, can you just add a note of that in the comment?

Divyansh Mangal

Just like Font settings, accept languages is fixed inside and will not update if changed (unless Page is reloaded).

There is already a note in https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/graphics/svg_image.cc;drc=abdfdef6a8e6dfabec1ad3cdfc3f83a849d21319;l=691
and as per the changes in the latest patchset this should cover accept language as well.

(However, in the old patchet (patchset 6) such a comment would have to be explicitly added.).

Let me know if have any more questions.

File third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h
Line 102, Patchset 6: String accept_languages_;
Philip Rogers . unresolved

This feels out of place, but it may be the best place for this. Is it an option to move accept languages off of ChromeClient and onto Settings or Page? This is just a question rather than a request.

Divyansh Mangal

That's a great question @p...@chromium.org, it's definitely possible and in fact make sense to move accept languages off of `ChromeClient` onto `Settings`. `Settings` already stores per-page configuration, and accept languages is conceptually a preference/setting sourced from `RendererPreferences`. In fact, in the latest PatchSet, I have tried to do that, changes are mainly straightforward, instead of `ChromeClient` now `Settings` are used to update/refer Accept Languages.

I actually originally thought of doing this, but I was not sure adding in settings.json5 is acceptable as per the top description in https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/settings.json5;drc=b29d63222d10f4c7e620d057578d737969eb7ae3;l=2 ?

`Page` is also possible but less clean, `Page` doesn't typically own configuration data directly; it delegates to `Settings` for that.

Existing tests related to system language also passes in the latest PatchSet, but let me know your thoughts on this as well.

Line 74, Patchset 6: void SetAcceptLanguages(const String& accept_languages) {
Philip Rogers . unresolved

Should this work for a svg resource document? If so, can you move this to IsolatedSVGChromeClient and add a test of that?

Divyansh Mangal

For svg resource document, this issue doesn't occur as those documents seems to utilise the normal Page's settings itself unlike SVG Images.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/graphics/svg_image.cc;drc=abdfdef6a8e6dfabec1ad3cdfc3f83a849d21319;l=691

I also checked this manually with some svgs. (I utilised <use> element which referred an external document).

File third_party/blink/web_tests/svg/dom/systemLanguage-reflect-user-language-in-image.html
Line 1, Patchset 6:<!DOCTYPE HTML>
Philip Rogers . unresolved

Is it possible for this to be a WPT test? I see some code for setting accept-language for some variants of WPT tests (https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/tools/blinkpy/wpt_tests/product.py;l=174?q=wpt%20%22Accept-Language%22&ss=chromium%2Fchromium%2Fsrc&start=11#:~:text=173-,174,-175), so I wonder if this would work as a WPT test that assumes the en system language?

If not a WPT test, can this be put in wpt_internal/? We try to add all new tests in the WPT format. wpt_internal/ has access to the internals API. If this is very complicated, a regular wept test as you have here seems fine.

Divyansh Mangal

Thanks for the reference @p...@chromium.org, if the headless shell has such setup of accept language already then, yes it's possible to convert this test to a WPT one.
I have converted it to a WPT in the latest Patchset but let me know if more changes are needed.

(Earlier I mainly kept this in third_party/blink/web_tests/svg/dom/ cause all other related systemLanguage test for svg where there.)

Open in Gerrit

Related details

Attention is currently required from:
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:36:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Feb 19, 2026, 2:22:11 PM (23 hours ago) Feb 19
to Divyansh Mangal, (Julie)Jeongeun Kim, Nate Chapin, Kevin Babbitt, Vinay Singh, Ian Kilpatrick, Virali Purbey, Ragvesh Sharma, Sejal Anand, Gaurav Kumar, Dileep Maurya, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revi...@chromium.org, josiah...@chromium.org, yuzo+...@chromium.org, lucasrada...@google.com, dtseng...@chromium.org, abigailbk...@google.com, kyungjunle...@google.com, loading...@chromium.org, blink-revie...@chromium.org, francisjp...@google.com, nektar...@chromium.org, gavinp...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Divyansh Mangal, Ian Kilpatrick and Vinay Singh

Philip Rogers added 3 comments

File third_party/blink/renderer/core/exported/web_view_impl.cc
Line 738, Patchset 7 (Latest): GetPage()->GetSettings().SetAcceptLanguages(
Philip Rogers . unresolved

Optional: can we even go a little further and remove WebViewImpl::AcceptLanguagesChanged? This is called from WebViewImpl::UpdateRendererPreferences, but we can just set the blink setting directly there (see other code in the area). Rather than calling GetPage()->AcceptLanguagesChanged here, we can call it from Page::SettingsChanged, and make Page::AcceptLanguagesChanged private, and have the blink setting invalidate kAcceptLanguages. WDYT?

File third_party/blink/renderer/core/svg/graphics/svg_image_chrome_client.h
Line 102, Patchset 6: String accept_languages_;
Philip Rogers . unresolved

This feels out of place, but it may be the best place for this. Is it an option to move accept languages off of ChromeClient and onto Settings or Page? This is just a question rather than a request.

Divyansh Mangal

That's a great question @p...@chromium.org, it's definitely possible and in fact make sense to move accept languages off of `ChromeClient` onto `Settings`. `Settings` already stores per-page configuration, and accept languages is conceptually a preference/setting sourced from `RendererPreferences`. In fact, in the latest PatchSet, I have tried to do that, changes are mainly straightforward, instead of `ChromeClient` now `Settings` are used to update/refer Accept Languages.

I actually originally thought of doing this, but I was not sure adding in settings.json5 is acceptable as per the top description in https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/settings.json5;drc=b29d63222d10f4c7e620d057578d737969eb7ae3;l=2 ?

`Page` is also possible but less clean, `Page` doesn't typically own configuration data directly; it delegates to `Settings` for that.

Existing tests related to system language also passes in the latest PatchSet, but let me know your thoughts on this as well.

Philip Rogers

Thanks for looking into this. After seeing the patch, I agree that Settings is a bit of a mess, but ChromeClient is too, so on balance I think the settings approach is the way to go.

File third_party/blink/web_tests/svg/dom/systemLanguage-reflect-user-language-in-image.html
Line 1, Patchset 6:<!DOCTYPE HTML>
Philip Rogers . unresolved

Is it possible for this to be a WPT test? I see some code for setting accept-language for some variants of WPT tests (https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/tools/blinkpy/wpt_tests/product.py;l=174?q=wpt%20%22Accept-Language%22&ss=chromium%2Fchromium%2Fsrc&start=11#:~:text=173-,174,-175), so I wonder if this would work as a WPT test that assumes the en system language?

If not a WPT test, can this be put in wpt_internal/? We try to add all new tests in the WPT format. wpt_internal/ has access to the internals API. If this is very complicated, a regular wept test as you have here seems fine.

Divyansh Mangal

Thanks for the reference @p...@chromium.org, if the headless shell has such setup of accept language already then, yes it's possible to convert this test to a WPT one.
I have converted it to a WPT in the latest Patchset but let me know if more changes are needed.

(Earlier I mainly kept this in third_party/blink/web_tests/svg/dom/ cause all other related systemLanguage test for svg where there.)

Philip Rogers

I looked around the WPT infrastructure and I am not sure the approach of using "en" will work for other engines, or if it will cause issues for configurations not using "en". Sorry for having you move this and then move it again. Can you move this to wpt_internal/ and use `internals.settings.setAcceptLanguages("foo");`?

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Ian Kilpatrick
  • Vinay Singh
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 19:22:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Kilpatrick (Gerrit)

unread,
Feb 19, 2026, 5:14:16 PM (20 hours ago) Feb 19
to Divyansh Mangal, (Julie)Jeongeun Kim, Nate Chapin, Kevin Babbitt, Vinay Singh, Philip Rogers, Virali Purbey, Ragvesh Sharma, Sejal Anand, Gaurav Kumar, Dileep Maurya, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-revi...@chromium.org, josiah...@chromium.org, yuzo+...@chromium.org, lucasrada...@google.com, dtseng...@chromium.org, abigailbk...@google.com, kyungjunle...@google.com, loading...@chromium.org, blink-revie...@chromium.org, francisjp...@google.com, nektar...@chromium.org, gavinp...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, fmalit...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org
Attention needed from Divyansh Mangal and Vinay Singh

Ian Kilpatrick added 1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Ian Kilpatrick . resolved

pdr@ can handle this review.

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
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: I68b96c12b19f6e7994913efe381561824df1e89a
Gerrit-Change-Number: 7579553
Gerrit-PatchSet: 7
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-CC: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Thu, 19 Feb 2026 22:14:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages