2009-04-24 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2009 22:00:44 +0000 (22:00 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Apr 2009 22:00:44 +0000 (22:00 +0000)
        Reviewed by Eric Seidel.

        https://bugs.webkit.org/show_bug.cgi?id=25370
        Introduce ScriptEventListener to refactor away direct references to
        JSLazyEventListener in WebCore code.

        * GNUmakefile.am: Added ScriptEventListener to project.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * bindings/js/JSDOMGlobalObject.cpp: Removed unused JSLazyEventListener include.
        * bindings/js/JSLazyEventListener.cpp: Moved createAttributeEventListener helpers
            to ScriptEventListener.
        * bindings/js/JSLazyEventListener.h: Ditto.
        * bindings/js/ScriptController.cpp: Removed unused JSLazyEventListener include.
        * bindings/js/ScriptEventListener.cpp: Added.
        * bindings/js/ScriptEventListener.h: Added.
        * bindings/v8/ScriptEventListener.cpp: Added.
        * bindings/v8/ScriptEventListener.h: Added.
        * dom/Document.cpp: Renamed JSLazyEventListener include to ScriptEventListener.
        * html/HTMLBodyElement.cpp: Ditto.
        * html/HTMLButtonElement.cpp: Ditto.
        * html/HTMLElement.cpp: Ditto.
        * html/HTMLFormElement.cpp: Ditto.
        * html/HTMLFrameElementBase.cpp: Ditto.
        * html/HTMLFrameSetElement.cpp: Ditto.
        * html/HTMLImageElement.cpp: Ditto.
        * html/HTMLInputElement.cpp: Ditto.
        * html/HTMLObjectElement.cpp: Ditto.
        * html/HTMLScriptElement.cpp: Ditto.
        * html/HTMLSelectElement.cpp: Ditto.
        * html/HTMLTextAreaElement.cpp: Ditto.
        * svg/SVGElement.cpp: Ditto.
        * svg/SVGSVGElement.cpp: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42843 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSDOMGlobalObject.cpp
WebCore/bindings/js/JSLazyEventListener.cpp
WebCore/bindings/js/JSLazyEventListener.h
WebCore/bindings/js/ScriptController.cpp
WebCore/bindings/js/ScriptEventListener.cpp [new file with mode: 0644]
WebCore/bindings/js/ScriptEventListener.h [new file with mode: 0644]
WebCore/bindings/v8/ScriptEventListener.cpp [new file with mode: 0644]
WebCore/bindings/v8/ScriptEventListener.h [new file with mode: 0644]
WebCore/dom/Document.cpp
WebCore/html/HTMLBodyElement.cpp
WebCore/html/HTMLButtonElement.cpp
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLFormElement.cpp
WebCore/html/HTMLFrameElementBase.cpp
WebCore/html/HTMLFrameSetElement.cpp
WebCore/html/HTMLImageElement.cpp
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLObjectElement.cpp
WebCore/html/HTMLScriptElement.cpp
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLTextAreaElement.cpp
WebCore/svg/SVGElement.cpp
WebCore/svg/SVGSVGElement.cpp

index 8032e0f..5f32f2e 100644 (file)
@@ -1,3 +1,40 @@
+2009-04-24  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25370
+        Introduce ScriptEventListener to refactor away direct references to
+        JSLazyEventListener in WebCore code.
+
+        * GNUmakefile.am: Added ScriptEventListener to project.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * bindings/js/JSDOMGlobalObject.cpp: Removed unused JSLazyEventListener include.
+        * bindings/js/JSLazyEventListener.cpp: Moved createAttributeEventListener helpers
+            to ScriptEventListener.
+        * bindings/js/JSLazyEventListener.h: Ditto.
+        * bindings/js/ScriptController.cpp: Removed unused JSLazyEventListener include.
+        * bindings/js/ScriptEventListener.cpp: Added.
+        * bindings/js/ScriptEventListener.h: Added.
+        * bindings/v8/ScriptEventListener.cpp: Added.
+        * bindings/v8/ScriptEventListener.h: Added.
+        * dom/Document.cpp: Renamed JSLazyEventListener include to ScriptEventListener.
+        * html/HTMLBodyElement.cpp: Ditto.
+        * html/HTMLButtonElement.cpp: Ditto.
+        * html/HTMLElement.cpp: Ditto.
+        * html/HTMLFormElement.cpp: Ditto.
+        * html/HTMLFrameElementBase.cpp: Ditto.
+        * html/HTMLFrameSetElement.cpp: Ditto.
+        * html/HTMLImageElement.cpp: Ditto.
+        * html/HTMLInputElement.cpp: Ditto.
+        * html/HTMLObjectElement.cpp: Ditto.
+        * html/HTMLScriptElement.cpp: Ditto.
+        * html/HTMLSelectElement.cpp: Ditto.
+        * html/HTMLTextAreaElement.cpp: Ditto.
+        * svg/SVGElement.cpp: Ditto.
+        * svg/SVGSVGElement.cpp: Ditto.
+
 2009-04-24  Darin Adler  <darin@apple.com>
 
         Reviewed by Sam Weinig.
index 2693815..e6d3e7f 100644 (file)
@@ -372,6 +372,8 @@ webcore_sources += \
        WebCore/bindings/js/ScriptCallStack.h \
        WebCore/bindings/js/ScriptController.cpp \
        WebCore/bindings/js/ScriptController.h \
+       WebCore/bindings/js/ScriptEventListener.cpp \
+       WebCore/bindings/js/ScriptEventListener.h \
        WebCore/bindings/js/ScriptFunctionCall.cpp \
        WebCore/bindings/js/ScriptFunctionCall.h \
        WebCore/bindings/js/ScriptInstance.h \
index 6241173..b6781bc 100644 (file)
@@ -496,6 +496,7 @@ SOURCES += \
     bindings/js/ScriptCallFrame.cpp \
     bindings/js/ScriptCallStack.cpp \
     bindings/js/ScriptController.cpp \
+    bindings/js/ScriptEventListener.cpp \
     bindings/js/ScriptFunctionCall.cpp \
     bindings/js/ScriptObject.cpp \
     bindings/js/ScriptObjectQuarantine.cpp \
index 978cf51..336627a 100644 (file)
                                        >\r
                                </File>\r
                                <File\r
+                                       RelativePath="..\bindings\js\ScriptEventListener.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath="..\bindings\js\ScriptEventListener.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
                                        RelativePath="..\bindings\js\ScriptFunctionCall.cpp"\r
                                        >\r
                                </File>\r
index aec6896..8dae426 100644 (file)
                37F818FE0D657606005E1F05 /* WebCoreURLResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */; };
                41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */; };
                41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */; };
