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