Title: [146184] trunk
Revision
146184
Author
apav...@chromium.org
Date
2013-03-19 00:50:24 -0700 (Tue, 19 Mar 2013)

Log Message

Web Inspector: [Styles] Matching @host rule children are not displayed
https://bugs.webkit.org/show_bug.cgi?id=112664

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Process host rules' contents akin to media rules' when handling the CSS model and source data.

Test: platform/chromium/inspector/styles/host-rules.html

* inspector/InspectorStyleSheet.cpp:
(flattenSourceData):
(WebCore::asCSSRuleList):

LayoutTests:

* platform/chromium/inspector/styles/host-rules-expected.txt: Added.
* platform/chromium/inspector/styles/host-rules.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (146183 => 146184)


--- trunk/LayoutTests/ChangeLog	2013-03-19 06:46:39 UTC (rev 146183)
+++ trunk/LayoutTests/ChangeLog	2013-03-19 07:50:24 UTC (rev 146184)
@@ -1,3 +1,13 @@
+2013-03-19  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Styles] Matching @host rule children are not displayed
+        https://bugs.webkit.org/show_bug.cgi?id=112664
+
+        Reviewed by Vsevolod Vlasov.
+
+        * platform/chromium/inspector/styles/host-rules-expected.txt: Added.
+        * platform/chromium/inspector/styles/host-rules.html: Added.
+
 2013-03-18  David Levin  <le...@chromium.org>
 
         Change icon-url-property test for platforms which don't support dumpIconChanges.

Added: trunk/LayoutTests/platform/chromium/inspector/styles/host-rules-expected.txt (0 => 146184)


--- trunk/LayoutTests/platform/chromium/inspector/styles/host-rules-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/inspector/styles/host-rules-expected.txt	2013-03-19 07:50:24 UTC (rev 146184)
@@ -0,0 +1,39 @@
+Tests that @host-provided styles are displayed in the Styles pane. Bug 112664
+
+Content
+
+Running: testInit
+
+Running: testDumpStyles
+[expanded] 
+element.style  { ()
+background-color: white;
+
+======== Matched CSS Rules ========
+[expanded] 
+*  { (host-rules.html:0)
+border: 1px solid black;
+    border-top-color: black;
+    border-top-style: solid;
+    border-top-width: 1px;
+    border-right-color: black;
+    border-right-style: solid;
+    border-right-width: 1px;
+    border-bottom-color: black;
+    border-bottom-style: solid;
+    border-bottom-width: 1px;
+    border-left-color: black;
+    border-left-style: solid;
+    border-left-width: 1px;
+/-- overloaded --/ background-color: red;
+
+[expanded] 
+*  { (host-rules.html:4)
+/-- overloaded --/ background-color: papayawhip;
+
+[expanded] 
+div  { (user agent stylesheet)
+display: block;
+
+
+

Added: trunk/LayoutTests/platform/chromium/inspector/styles/host-rules.html (0 => 146184)


--- trunk/LayoutTests/platform/chromium/inspector/styles/host-rules.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/inspector/styles/host-rules.html	2013-03-19 07:50:24 UTC (rev 146184)
@@ -0,0 +1,52 @@
+<html>
+<head>
+<style>
+* {
+    background-color: papayawhip;
+}
+</style>
+<script src=""
+<script src=""
+<script>
+function createShadowRoot()
+{
+    var root = host.webkitCreateShadowRoot();
+    root.appendChild(document.createElement('content'));
+    var styles = document.createElement('style');
+    styles.textContent = '@host { * { border: 1px solid black; background-color: red } } content::-webkit-distributed(div) { font-size: 24px }';
+    root.appendChild(styles);
+    root.appendChild(document.createElement('content'));
+}
+
+function test()
+{
+    InspectorTest.runTestSuite([
+        function testInit(next)
+        {
+            WebInspector.settings.showShadowDOM.set(true);
+            InspectorTest.evaluateInPage("createShadowRoot()", callback);
+            function callback()
+            {
+                InspectorTest.selectNodeAndWaitForStyles("host", next);
+            }
+        },
+
+        function testDumpStyles(next)
+        {
+            InspectorTest.dumpSelectedElementStyles(true);
+            WebInspector.settings.showShadowDOM.set(false);
+            next();
+        }
+    ]);
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that @host-provided styles are displayed in the Styles pane. <a href="" 112664</a>
+</p>
+
+<div id="host" style="background-color: white;">Content</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (146183 => 146184)


--- trunk/Source/WebCore/ChangeLog	2013-03-19 06:46:39 UTC (rev 146183)
+++ trunk/Source/WebCore/ChangeLog	2013-03-19 07:50:24 UTC (rev 146184)
@@ -1,3 +1,18 @@
+2013-03-19  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: [Styles] Matching @host rule children are not displayed
+        https://bugs.webkit.org/show_bug.cgi?id=112664
+
+        Reviewed by Vsevolod Vlasov.
+
+        Process host rules' contents akin to media rules' when handling the CSS model and source data.
+
+        Test: platform/chromium/inspector/styles/host-rules.html
+
+        * inspector/InspectorStyleSheet.cpp:
+        (flattenSourceData):
+        (WebCore::asCSSRuleList):
+
 2013-03-18  Alexander Pavlov  <apav...@chromium.org>
 
         Web Inspector: [Styles] The "inherit" property value should be suggested for all properties

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (146183 => 146184)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-03-19 06:46:39 UTC (rev 146183)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2013-03-19 07:50:24 UTC (rev 146184)
@@ -28,6 +28,7 @@
 
 #include "InspectorStyleSheet.h"
 
+#include "CSSHostRule.h"
 #include "CSSImportRule.h"
 #include "CSSMediaRule.h"
 #include "CSSParser.h"
@@ -112,6 +113,10 @@
             target->append(data);
         else if (data->type == CSSRuleSourceData::MEDIA_RULE)
             flattenSourceData(&data->childRules, target);
+#if ENABLE(SHADOW_DOM)
+        else if (data->type == CSSRuleSourceData::HOST_RULE)
+            flattenSourceData(&data->childRules, target);
+#endif
 #if ENABLE(CSS3_CONDITIONAL_RULES)
         else if (data->type == CSSRuleSourceData::SUPPORTS_RULE)
             flattenSourceData(&data->childRules, target);
@@ -223,6 +228,11 @@
     if (rule->type() == CSSRule::WEBKIT_KEYFRAMES_RULE)
         return static_cast<WebKitCSSKeyframesRule*>(rule)->cssRules();
 
+#if ENABLE(SHADOW_DOM)
+    if (rule->type() == CSSRule::HOST_RULE)
+        return static_cast<CSSHostRule*>(rule)->cssRules();
+#endif
+
 #if ENABLE(CSS3_CONDITIONAL_RULES)
     if (rule->type() == CSSRule::SUPPORTS_RULE)
         return static_cast<CSSSupportsRule*>(rule)->cssRules();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to