[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
pfeldman at chromium.org
pfeldman at chromium.org
Wed Dec 22 12:28:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f8a737572502b171989ca9379e812aeb0efa27e9
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 24 16:15:46 2010 +0000
2010-08-24 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: Trace to the style that contributes to
the computed styles panel.
https://bugs.webkit.org/show_bug.cgi?id=44448
Test: inspector/styles-computed-trace.html
* English.lproj/localizedStrings.js:
* inspector/front-end/Section.js:
(WebInspector.Section.prototype.set subtitle):
(WebInspector.Section.prototype.get subtitleAsTextForTest):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._refreshUpdate):
(WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
(WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
(WebInspector.StylesSidebarPane.prototype._refreshSectionsForStyleRules):
(WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
(WebInspector.StylePropertiesSection.linkifyUncopyable):
(WebInspector.StylePropertiesSection):
(WebInspector.StylePropertiesSection.prototype.isPropertyInherited):
(WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
(WebInspector.StylePropertiesSection.prototype.isPropertyDisabled):
(WebInspector.StylePropertiesSection.prototype.update):
(WebInspector.StylePropertiesSection.prototype.onpopulate):
(WebInspector.ComputedStylePropertiesSection):
(WebInspector.ComputedStylePropertiesSection.prototype.collapse):
(WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited):
(WebInspector.ComputedStylePropertiesSection.prototype.update):
(WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
(WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace):
(WebInspector.BlankStylePropertiesSection):
* inspector/front-end/inspector.css:
(.styles-section a::before):
* inspector/front-end/inspector.js:
(WebInspector.documentClick.followLink):
(WebInspector.documentClick):
(WebInspector.linkifyResourceAsNode):
2010-08-24 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: Trace to the style that contributes to
the computed styles panel.
https://bugs.webkit.org/show_bug.cgi?id=44448
* inspector/elements-panel-styles-expected.txt:
* inspector/elements-tests.js:
(frontend_getSelectedElementStyles):
(frontend_dumpStyleTreeItem):
* inspector/styles-computed-trace-expected.txt: Added.
* inspector/styles-computed-trace.html: Added.
* inspector/styles-disable-inherited-expected.txt:
* inspector/styles-disable-inherited.html:
* inspector/styles-disable-then-delete-expected.txt:
* inspector/styles-source-lines-inline-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 28a7e6d..2297c70 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-24 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: Trace to the style that contributes to
+ the computed styles panel.
+ https://bugs.webkit.org/show_bug.cgi?id=44448
+
+ * inspector/elements-panel-styles-expected.txt:
+ * inspector/elements-tests.js:
+ (frontend_getSelectedElementStyles):
+ (frontend_dumpStyleTreeItem):
+ * inspector/styles-computed-trace-expected.txt: Added.
+ * inspector/styles-computed-trace.html: Added.
+ * inspector/styles-disable-inherited-expected.txt:
+ * inspector/styles-disable-inherited.html:
+ * inspector/styles-disable-then-delete-expected.txt:
+ * inspector/styles-source-lines-inline-expected.txt:
+
2010-08-24 Csaba Osztrogonác <ossy at webkit.org>
Unreviewed trivial fix.
diff --git a/LayoutTests/inspector/elements-panel-styles-expected.txt b/LayoutTests/inspector/elements-panel-styles-expected.txt
index 530d75f..866ed4b 100644
--- a/LayoutTests/inspector/elements-panel-styles-expected.txt
+++ b/LayoutTests/inspector/elements-panel-styles-expected.txt
@@ -2,17 +2,26 @@ Tests that elements panel shows proper styles in the sidebar panel.
[expanded] ()
color: blue;
+ .foo, .foo::before - blue resources/elements-panel-styles.css:15
+ /-- overloaded --/ .foo - black resources/elements-panel-styles.css:10
display: none;
+ element.style - none
+ /-- overloaded --/ div - block user agent stylesheet
font-family: serif;
+ #container - serif resources/elements-panel-styles.css:5
font-size: 14px;
-height: auto;
+ #container - 14px resources/elements-panel-styles.css:5
+ /-- overloaded --/ body - 12px resources/elements-panel-styles.css:1
margin-bottom: 2px;
+ .foo - 2px resources/elements-panel-styles.css:10
margin-left: 0px;
+ .foo - 0px resources/elements-panel-styles.css:10
margin-right: 0px;
+ .foo - 0px resources/elements-panel-styles.css:10
margin-top: 10px;
-width: auto;
+ .foo - 10px resources/elements-panel-styles.css:10
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
display: none;
======== Matched CSS Rules ========
diff --git a/LayoutTests/inspector/elements-tests.js b/LayoutTests/inspector/elements-tests.js
index 4d7277d..3e06926 100755
--- a/LayoutTests/inspector/elements-tests.js
+++ b/LayoutTests/inspector/elements-tests.js
@@ -60,7 +60,7 @@ function frontend_getSelectedElementStyles(excludeComputed, excludeMatched)
continue;
if (section.element.previousSibling && section.element.previousSibling.className === "styles-sidebar-separator")
result.push("======== " + section.element.previousSibling.textContent + " ========");
- result.push((section.expanded ? "[expanded] " : "[collapsed] ") + section.titleElement.textContent + " (" + section.subtitleAsText + ")");
+ result.push((section.expanded ? "[expanded] " : "[collapsed] ") + section.titleElement.textContent + " (" + section.subtitleAsTextForTest + ")");
section.expand();
frontend_dumpStyleTreeOutline(section.propertiesTreeOutline, result);
result.push("");
@@ -92,6 +92,12 @@ function frontend_dumpStyleTreeOutline(treeItem, result)
function frontend_dumpStyleTreeItem(treeItem, result, prefix)
{
+ // Filter out width and height properties in order to minimize
+ // potential diffs.
+ if (!treeItem.listItemElement.textContent.indexOf("width") ||
+ !treeItem.listItemElement.textContent.indexOf("height"))
+ return;
+
if (treeItem.listItemElement.hasStyleClass("inherited"))
return;
var typePrefix = "";
@@ -99,7 +105,14 @@ function frontend_dumpStyleTreeItem(treeItem, result, prefix)
typePrefix += "/-- overloaded --/ ";
if (treeItem.listItemElement.hasStyleClass("disabled"))
typePrefix += "/-- disabled --/ ";
- result.push(prefix + typePrefix + treeItem.listItemElement.textContent);
+ var textContent = treeItem.listItemElement.textContent;
+
+ // Add non-selectable url text.
+ var textData = treeItem.listItemElement.querySelector("[data-uncopyable]");
+ if (textData)
+ textContent += textData.getAttribute("data-uncopyable");
+
+ result.push(prefix + typePrefix + textContent);
treeItem.expand();
var children = treeItem.children;
for (var i = 0; children && i < children.length; ++i)
diff --git a/LayoutTests/inspector/styles-computed-trace-expected.txt b/LayoutTests/inspector/styles-computed-trace-expected.txt
new file mode 100644
index 0000000..a322273
--- /dev/null
+++ b/LayoutTests/inspector/styles-computed-trace-expected.txt
@@ -0,0 +1,41 @@
+Tests that disabling inherited style property does not break further style inspection.
+
+==== Computed style for ID1 ====
+[expanded] ()
+background-attachment: scroll;
+ #id1 - initial styles-computed-trace.html:19
+background-clip: border-box;
+ #id1 - initial styles-computed-trace.html:19
+background-color: gray;
+ #id1 - gray styles-computed-trace.html:19
+ /-- overloaded --/ #id1 - black styles-computed-trace.html:14
+ /-- overloaded --/ #id1 - green styles-computed-trace.html:9
+background-image: none;
+ #id1 - initial styles-computed-trace.html:19
+background-origin: padding-box;
+ #id1 - initial styles-computed-trace.html:19
+display: block;
+ div - block user agent stylesheet
+font-family: Courier;
+ #id1 - Courier styles-computed-trace.html:14
+ /-- overloaded --/ #id1 - Times styles-computed-trace.html:9
+ /-- overloaded --/ body - Arial styles-computed-trace.html:4
+
+[expanded] element.style { ()
+
+
+==== Computed style for ID2 ====
+[expanded] ()
+background-color: blue;
+ #id2 - blue styles-computed-trace.html:23
+display: block;
+ div - block user agent stylesheet
+font-family: Courier;
+ #id2 - Courier styles-computed-trace.html:23
+ /-- overloaded --/ #id1 - Courier styles-computed-trace.html:14
+ /-- overloaded --/ #id1 - Times styles-computed-trace.html:9
+ /-- overloaded --/ body - Arial styles-computed-trace.html:4
+
+[expanded] element.style { ()
+
+
diff --git a/LayoutTests/inspector/styles-computed-trace.html b/LayoutTests/inspector/styles-computed-trace.html
new file mode 100644
index 0000000..8f66608
--- /dev/null
+++ b/LayoutTests/inspector/styles-computed-trace.html
@@ -0,0 +1,84 @@
+<html>
+<head>
+<style>
+body {
+ background-color: rgb(100, 0, 0);
+ font-family: Arial;
+}
+
+#id1 {
+ background-color: green;
+ font-family: Times;
+}
+
+#id1 {
+ background-color: black;
+ font-family: Courier;
+}
+
+#id1 {
+ background: gray;
+}
+
+#id2 {
+ background-color: blue;
+ font-family: Courier;
+}
+
+</style>
+<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="elements-tests.js"></script>
+<script>
+
+function doit()
+{
+ function callback(result)
+ {
+ dumpArray(result);
+ notifyDone();
+ }
+ evaluateInWebInspector("frontend_runTest", callback);
+}
+
+// Frontend functions.
+
+function frontend_runTest(testController)
+{
+ testController.waitUntilDone();
+ frontend_expandDOMSubtreeAndRun(testController, null, frontend_selectNestedElement);
+}
+
+function frontend_selectNestedElement(testController)
+{
+ frontend_selectElementAndRun(testController, "id1", frontend_dumpID1Style);
+}
+
+function frontend_dumpID1Style(testController)
+{
+ testController.results.push("==== Computed style for ID1 ====");
+ testController.results = testController.results.concat(frontend_getSelectedElementStyles(false, true));
+ frontend_selectElementAndRun(testController, "id2", frontend_dumpID2Style);
+}
+
+function frontend_dumpID2Style(testController)
+{
+ testController.results.push("==== Computed style for ID2 ====");
+ testController.results = testController.results.concat(frontend_getSelectedElementStyles(false, true));
+ testController.notifyDone();
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that computed styles expand and allow tracing to style rules.
+</p>
+
+<div id="id1">
+<div id="id2">
+</div>
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/styles-disable-inherited-expected.txt b/LayoutTests/inspector/styles-disable-inherited-expected.txt
index 8327df6..9b48ed6 100644
--- a/LayoutTests/inspector/styles-disable-inherited-expected.txt
+++ b/LayoutTests/inspector/styles-disable-inherited-expected.txt
@@ -1,19 +1,19 @@
Tests that disabling inherited style property does not break further style inspection.
Before disable
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
======== Matched CSS Rules ========
[expanded] div { (user agent stylesheet)
display: block;
======== Inherited from div#container ========
-[expanded] Style Attribute { (element’s “style” attribute)
+[expanded] Style Attribute { ()
font-weight: bold;
After disable:
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
======== Matched CSS Rules ========
[expanded] div { (user agent stylesheet)
diff --git a/LayoutTests/inspector/styles-disable-inherited.html b/LayoutTests/inspector/styles-disable-inherited.html
index 8b6ed51..29f9275 100644
--- a/LayoutTests/inspector/styles-disable-inherited.html
+++ b/LayoutTests/inspector/styles-disable-inherited.html
@@ -49,7 +49,7 @@ function frontend_dumpResults(testController)
{
testController.results.push("After disable:");
testController.results = testController.results.concat(frontend_getSelectedElementStyles(true));
- testController.notifyDone(window.__result);
+ testController.notifyDone(testController.results);
}
frontend_selectElementAndRun(testController, "nested", reportResults);
}
diff --git a/LayoutTests/inspector/styles-disable-then-delete-expected.txt b/LayoutTests/inspector/styles-disable-then-delete-expected.txt
index f28549d..cbfaa71 100644
--- a/LayoutTests/inspector/styles-disable-then-delete-expected.txt
+++ b/LayoutTests/inspector/styles-disable-then-delete-expected.txt
@@ -1,17 +1,17 @@
Tests that removal of property following its disabling works.
Before disable
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
font-weight: bold;
After disable
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
/-- overloaded --/ /-- disabled --/ font-weight: bold;
After delete
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
diff --git a/LayoutTests/inspector/styles-source-lines-inline-expected.txt b/LayoutTests/inspector/styles-source-lines-inline-expected.txt
index 354197f..a135d24 100644
--- a/LayoutTests/inspector/styles-source-lines-inline-expected.txt
+++ b/LayoutTests/inspector/styles-source-lines-inline-expected.txt
@@ -1,7 +1,7 @@
Tests that elements panel shows proper inline style locations in the sidebar panel.
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
display: none;
======== Matched CSS Rules ========
@@ -12,7 +12,7 @@ color: blue;
/-- overloaded --/ display: block;
-[expanded] element.style { (element’s “style” attribute)
+[expanded] element.style { ()
======== Matched CSS Rules ========
[expanded] .bar { (resources/styles-source-lines-inline-iframe.html:4)
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 3bea74d..e12112b 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3133,8 +3133,6 @@ BUG51161 LINUX DEBUG : svg/clip-path/clip-path-text.svg = CRASH
// This test has not landed yet, though the fix has.
//BUG41968 LINUX WIN : svg/hittest/svg-rect-hit.html = TEXT
-BUGWK43720 WIN : http/tests/inspector-enabled/console-log-before-frame-navigation.html = TEXT
-
// Failure caused by r64749
BUGSATISH: fast/speech/input-text-speechbutton.html = TIMEOUT
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 58fe299..dc12588 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,44 @@
+2010-08-24 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: Trace to the style that contributes to
+ the computed styles panel.
+ https://bugs.webkit.org/show_bug.cgi?id=44448
+
+ Test: inspector/styles-computed-trace.html
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/Section.js:
+ (WebInspector.Section.prototype.set subtitle):
+ (WebInspector.Section.prototype.get subtitleAsTextForTest):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.prototype._refreshUpdate):
+ (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._refreshSectionsForStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
+ (WebInspector.StylePropertiesSection.linkifyUncopyable):
+ (WebInspector.StylePropertiesSection):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyInherited):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyDisabled):
+ (WebInspector.StylePropertiesSection.prototype.update):
+ (WebInspector.StylePropertiesSection.prototype.onpopulate):
+ (WebInspector.ComputedStylePropertiesSection):
+ (WebInspector.ComputedStylePropertiesSection.prototype.collapse):
+ (WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited):
+ (WebInspector.ComputedStylePropertiesSection.prototype.update):
+ (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
+ (WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace):
+ (WebInspector.BlankStylePropertiesSection):
+ * inspector/front-end/inspector.css:
+ (.styles-section a::before):
+ * inspector/front-end/inspector.js:
+ (WebInspector.documentClick.followLink):
+ (WebInspector.documentClick):
+ (WebInspector.linkifyResourceAsNode):
+
2010-08-24 Daniel Cheng <dcheng at chromium.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index 010c28c..16d87ae 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/inspector/front-end/Section.js b/WebCore/inspector/front-end/Section.js
index 913d495..a186d43 100644
--- a/WebCore/inspector/front-end/Section.js
+++ b/WebCore/inspector/front-end/Section.js
@@ -82,21 +82,18 @@ WebInspector.Section.prototype = {
if (this._subtitle === x)
return;
this._subtitle = x;
- this.subtitleElement.setAttribute("data-uncopyable", x);
+ this.subtitleElement.textContent = x;
},
- get subtitleAsText()
- {
- var result = "";
- var data = this.subtitleElement.getAttribute("data-uncopyable");
- if (data)
- result += data;
- var child = this.subtitleElement.querySelector("[data-uncopyable]");
- if (child) {
- var linkData = child.getAttribute("data-uncopyable");
- if (linkData)
- result += linkData;
- }
+ get subtitleAsTextForTest()
+ {
+ var result = this.subtitleElement.textContent;
+ var child = this.subtitleElement.querySelector("[data-uncopyable]");
+ if (child) {
+ var linkData = child.getAttribute("data-uncopyable");
+ if (linkData)
+ result += linkData;
+ }
return result;
},
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index 39352a1..1dddde7 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -160,6 +160,8 @@ WebInspector.StylesSidebarPane.prototype = {
this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection);
}
+ // Trace the computed style.
+ this.sections[0][0].rebuildComputedTrace(this.sections[0]);
},
_rebuildUpdate: function(node, styles)
@@ -173,6 +175,8 @@ WebInspector.StylesSidebarPane.prototype = {
this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0);
var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
+ // Trace the computed style.
+ this.sections[0][0].rebuildComputedTrace(this.sections[0]);
for (var i = 0; i < styles.pseudoElements.length; ++i) {
var pseudoElementCSSRules = styles.pseudoElements[i];
@@ -223,7 +227,6 @@ WebInspector.StylesSidebarPane.prototype = {
var styleAttributes = {};
for (var name in styles.styleAttributes) {
var attrStyle = { style: new WebInspector.CSSStyleDeclaration(styles.styleAttributes[name]), editable: false };
- attrStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", name);
attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name;
if (node.getAttribute(name))
attrStyle.selectorText += "=" + node.getAttribute(name);
@@ -234,7 +237,6 @@ WebInspector.StylesSidebarPane.prototype = {
// Show element's Style Attributes
if (styles.inlineStyle && node.nodeType === Node.ELEMENT_NODE) {
var inlineStyle = { selectorText: "element.style", style: new WebInspector.CSSStyleDeclaration(styles.inlineStyle), isAttribute: true };
- inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style");
styleRules.push(inlineStyle);
}
@@ -262,7 +264,6 @@ WebInspector.StylesSidebarPane.prototype = {
if (parentStyles.inlineStyle) {
if (this._containsInherited(parentStyles.inlineStyle)) {
var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: new WebInspector.CSSStyleDeclaration(parentStyles.inlineStyle), isAttribute: true, isInherited: true };
- inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style");
if (!separatorInserted) {
insertInheritedNodeSeparator(parentNode);
separatorInserted = true;
@@ -386,10 +387,14 @@ WebInspector.StylesSidebarPane.prototype = {
for (var i = 0; i < styleRules.length; ++i) {
var styleRule = styleRules[i];
var section = styleRule.section;
- if (styleRule.computedStyle)
- section.disabledComputedProperties = disabledComputedProperties;
- section._usedProperties = (styleRule.usedProperties || usedProperties);
- section.update((section === editedSection) || styleRule.computedStyle);
+ if (styleRule.computedStyle) {
+ section._disabledComputedProperties = disabledComputedProperties;
+ section._usedProperties = usedProperties;
+ section.update();
+ } else {
+ section._usedProperties = styleRule.usedProperties;
+ section.update(section === editedSection);
+ }
}
},
@@ -428,9 +433,10 @@ WebInspector.StylesSidebarPane.prototype = {
if (typeof editable === "undefined")
editable = true;
- var section = new WebInspector.StylePropertiesSection(styleRule, styleRule.subtitle, styleRule.computedStyle, (styleRule.usedProperties || usedProperties), editable, styleRule.isInherited, lastWasSeparator);
if (computedStyle)
- section.disabledComputedProperties = disabledComputedProperties;
+ var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties, styleRules);
+ else
+ var section = new WebInspector.StylePropertiesSection(styleRule, editable, styleRule.isInherited, lastWasSeparator);
section.pane = this;
section.expanded = true;
@@ -596,7 +602,7 @@ WebInspector.ComputedStyleSidebarPane = function()
WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
-WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyle, usedProperties, editable, isInherited, isFirstSection)
+WebInspector.StylePropertiesSection = function(styleRule, editable, isInherited, isFirstSection)
{
WebInspector.PropertiesSection.call(this, "");
this.element.className = "styles-section monospace" + (isFirstSection ? " first-styles-section" : "");
@@ -605,23 +611,20 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
this._selectorElement.textContent = styleRule.selectorText;
this.titleElement.appendChild(this._selectorElement);
- if (!computedStyle) {
- var openBrace = document.createElement("span");
- openBrace.textContent = " {";
- this.titleElement.appendChild(openBrace);
+ var openBrace = document.createElement("span");
+ openBrace.textContent = " {";
+ this.titleElement.appendChild(openBrace);
- var closeBrace = document.createElement("div");
- closeBrace.textContent = "}";
- this.element.appendChild(closeBrace);
- }
+ var closeBrace = document.createElement("div");
+ closeBrace.textContent = "}";
+ this.element.appendChild(closeBrace);
this._selectorElement.addEventListener("dblclick", this._handleSelectorDoubleClick.bind(this), false);
this.element.addEventListener("dblclick", this._handleEmptySpaceDoubleClick.bind(this), false);
this.styleRule = styleRule;
this.rule = this.styleRule.rule;
- this.computedStyle = computedStyle;
- this.editable = (editable && !computedStyle);
+ this.editable = editable;
this.isInherited = isInherited;
// Prevent editing the user agent and user rules.
@@ -632,41 +635,36 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
if (isUserAgent || isUser)
this.editable = false;
- this._usedProperties = usedProperties;
+ this._usedProperties = styleRule.usedProperties;
if (this.rule)
this.titleElement.addStyleClass("styles-selector");
- if (computedStyle) {
- this.element.addStyleClass("computed-style");
- this.headerElement.addStyleClass("hidden");
- } else {
- if (!subtitle) {
- function linkifyUncopyable(url, line)
- {
- var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
- link.setAttribute("data-uncopyable", link.textContent);
- link.textContent = "";
- return link;
- }
-
- if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href)
- this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.parentStyleSheet.href, this.rule.sourceLine));
- else if (isUserAgent)
- subtitle = WebInspector.UIString("user agent stylesheet");
- else if (isUser)
- subtitle = WebInspector.UIString("user stylesheet");
- else if (isViaInspector)
- subtitle = WebInspector.UIString("via inspector");
- else
- this.subtitleElement.appendChild(linkifyUncopyable(this.rule.documentURL, this.rule.sourceLine));
- }
- if (isInherited)
- this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style.
- if (subtitle)
- this.subtitle = subtitle;
+ function linkifyUncopyable(url, line)
+ {
+ var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
+ link.setAttribute("data-uncopyable", link.textContent);
+ link.textContent = "";
+ return link;
}
+ var subtitle = "";
+ if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href)
+ this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.parentStyleSheet.href, this.rule.sourceLine));
+ else if (isUserAgent)
+ subtitle = WebInspector.UIString("user agent stylesheet");
+ else if (isUser)
+ subtitle = WebInspector.UIString("user stylesheet");
+ else if (isViaInspector)
+ subtitle = WebInspector.UIString("via inspector");
+ else if (this.rule && this.rule.documentURL)
+ this.subtitleElement.appendChild(linkifyUncopyable(this.rule.documentURL, this.rule.sourceLine));
+
+ if (isInherited)
+ this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style.
+ if (subtitle)
+ this.subtitle = subtitle;
+
this.identifier = styleRule.selectorText;
if (this.subtitle)
this.identifier += ":" + this.subtitle;
@@ -676,17 +674,6 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl
}
WebInspector.StylePropertiesSection.prototype = {
- get usedProperties()
- {
- return this._usedProperties || {};
- },
-
- set usedProperties(x)
- {
- this._usedProperties = x;
- this.update();
- },
-
collapse: function(dontRememberState)
{
// Overriding with empty body.
@@ -699,17 +686,12 @@ WebInspector.StylePropertiesSection.prototype = {
// Render truly inherited properties with black, i.e. return them as non-inherited.
return !(property in WebInspector.StylesSidebarPane.InheritedProperties);
}
-
- if (!this.computedStyle || !this._usedProperties || this.noAffect)
- return false;
- // These properties should always show for Computed Style.
- var alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
- return !(property in this.usedProperties) && !(property in alwaysShowComputedProperties) && !(property in this.disabledComputedProperties);
+ return false;
},
isPropertyOverloaded: function(property, shorthand)
{
- if (this.computedStyle || !this._usedProperties || this.noAffect)
+ if (!this._usedProperties || this.noAffect)
return false;
if (this.isInherited && !(property in WebInspector.StylesSidebarPane.InheritedProperties)) {
@@ -717,7 +699,7 @@ WebInspector.StylePropertiesSection.prototype = {
return false;
}
- var used = (property in this.usedProperties);
+ var used = (property in this._usedProperties);
if (used || !shorthand)
return !used;
@@ -726,16 +708,23 @@ WebInspector.StylePropertiesSection.prototype = {
var longhandProperties = this.styleRule.style.getLonghandProperties(property);
for (var j = 0; j < longhandProperties.length; ++j) {
var individualProperty = longhandProperties[j];
- if (individualProperty in this.usedProperties)
+ if (individualProperty in this._usedProperties)
return false;
}
return true;
},
+ isPropertyDisabled: function(property)
+ {
+ if (!this.styleRule.style.__disabledPropertyValues)
+ return false;
+ return property in this.styleRule.style.__disabledPropertyValues;
+ },
+
update: function(full)
{
- if (full || this.computedStyle) {
+ if (full) {
this.propertiesTreeOutline.removeChildren();
this.populated = false;
} else {
@@ -745,7 +734,6 @@ WebInspector.StylePropertiesSection.prototype = {
child = child.traverseNextTreeElement(false, null, true);
}
}
-
this.afterUpdate();
},
@@ -764,21 +752,18 @@ WebInspector.StylePropertiesSection.prototype = {
var foundShorthands = {};
var disabledProperties = style.__disabledPropertyValues || {};
- var uniqueProperties = [];
+ this.uniqueProperties = [];
for (var i = 0; i < style.length; ++i)
- uniqueProperties.push(style[i]);
+ this.uniqueProperties.push(style[i]);
for (var name in disabledProperties)
- uniqueProperties.push(name);
+ this.uniqueProperties.push(name);
- uniqueProperties.sort();
+ this.uniqueProperties.sort();
- for (var i = 0; i < uniqueProperties.length; ++i) {
- var name = uniqueProperties[i];
+ for (var i = 0; i < this.uniqueProperties.length; ++i) {
+ var name = this.uniqueProperties[i];
var disabled = name in disabledProperties;
- if (!disabled && this.disabledComputedProperties && !(name in this.usedProperties) && name in this.disabledComputedProperties)
- disabled = true;
-
var shorthand = !disabled ? style.getPropertyShorthand(name) : null;
if (shorthand && shorthand in foundShorthands)
@@ -920,10 +905,102 @@ WebInspector.StylePropertiesSection.prototype = {
WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
-WebInspector.BlankStylePropertiesSection = function(defaultSelectorText)
+WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties, disabledComputedProperties)
{
- WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, "", false, {}, false);
+ WebInspector.PropertiesSection.call(this, "");
+ this.headerElement.addStyleClass("hidden");
+ this.element.className = "styles-section monospace first-styles-section read-only computed-style";
+ this.styleRule = styleRule;
+ this._usedProperties = usedProperties;
+ this._disabledComputedProperties = disabledComputedProperties;
+ this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
+ this.computedStyle = true;
+ this._propertyTreeElements = {};
+ this._expandedPropertyNames = {};
+}
+
+WebInspector.ComputedStylePropertiesSection.prototype = {
+ collapse: function(dontRememberState)
+ {
+ // Overriding with empty body.
+ },
+ _isPropertyInherited: function(property)
+ {
+ return !(property in this._usedProperties) && !(property in this._alwaysShowComputedProperties) && !(property in this._disabledComputedProperties);
+ },
+
+ update: function()
+ {
+ this._expandedPropertyNames = {};
+ for (var name in this._propertyTreeElements) {
+ if (this._propertyTreeElements[name].expanded)
+ this._expandedPropertyNames[name] = true;
+ }
+ this._propertyTreeElements = {};
+ this.propertiesTreeOutline.removeChildren();
+ this.populated = false;
+ },
+
+ onpopulate: function()
+ {
+ var style = this.styleRule.style;
+ var uniqueProperties = [];
+ for (var i = 0; i < style.length; ++i)
+ uniqueProperties.push(style[i]);
+ uniqueProperties.sort();
+
+ this._propertyTreeElements = {};
+ for (var i = 0; i < uniqueProperties.length; ++i) {
+ var name = uniqueProperties[i];
+ var inherited = this._isPropertyInherited(name);
+ var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, name, false, inherited, false, false);
+ this.propertiesTreeOutline.appendChild(item);
+ this._propertyTreeElements[name] = item;
+ }
+ },
+
+ rebuildComputedTrace: function(sections)
+ {
+ for (var i = 0; i < sections.length; ++i) {
+ var section = sections[i];
+ if (section.computedStyle || section instanceof WebInspector.BlankStylePropertiesSection)
+ continue;
+
+ for (var j = 0; j < section.uniqueProperties.length; ++j) {
+ var name = section.uniqueProperties[j];
+ if (section.isPropertyDisabled(name))
+ continue;
+ if (section.isInherited && !(name in WebInspector.StylesSidebarPane.InheritedProperties))
+ continue;
+
+ var treeElement = this._propertyTreeElements[name];
+ if (treeElement) {
+ var selectorText = section.styleRule.selectorText;
+ var value = section.styleRule.style.getPropertyValue(name);
+ var title = "<span style='color: gray'>" + selectorText + "</span> - " + value;
+ var subtitle = " <span style='float:right'>" + section.subtitleElement.innerHTML + "</span>";
+ var childElement = new TreeElement(title + subtitle, null, false);
+ treeElement.appendChild(childElement);
+ if (section.isPropertyOverloaded(name))
+ childElement.listItemElement.addStyleClass("overloaded");
+ }
+ }
+ }
+
+ // Restore expanded state after update.
+ for (var name in this._expandedPropertyNames) {
+ if (name in this._propertyTreeElements)
+ this._propertyTreeElements[name].expand();
+ }
+ }
+}
+
+WebInspector.ComputedStylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
+
+WebInspector.BlankStylePropertiesSection = function(defaultSelectorText)
+{
+ WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
this.element.addStyleClass("blank-section");
}
@@ -962,13 +1039,9 @@ WebInspector.BlankStylePropertiesSection.prototype = {
makeNormal: function(styleRule)
{
this.element.removeStyleClass("blank-section");
-
this.styleRule = styleRule;
this.rule = styleRule.rule;
- this.computedStyle = false;
- this.editable = true;
this.identifier = styleRule.selectorText + ":via inspector";
-
this.__proto__ = WebInspector.StylePropertiesSection.prototype;
}
}
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 384be93..4319816 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -4107,7 +4107,7 @@ a.worker-item {
color: inherit;
}
-.styles-section .subtitle::before, .styles-section .subtitle a::before {
+.styles-section a::before {
content: attr(data-uncopyable);
}
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 79b0e0e..8475804 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -714,13 +714,13 @@ WebInspector.documentClick = function(event)
function followLink()
{
// FIXME: support webkit-html-external-link links here.
- if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel)) {
+ if (WebInspector.canShowSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"))) {
if (anchor.hasStyleClass("webkit-html-external-link")) {
anchor.removeStyleClass("webkit-html-external-link");
anchor.addStyleClass("webkit-html-resource-link");
}
- WebInspector.showSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel);
+ WebInspector.showSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"));
return;
}
@@ -1800,8 +1800,8 @@ WebInspector.linkifyResourceAsNode = function(url, preferredPanel, lineNumber, c
if (lineNumber)
linkText += ":" + lineNumber;
var node = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
- node.lineNumber = lineNumber;
- node.preferredPanel = preferredPanel;
+ node.setAttribute("line_number", lineNumber);
+ node.setAttribute("preferred_panel", preferredPanel);
return node;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list