OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... | |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef VisibleSelection_h | 26 #ifndef VisibleSelection_h |
27 #define VisibleSelection_h | 27 #define VisibleSelection_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/editing/SelectionType.h" | 30 #include "core/editing/SelectionType.h" |
31 #include "core/editing/TextGranularity.h" | 31 #include "core/editing/TextGranularity.h" |
32 #include "core/editing/VisiblePosition.h" | 32 #include "core/editing/VisiblePosition.h" |
33 #include "core/editing/VisibleUnits.h" | |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 class LayoutPoint; | 37 class LayoutPoint; |
37 class Position; | 38 class Position; |
38 | 39 |
39 const EAffinity SEL_DEFAULT_AFFINITY = DOWNSTREAM; | 40 const EAffinity SEL_DEFAULT_AFFINITY = DOWNSTREAM; |
40 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft }; | 41 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft }; |
41 | 42 |
42 class CORE_EXPORT VisibleSelection { | 43 class CORE_EXPORT VisibleSelection { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 DECLARE_TRACE(); | 140 DECLARE_TRACE(); |
140 | 141 |
141 void validatePositionsIfNeeded(); | 142 void validatePositionsIfNeeded(); |
142 | 143 |
143 #ifndef NDEBUG | 144 #ifndef NDEBUG |
144 void debugPosition() const; | 145 void debugPosition() const; |
145 void formatForDebugger(char* buffer, unsigned length) const; | 146 void formatForDebugger(char* buffer, unsigned length) const; |
146 void showTreeForThis() const; | 147 void showTreeForThis() const; |
147 #endif | 148 #endif |
148 | 149 |
149 void setStartRespectingGranularity(TextGranularity); | 150 void setStartRespectingGranularity(TextGranularity, EWordSide defaultWordSid e = RightWordIfOnBoundary); |
150 void setEndRespectingGranularity(TextGranularity); | 151 void setEndRespectingGranularity(TextGranularity, EWordSide defaultWordSide = RightWordIfOnBoundary); |
151 | 152 |
152 private: | 153 private: |
153 void validate(TextGranularity = CharacterGranularity); | 154 void validate(TextGranularity = CharacterGranularity); |
154 | 155 |
155 // Support methods for validate() | 156 // Support methods for validate() |
156 void setBaseAndExtentToDeepEquivalents(); | 157 void setBaseAndExtentToDeepEquivalents(); |
157 void adjustSelectionToAvoidCrossingShadowBoundaries(); | 158 void adjustSelectionToAvoidCrossingShadowBoundaries(); |
158 void adjustSelectionToAvoidCrossingEditingBoundaries(); | 159 void adjustSelectionToAvoidCrossingEditingBoundaries(); |
159 void updateSelectionType(); | 160 void updateSelectionType(); |
160 | 161 |
(...skipping 15 matching lines...) Expand all Loading... | |
176 | 177 |
177 // these are cached, can be recalculated by validate() | 178 // these are cached, can be recalculated by validate() |
178 SelectionType m_selectionType; // None, Caret, Range | 179 SelectionType m_selectionType; // None, Caret, Range |
179 bool m_baseIsFirst : 1; // True if base is before the extent | 180 bool m_baseIsFirst : 1; // True if base is before the extent |
180 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key. | 181 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key. |
181 }; | 182 }; |
182 | 183 |
183 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) | 184 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) |
184 { | 185 { |
185 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff inity() && a.isBaseFirst() == b.isBaseFirst() | 186 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff inity() && a.isBaseFirst() == b.isBaseFirst() |
186 && a.isDirectional() == b.isDirectional(); | 187 && a.isDirectional() == b.isDirectional() && a.base() == b.base() && a.e xtent() == b.extent(); |
yosin_UTC9
2015/04/16 04:11:26
Note: I assume this change will be kicked out from
mfomitchev1
2015/04/17 00:13:51
Done.
| |
187 } | 188 } |
188 | 189 |
189 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) | 190 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) |
190 { | 191 { |
191 return !(a == b); | 192 return !(a == b); |
192 } | 193 } |
193 | 194 |
194 } // namespace blink | 195 } // namespace blink |
195 | 196 |
196 #ifndef NDEBUG | 197 #ifndef NDEBUG |
197 // Outside the WebCore namespace for ease of invocation from gdb. | 198 // Outside the WebCore namespace for ease of invocation from gdb. |
198 void showTree(const blink::VisibleSelection&); | 199 void showTree(const blink::VisibleSelection&); |
199 void showTree(const blink::VisibleSelection*); | 200 void showTree(const blink::VisibleSelection*); |
200 #endif | 201 #endif |
201 | 202 |
202 #endif // VisibleSelection_h | 203 #endif // VisibleSelection_h |
OLD | NEW |