OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 for (size_t i = ancestors.size(); i != 0; --i) { | 144 for (size_t i = ancestors.size(); i != 0; --i) { |
145 RefPtr<Element> clonedChild = ancestors[i - 1]->cloneElementWithoutChild
ren(); | 145 RefPtr<Element> clonedChild = ancestors[i - 1]->cloneElementWithoutChild
ren(); |
146 // Preserve list item numbering in cloned lists. | 146 // Preserve list item numbering in cloned lists. |
147 if (clonedChild->isElementNode() && clonedChild->hasTagName(olTag)) { | 147 if (clonedChild->isElementNode() && clonedChild->hasTagName(olTag)) { |
148 Node* listChildNode = i > 1 ? ancestors[i - 2].get() : startNode; | 148 Node* listChildNode = i > 1 ? ancestors[i - 2].get() : startNode; |
149 // The first child of the cloned list might not be a list item eleme
nt, | 149 // The first child of the cloned list might not be a list item eleme
nt, |
150 // find the first one so that we know where to start numbering. | 150 // find the first one so that we know where to start numbering. |
151 while (listChildNode && !listChildNode->hasTagName(liTag)) | 151 while (listChildNode && !listChildNode->hasTagName(liTag)) |
152 listChildNode = listChildNode->nextSibling(); | 152 listChildNode = listChildNode->nextSibling(); |
153 if (listChildNode && listChildNode->renderer() && listChildNode->ren
derer()->isListItem()) | 153 if (listChildNode && listChildNode->renderer() && listChildNode->ren
derer()->isListItem()) |
154 setNodeAttribute(clonedChild, startAttr, String::number(toRender
ListItem(listChildNode->renderer())->value())); | 154 setNodeAttribute(clonedChild, startAttr, AtomicString::number(to
RenderListItem(listChildNode->renderer())->value())); |
155 } | 155 } |
156 | 156 |
157 appendNode(clonedChild.get(), clonedAncestor.get()); | 157 appendNode(clonedChild.get(), clonedAncestor.get()); |
158 clonedAncestor = clonedChild; | 158 clonedAncestor = clonedChild; |
159 } | 159 } |
160 | 160 |
161 moveRemainingSiblingsToNewParent(startNode, 0, clonedAncestor); | 161 moveRemainingSiblingsToNewParent(startNode, 0, clonedAncestor); |
162 | 162 |
163 if (!ancestors.isEmpty()) { | 163 if (!ancestors.isEmpty()) { |
164 // Split the tree up the ancestor chain until the topBlockquote | 164 // Split the tree up the ancestor chain until the topBlockquote |
(...skipping 15 matching lines...) Expand all Loading... |
180 | 180 |
181 // Make sure the cloned block quote renders. | 181 // Make sure the cloned block quote renders. |
182 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 182 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
183 | 183 |
184 // Put the selection right before the break. | 184 // Put the selection right before the break. |
185 setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.get()), DOW
NSTREAM, endingSelection().isDirectional())); | 185 setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.get()), DOW
NSTREAM, endingSelection().isDirectional())); |
186 rebalanceWhitespace(); | 186 rebalanceWhitespace(); |
187 } | 187 } |
188 | 188 |
189 } // namespace WebCore | 189 } // namespace WebCore |
OLD | NEW |