| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ | 26 #ifndef SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ |
| 27 #define SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ | 27 #define SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ |
| 28 | 28 |
| 29 #include "sky/engine/core/editing/TextGranularity.h" | 29 #include "sky/engine/core/editing/TextGranularity.h" |
| 30 #include "sky/engine/core/events/TextEventInputType.h" | 30 #include "sky/engine/core/events/TextEventInputType.h" |
| 31 #include "sky/engine/core/page/FocusType.h" | 31 #include "sky/engine/core/page/FocusType.h" |
| 32 #include "sky/engine/core/rendering/HitTestRequest.h" | 32 #include "sky/engine/core/rendering/HitTestRequest.h" |
| 33 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" | 33 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" |
| 34 #include "sky/engine/platform/Cursor.h" | |
| 35 #include "sky/engine/platform/Timer.h" | 34 #include "sky/engine/platform/Timer.h" |
| 36 #include "sky/engine/platform/geometry/LayoutPoint.h" | 35 #include "sky/engine/platform/geometry/LayoutPoint.h" |
| 37 #include "sky/engine/platform/heap/Handle.h" | 36 #include "sky/engine/platform/heap/Handle.h" |
| 38 #include "sky/engine/wtf/Forward.h" | 37 #include "sky/engine/wtf/Forward.h" |
| 39 #include "sky/engine/wtf/HashMap.h" | 38 #include "sky/engine/wtf/HashMap.h" |
| 40 #include "sky/engine/wtf/HashTraits.h" | 39 #include "sky/engine/wtf/HashTraits.h" |
| 41 #include "sky/engine/wtf/RefPtr.h" | 40 #include "sky/engine/wtf/RefPtr.h" |
| 42 | 41 |
| 43 namespace blink { | 42 namespace blink { |
| 44 | 43 |
| 45 class Document; | 44 class Document; |
| 46 class Element; | 45 class Element; |
| 47 class Event; | 46 class Event; |
| 48 class EventTarget; | 47 class EventTarget; |
| 49 class FloatPoint; | 48 class FloatPoint; |
| 50 class FloatQuad; | 49 class FloatQuad; |
| 51 class HitTestRequest; | 50 class HitTestRequest; |
| 52 class HitTestResult; | 51 class HitTestResult; |
| 53 class KeyboardEvent; | 52 class KeyboardEvent; |
| 54 class LocalFrame; | 53 class LocalFrame; |
| 55 class Node; | 54 class Node; |
| 56 class OptionalCursor; | |
| 57 class RenderLayer; | 55 class RenderLayer; |
| 58 class RenderObject; | 56 class RenderObject; |
| 59 class TextEvent; | 57 class TextEvent; |
| 60 class VisibleSelection; | 58 class VisibleSelection; |
| 61 class Widget; | 59 class Widget; |
| 62 | 60 |
| 63 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili
ngWhitespace }; | 61 enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTraili
ngWhitespace }; |
| 64 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; | 62 enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis }; |
| 65 | 63 |
| 66 class EventHandler { | 64 class EventHandler { |
| 67 WTF_MAKE_NONCOPYABLE(EventHandler); | 65 WTF_MAKE_NONCOPYABLE(EventHandler); |
| 68 public: | 66 public: |
| 69 explicit EventHandler(LocalFrame*); | 67 explicit EventHandler(LocalFrame*); |
| 70 ~EventHandler(); | 68 ~EventHandler(); |
| 71 | 69 |
| 72 void clear(); | 70 void clear(); |
| 73 void nodeWillBeRemoved(Node&); | 71 void nodeWillBeRemoved(Node&); |
| 74 | 72 |
| 75 HitTestResult hitTestResultAtPoint(const LayoutPoint&, | 73 HitTestResult hitTestResultAtPoint(const LayoutPoint&, |
| 76 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, | 74 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, |
| 77 const LayoutSize& padding = LayoutSize()); | 75 const LayoutSize& padding = LayoutSize()); |
| 78 | 76 |
| 79 void scheduleCursorUpdate(); | |
| 80 | |
| 81 void defaultKeyboardEventHandler(KeyboardEvent*); | 77 void defaultKeyboardEventHandler(KeyboardEvent*); |
| 82 | 78 |
| 83 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); | 79 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); |
| 84 void defaultTextInputEventHandler(TextEvent*); | 80 void defaultTextInputEventHandler(TextEvent*); |
| 85 | 81 |
| 86 void focusDocumentView(); | 82 void focusDocumentView(); |
| 87 | 83 |
| 88 void capsLockStateMayHaveChanged(); // Only called by FrameSelection | 84 void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
| 89 | 85 |
| 90 void notifyElementActivated(); | 86 void notifyElementActivated(); |
| 91 | 87 |
| 92 private: | 88 private: |
| 93 OptionalCursor selectCursor(const HitTestResult&); | |
| 94 OptionalCursor selectAutoCursor(const HitTestResult&, Node*); | |
| 95 | |
| 96 void hoverTimerFired(Timer<EventHandler>*); | 89 void hoverTimerFired(Timer<EventHandler>*); |
| 97 void cursorUpdateTimerFired(Timer<EventHandler>*); | |
| 98 void activeIntervalTimerFired(Timer<EventHandler>*); | 90 void activeIntervalTimerFired(Timer<EventHandler>*); |
| 99 | 91 |
| 100 bool isCursorVisible() const; | |
| 101 void updateCursor(); | |
| 102 | |
| 103 TouchAction intersectTouchAction(const TouchAction, const TouchAction); | 92 TouchAction intersectTouchAction(const TouchAction, const TouchAction); |
| 104 TouchAction computeEffectiveTouchAction(const Node&); | 93 TouchAction computeEffectiveTouchAction(const Node&); |
| 105 | 94 |
| 106 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); | 95 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); |
| 107 | 96 |
| 108 void invalidateClick(); | 97 void invalidateClick(); |
| 109 | 98 |
| 110 bool dragHysteresisExceeded(const FloatPoint&) const; | 99 bool dragHysteresisExceeded(const FloatPoint&) const; |
| 111 bool dragHysteresisExceeded(const IntPoint&) const; | 100 bool dragHysteresisExceeded(const IntPoint&) const; |
| 112 | 101 |
| 113 void defaultTabEventHandler(KeyboardEvent*); | 102 void defaultTabEventHandler(KeyboardEvent*); |
| 114 | 103 |
| 115 bool capturesDragging() const { return m_capturesDragging; } | 104 bool capturesDragging() const { return m_capturesDragging; } |
| 116 | 105 |
| 117 LocalFrame* const m_frame; | 106 LocalFrame* const m_frame; |
| 118 | 107 |
| 119 bool m_capturesDragging; | 108 bool m_capturesDragging; |
| 120 | 109 |
| 121 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; | 110 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; |
| 122 SelectionInitiationState m_selectionInitiationState; | 111 SelectionInitiationState m_selectionInitiationState; |
| 123 | 112 |
| 124 LayoutPoint m_dragStartPos; | 113 LayoutPoint m_dragStartPos; |
| 125 | 114 |
| 126 Timer<EventHandler> m_cursorUpdateTimer; | |
| 127 | |
| 128 int m_clickCount; | 115 int m_clickCount; |
| 129 RefPtr<Node> m_clickNode; | 116 RefPtr<Node> m_clickNode; |
| 130 | 117 |
| 131 RefPtr<Node> m_dragTarget; | 118 RefPtr<Node> m_dragTarget; |
| 132 bool m_shouldOnlyFireDragOverEvent; | 119 bool m_shouldOnlyFireDragOverEvent; |
| 133 | 120 |
| 134 bool m_didStartDrag; | 121 bool m_didStartDrag; |
| 135 | 122 |
| 136 Timer<EventHandler> m_activeIntervalTimer; | 123 Timer<EventHandler> m_activeIntervalTimer; |
| 137 double m_lastShowPressTimestamp; | 124 double m_lastShowPressTimestamp; |
| 138 RefPtr<Element> m_lastDeferredTapElement; | 125 RefPtr<Element> m_lastDeferredTapElement; |
| 139 }; | 126 }; |
| 140 | 127 |
| 141 } // namespace blink | 128 } // namespace blink |
| 142 | 129 |
| 143 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ | 130 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ |
| OLD | NEW |