Event.h has too many virtual isMumbleEvent() functions
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2011 21:07:12 +0000 (21:07 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2011 21:07:12 +0000 (21:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70636

Reviewed by Dimitri Glazkov.

Source/WebCore:

We should use the new interfaceName() way of doing run-time type inference.

* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSEventCustom.cpp:
(WebCore::JSEvent::clipboardData):
* bindings/objc/DOMEvents.mm:
(kitClass):
* bindings/v8/V8WindowErrorHandler.cpp:
(WebCore::V8WindowErrorHandler::callListenerFunction):
* bindings/v8/V8WorkerContextErrorHandler.cpp:
(WebCore::V8WorkerContextErrorHandler::callListenerFunction):
* bindings/v8/custom/V8EventCustom.cpp:
(WebCore::V8Event::clipboardDataAccessorGetter):
* dom/BeforeLoadEvent.h:
(WebCore::BeforeLoadEvent::interfaceName):
* dom/BeforeTextInsertedEvent.h:
* dom/ClipboardEvent.cpp:
* dom/ClipboardEvent.h:
* dom/CompositionEvent.cpp:
* dom/CompositionEvent.h:
* dom/ErrorEvent.cpp:
* dom/ErrorEvent.h:
* dom/Event.cpp:
(WebCore::Event::storesResultAsString):
(WebCore::Event::storeResult):
(WebCore::Event::clipboardData):
* dom/Event.h:
* dom/Event.idl:
    - Remove this interface from the CPP bindings because this function
      no longer exists.  It's unclear to me how strong our API
      commitments are in the CPP bindings.
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::determineDispatchBehavior):
* dom/MessageEvent.cpp:
* dom/MessageEvent.h:
* dom/MutationEvent.cpp:
* dom/MutationEvent.h:
* dom/Node.cpp:
(WebCore::Node::defaultEventHandler):
* dom/OverflowEvent.cpp:
* dom/OverflowEvent.h:
* dom/PageTransitionEvent.h:
* dom/ProgressEvent.h:
* dom/TextEvent.cpp:
* dom/TextEvent.h:
* dom/WheelEvent.cpp:
* dom/WheelEvent.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::defaultEventHandler):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::forwardEvent):
(WebCore::TextFieldInputType::shouldSubmitImplicitly):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerTextElement::defaultEventHandler):
* svg/SVGZoomEvent.cpp:
* svg/SVGZoomEvent.h:

Source/WebKit/chromium:

Update these callsites to the new API.

* src/WebDOMEvent.cpp:
(WebKit::WebDOMEvent::isKeyboardEvent):
(WebKit::WebDOMEvent::isMutationEvent):
(WebKit::WebDOMEvent::isTextEvent):
(WebKit::WebDOMEvent::isCompositionEvent):
(WebKit::WebDOMEvent::isClipboardEvent):
(WebKit::WebDOMEvent::isMessageEvent):
(WebKit::WebDOMEvent::isWheelEvent):
(WebKit::WebDOMEvent::isBeforeTextInsertedEvent):
(WebKit::WebDOMEvent::isOverflowEvent):
(WebKit::WebDOMEvent::isPageTransitionEvent):
(WebKit::WebDOMEvent::isProgressEvent):
(WebKit::WebDOMEvent::isBeforeLoadEvent):

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

35 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSErrorHandler.cpp
Source/WebCore/bindings/objc/DOMEvents.mm
Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp
Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp
Source/WebCore/dom/BeforeLoadEvent.h
Source/WebCore/dom/CompositionEvent.cpp
Source/WebCore/dom/CompositionEvent.h
Source/WebCore/dom/ErrorEvent.cpp
Source/WebCore/dom/ErrorEvent.h
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/Event.idl
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/MessageEvent.h
Source/WebCore/dom/MutationEvent.cpp
Source/WebCore/dom/MutationEvent.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/OverflowEvent.cpp
Source/WebCore/dom/OverflowEvent.h
Source/WebCore/dom/PageTransitionEvent.h
Source/WebCore/dom/ProgressEvent.h
Source/WebCore/dom/TextEvent.cpp
Source/WebCore/dom/TextEvent.h
Source/WebCore/dom/WheelEvent.cpp
Source/WebCore/dom/WheelEvent.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/svg/SVGZoomEvent.cpp
Source/WebCore/svg/SVGZoomEvent.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebDOMEvent.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp

