Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: LayoutTests/fast/dom/shadow/attr-lang-inherit.html

Issue 878743003: Use the tree of trees for the lang attributes in Shadow DOM (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/shadow/attr-lang-inherit.html
diff --git a/LayoutTests/fast/dom/shadow/attr-lang-inherit.html b/LayoutTests/fast/dom/shadow/attr-lang-inherit.html
new file mode 100644
index 0000000000000000000000000000000000000000..773e5f3f9194d601e4122194164e130f489e2ecb
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/attr-lang-inherit.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+#container > div {
+ border: green solid thin;
+}
+:lang(fr) { background:blue; color:white; }
+:lang(ja) { background:green; color:white; }
+</style>
+<div id="container" lang="ja">
+ <div id="normal"></div>
+ <div id="distributed"><div>Distributed</div></div>
+</div>
+<script>
+setup({ explicit_done: true });
+var fr = "rgb(0, 0, 255)";
+var ja = "rgb(0, 128, 0)";
+var style = "<style>:lang(fr) { background:blue; color:white; } :lang(ja) { background:green; color:white; }</style>";
+
+testLangInShadow("lang inherits into shadow tree",
+ document.getElementById("normal"),
+ style + "<div lang='fr'>French</div><div>Inherit</div>",
+ [[function (root) { return root.lastChild.previousSibling; }, fr],
hayato 2015/01/28 09:56:12 You can use shadowRoot.querySelector(..) to get th
kojii 2015/01/29 11:05:24 Done.
+ [function (root) { return root.lastChild; }, ja]]);
+
+testLangInShadow("lang of distributed content traverses tree of trees recursively",
hayato 2015/01/28 09:56:12 "Recursively" is misleading because this test only
kojii 2015/01/29 11:05:24 Added: - Multiple shadow roots to one host - Multi
+ document.getElementById("distributed"),
+ style + "<div lang='fr'><div>French</div><content></content></div>",
+ [[function (root) { return root.lastChild.firstChild; }, fr],
+ [function (root) { return root.host.firstChild; }, ja]]);
+
+function testLangInShadow(description, host, shadowHtml, elementAndExpectedList) {
+ var root = host.createShadowRoot();
+ root.innerHTML = shadowHtml;
+ test(function () {
+ elementAndExpectedList.forEach(function (elementAndExpected) {
+ var element = elementAndExpected[0];
+ if (typeof(element) === "function")
hayato 2015/01/28 09:56:12 In this test, elementAndExpected[0] is always a fu
kojii 2015/01/29 11:05:23 Done.
+ element = element(root);
+ var actual = getComputedStyle(element).backgroundColor;
+ assert_equals(actual, elementAndExpected[1]);
+ });
+ }, description);
+}
+
+if (window.testRunner)
+ container.style.display = "none";
+done();
+</script>
« no previous file with comments | « no previous file | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698