Title: [98146] trunk/Source
Revision
98146
Author
aba...@webkit.org
Date
2011-10-21 14:07:12 -0700 (Fri, 21 Oct 2011)

Log Message

Event.h has too many virtual isMumbleEvent() functions
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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98145 => 98146)


--- trunk/Source/WebCore/ChangeLog	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/ChangeLog	2011-10-21 21:07:12 UTC (rev 98146)
@@ -1,3 +1,70 @@
+2011-10-21  Adam Barth  <aba...@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  <r...@google.com>
 
         Flush denormals in Biquad, ZeroPole, and DynamicsCompressor.

Modified: trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp (98145 => 98146)


--- trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -34,6 +34,7 @@
 
 #include "ErrorEvent.h"
 #include "Event.h"
+#include "EventNames.h"
 #include "JSEvent.h"
 #include <runtime/JSLock.h>
 
@@ -52,7 +53,7 @@
 
 void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
 {
-    if (!event->isErrorEvent())
+    if (event->interfaceName() != eventNames().interfaceForErrorEvent)
         return JSEventListener::handleEvent(scriptExecutionContext, event);
 
     ASSERT(scriptExecutionContext);

Modified: trunk/Source/WebCore/bindings/objc/DOMEvents.mm (98145 => 98146)


--- trunk/Source/WebCore/bindings/objc/DOMEvents.mm	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/bindings/objc/DOMEvents.mm	2011-10-21 21:07:12 UTC (rev 98146)
@@ -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"
@@ -45,30 +46,32 @@
 
 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];
 }

Modified: trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp (98145 => 98146)


--- trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -32,6 +32,7 @@
 
 #include "V8WindowErrorHandler.h"
 
+#include "EventNames.h"
 #include "ErrorEvent.h"
 #include "V8Binding.h"
 
@@ -44,9 +45,9 @@
 
 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;

Modified: trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp (98145 => 98146)


--- trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/bindings/v8/V8WorkerContextErrorHandler.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -34,6 +34,7 @@
 
 #include "V8WorkerContextErrorHandler.h"
 
+#include "EventNames.h"
 #include "ErrorEvent.h"
 #include "V8Binding.h"
 
@@ -46,7 +47,7 @@
 
 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()) {

Modified: trunk/Source/WebCore/dom/BeforeLoadEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/BeforeLoadEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/BeforeLoadEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -70,7 +70,6 @@
     const String& url() const { return m_url; }
 
     virtual const AtomicString& interfaceName() const { return eventNames().interfaceForBeforeLoadEvent; }
-    virtual bool isBeforeLoadEvent() const { return true; }
 
 private:
     BeforeLoadEvent()

Modified: trunk/Source/WebCore/dom/CompositionEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/CompositionEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/CompositionEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -60,9 +60,4 @@
     return eventNames().interfaceForCompositionEvent;
 }
 
-bool CompositionEvent::isCompositionEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/CompositionEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/CompositionEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/CompositionEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -48,7 +48,6 @@
         String data() const { return m_data; }
 
         virtual const AtomicString& interfaceName() const;
-        virtual bool isCompositionEvent() const;
 
     private:
         CompositionEvent();

Modified: trunk/Source/WebCore/dom/ErrorEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/ErrorEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/ErrorEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -78,11 +78,6 @@
     m_lineNumber = lineNumber;
 }
 
-bool ErrorEvent::isErrorEvent() const
-{
-    return true;
-}
-
 const AtomicString& ErrorEvent::interfaceName() const
 {
     return eventNames().interfaceForErrorEvent;

Modified: trunk/Source/WebCore/dom/ErrorEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/ErrorEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/ErrorEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -67,7 +67,6 @@
     unsigned lineno() const { return m_lineNumber; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isErrorEvent() const;
 
 private:
     ErrorEvent();

Modified: trunk/Source/WebCore/dom/Event.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/Event.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/Event.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -112,26 +112,11 @@
     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,58 +127,16 @@
     return false;
 }
 
-bool Event::isWheelEvent() const
+bool Event::storesResultAsString() const
 {
     return false;
 }
 
-bool Event::isMessageEvent() const
-{
-    return false;
-}
-
 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&)
 {
 }

Modified: trunk/Source/WebCore/dom/Event.h (98145 => 98146)


--- trunk/Source/WebCore/dom/Event.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/Event.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -114,29 +114,17 @@
 
         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; }

Modified: trunk/Source/WebCore/dom/Event.idl (98145 => 98146)


--- trunk/Source/WebCore/dom/Event.idl	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/Event.idl	2011-10-21 21:07:12 UTC (rev 98146)
@@ -83,7 +83,6 @@
 
 #if defined(LANGUAGE_CPP) && LANGUAGE_CPP
         // Extra WebCore methods exposed to allow compile-time casting in C++
