| 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 if (singleClick) | 613 if (singleClick) |
| 614 focusDocumentView(); | 614 focusDocumentView(); |
| 615 | 615 |
| 616 Node* innerNode = event.innerNode(); | 616 Node* innerNode = event.innerNode(); |
| 617 | 617 |
| 618 m_mousePressNode = innerNode; | 618 m_mousePressNode = innerNode; |
| 619 m_dragStartPos = event.event().position(); | 619 m_dragStartPos = event.event().position(); |
| 620 | 620 |
| 621 bool swallowEvent = false; | 621 bool swallowEvent = false; |
| 622 m_mousePressed = true; | 622 m_mousePressed = true; |
| 623 m_selectionInitiationState = HaveNotStartedSelection; | |
| 624 | 623 |
| 625 if (event.event().clickCount() == 2) | 624 if (event.event().clickCount() == 2) |
| 626 swallowEvent = handleMousePressEventDoubleClick(event); | 625 swallowEvent = handleMousePressEventDoubleClick(event); |
| 627 else if (event.event().clickCount() >= 3) | 626 else if (event.event().clickCount() >= 3) |
| 628 swallowEvent = handleMousePressEventTripleClick(event); | 627 swallowEvent = handleMousePressEventTripleClick(event); |
| 629 else | 628 else |
| 630 swallowEvent = handleMousePressEventSingleClick(event); | 629 swallowEvent = handleMousePressEventSingleClick(event); |
| 631 | 630 |
| 632 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect | 631 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect |
| 633 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod
e->renderBox()->canBeProgramaticallyScrolled()); | 632 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod
e->renderBox()->canBeProgramaticallyScrolled()); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 m_resizeScrollableArea->setInResizeMode(true); | 1275 m_resizeScrollableArea->setInResizeMode(true); |
| 1277 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC
orner(p); | 1276 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC
orner(p); |
| 1278 invalidateClick(); | 1277 invalidateClick(); |
| 1279 return true; | 1278 return true; |
| 1280 } | 1279 } |
| 1281 } | 1280 } |
| 1282 | 1281 |
| 1283 m_frame->selection().setCaretBlinkingSuspended(true); | 1282 m_frame->selection().setCaretBlinkingSuspended(true); |
| 1284 | 1283 |
| 1285 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.inner
Node(), m_clickCount, mouseEvent, true); | 1284 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.inner
Node(), m_clickCount, mouseEvent, true); |
| 1285 // m_selectionInitiationState is initialized after dispatching mousedown eve
nt in order not to keep the selection by DOM APIs |
| 1286 // Because we can't give the user the chance to handle the selection by user
action like dragging if we keep the selection in case of mousedown. |
| 1287 // FireFox also has the same behavior and it's more compatible with other br
owsers. |
| 1288 m_selectionInitiationState = HaveNotStartedSelection; |
| 1286 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); | 1289 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); |
| 1287 m_capturesDragging = !swallowEvent || mev.scrollbar(); | 1290 m_capturesDragging = !swallowEvent || mev.scrollbar(); |
| 1288 | 1291 |
| 1289 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults | 1292 // If the hit testing originally determined the event was in a scrollbar, re
fetch the MouseEventWithHitTestResults |
| 1290 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. | 1293 // in case the scrollbar widget was destroyed when the mouse event was handl
ed. |
| 1291 if (mev.scrollbar()) { | 1294 if (mev.scrollbar()) { |
| 1292 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); | 1295 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou
se.get(); |
| 1293 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); | 1296 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); |
| 1294 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); | 1297 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou
seEvent); |
| 1295 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) | 1298 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get
()) |
| (...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2930 } | 2933 } |
| 2931 | 2934 |
| 2932 void EventHandler::notifyElementActivated() | 2935 void EventHandler::notifyElementActivated() |
| 2933 { | 2936 { |
| 2934 // Since another element has been set to active, stop current timer and clea
r reference. | 2937 // Since another element has been set to active, stop current timer and clea
r reference. |
| 2935 if (m_activeIntervalTimer.isActive()) | 2938 if (m_activeIntervalTimer.isActive()) |
| 2936 m_activeIntervalTimer.stop(); | 2939 m_activeIntervalTimer.stop(); |
| 2937 m_lastDeferredTapElement = nullptr; | 2940 m_lastDeferredTapElement = nullptr; |
| 2938 } | 2941 } |
| 2939 | 2942 |
| 2943 void EventHandler::notifySelectionChanged() |
| 2944 { |
| 2945 m_selectionInitiationState = ExtendedSelection; |
| 2946 } |
| 2947 |
| 2940 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt) | 2948 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt) |
| 2941 { | 2949 { |
| 2942 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. | 2950 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. |
| 2943 // IE matches lower and upper case access keys regardless of Shift key state
- but if both upper and | 2951 // IE matches lower and upper case access keys regardless of Shift key state
- but if both upper and |
| 2944 // lower case variants are present in a document, the correct element is mat
ched based on Shift key state. | 2952 // lower case variants are present in a document, the correct element is mat
ched based on Shift key state. |
| 2945 // Firefox only matches an access key if Shift is not pressed, and does that
case-insensitively. | 2953 // Firefox only matches an access key if Shift is not pressed, and does that
case-insensitively. |
| 2946 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); | 2954 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); |
| 2947 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) | 2955 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) |
| 2948 return false; | 2956 return false; |
| 2949 String key = evt.unmodifiedText(); | 2957 String key = evt.unmodifiedText(); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 unsigned EventHandler::accessKeyModifiers() | 3868 unsigned EventHandler::accessKeyModifiers() |
| 3861 { | 3869 { |
| 3862 #if OS(MACOSX) | 3870 #if OS(MACOSX) |
| 3863 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3871 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3864 #else | 3872 #else |
| 3865 return PlatformEvent::AltKey; | 3873 return PlatformEvent::AltKey; |
| 3866 #endif | 3874 #endif |
| 3867 } | 3875 } |
| 3868 | 3876 |
| 3869 } // namespace blink | 3877 } // namespace blink |
| OLD | NEW |