diff options
Diffstat (limited to 'Source/WebCore/dom/TouchEvent.h')
-rw-r--r-- | Source/WebCore/dom/TouchEvent.h | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/Source/WebCore/dom/TouchEvent.h b/Source/WebCore/dom/TouchEvent.h index 1a73ccac5..d339c0b72 100644 --- a/Source/WebCore/dom/TouchEvent.h +++ b/Source/WebCore/dom/TouchEvent.h @@ -14,7 +14,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,10 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TouchEvent_h -#define TouchEvent_h +#pragma once -#if PLATFORM(IOS) +#if ENABLE(IOS_TOUCH_EVENTS) #include <WebKitAdditions/TouchEventIOS.h> #elif ENABLE(TOUCH_EVENTS) @@ -36,28 +35,39 @@ namespace WebCore { -class TouchEvent : public MouseRelatedEvent { +class TouchEvent final : public MouseRelatedEvent { public: virtual ~TouchEvent(); - static PassRefPtr<TouchEvent> create() - { - return adoptRef(new TouchEvent); - } - static PassRefPtr<TouchEvent> create(TouchList* touches, + static Ref<TouchEvent> create(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, - const AtomicString& type, PassRefPtr<AbstractView> view, + const AtomicString& type, DOMWindow* view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) { - return adoptRef(new TouchEvent(touches, targetTouches, changedTouches, + return adoptRef(*new TouchEvent(touches, targetTouches, changedTouches, type, view, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey)); } + static Ref<TouchEvent> createForBindings() + { + return adoptRef(*new TouchEvent); + } + + struct Init : MouseRelatedEventInit { + RefPtr<TouchList> touches; + RefPtr<TouchList> targetTouches; + RefPtr<TouchList> changedTouches; + }; + + static Ref<TouchEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) + { + return adoptRef(*new TouchEvent(type, initializer, isTrusted)); + } void initTouchEvent(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, const AtomicString& type, - PassRefPtr<AbstractView> view, int screenX, int screenY, + DOMWindow*, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); @@ -65,41 +75,30 @@ public: TouchList* targetTouches() const { return m_targetTouches.get(); } TouchList* changedTouches() const { return m_changedTouches.get(); } - void setTouches(PassRefPtr<TouchList> touches) { m_touches = touches; } - void setTargetTouches(PassRefPtr<TouchList> targetTouches) { m_targetTouches = targetTouches; } - void setChangedTouches(PassRefPtr<TouchList> changedTouches) { m_changedTouches = changedTouches; } + void setTouches(RefPtr<TouchList>&& touches) { m_touches = touches; } + void setTargetTouches(RefPtr<TouchList>&& targetTouches) { m_targetTouches = targetTouches; } + void setChangedTouches(RefPtr<TouchList>&& changedTouches) { m_changedTouches = changedTouches; } - virtual bool isTouchEvent() const override; + bool isTouchEvent() const override; - virtual EventInterface eventInterface() const; + EventInterface eventInterface() const override; private: TouchEvent(); TouchEvent(TouchList* touches, TouchList* targetTouches, TouchList* changedTouches, const AtomicString& type, - PassRefPtr<AbstractView>, int screenX, int screenY, int pageX, + DOMWindow*, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); + TouchEvent(const AtomicString&, const Init&, IsTrusted); RefPtr<TouchList> m_touches; RefPtr<TouchList> m_targetTouches; RefPtr<TouchList> m_changedTouches; }; -inline TouchEvent* toTouchEvent(Event* event) -{ - ASSERT_WITH_SECURITY_IMPLICATION(event && event->isTouchEvent()); - return static_cast<TouchEvent*>(event); -} - -inline TouchEvent& toTouchEvent(Event& event) -{ - ASSERT(event.isTouchEvent()); - return static_cast<TouchEvent&>(event); -} - } // namespace WebCore -#endif // ENABLE(TOUCH_EVENTS) +SPECIALIZE_TYPE_TRAITS_EVENT(TouchEvent) -#endif // TouchEvent_h +#endif // ENABLE(TOUCH_EVENTS) |