Diff
Modified: trunk/LayoutTests/ChangeLog (107199 => 107200)
--- trunk/LayoutTests/ChangeLog 2012-02-09 09:46:17 UTC (rev 107199)
+++ trunk/LayoutTests/ChangeLog 2012-02-09 09:50:06 UTC (rev 107200)
@@ -1,3 +1,24 @@
+2012-02-09 Matt Falkenhagen <[email protected]>
+
+ Improve http-equiv content-language parsing
+ https://bugs.webkit.org/show_bug.cgi?id=77724
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add tests for mapping http-equiv content-language to -webkit-locale to cover dynamic changes to the meta
+ element and a comma-separated list of languages. The desired behavior of some of these is not yet decided, so
+ some of the tests currently fail and the expectations may change. See comments in bug and in the tests.
+
+ * fast/text/content-language-comma-separated-list-expected.txt: Added.
+ * fast/text/content-language-comma-separated-list.html: Added.
+ * fast/text/content-language-dynamically-added-expected.txt: Added.
+ * fast/text/content-language-dynamically-added.html: Added.
+ * fast/text/content-language-dynamically-changed-expected.txt: Added.
+ * fast/text/content-language-dynamically-changed.html: Added.
+ * fast/text/content-language-dynamically-removed-expected.txt: Added.
+ * fast/text/content-language-dynamically-removed.html: Added.
+ * fast/text/content-language-multiple.html: Fix to actually test http-equiv content-language.
+
2012-02-09 Pavel Podivilov <[email protected]>
Unreviewed, gardening, remove stale chromium expectations for synthetic-bold-transformed.
Added: trunk/LayoutTests/fast/text/content-language-comma-separated-list-expected.txt (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-comma-separated-list-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-comma-separated-list-expected.txt 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,8 @@
+Test for bug 76701: map HTTP-EQUIV content-language to -webkit-locale. This particular test tests that a comma-separated list of languages is ignored. This expectation may change, see bug. The HTML5 spec says that content-language should not have multiple languages, and decrees that a content-language containing a comma be ignored; this position has been upheld following significant debate. Firefox accepts a comma-separated list and a CSS :lang selector for any language in the list is matched. It's unclear what IE does.
+
+FAIL languageOfNode('x') should be auto. Was 'ja, zh_CN'.
+PASS languageOfNode('y') is "ar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: trunk/LayoutTests/fast/text/content-language-comma-separated-list.html (from rev 107199, trunk/LayoutTests/fast/text/content-language-multiple.html) (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-comma-separated-list.html (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-comma-separated-list.html 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-language" content="ja, zh_CN">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map HTTP-EQUIV content-language to -webkit-locale. This particular test tests
+that a comma-separated list of languages is ignored. This expectation may
+change, see bug. The HTML5 spec says that content-language should not have
+multiple languages, and decrees that a content-language containing a comma be
+ignored; this <a
+href="" has
+been upheld</a> following significant debate. Firefox accepts a
+comma-separated list and a CSS :lang selector for any language in the list is
+matched. It's unclear what IE does.
+</p>
+<div id="console"></div>
+<div id="x"></div>
+<div id="y" lang="ar"></div>
+<script>
+function languageOfNode(id) {
+ var element = document.getElementById(id);
+ return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x')", "auto");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/content-language-dynamically-added-expected.txt (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-added-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-added-expected.txt 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,10 @@
+Test for bug 76701: map http-equiv content-language to -webkit-locale. This particular test tests that a dynamically added content-language is processed. This expectation may change, see bug. The HTML 5 spec decrees that http-equiv content-language be processed when it is inserted into the document. In Firefox and IE adding the meta element dynamically doesn't seem to affect the page, but in Firefox the meta content-language displayed in "Page Information" is affected.
+
+PASS languageOfNode('x') is "auto"
+PASS languageOfNode('y') is "ar"
+PASS languageOfNode('x') is "ja"
+PASS languageOfNode('y') is "ar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/text/content-language-dynamically-added.html (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-added.html (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-added.html 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head id="head">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map http-equiv content-language to -webkit-locale. This particular test tests
+that a dynamically added content-language is processed. This expectation may
+change, see bug. The HTML 5 spec decrees that http-equiv content-language be
+processed when it is
+<a href="" into the document</a>.
+In Firefox and IE adding the meta element dynamically doesn't seem to affect
+the page, but in Firefox the meta content-language displayed in "Page
+Information" is affected.
+</p>
+<div id="console"></div>
+<div id="x"></div>
+<div id="y" lang="ar"></div>
+<script>
+function languageOfNode(id) {
+ var element = document.getElementById(id);
+ return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x')", "auto");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+
+var meta = document.createElement("meta");
+meta.httpEquiv = "content-language";
+meta.content = "ja";
+document.getElementById("head").appendChild(meta);
+shouldBeEqualToString("languageOfNode('x')", "ja");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/content-language-dynamically-changed-expected.txt (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-changed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-changed-expected.txt 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,14 @@
+Test for bug 76701: map http-equiv content-language to -webkit-locale. This particular test tests that dynamic changes to the meta element have no effect. This expectation may change, see bug. The HTML 5 spec decrees that the pragma-set default language be set only when the meta element is inserted into the document. In Firefox and IE changing the element dynamically doesn't seem to affect the page, but in Firefox the meta content-language displayed in "Page Information" is affected.
+
+PASS languageOfNode('x') is "zh"
+PASS languageOfNode('y') is "ar"
+FAIL languageOfNode('x') should be zh. Was ja.
+PASS languageOfNode('y') is "ar"
+FAIL languageOfNode('x') should be zh. Was ja.
+PASS languageOfNode('y') is "ar"
+FAIL languageOfNode('x') should be zh. Was ja.
+PASS languageOfNode('y') is "ar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/text/content-language-dynamically-changed.html (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-changed.html (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-changed.html 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta id="target" http-equiv="content-language" content="zh">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map http-equiv content-language to -webkit-locale. This particular test tests
+that dynamic changes to the meta element have no effect. This expectation may
+change, see bug. The HTML 5 spec decrees that the pragma-set default language
+be set only when the meta element is
+<a href="" into the document</a>.
+In Firefox and IE changing the element dynamically doesn't seem to affect the
+page, but in Firefox the meta content-language displayed in "Page Information"
+is affected.
+</p>
+<div id="console"></div>
+<div id="x"></div>
+<div id="y" lang="ar"></div>
+<script>
+function languageOfNode(id) {
+ var element = document.getElementById(id);
+ return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+
+var meta = document.getElementById("target");
+meta.content = "ja";
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+
+meta.httpEquiv = "foobar";
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+
+meta.httpEquiv = "content-language";
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/content-language-dynamically-removed-expected.txt (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-removed-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-removed-expected.txt 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,10 @@
+Test for bug 76701: map http-equiv content-language to -webkit-locale. This particular test tests that dynamically removing the meta element has no effect. This expectation may change, see bug. The HTML 5 spec decrees that the pragma-set default language be changed only when the meta element is inserted into the document. In Firefox and IE removing the meta element doesn't seem to affect the page, but in Firefox the meta content-language displayed in "Page Information" is affected.
+
+PASS languageOfNode('x') is "zh"
+PASS languageOfNode('y') is "ar"
+PASS languageOfNode('x') is "zh"
+PASS languageOfNode('y') is "ar"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/text/content-language-dynamically-removed.html (0 => 107200)
--- trunk/LayoutTests/fast/text/content-language-dynamically-removed.html (rev 0)
+++ trunk/LayoutTests/fast/text/content-language-dynamically-removed.html 2012-02-09 09:50:06 UTC (rev 107200)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta id="target" http-equiv="content-language" content="zh">
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Test for <a href="" 76701</a>:
+map http-equiv content-language to -webkit-locale. This particular test tests
+that dynamically removing the meta element has no effect. This
+expectation may change, see bug. The HTML 5 spec decrees that the
+pragma-set default language be changed only when the meta element is
+<a href="" into the document</a>.
+In Firefox and IE removing the meta element doesn't seem to affect the page,
+but in Firefox the meta content-language displayed in "Page Information" is
+affected.
+</p>
+<div id="console"></div>
+<div id="x"></div>
+<div id="y" lang="ar"></div>
+<script>
+function languageOfNode(id) {
+ var element = document.getElementById(id);
+ return window.getComputedStyle(element).webkitLocale;
+}
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+
+var meta = document.getElementById("target");
+var parent = meta.parentNode;
+meta.parentNode.removeChild(meta);
+shouldBeEqualToString("languageOfNode('x')", "zh");
+shouldBeEqualToString("languageOfNode('y')", "ar");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/text/content-language-multiple.html (107199 => 107200)
--- trunk/LayoutTests/fast/text/content-language-multiple.html 2012-02-09 09:46:17 UTC (rev 107199)
+++ trunk/LayoutTests/fast/text/content-language-multiple.html 2012-02-09 09:50:06 UTC (rev 107200)
@@ -16,7 +16,7 @@
Firefox and IE seem to use the final one.
</p>
<div id="console"></div>
-<div id="x" lang="zh_CN"></div>
+<div id="x"></div>
<div id="y" lang="ar"></div>
<script>
function languageOfNode(id) {