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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 if (singleClick) | 361 if (singleClick) |
362 focusDocumentView(); | 362 focusDocumentView(); |
363 | 363 |
364 Node* innerNode = event.innerNode(); | 364 Node* innerNode = event.innerNode(); |
365 | 365 |
366 m_mousePressNode = innerNode; | 366 m_mousePressNode = innerNode; |
367 m_dragStartPos = event.event().position(); | 367 m_dragStartPos = event.event().position(); |
368 | 368 |
369 bool swallowEvent = false; | 369 bool swallowEvent = false; |
370 m_mousePressed = true; | 370 m_mousePressed = true; |
371 selectionController().initializeSelectionState(); | |
372 | 371 |
373 if (event.event().clickCount() == 2) | 372 if (event.event().clickCount() == 2) |
374 swallowEvent = selectionController().handleMousePressEventDoubleClick(ev
ent); | 373 swallowEvent = selectionController().handleMousePressEventDoubleClick(ev
ent); |
375 else if (event.event().clickCount() >= 3) | 374 else if (event.event().clickCount() >= 3) |
376 swallowEvent = selectionController().handleMousePressEventTripleClick(ev
ent); | 375 swallowEvent = selectionController().handleMousePressEventTripleClick(ev
ent); |
377 else | 376 else |
378 swallowEvent = selectionController().handleMousePressEventSingleClick(ev
ent); | 377 swallowEvent = selectionController().handleMousePressEventSingleClick(ev
ent); |
379 | 378 |
380 m_mouseDownMayStartAutoscroll = selectionController().mouseDownMayStartSelec
t() | 379 m_mouseDownMayStartAutoscroll = selectionController().mouseDownMayStartSelec
t() |
381 || (m_mousePressNode && m_mousePressNode->layoutBox() && m_mousePressNod
e->layoutBox()->canBeProgramaticallyScrolled()); | 380 || (m_mousePressNode && m_mousePressNode->layoutBox() && m_mousePressNod
e->layoutBox()->canBeProgramaticallyScrolled()); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 m_resizeScrollableArea->setInResizeMode(true); | 948 m_resizeScrollableArea->setInResizeMode(true); |
950 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset
FromResizeCorner(p)); | 949 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset
FromResizeCorner(p)); |
951 invalidateClick(); | 950 invalidateClick(); |
952 return true; | 951 return true; |
953 } | 952 } |
954 } | 953 } |
955 | 954 |
956 m_frame->selection().setCaretBlinkingSuspended(true); | 955 m_frame->selection().setCaretBlinkingSuspended(true); |
957 | 956 |
958 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.inner
Node(), m_clickCount, mouseEvent, true); | 957 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.inner
Node(), m_clickCount, mouseEvent, true); |
| 958 // m_selectionInitiationState is initialized after dispatching mousedown |
| 959 // event in order not to keep the selection by DOM APIs Because we can't |
| 960 // give the user the chance to handle the selection by user action like |
| 961 // dragging if we keep the selection in case of mousedown. FireFox also has |
| 962 // the same behavior and it's more compatible with other browsers. |
| 963 selectionController().initializeSelectionState(); |
959 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, mouseEvent.posit
ion(), HitTestRequest::ReadOnly); | 964 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, mouseEvent.posit
ion(), HitTestRequest::ReadOnly); |
960 swallowEvent = swallowEvent || handleMouseFocus(MouseEventWithHitTestResults
(mouseEvent, hitTestResult)); | 965 swallowEvent = swallowEvent || handleMouseFocus(MouseEventWithHitTestResults
(mouseEvent, hitTestResult)); |
961 m_capturesDragging = !swallowEvent || mev.scrollbar(); | 966 m_capturesDragging = !swallowEvent || mev.scrollbar(); |
962 | 967 |
963 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults | 968 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults |
964 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. | 969 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. |
965 if (mev.scrollbar()) { | 970 if (mev.scrollbar()) { |
966 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); | 971 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); |
967 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); | 972 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); |
968 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); | 973 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 IntPoint tappedPosition = gestureEvent.position(); | 2030 IntPoint tappedPosition = gestureEvent.position(); |
2026 | 2031 |
2027 if (m_clickNode && m_clickNode->isTextNode()) | 2032 if (m_clickNode && m_clickNode->isTextNode()) |
2028 m_clickNode = ComposedTreeTraversal::parent(*m_clickNode); | 2033 m_clickNode = ComposedTreeTraversal::parent(*m_clickNode); |
2029 | 2034 |
2030 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), | 2035 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), |
2031 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), | 2036 LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(), |
2032 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), | 2037 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), |
2033 PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); | 2038 PlatformMouseEvent::FromTouch, gestureEvent.timestamp()); |
2034 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); | 2039 bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown,
currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown, true); |
| 2040 selectionController().initializeSelectionState(); |
2035 if (!swallowMouseDownEvent) | 2041 if (!swallowMouseDownEvent) |
2036 swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fa
keMouseDown, currentHitTest)); | 2042 swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fa
keMouseDown, currentHitTest)); |
2037 if (!swallowMouseDownEvent) | 2043 if (!swallowMouseDownEvent) |
2038 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); | 2044 swallowMouseDownEvent = handleMousePressEvent(MouseEventWithHitTestResul
ts(fakeMouseDown, currentHitTest)); |
2039 | 2045 |
2040 if (currentHitTest.innerNode()) { | 2046 if (currentHitTest.innerNode()) { |
2041 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap); | 2047 ASSERT(gestureEvent.type() == PlatformEvent::GestureTap); |
2042 HitTestResult result = currentHitTest; | 2048 HitTestResult result = currentHitTest; |
2043 result.setToShadowHostIfInUserAgentShadowRoot(); | 2049 result.setToShadowHostIfInUserAgentShadowRoot(); |
2044 m_frame->chromeClient().onMouseDown(result.innerNode()); | 2050 m_frame->chromeClient().onMouseDown(result.innerNode()); |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4014 unsigned EventHandler::accessKeyModifiers() | 4020 unsigned EventHandler::accessKeyModifiers() |
4015 { | 4021 { |
4016 #if OS(MACOSX) | 4022 #if OS(MACOSX) |
4017 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4023 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4018 #else | 4024 #else |
4019 return PlatformEvent::AltKey; | 4025 return PlatformEvent::AltKey; |
4020 #endif | 4026 #endif |
4021 } | 4027 } |
4022 | 4028 |
4023 } // namespace blink | 4029 } // namespace blink |
OLD | NEW |