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

Side by Side Diff: Source/core/dom/ChildNodeList.cpp

Issue 180143003: Have LiveNodeListBase::ownerNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ChildNodeList.h ('k') | Source/core/dom/ClassCollection.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, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 6 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 namespace WebCore { 30 namespace WebCore {
31 31
32 ChildNodeList::ChildNodeList(PassRefPtr<ContainerNode> parent) 32 ChildNodeList::ChildNodeList(PassRefPtr<ContainerNode> parent)
33 : m_parent(parent) 33 : m_parent(parent)
34 { 34 {
35 ASSERT(m_parent); 35 ASSERT(m_parent);
36 } 36 }
37 37
38 Node* ChildNodeList::virtualOwnerNode() const 38 Node* ChildNodeList::virtualOwnerNode() const
39 { 39 {
40 return ownerNode(); 40 return &ownerNode();
41 } 41 }
42 42
43 ChildNodeList::~ChildNodeList() 43 ChildNodeList::~ChildNodeList()
44 { 44 {
45 m_parent->nodeLists()->removeChildNodeList(this); 45 m_parent->nodeLists()->removeChildNodeList(this);
46 } 46 }
47 47
48 Node* ChildNodeList::itemBefore(const Node* previous) const 48 Node* ChildNodeList::itemBefore(const Node* previous) const
49 { 49 {
50 return LIKELY(!!previous) ? previous->previousSibling() : rootNode().lastChi ld(); 50 return LIKELY(!!previous) ? previous->previousSibling() : rootNode().lastChi ld();
51 } 51 }
52 52
53 Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset, const ContainerNode&) const 53 Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset, const ContainerNode&) const
54 { 54 {
55 ASSERT(currentOffset < offset); 55 ASSERT(currentOffset < offset);
56 Node* next = &currentNode; 56 Node* next = &currentNode;
57 while ((next = next->nextSibling())) { 57 while ((next = next->nextSibling())) {
58 if (++currentOffset == offset) 58 if (++currentOffset == offset)
59 return next; 59 return next;
60 } 60 }
61 return 0; 61 return 0;
62 } 62 }
63 63
64 } // namespace WebCore 64 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ChildNodeList.h ('k') | Source/core/dom/ClassCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698