OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/dom/ChildNodeList.h" | 25 #include "core/dom/ChildNodeList.h" |
26 | 26 |
27 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
28 #include "core/dom/NodeRareData.h" | 28 #include "core/dom/NodeRareData.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 ChildNodeList::ChildNodeList(PassRefPtr<ContainerNode> parent) | 32 ChildNodeList::ChildNodeList(ContainerNode& parent) |
33 : m_parent(parent) | 33 : m_parent(parent) |
34 { | 34 { |
35 ASSERT(m_parent); | |
36 } | 35 } |
37 | 36 |
38 Node* ChildNodeList::virtualOwnerNode() const | 37 Node* ChildNodeList::virtualOwnerNode() const |
39 { | 38 { |
40 return &ownerNode(); | 39 return &ownerNode(); |
41 } | 40 } |
42 | 41 |
43 ChildNodeList::~ChildNodeList() | 42 ChildNodeList::~ChildNodeList() |
44 { | 43 { |
45 m_parent->nodeLists()->removeChildNodeList(this); | 44 m_parent->nodeLists()->removeChildNodeList(this); |
46 } | 45 } |
47 | 46 |
48 Node* ChildNodeList::itemBefore(const Node* previous) const | 47 Node* ChildNodeList::itemBefore(const Node* previous) const |
49 { | 48 { |
50 return LIKELY(!!previous) ? previous->previousSibling() : rootNode().lastChi
ld(); | 49 return LIKELY(!!previous) ? previous->previousSibling() : rootNode().lastChi
ld(); |
51 } | 50 } |
52 | 51 |
53 Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode,
unsigned& currentOffset, const ContainerNode&) const | 52 Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode,
unsigned& currentOffset, const ContainerNode&) const |
54 { | 53 { |
55 ASSERT(currentOffset < offset); | 54 ASSERT(currentOffset < offset); |
56 Node* next = ¤tNode; | 55 Node* next = ¤tNode; |
57 while ((next = next->nextSibling())) { | 56 while ((next = next->nextSibling())) { |
58 if (++currentOffset == offset) | 57 if (++currentOffset == offset) |
59 return next; | 58 return next; |
60 } | 59 } |
61 return 0; | 60 return 0; |
62 } | 61 } |
63 | 62 |
64 } // namespace WebCore | 63 } // namespace WebCore |
OLD | NEW |