OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 m_childBeforeBoundary = nullptr; | 204 m_childBeforeBoundary = nullptr; |
205 } else { | 205 } else { |
206 m_childBeforeBoundary = m_containerNode->lastChild(); | 206 m_childBeforeBoundary = m_containerNode->lastChild(); |
207 m_offsetInContainer = m_childBeforeBoundary ? invalidOffset : 0; | 207 m_offsetInContainer = m_childBeforeBoundary ? invalidOffset : 0; |
208 } | 208 } |
209 markValid(); | 209 markValid(); |
210 } | 210 } |
211 | 211 |
212 inline void RangeBoundaryPoint::childBeforeWillBeRemoved() | 212 inline void RangeBoundaryPoint::childBeforeWillBeRemoved() |
213 { | 213 { |
214 DCHECK(m_offsetInContainer); | |
215 m_childBeforeBoundary = m_childBeforeBoundary->previousSibling(); | 214 m_childBeforeBoundary = m_childBeforeBoundary->previousSibling(); |
| 215 if (!isOffsetValid()) |
| 216 return; |
| 217 DCHECK_GT(m_offsetInContainer, 0); |
216 if (!m_childBeforeBoundary) | 218 if (!m_childBeforeBoundary) |
217 m_offsetInContainer = 0; | 219 m_offsetInContainer = 0; |
218 else if (m_offsetInContainer > 0) | 220 else if (m_offsetInContainer > 0) |
219 --m_offsetInContainer; | 221 --m_offsetInContainer; |
220 markValid(); | 222 markValid(); |
221 } | 223 } |
222 | 224 |
223 inline void RangeBoundaryPoint::invalidateOffset() | 225 inline void RangeBoundaryPoint::invalidateOffset() |
224 { | 226 { |
225 m_offsetInContainer = invalidOffset; | 227 m_offsetInContainer = invalidOffset; |
(...skipping 14 matching lines...) Expand all Loading... |
240 } else { | 242 } else { |
241 if (a.offset() != b.offset()) | 243 if (a.offset() != b.offset()) |
242 return false; | 244 return false; |
243 } | 245 } |
244 return true; | 246 return true; |
245 } | 247 } |
246 | 248 |
247 } // namespace blink | 249 } // namespace blink |
248 | 250 |
249 #endif | 251 #endif |
OLD | NEW |