Title: [106632] trunk
Revision
106632
Author
[email protected]
Date
2012-02-02 23:30:20 -0800 (Thu, 02 Feb 2012)

Log Message

Use content-language from http-equiv to set document locale and font
https://bugs.webkit.org/show_bug.cgi?id=76701

Patch by Matt Falkenhagen <[email protected]> on 2012-02-02
Reviewed by Darin Adler.

Source/WebCore:

So far, only content-language set through http-equiv is used; the HTTP Content-Language
header is not yet supported.

Tests: fast/text/content-language-case-insensitivity.html
       fast/text/content-language-mapped-to-webkit-locale.html
       fast/text/international/content-language-font-selection-expected.html
       fast/text/international/content-language-font-selection.html
       fast/text/international/content-language-with-subtags-expected.html
       fast/text/international/content-language-with-subtags.html

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::styleForDocument): Use content language when selecting initial font.
* dom/Document.cpp:
(WebCore::Document::setContentLanguage): Recalculate style so language is taken into account.
(WebCore):
* dom/Document.h:
(Document):

LayoutTests:

Add tests that content-language from http-equiv sets document locale and is used in font selection.

* fast/text/content-language-case-insensitivity-expected.txt: Added.
* fast/text/content-language-case-insensitivity.html: Added.
* fast/text/content-language-mapped-to-webkit-locale-expected.txt: Added.
* fast/text/content-language-mapped-to-webkit-locale.html: Added.
* fast/text/international/content-language-font-selection-expected.html: Added.
* fast/text/international/content-language-font-selection.html: Added.
* fast/text/international/content-language-with-subtags-expected.html: Added.
* fast/text/international/content-language-with-subtags.html: Added.
* fast/text/lang-mapped-to-webkit-locale-expected.txt:
* fast/text/lang-mapped-to-webkit-locale.xhtml: Fix some style issues.
* fast/text/xml-lang-ignored-in-html-expected.txt:
* fast/text/xml-lang-ignored-in-html.html: Fix some style issues.
* platform/efl/Skipped: Skip tests using overridePreference("WebKit*FontMap"...) on non-Chromium ports.
* platform/gtk-wk2/Skipped: Ditto.
* platform/gtk/Skipped: Ditto.
* platform/mac/Skipped: Ditto.
* platform/qt/Skipped: Ditto.
* platform/win/Skipped: Ditto.
* platform/wincairo/Skipped: Ditto.
* platform/wk2/Skipped: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106631 => 106632)


--- trunk/LayoutTests/ChangeLog	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/ChangeLog	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1,3 +1,33 @@
+2012-02-02  Matt Falkenhagen  <[email protected]>
+
+        Use content-language from http-equiv to set document locale and font
+        https://bugs.webkit.org/show_bug.cgi?id=76701
+
+        Reviewed by Darin Adler.
+
+        Add tests that content-language from http-equiv sets document locale and is used in font selection.
+
+        * fast/text/content-language-case-insensitivity-expected.txt: Added.
+        * fast/text/content-language-case-insensitivity.html: Added.
+        * fast/text/content-language-mapped-to-webkit-locale-expected.txt: Added.
+        * fast/text/content-language-mapped-to-webkit-locale.html: Added.
+        * fast/text/international/content-language-font-selection-expected.html: Added.
+        * fast/text/international/content-language-font-selection.html: Added.
+        * fast/text/international/content-language-with-subtags-expected.html: Added.
+        * fast/text/international/content-language-with-subtags.html: Added.
+        * fast/text/lang-mapped-to-webkit-locale-expected.txt:
+        * fast/text/lang-mapped-to-webkit-locale.xhtml: Fix some style issues.
+        * fast/text/xml-lang-ignored-in-html-expected.txt:
+        * fast/text/xml-lang-ignored-in-html.html: Fix some style issues.
+        * platform/efl/Skipped: Skip tests using overridePreference("WebKit*FontMap"...) on non-Chromium ports.
+        * platform/gtk-wk2/Skipped: Ditto.
+        * platform/gtk/Skipped: Ditto.
+        * platform/mac/Skipped: Ditto.
+        * platform/qt/Skipped: Ditto.
+        * platform/win/Skipped: Ditto.
+        * platform/wincairo/Skipped: Ditto.
+        * platform/wk2/Skipped: Ditto.
+
 2012-02-02  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening after r106554.

