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

Side by Side Diff: WebCore/editing/CompositeEditCommand.cpp

Issue 4182003: Merge 70594 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 } 1168 }
1169 1169
1170 // Splits the tree parent by parent until we reach the specified ancestor. We us e VisiblePositions 1170 // Splits the tree parent by parent until we reach the specified ancestor. We us e VisiblePositions
1171 // to determine if the split is necessary. Returns the last split node. 1171 // to determine if the split is necessary. Returns the last split node.
1172 PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, b ool splitAncestor) 1172 PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, b ool splitAncestor)
1173 { 1173 {
1174 ASSERT(start != end); 1174 ASSERT(start != end);
1175 1175
1176 RefPtr<Node> node; 1176 RefPtr<Node> node;
1177 for (node = start; node && node->parent() != end; node = node->parent()) { 1177 for (node = start; node && node->parent() != end; node = node->parent()) {
1178 if (!node->parent()->isElementNode())
1179 break;
1178 VisiblePosition positionInParent(Position(node->parent(), 0), DOWNSTREAM ); 1180 VisiblePosition positionInParent(Position(node->parent(), 0), DOWNSTREAM );
1179 VisiblePosition positionInNode(Position(node, 0), DOWNSTREAM); 1181 VisiblePosition positionInNode(Position(node, 0), DOWNSTREAM);
1180 if (positionInParent != positionInNode) 1182 if (positionInParent != positionInNode)
1181 applyCommandToComposite(SplitElementCommand::create(static_cast<Elem ent*>(node->parent()), node)); 1183 applyCommandToComposite(SplitElementCommand::create(static_cast<Elem ent*>(node->parent()), node));
1182 } 1184 }
1183 if (splitAncestor) { 1185 if (splitAncestor) {
1184 splitElement(static_cast<Element*>(end), node); 1186 splitElement(static_cast<Element*>(end), node);
1185 return node->parent(); 1187 return node->parent();
1186 } 1188 }
1187 return node.release(); 1189 return node.release();
1188 } 1190 }
1189 1191
1190 PassRefPtr<Element> createBlockPlaceholderElement(Document* document) 1192 PassRefPtr<Element> createBlockPlaceholderElement(Document* document)
1191 { 1193 {
1192 RefPtr<Element> breakNode = document->createElement(brTag, false); 1194 RefPtr<Element> breakNode = document->createElement(brTag, false);
1193 return breakNode.release(); 1195 return breakNode.release();
1194 } 1196 }
1195 1197
1196 } // namespace WebCore 1198 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/indent-node-to-split-to-crash-expected.txt ('k') | WebCore/editing/IndentOutdentCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698