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

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

Issue 1313883002: Introduce firstRangeOf() as replacement of VisibleSelection::firstRange() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T17:47:14 Created 5 years, 4 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
« no previous file with comments | « Source/core/editing/SurroundingTextTest.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 bool isBaseFirst() const { return m_baseIsFirst; } 146 bool isBaseFirst() const { return m_baseIsFirst; }
147 bool isDirectional() const { return m_isDirectional; } 147 bool isDirectional() const { return m_isDirectional; }
148 void setIsDirectional(bool isDirectional) { m_isDirectional = isDirectional; } 148 void setIsDirectional(bool isDirectional) { m_isDirectional = isDirectional; }
149 149
150 void appendTrailingWhitespace(); 150 void appendTrailingWhitespace();
151 151
152 bool expandUsingGranularity(TextGranularity); 152 bool expandUsingGranularity(TextGranularity);
153 bool expandUsingGranularityInComposedTree(TextGranularity); 153 bool expandUsingGranularityInComposedTree(TextGranularity);
154 154
155 // We don't yet support multi-range selections, so we only ever have one ran ge to return.
156 PassRefPtrWillBeRawPtr<Range> firstRange() const;
157
158 bool intersectsNode(Node*) const; 155 bool intersectsNode(Node*) const;
159 156
160 // FIXME: Most callers probably don't want these functions, but 157 // FIXME: Most callers probably don't want these functions, but
161 // are using them for historical reasons. toNormalizedRange and 158 // are using them for historical reasons. toNormalizedRange and
162 // toNormalizedEphemeralRange contracts the range around text, and 159 // toNormalizedEphemeralRange contracts the range around text, and
163 // moves the caret upstream before returning the range/positions. 160 // moves the caret upstream before returning the range/positions.
164 PassRefPtrWillBeRawPtr<Range> toNormalizedRange() const; 161 PassRefPtrWillBeRawPtr<Range> toNormalizedRange() const;
165 EphemeralRange toNormalizedEphemeralRange() const; 162 EphemeralRange toNormalizedEphemeralRange() const;
166 static EphemeralRange normalizeRange(const EphemeralRange&); 163 static EphemeralRange normalizeRange(const EphemeralRange&);
167 static EphemeralRangeInComposedTree normalizeRange(const EphemeralRangeInCom posedTree&); 164 static EphemeralRangeInComposedTree normalizeRange(const EphemeralRangeInCom posedTree&);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // Oilpan: this reference has a lifetime that is at least as long 247 // Oilpan: this reference has a lifetime that is at least as long
251 // as this object. 248 // as this object.
252 RawPtrWillBeMember<ChangeObserver> m_changeObserver; 249 RawPtrWillBeMember<ChangeObserver> m_changeObserver;
253 250
254 // these are cached, can be recalculated by validate() 251 // these are cached, can be recalculated by validate()
255 SelectionType m_selectionType; // None, Caret, Range 252 SelectionType m_selectionType; // None, Caret, Range
256 bool m_baseIsFirst : 1; // True if base is before the extent 253 bool m_baseIsFirst : 1; // True if base is before the extent
257 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key. 254 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key.
258 }; 255 };
259 256
257 // We don't yet support multi-range selections, so we only ever have one range
258 // to return.
259 CORE_EXPORT PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection&);
260
260 } // namespace blink 261 } // namespace blink
261 262
262 #ifndef NDEBUG 263 #ifndef NDEBUG
263 // Outside the WebCore namespace for ease of invocation from gdb. 264 // Outside the WebCore namespace for ease of invocation from gdb.
264 void showTree(const blink::VisibleSelection&); 265 void showTree(const blink::VisibleSelection&);
265 void showTree(const blink::VisibleSelection*); 266 void showTree(const blink::VisibleSelection*);
266 #endif 267 #endif
267 268
268 #endif // VisibleSelection_h 269 #endif // VisibleSelection_h
OLDNEW
« no previous file with comments | « Source/core/editing/SurroundingTextTest.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698