Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bcfac781bec780c78e7ef90f71293d8792a1d517
https://github.com/WebKit/WebKit/commit/bcfac781bec780c78e7ef90f71293d8792a1d517
Author: Karl Dubost <[email protected]>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/svg/struct/systemLanguage-matching-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/svg/struct/systemLanguage-matching.html
A LayoutTests/svg/dom/systemLanguage-matching-expected.txt
A LayoutTests/svg/dom/systemLanguage-matching.html
M Source/WebCore/svg/SVGTests.cpp
Log Message:
-----------
SVGTests::isValid() does not correctly implement systemLanguage matching per
SVG2
https://bugs.webkit.org/show_bug.cgi?id=262140
rdar://116424326
Reviewed by Nikolas Zimmermann and Anne van Kesteren.
SVGTests::isValid() did not correctly implement the systemLanguage
matching algorithm defined in SVG2 5.6.5 and RFC 4647 3.3.1 (Basic
Filtering). It had four bugs:
1. Required ALL listed tags to match (should be: true if ANY
user preference matches ANY listed tag).
2. Truncated the user language to 2 characters, losing script
and region subtags (e.g. "zh-Hans" became "zh").
3. Used case-sensitive comparison.
4. Did not implement BCP 47 prefix matching (user "en" should
match listed "en-US").
The fix replaces the broken loop with two static helpers
matchesLanguageTag() implementing RFC 4647 Basic Filtering,
and userLanguageMatchesAnyListedTag() synthesizing parent language tags
by iterative subtag stripping and iterates over userPreferredLanguages()
instead of truncating defaultLanguage().
BUT in a way that preserve the privacy of the end users. This is the way
WebKit is architectured. The code deviates from the specification on
purpose.
Tests: imported/w3c/web-platform-tests/svg/struct/systemLanguage-matching.html
svg/dom/systemLanguage-matching.html
*
LayoutTests/imported/w3c/web-platform-tests/svg/struct/systemLanguage-matching-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/svg/struct/systemLanguage-matching.html:
Added.
* LayoutTests/svg/dom/systemLanguage-matching-expected.txt: Added.
* LayoutTests/svg/dom/systemLanguage-matching.html: Added.
* Source/WebCore/svg/SVGTests.cpp:
(WebCore::matchesLanguageTag):
(WebCore::userLanguageMatchesAnyListedTag):
(WebCore::SVGTests::isValid const):
Canonical link: https://commits.webkit.org/315952@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications