| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2015 Google Inc. All rights reserved. | 3 * Copyright (C) 2015 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef SelectionController_h | 27 #ifndef SelectionController_h |
| 28 #define SelectionController_h | 28 #define SelectionController_h |
| 29 | 29 |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/editing/FrameSelection.h" |
| 31 #include "core/editing/TextGranularity.h" | 32 #include "core/editing/TextGranularity.h" |
| 32 #include "core/editing/VisibleSelection.h" | 33 #include "core/editing/VisibleSelection.h" |
| 33 #include "core/page/EventWithHitTestResults.h" | 34 #include "core/page/EventWithHitTestResults.h" |
| 34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class FrameSelection; | |
| 39 class HitTestResult; | 39 class HitTestResult; |
| 40 class LocalFrame; | 40 class LocalFrame; |
| 41 | 41 |
| 42 class CORE_EXPORT SelectionController final | 42 class CORE_EXPORT SelectionController final |
| 43 : public GarbageCollectedFinalized<SelectionController> { | 43 : public GarbageCollectedFinalized<SelectionController> { |
| 44 WTF_MAKE_NONCOPYABLE(SelectionController); | 44 WTF_MAKE_NONCOPYABLE(SelectionController); |
| 45 | 45 |
| 46 public: | 46 public: |
| 47 static SelectionController* create(LocalFrame&); | 47 static SelectionController* create(LocalFrame&); |
| 48 DECLARE_TRACE(); | 48 DECLARE_TRACE(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 SelectInputEventType); | 100 SelectInputEventType); |
| 101 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, | 101 void selectClosestMisspellingFromHitTestResult(const HitTestResult&, |
| 102 AppendTrailingWhitespace); | 102 AppendTrailingWhitespace); |
| 103 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); | 103 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); |
| 104 void selectClosestMisspellingFromMouseEvent( | 104 void selectClosestMisspellingFromMouseEvent( |
| 105 const MouseEventWithHitTestResults&); | 105 const MouseEventWithHitTestResults&); |
| 106 void selectClosestWordOrLinkFromMouseEvent( | 106 void selectClosestWordOrLinkFromMouseEvent( |
| 107 const MouseEventWithHitTestResults&); | 107 const MouseEventWithHitTestResults&); |
| 108 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, | 108 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, |
| 109 TextGranularity, | 109 TextGranularity, |
| 110 EndPointsAdjustmentMode); | 110 EndPointsAdjustmentMode, |
| 111 HandleVisibility); |
| 111 bool updateSelectionForMouseDownDispatchingSelectStart( | 112 bool updateSelectionForMouseDownDispatchingSelectStart( |
| 112 Node*, | 113 Node*, |
| 113 const VisibleSelectionInFlatTree&, | 114 const VisibleSelectionInFlatTree&, |
| 114 TextGranularity); | 115 TextGranularity, |
| 116 HandleVisibility); |
| 115 | 117 |
| 116 FrameSelection& selection() const; | 118 FrameSelection& selection() const; |
| 117 | 119 |
| 118 Member<LocalFrame> const m_frame; | 120 Member<LocalFrame> const m_frame; |
| 119 // TODO(yosin): We should use |PositionWIthAffinityInFlatTree| since we | 121 // TODO(yosin): We should use |PositionWIthAffinityInFlatTree| since we |
| 120 // should reduce usage of |VisibleSelectionInFlatTree|. | 122 // should reduce usage of |VisibleSelectionInFlatTree|. |
| 121 // Used to store base before the adjustment at bidi boundary | 123 // Used to store base before the adjustment at bidi boundary |
| 122 VisiblePositionInFlatTree m_originalBaseInFlatTree; | 124 VisiblePositionInFlatTree m_originalBaseInFlatTree; |
| 123 bool m_mouseDownMayStartSelect; | 125 bool m_mouseDownMayStartSelect; |
| 124 bool m_mouseDownWasSingleClickInSelection; | 126 bool m_mouseDownWasSingleClickInSelection; |
| 125 bool m_mouseDownAllowsMultiClick; | 127 bool m_mouseDownAllowsMultiClick; |
| 126 enum class SelectionState { | 128 enum class SelectionState { |
| 127 HaveNotStartedSelection, | 129 HaveNotStartedSelection, |
| 128 PlacedCaret, | 130 PlacedCaret, |
| 129 ExtendedSelection | 131 ExtendedSelection |
| 130 }; | 132 }; |
| 131 SelectionState m_selectionState; | 133 SelectionState m_selectionState; |
| 132 }; | 134 }; |
| 133 | 135 |
| 134 bool isLinkSelection(const MouseEventWithHitTestResults&); | 136 bool isLinkSelection(const MouseEventWithHitTestResults&); |
| 135 bool isExtendingSelection(const MouseEventWithHitTestResults&); | 137 bool isExtendingSelection(const MouseEventWithHitTestResults&); |
| 136 | 138 |
| 137 } // namespace blink | 139 } // namespace blink |
| 138 | 140 |
| 139 #endif // SelectionController_h | 141 #endif // SelectionController_h |
| OLD | NEW |