New issue
Advanced search Search tips

Issue 872378 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Aug 30
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

systemLanguage does not do prefix match

Reported by glroyla...@gmail.com, Aug 8

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36

Steps to reproduce the problem:
1. https://jsfiddle.net/mqt58n0u/42/
2. Note that line 4 says failure for en or en-us browser
3. 

What is the expected behavior?
Chrome should implement systemLanguage matching consistent with BCP 47's basic filter operation and as specfied in SVG 1.1 spec
https://www.w3.org/TR/SVG/struct.html#ConditionalProcessingSystemLanguageAttribute

If the browser language preference is "en" or "en-us", then the matching algorithm should match "en-us-kumquat" by matching the prefix (either "en" or "en-us") followed by a hyphen.

Consequently, the test case should display a green "4. success".

What went wrong?
The systemLanguage matching did not follow the spec, so the default line "4. Failure: no prefix match" displayed.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 68.0.3440.84  Channel: stable
OS Version: 10.0
Flash Version: 

Test works in Edge and Firefox.
 
Labels: Needs-Triage-M68
Labels: Triaged-ET Target-70 M-70 FoundIn-70 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Mac 10.13.3, Win-10 and Ubuntu 17.10 using chrome reported version #68.0.3440.84 and latest canary #70.0.3516.0.
This is a non-regression issue as it is observed from M60 old builds. 

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!
Status: Available (was: Untriaged)
An external contributor is working on this. I'll add an owner once we confirm contributor status.
bool SVGTests::IsValid() 

https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/svg/svg_tests.cc?type=cs&sq=package:chromium&g=0&l=56

requires the systemLanguage langtag (ie, value) to be exactly 2 characters long (so any langtag such as en-US is ignored) and then does the prefix match backward (value is tested as a prefix of user preference rather than user preference is a prefix of value).
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59

commit 1f24b02c1e563e405a59d5d44eeb03a6f2c00d59
Author: Fredrik Söderquist <fs@opera.com>
Date: Thu Aug 30 15:29:57 2018

Fix SVG systemLanguage conditional processing

The algorithm that performs the test between browser language preference
and the systemLanguage value has been modified
to implement a language-tag match based on the prefix,
making it consistent with BCP 47's basic filter operation and
as specified in the SVG 1.1 spec.

The previous behavior was:

- Tests whether the value of the attribute (e.g., "en-us") is a prefix
of the user preferred language (e.g., "en")
(which would evaluate to false)

The test was modified to compare in the opposite manner,
now user preferred language must be a prefix of the value.

- If the language tag length was not 2, the language tag
was not matched, (e.g. It did not match "en-us" to "en-us").
This check has been removed.

- The algorithm did not check for a trailing hyphen ("-").
We do not want langtag "it" matching langtag "ita",
but it is ok for "it" to match "it-it".
Now it does.

------------

The algorithm that performs the test between browser language preference
and the systemLanguage value has been modified
to implement a case insensitive language-tag match:

"en" matches "EN".

The previous behavior was case sensitive.

------------

Add Luca Di Domenico to AUTHORS

------------

Bug:  872378 ,  869440 
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ibe767644b5a92e8d79ffe4b7777f5f51851b3883
Reviewed-on: https://chromium-review.googlesource.com/1188314
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#587592}
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/AUTHORS
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/linux/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/linux/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/win/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/win/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt
[add] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/svg/dom/systemLanguage-case-insensitive.html
[add] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/svg/dom/systemLanguage-langtag-match-prefix.html
[modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/blink/renderer/core/svg/svg_tests.cc

Status: Fixed (was: Available)

Comment 7 Deleted

If lang_tag.length() < language.length() then lang_tag does not start with language, and StartsWith... returns false, so lang_tag.length() >= language.length() at that point in time.
Yes, I already realized that and deleted the comment.

Sign in to add a comment