| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 tail = 0; | 59 tail = 0; |
| 60 | 60 |
| 61 if (n->hasChildren()) | 61 if (n->hasChildren()) |
| 62 Private::addChildNodesToDeletionQueue<GenericNode, GenericNodeContai
ner>(head, tail, static_cast<GenericNodeContainer&>(*n)); | 62 Private::addChildNodesToDeletionQueue<GenericNode, GenericNodeContai
ner>(head, tail, static_cast<GenericNodeContainer&>(*n)); |
| 63 | 63 |
| 64 delete n; | 64 delete n; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 template<class GenericNode, class GenericNodeContainer> | |
| 70 inline void appendChildToContainer(GenericNode& child, GenericNodeContainer& con
tainer) | |
| 71 { | |
| 72 child.setParentOrShadowHostNode(&container); | |
| 73 | |
| 74 GenericNode* lastChild = container.lastChild(); | |
| 75 if (lastChild) { | |
| 76 child.setPreviousSibling(lastChild); | |
| 77 lastChild->setNextSibling(&child); | |
| 78 } else { | |
| 79 container.setFirstChild(&child); | |
| 80 } | |
| 81 | |
| 82 container.setLastChild(&child); | |
| 83 } | |
| 84 | |
| 85 // Helper methods for removeDetachedChildrenInContainer, hidden from WebCore nam
espace | 69 // Helper methods for removeDetachedChildrenInContainer, hidden from WebCore nam
espace |
| 86 namespace Private { | 70 namespace Private { |
| 87 | 71 |
| 88 template<class GenericNode, class GenericNodeContainer, bool dispatchRemoval
Notification> | 72 template<class GenericNode, class GenericNodeContainer, bool dispatchRemoval
Notification> |
| 89 struct NodeRemovalDispatcher { | 73 struct NodeRemovalDispatcher { |
| 90 static void dispatch(GenericNode&, GenericNodeContainer&) | 74 static void dispatch(GenericNode&, GenericNodeContainer&) |
| 91 { | 75 { |
| 92 // no-op, by default | 76 // no-op, by default |
| 93 } | 77 } |
| 94 }; | 78 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 131 } |
| 148 | 132 |
| 149 container.setLastChild(0); | 133 container.setLastChild(0); |
| 150 } | 134 } |
| 151 | 135 |
| 152 } // namespace Private | 136 } // namespace Private |
| 153 | 137 |
| 154 } // namespace WebCore | 138 } // namespace WebCore |
| 155 | 139 |
| 156 #endif // ContainerNodeAlgorithms_h | 140 #endif // ContainerNodeAlgorithms_h |
| OLD | NEW |