Commit 869103e5 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Disable hyphenation when content language is not set

The spec changed to:
>  The UA must therefore only automatically hyphenate text for
which the content language is known and for which it has an
appropriate hyphenation resource.
https://drafts.csswg.org/css-text-3/#valdef-hyphens-auto

This patch matches the updated spec.

Bug: 676270
Change-Id: I79bd9c260bde8e744f1261af38b665e0ebc72500
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505692
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823045}
parent d9acd217
......@@ -1433,9 +1433,11 @@ AtomicString ComputedStyle::LocaleForLineBreakIterator() const {
}
Hyphenation* ComputedStyle::GetHyphenation() const {
return GetHyphens() == Hyphens::kAuto
? GetFontDescription().LocaleOrDefault().GetHyphenation()
: nullptr;
if (GetHyphens() != Hyphens::kAuto)
return nullptr;
if (const LayoutLocale* locale = GetFontDescription().Locale())
return locale->GetHyphenation();
return nullptr;
}
const AtomicString& ComputedStyle::HyphenString() const {
......
......@@ -1633,7 +1633,6 @@ crbug.com/1022182 virtual/module-top-level-await/external/wpt/html/webappapis/dy
crbug.com/1022182 virtual/module-top-level-await/external/wpt/html/webappapis/dynamic-markup-insertion/document-write/module-tla-import.html [ Pass ]
crbug.com/1022182 virtual/module-top-level-await/external/wpt/html/webappapis/dynamic-markup-insertion/document-write/module-tla-promise.html [ Pass ]
crbug.com/676270 external/wpt/css/css-text/hyphens/hyphens-auto-001.html [ Failure ]
crbug.com/1024331 external/wpt/css/css-text/hyphens/hyphens-out-of-flow-001.html [ Failure ]
crbug.com/1024331 external/wpt/css/css-text/hyphens/hyphens-out-of-flow-002.html [ Failure ]
crbug.com/1140728 external/wpt/css/css-text/hyphens/hyphens-span-002.html [ Failure ]
......
<!DOCTYPE html>
<html lang="en-us">
<script>
if (window.internals)
internals.setMockHyphenation('en-us');
......@@ -20,3 +21,4 @@ div {
<div class="hyphen">This is hyphenation enabled paragraph.</div>
<div>This is hyphen&shy;ation enabled paragraph.</div>
</div>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment