| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Oilpan: this reference has a lifetime that is at least as long | 239 // Oilpan: this reference has a lifetime that is at least as long |
| 240 // as this object. | 240 // as this object. |
| 241 RawPtrWillBeMember<ChangeObserver> m_changeObserver; | 241 RawPtrWillBeMember<ChangeObserver> m_changeObserver; |
| 242 | 242 |
| 243 // these are cached, can be recalculated by validate() | 243 // these are cached, can be recalculated by validate() |
| 244 SelectionType m_selectionType; // None, Caret, Range | 244 SelectionType m_selectionType; // None, Caret, Range |
| 245 bool m_baseIsFirst : 1; // True if base is before the extent | 245 bool m_baseIsFirst : 1; // True if base is before the extent |
| 246 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec
tion always extends on shift + arrow key. | 246 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec
tion always extends on shift + arrow key. |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) | |
| 250 { | |
| 251 if (a.affinity() != b.affinity() || a.isDirectional() != b.isDirectional()) | |
| 252 return false; | |
| 253 | |
| 254 if (a.isNone()) | |
| 255 return b.isNone(); | |
| 256 | |
| 257 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff
inity() | |
| 258 && a.isDirectional() == b.isDirectional() && a.base() == b.base() && a.e
xtent() == b.extent(); | |
| 259 } | |
| 260 | |
| 261 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) | |
| 262 { | |
| 263 return !(a == b); | |
| 264 } | |
| 265 | |
| 266 } // namespace blink | 249 } // namespace blink |
| 267 | 250 |
| 268 #ifndef NDEBUG | 251 #ifndef NDEBUG |
| 269 // Outside the WebCore namespace for ease of invocation from gdb. | 252 // Outside the WebCore namespace for ease of invocation from gdb. |
| 270 void showTree(const blink::VisibleSelection&); | 253 void showTree(const blink::VisibleSelection&); |
| 271 void showTree(const blink::VisibleSelection*); | 254 void showTree(const blink::VisibleSelection*); |
| 272 #endif | 255 #endif |
| 273 | 256 |
| 274 #endif // VisibleSelection_h | 257 #endif // VisibleSelection_h |
| OLD | NEW |