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

Side by Side Diff: Source/WebCore/dom/ContainerNode.h

Issue 11593024: Merge 137739 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years 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 | Source/WebCore/dom/ContainerNodeAlgorithms.cpp » ('j') | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 m_nextSnapshot = latestSnapshot; 334 m_nextSnapshot = latestSnapshot;
335 latestSnapshot = this; 335 latestSnapshot = this;
336 } 336 }
337 337
338 ~ChildNodesLazySnapshot() 338 ~ChildNodesLazySnapshot()
339 { 339 {
340 latestSnapshot = m_nextSnapshot; 340 latestSnapshot = m_nextSnapshot;
341 } 341 }
342 342
343 // Returns 0 if there is no next Node. 343 // Returns 0 if there is no next Node.
344 Node* nextNode() 344 PassRefPtr<Node> nextNode()
345 { 345 {
346 if (LIKELY(!hasSnapshot())) { 346 if (LIKELY(!hasSnapshot())) {
347 Node* node = m_currentNode.get(); 347 RefPtr<Node> node = m_currentNode;
348 if (m_currentNode) 348 if (node.get())
349 m_currentNode = m_currentNode->nextSibling(); 349 m_currentNode = node->nextSibling();
350 return node; 350 return node;
351 } 351 }
352 Vector<RefPtr<Node> >* nodeVector = m_childNodes.get(); 352 Vector<RefPtr<Node> >* nodeVector = m_childNodes.get();
353 if (m_currentIndex >= nodeVector->size()) 353 if (m_currentIndex >= nodeVector->size())
354 return 0; 354 return 0;
355 return (*nodeVector)[m_currentIndex++].get(); 355 return (*nodeVector)[m_currentIndex++];
356 } 356 }
357 357
358 void takeSnapshot() 358 void takeSnapshot()
359 { 359 {
360 if (hasSnapshot()) 360 if (hasSnapshot())
361 return; 361 return;
362 m_childNodes = adoptPtr(new Vector<RefPtr<Node> >()); 362 m_childNodes = adoptPtr(new Vector<RefPtr<Node> >());
363 Node* node = m_currentNode.get(); 363 Node* node = m_currentNode.get();
364 while (node) { 364 while (node) {
365 m_childNodes->append(node); 365 m_childNodes->append(node);
(...skipping 18 matching lines...) Expand all
384 384
385 RefPtr<Node> m_currentNode; 385 RefPtr<Node> m_currentNode;
386 unsigned m_currentIndex; 386 unsigned m_currentIndex;
387 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. 387 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated.
388 ChildNodesLazySnapshot* m_nextSnapshot; 388 ChildNodesLazySnapshot* m_nextSnapshot;
389 }; 389 };
390 390
391 } // namespace WebCore 391 } // namespace WebCore
392 392
393 #endif // ContainerNode_h 393 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/dom/ContainerNodeAlgorithms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698