Title: [144031] trunk
- Revision
- 144031
- Author
- [email protected]
- Date
- 2013-02-26 02:51:58 -0800 (Tue, 26 Feb 2013)
Log Message
Shadow DOM styles appear to be over-eagerly shared
https://bugs.webkit.org/show_bug.cgi?id=110797
Reviewed by Dimitri Glazkov.
Source/WebCore:
A style of a distributed node should not be shared, because the node
might be affected by styles in a shadow dom tree, i.e. :distributed
or something.
Test: fast/dom/shadow/no-style-sharing-with-distributed-nodes.html
* css/StyleResolver.cpp:
(WebCore::StyleResolver::locateCousinList):
Skip shadow hosts, because children of shadow hosts are distributed
nodes and cannot share their styles.
LayoutTests:
* fast/dom/shadow/no-style-sharing-with-distributed-nodes-expected.html: Added.
* fast/dom/shadow/no-style-sharing-with-distributed-nodes.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (144030 => 144031)
--- trunk/LayoutTests/ChangeLog 2013-02-26 10:40:12 UTC (rev 144030)
+++ trunk/LayoutTests/ChangeLog 2013-02-26 10:51:58 UTC (rev 144031)
@@ -1,3 +1,13 @@
+2013-02-26 Takashi Sakamoto <[email protected]>
+
+ Shadow DOM styles appear to be over-eagerly shared
+ https://bugs.webkit.org/show_bug.cgi?id=110797
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/no-style-sharing-with-distributed-nodes-expected.html: Added.
+ * fast/dom/shadow/no-style-sharing-with-distributed-nodes.html: Added.
+
2013-02-26 Ádám Kallai <[email protected]>
[Qt] Unreviewed gardening. Update platform specific expected file after r143836.
Added: trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes-expected.html (0 => 144031)
--- trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes-expected.html 2013-02-26 10:51:58 UTC (rev 144031)
@@ -0,0 +1,34 @@
+<!doctype html>
+<html>
+<head>
+<style>
+.container {
+ border:1px solid black;
+}
+.container>.number {
+ color:red;
+}
+.container>.letters {
+ color:blue;
+}
+</style>
+</head>
+<body>
+<div id="test1">
+ <div class="number">1</div>
+ <div class="letters">QUX</div>
+</div>
+
+<div id="test2">
+ <div class="container">
+ <div class="number"><div class="number">2</div></div>
+ <div class="letters"><div class="letters">FOO</div></div>
+ </div>
+</div>
+
+<div id="test3">
+ <div class="number">3</div>
+ <div class="letters">BAR</div>
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes.html (0 => 144031)
--- trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/no-style-sharing-with-distributed-nodes.html 2013-02-26 10:51:58 UTC (rev 144031)
@@ -0,0 +1,46 @@
+<!doctype html>
+<html>
+<head>
+<script>
+function runTest() {
+ var shadow = document.querySelector('#test2').webkitCreateShadowRoot();
+ var template = document.querySelector('template');
+ shadow.appendChild(template.content);
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<template>
+ <style>
+ .container {
+ border:1px solid black;
+ }
+ .container>.number {
+ color:red;
+ }
+ .container>.letters {
+ color:blue;
+ }
+ </style>
+ <div class="container">
+ <div class="number"><content select=".number"></content></div>
+ <div class="letters"><content select=".letters"></content></div>
+ </div>
+</template>
+
+<div id="test1">
+ <div class="number">1</div>
+ <div class="letters">QUX</div>
+</div>
+
+<div id="test2">
+ <div class="number">2</div>
+ <div class="letters">FOO</div>
+</div>
+
+<div id="test3">
+ <div class="number">3</div>
+ <div class="letters">BAR</div>
+</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (144030 => 144031)
--- trunk/Source/WebCore/ChangeLog 2013-02-26 10:40:12 UTC (rev 144030)
+++ trunk/Source/WebCore/ChangeLog 2013-02-26 10:51:58 UTC (rev 144031)
@@ -1,3 +1,21 @@
+2013-02-26 Takashi Sakamoto <[email protected]>
+
+ Shadow DOM styles appear to be over-eagerly shared
+ https://bugs.webkit.org/show_bug.cgi?id=110797
+
+ Reviewed by Dimitri Glazkov.
+
+ A style of a distributed node should not be shared, because the node
+ might be affected by styles in a shadow dom tree, i.e. :distributed
+ or something.
+
+ Test: fast/dom/shadow/no-style-sharing-with-distributed-nodes.html
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::locateCousinList):
+ Skip shadow hosts, because children of shadow hosts are distributed
+ nodes and cannot share their styles.
+
2013-02-26 Adam Klein <[email protected]>
Remove unused conditional includes of {MathML,SVG}Names.h
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (144030 => 144031)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2013-02-26 10:40:12 UTC (rev 144030)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2013-02-26 10:51:58 UTC (rev 144031)
@@ -875,7 +875,11 @@
while (currentNode) {
++subcount;
if (currentNode->renderStyle() == parentStyle && currentNode->lastChild()
- && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode))) {
+ && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode))
+#if ENABLE(SHADOW_DOM)
+ && !toElement(currentNode)->shadow()
+#endif
+ ) {
// Adjust for unused reserved tries.
visitedNodeCount -= cStyleSearchThreshold - subcount;
return currentNode->lastChild();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes