Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1966)

Side by Side Diff: Source/core/editing/BreakBlockquoteCommand.cpp

Issue 717603002: Clean up htmlediting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 RefPtrWillBeRawPtr<Element> clonedAncestor = clonedBlockquote; 145 RefPtrWillBeRawPtr<Element> clonedAncestor = clonedBlockquote;
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 (listChildNode && listChildNode->renderer() && listChildNode->ren derer()->isListItem()) 155 if (isListItem(listChildNode))
156 setNodeAttribute(clonedChild, startAttr, AtomicString::number(to RenderListItem(listChildNode->renderer())->value())); 156 setNodeAttribute(clonedChild, startAttr, AtomicString::number(to RenderListItem(listChildNode->renderer())->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()) {
(...skipping 16 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698