-        boolean isMutationEvent();
         boolean isMouseEvent();
         boolean isUIEvent();
 #endif

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -396,7 +396,7 @@
 
     // 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.

Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/MessageEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -169,9 +169,4 @@
     return eventNames().interfaceForMessageEvent;
 }
 
-bool MessageEvent::isMessageEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/MessageEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/MessageEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/MessageEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -98,7 +98,6 @@
     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,

Modified: trunk/Source/WebCore/dom/MutationEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/MutationEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/MutationEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -69,9 +69,4 @@
     return eventNames().interfaceForMutationEvent;
 }
 
-bool MutationEvent::isMutationEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/MutationEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/MutationEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/MutationEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -61,7 +61,6 @@
         unsigned short attrChange() const { return m_attrChange; }
 
         virtual const AtomicString& interfaceName() const;
-        virtual bool isMutationEvent() const;
 
     private:
         MutationEvent();

Modified: trunk/Source/WebCore/dom/Node.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/Node.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -2876,7 +2876,7 @@
                 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 @@
             }
         }
 #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.

Modified: trunk/Source/WebCore/dom/OverflowEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/OverflowEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/OverflowEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -73,11 +73,6 @@
     return eventNames().interfaceForOverflowEvent;
 }
 
-bool OverflowEvent::isOverflowEvent() const
-{
-    return true;
-}
-
 void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
 {
     if (dispatched())

Modified: trunk/Source/WebCore/dom/OverflowEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/OverflowEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/OverflowEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -66,7 +66,6 @@
     bool verticalOverflow() const { return m_verticalOverflow; }
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isOverflowEvent() const;
 
 private:
     OverflowEvent();

Modified: trunk/Source/WebCore/dom/PageTransitionEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/PageTransitionEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/PageTransitionEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -59,7 +59,6 @@
                                  bool persisted);
 
     virtual const AtomicString& interfaceName() const;
-    virtual bool isPageTransitionEvent() const { return true; }
 
     bool persisted() const { return m_persisted; }
 

Modified: trunk/Source/WebCore/dom/ProgressEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/ProgressEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/ProgressEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -68,8 +68,6 @@
     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;

Modified: trunk/Source/WebCore/dom/TextEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/TextEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/TextEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -104,9 +104,4 @@
     return eventNames().interfaceForTextEvent;
 }
 
-bool TextEvent::isTextEvent() const
-{
-    return true;
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/TextEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/TextEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/TextEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -50,7 +50,6 @@
         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; }

Modified: trunk/Source/WebCore/dom/WheelEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/dom/WheelEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/WheelEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -89,11 +89,6 @@
     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;

Modified: trunk/Source/WebCore/dom/WheelEvent.h (98145 => 98146)


--- trunk/Source/WebCore/dom/WheelEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/dom/WheelEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -78,8 +78,6 @@
                    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;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (98145 => 98146)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -1269,7 +1269,7 @@
     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;

Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (98145 => 98146)


--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -211,7 +211,7 @@
 
 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));

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (98145 => 98146)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -142,7 +142,7 @@
 
 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 @@
 
 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

Modified: trunk/Source/WebCore/svg/SVGZoomEvent.cpp (98145 => 98146)


--- trunk/Source/WebCore/svg/SVGZoomEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/svg/SVGZoomEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -69,11 +69,6 @@
     return m_newTranslate;
 }
 
-bool SVGZoomEvent::isSVGZoomEvent() const
-{
-    return true;
-}
-
 const AtomicString& SVGZoomEvent::interfaceName() const
 {
     return eventNames().interfaceForSVGZoomEvent;

Modified: trunk/Source/WebCore/svg/SVGZoomEvent.h (98145 => 98146)


--- trunk/Source/WebCore/svg/SVGZoomEvent.h	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebCore/svg/SVGZoomEvent.h	2011-10-21 21:07:12 UTC (rev 98146)
@@ -50,8 +50,6 @@
 private:
     SVGZoomEvent();
 
-    virtual bool isSVGZoomEvent() const;
-
     float m_newScale;
     float m_previousScale;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (98145 => 98146)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-21 21:07:12 UTC (rev 98146)
@@ -1,3 +1,26 @@
+2011-10-21  Adam Barth  <aba...@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  <z...@google.com>
 
         Implement mechanism to enable privileged webgl extensions

Modified: trunk/Source/WebKit/chromium/src/WebDOMEvent.cpp (98145 => 98146)


--- trunk/Source/WebKit/chromium/src/WebDOMEvent.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebKit/chromium/src/WebDOMEvent.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -115,28 +115,28 @@
     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::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::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::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::isBeforeLoadEvent() const
 {
     ASSERT(m_private);
-    return m_private->isBeforeLoadEvent();
+    return m_private->interfaceName() == WebCore::eventNames().interfaceForBeforeLoadEvent;
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (98145 => 98146)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2011-10-21 21:06:33 UTC (rev 98145)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2011-10-21 21:07:12 UTC (rev 98146)
@@ -186,7 +186,7 @@
     // 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));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to