index 313e306..9007555 100755 (executable)
@@ -1,3 +1,70 @@
+2011-10-21  Adam Barth  <abarth@webkit.org>
+
+        Event.h has too many virtual isMumbleEvent() functions
+        https://bugs.webkit.org/show_bug.cgi?id=70636
+
+        Reviewed by Dimitri Glazkov.
+
+        We should use the new interfaceName() way of doing run-time type inference.
+
+        * bindings/js/JSErrorHandler.cpp:
+        (WebCore::JSErrorHandler::handleEvent):
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::JSEvent::clipboardData):
+        * bindings/objc/DOMEvents.mm:
+        (kitClass):
+        * bindings/v8/V8WindowErrorHandler.cpp:
+        (WebCore::V8WindowErrorHandler::callListenerFunction):
+        * bindings/v8/V8WorkerContextErrorHandler.cpp:
+        (WebCore::V8WorkerContextErrorHandler::callListenerFunction):
+        * bindings/v8/custom/V8EventCustom.cpp:
+        (WebCore::V8Event::clipboardDataAccessorGetter):
+        * dom/BeforeLoadEvent.h:
+        (WebCore::BeforeLoadEvent::interfaceName):
+        * dom/BeforeTextInsertedEvent.h:
+        * dom/ClipboardEvent.cpp:
+        * dom/ClipboardEvent.h:
+        * dom/CompositionEvent.cpp:
+        * dom/CompositionEvent.h:
+        * dom/ErrorEvent.cpp:
+        * dom/ErrorEvent.h:
+        * dom/Event.cpp:
+        (WebCore::Event::storesResultAsString):
+        (WebCore::Event::storeResult):
+        (WebCore::Event::clipboardData):
+        * dom/Event.h:
+        * dom/Event.idl:
+            - Remove this interface from the CPP bindings because this function
+              no longer exists.  It's unclear to me how strong our API
+              commitments are in the CPP bindings.
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::determineDispatchBehavior):
+        * dom/MessageEvent.cpp:
+        * dom/MessageEvent.h:
+        * dom/MutationEvent.cpp:
+        * dom/MutationEvent.h:
+        * dom/Node.cpp:
+        (WebCore::Node::defaultEventHandler):
+        * dom/OverflowEvent.cpp:
+        * dom/OverflowEvent.h:
+        * dom/PageTransitionEvent.h:
+        * dom/ProgressEvent.h:
+        * dom/TextEvent.cpp:
+        * dom/TextEvent.h:
+        * dom/WheelEvent.cpp:
+        * dom/WheelEvent.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::defaultEventHandler):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::defaultEventHandler):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::forwardEvent):
+        (WebCore::TextFieldInputType::shouldSubmitImplicitly):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerTextElement::defaultEventHandler):
+        * svg/SVGZoomEvent.cpp:
+        * svg/SVGZoomEvent.h:
+
 2011-10-21  Raymond Toy  <rtoy@google.com>
 
         Flush denormals in Biquad, ZeroPole, and DynamicsCompressor.
index 76a5d71..603342f 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "ErrorEvent.h"
 #include "Event.h"
+#include "EventNames.h"
 #include "JSEvent.h"
 #include <runtime/JSLock.h>
 