+               411046410FA222A600BA436A /* ScriptEventListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 4110463F0FA222A600BA436A /* ScriptEventListener.h */; };
+               411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 411046400FA222A600BA436A /* ScriptEventListener.cpp */; };
                4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */; };
                412A68470F6B03DD000EA66E /* ScriptObjectQuarantine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */; };
                415E3EF60F8D67FE007EEB50 /* MessagePortProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 415E3EF50F8D67FE007EEB50 /* MessagePortProxy.h */; };
                37F818FC0D657606005E1F05 /* WebCoreURLResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreURLResponse.mm; sourceTree = "<group>"; };
                41002CCB0F66EDEF009E660D /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
                41002CCC0F66EDEF009E660D /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
+               4110463F0FA222A600BA436A /* ScriptEventListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptEventListener.h; sourceTree = "<group>"; };
+               411046400FA222A600BA436A /* ScriptEventListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptEventListener.cpp; sourceTree = "<group>"; };
                4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptState.cpp; sourceTree = "<group>"; };
                412A68460F6B03DD000EA66E /* ScriptObjectQuarantine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptObjectQuarantine.cpp; sourceTree = "<group>"; };
                415E3EF50F8D67FE007EEB50 /* MessagePortProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagePortProxy.h; sourceTree = "<group>"; };
                                65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */,
                                E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */,
                                E1A643F10EC0972500779668 /* WorkerScriptController.h */,
+                               4110463F0FA222A600BA436A /* ScriptEventListener.h */,
+                               411046400FA222A600BA436A /* ScriptEventListener.cpp */,
                        );
                        path = js;
                        sourceTree = "<group>";
                                93B70D7009EB0C7C009D8468 /* ScriptController.h in Headers */,
                                08A484780E5272C500C3FE76 /* ScriptElement.h in Headers */,
                                E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */,
+                               411046410FA222A600BA436A /* ScriptEventListener.h in Headers */,
                                41002CCD0F66EDEF009E660D /* ScriptFunctionCall.h in Headers */,
                                934CC1170EDCAC7300A658F2 /* ScriptInstance.h in Headers */,
                                41F066E40F64BCF600A07EAC /* ScriptObject.h in Headers */,
                                93B70D6F09EB0C7C009D8468 /* ScriptController.cpp in Sources */,
                                A83E1C740E49042C00140B9C /* ScriptControllerMac.mm in Sources */,
                                08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */,
+                               411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */,
                                E11C9DB00EB3699500E409DB /* ScriptExecutionContext.cpp in Sources */,
                                41002CCE0F66EDEF009E660D /* ScriptFunctionCall.cpp in Sources */,
                                41F066E50F64BCF600A07EAC /* ScriptObject.cpp in Sources */,
index c26b83b..2ddd208 100644 (file)
@@ -30,7 +30,6 @@
 #include "Document.h"
 #include "JSDOMWindow.h"
 #include "JSEventListener.h"
