Title: [121234] trunk
Revision
121234
Author
[email protected]
Date
2012-06-26 00:41:32 -0700 (Tue, 26 Jun 2012)

Log Message

WheelEvent should inherit from MouseEvent
https://bugs.webkit.org/show_bug.cgi?id=76104

Reviewed by Kentaro Hara.

Source/WebCore:

The spec for WheelEvent is
<http://www.w3.org/TR/DOM-Level-3-Events/#webidl-events-WheelEvent>

Tests: fast/events/event-creation.html
       http://samples.msdn.microsoft.com/ietestcenter/dominheritance/showdominheritancetest.htm?Prototype_WheelEvent

* bindings/objc/PublicDOMInterfaces.h: Remove redundant MouseEvent API from WheelEvent
* bindings/scripts/CodeGeneratorObjC.pm: MouseEvents are Events
* dom/MouseEvent.h: Expose no-arg constructor to WheelEvent
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent): Call MouseEvent superconstructor
(WebCore::WheelEvent::isMouseEvent): Existing callers use this just for
moves and clicks, ie the type is exactly MouseEvent.
* dom/WheelEvent.h: Extend MouseEvent
* dom/WheelEvent.idl: "

LayoutTests:

* fast/events/event-creation-expected.txt:
* fast/events/event-creation.html: Also check WheelEvent instanceof MouseEvent as well as UIEvent, Event

Modified Paths

Property Changed

Diff

Modified: trunk/LayoutTests/ChangeLog (121233 => 121234)


--- trunk/LayoutTests/ChangeLog	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/LayoutTests/ChangeLog	2012-06-26 07:41:32 UTC (rev 121234)
@@ -1,3 +1,13 @@
+2012-06-26  Dominic Cooney  <[email protected]>
+
+        WheelEvent should inherit from MouseEvent
+        https://bugs.webkit.org/show_bug.cgi?id=76104
+
+        Reviewed by Kentaro Hara.
+
+        * fast/events/event-creation-expected.txt:
+        * fast/events/event-creation.html: Also check WheelEvent instanceof MouseEvent as well as UIEvent, Event
+
 2012-06-25  Fumitoshi Ukai  <[email protected]>
 
         Unreviewed, update chromium test expectations.

Modified: trunk/LayoutTests/fast/events/event-creation-expected.txt (121233 => 121234)


--- trunk/LayoutTests/fast/events/event-creation-expected.txt	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/LayoutTests/fast/events/event-creation-expected.txt	2012-06-26 07:41:32 UTC (rev 121234)
@@ -78,6 +78,7 @@
 PASS document.createEvent('WebKitTransitionEvent') instanceof window.Event is true
 PASS document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.WheelEvent is true
+PASS document.createEvent('WheelEvent') instanceof window.MouseEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.UIEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.Event is true
 PASS document.createEvent('WheelEvent').constructor === window.WheelEvent is true

Modified: trunk/LayoutTests/fast/events/event-creation.html (121233 => 121234)


--- trunk/LayoutTests/fast/events/event-creation.html	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/LayoutTests/fast/events/event-creation.html	2012-06-26 07:41:32 UTC (rev 121234)
@@ -129,6 +129,7 @@
 
     // WheelEvent
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
+    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.MouseEvent");
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.UIEvent");
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.Event");
     shouldBeTrue("document.createEvent('WheelEvent').constructor === window.WheelEvent");

