| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 class EventHandler { | 75 class EventHandler { |
| 76 WTF_MAKE_NONCOPYABLE(EventHandler); | 76 WTF_MAKE_NONCOPYABLE(EventHandler); |
| 77 public: | 77 public: |
| 78 explicit EventHandler(LocalFrame*); | 78 explicit EventHandler(LocalFrame*); |
| 79 ~EventHandler(); | 79 ~EventHandler(); |
| 80 | 80 |
| 81 void clear(); | 81 void clear(); |
| 82 void nodeWillBeRemoved(Node&); | 82 void nodeWillBeRemoved(Node&); |
| 83 | 83 |
| 84 void updateSelectionForMouseDrag(); | |
| 85 | |
| 86 Node* mousePressNode() const; | |
| 87 | |
| 88 void stopAutoscroll(); | 84 void stopAutoscroll(); |
| 89 | 85 |
| 90 HitTestResult hitTestResultAtPoint(const LayoutPoint&, | 86 HitTestResult hitTestResultAtPoint(const LayoutPoint&, |
| 91 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, | 87 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly |
HitTestRequest::Active, |
| 92 const LayoutSize& padding = LayoutSize()); | 88 const LayoutSize& padding = LayoutSize()); |
| 93 | 89 |
| 94 bool mousePressed() const { return m_mousePressed; } | |
| 95 void setMousePressed(bool pressed) { m_mousePressed = pressed; } | |
| 96 | |
| 97 void scheduleHoverStateUpdate(); | |
| 98 void scheduleCursorUpdate(); | 90 void scheduleCursorUpdate(); |
| 99 | 91 |
| 100 IntPoint lastKnownMousePosition() const; | |
| 101 Cursor currentMouseCursor() const { return m_currentMouseCursor; } | |
| 102 | |
| 103 // Attempts to scroll the DOM tree. If that fails, scrolls the view. | 92 // Attempts to scroll the DOM tree. If that fails, scrolls the view. |
| 104 // If the view can't be scrolled either, recursively bubble to the parent fr
ame. | 93 // If the view can't be scrolled either, recursively bubble to the parent fr
ame. |
| 105 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode =
0); | 94 bool bubblingScroll(ScrollDirection, ScrollGranularity, Node* startingNode =
0); |
| 106 | 95 |
| 107 void setMouseDownMayStartAutoscroll() { m_mouseDownMayStartAutoscroll = true
; } | |
| 108 | |
| 109 bool keyEvent(const PlatformKeyboardEvent&); | 96 bool keyEvent(const PlatformKeyboardEvent&); |
| 110 void defaultKeyboardEventHandler(KeyboardEvent*); | 97 void defaultKeyboardEventHandler(KeyboardEvent*); |
| 111 | 98 |
| 112 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); | 99 bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, Te
xtEventInputType = TextEventInputKeyboard); |
| 113 void defaultTextInputEventHandler(TextEvent*); | 100 void defaultTextInputEventHandler(TextEvent*); |
| 114 | 101 |
| 115 void focusDocumentView(); | 102 void focusDocumentView(); |
| 116 | 103 |
| 117 void capsLockStateMayHaveChanged(); // Only called by FrameSelection | 104 void capsLockStateMayHaveChanged(); // Only called by FrameSelection |
| 118 | 105 |
| 119 bool useHandCursor(Node*, bool isOverLink); | 106 bool useHandCursor(Node*, bool isOverLink); |
| 120 | 107 |
| 121 void notifyElementActivated(); | 108 void notifyElementActivated(); |
| 122 | 109 |
| 123 private: | 110 private: |
| 124 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleS
election&, TextGranularity); | |
| 125 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing
Whitespace); | 111 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailing
Whitespace); |
| 126 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT
railingWhitespace); | 112 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, AppendT
railingWhitespace); |
| 127 | 113 |
| 128 OptionalCursor selectCursor(const HitTestResult&); | 114 OptionalCursor selectCursor(const HitTestResult&); |
| 129 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); | 115 OptionalCursor selectAutoCursor(const HitTestResult&, Node*, const Cursor& i
Beam); |
| 130 | 116 |
| 131 void hoverTimerFired(Timer<EventHandler>*); | 117 void hoverTimerFired(Timer<EventHandler>*); |
| 132 void cursorUpdateTimerFired(Timer<EventHandler>*); | 118 void cursorUpdateTimerFired(Timer<EventHandler>*); |
| 133 void activeIntervalTimerFired(Timer<EventHandler>*); | 119 void activeIntervalTimerFired(Timer<EventHandler>*); |
| 134 | 120 |
| 135 bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } | |
| 136 | |
| 137 bool isCursorVisible() const; | 121 bool isCursorVisible() const; |
| 138 void updateCursor(); | 122 void updateCursor(); |
| 139 | 123 |
| 140 bool isInsideScrollbar(const IntPoint&) const; | 124 bool isInsideScrollbar(const IntPoint&) const; |
| 141 | 125 |
| 142 ScrollableArea* associatedScrollableArea(const RenderLayer*) const; | 126 ScrollableArea* associatedScrollableArea(const RenderLayer*) const; |
| 143 | 127 |
| 144 // Scrolls the elements of the DOM tree. Returns true if a node was scrolled
. | 128 // Scrolls the elements of the DOM tree. Returns true if a node was scrolled
. |
| 145 // False if we reached the root and couldn't scroll anything. | 129 // False if we reached the root and couldn't scroll anything. |
| 146 // direction - The direction to scroll in. If this is a logicl direction, it
will be | 130 // direction - The direction to scroll in. If this is a logicl direction, it
will be |
| (...skipping 12 matching lines...) Expand all Loading... |
| 159 | 143 |
| 160 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); | 144 HitTestResult hitTestResultInFrame(LocalFrame*, const LayoutPoint&, HitTestR
equest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::
Active); |
| 161 | 145 |
| 162 void invalidateClick(); | 146 void invalidateClick(); |
| 163 | 147 |
| 164 bool dragHysteresisExceeded(const FloatPoint&) const; | 148 bool dragHysteresisExceeded(const FloatPoint&) const; |
| 165 bool dragHysteresisExceeded(const IntPoint&) const; | 149 bool dragHysteresisExceeded(const IntPoint&) const; |
| 166 | 150 |
| 167 void defaultTabEventHandler(KeyboardEvent*); | 151 void defaultTabEventHandler(KeyboardEvent*); |
| 168 | 152 |
| 169 void updateSelectionForMouseDrag(const HitTestResult&); | |
| 170 | |
| 171 void updateLastScrollbarUnderMouse(Scrollbar*, bool); | |
| 172 | |
| 173 bool capturesDragging() const { return m_capturesDragging; } | 153 bool capturesDragging() const { return m_capturesDragging; } |
| 174 | 154 |
| 175 AutoscrollController* autoscrollController() const; | 155 AutoscrollController* autoscrollController() const; |
| 176 | 156 |
| 177 LocalFrame* const m_frame; | 157 LocalFrame* const m_frame; |
| 178 | 158 |
| 179 bool m_mousePressed; | |
| 180 bool m_capturesDragging; | 159 bool m_capturesDragging; |
| 181 RefPtr<Node> m_mousePressNode; | |
| 182 | 160 |
| 183 bool m_mouseDownMayStartSelect; | |
| 184 bool m_mouseDownMayStartDrag; | |
| 185 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; | 161 enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, Extend
edSelection }; |
| 186 SelectionInitiationState m_selectionInitiationState; | 162 SelectionInitiationState m_selectionInitiationState; |
| 187 | 163 |
| 188 LayoutPoint m_dragStartPos; | 164 LayoutPoint m_dragStartPos; |
| 189 | 165 |
| 190 Timer<EventHandler> m_hoverTimer; | |
| 191 Timer<EventHandler> m_cursorUpdateTimer; | 166 Timer<EventHandler> m_cursorUpdateTimer; |
| 192 | 167 |
| 193 bool m_mouseDownMayStartAutoscroll; | |
| 194 | |
| 195 RefPtr<Node> m_nodeUnderMouse; | |
| 196 RefPtr<Node> m_lastNodeUnderMouse; | |
| 197 RefPtr<Scrollbar> m_lastScrollbarUnderMouse; | |
| 198 Cursor m_currentMouseCursor; | |
| 199 | |
| 200 int m_clickCount; | 168 int m_clickCount; |
| 201 RefPtr<Node> m_clickNode; | 169 RefPtr<Node> m_clickNode; |
| 202 | 170 |
| 203 RefPtr<Node> m_dragTarget; | 171 RefPtr<Node> m_dragTarget; |
| 204 bool m_shouldOnlyFireDragOverEvent; | 172 bool m_shouldOnlyFireDragOverEvent; |
| 205 | 173 |
| 206 bool m_mousePositionIsUnknown; | |
| 207 IntPoint m_lastKnownMousePosition; | |
| 208 IntPoint m_lastKnownMouseGlobalPosition; | |
| 209 IntPoint m_mouseDownPos; // In our view's coords. | |
| 210 | |
| 211 RefPtr<Node> m_previousWheelScrolledNode; | |
| 212 | |
| 213 double m_maxMouseMovedDuration; | |
| 214 bool m_didStartDrag; | 174 bool m_didStartDrag; |
| 215 | 175 |
| 216 Timer<EventHandler> m_activeIntervalTimer; | 176 Timer<EventHandler> m_activeIntervalTimer; |
| 217 double m_lastShowPressTimestamp; | 177 double m_lastShowPressTimestamp; |
| 218 RefPtr<Element> m_lastDeferredTapElement; | 178 RefPtr<Element> m_lastDeferredTapElement; |
| 219 }; | 179 }; |
| 220 | 180 |
| 221 } // namespace blink | 181 } // namespace blink |
| 222 | 182 |
| 223 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ | 183 #endif // SKY_ENGINE_CORE_PAGE_EVENTHANDLER_H_ |
| OLD | NEW |