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 20 matching lines...) Expand all Loading... |
31 #include "core/editing/EphemeralRange.h" | 31 #include "core/editing/EphemeralRange.h" |
32 #include "core/editing/SelectionType.h" | 32 #include "core/editing/SelectionType.h" |
33 #include "core/editing/TextGranularity.h" | 33 #include "core/editing/TextGranularity.h" |
34 #include "core/editing/VisiblePosition.h" | 34 #include "core/editing/VisiblePosition.h" |
35 #include "core/editing/VisibleUnits.h" | 35 #include "core/editing/VisibleUnits.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class LayoutPoint; | 39 class LayoutPoint; |
40 | 40 |
41 const EAffinity SEL_DEFAULT_AFFINITY = DOWNSTREAM; | 41 // TODO(yosin) We should use capitalized name instead of |SEL_DEFAULT_AFFINITY|. |
| 42 const EAffinity SEL_DEFAULT_AFFINITY = DOWNSTREAM; // NOLINT |
42 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D
irectionLeft }; | 43 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D
irectionLeft }; |
43 | 44 |
44 class CORE_EXPORT VisibleSelection { | 45 class CORE_EXPORT VisibleSelection { |
45 DISALLOW_ALLOCATION(); | 46 DISALLOW_ALLOCATION(); |
46 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelection); | 47 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelection); |
47 public: | 48 public: |
48 class InDOMTree { | 49 class InDOMTree { |
49 public: | 50 public: |
50 using PositionType = Position; | 51 using PositionType = Position; |
51 using Strategy = EditingStrategy; | 52 using Strategy = EditingStrategy; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void setBaseAndExtentToDeepEquivalents(); | 216 void setBaseAndExtentToDeepEquivalents(); |
216 void adjustSelectionToAvoidCrossingShadowBoundaries(); | 217 void adjustSelectionToAvoidCrossingShadowBoundaries(); |
217 void adjustSelectionToAvoidCrossingSelectionBoundaryInComposedTree(); | 218 void adjustSelectionToAvoidCrossingSelectionBoundaryInComposedTree(); |
218 bool isBaseFirstInComposedTree() const; | 219 bool isBaseFirstInComposedTree() const; |
219 void adjustSelectionToAvoidCrossingEditingBoundaries(); | 220 void adjustSelectionToAvoidCrossingEditingBoundaries(); |
220 void adjustStartAndEndInComposedTree(); | 221 void adjustStartAndEndInComposedTree(); |
221 void updateSelectionType(); | 222 void updateSelectionType(); |
222 | 223 |
223 // We need to store these as Positions because VisibleSelection is | 224 // We need to store these as Positions because VisibleSelection is |
224 // used to store values in editing commands for use when | 225 // used to store values in editing commands for use when |
225 // undoing the command. We need to be able to create a selection that, while
currently | 226 // undoing the command. We need to be able to create a selection that, while |
226 // invalid, will be valid once the changes are undone. | 227 // currently invalid, will be valid once the changes are undone. |
227 | 228 |
228 Position m_base; // Where the first click happened | 229 Position m_base; // Where the first click happened |
229 Position m_extent; // Where the end click happened | 230 Position m_extent; // Where the end click happened |
230 Position m_start; // Leftmost position when expanded to respect granularity | 231 Position m_start; // Leftmost position when expanded to respect granularity |
231 Position m_end; // Rightmost position when expanded to respect granularit
y | 232 Position m_end; // Rightmost position when expanded to respect granularity |
232 | 233 |
233 // TODO(hajimehoshi, yosin): The members m_*InComposedTree are now always | 234 // TODO(hajimehoshi, yosin): The members m_*InComposedTree are now always |
234 // computed from the respective positions at validate(). To have selections | 235 // computed from the respective positions at validate(). To have selections |
235 // work on the composed tree more accurately, we need to compute the DOM | 236 // work on the composed tree more accurately, we need to compute the DOM |
236 // positions from the composed tree positions. To do this, we need to add | 237 // positions from the composed tree positions. To do this, we need to add |
237 // considable amount of fixes (including EditingUtilities.cpp, | 238 // considable amount of fixes (including EditingUtilities.cpp, |
238 // VisibleUnit.cpp, and VisiblePosition.cpp). We'll do that in the future. | 239 // VisibleUnit.cpp, and VisiblePosition.cpp). We'll do that in the future. |
239 PositionInComposedTree m_baseInComposedTree; | 240 PositionInComposedTree m_baseInComposedTree; |
240 PositionInComposedTree m_extentInComposedTree; | 241 PositionInComposedTree m_extentInComposedTree; |
241 PositionInComposedTree m_startInComposedTree; | 242 PositionInComposedTree m_startInComposedTree; |
(...skipping 13 matching lines...) Expand all Loading... |
255 | 256 |
256 } // namespace blink | 257 } // namespace blink |
257 | 258 |
258 #ifndef NDEBUG | 259 #ifndef NDEBUG |
259 // Outside the WebCore namespace for ease of invocation from gdb. | 260 // Outside the WebCore namespace for ease of invocation from gdb. |
260 void showTree(const blink::VisibleSelection&); | 261 void showTree(const blink::VisibleSelection&); |
261 void showTree(const blink::VisibleSelection*); | 262 void showTree(const blink::VisibleSelection*); |
262 #endif | 263 #endif |
263 | 264 |
264 #endif // VisibleSelection_h | 265 #endif // VisibleSelection_h |
OLD | NEW |