@@ -52,7 +53,7 @@ JSErrorHandler::~JSErrorHandler()
 
 void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
 {
-    if (!event->isErrorEvent())
+    if (event->interfaceName() != eventNames().interfaceForErrorEvent)
         return JSEventListener::handleEvent(scriptExecutionContext, event);
 
     ASSERT(scriptExecutionContext);
index 26dfe7b..2e2bae2 100644 (file)
@@ -38,6 +38,7 @@
 #import "DOMTextEvent.h"
 #import "DOMWheelEvent.h"
 #import "Event.h"
+#import "EventNames.h"
 
 #if ENABLE(SVG_DOM_OBJC_BINDINGS)
 #import "DOMSVGZoomEvent.h"
 
 Class kitClass(WebCore::Event* impl)
 {
+    AtomicString desiredInterface = impl->interfaceName();
+
     if (impl->isUIEvent()) {
         if (impl->isKeyboardEvent())
             return [DOMKeyboardEvent class];
-        if (impl->isTextEvent())
-            return [DOMTextEvent class];
         if (impl->isMouseEvent())
             return [DOMMouseEvent class];
-        if (impl->isWheelEvent())
+        if (desiredInterface == WebCore::eventNames().interfaceForTextEvent)
+            return [DOMTextEvent class];
+        if (desiredInterface == WebCore::eventNames().interfaceForWheelEvent)
             return [DOMWheelEvent class];        
 #if ENABLE(SVG_DOM_OBJC_BINDINGS)
-        if (impl->isSVGZoomEvent())
+        if (desiredInterface == WebCore::eventNames().interfaceForSVGZoomEvent)
             return [DOMSVGZoomEvent class];
 #endif
         return [DOMUIEvent class];
     }
-    if (impl->isMutationEvent())
+    if (desiredInterface == WebCore::eventNames().interfaceForMutationEvent)
         return [DOMMutationEvent class];
-    if (impl->isOverflowEvent())
+    if (desiredInterface == WebCore::eventNames().interfaceForOverflowEvent)
         return [DOMOverflowEvent class];
-    if (impl->isMessageEvent())
+    if (desiredInterface == WebCore::eventNames().interfaceForMessageEvent)
         return [DOMMessageEvent class];
-    if (impl->isProgressEvent())
+    if (desiredInterface == WebCore::eventNames().interfaceForProgressEvent || desiredInterface == WebCore::eventNames().interfaceForXMLHttpRequestProgressEvent)
         return [DOMProgressEvent class];
-    if (impl->isBeforeLoadEvent())
+    if (desiredInterface == WebCore::eventNames().interfaceForBeforeLoadEvent)
         return [DOMBeforeLoadEvent class];
     return [DOMEvent class];
 }
index 94e8680..deb8e4c 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "V8WindowErrorHandler.h"
 
+#include "EventNames.h"
 #include "ErrorEvent.h"
 #include "V8Binding.h"
 
@@ -44,9 +45,9 @@ V8WindowErrorHandler::V8WindowErrorHandler(v8::Local<v8::Object> listener, bool
 
 v8::Local<v8::Value> V8WindowErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
 {
-    if (!event->isErrorEvent())
+    if (event->interfaceName() != eventNames().interfaceForErrorEvent)
         return V8EventListener::callListenerFunction(context, jsEvent, event);
-    
+
     ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
     v8::Local<v8::Object> listener = getListenerObject(context);
     v8::Local<v8::Value> returnValue;
index 0a5c99d..75071ee 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "V8WorkerContextErrorHandler.h"
 
+#include "EventNames.h"
 #include "ErrorEvent.h"
 #include "V8Binding.h"
 
@@ -46,7 +47,7 @@ V8WorkerContextErrorHandler::V8WorkerContextErrorHandler(v8::Local<v8::Object> l
 
 v8::Local<v8::Value> V8WorkerContextErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
 {
-    ASSERT(event->isErrorEvent());
+    ASSERT(event->interfaceName() == eventNames().interfaceForErrorEvent);
     v8::Local<v8::Object> listener = getListenerObject(context);
     v8::Local<v8::Value> returnValue;
     if (!listener.IsEmpty() && listener->IsFunction()) {
index 166fb67..c9da9f8 100644 (file)
@@ -70,7 +70,6 @@ public:
     const String& url() const { return m_url; }
 
     virtual const AtomicString& interfaceName() const { return eventNames().interfaceForBeforeLoadEvent; }
-    virtual bool isBeforeLoadEvent() const { return true; }
 
 private:
     BeforeLoadEvent()
index db9ffb4..908bb7d 100644 (file)
@@ -60,9 +60,4 @@ const AtomicString& CompositionEvent::interfaceName() const
     return eventNames().interfaceForCompositionEvent;
 }
 
-bool CompositionEvent::isCompositionEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore
index 5473573..0158d84 100644 (file)
@@ -48,7 +48,6 @@ namespace WebCore {
         String data() const { return m_data; }
 
         virtual const AtomicString& interfaceName() const;
-        virtual bool isCompositionEvent() const;
 
     private:
         CompositionEvent();
index ecef772..beef3fd 100644 (file)
@@ -78,11 +78,6 @@ void ErrorEvent::initErrorEvent(const AtomicString& type, bool canBubble, bool c
     m_lineNumber = lineNumber;
 }
 
-bool ErrorEvent::isErrorEvent() const
-{
-    return true;
-}
-
 const AtomicString& ErrorEvent::interfaceName() const
 {
     return eventNames().interfaceForErrorEvent;
index 5acf01a..84c9750 100644 (file)
@@ -67,7 +67,6 @@ public:
     unsigned lineno() const { return m_lineNumber; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isErrorEvent() const;
 
 private:
     ErrorEvent();
index 7d74b1b..f775c99 100644 (file)
@@ -112,26 +112,11 @@ bool Event::isMouseEvent() const
     return false;
 }
 
-bool Event::isMutationEvent() const
-{
-    return false;
-}
-
 bool Event::isKeyboardEvent() const
 {
     return false;
 }
 
-bool Event::isTextEvent() const
-{
-    return false;
-}
-
-bool Event::isCompositionEvent() const
-{
-    return false;
-}
-
 bool Event::isDragEvent() const
 {
     return false;
@@ -142,12 +127,7 @@ bool Event::isClipboardEvent() const
     return false;
 }
 
-bool Event::isWheelEvent() const
-{
-    return false;
-}
-
-bool Event::isMessageEvent() const
+bool Event::storesResultAsString() const
 {
     return false;
 }
@@ -157,43 +137,6 @@ bool Event::isBeforeTextInsertedEvent() const
     return false;
 }
 
-bool Event::isOverflowEvent() const
-{
-    return false;
-}
-
-bool Event::isPageTransitionEvent() const
-{
-    return false;
-}
-
-bool Event::isProgressEvent() const
-{
-    return false;
-}
-
-bool Event::isBeforeLoadEvent() const
-{
-    return false;
-}
-
-#if ENABLE(SVG)
-bool Event::isSVGZoomEvent() const
-{
-    return false;
-}
-#endif
-
-bool Event::isErrorEvent() const
-{
-    return false;
-}
-
-bool Event::storesResultAsString() const
-{
-    return false;
-}
-
 void Event::storeResult(const String&)
 {
 }
index c027a78..ea6f822 100644 (file)
@@ -114,29 +114,17 @@ namespace WebCore {
 
         virtual const AtomicString& interfaceName() const;
 
-        // These are needed for the CPP bindings.
+        // These events are general classes of events.
         virtual bool isUIEvent() const;
         virtual bool isMouseEvent() const;
-        virtual bool isMutationEvent() const;
+        virtual bool isKeyboardEvent() const;
 
-        virtual bool isDragEvent() const; // a subset of mouse events
+        // Drag events are a subset of mouse events.
+        virtual bool isDragEvent() const;
 
-        // FIXME: Remove these! Callers should use interfaceName() instead.
-        virtual bool isKeyboardEvent() const;
-        virtual bool isTextEvent() const;
-        virtual bool isCompositionEvent() const;
+        // These events lack a DOM interface.
         virtual bool isClipboardEvent() const;
-        virtual bool isMessageEvent() const;
-        virtual bool isWheelEvent() const;
         virtual bool isBeforeTextInsertedEvent() const;
-        virtual bool isOverflowEvent() const;
-        virtual bool isPageTransitionEvent() const;
-        virtual bool isProgressEvent() const;
-        virtual bool isBeforeLoadEvent() const;
-#if ENABLE(SVG)
-        virtual bool isSVGZoomEvent() const;
-#endif
-        virtual bool isErrorEvent() const;
 
         bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
         bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
index 056d185..896cc28 100644 (file)
@@ -83,7 +83,6 @@ module events {
 
 #if defined(LANGUAGE_CPP) && LANGUAGE_CPP
         // Extra WebCore methods exposed to allow compile-time casting in C++
-        boolean isMutationEvent();
         boolean isMouseEvent();
         boolean isUIEvent();
 #endif
index a2878d5..9df8f79 100644 (file)
@@ -396,7 +396,7 @@ EventDispatchBehavior EventDispatcher::determineDispatchBehavior(Event* event, N
 
     // Per XBL 2.0 spec, mutation events should never cross shadow DOM boundary:
     // http://dev.w3.org/2006/xbl2/#event-flow-and-targeting-across-shadow-s
-    if (event->isMutationEvent())
+    if (event->interfaceName() == eventNames().interfaceForMutationEvent)
         return StayInsideShadowDOM;
 
     // WebKit never allowed selectstart event to cross the the shadow DOM boundary.
index e29d445..1252d2c 100644 (file)
@@ -169,9 +169,4 @@ const AtomicString& MessageEvent::interfaceName() const
     return eventNames().interfaceForMessageEvent;
 }
 
-bool MessageEvent::isMessageEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore
index f9fe69c..030e186 100644 (file)
@@ -98,7 +98,6 @@ public:
     void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isMessageEvent() const;
 
     enum DataType {
         DataTypeScriptValue,
index 78b702b..d024fdf 100644 (file)
@@ -69,9 +69,4 @@ const AtomicString& MutationEvent::interfaceName() const
     return eventNames().interfaceForMutationEvent;
 }
 
-bool MutationEvent::isMutationEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore
index c37bb35..680627b 100644 (file)
@@ -61,7 +61,6 @@ namespace WebCore {
         unsigned short attrChange() const { return m_attrChange; }
 
         virtual const AtomicString& interfaceName() const;
-        virtual bool isMutationEvent() const;
 
     private:
         MutationEvent();
index 915a5dc..3c8623f 100644 (file)
@@ -2876,7 +2876,7 @@ void Node::defaultEventHandler(Event* event)
                 page->contextMenuController()->handleContextMenuEvent(event);
 #endif
     } else if (eventType == eventNames().textInputEvent) {
-        if (event->isTextEvent())
+        if (event->interfaceName() == eventNames().interfaceForTextEvent)
             if (Frame* frame = document()->frame())
                 frame->eventHandler()->defaultTextInputEventHandler(static_cast<TextEvent*>(event));
 #if ENABLE(PAN_SCROLLING)
@@ -2896,7 +2896,7 @@ void Node::defaultEventHandler(Event* event)
             }
         }
 #endif
-    } else if (eventType == eventNames().mousewheelEvent && event->isWheelEvent()) {
+    } else if (eventType == eventNames().mousewheelEvent && event->interfaceName() == eventNames().interfaceForWheelEvent) {
         WheelEvent* wheelEvent = static_cast<WheelEvent*>(event);
         
         // If we don't have a renderer, send the wheel event to the first node we find with a renderer.
index a980731..68711e9 100644 (file)
@@ -73,11 +73,6 @@ const AtomicString& OverflowEvent::interfaceName() const
     return eventNames().interfaceForOverflowEvent;
 }
 
-bool OverflowEvent::isOverflowEvent() const
-{
-    return true;
-}
-
 void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
 {
     if (dispatched())
index 800ba88..8f77d2b 100644 (file)
@@ -66,7 +66,6 @@ public:
     bool verticalOverflow() const { return m_verticalOverflow; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isOverflowEvent() const;
 
 private:
     OverflowEvent();
index ab6dd78..e77ab6a 100644 (file)
@@ -59,7 +59,6 @@ public:
                                  bool persisted);
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isPageTransitionEvent() const { return true; }
 
     bool persisted() const { return m_persisted; }
 
index 10fe52f..f77999c 100644 (file)
@@ -68,8 +68,6 @@ protected:
     ProgressEvent(const AtomicString&, const ProgressEventInit&);
 
 private:
-    virtual bool isProgressEvent() const { return true; }
-    
     bool m_lengthComputable;
     unsigned long long m_loaded;
     unsigned long long m_total;
index e3cac85..1dffb01 100644 (file)
@@ -104,9 +104,4 @@ const AtomicString& TextEvent::interfaceName() const
     return eventNames().interfaceForTextEvent;
 }
 
-bool TextEvent::isTextEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore
index 05eb5e3..9b0877a 100644 (file)
@@ -50,7 +50,6 @@ namespace WebCore {
         String data() const { return m_data; }
 
         virtual const AtomicString& interfaceName() const;
-        virtual bool isTextEvent() const;
 
         bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
         bool isComposition() const { return m_inputType == TextEventInputComposition; }
index a936ed6..72ba95f 100644 (file)
@@ -89,11 +89,6 @@ const AtomicString& WheelEvent::interfaceName() const
     return eventNames().interfaceForWheelEvent;
 }
 
-bool WheelEvent::isWheelEvent() const
-{
-    return true;
-}
-
 inline static WheelEvent::Granularity granularity(const PlatformWheelEvent& event)
 {
     return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::Page : WheelEvent::Pixel;
index 1a5c84e..6b36ab9 100644 (file)
@@ -78,8 +78,6 @@ namespace WebCore {
                    const IntPoint& screenLocation, const IntPoint& pageLocation,
                    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
 
-        virtual bool isWheelEvent() const;
-
         IntPoint m_wheelDelta;
         IntPoint m_rawDelta;
         Granularity m_granularity;
index 7faaea1..24707db 100644 (file)
@@ -1269,7 +1269,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
     if (evt->isBeforeTextInsertedEvent())
         m_inputType->handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(evt));
 
-    if (evt->isWheelEvent()) {
+    if (evt->interfaceName() == eventNames().interfaceForWheelEvent) {
         m_inputType->handleWheelEvent(static_cast<WheelEvent*>(evt));
         if (evt->defaultHandled())
             return;
index 5a6b60a..30506b5 100644 (file)
@@ -211,7 +211,7 @@ void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection)
 
 void HTMLTextAreaElement::defaultEventHandler(Event* event)
 {
-    if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->isWheelEvent() || event->type() == eventNames().blurEvent))
+    if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->interfaceName() == eventNames().interfaceForWheelEvent || event->type() == eventNames().blurEvent))
         forwardEvent(event);
     else if (renderer() && event->isBeforeTextInsertedEvent())
         handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event));
index 5f97901..073936a 100644 (file)
@@ -142,7 +142,7 @@ void TextFieldInputType::handleWheelEventForSpinButton(WheelEvent* event)
 
 void TextFieldInputType::forwardEvent(Event* event)
 {
-    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->isWheelEvent() || event->type() == eventNames().blurEvent || event->type() == eventNames().focusEvent)) {
+    if (element()->renderer() && (event->isMouseEvent() || event->isDragEvent() || event->interfaceName() == eventNames().interfaceForWheelEvent || event->type() == eventNames().blurEvent || event->type() == eventNames().focusEvent)) {
         RenderTextControlSingleLine* renderTextControl = toRenderTextControlSingleLine(element()->renderer());
         if (event->type() == eventNames().blurEvent) {
             if (RenderBox* innerTextRenderer = innerTextElement()->renderBox()) {
@@ -160,7 +160,7 @@ void TextFieldInputType::forwardEvent(Event* event)
 
 bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
 {
-    return (event->type() == eventNames().textInputEvent && event->isTextEvent() && static_cast<TextEvent*>(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
+    return (event->type() == eventNames().textInputEvent && event->interfaceName() == eventNames().interfaceForTextEvent && static_cast<TextEvent*>(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
 }
 
 RenderObject* TextFieldInputType::createRenderer(RenderArena* arena, RenderStyle*) const
index b6320b8..de3ec7c 100644 (file)
@@ -69,11 +69,6 @@ FloatPoint SVGZoomEvent::newTranslate() const
     return m_newTranslate;
 }
 
-bool SVGZoomEvent::isSVGZoomEvent() const
-{
-    return true;
-}
-
 const AtomicString& SVGZoomEvent::interfaceName() const
 {
     return eventNames().interfaceForSVGZoomEvent;
index 1b6ed71..1ed5fec 100644 (file)
@@ -50,8 +50,6 @@ public:
 private:
     SVGZoomEvent();
 
-    virtual bool isSVGZoomEvent() const;
-
     float m_newScale;
     float m_previousScale;
 
index ceb3c7b..f805c48 100644 (file)
@@ -1,3 +1,26 @@
+2011-10-21  Adam Barth  <abarth@webkit.org>
+
+        Event.h has too many virtual isMumbleEvent() functions
+        https://bugs.webkit.org/show_bug.cgi?id=70636
+
+        Reviewed by Dimitri Glazkov.
+
+        Update these callsites to the new API.
+
+        * src/WebDOMEvent.cpp:
+        (WebKit::WebDOMEvent::isKeyboardEvent):
+        (WebKit::WebDOMEvent::isMutationEvent):
+        (WebKit::WebDOMEvent::isTextEvent):
+        (WebKit::WebDOMEvent::isCompositionEvent):
+        (WebKit::WebDOMEvent::isClipboardEvent):
+        (WebKit::WebDOMEvent::isMessageEvent):
+        (WebKit::WebDOMEvent::isWheelEvent):
+        (WebKit::WebDOMEvent::isBeforeTextInsertedEvent):
+        (WebKit::WebDOMEvent::isOverflowEvent):
+        (WebKit::WebDOMEvent::isPageTransitionEvent):
+        (WebKit::WebDOMEvent::isProgressEvent):
+        (WebKit::WebDOMEvent::isBeforeLoadEvent):
+
 2011-10-20  Zhenyao Mo  <zmo@google.com>
 
         Implement mechanism to enable privileged webgl extensions
index ccb6751..548961a 100644 (file)
@@ -115,28 +115,28 @@ bool WebDOMEvent::isMouseEvent() const
     return m_private->isMouseEvent();
 }
 
-bool WebDOMEvent::isMutationEvent() const
+bool WebDOMEvent::isKeyboardEvent() const
 {
     ASSERT(m_private);
-    return m_private->isMutationEvent();
+    return m_private->isKeyboardEvent();
 }
 
-bool WebDOMEvent::isKeyboardEvent() const
+bool WebDOMEvent::isMutationEvent() const
 {
     ASSERT(m_private);
-    return m_private->isKeyboardEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForMutationEvent;
 }
 
 bool WebDOMEvent::isTextEvent() const
 {
     ASSERT(m_private);
-    return m_private->isTextEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForTextEvent;
 }
 
 bool WebDOMEvent::isCompositionEvent() const
 {
     ASSERT(m_private);
-    return m_private->isCompositionEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForCompositionEvent;
 }
 
 bool WebDOMEvent::isDragEvent() const
@@ -154,13 +154,13 @@ bool WebDOMEvent::isClipboardEvent() const
 bool WebDOMEvent::isMessageEvent() const
 {
     ASSERT(m_private);
-    return m_private->isMessageEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForMessageEvent;
 }
 
 bool WebDOMEvent::isWheelEvent() const
 {
     ASSERT(m_private);
-    return m_private->isWheelEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForWheelEvent;
 }
 
 bool WebDOMEvent::isBeforeTextInsertedEvent() const
@@ -172,13 +172,13 @@ bool WebDOMEvent::isBeforeTextInsertedEvent() const
 bool WebDOMEvent::isOverflowEvent() const
 {
     ASSERT(m_private);
-    return m_private->isOverflowEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForOverflowEvent;
 }
 
 bool WebDOMEvent::isPageTransitionEvent() const
 {
     ASSERT(m_private);
-    return m_private->isPageTransitionEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForPageTransitionEvent;
 }
 
 bool WebDOMEvent::isPopStateEvent() const
@@ -190,7 +190,7 @@ bool WebDOMEvent::isPopStateEvent() const
 bool WebDOMEvent::isProgressEvent() const
 {
     ASSERT(m_private);
-    return m_private->isProgressEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForProgressEvent;
 }
 
 bool WebDOMEvent::isXMLHttpRequestProgressEvent() const
@@ -214,7 +214,7 @@ bool WebDOMEvent::isWebKitTransitionEvent() const
 bool WebDOMEvent::isBeforeLoadEvent() const
 {
     ASSERT(m_private);
-    return m_private->isBeforeLoadEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForBeforeLoadEvent;
 }
 
 } // namespace WebKit
index a808820..2b31449 100644 (file)
@@ -186,7 +186,7 @@ void WebPluginContainerImpl::handleEvent(Event* event)
     // where mozilla behaves differently than the spec.
     if (event->isMouseEvent())
         handleMouseEvent(static_cast<MouseEvent*>(event));
-    else if (event->isWheelEvent())
+    else if (event->interfaceName() == eventNames().interfaceForWheelEvent)
         handleWheelEvent(static_cast<WheelEvent*>(event));
     else if (event->isKeyboardEvent())
         handleKeyboardEvent(static_cast<KeyboardEvent*>(event));