OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
6 * Copyright (C) 2015 Google Inc. All rights reserved. | 6 * Copyright (C) 2015 Google Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 return updateSelectionForMouseDownDispatchingSelectStart( | 777 return updateSelectionForMouseDownDispatchingSelectStart( |
778 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), | 778 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), |
779 ParagraphGranularity, isHandleVisible ? HandleVisibility::Visible | 779 ParagraphGranularity, isHandleVisible ? HandleVisibility::Visible |
780 : HandleVisibility::NotVisible); | 780 : HandleVisibility::NotVisible); |
781 } | 781 } |
782 | 782 |
783 void SelectionController::handleMousePressEvent( | 783 void SelectionController::handleMousePressEvent( |
784 const MouseEventWithHitTestResults& event) { | 784 const MouseEventWithHitTestResults& event) { |
785 // If we got the event back, that must mean it wasn't prevented, | 785 // If we got the event back, that must mean it wasn't prevented, |
786 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. | 786 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. |
787 m_mouseDownMayStartSelect = | 787 m_mouseDownMayStartSelect = (canMouseDownStartSelect(event.innerNode()) || |
788 (canMouseDownStartSelect(event.innerNode()) || isLinkSelection(event)) && | 788 isSelectionOverLink(event)) && |
789 !event.scrollbar(); | 789 !event.scrollbar(); |
790 m_mouseDownWasSingleClickInSelection = false; | 790 m_mouseDownWasSingleClickInSelection = false; |
791 if (!selection().isAvailable()) { | 791 if (!selection().isAvailable()) { |
792 // "gesture-tap-frame-removed.html" reaches here. | 792 // "gesture-tap-frame-removed.html" reaches here. |
793 m_mouseDownAllowsMultiClick = !event.event().fromTouch(); | 793 m_mouseDownAllowsMultiClick = !event.event().fromTouch(); |
794 return; | 794 return; |
795 } | 795 } |
796 | 796 |
797 // Avoid double-tap touch gesture confusion by restricting multi-click side | 797 // Avoid double-tap touch gesture confusion by restricting multi-click side |
798 // effects, e.g., word selection, to editable regions. | 798 // effects, e.g., word selection, to editable regions. |
799 m_mouseDownAllowsMultiClick = | 799 m_mouseDownAllowsMultiClick = |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 m_selectionState = SelectionState::ExtendedSelection; | 1072 m_selectionState = SelectionState::ExtendedSelection; |
1073 return; | 1073 return; |
1074 } | 1074 } |
1075 NOTREACHED() << "We should handle all SelectionType" << selection; | 1075 NOTREACHED() << "We should handle all SelectionType" << selection; |
1076 } | 1076 } |
1077 | 1077 |
1078 FrameSelection& SelectionController::selection() const { | 1078 FrameSelection& SelectionController::selection() const { |
1079 return m_frame->selection(); | 1079 return m_frame->selection(); |
1080 } | 1080 } |
1081 | 1081 |
1082 bool isLinkSelection(const MouseEventWithHitTestResults& event) { | 1082 bool isSelectionOverLink(const MouseEventWithHitTestResults& event) { |
1083 return (event.event().modifiers() & WebInputEvent::Modifiers::AltKey) != 0 && | 1083 return (event.event().modifiers() & WebInputEvent::Modifiers::AltKey) != 0 && |
1084 event.isOverLink(); | 1084 event.isOverLink(); |
1085 } | 1085 } |
1086 | 1086 |
1087 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { | 1087 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { |
1088 bool isMouseDownOnLinkOrImage = | 1088 bool isMouseDownOnLinkOrImage = |
1089 event.isOverLink() || event.hitTestResult().image(); | 1089 event.isOverLink() || event.hitTestResult().image(); |
1090 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != | 1090 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != |
1091 0 && | 1091 0 && |
1092 !isMouseDownOnLinkOrImage; | 1092 !isMouseDownOnLinkOrImage; |
1093 } | 1093 } |
1094 | 1094 |
1095 } // namespace blink | 1095 } // namespace blink |
OLD | NEW |