Diff
Modified: trunk/LayoutTests/ChangeLog (107219 => 107220)
--- trunk/LayoutTests/ChangeLog 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/LayoutTests/ChangeLog 2012-02-09 12:41:37 UTC (rev 107220)
@@ -1,3 +1,15 @@
+2012-02-09 Alexander Pavlov <[email protected]>
+
+ Web Inspector: Update protocol and UI to follow bug 77204 (Kill per-Attribute style declarations)
+ https://bugs.webkit.org/show_bug.cgi?id=77962
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/elements/elements-panel-styles-expected.txt:
+ * inspector/styles/styles-computed-trace-expected.txt:
+ * inspector/styles/styles-new-API-expected.txt:
+ * inspector/styles/styles-new-API.html:
+
2012-02-09 Nikolas Zimmermann <[email protected]>
Not reviewed. Add missing Mac/Lion result.
Modified: trunk/LayoutTests/inspector/elements/elements-panel-styles-expected.txt (107219 => 107220)
--- trunk/LayoutTests/inspector/elements/elements-panel-styles-expected.txt 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/LayoutTests/inspector/elements/elements-panel-styles-expected.txt 2012-02-09 12:41:37 UTC (rev 107220)
@@ -32,7 +32,7 @@
margin-top: 10px;
.foo - 10px elements-panel-styles.css:14
text-align: -webkit-left;
- div[] - -webkit-left
+ div[Attributes Style] - -webkit-left
[expanded]
element.style { ()
@@ -67,7 +67,7 @@
/-- overloaded --/ font-style: normal !important;
[expanded]
-div[] { ()
+div[Attributes Style] { ()
text-align: -webkit-left;
[expanded]
Modified: trunk/LayoutTests/inspector/styles/styles-computed-trace-expected.txt (107219 => 107220)
--- trunk/LayoutTests/inspector/styles/styles-computed-trace-expected.txt 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/LayoutTests/inspector/styles/styles-computed-trace-expected.txt 2012-02-09 12:41:37 UTC (rev 107220)
@@ -52,7 +52,7 @@
======== Matched CSS Rules ========
[expanded]
-button[] { ()
+button[Attributes Style] { ()
display: none;
Modified: trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt (107219 => 107220)
--- trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/LayoutTests/inspector/styles/styles-new-API-expected.txt 2012-02-09 12:41:37 UTC (rev 107220)
@@ -90,8 +90,7 @@
['width':'85%'] @[21-32] active
['background-image':'url(bar.png)'] @[33-63] active
-=== Attribute styles for table ===
-Attribute:
+=== Attributes style for table ===
style
raw style
Modified: trunk/LayoutTests/inspector/styles/styles-new-API.html (107219 => 107220)
--- trunk/LayoutTests/inspector/styles/styles-new-API.html 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/LayoutTests/inspector/styles/styles-new-API.html 2012-02-09 12:41:37 UTC (rev 107220)
@@ -96,18 +96,15 @@
function test_tableStyles()
{
- function callback(error, inlineStyle, styleAttributes)
+ function callback(error, inlineStyle, attributesStyle)
{
if (error) {
InspectorTest.addResult("error: " + error);
return;
}
InspectorTest.addResult("");
- InspectorTest.addResult("=== Attribute styles for table ===");
- for (var i = 0; i < styleAttributes.length; ++i) {
- InspectorTest.addResult("Attribute: " + styleAttributes[i].name);
- dumpRuleOrStyle(styleAttributes[i].style);
- }
+ InspectorTest.addResult("=== Attributes style for table ===");
+ dumpRuleOrStyle(attributesStyle);
test_styleSheets();
}
@@ -386,7 +383,7 @@
<p>
Tests that InspectorCSSAgent API methods work as expected.
</p>
-<table width=50% id="thetable">
+<table width="50%" id="thetable">
</table>
<h1 id="toggle">H1</h1>
</body>
Modified: trunk/Source/WebCore/ChangeLog (107219 => 107220)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 12:41:37 UTC (rev 107220)
@@ -1,3 +1,27 @@
+2012-02-09 Alexander Pavlov <[email protected]>
+
+ Web Inspector: Update protocol and UI to follow bug 77204 (Kill per-Attribute style declarations)
+ https://bugs.webkit.org/show_bug.cgi?id=77962
+
+ Reviewed by Pavel Feldman.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/Inspector.json:
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getInlineStylesForNode):
+ (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
+ * inspector/InspectorCSSAgent.h:
+ (InspectorCSSAgent):
+ * inspector/front-end/AuditRules.js:
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.getStyles):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.prototype.getInlineStylesAsync):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate.inlineCallback):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules.get continue):
+
2012-02-08 Pavel Feldman <[email protected]>
Web Inspector: toggle Edit as HTML on F2, drag nodes up / down upon Ctrl(Cmd) Up / Down.
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/Inspector.json (107219 => 107220)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-02-09 12:41:37 UTC (rev 107220)
@@ -1802,7 +1802,7 @@
],
"returns": [
{ "name": "inlineStyle", "$ref": "CSSStyle", "optional": true, "description": "Inline style for the specified DOM node." },
- { "name": "styleAttributes", "type": "array", "items": { "$ref": "CSSStyleAttribute" }, "optional": true, "description": "Entries for style-related element attributes (e.g. width=20)."}
+ { "name": "attributesStyle", "$ref": "CSSStyle", "optional": true, "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\")."}
],
"description": "Returns the styles defined inline (explicitly in the \"style\" attribute and implicitly, using DOM attributes) for a DOM node identified by <code>nodeId</code>."
},
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (107219 => 107220)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2012-02-09 12:41:37 UTC (rev 107220)
@@ -536,7 +536,7 @@
}
}
-void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorArray>& attributes)
+void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorObject>& attributesStyle)
{
Element* element = elementForId(errorString, nodeId);
if (!element)
@@ -547,7 +547,8 @@
return;
inlineStyle = styleSheet->buildObjectForStyle(element->style());
- attributes = buildArrayForAttributeStyles(element);
+ RefPtr<InspectorObject> attributes = buildObjectForAttributesStyle(element);
+ attributesStyle = attributes ? attributes.release() : 0;
}
void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<InspectorArray>& style)
@@ -862,26 +863,17 @@
return result.release();
}
-PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element* element)
+PassRefPtr<InspectorObject> InspectorCSSAgent::buildObjectForAttributesStyle(Element* element)
{
- // FIXME: Since we no longer have per-attribute style declarations, we should come up
- // with a nicer way to present what we do have.
-
if (!element->isStyledElement())
- return InspectorArray::create();
+ return 0;
StylePropertySet* attributeStyle = static_cast<StyledElement*>(element)->attributeStyle();
if (!attributeStyle)
- return InspectorArray::create();
+ return 0;
- RefPtr<InspectorObject> attrStyleObject = InspectorObject::create();
RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attributeStyle->ensureCSSStyleDeclaration(), 0);
- attrStyleObject->setString("name", "");
- attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle());
-
- RefPtr<InspectorArray> attrStyles = InspectorArray::create();
- attrStyles->pushObject(attrStyleObject.release());
- return attrStyles.release();
+ return inspectorStyle->buildObjectForStyle();
}
void InspectorCSSAgent::didRemoveDocument(Document* document)
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.h (107219 => 107220)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.h 2012-02-09 12:41:37 UTC (rev 107220)
@@ -76,7 +76,7 @@
void mediaQueryResultChanged();
virtual void getComputedStyleForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<InspectorArray>& style);
- virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorArray>& attributes);
+ virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorObject>& attributes);
virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, const bool* includePseudo, const bool* includeInherited, RefPtr<InspectorArray>& matchedCSSRules, RefPtr<InspectorArray>& pseudoIdRules, RefPtr<InspectorArray>& inheritedEntries);
virtual void getAllStyleSheets(ErrorString*, RefPtr<InspectorArray>& styleSheetInfos);
virtual void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorObject>& result);
@@ -121,7 +121,7 @@
String detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
PassRefPtr<InspectorArray> buildArrayForRuleList(CSSRuleList* ruleList);
- PassRefPtr<InspectorArray> buildArrayForAttributeStyles(Element*);
+ PassRefPtr<InspectorObject> buildObjectForAttributesStyle(Element*);
// InspectorDOMAgent::DOMListener interface
virtual void didRemoveDocument(Document*);
Modified: trunk/Source/WebCore/inspector/front-end/AuditRules.js (107219 => 107220)
--- trunk/Source/WebCore/inspector/front-end/AuditRules.js 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/front-end/AuditRules.js 2012-02-09 12:41:37 UTC (rev 107220)
@@ -729,8 +729,10 @@
return;
}
- var widthFound = "width" in styles.styleAttributes;
- var heightFound = "height" in styles.styleAttributes;
+ if (styles.attributesStyle) {
+ var widthFound = !!styles.attributesStyle.getLiveProperty("width");
+ var heightFound = !!styles.attributesStyle.getLiveProperty("height");
+ }
var inlineStyle = styles.inlineStyle;
if (inlineStyle) {
@@ -765,10 +767,10 @@
return;
var targetResult = {};
- function inlineCallback(inlineStyle, styleAttributes)
+ function inlineCallback(inlineStyle, attributesStyle)
{
targetResult.inlineStyle = inlineStyle;
- targetResult.styleAttributes = styleAttributes;
+ targetResult.attributesStyle = attributesStyle;
}
function matchedCallback(result)
Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (107219 => 107220)
--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js 2012-02-09 12:41:37 UTC (rev 107220)
@@ -132,28 +132,19 @@
/**
* @param {DOMAgent.NodeId} nodeId
- * @param {function(?WebInspector.CSSStyleDeclaration, ?Object.<string, string>)} userCallback
+ * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
*/
getInlineStylesAsync: function(nodeId, userCallback)
{
/**
- * @param {function(?WebInspector.CSSStyleDeclaration, ?Object.<string, string>)} userCallback
+ * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
*/
- function callback(userCallback, error, inlinePayload, attributesPayload)
+ function callback(userCallback, error, inlinePayload, attributesStylePayload)
{
if (error || !inlinePayload)
userCallback(null, null);
- else {
- var styleAttributes;
- if (attributesPayload) {
- styleAttributes = {};
- for (var i = 0; i < attributesPayload.length; ++i) {
- var name = attributesPayload[i].name;
- styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(attributesPayload[i].style);
- }
- }
- userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), styleAttributes || null);
- }
+ else
+ userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload) : null);
}
CSSAgent.getInlineStylesForNode(nodeId, callback.bind(null, userCallback));
Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (107219 => 107220)
--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2012-02-09 12:33:44 UTC (rev 107219)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2012-02-09 12:41:37 UTC (rev 107220)
@@ -250,10 +250,10 @@
callback();
}
- function inlineCallback(inlineStyle, styleAttributes)
+ function inlineCallback(inlineStyle, attributesStyle)
{
resultStyles.inlineStyle = inlineStyle;
- resultStyles.styleAttributes = styleAttributes;
+ resultStyles.attributesStyle = attributesStyle;
}
function computedCallback(computedStyle)
@@ -436,16 +436,13 @@
var styleRules = [];
- function addStyleAttributes()
+ function addAttributesStyle()
{
- for (var name in styles.styleAttributes) {
- var attrStyle = { style: styles.styleAttributes[name], editable: false };
- attrStyle.selectorText = node.nodeNameInCorrectCase() + "[" + name;
- if (node.getAttribute(name))
- attrStyle.selectorText += "=" + node.getAttribute(name);
- attrStyle.selectorText += "]";
- styleRules.push(attrStyle);
- }
+ if (!styles.attributesStyle)
+ return;
+ var attrStyle = { style: styles.attributesStyle, editable: false };
+ attrStyle.selectorText = node.nodeNameInCorrectCase() + "[" + WebInspector.UIString("Attributes Style") + "]";
+ styleRules.push(attrStyle);
}
styleRules.push({ computedStyle: true, selectorText: "", style: nodeComputedStyle, editable: false });
@@ -459,21 +456,21 @@
// Add rules in reverse order to match the cascade order.
if (styles.matchedCSSRules.length)
styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") });
- var addedStyleAttributes;
+ var addedAttributesStyle;
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;
- if ((rule.isUser || rule.isUserAgent) && !addedStyleAttributes) {
+ if ((rule.isUser || rule.isUserAgent) && !addedAttributesStyle) {
// Show element's Style Attributes after all author rules.
- addedStyleAttributes = true;
- addStyleAttributes();
+ addedAttributesStyle = true;
+ addAttributesStyle();
}
styleRules.push({ style: rule.style, selectorText: rule.selectorText, media: rule.media, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
}
- if (!addedStyleAttributes)
- addStyleAttributes();
+ if (!addedAttributesStyle)
+ addAttributesStyle();
// Walk the node structure and identify styles with inherited properties.
var parentNode = node.parentNode;