Changeset 141318 in webkit


Ignore:
Timestamp:
Jan 30, 2013 2:43:57 PM (11 years ago)
Author:
haraken@chromium.org
Message:

Implement WheelEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=108303

Reviewed by Adam Barth.

Source/WebCore:

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

Test: fast/events/constructors/wheel-event-constructor.html

  • dom/WheelEvent.cpp:

(WebCore::WheelEventInit::WheelEventInit):
(WebCore):
(WebCore::WheelEvent::WheelEvent):
(WebCore::WheelEvent::initWheelEvent):

  • dom/WheelEvent.h:

(WheelEventInit):
(WebCore):
(WheelEvent):
(WebCore::WheelEvent::create):
(WebCore::WheelEvent::wheelDelta):
(WebCore::WheelEvent::wheelDeltaX):
(WebCore::WheelEvent::wheelDeltaY):
(WebCore::WheelEvent::rawDeltaX):
(WebCore::WheelEvent::rawDeltaY):
(WebCore::WheelEvent::granularity):
(WebCore::WheelEvent::webkitDirectionInvertedFromDevice):
(WebCore::WheelEvent::isHorizontal):

  • dom/WheelEvent.idl:

Source/WebKit/chromium:

This patch just renames an enum value to avoid style check error.

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::scrollBy):

LayoutTests:

Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
which is enabled on Chromium and Safari.