-#include "JSLazyEventListener.h"
 
 #if ENABLE(WORKERS)
 #include "JSWorkerContext.h"
index ee75af9..2c79c96 100644 (file)
@@ -34,13 +34,6 @@ namespace WebCore {
 static WTF::RefCountedLeakCounter eventListenerCounter("JSLazyEventListener");
 #endif
 
-static const String& eventParameterName(bool isSVGEvent)
-{
-    DEFINE_STATIC_LOCAL(const String, eventString, ("event"));
-    DEFINE_STATIC_LOCAL(const String, evtString, ("evt"));
-    return isSVGEvent ? evtString : eventString;
-}
-
 JSLazyEventListener::JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, JSDOMGlobalObject* globalObject, Node* node, int lineNumber)
     : JSEventListener(0, globalObject, true)
     , m_functionName(functionName)
@@ -133,44 +126,4 @@ void JSLazyEventListener::parseCode() const
     m_eventParameterName = String();
 }
 
-PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
-{
-    ASSERT(node);
-
-    Document* document = node->document();
-
-    Frame* frame = document->frame();
-    if (!frame)
-        return 0;
-
-    ScriptController* scriptController = frame->script();
-    if (!scriptController->isEnabled())
-        return 0;
-
-    JSDOMWindow* globalObject = scriptController->globalObject();
-    
-    // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
-    {
-        JSLock lock(false);
-        toJS(globalObject->globalExec(), node);
-    }
-
-    return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), globalObject, node, scriptController->eventHandlerLineNumber());
-}
-
-PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
-{
-    if (!frame)
-        return 0;
-
-    ScriptController* scriptController = frame->script();
-    if (!scriptController->isEnabled())
-        return 0;
-
-    // 'globalObject' is the JavaScript wrapper that will mark the event listener we're creating.
-    JSDOMWindow* globalObject = scriptController->globalObject();
-
-    return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), globalObject, 0, scriptController->eventHandlerLineNumber());
-}
-
 } // namespace WebCore
