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

Unified Diff: Source/bindings/v8/ScriptEventListener.cpp

Issue 321023002: Avoid branching in createAttributeEventListener (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 6 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/bindings/v8/ScriptEventListener.h ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptEventListener.cpp
diff --git a/Source/bindings/v8/ScriptEventListener.cpp b/Source/bindings/v8/ScriptEventListener.cpp
index 87a3fcb28ca0399bc19ffb9c2780dfcf96a767e1..f720c88a02196c22ce9e6afad6b148f286dc772c 100644
--- a/Source/bindings/v8/ScriptEventListener.cpp
+++ b/Source/bindings/v8/ScriptEventListener.cpp
@@ -44,14 +44,7 @@
namespace WebCore {
-static const AtomicString& eventParameterName(bool isSVGEvent)
-{
- DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event"));
- DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
- return isSVGEvent ? evtString : eventString;
-}
-
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const QualifiedName& name, const AtomicString& value)
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const QualifiedName& name, const AtomicString& value, const AtomicString& eventParameterName)
{
ASSERT(node);
if (value.isNull())
@@ -73,10 +66,10 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const Q
isolate = v8::Isolate::GetCurrent();
}
- return V8LazyEventListener::create(name.localName(), eventParameterName(node->isSVGElement()), value, sourceURL, position, node, isolate);
+ return V8LazyEventListener::create(name.localName(), eventParameterName, value, sourceURL, position, node, isolate);
}
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(LocalFrame* frame, const QualifiedName& name, const AtomicString& value)
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(LocalFrame* frame, const QualifiedName& name, const AtomicString& value, const AtomicString& eventParameterName)
{
if (!frame)
return nullptr;
@@ -91,7 +84,7 @@ PassRefPtr<V8LazyEventListener> createAttributeEventListener(LocalFrame* frame,
TextPosition position = scriptController.eventHandlerPosition();
String sourceURL = frame->document()->url().string();
- return V8LazyEventListener::create(name.localName(), eventParameterName(frame->document()->isSVGDocument()), value, sourceURL, position, 0, toIsolate(frame));
+ return V8LazyEventListener::create(name.localName(), eventParameterName, value, sourceURL, position, 0, toIsolate(frame));
}
static v8::Handle<v8::Function> eventListenerEffectiveFunction(v8::Isolate* isolate, v8::Handle<v8::Object> listenerObject)
« no previous file with comments | « Source/bindings/v8/ScriptEventListener.h ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698