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

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

Issue 59963002: Unable to delete the first and the last characters of a contenteditable div with display: table. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaking the testcase 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
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(isRenderedTable(outerNode.get())); 980 lastNode = outerNode->cloneNode(isTableElement(outerNode.get()));
981 appendNode(lastNode, blockElement); 981 appendNode(lastNode, blockElement);
982 } 982 }
983 983
984 if (start.anchorNode() != outerNode && lastNode->isElementNode() && start.an chorNode()->isDescendantOf(outerNode.get())) { 984 if (start.anchorNode() != outerNode && lastNode->isElementNode() && start.an chorNode()->isDescendantOf(outerNode.get())) {
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(isRenderedTable(item)); 995 RefPtr<Node> child = item->cloneNode(isTableElement(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 457 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

Powered by Google App Engine
This is Rietveld 408576698