https://bugs.webkit.org/show_bug.cgi?id=79025
Reviewed by Pavel Feldman.
Source/WebCore:
* dom/Element.cpp:
(WebCore::Element::willModifyAttribute):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::InspectorDOMAgent):
(WebCore::InspectorDOMAgent::willModifyDOMAttr):
(WebCore):
(WebCore::InspectorDOMAgent::didModifyDOMAttr):
* inspector/InspectorDOMAgent.h:
(InspectorDOMAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::willModifyDOMAttr):
LayoutTests:
* inspector/elements/set-attribute-expected.txt:
* inspector/elements/set-attribute.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108235
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-20 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: DOMAttrModified should not be fired if the attribute value remains the same
+ https://bugs.webkit.org/show_bug.cgi?id=79025
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/elements/set-attribute-expected.txt:
+ * inspector/elements/set-attribute.html:
+
2012-02-20 Yosifumi Inoue <yosin@chromium.org>
[Forms] Spin buttons of number input type should fire both input and change event
===== On attribute set =====
<div id="node" name="value"></div>
+Running: testAttributeSameValueNotUpdated
+===== On attribute modified (should be 'newValue') =====
+ <div id="node" name="newValue"></div>
+
Running: testAttributeRemoved
=== On attribute removed ===
<div id="node"></div>
InspectorTest.evaluateInPage("setAttribute('name', 'value')");
},
+ function testAttributeSameValueNotUpdated(next)
+ {
+ function callback()
+ {
+ InspectorTest.addResult("===== On attribute modified (should be 'newValue') =====");
+ InspectorTest.dumpElementsTree(targetNode);
+ WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ next();
+ }
+ WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModified, callback);
+ // Setting the same property value should not result in the AttrModified event.
+ InspectorTest.evaluateInPage("setAttribute('name', 'value')");
+ InspectorTest.evaluateInPage("setAttribute('name', 'value')");
+ InspectorTest.evaluateInPage("setAttribute('name', 'newValue')");
+ },
+
function testAttributeRemoved(next)
{
function callback()
+2012-02-20 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: DOMAttrModified should not be fired if the attribute value remains the same
+ https://bugs.webkit.org/show_bug.cgi?id=79025
+
+ Reviewed by Pavel Feldman.
+
+ * dom/Element.cpp:
+ (WebCore::Element::willModifyAttribute):
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::InspectorDOMAgent):
+ (WebCore::InspectorDOMAgent::willModifyDOMAttr):
+ (WebCore):
+ (WebCore::InspectorDOMAgent::didModifyDOMAttr):
+ * inspector/InspectorDOMAgent.h:
+ (InspectorDOMAgent):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ (WebCore::InspectorInstrumentation::willModifyDOMAttr):
+
2012-02-20 Kwonjin Jeong <gram@company100.net>
Correct a typo error in ScrollingCoordinator.h
#if ENABLE(INSPECTOR)
if (!isSynchronizingStyleAttribute())
- InspectorInstrumentation::willModifyDOMAttr(document(), this);
+ InspectorInstrumentation::willModifyDOMAttr(document(), this, oldValue, newValue);
#endif
}
, m_domListener(0)
, m_lastNodeId(1)
, m_searchingForNode(false)
+ , m_suppressAttributeModifiedEvent(false)
{
}
unbind(node, &m_documentNodeToIdMap);
}
+void InspectorDOMAgent::willModifyDOMAttr(Element* element, const AtomicString& oldValue, const AtomicString& newValue)
+{
+ m_suppressAttributeModifiedEvent = (oldValue == newValue);
+}
+
void InspectorDOMAgent::didModifyDOMAttr(Element* element, const AtomicString& name, const AtomicString& value)
{
+ bool shouldSuppressEvent = m_suppressAttributeModifiedEvent;
+ m_suppressAttributeModifiedEvent = false;
+ if (shouldSuppressEvent)
+ return;
+
int id = boundNodeId(element);
// If node is not mapped yet -> ignore the event.
if (!id)
void didInsertDOMNode(Node*);
void didRemoveDOMNode(Node*);
+ void willModifyDOMAttr(Element*, const AtomicString& oldValue, const AtomicString& newValue);
void didModifyDOMAttr(Element*, const AtomicString& name, const AtomicString& value);
void didRemoveDOMAttr(Element*, const AtomicString& name);
void styleAttributeInvalidated(const Vector<Element*>& elements);
bool m_searchingForNode;
OwnPtr<InspectorHistory> m_history;
OwnPtr<DOMEditor> m_domEditor;
+ bool m_suppressAttributeModifiedEvent;
};
#endif // ENABLE(INSPECTOR)
domAgent->didRemoveDOMNode(node);
}
-void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element)
+void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents* instrumentingAgents, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
{
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents->inspectorDOMDebuggerAgent())
domDebuggerAgent->willModifyDOMAttr(element);
+ if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+ domAgent->willModifyDOMAttr(element, oldValue, newValue);
#endif
}
static void willInsertDOMNode(Document*, Node*, Node* parent);
static void didInsertDOMNode(Document*, Node*);
static void willRemoveDOMNode(Document*, Node*);
- static void willModifyDOMAttr(Document*, Element*);
+ static void willModifyDOMAttr(Document*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
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 didInsertDOMNodeImpl(InstrumentingAgents*, Node*);
static void willRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
static void didRemoveDOMNodeImpl(InstrumentingAgents*, Node*);
- static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*);
+ static void willModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& oldValue, const AtomicString& newValue);
static void didModifyDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name, const AtomicString& value);
static void didRemoveDOMAttrImpl(InstrumentingAgents*, Element*, const AtomicString& name);
static void characterDataModifiedImpl(InstrumentingAgents*, CharacterData*);
#endif
}
-inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element)
+inline void InspectorInstrumentation::willModifyDOMAttr(Document* document, Element* element, const AtomicString& oldValue, const AtomicString& newValue)
{
#if ENABLE(INSPECTOR)
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
- willModifyDOMAttrImpl(instrumentingAgents, element);
+ willModifyDOMAttrImpl(instrumentingAgents, element, oldValue, newValue);
#endif
}