| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
| 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 ~TouchEvent() override; | 41 ~TouchEvent() override; |
| 42 | 42 |
| 43 // We only initialize sourceCapabilities when we create TouchEvent from Even
tHandler, null if it is from JavaScript. | 43 // We only initialize sourceCapabilities when we create TouchEvent from Even
tHandler, null if it is from JavaScript. |
| 44 static TouchEvent* create() | 44 static TouchEvent* create() |
| 45 { | 45 { |
| 46 return new TouchEvent; | 46 return new TouchEvent; |
| 47 } | 47 } |
| 48 static TouchEvent* create(TouchList* touches, | 48 static TouchEvent* create(TouchList* touches, |
| 49 TouchList* targetTouches, TouchList* changedTouches, | 49 TouchList* targetTouches, TouchList* changedTouches, |
| 50 const AtomicString& type, AbstractView* view, | 50 const AtomicString& type, AbstractView* view, |
| 51 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollin
gIfUncanceled, | 51 PlatformEvent::Modifiers modifiers, bool cancelable, bool causesScrollin
gIfUncanceled, bool firstTouchMoveOrStart, |
| 52 double platformTimeStamp) | 52 double platformTimeStamp) |
| 53 { | 53 { |
| 54 return new TouchEvent(touches, targetTouches, changedTouches, type, view
, | 54 return new TouchEvent(touches, targetTouches, changedTouches, type, view
, |
| 55 modifiers, cancelable, causesScrollingIfUncanceled, platformTimeStam
p); | 55 modifiers, cancelable, causesScrollingIfUncanceled, firstTouchMoveOr
Start, platformTimeStamp); |
| 56 } | 56 } |
| 57 | 57 |
| 58 static TouchEvent* create(const AtomicString& type, const TouchEventInit& in
itializer) | 58 static TouchEvent* create(const AtomicString& type, const TouchEventInit& in
itializer) |
| 59 { | 59 { |
| 60 return new TouchEvent(type, initializer); | 60 return new TouchEvent(type, initializer); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void initTouchEvent(ScriptState*, TouchList* touches, TouchList* targetTouch
es, | 63 void initTouchEvent(ScriptState*, TouchList* touches, TouchList* targetTouch
es, |
| 64 TouchList* changedTouches, const AtomicString& type, | 64 TouchList* changedTouches, const AtomicString& type, |
| 65 AbstractView*, | 65 AbstractView*, |
| 66 int, int, int, int, // unused useless members of web exposed API | 66 int, int, int, int, // unused useless members of web exposed API |
| 67 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); | 67 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 68 | 68 |
| 69 TouchList* touches() const { return m_touches.get(); } | 69 TouchList* touches() const { return m_touches.get(); } |
| 70 TouchList* targetTouches() const { return m_targetTouches.get(); } | 70 TouchList* targetTouches() const { return m_targetTouches.get(); } |
| 71 TouchList* changedTouches() const { return m_changedTouches.get(); } | 71 TouchList* changedTouches() const { return m_changedTouches.get(); } |
| 72 | 72 |
| 73 void setTouches(TouchList* touches) { m_touches = touches; } | 73 void setTouches(TouchList* touches) { m_touches = touches; } |
| 74 void setTargetTouches(TouchList* targetTouches) { m_targetTouches = targetTo
uches; } | 74 void setTargetTouches(TouchList* targetTouches) { m_targetTouches = targetTo
uches; } |
| 75 void setChangedTouches(TouchList* changedTouches) { m_changedTouches = chang
edTouches; } | 75 void setChangedTouches(TouchList* changedTouches) { m_changedTouches = chang
edTouches; } |
| 76 | 76 |
| 77 bool causesScrollingIfUncanceled() const { return m_causesScrollingIfUncance
led; } | 77 bool causesScrollingIfUncanceled() const { return m_causesScrollingIfUncance
led; } |
| 78 | 78 |
| 79 bool isTouchEvent() const override; | 79 bool isTouchEvent() const override; |
| 80 | 80 |
| 81 const AtomicString& interfaceName() const override; | 81 const AtomicString& interfaceName() const override; |
| 82 | 82 |
| 83 void preventDefault() override; | 83 void preventDefault() override; |
| 84 | 84 |
| 85 void doneDispatchingEventAtCurrentTarget() override; |
| 86 |
| 85 EventDispatchMediator* createMediator() override; | 87 EventDispatchMediator* createMediator() override; |
| 86 | 88 |
| 87 DECLARE_VIRTUAL_TRACE(); | 89 DECLARE_VIRTUAL_TRACE(); |
| 88 | 90 |
| 89 private: | 91 private: |
| 90 TouchEvent(); | 92 TouchEvent(); |
| 91 TouchEvent(TouchList* touches, TouchList* targetTouches, | 93 TouchEvent(TouchList* touches, TouchList* targetTouches, |
| 92 TouchList* changedTouches, const AtomicString& type, | 94 TouchList* changedTouches, const AtomicString& type, |
| 93 AbstractView*, PlatformEvent::Modifiers, | 95 AbstractView*, PlatformEvent::Modifiers, |
| 94 bool cancelable, bool causesScrollingIfUncanceled, | 96 bool cancelable, bool causesScrollingIfUncanceled, |
| 97 bool firstTouchMoveOrStart, |
| 95 double platformTimeStamp); | 98 double platformTimeStamp); |
| 96 TouchEvent(const AtomicString&, const TouchEventInit&); | 99 TouchEvent(const AtomicString&, const TouchEventInit&); |
| 97 | 100 |
| 98 Member<TouchList> m_touches; | 101 Member<TouchList> m_touches; |
| 99 Member<TouchList> m_targetTouches; | 102 Member<TouchList> m_targetTouches; |
| 100 Member<TouchList> m_changedTouches; | 103 Member<TouchList> m_changedTouches; |
| 101 bool m_causesScrollingIfUncanceled; | 104 bool m_causesScrollingIfUncanceled; |
| 105 bool m_firstTouchMoveOrStart; |
| 106 bool m_defaultPreventedBeforeCurrentTarget; |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 class TouchEventDispatchMediator final : public EventDispatchMediator { | 109 class TouchEventDispatchMediator final : public EventDispatchMediator { |
| 105 public: | 110 public: |
| 106 static TouchEventDispatchMediator* create(TouchEvent*); | 111 static TouchEventDispatchMediator* create(TouchEvent*); |
| 107 | 112 |
| 108 private: | 113 private: |
| 109 explicit TouchEventDispatchMediator(TouchEvent*); | 114 explicit TouchEventDispatchMediator(TouchEvent*); |
| 110 TouchEvent& event() const; | 115 TouchEvent& event() const; |
| 111 DispatchEventResult dispatchEvent(EventDispatcher&) const override; | 116 DispatchEventResult dispatchEvent(EventDispatcher&) const override; |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 DEFINE_EVENT_TYPE_CASTS(TouchEvent); | 119 DEFINE_EVENT_TYPE_CASTS(TouchEvent); |
| 115 | 120 |
| 116 } // namespace blink | 121 } // namespace blink |
| 117 | 122 |
| 118 #endif // TouchEvent_h | 123 #endif // TouchEvent_h |
| OLD | NEW |