| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 m_eventHandlerWillResetCapturingMouseEventsNode = false; | 324 m_eventHandlerWillResetCapturingMouseEventsNode = false; |
| 325 m_mouseDownWasSingleClickInSelection = false; | 325 m_mouseDownWasSingleClickInSelection = false; |
| 326 m_selectionInitiationState = HaveNotStartedSelection; | 326 m_selectionInitiationState = HaveNotStartedSelection; |
| 327 m_mouseDownMayStartAutoscroll = false; | 327 m_mouseDownMayStartAutoscroll = false; |
| 328 m_svgPan = false; | 328 m_svgPan = false; |
| 329 m_mouseDownPos = IntPoint(); | 329 m_mouseDownPos = IntPoint(); |
| 330 m_mouseDownTimestamp = 0; | 330 m_mouseDownTimestamp = 0; |
| 331 m_longTapShouldInvokeContextMenu = false; | 331 m_longTapShouldInvokeContextMenu = false; |
| 332 m_dragStartPos = LayoutPoint(); | 332 m_dragStartPos = LayoutPoint(); |
| 333 m_offsetFromResizeCorner = LayoutSize(); | 333 m_offsetFromResizeCorner = LayoutSize(); |
| 334 m_currentMouseCursor = Cursor(); | |
| 335 m_mouseDown = PlatformMouseEvent(); | 334 m_mouseDown = PlatformMouseEvent(); |
| 336 | |
| 337 } | 335 } |
| 338 | 336 |
| 339 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) | 337 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) |
| 340 { | 338 { |
| 341 if (nodeToBeRemoved.containsIncludingShadowDOM(m_clickNode.get())) { | 339 if (nodeToBeRemoved.containsIncludingShadowDOM(m_clickNode.get())) { |
| 342 // We don't dispatch click events if the mousedown node is removed | 340 // We don't dispatch click events if the mousedown node is removed |
| 343 // before a mouseup event. It is compatible with IE and Firefox. | 341 // before a mouseup event. It is compatible with IE and Firefox. |
| 344 m_clickNode = nullptr; | 342 m_clickNode = nullptr; |
| 345 } | 343 } |
| 346 } | 344 } |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 void EventHandler::cursorUpdateTimerFired(Timer<EventHandler>*) | 1038 void EventHandler::cursorUpdateTimerFired(Timer<EventHandler>*) |
| 1041 { | 1039 { |
| 1042 ASSERT(m_frame); | 1040 ASSERT(m_frame); |
| 1043 ASSERT(m_frame->document()); | 1041 ASSERT(m_frame->document()); |
| 1044 | 1042 |
| 1045 updateCursor(); | 1043 updateCursor(); |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 void EventHandler::updateCursor() | 1046 void EventHandler::updateCursor() |
| 1049 { | 1047 { |
| 1048 // We must do a cross-frame hit test because the frame that triggered the cu
rsor |
| 1049 // update could be occluded by a different frame. |
| 1050 ASSERT(m_frame == m_frame->localFrameRoot()); |
| 1051 |
| 1050 if (m_mousePositionIsUnknown) | 1052 if (m_mousePositionIsUnknown) |
| 1051 return; | 1053 return; |
| 1052 | 1054 |
| 1053 FrameView* view = m_frame->view(); | 1055 FrameView* view = m_frame->view(); |
| 1054 if (!view || !view->shouldSetCursor()) | 1056 if (!view || !view->shouldSetCursor()) |
| 1055 return; | 1057 return; |
| 1056 | 1058 |
| 1057 LayoutView* layoutView = view->layoutView(); | 1059 LayoutView* layoutView = view->layoutView(); |
| 1058 if (!layoutView) | 1060 if (!layoutView) |
| 1059 return; | 1061 return; |
| 1060 | 1062 |
| 1061 m_frame->document()->updateLayout(); | 1063 m_frame->document()->updateLayout(); |
| 1062 | 1064 |
| 1063 HitTestRequest request(HitTestRequest::ReadOnly); | 1065 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::AllowChild
FrameContent); |
| 1064 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi
tion)); | 1066 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi
tion)); |
| 1065 layoutView->hitTest(result); | 1067 layoutView->hitTest(result); |
| 1066 | 1068 |
| 1067 OptionalCursor optionalCursor = selectCursor(result); | 1069 if (LocalFrame* frame = result.innerNodeFrame()) { |
| 1068 if (optionalCursor.isCursorChange()) { | 1070 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul
t); |
| 1069 m_currentMouseCursor = optionalCursor.cursor(); | 1071 if (optionalCursor.isCursorChange()) { |
| 1070 view->setCursor(m_currentMouseCursor); | 1072 view->setCursor(optionalCursor.cursor()); |
| 1073 } |
| 1071 } | 1074 } |
| 1072 } | 1075 } |
| 1073 | 1076 |
| 1074 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) | 1077 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) |
| 1075 { | 1078 { |
| 1076 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) | 1079 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) |
| 1077 return NoCursorChange; | 1080 return NoCursorChange; |
| 1078 | 1081 |
| 1079 Page* page = m_frame->page(); | 1082 Page* page = m_frame->page(); |
| 1080 if (!page) | 1083 if (!page) |
| 1081 return NoCursorChange; | 1084 return NoCursorChange; |
| 1082 #if OS(WIN) | |
| 1083 if (panScrollInProgress()) | 1085 if (panScrollInProgress()) |
| 1084 return NoCursorChange; | 1086 return NoCursorChange; |
| 1085 #endif | |
| 1086 | 1087 |
| 1087 Node* node = result.innerPossiblyPseudoNode(); | 1088 Node* node = result.innerPossiblyPseudoNode(); |
| 1088 if (!node) | 1089 if (!node) |
| 1089 return selectAutoCursor(result, node, iBeamCursor()); | 1090 return selectAutoCursor(result, node, iBeamCursor()); |
| 1090 | 1091 |
| 1091 LayoutObject* renderer = node->layoutObject(); | 1092 LayoutObject* renderer = node->layoutObject(); |
| 1092 const ComputedStyle* style = renderer ? renderer->style() : nullptr; | 1093 const ComputedStyle* style = renderer ? renderer->style() : nullptr; |
| 1093 | 1094 |
| 1094 if (renderer) { | 1095 if (renderer) { |
| 1095 Cursor overrideCursor; | 1096 Cursor overrideCursor; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target | 1514 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target |
| 1514 // node to be detached from its FrameView, in which case the event shoul
d not be passed. | 1515 // node to be detached from its FrameView, in which case the event shoul
d not be passed. |
| 1515 if (newSubframe->view()) | 1516 if (newSubframe->view()) |
| 1516 swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(),
hoveredNode); | 1517 swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(),
hoveredNode); |
| 1517 } else { | 1518 } else { |
| 1518 if (scrollbar && !m_mousePressed) | 1519 if (scrollbar && !m_mousePressed) |
| 1519 scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platfo
rms that support visual feedback on scrollbar hovering. | 1520 scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platfo
rms that support visual feedback on scrollbar hovering. |
| 1520 if (FrameView* view = m_frame->view()) { | 1521 if (FrameView* view = m_frame->view()) { |
| 1521 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); | 1522 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); |
| 1522 if (optionalCursor.isCursorChange()) { | 1523 if (optionalCursor.isCursorChange()) { |
| 1523 m_currentMouseCursor = optionalCursor.cursor(); | 1524 view->setCursor(optionalCursor.cursor()); |
| 1524 view->setCursor(m_currentMouseCursor); | |
| 1525 } | 1525 } |
| 1526 } | 1526 } |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 m_lastMouseMoveEventSubframe = newSubframe; | 1529 m_lastMouseMoveEventSubframe = newSubframe; |
| 1530 | 1530 |
| 1531 if (swallowEvent) | 1531 if (swallowEvent) |
| 1532 return true; | 1532 return true; |
| 1533 | 1533 |
| 1534 swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.innerNode(
), 0, mouseEvent, true); | 1534 swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.innerNode(
), 0, mouseEvent, true); |
| (...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 } | 3127 } |
| 3128 | 3128 |
| 3129 void EventHandler::scheduleHoverStateUpdate() | 3129 void EventHandler::scheduleHoverStateUpdate() |
| 3130 { | 3130 { |
| 3131 if (!m_hoverTimer.isActive()) | 3131 if (!m_hoverTimer.isActive()) |
| 3132 m_hoverTimer.startOneShot(0, FROM_HERE); | 3132 m_hoverTimer.startOneShot(0, FROM_HERE); |
| 3133 } | 3133 } |
| 3134 | 3134 |
| 3135 void EventHandler::scheduleCursorUpdate() | 3135 void EventHandler::scheduleCursorUpdate() |
| 3136 { | 3136 { |
| 3137 // We only want one timer for the page, rather than each frame having it's o
wn timer |
| 3138 // competing which eachother (since there's only one mouse cursor). |
| 3139 ASSERT(m_frame == m_frame->localFrameRoot()); |
| 3140 |
| 3137 if (!m_cursorUpdateTimer.isActive()) | 3141 if (!m_cursorUpdateTimer.isActive()) |
| 3138 m_cursorUpdateTimer.startOneShot(cursorUpdateInterval, FROM_HERE); | 3142 m_cursorUpdateTimer.startOneShot(cursorUpdateInterval, FROM_HERE); |
| 3139 } | 3143 } |
| 3140 | 3144 |
| 3141 void EventHandler::dispatchFakeMouseMoveEventSoon() | 3145 void EventHandler::dispatchFakeMouseMoveEventSoon() |
| 3142 { | 3146 { |
| 3143 if (m_mousePressed) | 3147 if (m_mousePressed) |
| 3144 return; | 3148 return; |
| 3145 | 3149 |
| 3146 if (m_mousePositionIsUnknown) | 3150 if (m_mousePositionIsUnknown) |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4135 unsigned EventHandler::accessKeyModifiers() | 4139 unsigned EventHandler::accessKeyModifiers() |
| 4136 { | 4140 { |
| 4137 #if OS(MACOSX) | 4141 #if OS(MACOSX) |
| 4138 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4142 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 4139 #else | 4143 #else |
| 4140 return PlatformEvent::AltKey; | 4144 return PlatformEvent::AltKey; |
| 4141 #endif | 4145 #endif |
| 4142 } | 4146 } |
| 4143 | 4147 |
| 4144 } // namespace blink | 4148 } // namespace blink |
| OLD | NEW |