| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 RawPtrWillBeMember<ChangeObserver> m_changeObserver; | 174 RawPtrWillBeMember<ChangeObserver> m_changeObserver; |
| 175 | 175 |
| 176 // these are cached, can be recalculated by validate() | 176 // these are cached, can be recalculated by validate() |
| 177 SelectionType m_selectionType; // None, Caret, Range | 177 SelectionType m_selectionType; // None, Caret, Range |
| 178 bool m_baseIsFirst : 1; // True if base is before the extent | 178 bool m_baseIsFirst : 1; // True if base is before the extent |
| 179 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec
tion always extends on shift + arrow key. | 179 bool m_isDirectional : 1; // Non-directional ignores m_baseIsFirst and selec
tion always extends on shift + arrow key. |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) | 182 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) |
| 183 { | 183 { |
| 184 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff
inity() && a.isBaseFirst() == b.isBaseFirst() | 184 if (a.affinity() != b.affinity() || a.isDirectional() != b.isDirectional()) |
| 185 && a.isDirectional() == b.isDirectional(); | 185 return false; |
| 186 |
| 187 if (a.isNone()) |
| 188 return b.isNone(); |
| 189 |
| 190 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.aff
inity() |
| 191 && a.isDirectional() == b.isDirectional() && a.base() == b.base() && a.e
xtent() == b.extent(); |
| 186 } | 192 } |
| 187 | 193 |
| 188 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) | 194 inline bool operator!=(const VisibleSelection& a, const VisibleSelection& b) |
| 189 { | 195 { |
| 190 return !(a == b); | 196 return !(a == b); |
| 191 } | 197 } |
| 192 | 198 |
| 193 } // namespace blink | 199 } // namespace blink |
| 194 | 200 |
| 195 #ifndef NDEBUG | 201 #ifndef NDEBUG |
| 196 // Outside the WebCore namespace for ease of invocation from gdb. | 202 // Outside the WebCore namespace for ease of invocation from gdb. |
| 197 void showTree(const blink::VisibleSelection&); | 203 void showTree(const blink::VisibleSelection&); |
| 198 void showTree(const blink::VisibleSelection*); | 204 void showTree(const blink::VisibleSelection*); |
| 199 #endif | 205 #endif |
| 200 | 206 |
| 201 #endif // VisibleSelection_h | 207 #endif // VisibleSelection_h |
| OLD | NEW |