Test: fast/events/constructors/wheel-event-constructor.html

  • fast/events/constructors/wheel-event-constructor-expected.txt: Added.
  • fast/events/constructors/wheel-event-constructor.html: Added.
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141317 r141318  
     12013-01-30  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement WheelEvent constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=108303
     5
     6        Reviewed by Adam Barth.
     7
     8        Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
     9
     10        This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
     11        which is enabled on Chromium and Safari.
     12
     13        Test: fast/events/constructors/wheel-event-constructor.html
     14
     15        * fast/events/constructors/wheel-event-constructor-expected.txt: Added.
     16        * fast/events/constructors/wheel-event-constructor.html: Added.
     17        * platform/efl/TestExpectations:
     18        * platform/gtk/TestExpectations:
     19        * platform/qt/TestExpectations:
     20        * platform/win/TestExpectations:
     21        * platform/wincairo/TestExpectations:
     22
    1232013-01-30  Julien Chaffraix  <jchaffraix@webkit.org>
    224
  • trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt

    r141028 r141318  
    6666PASS (new inner.WebKitTransitionEvent()).isInner is true
    6767PASS (new inner.WebKitTransitionEvent()).constructor.isInner is true
     68PASS (new inner.WheelEvent()).isInner is true
     69PASS (new inner.WheelEvent()).constructor.isInner is true
    6870PASS (new inner.Worker('foo')).isInner is true
    6971PASS (new inner.Worker('foo')).constructor.isInner is true
  • trunk/LayoutTests/fast/dom/dom-constructors-expected.txt

    r140657 r141318  
    108108PASS TryAllocate('StyleSheetList') is 'exception'
    109109PASS TryAllocate('TextEvent') is 'exception'
    110 PASS TryAllocate('WheelEvent') is 'exception'
    111110PASS TryAllocate('XPathResult') is 'exception'
    112111FAIL TryAllocate('BarInfo') should be exception. Was no constructor.
  • trunk/LayoutTests/fast/dom/dom-constructors.html

    r140657 r141318  
    4747    'NodeFilter', 'NodeList', 'Plugin',
    4848    'PluginArray', 'Range', 'Rect', 'StyleSheet', 'StyleSheetList',
    49     'TextEvent', 'WheelEvent', 'XPathResult', 'BarInfo',
     49    'TextEvent', 'XPathResult', 'BarInfo',
    5050    'CanvasGradient', 'CanvasPattern', 'Console', 'Selection',
    5151    'Window', 'History', 'HTMLOptionsCollection', 'Location',
  • trunk/LayoutTests/platform/efl/TestExpectations

    r141271 r141318  
    12321232webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ]
    12331233webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ]
     1234webkit.org/b/107428 fast/events/constructors/wheel-event-constructor.html [ Skip ]
    12341235
    12351236# Requires support for Web notifications
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r141299 r141318  
    392392webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ]
    393393webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ]
     394webkit.org/b/107428 fast/events/constructors/wheel-event-constructor.html [ Skip ]
    394395
    395396# No CORS support for media elements is implemented yet.
  • trunk/LayoutTests/platform/qt/TestExpectations

    r141264 r141318  
    109109fast/events/constructors/mouse-event-constructor.html
    110110fast/events/constructors/composition-event-constructor.html
     111fast/events/constructors/wheel-event-constructor.html
    111112
    112113# ENABLE(INDEXED_DATABASE) is disabled.
  • trunk/LayoutTests/platform/win/TestExpectations

    r141251 r141318  
    12151215fast/events/constructors/mouse-event-constructor.html
    12161216fast/events/constructors/composition-event-constructor.html
     1217fast/events/constructors/wheel-event-constructor.html
    12171218
    12181219# Disable until the windows WebKit API supports injecting in the top frame only.
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r141028 r141318  
    17421742fast/events/constructors/mouse-event-constructor.html
    17431743fast/events/constructors/composition-event-constructor.html
     1744fast/events/constructors/wheel-event-constructor.html
    17441745
    17451746# Disable until the windows WebKit API supports injecting in the top frame only.
  • trunk/Source/WebCore/ChangeLog

    r141317 r141318  
     12013-01-30  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement WheelEvent constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=108303
     5
     6        Reviewed by Adam Barth.
     7
     8        Editor's draft: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
     9
     10        This patch implements UIEvent constructor under a DOM4_EVENTS_CONSTRUCTOR flag,
     11        which is enabled on Chromium and Safari.
     12
     13        Test: fast/events/constructors/wheel-event-constructor.html
     14
     15        * dom/WheelEvent.cpp:
     16        (WebCore::WheelEventInit::WheelEventInit):
     17        (WebCore):
     18        (WebCore::WheelEvent::WheelEvent):
     19        (WebCore::WheelEvent::initWheelEvent):
     20        * dom/WheelEvent.h:
     21        (WheelEventInit):
     22        (WebCore):
     23        (WheelEvent):
     24        (WebCore::WheelEvent::create):
     25        (WebCore::WheelEvent::wheelDelta):
     26        (WebCore::WheelEvent::wheelDeltaX):
     27        (WebCore::WheelEvent::wheelDeltaY):
     28        (WebCore::WheelEvent::rawDeltaX):
     29        (WebCore::WheelEvent::rawDeltaY):
     30        (WebCore::WheelEvent::granularity):
     31        (WebCore::WheelEvent::webkitDirectionInvertedFromDevice):
     32        (WebCore::WheelEvent::isHorizontal):
     33        * dom/WheelEvent.idl:
     34
    1352013-01-30  Julien Chaffraix  <jchaffraix@webkit.org>
    236
  • trunk/Source/WebCore/dom/WheelEvent.cpp

    r131826 r141318  
    3232namespace WebCore {
    3333
     34WheelEventInit::WheelEventInit()
     35    : wheelDeltaX(0)
     36    , wheelDeltaY(0)
     37{
     38}
     39
    3440WheelEvent::WheelEvent()
    3541    : m_granularity(Pixel)
    3642    , m_directionInvertedFromDevice(false)
     43{
     44}
     45
     46WheelEvent::WheelEvent(const AtomicString& type, const WheelEventInit& initializer)
     47    : MouseEvent(type, initializer)
     48    , m_wheelDelta(IntPoint(initializer.wheelDeltaX, initializer.wheelDeltaY))
    3749{
    3850}
     
    5062#endif
    5163                 ctrlKey, altKey, shiftKey, metaKey, 0, 0, 0, false)
    52     , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * tickMultiplier), static_cast<int>(wheelTicks.y() * tickMultiplier)))
     64    , m_wheelDelta(IntPoint(static_cast<int>(wheelTicks.x() * TickMultiplier), static_cast<int>(wheelTicks.y() * TickMultiplier)))
    5365    , m_rawDelta(roundedIntPoint(rawDelta))
    5466    , m_granularity(granularity)
     
    7385   
    7486    // Normalize to the Windows 120 multiple
    75     m_wheelDelta = IntPoint(rawDeltaX * tickMultiplier, rawDeltaY * tickMultiplier);
     87    m_wheelDelta = IntPoint(rawDeltaX * TickMultiplier, rawDeltaY * TickMultiplier);
    7688   
    7789    m_rawDelta = IntPoint(rawDeltaX, rawDeltaY);
  • trunk/Source/WebCore/dom/WheelEvent.h

    r138674 r141318  
    3131namespace WebCore {
    3232
    33     // extension: mouse wheel event
    34     class WheelEvent : public MouseEvent {
    35     public:
    36         enum { tickMultiplier = 120 };
     33struct WheelEventInit : public MouseEventInit {
     34    WheelEventInit();
    3735
    38         enum Granularity { Pixel, Line, Page };
     36    int wheelDeltaX;
     37    int wheelDeltaY;
     38};
    3939
    40         static PassRefPtr<WheelEvent> create()
    41         {
    42             return adoptRef(new WheelEvent);
    43         }
    44         static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks,
    45             const FloatPoint& rawDelta, Granularity granularity, PassRefPtr<AbstractView> view,
    46             const IntPoint& screenLocation, const IntPoint& pageLocation,
    47             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
    48         {
    49             return adoptRef(new WheelEvent(wheelTicks, rawDelta, granularity, view,
    50                 screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, directionInvertedFromDevice));
    51         }
     40class WheelEvent : public MouseEvent {
     41public:
     42    enum { TickMultiplier = 120 };
    5243
    53         void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
    54                             int screenX, int screenY, int pageX, int pageY,
    55                             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
     44    enum Granularity { Pixel, Line, Page };
    5645
    57         void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
    58                                   int screenX, int screenY, int pageX, int pageY,
    59                                   bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
     46    static PassRefPtr<WheelEvent> create()
     47    {
     48        return adoptRef(new WheelEvent);
     49    }
    6050
    61         int wheelDelta() const { return m_wheelDelta.y() ? m_wheelDelta.y() : m_wheelDelta.x(); }
    62         int wheelDeltaX() const { return m_wheelDelta.x(); }
    63         int wheelDeltaY() const { return m_wheelDelta.y(); }
    64         int rawDeltaX() const { return m_rawDelta.x(); }
    65         int rawDeltaY() const { return m_rawDelta.y(); }
    66         Granularity granularity() const { return m_granularity; }
     51    static PassRefPtr<WheelEvent> create(const AtomicString& type, const WheelEventInit& initializer)
     52    {
     53        return adoptRef(new WheelEvent(type, initializer));
     54    }
    6755
    68         bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
    69         // Needed for Objective-C legacy support
    70         bool isHorizontal() const { return m_wheelDelta.x(); }
     56    static PassRefPtr<WheelEvent> create(const FloatPoint& wheelTicks,
     57        const FloatPoint& rawDelta, Granularity granularity, PassRefPtr<AbstractView> view,
     58        const IntPoint& screenLocation, const IntPoint& pageLocation,
     59        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice)
     60    {
     61        return adoptRef(new WheelEvent(wheelTicks, rawDelta, granularity, view,
     62        screenLocation, pageLocation, ctrlKey, altKey, shiftKey, metaKey, directionInvertedFromDevice));
     63    }
    7164
    72         virtual const AtomicString& interfaceName() const;
    73         virtual bool isMouseEvent() const;
     65    void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
     66        int screenX, int screenY, int pageX, int pageY,
     67        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
    7468
    75     private:
    76         WheelEvent();
    77         WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
    78                    Granularity, PassRefPtr<AbstractView>,
    79                    const IntPoint& screenLocation, const IntPoint& pageLocation,
    80                    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
     69    void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
     70        int screenX, int screenY, int pageX, int pageY,
     71        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
    8172
    82         IntPoint m_wheelDelta;
    83         IntPoint m_rawDelta;
    84         Granularity m_granularity;
    85         bool m_directionInvertedFromDevice;
    86     };
     73    int wheelDelta() const { return m_wheelDelta.y() ? m_wheelDelta.y() : m_wheelDelta.x(); }
     74    int wheelDeltaX() const { return m_wheelDelta.x(); }
     75    int wheelDeltaY() const { return m_wheelDelta.y(); }
     76    int rawDeltaX() const { return m_rawDelta.x(); }
     77    int rawDeltaY() const { return m_rawDelta.y(); }
     78    Granularity granularity() const { return m_granularity; }
     79
     80    bool webkitDirectionInvertedFromDevice() const { return m_directionInvertedFromDevice; }
     81    // Needed for Objective-C legacy support
     82    bool isHorizontal() const { return m_wheelDelta.x(); }
     83
     84    virtual const AtomicString& interfaceName() const;
     85    virtual bool isMouseEvent() const;
     86
     87private:
     88    WheelEvent();
     89    WheelEvent(const AtomicString&, const WheelEventInit&);
     90    WheelEvent(const FloatPoint& wheelTicks, const FloatPoint& rawDelta,
     91        Granularity, PassRefPtr<AbstractView>,
     92        const IntPoint& screenLocation, const IntPoint& pageLocation,
     93        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool directionInvertedFromDevice);
     94
     95    IntPoint m_wheelDelta;
     96    IntPoint m_rawDelta;
     97    Granularity m_granularity;
     98    bool m_directionInvertedFromDevice;
     99};
    87100
    88101class WheelEventDispatchMediator : public EventDispatchMediator {
  • trunk/Source/WebCore/dom/WheelEvent.idl

    r131145 r141318  
    1919 */
    2020
    21 // Based off http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-wheelevents
    22 interface WheelEvent : MouseEvent
    23 {
    24     readonly attribute long    wheelDelta;
    25     readonly attribute long    wheelDeltaX;
    26     readonly attribute long    wheelDeltaY;
     21[
     22    ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR,
     23    ConstructorTemplate=Event
     24] interface WheelEvent : MouseEvent {
     25    [InitializedByEventConstructor] readonly attribute long wheelDeltaX;
     26    [InitializedByEventConstructor] readonly attribute long wheelDeltaY;
     27
     28    readonly attribute long wheelDelta;
    2729
    2830    // WebKit Extension
  • trunk/Source/WebKit/chromium/ChangeLog

    r141302 r141318  
     12013-01-30  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement WheelEvent constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=108303
     5
     6        Reviewed by Adam Barth.
     7
     8        This patch just renames an enum value to avoid style check error.
     9
     10        * src/WebViewImpl.cpp:
     11        (WebKit::WebViewImpl::scrollBy):
     12
    1132013-01-30  Dana Jansens  <danakj@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r141302 r141318  
    660660    if (m_flingSourceDevice == WebGestureEvent::Touchpad) {
    661661        WebMouseWheelEvent syntheticWheel;
    662         const float tickDivisor = WebCore::WheelEvent::tickMultiplier;
     662        const float tickDivisor = WebCore::WheelEvent::TickMultiplier;
    663663
    664664        syntheticWheel.deltaX = delta.x;
Note: See TracChangeset for help on using the changeset viewer.