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

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

Issue 66383003: Renaming isTableElement() to isRenderedTable() as per the FIXME comment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « Source/core/editing/Caret.cpp ('k') | Source/core/editing/VisibleUnits.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, 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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 970
971 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi on& end, Node* passedOuterNode, Element* blockElement) 971 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi on& end, Node* passedOuterNode, Element* blockElement)
972 { 972 {
973 // First we clone the outerNode 973 // First we clone the outerNode
974 RefPtr<Node> lastNode; 974 RefPtr<Node> lastNode;
975 RefPtr<Node> outerNode = passedOuterNode; 975 RefPtr<Node> outerNode = passedOuterNode;
976 976
977 if (outerNode->isRootEditableElement()) { 977 if (outerNode->isRootEditableElement()) {
978 lastNode = blockElement; 978 lastNode = blockElement;
979 } else { 979 } else {
980 lastNode = outerNode->cloneNode(isTableElement(outerNode.get())); 980 lastNode = outerNode->cloneNode(isRenderedTable(outerNode.get()));
981 appendNode(lastNode, blockElement); 981 appendNode(lastNode, blockElement);
982 } 982 }
983 983
984 if (start.deprecatedNode() != outerNode && lastNode->isElementNode()) { 984 if (start.deprecatedNode() != outerNode && lastNode->isElementNode()) {
985 Vector<RefPtr<Node> > ancestors; 985 Vector<RefPtr<Node> > ancestors;
986 986
987 // Insert each node from innerNode to outerNode (excluded) in a list. 987 // Insert each node from innerNode to outerNode (excluded) in a list.
988 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren tNode()) 988 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren tNode())
989 ancestors.append(n); 989 ancestors.append(n);
990 990
991 // Clone every node between start.deprecatedNode() and outerBlock. 991 // Clone every node between start.deprecatedNode() and outerBlock.
992 992
993 for (size_t i = ancestors.size(); i != 0; --i) { 993 for (size_t i = ancestors.size(); i != 0; --i) {
994 Node* item = ancestors[i - 1].get(); 994 Node* item = ancestors[i - 1].get();
995 RefPtr<Node> child = item->cloneNode(isTableElement(item)); 995 RefPtr<Node> child = item->cloneNode(isRenderedTable(item));
996 appendNode(child, toElement(lastNode)); 996 appendNode(child, toElement(lastNode));
997 lastNode = child.release(); 997 lastNode = child.release();
998 } 998 }
999 } 999 }
1000 1000
1001 // Scripts specified in javascript protocol may remove |outerNode| 1001 // Scripts specified in javascript protocol may remove |outerNode|
1002 // during insertion, e.g. <iframe src="javascript:..."> 1002 // during insertion, e.g. <iframe src="javascript:...">
1003 if (!outerNode->inDocument()) 1003 if (!outerNode->inDocument())
1004 return; 1004 return;
1005 1005
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // Add a br if pruning an empty block level element caused a collapse. For example: 1115 // Add a br if pruning an empty block level element caused a collapse. For example:
1116 // foo^ 1116 // foo^
1117 // <div>bar</div> 1117 // <div>bar</div>
1118 // baz 1118 // baz
1119 // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. Th at would 1119 // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. Th at would
1120 // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br . 1120 // cause 'baz' to collapse onto the line with 'foobar' unless we insert a br .
1121 // Must recononicalize these two VisiblePositions after the pruning above. 1121 // Must recononicalize these two VisiblePositions after the pruning above.
1122 beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent()); 1122 beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent());
1123 afterParagraph = VisiblePosition(afterParagraph.deepEquivalent()); 1123 afterParagraph = VisiblePosition(afterParagraph.deepEquivalent());
1124 1124
1125 if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquiv alent().deprecatedNode()) 1125 if (beforeParagraph.isNotNull() && !isRenderedTable(beforeParagraph.deepEqui valent().deprecatedNode())
1126 && ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforePar agraph)) || beforeParagraph == afterParagraph)) { 1126 && ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforePar agraph)) || beforeParagraph == afterParagraph)) {
1127 // FIXME: Trim text between beforeParagraph and afterParagraph if they a ren't equal. 1127 // FIXME: Trim text between beforeParagraph and afterParagraph if they a ren't equal.
1128 insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquival ent()); 1128 insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquival ent());
1129 } 1129 }
1130 } 1130 }
1131 1131
1132 void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraph ToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& dest ination, bool preserveSelection, bool preserveStyle, Node* constrainingAncestor) 1132 void CompositeEditCommand::moveParagraph(const VisiblePosition& startOfParagraph ToMove, const VisiblePosition& endOfParagraphToMove, const VisiblePosition& dest ination, bool preserveSelection, bool preserveStyle, Node* constrainingAncestor)
1133 { 1133 {
1134 ASSERT(isStartOfParagraph(startOfParagraphToMove)); 1134 ASSERT(isStartOfParagraph(startOfParagraphToMove));
1135 ASSERT(isEndOfParagraph(endOfParagraphToMove)); 1135 ASSERT(isEndOfParagraph(endOfParagraphToMove));
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 return node.release(); 1463 return node.release();
1464 } 1464 }
1465 1465
1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) 1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document)
1467 { 1467 {
1468 RefPtr<Element> breakNode = document.createElement(brTag, false); 1468 RefPtr<Element> breakNode = document.createElement(brTag, false);
1469 return breakNode.release(); 1469 return breakNode.release();
1470 } 1470 }
1471 1471
1472 } // namespace WebCore 1472 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/Caret.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698