Diff
Modified: trunk/LayoutTests/ChangeLog (96105 => 96106)
--- trunk/LayoutTests/ChangeLog 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/LayoutTests/ChangeLog 2011-09-27 14:13:07 UTC (rev 96106)
@@ -1,3 +1,13 @@
+2011-09-27 Pavel Feldman <[email protected]>
+
+ Web Inspector: split DOM.attributesUpdated into attributeModified and attributeRemoved. Send attribute name and value within the event.
+ https://bugs.webkit.org/show_bug.cgi?id=68613
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/elements/mutate-unknown-node.html-disabled:
+ * inspector/elements/set-attribute.html:
+
2011-09-27 Shinichiro Hamaji <[email protected]>
[Chromium] Layout Test fast/canvas/canvas-composite-transformclip.html is failing
Modified: trunk/LayoutTests/inspector/elements/mutate-unknown-node.html-disabled (96105 => 96106)
--- trunk/LayoutTests/inspector/elements/mutate-unknown-node.html-disabled 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/LayoutTests/inspector/elements/mutate-unknown-node.html-disabled 2011-09-27 14:13:07 UTC (rev 96106)
@@ -28,6 +28,7 @@
{
function listener(type, event)
{
+ node = event.data.node || event.data;
InspectorTest.addResult("DOMAgent event fired. Should only happen once for output node: " + type + " " + event.data.nodeName() + "#" + event.data.getAttribute("id"));
}
Modified: trunk/LayoutTests/inspector/elements/set-attribute.html (96105 => 96106)
--- trunk/LayoutTests/inspector/elements/set-attribute.html 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/LayoutTests/inspector/elements/set-attribute.html 2011-09-27 14:13:07 UTC (rev 96106)
@@ -50,12 +50,12 @@
{
function callback()
{
- WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
InspectorTest.addResult("=== On attribute removed ===");
InspectorTest.dumpElementsTree(targetNode);
next();
}
- WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
InspectorTest.evaluateInPage("removeAttribute('name')");
},
@@ -76,12 +76,12 @@
{
function callback()
{
- WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
InspectorTest.addResult("=== Set attribute as text ===");
InspectorTest.dumpElementsTree(targetNode);
next();
}
- WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
targetNode.setAttribute("foo", "foo2='baz2' foo3='baz3'");
},
@@ -89,12 +89,12 @@
{
function callback()
{
- WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
InspectorTest.addResult("=== Remove attribute as text ===");
InspectorTest.dumpElementsTree(targetNode);
next();
}
- WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, callback);
targetNode.setAttribute("foo3", "");
},
Modified: trunk/Source/WebCore/ChangeLog (96105 => 96106)
--- trunk/Source/WebCore/ChangeLog 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/ChangeLog 2011-09-27 14:13:07 UTC (rev 96106)
@@ -1,3 +1,51 @@
+2011-09-27 Pavel Feldman <[email protected]>
+
+ Web Inspector: split DOM.attributesUpdated into attributeModified and attributeRemoved.
+ Send attribute name and value within the event.
+ https://bugs.webkit.org/show_bug.cgi?id=68613
+
+ Reviewed by Yury Semikhatsky.
+
+ * dom/Element.cpp:
+ (WebCore::Element::setAttribute):
+ (WebCore::Element::removeAttribute):
+ * inspector/Inspector.draft-01.json:
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::didModifyDOMAttr):
+ (WebCore::InspectorDOMAgent::didRemoveDOMAttr):
+ * inspector/InspectorDOMAgent.h:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl):
+ (WebCore::InspectorInstrumentation::didRemoveDOMAttrImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didModifyDOMAttr):
+ (WebCore::InspectorInstrumentation::didRemoveDOMAttr):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMNode.prototype._addAttribute):
+ (WebInspector.DOMNode.prototype._setAttribute):
+ (WebInspector.DOMNode.prototype._removeAttribute):
+ (WebInspector.DOMAgent.prototype._attributeModified):
+ (WebInspector.DOMAgent.prototype._attributeRemoved):
+ (WebInspector.DOMAgent.prototype._inlineStyleInvalidated):
+ (WebInspector.DOMAgent.prototype._loadNodeAttributes):
+ (WebInspector.DOMDispatcher.prototype.attributeModified):
+ (WebInspector.DOMDispatcher.prototype.attributeRemoved):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel):
+ (WebInspector.ElementsPanel.prototype._attributesUpdated):
+ * inspector/front-end/MetricsSidebarPane.js:
+ (WebInspector.MetricsSidebarPane):
+ (WebInspector.MetricsSidebarPane.prototype._attributesUpdated):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane):
+ (WebInspector.StylesSidebarPane.prototype._attributesModified):
+ (WebInspector.StylesSidebarPane.prototype._attributesRemoved):
+ (WebInspector.StylesSidebarPane.prototype._styleInvalidated):
+ (WebInspector.StylePropertyTreeElement.prototype.event):
+ (WebInspector.StylePropertyTreeElement.prototype):
+ * inspector/validate-protocol-compatibility:
+
2011-09-27 Sheriff Bot <[email protected]>
Unreviewed, rolling out r96070 and r96075.
Modified: trunk/Source/WebCore/dom/Element.cpp (96105 => 96106)
--- trunk/Source/WebCore/dom/Element.cpp 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/dom/Element.cpp 2011-09-27 14:13:07 UTC (rev 96106)
@@ -646,7 +646,7 @@
#if ENABLE(INSPECTOR)
if (!isSynchronizingStyleAttribute())
- InspectorInstrumentation::didModifyDOMAttr(document(), this);
+ InspectorInstrumentation::didModifyDOMAttr(document(), this, name, value);
#endif
}
@@ -679,7 +679,7 @@
#if ENABLE(INSPECTOR)
if (!isSynchronizingStyleAttribute())
- InspectorInstrumentation::didModifyDOMAttr(document(), this);
+ InspectorInstrumentation::didModifyDOMAttr(document(), this, name.localName(), value);
#endif
}
@@ -1511,7 +1511,7 @@
ec = 0;
}
- InspectorInstrumentation::didModifyDOMAttr(document(), this);
+ InspectorInstrumentation::didRemoveDOMAttr(document(), this, name);
}
void Element::removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode& ec)
Modified: trunk/Source/WebCore/inspector/Inspector.draft-01.json (96105 => 96106)
--- trunk/Source/WebCore/inspector/Inspector.draft-01.json 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/Inspector.draft-01.json 2011-09-27 14:13:07 UTC (rev 96106)
@@ -1176,18 +1176,29 @@
"description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids."
},
{
- "name": "attributesUpdated",
+ "name": "attributeModified",
"parameters": [
- { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." }
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "Attribute name." },
+ { "name": "value", "type": "string", "description": "Attribute value." }
],
- "description": "Fired when <code>Element</code>'s attributes are updated."
+ "description": "Fired when <code>Element</code>'s attribute is modified."
},
{
+ "name": "attributeRemoved",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "Local attribute name." }
+ ],
+ "description": "Fired when <code>Element</code>'s attribute is removed."
+ },
+ {
"name": "inlineStyleInvalidated",
"parameters": [
{ "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "description": "Ids of the nodes for which the inline styles have been invalidated." }
],
- "description": "Fired when <code>Element</code>'s inline style is modified via a CSS property modification."
+ "description": "Fired when <code>Element</code>'s inline style is modified via a CSS property modification.",
+ "hidden": true
},
{
"name": "characterDataModified",
Modified: trunk/Source/WebCore/inspector/Inspector.json (96105 => 96106)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-09-27 14:13:07 UTC (rev 96106)
@@ -1176,18 +1176,29 @@
"description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids."
},
{
- "name": "attributesUpdated",
+ "name": "attributeModified",
"parameters": [
- { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." }
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "Attribute name." },
+ { "name": "value", "type": "string", "description": "Attribute value." }
],
- "description": "Fired when <code>Element</code>'s attributes are updated."
+ "description": "Fired when <code>Element</code>'s attribute is modified."
},
{
+ "name": "attributeRemoved",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "Local attribute name." }
+ ],
+ "description": "Fired when <code>Element</code>'s attribute is removed."
+ },
+ {
"name": "inlineStyleInvalidated",
"parameters": [
{ "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "description": "Ids of the nodes for which the inline styles have been invalidated." }
],
- "description": "Fired when <code>Element</code>'s inline style is modified via a CSS property modification."
+ "description": "Fired when <code>Element</code>'s inline style is modified via a CSS property modification.",
+ "hidden": true
},
{
"name": "characterDataModified",
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (96105 => 96106)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2011-09-27 14:13:07 UTC (rev 96106)
@@ -1447,7 +1447,7 @@
unbind(node, &m_documentNodeToIdMap);
}
-void InspectorDOMAgent::didModifyDOMAttr(Element* element)
+void InspectorDOMAgent::didModifyDOMAttr(Element* element, const AtomicString& name, const AtomicString& value)
{
int id = boundNodeId(element);
// If node is not mapped yet -> ignore the event.
@@ -1457,9 +1457,22 @@
if (m_domListener)
m_domListener->didModifyDOMAttr(element);
- m_frontend->attributesUpdated(id);
+ m_frontend->attributeModified(id, name, value);
}
+void InspectorDOMAgent::didRemoveDOMAttr(Element* element, const AtomicString& name)
+{
+ int id = boundNodeId(element);
+ // If node is not mapped yet -> ignore the event.
+ if (!id)
+ return;
+
+ if (m_domListener)
+ m_domListener->didModifyDOMAttr(element);
+
+ m_frontend->attributeRemoved(id, name);
+}
+
void InspectorDOMAgent::styleAttributeInvalidated(const Vector<Element*>& elements)
{
RefPtr<InspectorArray> nodeIds = InspectorArray::create();
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (96105 => 96106)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2011-09-27 14:13:07 UTC (rev 96106)
@@ -150,7 +150,8 @@
void didInsertDOMNode(Node*);
void didRemoveDOMNode(Node*);
- void didModifyDOMAttr(Element*);
+ void didModifyDOMAttr(Element*, const AtomicString& name, const AtomicString& value);
+ void didRemoveDOMAttr(Element*, const AtomicString& name);
void styleAttributeInvalidated(const Vector<Element*>& elements);
void characterDataModified(CharacterData*);
void didInvalidateStyleAttr(Node*);
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (96105 => 96106)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-09-27 14:13:07 UTC (rev 96106)
@@ -146,12 +146,18 @@
#endif
}
-void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element)
+void InspectorInstrumentation::didModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name, const AtomicString& value)
{
if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
- domAgent->didModifyDOMAttr(element);
+ domAgent->didModifyDOMAttr(element, name, value);
}
+void InspectorInstrumentation::didRemoveDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& name)
+{
+ if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+ domAgent->didRemoveDOMAttr(element, name);
+}
+
void InspectorInstrumentation::didInvalidateStyleAttrImpl(InstrumentingAgents* instrumentingAgents, Node* node)
{
if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (96105 => 96106)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-09-27 14:13:07 UTC (rev 96106)
@@ -81,7 +81,8 @@
static void didInsertDOMNode(Document*, Node*);
static void willRemoveDOMNode(Document*, Node*);
static void willModifyDOMAttr(Document*, Element*);
- static void didModifyDOMAttr(Document*, Element*);
+ static void didModifyDOMAttr(Document*, Element*, const AtomicString& name, const AtomicString& value);
+ static void didRemoveDOMAttr(Document*, Element*, const AtomicString& name);
static void characterDataModified(Document*, CharacterData*);
static void didInvalidateStyleAttr(Document*, Node*);
static void frameWindowDiscarded(Frame*, DOMWindow*);
@@ -211,7 +212,8 @@
static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*);
- static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*);
+ static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
+ static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
static void didInvalidateStyleAttrImpl(InstrumentingAgents*, Node*);
static void frameWindowDiscardedImpl(InstrumentingAgents*, DOMWindow*);
@@ -390,15 +392,24 @@
#endif
}
-inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element)
+inline void InspectorInstrumentation::didModifyDOMAttr(Document* document, Element* element, const AtomicString& name, const AtomicString& value)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
- didModifyDOMAttrImpl(instrumentingAgents, element);
+ didModifyDOMAttrImpl(instrumentingAgents, element, name, value);
#endif
}
+inline void InspectorInstrumentation::didRemoveDOMAttr(Document* document, Element* element, const AtomicString& name)
+{
+#if ENABLE(INSPECTOR)
+ FAST_RETURN_IF_NO_FRONTENDS(void());
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+ didRemoveDOMAttrImpl(instrumentingAgents, element, name);
+#endif
+}
+
inline void InspectorInstrumentation::didInvalidateStyleAttr(Document* document, Node* node)
{
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (96105 => 96106)
--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2011-09-27 14:13:07 UTC (rev 96106)
@@ -330,14 +330,32 @@
_addAttribute: function(name, value)
{
var attr = {
- "name": name,
- "value": value,
- "_node": this
+ name: name,
+ value: value,
+ _node: this
};
this._attributesMap[name] = attr;
this._attributes.push(attr);
},
+ _setAttribute: function(name, value)
+ {
+ var attr = this._attributesMap[name];
+ if (attr)
+ attr.value = value;
+ else
+ this._addAttribute(name, value);
+ },
+
+ _removeAttribute: function(name)
+ {
+ var attr = this._attributesMap[name];
+ if (attr) {
+ this._attributes.remove(attr);
+ delete this._attributesMap[name];
+ }
+ },
+
ownerDocumentElement: function()
{
// document element is the child of the document / frame owner node that has documentURL property.
@@ -380,12 +398,14 @@
WebInspector.DOMAgent.Events = {
AttrModified: "AttrModified",
+ AttrRemoved: "AttrRemoved",
CharacterDataModified: "CharacterDataModified",
NodeInserted: "NodeInserted",
NodeRemoved: "NodeRemoved",
DocumentUpdated: "DocumentUpdated",
ChildNodeCountUpdated: "ChildNodeCountUpdated",
- InspectElementRequested: "InspectElementRequested"
+ InspectElementRequested: "InspectElementRequested",
+ StyleInvalidated: "StyleInvalidated"
}
WebInspector.DOMAgent.prototype = {
@@ -464,18 +484,25 @@
this.requestDocument(onDocumentAvailable.bind(this));
},
- _attributesUpdated: function(nodeIds)
+ _attributeModified: function(nodeId, name, value)
{
- this._loadNodeAttributesSoon(nodeIds);
+ var node = this._idToDOMNode[nodeId];
+ if (!node)
+ return;
+ node._setAttribute(name, value);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: name });
},
- _inlineStyleInvalidated: function(nodeIds)
+ _attributeRemoved: function(nodeId, name)
{
- // FIXME: handle differently (we don't necessarily need to update attributes upon this message).
- this._loadNodeAttributesSoon(nodeIds);
+ var node = this._idToDOMNode[nodeId];
+ if (!node)
+ return;
+ node._removeAttribute(name);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrRemoved, { node: node, name: name });
},
- _loadNodeAttributesSoon: function(nodeIds)
+ _inlineStyleInvalidated: function(nodeIds)
{
for (var i = 0; i < nodeIds.length; ++i)
this._attributeLoadNodeIds[nodeIds[i]] = true;
@@ -493,7 +520,8 @@
var node = this._idToDOMNode[nodeId];
if (node) {
node._setAttributesPayload(attributes);
- this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, node);
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: "style" });
+ this.dispatchEventToListeners(WebInspector.DOMAgent.Events.StyleInvalidated, node);
}
}
@@ -641,11 +669,16 @@
this._domAgent._documentUpdated();
},
- attributesUpdated: function(nodeId)
+ attributeModified: function(nodeId, name, value)
{
- this._domAgent._attributesUpdated([nodeId]);
+ this._domAgent._attributeModified(nodeId, name, value);
},
+ attributeRemoved: function(nodeId, name)
+ {
+ this._domAgent._attributeRemoved(nodeId, name);
+ },
+
inlineStyleInvalidated: function(nodeIds)
{
this._domAgent._inlineStyleInvalidated(nodeIds);
Modified: trunk/Source/WebCore/inspector/front-end/ElementsPanel.js (96105 => 96106)
--- trunk/Source/WebCore/inspector/front-end/ElementsPanel.js 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/front-end/ElementsPanel.js 2011-09-27 14:13:07 UTC (rev 96106)
@@ -116,6 +116,7 @@
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeInserted, this._nodeInserted, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemoved, this._nodeRemoved, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, this._attributesUpdated, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.CharacterDataModified, this._characterDataModified, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, this._childNodeCountUpdated, this);
@@ -412,7 +413,7 @@
_attributesUpdated: function(event)
{
- this.recentlyModifiedNodes.push({node: event.data, updated: true});
+ this.recentlyModifiedNodes.push({node: event.data.node, updated: true});
if (this.visible)
this._updateModifiedNodesSoon();
},
Modified: trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js (96105 => 96106)
--- trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js 2011-09-27 14:13:07 UTC (rev 96106)
@@ -32,6 +32,7 @@
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, this._attributesUpdated, this);
}
WebInspector.MetricsSidebarPane.prototype = {
@@ -76,7 +77,7 @@
_attributesUpdated: function(event)
{
- if (this.node !== event.data)
+ if (this.node !== event.data.node)
return;
// "style" attribute might have changed. Update metrics unless they are being edited.
Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (96105 => 96106)
--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-09-27 14:13:07 UTC (rev 96106)
@@ -86,7 +86,9 @@
this.bodyElement.appendChild(this._sectionsContainer);
WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
- WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesUpdated, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, this._attributesModified, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemoved, this._attributesRemoved, this);
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.StyleInvalidated, this._styleInvalidated, this);
WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAgentStylesSettingChanged.bind(this));
}
@@ -277,12 +279,35 @@
this._innerUpdate(false);
},
- _attributesUpdated: function(event)
+ _attributesModified: function(event)
{
+ if (this.node !== event.data.node)
+ return;
+
+ // Changing style attribute will anyways generate _styleInvalidated message.
+ if (event.data.name === "style")
+ return;
+
+ // "class" (or any other) attribute might have changed. Update styles unless they are being edited.
+ if (!this._isEditingStyle && !this._userOperation)
+ this._innerUpdate(false);
+ },
+
+ _attributesRemoved: function(event)
+ {
+ if (this.node !== event.data.node)
+ return;
+
+ // "style" attribute might have been removed.
+ if (!this._isEditingStyle && !this._userOperation)
+ this._innerUpdate(false);
+ },
+
+ _styleInvalidated: function(event)
+ {
if (this.node !== event.data)
return;
- // "style" attribute might have changed. Update styles unless they are being edited.
if (!this._isEditingStyle && !this._userOperation)
this._innerUpdate(false);
},
@@ -1674,8 +1699,11 @@
this.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
this._updatePane();
+
+ delete this._parentPane._userOperation;
}
+ this._parentPane._userOperation = true;
this.property.setDisabled(disabled, callback.bind(this));
},
Modified: trunk/Source/WebCore/inspector/validate-protocol-compatibility (96105 => 96106)
--- trunk/Source/WebCore/inspector/validate-protocol-compatibility 2011-09-27 14:09:00 UTC (rev 96105)
+++ trunk/Source/WebCore/inspector/validate-protocol-compatibility 2011-09-27 14:13:07 UTC (rev 96106)
@@ -310,7 +310,10 @@
schema_1 = load_json(sys.argv[1])
schema_2 = load_json(sys.argv[2])
- compare_schemas(schema_1, schema_2)
+ errors = compare_schemas(schema_1, schema_2)
+ for error in errors:
+ print error
+
if __name__ == '__main__':
sys.exit(main())