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

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

Issue 1089283002: Making VisibleSelection operator== take base and extent into account. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 RawPtrWillBeMember<ChangeObserver> m_changeObserver; 175 RawPtrWillBeMember<ChangeObserver> m_changeObserver;
176 176
177 // these are cached, can be recalculated by validate() 177 // these are cached, can be recalculated by validate()
178 SelectionType m_selectionType; // None, Caret, Range 178 SelectionType m_selectionType; // None, Caret, Range
179 bool m_baseIsFirst : 1; // True if base is before the extent 179 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. 180 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec tion always extends on shift + arrow key.
181 }; 181 };
182 182
183 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) 183 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b)
184 { 184 {
185 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff inity() && a.isBaseFirst() == b.isBaseFirst() 185 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff inity() && a.isBaseFirst() == b.isBaseFirst()
yosin_UTC9 2015/04/16 04:59:04 if one of selections is null, we don't need to che
yosin_UTC9 2015/04/16 04:59:04 Since we compare base/extent equality, we don't ne
mfomitchev 2015/04/16 18:11:32 Added the None check and removed isBaseFirst() che
186 && a.isDirectional() == b.isDirectional(); 186 && a.isDirectional() == b.isDirectional() && a.base() == b.base() && a.e xtent() == b.extent();
187 } 187 }
188 188
189 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) 189 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b)
190 { 190 {
191 return !(a == b); 191 return !(a == b);
192 } 192 }
193 193
194 } // namespace blink 194 } // namespace blink
195 195
196 #ifndef NDEBUG 196 #ifndef NDEBUG
197 // Outside the WebCore namespace for ease of invocation from gdb. 197 // Outside the WebCore namespace for ease of invocation from gdb.
198 void showTree(const blink::VisibleSelection&); 198 void showTree(const blink::VisibleSelection&);
199 void showTree(const blink::VisibleSelection*); 199 void showTree(const blink::VisibleSelection*);
200 #endif 200 #endif
201 201
202 #endif // VisibleSelection_h 202 #endif // VisibleSelection_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698