Changeset 121234 in webkit


Ignore:
Timestamp:
Jun 26, 2012 12:41:32 AM (12 years ago)
Author:
dominicc@chromium.org
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
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121216 r121234  
     12012-06-26  Dominic Cooney  <dominicc@chromium.org>
     2
     3        WheelEvent should inherit from MouseEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=76104
     5
     6        Reviewed by Kentaro Hara.
     7
     8        * fast/events/event-creation-expected.txt:
     9        * fast/events/event-creation.html: Also check WheelEvent instanceof MouseEvent as well as UIEvent, Event
     10
    1112012-06-25  Fumitoshi Ukai  <ukai@chromium.org>
    212
  • trunk/LayoutTests/fast/events/event-creation-expected.txt

    r119360 r121234  
    7979PASS document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent is true
    8080PASS document.createEvent('WheelEvent') instanceof window.WheelEvent is true
     81PASS document.createEvent('WheelEvent') instanceof window.MouseEvent is true
    8182PASS document.createEvent('WheelEvent') instanceof window.UIEvent is true
    8283PASS document.createEvent('WheelEvent') instanceof window.Event is true
  • trunk/LayoutTests/fast/events/event-creation.html

    r119360 r121234  
    130130    // WheelEvent
    131131    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
     132    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.MouseEvent");
    132133    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.UIEvent");
    133134    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.Event");
  • trunk/Source/WebCore/ChangeLog

    • Property svn:executable set to *
    r121232 r121234  
     12012-06-26  Dominic Cooney  <dominicc@chromium.org>
     2
     3        WheelEvent should inherit from MouseEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=76104
     5
     6        Reviewed by Kentaro Hara.
     7
     8        The spec for WheelEvent is
     9        <http://www.w3.org/TR/DOM-Level-3-Events/#webidl-events-WheelEvent>
     10
     11        Tests: fast/events/event-creation.html
     12               http://samples.msdn.microsoft.com/ietestcenter/dominheritance/showdominheritancetest.htm?Prototype_WheelEvent
     13
     14        * bindings/objc/PublicDOMInterfaces.h: Remove redundant MouseEvent API from WheelEvent
     15        * bindings/scripts/CodeGeneratorObjC.pm: MouseEvents are Events
     16        * dom/MouseEvent.h: Expose no-arg constructor to WheelEvent
     17        * dom/WheelEvent.cpp:
     18        (WebCore::WheelEvent::WheelEvent): Call MouseEvent superconstructor
     19        (WebCore::WheelEvent::isMouseEvent): Existing callers use this just for
     20        moves and clicks, ie the type is exactly MouseEvent.
     21        * dom/WheelEvent.h: Extend MouseEvent
     22        * dom/WheelEvent.idl: "
     23
    1242012-06-25  Ryosuke Niwa  <rniwa@webkit.org>
    225
  • trunk/Source/WebCore/bindings/objc/DOMEvents.mm

    • Property svn:executable set to *
  • trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h

    r120158 r121234  
    10831083@end
    10841084
    1085 @interface DOMWheelEvent : DOMUIEvent WEBKIT_VERSION_3_0
    1086 @property(readonly) int screenX;
    1087 @property(readonly) int screenY;
    1088 @property(readonly) int clientX;
    1089 @property(readonly) int clientY;
    1090 @property(readonly) BOOL ctrlKey;
    1091 @property(readonly) BOOL shiftKey;
    1092 @property(readonly) BOOL altKey;
    1093 @property(readonly) BOOL metaKey;
     1085@interface DOMWheelEvent : DOMMouseEvent WEBKIT_VERSION_3_0
    10941086@property(readonly) BOOL isHorizontal;
    10951087@property(readonly) int wheelDelta;
    10961088@property(readonly) int wheelDeltaX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    10971089@property(readonly) int wheelDeltaY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    1098 @property(readonly) int offsetX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    1099 @property(readonly) int offsetY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    1100 @property(readonly) int x AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    1101 @property(readonly) int y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    11021090- (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;
    11031091@end
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r120206 r121234  
    419419
    420420    return $parent if $parent eq "Object" or IsBaseType($parent);
    421     return "Event" if $parent eq "UIEvent";
     421    return "Event" if $parent eq "UIEvent" or $parent eq "MouseEvent";
    422422    return "CSSValue" if $parent eq "SVGColor" or $parent eq "CSSValueList";
    423423    return "Node";
  • trunk/Source/WebCore/dom/MouseEvent.h

    r119360 r121234  
    9393                   PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated);
    9494
    95     private:
     95    protected:
    9696        MouseEvent();
    9797
     98    private:
    9899        unsigned short m_button;
    99100        bool m_buttonDown;
  • trunk/Source/WebCore/dom/WheelEvent.cpp

    • Property svn:executable set to *
    r119360 r121234  
    4343                       bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
    4444                       bool directionInvertedFromDevice)
    45     : MouseRelatedEvent(eventNames().mousewheelEvent,
    46                         true, true, view, 0, screenLocation, pageLocation,
     45    : MouseEvent(eventNames().mousewheelEvent,
     46                 true, true, view, 0, screenLocation.x(), screenLocation.y(),
     47                 pageLocation.x(), pageLocation.y(),
    4748#if ENABLE(POINTER_LOCK)
    48                         IntPoint(0, 0),
     49                 0, 0,
    4950#endif
    50                         ctrlKey, altKey, shiftKey, metaKey)
     51                 ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
    5152    , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * tickMultiplier), static_cast<int>(wheelTicks.y() * tickMultiplier)))
    5253    , m_rawDelta(roundedIntPoint(rawDelta))
     
    9495}
    9596
     97bool WheelEvent::isMouseEvent() const
     98{
     99    return false;
     100}
     101
    96102inline static WheelEvent::Granularity granularity(const PlatformWheelEvent& event)
    97103{
  • trunk/Source/WebCore/dom/WheelEvent.h

    • Property svn:executable set to *
    r119360 r121234  
    2727#include "EventDispatchMediator.h"
    2828#include "FloatPoint.h"
    29 #include "MouseRelatedEvent.h"
     29#include "MouseEvent.h"
    3030
    3131namespace WebCore {
    3232
    3333    // extension: mouse wheel event
    34     class WheelEvent : public MouseRelatedEvent {
     34    class WheelEvent : public MouseEvent {
    3535    public:
    3636        enum { tickMultiplier = 120 };
     
    7171
    7272        virtual const AtomicString& interfaceName() const;
     73        virtual bool isMouseEvent() const;
    7374
    7475    private:
    7576        WheelEvent();
    7677        WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
    77                    Granularity granularity, PassRefPtr<AbstractView>,
     78                   Granularity, PassRefPtr<AbstractView>,
    7879                   const IntPoint& screenLocation, const IntPoint& pageLocation,
    7980                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
  • trunk/Source/WebCore/dom/WheelEvent.idl

    r119360 r121234  
    2121module events {
    2222
    23     // Based off of proposed IDL interface for WheelEvent:
    24     interface WheelEvent : UIEvent {
    25         readonly attribute long    screenX;
    26         readonly attribute long    screenY;
    27         readonly attribute long    clientX;
    28         readonly attribute long    clientY;
    29         readonly attribute boolean ctrlKey;
    30         readonly attribute boolean shiftKey;
    31         readonly attribute boolean altKey;
    32         readonly attribute boolean metaKey;
     23    // Based off http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-wheelevents
     24    interface WheelEvent : MouseEvent
     25    {
    3326        readonly attribute long    wheelDelta;
    3427        readonly attribute long    wheelDeltaX;
    3528        readonly attribute long    wheelDeltaY;
    3629
    37         // WebKit Extensions
    38         readonly attribute long    offsetX;
    39         readonly attribute long    offsetY;
    40         readonly attribute long    x;
    41         readonly attribute long    y;
     30        // WebKit Extension
    4231        readonly attribute boolean webkitDirectionInvertedFromDevice;
    4332
Note: See TracChangeset for help on using the changeset viewer.