Modified: trunk/Source/WebCore/ChangeLog (121233 => 121234)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 07:41:32 UTC (rev 121234)
@@ -1,3 +1,26 @@
+2012-06-26  Dominic Cooney  <[email protected]>
+
+        WheelEvent should inherit from MouseEvent
+        https://bugs.webkit.org/show_bug.cgi?id=76104
+
+        Reviewed by Kentaro Hara.
+
+        The spec for WheelEvent is
+        <http://www.w3.org/TR/DOM-Level-3-Events/#webidl-events-WheelEvent>
+
+        Tests: fast/events/event-creation.html
+               http://samples.msdn.microsoft.com/ietestcenter/dominheritance/showdominheritancetest.htm?Prototype_WheelEvent
+
+        * bindings/objc/PublicDOMInterfaces.h: Remove redundant MouseEvent API from WheelEvent
+        * bindings/scripts/CodeGeneratorObjC.pm: MouseEvents are Events
+        * dom/MouseEvent.h: Expose no-arg constructor to WheelEvent
+        * dom/WheelEvent.cpp:
+        (WebCore::WheelEvent::WheelEvent): Call MouseEvent superconstructor
+        (WebCore::WheelEvent::isMouseEvent): Existing callers use this just for
+        moves and clicks, ie the type is exactly MouseEvent.
+        * dom/WheelEvent.h: Extend MouseEvent
+        * dom/WheelEvent.idl: "
+
 2012-06-25  Ryosuke Niwa  <[email protected]>
 
         Get rid of firstItem and nextItem from HTMLCollection
Property changes on: trunk/Source/WebCore/ChangeLog
___________________________________________________________________

Added: svn:executable

Property changes: trunk/Source/WebCore/bindings/objc/DOMEvents.mm


Added: svn:executable

Modified: trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h (121233 => 121234)


--- trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h	2012-06-26 07:41:32 UTC (rev 121234)
@@ -1082,23 +1082,11 @@
 - (void)initOverflowEvent:(unsigned short)orient horizontalOverflow:(BOOL)horizontalOverflow verticalOverflow:(BOOL)verticalOverflow;
 @end
 
-@interface DOMWheelEvent : DOMUIEvent WEBKIT_VERSION_3_0
-@property(readonly) int screenX;
-@property(readonly) int screenY;
-@property(readonly) int clientX;
-@property(readonly) int clientY;
-@property(readonly) BOOL ctrlKey;
-@property(readonly) BOOL shiftKey;
-@property(readonly) BOOL altKey;
-@property(readonly) BOOL metaKey;
+@interface DOMWheelEvent : DOMMouseEvent WEBKIT_VERSION_3_0
 @property(readonly) BOOL isHorizontal;
 @property(readonly) int wheelDelta;
 @property(readonly) int wheelDeltaX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
 @property(readonly) int wheelDeltaY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
-@property(readonly) int offsetX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
-@property(readonly) int offsetY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
-@property(readonly) int x AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
-@property(readonly) int y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
 - (void)initWheelEvent:(int)wheelDeltaX wheelDeltaY:(int)wheelDeltaY view:(DOMAbstractView *)view screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
 @end
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (121233 => 121234)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2012-06-26 07:41:32 UTC (rev 121234)
@@ -418,7 +418,7 @@
     $parent = shift;
 
     return $parent if $parent eq "Object" or IsBaseType($parent);
-    return "Event" if $parent eq "UIEvent";
+    return "Event" if $parent eq "UIEvent" or $parent eq "MouseEvent";
     return "CSSValue" if $parent eq "SVGColor" or $parent eq "CSSValueList";
     return "Node";
 }

Modified: trunk/Source/WebCore/dom/MouseEvent.h (121233 => 121234)


--- trunk/Source/WebCore/dom/MouseEvent.h	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/dom/MouseEvent.h	2012-06-26 07:41:32 UTC (rev 121234)
@@ -92,9 +92,10 @@
                    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
                    PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated);
 
-    private:
+    protected:
         MouseEvent();
 
+    private:
         unsigned short m_button;
         bool m_buttonDown;
         RefPtr<EventTarget> m_relatedTarget;

Modified: trunk/Source/WebCore/dom/WheelEvent.cpp (121233 => 121234)


--- trunk/Source/WebCore/dom/WheelEvent.cpp	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/dom/WheelEvent.cpp	2012-06-26 07:41:32 UTC (rev 121234)
@@ -42,12 +42,13 @@
                        const IntPoint& screenLocation, const IntPoint& pageLocation,
                        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
                        bool directionInvertedFromDevice)
