Diff
Modified: trunk/LayoutTests/ChangeLog (92681 => 92682)
--- trunk/LayoutTests/ChangeLog 2011-08-09 14:18:53 UTC (rev 92681)
+++ trunk/LayoutTests/ChangeLog 2011-08-09 14:24:15 UTC (rev 92682)
@@ -1,3 +1,13 @@
+2011-08-09 Pavel Feldman <[email protected]>
+
+ Web Inspector: provide a way to hide user agent styles
+ https://bugs.webkit.org/show_bug.cgi?id=37766
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/styles/show-user-agent-styles-expected.txt: Added.
+ * inspector/styles/show-user-agent-styles.html: Added.
+
2011-08-09 Vsevolod Vlasov <[email protected]>
Web Inspector: REGRESSION (r92672): http/tests/inspector/resource-main-cookies.php failing on Qt Linux Release
Added: trunk/LayoutTests/inspector/styles/show-user-agent-styles-expected.txt (0 => 92682)
--- trunk/LayoutTests/inspector/styles/show-user-agent-styles-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/styles/show-user-agent-styles-expected.txt 2011-08-09 14:24:15 UTC (rev 92682)
@@ -0,0 +1,36 @@
+Tests that user agent styles are shown based on the setting: https://bugs.webkit.org/show_bug.cgi?id=37766.
+
+I'm red.
+
+I'm also red.
+
+
+Running: testShowUserAgentStyles
+WebInspector.settings.showUserAgentStyles = true
+[expanded] element.style { ()
+
+======== Matched CSS Rules ========
+[expanded] h1 { (show-user-agent-styles.html:5)
+background-color: red;
+
+[expanded] h1 { (user agent stylesheet)
+display: block;
+font-size: 2em;
+-webkit-margin-before: 0.67em;
+-webkit-margin-after: 0.67em;
+-webkit-margin-start: 0px;
+-webkit-margin-end: 0px;
+font-weight: bold;
+
+
+
+Running: testShowUserAgentStyles
+WebInspector.settings.showUserAgentStyles = false
+[expanded] element.style { ()
+
+======== Matched CSS Rules ========
+[expanded] h1 { (show-user-agent-styles.html:5)
+background-color: red;
+
+
+
Property changes on: trunk/LayoutTests/inspector/styles/show-user-agent-styles-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/styles/show-user-agent-styles.html (0 => 92682)
--- trunk/LayoutTests/inspector/styles/show-user-agent-styles.html (rev 0)
+++ trunk/LayoutTests/inspector/styles/show-user-agent-styles.html 2011-08-09 14:24:15 UTC (rev 92682)
@@ -0,0 +1,57 @@
+<html>
+<head>
+
+<style>
+h1 {
+ background-color: red;
+}
+</style>
+
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+ InspectorTest.runTestSuite([
+ function testShowUserAgentStyles(next)
+ {
+ WebInspector.settings.showUserAgentStyles.set(true);
+ selectNodeAndDumpStyles("inspected", next);
+ },
+
+ function testShowUserAgentStyles(next)
+ {
+ WebInspector.settings.showUserAgentStyles.set(false);
+ selectNodeAndDumpStyles("other", next);
+ }
+ ]);
+
+ function selectNodeAndDumpStyles(nodeId, next)
+ {
+ InspectorTest.addResult("WebInspector.settings.showUserAgentStyles = " + WebInspector.settings.showUserAgentStyles.get());
+ InspectorTest.selectNodeAndWaitForStyles(nodeId, step1);
+
+ function step1()
+ {
+ InspectorTest.dumpSelectedElementStyles(true, false, true);
+ next();
+ }
+ }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that user agent styles are shown based on the setting: https://bugs.webkit.org/show_bug.cgi?id=37766.
+</p>
+<h1 id="inspected">
+I'm red.
+</h1>
+<h1 id="other">
+I'm also red.
+</h1>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/show-user-agent-styles.html
___________________________________________________________________
Added: svn:executable
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (92681 => 92682)
--- trunk/Source/WebCore/ChangeLog 2011-08-09 14:18:53 UTC (rev 92681)
+++ trunk/Source/WebCore/ChangeLog 2011-08-09 14:24:15 UTC (rev 92682)
@@ -1,3 +1,24 @@
+2011-08-09 Pavel Feldman <[email protected]>
+
+ Web Inspector: provide a way to hide user agent styles
+ https://bugs.webkit.org/show_bug.cgi?id=37766
+
+ Reviewed by Yury Semikhatsky.
+
+ Test: inspector/styles/show-user-agent-styles.html
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/Settings.js:
+ (WebInspector.Settings):
+ * inspector/front-end/SettingsScreen.js:
+ (WebInspector.SettingsScreen):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules.get continue):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._createElementStatePane):
+ (WebInspector.StylesSidebarPane.prototype._showUserAgentStylesSettingChanged):
+
2011-08-09 Steve Block <[email protected]>
JavaMethodJobject is no longer needed by V8
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/front-end/SettingsScreen.js (92681 => 92682)
--- trunk/Source/WebCore/inspector/front-end/SettingsScreen.js 2011-08-09 14:18:53 UTC (rev 92681)
+++ trunk/Source/WebCore/inspector/front-end/SettingsScreen.js 2011-08-09 14:24:15 UTC (rev 92682)
@@ -44,6 +44,7 @@
[ WebInspector.StylesSidebarPane.ColorFormat.HEX, "HEX: #DAC0DE" ],
[ WebInspector.StylesSidebarPane.ColorFormat.RGB, "RGB: rgb(128, 255, 255)" ],
[ WebInspector.StylesSidebarPane.ColorFormat.HSL, "HSL: hsl(300, 80%, 90%)" ] ], WebInspector.settings.colorFormat));
+ p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show user agent styles"), WebInspector.settings.showUserAgentStyles));
if (Preferences.canDisableCache) {
p = this._appendSection(WebInspector.UIString("Network"));
Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (92681 => 92682)
--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-08-09 14:18:53 UTC (rev 92681)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-08-09 14:24:15 UTC (rev 92682)
@@ -87,6 +87,7 @@
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this);
+ WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAgentStylesSettingChanged.bind(this));
}
WebInspector.StylesSidebarPane.ColorFormat = {
@@ -377,6 +378,8 @@
styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") });
for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) {
var rule = styles.matchedCSSRules[i];
+ if (!WebInspector.settings.showUserAgentStyles.get() && (rule.isUser || rule.isUserAgent))
+ continue;
styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
}
@@ -420,6 +423,9 @@
if (!this._containsInherited(rulePayload.style))
continue;
var rule = rulePayload;
+ if (!WebInspector.settings.showUserAgentStyles.get() && (rule.isUser || rule.isUserAgent))
+ continue;
+
if (!separatorInserted) {
insertInheritedNodeSeparator(parentNode);
separatorInserted = true;
@@ -763,6 +769,11 @@
table.appendChild(tr);
this._elementStatePane.appendChild(table);
+ },
+
+ _showUserAgentStylesSettingChanged: function()
+ {
+ this._innerUpdate(false);
}
}