Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / style-scoped / style-scoped-nested.html
index 4b047ed..0eb8b59 100644 (file)
@@ -41,5 +41,22 @@ styleForParent.innerHTML = "span { color: blue; }";
 document.getElementById("parent").appendChild(styleForParent);
 debug("A new scoped style is inserted into the parent node of the target. A tag rule in the inserted scoped style wins an id rule and a class rule in existing styles.");
 shouldBe("window.getComputedStyle(target).color", '"rgb(0, 0, 255)"');
+
+var shadowRoot = target.createShadowRoot();
+shadowRoot.innerHTML = '<span id="targetInShadow" class="target"></span>';
+var targetInShadow = shadowRoot.getElementById("targetInShadow");
+shadowRoot.applyAuthorStyles = true;
+// Disable style-inheritance from its shadow host to check whether rules match
+// the span in the shadow tree or not.
+shadowRoot.resetStyleInheritance = true;
+debug("Test a span in some shadow dom tree. Since the span's host node is the above target, we have to see all inserted scoped styles and an author style to find whether the styles have any matched rules or not.");
+shouldBe("window.getComputedStyle(targetInShadow).color", '"rgb(0, 0, 255)"');
+
+var styleInShadow = document.createElement("style");
+styleInShadow.innerHTML = "span { color: lime; }";
+shadowRoot.appendChild(styleInShadow);
+debug("Append a new style element to the shadow root. The style's scoping element is the shadow root. Rules in the style should override other rules in ascendant (scoped) styles.");
+shouldBe("window.getComputedStyle(targetInShadow).color", '"rgb(0, 255, 0)"');
+
 </script>
 </html>