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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 for (size_t i = ancestors.size(); i != 0; --i) { | 146 for (size_t i = ancestors.size(); i != 0; --i) { |
147 RefPtrWillBeRawPtr<Element> clonedChild = ancestors[i - 1]->cloneElement
WithoutChildren(); | 147 RefPtrWillBeRawPtr<Element> clonedChild = ancestors[i - 1]->cloneElement
WithoutChildren(); |
148 // Preserve list item numbering in cloned lists. | 148 // Preserve list item numbering in cloned lists. |
149 if (isHTMLOListElement(*clonedChild)) { | 149 if (isHTMLOListElement(*clonedChild)) { |
150 Node* listChildNode = i > 1 ? ancestors[i - 2].get() : startNode; | 150 Node* listChildNode = i > 1 ? ancestors[i - 2].get() : startNode; |
151 // The first child of the cloned list might not be a list item eleme
nt, | 151 // The first child of the cloned list might not be a list item eleme
nt, |
152 // find the first one so that we know where to start numbering. | 152 // find the first one so that we know where to start numbering. |
153 while (listChildNode && !isHTMLLIElement(*listChildNode)) | 153 while (listChildNode && !isHTMLLIElement(*listChildNode)) |
154 listChildNode = listChildNode->nextSibling(); | 154 listChildNode = listChildNode->nextSibling(); |
155 if (isListItem(listChildNode)) | 155 if (isListItem(listChildNode)) |
156 setNodeAttribute(clonedChild, startAttr, AtomicString::number(to
LayoutListItem(listChildNode->renderer())->value())); | 156 setNodeAttribute(clonedChild, startAttr, AtomicString::number(to
LayoutListItem(listChildNode->layoutObject())->value())); |
157 } | 157 } |
158 | 158 |
159 appendNode(clonedChild.get(), clonedAncestor.get()); | 159 appendNode(clonedChild.get(), clonedAncestor.get()); |
160 clonedAncestor = clonedChild; | 160 clonedAncestor = clonedChild; |
161 } | 161 } |
162 | 162 |
163 moveRemainingSiblingsToNewParent(startNode, 0, clonedAncestor); | 163 moveRemainingSiblingsToNewParent(startNode, 0, clonedAncestor); |
164 | 164 |
165 if (!ancestors.isEmpty()) { | 165 if (!ancestors.isEmpty()) { |
166 // Split the tree up the ancestor chain until the topBlockquote | 166 // Split the tree up the ancestor chain until the topBlockquote |
(...skipping 15 matching lines...) Expand all Loading... |
182 | 182 |
183 // Make sure the cloned block quote renders. | 183 // Make sure the cloned block quote renders. |
184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 184 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
185 | 185 |
186 // Put the selection right before the break. | 186 // Put the selection right before the break. |
187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); | 187 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
DOWNSTREAM, endingSelection().isDirectional())); |
188 rebalanceWhitespace(); | 188 rebalanceWhitespace(); |
189 } | 189 } |
190 | 190 |
191 } // namespace blink | 191 } // namespace blink |
OLD | NEW |