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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 | 403 |
404 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 404 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
405 | 405 |
406 if (FrameView* frameView = m_frame->view()) { | 406 if (FrameView* frameView = m_frame->view()) { |
407 if (frameView->isPointInScrollbarCorner(event.event().position())) | 407 if (frameView->isPointInScrollbarCorner(event.event().position())) |
408 return WebInputEventResult::NotHandled; | 408 return WebInputEventResult::NotHandled; |
409 } | 409 } |
410 | 410 |
411 bool singleClick = event.event().clickCount() <= 1; | 411 bool singleClick = event.event().clickCount() <= 1; |
412 | 412 |
413 m_mouseDownMayStartDrag = singleClick; | 413 m_mouseDownMayStartDrag = singleClick && !mayBeLinkSelection(event); |
414 | 414 |
415 selectionController().handleMousePressEvent(event); | 415 selectionController().handleMousePressEvent(event); |
416 | 416 |
417 m_mouseDown = event.event(); | 417 m_mouseDown = event.event(); |
418 | 418 |
419 if (m_frame->document()->isSVGDocument() && m_frame->document()->accessSVGEx tensions().zoomAndPanEnabled()) { | 419 if (m_frame->document()->isSVGDocument() && m_frame->document()->accessSVGEx tensions().zoomAndPanEnabled()) { |
420 if (event.event().shiftKey() && singleClick) { | 420 if (event.event().shiftKey() && singleClick) { |
421 m_svgPan = true; | 421 m_svgPan = true; |
422 m_frame->document()->accessSVGExtensions().startPan(m_frame->view()- >rootFrameToContents(event.event().position())); | 422 m_frame->document()->accessSVGExtensions().startPan(m_frame->view()- >rootFrameToContents(event.event().position())); |
423 return WebInputEventResult::HandledSystem; | 423 return WebInputEventResult::HandledSystem; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 case CURSOR_WEBKIT_GRABBING: | 944 case CURSOR_WEBKIT_GRABBING: |
945 return grabbingCursor(); | 945 return grabbingCursor(); |
946 } | 946 } |
947 return pointerCursor(); | 947 return pointerCursor(); |
948 } | 948 } |
949 | 949 |
950 OptionalCursor EventHandler::selectAutoCursor(const HitTestResult& result, Node* node, const Cursor& iBeam) | 950 OptionalCursor EventHandler::selectAutoCursor(const HitTestResult& result, Node* node, const Cursor& iBeam) |
951 { | 951 { |
952 bool editable = (node && node->hasEditableStyle()); | 952 bool editable = (node && node->hasEditableStyle()); |
953 | 953 |
954 if (useHandCursor(node, result.isOverLink())) | 954 const bool isOverLink = !selectionController().mouseDownMayStartSelect() && result.isOverLink(); |
kotenkov
2016/03/09 17:27:59
This is needed so that there is a beam cursor when
| |
955 if (useHandCursor(node, isOverLink)) | |
955 return handCursor(); | 956 return handCursor(); |
956 | 957 |
957 bool inResizer = false; | 958 bool inResizer = false; |
958 LayoutObject* layoutObject = node ? node->layoutObject() : nullptr; | 959 LayoutObject* layoutObject = node ? node->layoutObject() : nullptr; |
959 if (layoutObject && m_frame->view()) { | 960 if (layoutObject && m_frame->view()) { |
960 PaintLayer* layer = layoutObject->enclosingLayer(); | 961 PaintLayer* layer = layoutObject->enclosingLayer(); |
961 inResizer = layer->scrollableArea() && layer->scrollableArea()->isPointI nResizeControl(result.roundedPointInMainFrame(), ResizerForPointer); | 962 inResizer = layer->scrollableArea() && layer->scrollableArea()->isPointI nResizeControl(result.roundedPointInMainFrame(), ResizerForPointer); |
962 } | 963 } |
963 | 964 |
964 // During selection, use an I-beam no matter what we're over. | 965 // During selection, use an I-beam no matter what we're over. |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1368 mouseEvent.getModifiers()); | 1369 mouseEvent.getModifiers()); |
1369 | 1370 |
1370 bool contextMenuEvent = mouseEvent.button() == RightButton; | 1371 bool contextMenuEvent = mouseEvent.button() == RightButton; |
1371 #if OS(MACOSX) | 1372 #if OS(MACOSX) |
1372 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. | 1373 // FIXME: The Mac port achieves the same behavior by checking whether the co ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl ementations. |
1373 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor mEvent::CtrlKey) | 1374 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor mEvent::CtrlKey) |
1374 contextMenuEvent = true; | 1375 contextMenuEvent = true; |
1375 #endif | 1376 #endif |
1376 | 1377 |
1377 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 1378 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
1378 if (m_clickCount > 0 && !contextMenuEvent && mev.innerNode() && m_clickNode && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInF latTree()) { | 1379 const bool shouldDispatchClickEvent = m_clickCount > 0 |
1380 && !contextMenuEvent | |
1381 && mev.innerNode() && m_clickNode | |
1382 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic ipateInFlatTree() | |
1383 && !(selectionController().hasExtendedSelection() && mayBeLinkSelection( mev)); | |
kotenkov
2016/03/09 17:27:59
This is needed so that no click event is sent when
| |
1384 if (shouldDispatchClickEvent) { | |
1379 // Updates distribution because a 'mouseup' event listener can make the | 1385 // Updates distribution because a 'mouseup' event listener can make the |
1380 // tree dirty at dispatchMouseEvent() invocation above. | 1386 // tree dirty at dispatchMouseEvent() invocation above. |
1381 // Unless distribution is updated, commonAncestor would hit ASSERT. | 1387 // Unless distribution is updated, commonAncestor would hit ASSERT. |
1382 // Both m_clickNode and mev.innerNode() don't need to be updated | 1388 // Both m_clickNode and mev.innerNode() don't need to be updated |
1383 // because commonAncestor() will exit early if their documents are diffe rent. | 1389 // because commonAncestor() will exit early if their documents are diffe rent. |
1384 m_clickNode->updateDistribution(); | 1390 m_clickNode->updateDistribution(); |
1385 if (Node* clickTargetNode = mev.innerNode()->commonAncestor( | 1391 if (Node* clickTargetNode = mev.innerNode()->commonAncestor( |
1386 *m_clickNode, parentForClickEvent)) { | 1392 *m_clickNode, parentForClickEvent)) { |
1387 | 1393 |
1388 // Dispatch mouseup directly w/o calling updateMouseEventTargetNode | 1394 // Dispatch mouseup directly w/o calling updateMouseEventTargetNode |
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4015 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4021 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
4016 { | 4022 { |
4017 #if OS(MACOSX) | 4023 #if OS(MACOSX) |
4018 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); | 4024 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); |
4019 #else | 4025 #else |
4020 return PlatformEvent::AltKey; | 4026 return PlatformEvent::AltKey; |
4021 #endif | 4027 #endif |
4022 } | 4028 } |
4023 | 4029 |
4024 } // namespace blink | 4030 } // namespace blink |
OLD | NEW |