Added: trunk/LayoutTests/fast/text/content-language-case-insensitivity-expected.txt (0 => 106632)


--- trunk/LayoutTests/fast/text/content-language-case-insensitivity-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-case-insensitivity-expected.txt	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,7 @@
+Test for bug 76701: map content-language to -webkit-locale. This particular test tests that the matching of the http-equiv attribute to the content-language state is case insensitive.
+
+PASS languageOfNode('x1') is "ja-JP"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/text/content-language-case-insensitivity.html (0 => 106632)


--- trunk/LayoutTests/fast/text/content-language-case-insensitivity.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-case-insensitivity.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="cONtENT-LAnguAGE" content="ja-JP">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map content-language to -webkit-locale. This particular test tests that the
+matching of the http-equiv attribute to the content-language state is case
+insensitive.
+</p>
+<div id="console"></div>
+<div id="x1"/>
+<script>
+function languageOfNode(id) {
+    var element = document.getElementById(id);
+    return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x1')", "ja-JP");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale-expected.txt (0 => 106632)


--- trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale-expected.txt	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,8 @@
+Test for bug 76701: map content-language to -webkit-locale.
+
+PASS languageOfNode('x1') is "zh-CN"
+PASS languageOfNode('m1') is "ar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale.html (0 => 106632)


--- trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-mapped-to-webkit-locale.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="content-language" content="zh-CN">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map content-language to -webkit-locale.</p>
+<div id="console"></div>
+<div id="x1"/>
+<div lang="ar" id="m1"/>
+<script>
+function languageOfNode(id) {
+    var element = document.getElementById(id);
+    return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x1')", "zh-CN");
+shouldBeEqualToString("languageOfNode('m1')", "ar");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/content-language-font-selection-expected.html (0 => 106632)


--- trunk/LayoutTests/fast/text/international/content-language-font-selection-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/content-language-font-selection-expected.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Test font selection based on content-language</title>
+</head>
+<body style="font-family: 'Ahem'">
+This is in Ahem font.
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/content-language-font-selection.html (0 => 106632)


--- trunk/LayoutTests/fast/text/international/content-language-font-selection.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/content-language-font-selection.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-language" content="zh-TW">
+<script>
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitStandardFontMap", [ "Hant", "Ahem" ]);
+</script>
+<title>Test font selection based on content-language</title>
+</head>
+<body>
+<!-- This tests font selection based on content-language <https://bugs.webkit.org/show_bug.cgi?id=76701>. The text should be in Ahem font. -->
+This is in Ahem font.
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/content-language-with-subtags-expected.html (0 => 106632)


--- trunk/LayoutTests/fast/text/international/content-language-with-subtags-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/content-language-with-subtags-expected.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Test font selection based on content-language</title>
+</head>
+<body style="font-family: 'Ahem'">
+This is in Ahem font.
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/international/content-language-with-subtags.html (0 => 106632)


--- trunk/LayoutTests/fast/text/international/content-language-with-subtags.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/international/content-language-with-subtags.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-language" content="zh_tw_foobar">
+<script>
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitStandardFontMap", [ "Hant", "Ahem" ]);
+</script>
+<title>Test font selection based on content-language</title>
+</head>
+<body>
+<!-- This tests font selection based on content-language
+<https://bugs.webkit.org/show_bug.cgi?id=76701>, when content-language has
+extra subtags. The language "zh_tw_foobar" should match Han Traditional script,
+so the text should be in Ahem font. -->
+This is in Ahem font.
+</body>
+</html>

Modified: trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale-expected.txt (106631 => 106632)


--- trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale-expected.txt	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale-expected.txt	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1,28 +1,28 @@
 This is a test for bug 67586. HTML attributes lang and xml:lang are mapped to '-webkit-locale' to use their value in font fallback.
 
-PASS getLangOfNode('x1') is "ja"
-PASS getLangOfNode('x2') is "ja"
-PASS getLangOfNode('x3') is "ja"
-PASS getLangOfNode('l1') is "zh"
-PASS getLangOfNode('l2') is "zh"
-PASS getLangOfNode('l3') is "zh"
-PASS getLangOfNode('m1') is "ko"
-PASS getLangOfNode('m2') is "fr"
-PASS getLangOfNode('m3') is "fr"
-PASS getLangOfNode('n1') is "fr"
-PASS getLangOfNode('n2') is "fr"
-PASS getLangOfNode('n3') is "sv"
-PASS getLangOfNode('p1') is "ja"
-PASS getLangOfNode('p2') is "auto"
-PASS getLangOfNode('q1') is "ja"
-PASS getLangOfNode('q2') is "auto"
-PASS getLangOfNode('q3') is "auto"
-PASS getLangOfNode('q4') is "ar"
-PASS getLangOfNode('q5') is "auto"
-PASS getLangOfNode('q6') is "'  '"
-PASS getLangOfNode('q7') is "auto"
-PASS getLangOfNode('q8') is "xyzzy"
-PASS getLangOfNode('q9') is "'][;][['"
+PASS languageOfNode('x1') is "ja"
+PASS languageOfNode('x2') is "ja"
+PASS languageOfNode('x3') is "ja"
+PASS languageOfNode('l1') is "zh"
+PASS languageOfNode('l2') is "zh"
+PASS languageOfNode('l3') is "zh"
+PASS languageOfNode('m1') is "ko"
+PASS languageOfNode('m2') is "fr"
+PASS languageOfNode('m3') is "fr"
+PASS languageOfNode('n1') is "fr"
+PASS languageOfNode('n2') is "fr"
+PASS languageOfNode('n3') is "sv"
+PASS languageOfNode('p1') is "ja"
+PASS languageOfNode('p2') is "auto"
+PASS languageOfNode('q1') is "ja"
+PASS languageOfNode('q2') is "auto"
+PASS languageOfNode('q3') is "auto"
+PASS languageOfNode('q4') is "ar"
+PASS languageOfNode('q5') is "auto"
+PASS languageOfNode('q6') is "'  '"
+PASS languageOfNode('q7') is "auto"
+PASS languageOfNode('q8') is "xyzzy"
+PASS languageOfNode('q9') is "'][;][['"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale.xhtml (106631 => 106632)


--- trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale.xhtml	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/fast/text/lang-mapped-to-webkit-locale.xhtml	2012-02-03 07:30:20 UTC (rev 106632)
@@ -24,33 +24,33 @@
     <div lang="][;][[" id="q9"></div>
 </div>
 <script>
-function getLangOfNode(n) {
-    e = document.getElementById(n);
-    return window.getComputedStyle(e).webkitLocale;
+function languageOfNode(id) {
+    var element = document.getElementById(id);
+    return window.getComputedStyle(element).webkitLocale;
 }
-shouldBeEqualToString("getLangOfNode('x1')", "ja");
-shouldBeEqualToString("getLangOfNode('x2')", "ja");
-shouldBeEqualToString("getLangOfNode('x3')", "ja");
-shouldBeEqualToString("getLangOfNode('l1')", "zh");
-shouldBeEqualToString("getLangOfNode('l2')", "zh");
-shouldBeEqualToString("getLangOfNode('l3')", "zh");
-shouldBeEqualToString("getLangOfNode('m1')", "ko");
-shouldBeEqualToString("getLangOfNode('m2')", "fr");
-shouldBeEqualToString("getLangOfNode('m3')", "fr");
-shouldBeEqualToString("getLangOfNode('n1')", "fr");
-shouldBeEqualToString("getLangOfNode('n2')", "fr");
-shouldBeEqualToString("getLangOfNode('n3')", "sv");
-shouldBeEqualToString("getLangOfNode('p1')", "ja");
-shouldBeEqualToString("getLangOfNode('p2')", "auto");
-shouldBeEqualToString("getLangOfNode('q1')", "ja");
-shouldBeEqualToString("getLangOfNode('q2')", "auto");
-shouldBeEqualToString("getLangOfNode('q3')", "auto");
-shouldBeEqualToString("getLangOfNode('q4')", "ar");
-shouldBeEqualToString("getLangOfNode('q5')", "auto");
-shouldBeEqualToString("getLangOfNode('q6')", "'  '");
-shouldBeEqualToString("getLangOfNode('q7')", "auto");
-shouldBeEqualToString("getLangOfNode('q8')", "xyzzy");
-shouldBeEqualToString("getLangOfNode('q9')", "'][;][['");
+shouldBeEqualToString("languageOfNode('x1')", "ja");
+shouldBeEqualToString("languageOfNode('x2')", "ja");
+shouldBeEqualToString("languageOfNode('x3')", "ja");
+shouldBeEqualToString("languageOfNode('l1')", "zh");
+shouldBeEqualToString("languageOfNode('l2')", "zh");
+shouldBeEqualToString("languageOfNode('l3')", "zh");
+shouldBeEqualToString("languageOfNode('m1')", "ko");
+shouldBeEqualToString("languageOfNode('m2')", "fr");
+shouldBeEqualToString("languageOfNode('m3')", "fr");
+shouldBeEqualToString("languageOfNode('n1')", "fr");
+shouldBeEqualToString("languageOfNode('n2')", "fr");
+shouldBeEqualToString("languageOfNode('n3')", "sv");
+shouldBeEqualToString("languageOfNode('p1')", "ja");
+shouldBeEqualToString("languageOfNode('p2')", "auto");
+shouldBeEqualToString("languageOfNode('q1')", "ja");
+shouldBeEqualToString("languageOfNode('q2')", "auto");
+shouldBeEqualToString("languageOfNode('q3')", "auto");
+shouldBeEqualToString("languageOfNode('q4')", "ar");
+shouldBeEqualToString("languageOfNode('q5')", "auto");
+shouldBeEqualToString("languageOfNode('q6')", "'  '");
+shouldBeEqualToString("languageOfNode('q7')", "auto");
+shouldBeEqualToString("languageOfNode('q8')", "xyzzy");
+shouldBeEqualToString("languageOfNode('q9')", "'][;][['");
 
 var successfullyParsed = true;
 </script>

Modified: trunk/LayoutTests/fast/text/xml-lang-ignored-in-html-expected.txt (106631 => 106632)


--- trunk/LayoutTests/fast/text/xml-lang-ignored-in-html-expected.txt	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/fast/text/xml-lang-ignored-in-html-expected.txt	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1,9 +1,9 @@
 This tests that the attribute in no namespace with no prefix and with the literal localname "xml:lang" is ignored in HTML. See bug 67586.
 
-PASS getLangOfNode('m1') is "auto"
-PASS getLangOfNode('n1') is "ko"
-PASS getLangOfNode('o1') is "ar"
-PASS getLangOfNode('o2') is "ar"
+PASS languageOfNode('m1') is "auto"
+PASS languageOfNode('n1') is "ko"
+PASS languageOfNode('o1') is "ar"
+PASS languageOfNode('o2') is "ar"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/text/xml-lang-ignored-in-html.html (106631 => 106632)


--- trunk/LayoutTests/fast/text/xml-lang-ignored-in-html.html	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/fast/text/xml-lang-ignored-in-html.html	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1,24 +1,24 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<link rel="stylesheet" href="" />
+<link rel="stylesheet" href=""
 <script src=""
 </head>
 <body>
 <p>This tests that the attribute in no namespace with no prefix and with the literal localname "xml:lang" is ignored in HTML. See
 <a href="" 67586</a>.</p>
 <div id="console"></div>
-<div xml:lang="ar" id="m1"></div></div>
+<div xml:lang="ar" id="m1"></div>
 <div lang="ko"><div xml:lang="ar" id="n1"></div></div>
 <div lang="ar" id="o1"><div xml:lang="" id="o2"></div></div>
 <script>
-function getLangOfNode(n) {
-    e = document.getElementById(n);
-    return window.getComputedStyle(e).webkitLocale;
+function languageOfNode(id) {
+    var element = document.getElementById(id);
+    return window.getComputedStyle(element).webkitLocale;
 }
-shouldBeEqualToString("getLangOfNode('m1')", "auto");
-shouldBeEqualToString("getLangOfNode('n1')", "ko");
-shouldBeEqualToString("getLangOfNode('o1')", "ar");
-shouldBeEqualToString("getLangOfNode('o2')", "ar");
+shouldBeEqualToString("languageOfNode('m1')", "auto");
+shouldBeEqualToString("languageOfNode('n1')", "ko");
+shouldBeEqualToString("languageOfNode('o1')", "ar");
+shouldBeEqualToString("languageOfNode('o2')", "ar");
 
 var successfullyParsed = true;
 </script>

Modified: trunk/LayoutTests/platform/efl/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/efl/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -718,6 +718,8 @@
 fast/parser/pre-html5-parser-quirks.html
 fast/repaint/no-caret-repaint-in-non-content-editable-element.html
 fast/spatial-navigation
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 fast/text/zero-font-size.html
 fast/viewport/viewport-128.html

Modified: trunk/LayoutTests/platform/gtk/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/gtk/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/gtk/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -374,6 +374,8 @@
 
 # layoutTestController.overridePreference("WebKit*FontMap"...) is not
 # supported.
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 
 # Needs layoutTestController.enableAutoResizeMode()

Modified: trunk/LayoutTests/platform/gtk-wk2/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/gtk-wk2/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/gtk-wk2/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -208,6 +208,8 @@
 
 # WebKit2 needs layoutTestController.overridePreference
 # https://bugs.webkit.org/show_bug.cgi?id=42197
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 fast/repaint/no-caret-repaint-in-non-content-editable-element.html
 editing/selection/caret-mode-paragraph-keys-navigation.html

Modified: trunk/LayoutTests/platform/mac/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/mac/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/mac/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -493,6 +493,8 @@
 fast/repaint/table-extra-bottom-grow.html
 
 # DRT doesn't support overridePreference("WebKit*FontMap"...)
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 
 # Web Intents is not yet enabled.

Modified: trunk/LayoutTests/platform/qt/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/qt/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -994,6 +994,8 @@
 
 # Missing DRT ability to override 'standard' preferences.
 fast/dom/Window/timer-resume-on-navigation-back.html
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 loader/go-back-to-different-window-size.html
 

Modified: trunk/LayoutTests/platform/win/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/win/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/win/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1502,6 +1502,8 @@
 fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
 
 # DRT doesn't support overridePreference("WebKit*FontMap"...)
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 
 # Web Intents is not yet enabled.

Modified: trunk/LayoutTests/platform/wincairo/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/wincairo/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/wincairo/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -2026,6 +2026,8 @@
 fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
 
 # DRT doesn't support overridePreference("WebKit*FontMap"...)
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 
 # Web Intents is not yet enabled.

Modified: trunk/LayoutTests/platform/wk2/Skipped (106631 => 106632)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-02-03 07:30:20 UTC (rev 106632)
@@ -290,6 +290,8 @@
 fast/images/animated-gif-restored-from-bfcache.html
 fast/repaint/no-caret-repaint-in-non-content-editable-element.html
 fast/text/zero-font-size.html
+fast/text/international/content-language-font-selection.html
+fast/text/international/content-language-with-subtags.html
 fast/text/international/locale-sensitive-fonts.html
 css3/filters/effect-combined.html
 css3/filters/filter-repaint.html

Modified: trunk/Source/WebCore/ChangeLog (106631 => 106632)


--- trunk/Source/WebCore/ChangeLog	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/Source/WebCore/ChangeLog	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1,3 +1,28 @@
+2012-02-02  Matt Falkenhagen  <[email protected]>
+
+        Use content-language from http-equiv to set document locale and font
+        https://bugs.webkit.org/show_bug.cgi?id=76701
+
+        Reviewed by Darin Adler.
+
+        So far, only content-language set through http-equiv is used; the HTTP Content-Language
+        header is not yet supported.
+
+        Tests: fast/text/content-language-case-insensitivity.html
+               fast/text/content-language-mapped-to-webkit-locale.html
+               fast/text/international/content-language-font-selection-expected.html
+               fast/text/international/content-language-font-selection.html
+               fast/text/international/content-language-with-subtags-expected.html
+               fast/text/international/content-language-with-subtags.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForDocument): Use content language when selecting initial font.
+        * dom/Document.cpp:
+        (WebCore::Document::setContentLanguage): Recalculate style so language is taken into account.
+        (WebCore):
+        * dom/Document.h:
+        (Document):
+
 2012-02-02  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r106620.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (106631 => 106632)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1403,6 +1403,7 @@
     documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
     documentStyle->setPageScaleTransform(frame ? frame->frameScaleFactor() : 1);
     documentStyle->setUserModify(document->inDesignMode() ? READ_WRITE : READ_ONLY);
+    documentStyle->setLocale(document->contentLanguage());
 
     Element* docElement = document->documentElement();
     RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
@@ -1433,12 +1434,13 @@
 
     FontDescription fontDescription;
     fontDescription.setUsePrinterFont(document->printing());
+    fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));
     if (Settings* settings = document->settings()) {
         fontDescription.setRenderingMode(settings->fontRenderingMode());
-        const AtomicString& stdfont = settings->standardFontFamily();
-        if (!stdfont.isEmpty()) {
+        const AtomicString& standardFont = settings->standardFontFamily(fontDescription.script());
+        if (!standardFont.isEmpty()) {
             fontDescription.setGenericFamily(FontDescription::StandardFamily);
-            fontDescription.firstFamily().setFamily(stdfont);
+            fontDescription.firstFamily().setFamily(standardFont);
             fontDescription.firstFamily().appendFamily(0);
         }
         fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);

Modified: trunk/Source/WebCore/dom/Document.cpp (106631 => 106632)


--- trunk/Source/WebCore/dom/Document.cpp	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-02-03 07:30:20 UTC (rev 106632)
@@ -1102,6 +1102,16 @@
     decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
 }
 
+void Document::setContentLanguage(const String& language)
+{
+    if (m_contentLanguage == language)
+        return;
+    m_contentLanguage = language;
+
+    // Recalculate style so language is used when selecting the initial font.
+    styleSelectorChanged(DeferRecalcStyle);
+}
+
 void Document::setXMLVersion(const String& version, ExceptionCode& ec)
 {
     if (!implementation()->hasFeature("XML", String())) {

Modified: trunk/Source/WebCore/dom/Document.h (106631 => 106632)


--- trunk/Source/WebCore/dom/Document.h	2012-02-03 07:12:45 UTC (rev 106631)
+++ trunk/Source/WebCore/dom/Document.h	2012-02-03 07:30:20 UTC (rev 106632)
@@ -387,7 +387,7 @@
     String suggestedMIMEType() const;
 
     String contentLanguage() const { return m_contentLanguage; }
-    void setContentLanguage(const String& lang) { m_contentLanguage = lang; }
+    void setContentLanguage(const String&);
 
     String xmlEncoding() const { return m_xmlEncoding; }
     String xmlVersion() const { return m_xmlVersion; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to