| 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 17 matching lines...) Expand all Loading... |
| 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" | 34 #include "sky/engine/platform/Cursor.h" |
| 35 #include "sky/engine/platform/Timer.h" | 35 #include "sky/engine/platform/Timer.h" |
| 36 #include "sky/engine/platform/geometry/LayoutPoint.h" | 36 #include "sky/engine/platform/geometry/LayoutPoint.h" |
| 37 #include "sky/engine/platform/heap/Handle.h" | 37 #include "sky/engine/platform/heap/Handle.h" |
| 38 #include "sky/engine/platform/scroll/ScrollTypes.h" | |
| 39 #include "sky/engine/wtf/Forward.h" | 38 #include "sky/engine/wtf/Forward.h" |
| 40 #include "sky/engine/wtf/HashMap.h" | 39 #include "sky/engine/wtf/HashMap.h" |
| 41 #include "sky/engine/wtf/HashTraits.h" | 40 #include "sky/engine/wtf/HashTraits.h" |
| 42 #include "sky/engine/wtf/RefPtr.h" | 41 #include "sky/engine/wtf/RefPtr.h" |
| 43 | 42 |
| 44 namespace blink { | 43 namespace blink { |
| 45 | 44 |
| 46 class AutoscrollController; | |
| 47 class Document; | 45 class Document; |
| 48 class Element; | 46 class Element; |
| 49 class Event; | 47 class Event; |
| 50 class EventTarget; | 48 class EventTarget; |
| 51 class FloatPoint; | 49 class FloatPoint; |
| 52 class FloatQuad; | 50 class FloatQuad; |
| 53 class HitTestRequest; | 51 class HitTestRequest; |
| 54 class HitTestResult; | 52 class HitTestResult; |
| 55 class KeyboardEvent; | 53 class KeyboardEvent; |
| 56 class LocalFrame; | 54 class LocalFrame; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 | 65 |
| 68 class EventHandler { | 66 class EventHandler { |
| 69 WTF_MAKE_NONCOPYABLE(EventHandler); | 67 WTF_MAKE_NONCOPYABLE(EventHandler); |
| 70 public: | 68 public: |
| 71 explicit EventHandler(LocalFrame*); | 69 explicit EventHandler(LocalFrame*); |
| 72 ~EventHandler(); | 70 ~EventHandler(); |
| 73 | 71 |
| 74 void clear(); | 72 void clear(); |
| 75 void nodeWillBeRemoved(Node&); | 73 void nodeWillBeRemoved(Node&); |
| 76 | 74 |
| 77 void stopAutoscroll(); | |
| 78 | |
| 79 HitTestResult hitTestResultAtPoint(const LayoutPoint&, | 75 HitTestResult hitTestResultAtPoint(const LayoutPoint&, |
| 80 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, | 76 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, |
| 81 const LayoutSize& padding = LayoutSize()); | 77 const LayoutSize& padding = LayoutSize()); |
| 82 | 78 |
| 83 void scheduleCursorUpdate(); | 79 void scheduleCursorUpdate(); |
| 84 | 80 |
| 85 // Attempts to scroll the DOM tree. If that fails, scrolls the view. | |
| 86 // If the view can't be scrolled either, recursively bubble to the parent fr
ame. | |
| 87 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode =
0); | |
| 88 | |
| 89 void defaultKeyboardEventHandler(KeyboardEvent*); | 81 void defaultKeyboardEventHandler(KeyboardEvent*); |
| 90 | 82 |
| 91 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); | 83 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); |
| 92 void defaultTextInputEventHandler(TextEvent*); | 84 void defaultTextInputEventHandler(TextEvent*); |
| 93 | 85 |
| 94 void focusDocumentView(); | 86 void focusDocumentView(); |
| 95 | 87 |
| 96 void capsLockStateMayHaveChanged(); // Only called by FrameSelection | 88 void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
| 97 | 89 |
| 98 bool useHandCursor(Node*, bool isOverLink); | 90 bool useHandCursor(Node*, bool isOverLink); |
| 99 | 91 |
| 100 void notifyElementActivated(); | 92 void notifyElementActivated(); |
| 101 | 93 |
| 102 private: | 94 private: |
| 103 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing
Whitespace); | 95 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing
Whitespace); |
| 104 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT
railingWhitespace); | 96 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT
railingWhitespace); |
| 105 | 97 |
| 106 OptionalCursor selectCursor(const HitTestResult&); | 98 OptionalCursor selectCursor(const HitTestResult&); |
| 107 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); | 99 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); |
| 108 | 100 |
| 109 void hoverTimerFired(Timer<EventHandler>*); | 101 void hoverTimerFired(Timer<EventHandler>*); |
| 110 void cursorUpdateTimerFired(Timer<EventHandler>*); | 102 void cursorUpdateTimerFired(Timer<EventHandler>*); |
| 111 void activeIntervalTimerFired(Timer<EventHandler>*); | 103 void activeIntervalTimerFired(Timer<EventHandler>*); |
| 112 | 104 |
| 113 bool isCursorVisible() const; | 105 bool isCursorVisible() const; |
| 114 void updateCursor(); | 106 void updateCursor(); |
| 115 | 107 |
| 116 // Scrolls the elements of the DOM tree. Returns true if a node was scrolled
. | |
| 117 // False if we reached the root and couldn't scroll anything. | |
| 118 // direction - The direction to scroll in. If this is a logicl direction, it
will be | |
| 119 // converted to the physical direction based on a node's writing
mode. | |
| 120 // granularity - The units that the scroll delta parameter is in. | |
| 121 // startNode - The node to start bubbling the scroll from. If a node can't s
croll, | |
| 122 // the scroll bubbles up to the containing block. | |
| 123 // stopNode - On input, if provided and non-null, the node at which we shoul
d stop bubbling on input. | |
| 124 // On output, if provided and a node was scrolled stopNode will p
oint to that node. | |
| 125 // delta - The delta to scroll by, in the units of the granularity parameter
. (e.g. pixels, lines, pages, etc.) | |
| 126 // absolutePoint - For wheel scrolls - the location, in absolute coordinates
, where the event occured. | |
| 127 bool scroll(ScrollDirection, ScrollGranularity, Node* startNode = 0, Node**
stopNode = 0, float delta = 1.0f, IntPoint absolutePoint = IntPoint()); | |
| 128 | |
| 129 TouchAction intersectTouchAction(const TouchAction, const TouchAction); | 108 TouchAction intersectTouchAction(const TouchAction, const TouchAction); |
| 130 TouchAction computeEffectiveTouchAction(const Node&); | 109 TouchAction computeEffectiveTouchAction(const Node&); |
| 131 | 110 |
| 132 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); | 111 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); |
| 133 | 112 |
| 134 void invalidateClick(); | 113 void invalidateClick(); |
| 135 | 114 |
| 136 bool dragHysteresisExceeded(const FloatPoint&) const; | 115 bool dragHysteresisExceeded(const FloatPoint&) const; |
| 137 bool dragHysteresisExceeded(const IntPoint&) const; | 116 bool dragHysteresisExceeded(const IntPoint&) const; |
| 138 | 117 |
| 139 void defaultTabEventHandler(KeyboardEvent*); | 118 void defaultTabEventHandler(KeyboardEvent*); |
| 140 | 119 |
| 141 bool capturesDragging() const { return m_capturesDragging; } | 120 bool capturesDragging() const { return m_capturesDragging; } |
| 142 | 121 |
| 143 AutoscrollController* autoscrollController() const; | |
| 144 | |
| 145 LocalFrame* const m_frame; | 122 LocalFrame* const m_frame; |
| 146 | 123 |
| 147 bool m_capturesDragging; | 124 bool m_capturesDragging; |
| 148 | 125 |
| 149 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; | 126 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; |
| 150 SelectionInitiationState m_selectionInitiationState; | 127 SelectionInitiationState m_selectionInitiationState; |
| 151 | 128 |
| 152 LayoutPoint m_dragStartPos; | 129 LayoutPoint m_dragStartPos; |
| 153 | 130 |
| 154 Timer<EventHandler> m_cursorUpdateTimer; | 131 Timer<EventHandler> m_cursorUpdateTimer; |
| 155 | 132 |
| 156 int m_clickCount; | 133 int m_clickCount; |
| 157 RefPtr<Node> m_clickNode; | 134 RefPtr<Node> m_clickNode; |
| 158 | 135 |
| 159 RefPtr<Node> m_dragTarget; | 136 RefPtr<Node> m_dragTarget; |
| 160 bool m_shouldOnlyFireDragOverEvent; | 137 bool m_shouldOnlyFireDragOverEvent; |
| 161 | 138 |
| 162 bool m_didStartDrag; | 139 bool m_didStartDrag; |
| 163 | 140 |
| 164 Timer<EventHandler> m_activeIntervalTimer; | 141 Timer<EventHandler> m_activeIntervalTimer; |
| 165 double m_lastShowPressTimestamp; | 142 double m_lastShowPressTimestamp; |
| 166 RefPtr<Element> m_lastDeferredTapElement; | 143 RefPtr<Element> m_lastDeferredTapElement; |
| 167 }; | 144 }; |
| 168 | 145 |
| 169 } // namespace blink | 146 } // namespace blink |
| 170 | 147 |
| 171 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ | 148 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ |
| OLD | NEW |