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

Side by Side Diff: third_party/WebKit/Source/core/dom/RangeBoundaryPoint.h

Issue 2039113003: Make removeChild faster with active ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T16:21:06 Created 4 years, 6 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 | « third_party/WebKit/Source/core/dom/Range.cpp ('k') | 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) 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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Range.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698