OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "core/svg/SVGElementInstance.h" | 23 #include "core/svg/SVGElementInstance.h" |
24 | 24 |
25 namespace WebCore { | 25 namespace WebCore { |
26 | 26 |
27 SVGElementInstanceList::SVGElementInstanceList(PassRefPtr<SVGElementInstance> ro
otInstance) | 27 SVGElementInstanceList::SVGElementInstanceList(PassRefPtr<SVGElementInstance> ro
otInstance) |
28 : m_rootInstance(rootInstance) | 28 : m_rootInstance(rootInstance) |
29 { | 29 { |
30 ScriptWrappable::init(this); | 30 ScriptWrappable::init(this); |
31 } | 31 } |
32 | 32 |
33 SVGElementInstanceList::~SVGElementInstanceList() | |
34 { | |
35 } | |
36 | |
37 unsigned SVGElementInstanceList::length() const | 33 unsigned SVGElementInstanceList::length() const |
38 { | 34 { |
39 // NOTE: We could use the same caching facilities, like the ones "ChildNodeL
ist" uses. | 35 // NOTE: We could use the same caching facilities, like the ones "ChildNodeL
ist" uses. |
40 unsigned length = 0; | 36 unsigned length = 0; |
41 for (SVGElementInstance* instance = m_rootInstance->firstChild(); instance;
instance = instance->nextSibling()) | 37 for (SVGElementInstance* instance = m_rootInstance->firstChild(); instance;
instance = instance->nextSibling()) |
42 length++; | 38 length++; |
43 return length; | 39 return length; |
44 } | 40 } |
45 | 41 |
46 SVGElementInstance* SVGElementInstanceList::item(unsigned index) | 42 SVGElementInstance* SVGElementInstanceList::item(unsigned index) |
47 { | 43 { |
48 unsigned pos = 0; | 44 unsigned pos = 0; |
49 SVGElementInstance* instance = m_rootInstance->firstChild(); | 45 SVGElementInstance* instance = m_rootInstance->firstChild(); |
50 while (instance && pos < index) { | 46 while (instance && pos < index) { |
51 instance = instance->nextSibling(); | 47 instance = instance->nextSibling(); |
52 pos++; | 48 pos++; |
53 } | 49 } |
54 return instance; | 50 return instance; |
55 } | 51 } |
56 | 52 |
57 } | 53 } |
OLD | NEW |