| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 .isCaret(); | 247 .isCaret(); |
| 248 const bool notLeftClick = | 248 const bool notLeftClick = |
| 249 event.event().button != WebPointerProperties::Button::Left; | 249 event.event().button != WebPointerProperties::Button::Left; |
| 250 if (!isTextBoxEmpty || notLeftClick) | 250 if (!isTextBoxEmpty || notLeftClick) |
| 251 isHandleVisible = event.event().fromTouch(); | 251 isHandleVisible = event.event().fromTouch(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 updateSelectionForMouseDownDispatchingSelectStart( | 254 updateSelectionForMouseDownDispatchingSelectStart( |
| 255 innerNode, | 255 innerNode, |
| 256 expandSelectionToRespectUserSelectAll( | 256 expandSelectionToRespectUserSelectAll( |
| 257 innerNode, createVisibleSelection( | 257 innerNode, |
| 258 SelectionInFlatTree::Builder() | 258 createVisibleSelection( |
| 259 .collapse(visiblePos.toPositionWithAffinity()) | 259 SelectionInFlatTree::Builder() |
| 260 .build())), | 260 .collapse(visiblePos.toPositionWithAffinity()) |
| 261 CharacterGranularity, isHandleVisible ? HandleVisibility::Visible | 261 .build())), |
| 262 : HandleVisibility::NotVisible); | 262 CharacterGranularity, |
| 263 isHandleVisible ? HandleVisibility::Visible |
| 264 : HandleVisibility::NotVisible); |
| 263 return false; | 265 return false; |
| 264 } | 266 } |
| 265 | 267 |
| 266 static bool targetPositionIsBeforeDragStartPosition( | 268 static bool targetPositionIsBeforeDragStartPosition( |
| 267 Node* dragStartNode, | 269 Node* dragStartNode, |
| 268 const LayoutPoint& dragStartPoint, | 270 const LayoutPoint& dragStartPoint, |
| 269 Node* target, | 271 Node* target, |
| 270 const LayoutPoint& hitTestPoint) { | 272 const LayoutPoint& hitTestPoint) { |
| 271 const PositionInFlatTree& targetPosition = toPositionInFlatTree( | 273 const PositionInFlatTree& targetPosition = toPositionInFlatTree( |
| 272 target->layoutObject()->positionForPoint(hitTestPoint).position()); | 274 target->layoutObject()->positionForPoint(hitTestPoint).position()); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 visiblePositionOfHitTestResult(hitTestResult); | 703 visiblePositionOfHitTestResult(hitTestResult); |
| 702 const VisiblePositionInFlatTree& visiblePos = | 704 const VisiblePositionInFlatTree& visiblePos = |
| 703 visibleHitPos.isNull() | 705 visibleHitPos.isNull() |
| 704 ? createVisiblePosition( | 706 ? createVisiblePosition( |
| 705 PositionInFlatTree::firstPositionInOrBeforeNode(innerNode)) | 707 PositionInFlatTree::firstPositionInOrBeforeNode(innerNode)) |
| 706 : visibleHitPos; | 708 : visibleHitPos; |
| 707 | 709 |
| 708 updateSelectionForMouseDownDispatchingSelectStart( | 710 updateSelectionForMouseDownDispatchingSelectStart( |
| 709 innerNode, | 711 innerNode, |
| 710 expandSelectionToRespectUserSelectAll( | 712 expandSelectionToRespectUserSelectAll( |
| 711 innerNode, createVisibleSelection( | 713 innerNode, |
| 712 SelectionInFlatTree::Builder() | 714 createVisibleSelection( |
| 713 .collapse(visiblePos.toPositionWithAffinity()) | 715 SelectionInFlatTree::Builder() |
| 714 .build())), | 716 .collapse(visiblePos.toPositionWithAffinity()) |
| 717 .build())), |
| 715 CharacterGranularity, HandleVisibility::Visible); | 718 CharacterGranularity, HandleVisibility::Visible); |
| 716 } | 719 } |
| 717 | 720 |
| 718 bool SelectionController::handleMousePressEventDoubleClick( | 721 bool SelectionController::handleMousePressEventDoubleClick( |
| 719 const MouseEventWithHitTestResults& event) { | 722 const MouseEventWithHitTestResults& event) { |
| 720 TRACE_EVENT0("blink", | 723 TRACE_EVENT0("blink", |
| 721 "SelectionController::handleMousePressEventDoubleClick"); | 724 "SelectionController::handleMousePressEventDoubleClick"); |
| 722 | 725 |
| 723 if (!selection().isAvailable()) | 726 if (!selection().isAvailable()) |
| 724 return false; | 727 return false; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 .collapse(pos.toPositionWithAffinity()) | 774 .collapse(pos.toPositionWithAffinity()) |
| 772 .setGranularity(ParagraphGranularity) | 775 .setGranularity(ParagraphGranularity) |
| 773 .build()); | 776 .build()); |
| 774 } | 777 } |
| 775 | 778 |
| 776 const bool isHandleVisible = | 779 const bool isHandleVisible = |
| 777 event.event().fromTouch() && newSelection.isRange(); | 780 event.event().fromTouch() && newSelection.isRange(); |
| 778 | 781 |
| 779 return updateSelectionForMouseDownDispatchingSelectStart( | 782 return updateSelectionForMouseDownDispatchingSelectStart( |
| 780 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), | 783 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), |
| 781 ParagraphGranularity, isHandleVisible ? HandleVisibility::Visible | 784 ParagraphGranularity, |
| 782 : HandleVisibility::NotVisible); | 785 isHandleVisible ? HandleVisibility::Visible |
| 786 : HandleVisibility::NotVisible); |
| 783 } | 787 } |
| 784 | 788 |
| 785 void SelectionController::handleMousePressEvent( | 789 void SelectionController::handleMousePressEvent( |
| 786 const MouseEventWithHitTestResults& event) { | 790 const MouseEventWithHitTestResults& event) { |
| 787 // If we got the event back, that must mean it wasn't prevented, | 791 // If we got the event back, that must mean it wasn't prevented, |
| 788 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. | 792 // so it's allowed to start a drag or selection if it wasn't in a scrollbar. |
| 789 m_mouseDownMayStartSelect = | 793 m_mouseDownMayStartSelect = |
| 790 (canMouseDownStartSelect(event.innerNode()) || isLinkSelection(event)) && | 794 (canMouseDownStartSelect(event.innerNode()) || isLinkSelection(event)) && |
| 791 !event.scrollbar(); | 795 !event.scrollbar(); |
| 792 m_mouseDownWasSingleClickInSelection = false; | 796 m_mouseDownWasSingleClickInSelection = false; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1074 |
| 1071 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { | 1075 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { |
| 1072 bool isMouseDownOnLinkOrImage = | 1076 bool isMouseDownOnLinkOrImage = |
| 1073 event.isOverLink() || event.hitTestResult().image(); | 1077 event.isOverLink() || event.hitTestResult().image(); |
| 1074 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != | 1078 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != |
| 1075 0 && | 1079 0 && |
| 1076 !isMouseDownOnLinkOrImage; | 1080 !isMouseDownOnLinkOrImage; |
| 1077 } | 1081 } |
| 1078 | 1082 |
| 1079 } // namespace blink | 1083 } // namespace blink |
| OLD | NEW |