index 40c3946..a5304cf 100644 (file)
@@ -25,7 +25,6 @@
 
 namespace WebCore {
 
-    class Attribute;
     class Node;
 
     class JSLazyEventListener : public JSEventListener {
@@ -52,9 +51,6 @@ namespace WebCore {
         Node* m_originalNode;
     };
 
-    PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
-    PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
-
 } // namespace WebCore
 
 #endif // JSEventListener_h
index 0ab9ee5..2398690 100644 (file)
@@ -27,7 +27,6 @@
 #include "GCController.h"
 #include "HTMLPlugInElement.h"
 #include "JSDocument.h"
-#include "JSLazyEventListener.h"
 #include "NP_jsobject.h"
 #include "Page.h"
 #include "PageGroup.h"
diff --git a/WebCore/bindings/js/ScriptEventListener.cpp b/WebCore/bindings/js/ScriptEventListener.cpp
new file mode 100644 (file)
index 0000000..0ce7bca
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptEventListener.h"
+
+#include "Attribute.h"
+#include "Document.h"
+#include "JSNode.h"
+#include "Frame.h"
+
+#include <runtime/JSLock.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+static const String& eventParameterName(bool isSVGEvent)
+{
+    DEFINE_STATIC_LOCAL(const String, eventString, ("event"));
+    DEFINE_STATIC_LOCAL(const String, evtString, ("evt"));
+    return isSVGEvent ? evtString : eventString;
+}
+
+PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
+{
+    ASSERT(node);
+
+    Frame* frame = node->document()->frame();
+    if (!frame)
+        return 0;
+
+    ScriptController* scriptController = frame->script();
+    if (!scriptController->isEnabled())
+        return 0;
+
+    JSDOMWindow* globalObject = scriptController->globalObject();
+
+    // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
+    {
+        JSLock lock(false);
+        toJS(globalObject->globalExec(), node);
+    }
+
+    return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), globalObject, node, scriptController->eventHandlerLineNumber());
+}
+
+PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
+{
+    if (!frame)
+        return 0;
+
+    ScriptController* scriptController = frame->script();
+    if (!scriptController->isEnabled())
+        return 0;
+
+    // 'globalObject' is the JavaScript wrapper that will mark the event listener we're creating.
+    JSDOMWindow* globalObject = scriptController->globalObject();
+
+    return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), globalObject, 0, scriptController->eventHandlerLineNumber());
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/ScriptEventListener.h b/WebCore/bindings/js/ScriptEventListener.h
new file mode 100644 (file)
index 0000000..8299d29
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptEventListener_h
+#define ScriptEventListener_h
+
+#include "JSLazyEventListener.h"
+
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+    class Attribute;
+    class Frame;
+    class Node;
+
+    PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
+    PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+
+} // namespace WebCore
+
+#endif // ScriptEventListener_h
diff --git a/WebCore/bindings/v8/ScriptEventListener.cpp b/WebCore/bindings/v8/ScriptEventListener.cpp
new file mode 100644 (file)
index 0000000..74cc09a
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptEventListener.h"
+
+#include "Attribute.h"
+#include "Document.h"
+#include "Frame.h"
+
+namespace WebCore {
+
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
+{
+    ASSERT(node);
+
+    Frame* frame = node->document()->frame();
+
+    if (!frame)
+        return 0;
+
+    return V8LazyEventListener::create(frame, attr->value(), attr->localName().string());
+}
+
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
+{
+    if (!frame)
+        return 0;
+
+    return V8LazyEventListener::create(frame, attr->value(), attr->localName().string());
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptEventListener.h b/WebCore/bindings/v8/ScriptEventListener.h
new file mode 100644 (file)
index 0000000..0171120
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptEventListener_h
+#define ScriptEventListener_h
+
+#include "V8LazyEventListener.h"
+
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+    class Attribute;
+    class Frame;
+    class Node;
+
+    PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
+    PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+
+} // namespace WebCore
+
+#endif // ScriptEventListener_h
index 3dff6a4..d5461d1 100644 (file)
@@ -78,7 +78,7 @@
 #include "ImageLoader.h"
 #include "InspectorController.h"
 #include "JSDOMBinding.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "KeyboardEvent.h"
 #include "Logging.h"
 #include "MessageEvent.h"
index 2135543..f2653ef 100644 (file)
@@ -36,7 +36,7 @@
 #include "FrameView.h"
 #include "HTMLFrameElementBase.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 
 namespace WebCore {
 
index 6ded776..f8a8958 100644 (file)
@@ -30,7 +30,7 @@
 #include "FormDataList.h"
 #include "HTMLFormElement.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "KeyboardEvent.h"
 #include "RenderButton.h"
 #include <wtf/StdLibExtras.h>
index 228c736..9a34742 100644 (file)
@@ -37,7 +37,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLNames.h"
 #include "HTMLTokenizer.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "RenderWordBreak.h"
 #include "Settings.h"
 #include "Text.h"
index 77fa15d..676918a 100644 (file)
@@ -42,7 +42,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "MIMETypeRegistry.h"
 #include "Page.h"
 #include "RenderTextControl.h"
index d951a92..2e24af9 100644 (file)
@@ -34,7 +34,7 @@
 #include "FrameView.h"
 #include "HTMLFrameSetElement.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "KURL.h"
 #include "Page.h"
 #include "RenderFrame.h"
index 0605e4e..999d70e 100644 (file)
@@ -29,7 +29,7 @@
 #include "Event.h"
 #include "EventNames.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "Length.h"
 #include "Length.h"
 #include "MouseEvent.h"
index fb316e7..5735901 100644 (file)
@@ -30,7 +30,7 @@
 #include "HTMLDocument.h"
 #include "HTMLFormElement.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "RenderImage.h"
 
 using namespace std;
index 2511404..f34c6e6 100644 (file)
@@ -41,7 +41,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLImageLoader.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "KeyboardEvent.h"
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
index 998b003..f2ca689 100644 (file)
@@ -32,7 +32,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLImageLoader.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "MIMETypeRegistry.h"
 #include "RenderImage.h"
 #include "RenderPartObject.h"
index 6078bdf..23108ae 100644 (file)
@@ -26,7 +26,7 @@
 #include "Document.h"
 #include "EventNames.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "Text.h"
 
 namespace WebCore {
index ecc9a0b..05c2e84 100644 (file)
@@ -42,7 +42,7 @@
 #include "HTMLNames.h"
 #include "HTMLOptionElement.h"
 #include "HTMLOptionsCollection.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "KeyboardEvent.h"
 #include "MouseEvent.h"
 #include "Page.h"
index 9b7dcf7..64e81a1 100644 (file)
@@ -34,7 +34,7 @@
 #include "FormDataList.h"
 #include "Frame.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "Page.h"
 #include "RenderStyle.h"
 #include "RenderTextControlMultiLine.h"
index 242af32..c216116 100644 (file)
@@ -33,7 +33,7 @@
 #include "EventNames.h"
 #include "FrameView.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "PlatformString.h"
 #include "RegisteredEventListener.h"
 #include "RenderObject.h"
index c5e342c..4be57dd 100644 (file)
@@ -34,7 +34,7 @@
 #include "FloatRect.h"
 #include "Frame.h"
 #include "HTMLNames.h"
-#include "JSLazyEventListener.h"
+#include "ScriptEventListener.h"
 #include "RenderSVGViewportContainer.h"
 #include "RenderSVGRoot.h"
 #include "SVGAngle.h"