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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 | 1044 |
1045 bool SelectionController::mouseDownMayStartSelect() const { | 1045 bool SelectionController::mouseDownMayStartSelect() const { |
1046 return m_mouseDownMayStartSelect; | 1046 return m_mouseDownMayStartSelect; |
1047 } | 1047 } |
1048 | 1048 |
1049 bool SelectionController::mouseDownWasSingleClickInSelection() const { | 1049 bool SelectionController::mouseDownWasSingleClickInSelection() const { |
1050 return m_mouseDownWasSingleClickInSelection; | 1050 return m_mouseDownWasSingleClickInSelection; |
1051 } | 1051 } |
1052 | 1052 |
1053 void SelectionController::notifySelectionChanged() { | 1053 void SelectionController::notifySelectionChanged() { |
1054 if (selection().getSelectionType() == SelectionType::RangeSelection) | 1054 const SelectionInDOMTree& selection = this->selection().selectionInDOMTree(); |
1055 m_selectionState = SelectionState::ExtendedSelection; | 1055 if (selection.isNone()) { |
1056 else if (selection().getSelectionType() == SelectionType::CaretSelection) | 1056 m_selectionState = SelectionState::HaveNotStartedSelection; |
| 1057 return; |
| 1058 } |
| 1059 if (selection.isCaret() && selection.granularity() == CharacterGranularity) { |
1057 m_selectionState = SelectionState::PlacedCaret; | 1060 m_selectionState = SelectionState::PlacedCaret; |
1058 else | 1061 return; |
1059 m_selectionState = SelectionState::HaveNotStartedSelection; | 1062 } |
| 1063 m_selectionState = SelectionState::ExtendedSelection; |
1060 } | 1064 } |
1061 | 1065 |
1062 FrameSelection& SelectionController::selection() const { | 1066 FrameSelection& SelectionController::selection() const { |
1063 return m_frame->selection(); | 1067 return m_frame->selection(); |
1064 } | 1068 } |
1065 | 1069 |
1066 bool isLinkSelection(const MouseEventWithHitTestResults& event) { | 1070 bool isLinkSelection(const MouseEventWithHitTestResults& event) { |
1067 return (event.event().modifiers() & WebInputEvent::Modifiers::AltKey) != 0 && | 1071 return (event.event().modifiers() & WebInputEvent::Modifiers::AltKey) != 0 && |
1068 event.isOverLink(); | 1072 event.isOverLink(); |
1069 } | 1073 } |
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 |