OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SelectionTemplate_h | 5 #ifndef SelectionTemplate_h |
6 #define SelectionTemplate_h | 6 #define SelectionTemplate_h |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 SelectionTemplate& operator=(const SelectionTemplate&) = default; | 81 SelectionTemplate& operator=(const SelectionTemplate&) = default; |
82 | 82 |
83 bool operator==(const SelectionTemplate&) const; | 83 bool operator==(const SelectionTemplate&) const; |
84 bool operator!=(const SelectionTemplate&) const; | 84 bool operator!=(const SelectionTemplate&) const; |
85 | 85 |
86 const PositionTemplate<Strategy>& Base() const; | 86 const PositionTemplate<Strategy>& Base() const; |
87 const PositionTemplate<Strategy>& Extent() const; | 87 const PositionTemplate<Strategy>& Extent() const; |
88 TextAffinity Affinity() const { return affinity_; } | 88 TextAffinity Affinity() const { return affinity_; } |
89 TextGranularity Granularity() const { return granularity_; } | 89 TextGranularity Granularity() const { return granularity_; } |
90 bool HasTrailingWhitespace() const { return has_trailing_whitespace_; } | 90 bool HasTrailingWhitespace() const { return has_trailing_whitespace_; } |
91 bool IsCaret() const { return base_.IsNotNull() && base_ == extent_; } | 91 bool IsCaret() const; |
92 bool IsDirectional() const { return is_directional_; } | 92 bool IsDirectional() const { return is_directional_; } |
93 bool IsHandleVisible() const { return is_handle_visible_; } | 93 bool IsHandleVisible() const { return is_handle_visible_; } |
94 bool IsNone() const { return base_.IsNull(); } | 94 bool IsNone() const { return base_.IsNull(); } |
95 bool IsRange() const { return base_ != extent_; } | 95 bool IsRange() const; |
96 | 96 |
97 // Returns true if |this| selection holds valid values otherwise it causes | 97 // Returns true if |this| selection holds valid values otherwise it causes |
98 // assertion failure. | 98 // assertion failure. |
99 bool AssertValid() const; | 99 bool AssertValid() const; |
100 bool AssertValidFor(const Document&) const; | 100 bool AssertValidFor(const Document&) const; |
101 | 101 |
102 const PositionTemplate<Strategy>& ComputeEndPosition() const; | 102 const PositionTemplate<Strategy>& ComputeEndPosition() const; |
103 const PositionTemplate<Strategy>& ComputeStartPosition() const; | 103 const PositionTemplate<Strategy>& ComputeStartPosition() const; |
104 | 104 |
105 // Returns |SelectionType| for |this| based on |m_base| and |m_extent| | 105 // Returns |SelectionType| for |this| based on |m_base| and |m_extent| |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>; | 141 using SelectionInDOMTree = SelectionTemplate<EditingStrategy>; |
142 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>; | 142 using SelectionInFlatTree = SelectionTemplate<EditingInFlatTreeStrategy>; |
143 | 143 |
144 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&); | 144 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInDOMTree&); |
145 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&); | 145 CORE_EXPORT std::ostream& operator<<(std::ostream&, const SelectionInFlatTree&); |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
148 | 148 |
149 #endif // SelectionTemplate_h | 149 #endif // SelectionTemplate_h |
OLD | NEW |