OLD | NEW |
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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 | 997 |
998 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
on& end, Node* passedOuterNode, Element* blockElement) | 998 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
on& end, Node* passedOuterNode, Element* blockElement) |
999 { | 999 { |
1000 // First we clone the outerNode | 1000 // First we clone the outerNode |
1001 RefPtr<Node> lastNode; | 1001 RefPtr<Node> lastNode; |
1002 RefPtr<Node> outerNode = passedOuterNode; | 1002 RefPtr<Node> outerNode = passedOuterNode; |
1003 | 1003 |
1004 if (outerNode->isRootEditableElement()) { | 1004 if (outerNode->isRootEditableElement()) { |
1005 lastNode = blockElement; | 1005 lastNode = blockElement; |
1006 } else { | 1006 } else { |
1007 lastNode = outerNode->cloneNode(isRenderedTable(outerNode.get())); | 1007 lastNode = outerNode->cloneNode(isTableElement(outerNode.get())); |
1008 appendNode(lastNode, blockElement); | 1008 appendNode(lastNode, blockElement); |
1009 } | 1009 } |
1010 | 1010 |
1011 if (start.anchorNode() != outerNode && lastNode->isElementNode() && start.an
chorNode()->isDescendantOf(outerNode.get())) { | 1011 if (start.anchorNode() != outerNode && lastNode->isElementNode() && start.an
chorNode()->isDescendantOf(outerNode.get())) { |
1012 Vector<RefPtr<Node> > ancestors; | 1012 Vector<RefPtr<Node> > ancestors; |
1013 | 1013 |
1014 // Insert each node from innerNode to outerNode (excluded) in a list. | 1014 // Insert each node from innerNode to outerNode (excluded) in a list. |
1015 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren
tNode()) | 1015 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren
tNode()) |
1016 ancestors.append(n); | 1016 ancestors.append(n); |
1017 | 1017 |
1018 // Clone every node between start.deprecatedNode() and outerBlock. | 1018 // Clone every node between start.deprecatedNode() and outerBlock. |
1019 | 1019 |
1020 for (size_t i = ancestors.size(); i != 0; --i) { | 1020 for (size_t i = ancestors.size(); i != 0; --i) { |
1021 Node* item = ancestors[i - 1].get(); | 1021 Node* item = ancestors[i - 1].get(); |
1022 RefPtr<Node> child = item->cloneNode(isRenderedTable(item)); | 1022 RefPtr<Node> child = item->cloneNode(isTableElement(item)); |
1023 appendNode(child, toElement(lastNode)); | 1023 appendNode(child, toElement(lastNode)); |
1024 lastNode = child.release(); | 1024 lastNode = child.release(); |
1025 } | 1025 } |
1026 } | 1026 } |
1027 | 1027 |
1028 // Scripts specified in javascript protocol may remove |outerNode| | 1028 // Scripts specified in javascript protocol may remove |outerNode| |
1029 // during insertion, e.g. <iframe src="javascript:..."> | 1029 // during insertion, e.g. <iframe src="javascript:..."> |
1030 if (!outerNode->inDocument()) | 1030 if (!outerNode->inDocument()) |
1031 return; | 1031 return; |
1032 | 1032 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 return node.release(); | 1490 return node.release(); |
1491 } | 1491 } |
1492 | 1492 |
1493 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1493 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1494 { | 1494 { |
1495 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1495 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1496 return breakNode.release(); | 1496 return breakNode.release(); |
1497 } | 1497 } |
1498 | 1498 |
1499 } // namespace WebCore | 1499 } // namespace WebCore |
OLD | NEW |