Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleSelection.h

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 const TextAffinity SelDefaultAffinity = TextAffinity::Downstream; 44 const TextAffinity SelDefaultAffinity = TextAffinity::Downstream;
45 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft }; 45 enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, D irectionLeft };
46 46
47 // Listener of |VisibleSelection| modification. |didChangeVisibleSelection()| 47 // Listener of |VisibleSelection| modification. |didChangeVisibleSelection()|
48 // will be invoked when base, extent, start or end is moved to a different 48 // will be invoked when base, extent, start or end is moved to a different
49 // position. 49 // position.
50 // 50 //
51 // Objects implementing |VisibleSelectionChangeObserver| interface must outlive 51 // Objects implementing |VisibleSelectionChangeObserver| interface must outlive
52 // the |VisibleSelection| object. 52 // the |VisibleSelection| object.
53 class CORE_EXPORT VisibleSelectionChangeObserver : public WillBeGarbageCollected Mixin { 53 class CORE_EXPORT VisibleSelectionChangeObserver : public GarbageCollectedMixin {
54 WTF_MAKE_NONCOPYABLE(VisibleSelectionChangeObserver); 54 WTF_MAKE_NONCOPYABLE(VisibleSelectionChangeObserver);
55 public: 55 public:
56 VisibleSelectionChangeObserver(); 56 VisibleSelectionChangeObserver();
57 virtual ~VisibleSelectionChangeObserver(); 57 virtual ~VisibleSelectionChangeObserver();
58 virtual void didChangeVisibleSelection() = 0; 58 virtual void didChangeVisibleSelection() = 0;
59 DEFINE_INLINE_VIRTUAL_TRACE() { } 59 DEFINE_INLINE_VIRTUAL_TRACE() { }
60 }; 60 };
61 61
62 template <typename Strategy> 62 template <typename Strategy>
63 class CORE_TEMPLATE_CLASS_EXPORT VisibleSelectionTemplate { 63 class CORE_TEMPLATE_CLASS_EXPORT VisibleSelectionTemplate {
64 DISALLOW_NEW(); 64 DISALLOW_NEW();
65 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelectionTemplate);
66 public: 65 public:
67 VisibleSelectionTemplate(); 66 VisibleSelectionTemplate();
68 VisibleSelectionTemplate(const PositionTemplate<Strategy>&, TextAffinity, bo ol isDirectional = false); 67 VisibleSelectionTemplate(const PositionTemplate<Strategy>&, TextAffinity, bo ol isDirectional = false);
69 VisibleSelectionTemplate(const PositionTemplate<Strategy>& base, const Posit ionTemplate<Strategy>& extent, TextAffinity = SelDefaultAffinity, bool isDirecti onal = false); 68 VisibleSelectionTemplate(const PositionTemplate<Strategy>& base, const Posit ionTemplate<Strategy>& extent, TextAffinity = SelDefaultAffinity, bool isDirecti onal = false);
70 explicit VisibleSelectionTemplate(const EphemeralRangeTemplate<Strategy>&, T extAffinity = SelDefaultAffinity, bool isDirectional = false); 69 explicit VisibleSelectionTemplate(const EphemeralRangeTemplate<Strategy>&, T extAffinity = SelDefaultAffinity, bool isDirectional = false);
71 70
72 explicit VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, bool isDirectional = false); 71 explicit VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, bool isDirectional = false);
73 VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, const Vis iblePositionTemplate<Strategy>&, bool isDirectional = false); 72 VisibleSelectionTemplate(const VisiblePositionTemplate<Strategy>&, const Vis iblePositionTemplate<Strategy>&, bool isDirectional = false);
74 73
75 explicit VisibleSelectionTemplate(const PositionWithAffinityTemplate<Strateg y>&, bool isDirectional = false); 74 explicit VisibleSelectionTemplate(const PositionWithAffinityTemplate<Strateg y>&, bool isDirectional = false);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 PositionTemplate<Strategy> m_extent; 183 PositionTemplate<Strategy> m_extent;
185 // Leftmost position when expanded to respect granularity 184 // Leftmost position when expanded to respect granularity
186 PositionTemplate<Strategy> m_start; 185 PositionTemplate<Strategy> m_start;
187 // Rightmost position when expanded to respect granularity 186 // Rightmost position when expanded to respect granularity
188 PositionTemplate<Strategy> m_end; 187 PositionTemplate<Strategy> m_end;
189 188
190 TextAffinity m_affinity; // the upstream/downstream affinity of the caret 189 TextAffinity m_affinity; // the upstream/downstream affinity of the caret
191 190
192 // Oilpan: this reference has a lifetime that is at least as long 191 // Oilpan: this reference has a lifetime that is at least as long
193 // as this object. 192 // as this object.
194 RawPtrWillBeMember<VisibleSelectionChangeObserver> m_changeObserver; 193 Member<VisibleSelectionChangeObserver> m_changeObserver;
195 194
196 // these are cached, can be recalculated by validate() 195 // these are cached, can be recalculated by validate()
197 SelectionType m_selectionType; // None, Caret, Range 196 SelectionType m_selectionType; // None, Caret, Range
198 bool m_baseIsFirst : 1; // True if base is before the extent 197 bool m_baseIsFirst : 1; // True if base is before the extent
199 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key. 198 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key.
200 199
201 TextGranularity m_granularity; 200 TextGranularity m_granularity;
202 // |updateIfNeeded()| uses |m_hasTrailingWhitespace| for word granularity. 201 // |updateIfNeeded()| uses |m_hasTrailingWhitespace| for word granularity.
203 // |m_hasTrailingWhitespace| is set by |appendTrailingWhitespace()|. 202 // |m_hasTrailingWhitespace| is set by |appendTrailingWhitespace()|.
204 // TODO(yosin): Once we unify start/end and base/extent, we should get rid 203 // TODO(yosin): Once we unify start/end and base/extent, we should get rid
205 // of |m_hasTrailingWhitespace|. 204 // of |m_hasTrailingWhitespace|.
206 bool m_hasTrailingWhitespace : 1; 205 bool m_hasTrailingWhitespace : 1;
207 }; 206 };
208 207
209 extern template class CORE_EXTERN_TEMPLATE_EXPORT VisibleSelectionTemplate<Editi ngStrategy>; 208 extern template class CORE_EXTERN_TEMPLATE_EXPORT VisibleSelectionTemplate<Editi ngStrategy>;
210 extern template class CORE_EXTERN_TEMPLATE_EXPORT VisibleSelectionTemplate<Editi ngInFlatTreeStrategy>; 209 extern template class CORE_EXTERN_TEMPLATE_EXPORT VisibleSelectionTemplate<Editi ngInFlatTreeStrategy>;
211 210
212 using VisibleSelection = VisibleSelectionTemplate<EditingStrategy>; 211 using VisibleSelection = VisibleSelectionTemplate<EditingStrategy>;
213 using VisibleSelectionInFlatTree = VisibleSelectionTemplate<EditingInFlatTreeStr ategy>; 212 using VisibleSelectionInFlatTree = VisibleSelectionTemplate<EditingInFlatTreeStr ategy>;
214 213
215 // TODO(yosin): We should use |operator==()| instead of 214 // TODO(yosin): We should use |operator==()| instead of
216 // |equalSelectionsInDOMTree()|. 215 // |equalSelectionsInDOMTree()|.
217 bool equalSelectionsInDOMTree(const VisibleSelection&, const VisibleSelection&); 216 bool equalSelectionsInDOMTree(const VisibleSelection&, const VisibleSelection&);
218 217
219 // We don't yet support multi-range selections, so we only ever have one range 218 // We don't yet support multi-range selections, so we only ever have one range
220 // to return. 219 // to return.
221 CORE_EXPORT EphemeralRange firstEphemeralRangeOf(const VisibleSelection&); 220 CORE_EXPORT EphemeralRange firstEphemeralRangeOf(const VisibleSelection&);
222 221
223 // TODO(sof): move more firstRangeOf() uses to be over EphemeralRange instead. 222 // TODO(sof): move more firstRangeOf() uses to be over EphemeralRange instead.
224 CORE_EXPORT PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection&); 223 CORE_EXPORT RawPtr<Range> firstRangeOf(const VisibleSelection&);
225 224
226 } // namespace blink 225 } // namespace blink
227 226
228 #ifndef NDEBUG 227 #ifndef NDEBUG
229 // Outside the WebCore namespace for ease of invocation from gdb. 228 // Outside the WebCore namespace for ease of invocation from gdb.
230 void showTree(const blink::VisibleSelection&); 229 void showTree(const blink::VisibleSelection&);
231 void showTree(const blink::VisibleSelection*); 230 void showTree(const blink::VisibleSelection*);
232 void showTree(const blink::VisibleSelectionInFlatTree&); 231 void showTree(const blink::VisibleSelectionInFlatTree&);
233 void showTree(const blink::VisibleSelectionInFlatTree*); 232 void showTree(const blink::VisibleSelectionInFlatTree*);
234 #endif 233 #endif
235 234
236 #endif // VisibleSelection_h 235 #endif // VisibleSelection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698