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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 685 } |
686 | 686 |
687 // Adjusting base and extent will make newSelection always directional | 687 // Adjusting base and extent will make newSelection always directional |
688 newSelection.setIsDirectional(isDirectional); | 688 newSelection.setIsDirectional(isDirectional); |
689 const bool isHandleVisible = handleVisibility == HandleVisibility::Visible; | 689 const bool isHandleVisible = handleVisibility == HandleVisibility::Visible; |
690 if (selection().visibleSelection<EditingInFlatTreeStrategy>() == | 690 if (selection().visibleSelection<EditingInFlatTreeStrategy>() == |
691 newSelection && | 691 newSelection && |
692 selection().isHandleVisible() == isHandleVisible) | 692 selection().isHandleVisible() == isHandleVisible) |
693 return; | 693 return; |
694 | 694 |
695 const FrameSelection::SetSelectionOptions options = | 695 selection().setSelection( |
696 isHandleVisible | 696 newSelection, isHandleVisible, |
697 ? FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | | 697 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle, |
698 FrameSelection::HandleVisible | 698 CursorAlignOnScroll::IfNeeded, granularity); |
699 : FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle; | |
700 | |
701 selection().setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded, | |
702 granularity); | |
703 } | 699 } |
704 | 700 |
705 void SelectionController::setCaretAtHitTestResult( | 701 void SelectionController::setCaretAtHitTestResult( |
706 const HitTestResult& hitTestResult) { | 702 const HitTestResult& hitTestResult) { |
707 Node* innerNode = hitTestResult.innerNode(); | 703 Node* innerNode = hitTestResult.innerNode(); |
708 const VisiblePositionInFlatTree& visibleHitPos = | 704 const VisiblePositionInFlatTree& visibleHitPos = |
709 visiblePositionOfHitTestResult(hitTestResult); | 705 visiblePositionOfHitTestResult(hitTestResult); |
710 const VisiblePositionInFlatTree& visiblePos = | 706 const VisiblePositionInFlatTree& visiblePos = |
711 visibleHitPos.isNull() | 707 visibleHitPos.isNull() |
712 ? createVisiblePosition( | 708 ? createVisiblePosition( |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 return event.event().altKey() && event.isOverLink(); | 1071 return event.event().altKey() && event.isOverLink(); |
1076 } | 1072 } |
1077 | 1073 |
1078 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { | 1074 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { |
1079 bool isMouseDownOnLinkOrImage = | 1075 bool isMouseDownOnLinkOrImage = |
1080 event.isOverLink() || event.hitTestResult().image(); | 1076 event.isOverLink() || event.hitTestResult().image(); |
1081 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; | 1077 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; |
1082 } | 1078 } |
1083 | 1079 |
1084 } // namespace blink | 1080 } // namespace blink |
OLD | NEW |