Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: Source/core/svg/SVGElement.cpp

Issue 144733003: Let svg event attributes be reflected the same as html event attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGElement.cpp
diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp
index 2c6330373c52ee3c9a3585b6e91146b4378b72c6..b00bbde44f0094bcea18055dee08a4af03cb4dcd 100644
--- a/Source/core/svg/SVGElement.cpp
+++ b/Source/core/svg/SVGElement.cpp
@@ -34,8 +34,9 @@
#include "core/css/parser/BisonCSSParser.h"
#include "core/dom/Document.h"
#include "core/dom/ElementTraversal.h"
-#include "core/events/Event.h"
#include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/Event.h"
+#include "core/html/HTMLElement.h"
#include "core/rendering/RenderObject.h"
#include "core/rendering/svg/RenderSVGResourceContainer.h"
#include "core/svg/SVGCursorElement.h"
@@ -651,48 +652,20 @@ void SVGElement::setCorrespondingElement(SVGElement* correspondingElement)
void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
- // standard events
- if (name == onloadAttr)
- setAttributeEventListener(EventTypeNames::load, createAttributeEventListener(this, name, value));
- else if (name == onclickAttr)
- setAttributeEventListener(EventTypeNames::click, createAttributeEventListener(this, name, value));
- else if (name == onmousedownAttr)
- setAttributeEventListener(EventTypeNames::mousedown, createAttributeEventListener(this, name, value));
- else if (name == onmouseenterAttr)
- setAttributeEventListener(EventTypeNames::mouseenter, createAttributeEventListener(this, name, value));
- else if (name == onmouseleaveAttr)
- setAttributeEventListener(EventTypeNames::mouseleave, createAttributeEventListener(this, name, value));
- else if (name == onmousemoveAttr)
- setAttributeEventListener(EventTypeNames::mousemove, createAttributeEventListener(this, name, value));
- else if (name == onmouseoutAttr)
- setAttributeEventListener(EventTypeNames::mouseout, createAttributeEventListener(this, name, value));
- else if (name == onmouseoverAttr)
- setAttributeEventListener(EventTypeNames::mouseover, createAttributeEventListener(this, name, value));
- else if (name == onmouseupAttr)
- setAttributeEventListener(EventTypeNames::mouseup, createAttributeEventListener(this, name, value));
- else if (name == SVGNames::onfocusinAttr)
- setAttributeEventListener(EventTypeNames::focusin, createAttributeEventListener(this, name, value));
- else if (name == SVGNames::onfocusoutAttr)
- setAttributeEventListener(EventTypeNames::focusout, createAttributeEventListener(this, name, value));
- else if (name == SVGNames::onactivateAttr)
- setAttributeEventListener(EventTypeNames::DOMActivate, createAttributeEventListener(this, name, value));
- else if (name == HTMLNames::classAttr) {
+ if (name == HTMLNames::classAttr) {
// SVG animation has currently requires special storage of values so we set
// the className here. svgAttributeChanged actually causes the resulting
// style updates (instead of Element::parseAttribute). We don't
// tell Element about the change to avoid parsing the class list twice
setClassNameBaseValue(value);
- } else if (name == ontouchstartAttr) {
- setAttributeEventListener(EventTypeNames::touchstart, createAttributeEventListener(this, name, value));
- } else if (name == ontouchmoveAttr) {
- setAttributeEventListener(EventTypeNames::touchmove, createAttributeEventListener(this, name, value));
- } else if (name == ontouchendAttr) {
- setAttributeEventListener(EventTypeNames::touchend, createAttributeEventListener(this, name, value));
- } else if (name == ontouchcancelAttr) {
- setAttributeEventListener(EventTypeNames::touchcancel, createAttributeEventListener(this, name, value));
} else if (name.matches(XMLNames::langAttr) || name.matches(XMLNames::spaceAttr)) {
} else {
- Element::parseAttribute(name, value);
+ // standard events
+ const AtomicString& eventName = HTMLElement::eventNameForAttributeName(name);
+ if (!eventName.isNull())
+ setAttributeEventListener(eventName, createAttributeEventListener(this, name, value));
+ else
+ Element::parseAttribute(name, value);
}
}
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698