-    : MouseRelatedEvent(eventNames().mousewheelEvent,
-                        true, true, view, 0, screenLocation, pageLocation,
+    : MouseEvent(eventNames().mousewheelEvent,
+                 true, true, view, 0, screenLocation.x(), screenLocation.y(),
+                 pageLocation.x(), pageLocation.y(),
 #if ENABLE(POINTER_LOCK)
-                        IntPoint(0, 0),
+                 0, 0,
 #endif
-                        ctrlKey, altKey, shiftKey, metaKey)
+                 ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
     , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * tickMultiplier), static_cast<int>(wheelTicks.y() * tickMultiplier)))
     , m_rawDelta(roundedIntPoint(rawDelta))
     , m_granularity(granularity)
@@ -93,6 +94,11 @@
     return eventNames().interfaceForWheelEvent;
 }
 
+bool WheelEvent::isMouseEvent() const
+{
+    return false;
+}
+
 inline static WheelEvent::Granularity granularity(const PlatformWheelEvent& event)
 {
     return event.granularity() == ScrollByPageWheelEvent ? WheelEvent::Page : WheelEvent::Pixel;
Property changes on: trunk/Source/WebCore/dom/WheelEvent.cpp
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/dom/WheelEvent.h (121233 => 121234)


--- trunk/Source/WebCore/dom/WheelEvent.h	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/dom/WheelEvent.h	2012-06-26 07:41:32 UTC (rev 121234)
@@ -26,12 +26,12 @@
 
 #include "EventDispatchMediator.h"
 #include "FloatPoint.h"
-#include "MouseRelatedEvent.h"
+#include "MouseEvent.h"
 
 namespace WebCore {
 
     // extension: mouse wheel event
-    class WheelEvent : public MouseRelatedEvent {
+    class WheelEvent : public MouseEvent {
     public:
         enum { tickMultiplier = 120 };
 
@@ -70,11 +70,12 @@
         bool isHorizontal() const { return m_wheelDelta.x(); }
 
         virtual const AtomicString& interfaceName() const;
+        virtual bool isMouseEvent() const;
 
     private:
         WheelEvent();
         WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
-                   Granularity granularity, PassRefPtr<AbstractView>,
+                   Granularity, PassRefPtr<AbstractView>,
                    const IntPoint& screenLocation, const IntPoint& pageLocation,
                    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
 
Property changes on: trunk/Source/WebCore/dom/WheelEvent.h
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/dom/WheelEvent.idl (121233 => 121234)


--- trunk/Source/WebCore/dom/WheelEvent.idl	2012-06-26 07:24:03 UTC (rev 121233)
+++ trunk/Source/WebCore/dom/WheelEvent.idl	2012-06-26 07:41:32 UTC (rev 121234)
@@ -20,25 +20,14 @@
 
 module events {
 
-    // Based off of proposed IDL interface for WheelEvent:
-    interface WheelEvent : UIEvent {
-        readonly attribute long    screenX;
-        readonly attribute long    screenY;
-        readonly attribute long    clientX;
-        readonly attribute long    clientY;
-        readonly attribute boolean ctrlKey;
-        readonly attribute boolean shiftKey;
-        readonly attribute boolean altKey;
-        readonly attribute boolean metaKey;
+    // Based off http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-wheelevents
+    interface WheelEvent : MouseEvent
+    {
         readonly attribute long    wheelDelta;
         readonly attribute long    wheelDeltaX;
         readonly attribute long    wheelDeltaY;
 
-        // WebKit Extensions
-        readonly attribute long    offsetX;
-        readonly attribute long    offsetY;
-        readonly attribute long    x;
-        readonly attribute long    y;
+        // WebKit Extension
         readonly attribute boolean webkitDirectionInvertedFromDevice;
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to