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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 // preserving the hierarchy up to outerNode. | 801 // preserving the hierarchy up to outerNode. |
802 | 802 |
803 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
on& end, Node* outerNode, Element* blockElement) | 803 void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
on& end, Node* outerNode, Element* blockElement) |
804 { | 804 { |
805 // First we clone the outerNode | 805 // First we clone the outerNode |
806 | 806 |
807 RefPtr<Node> topNode = outerNode->cloneNode(isTableElement(outerNode)); | 807 RefPtr<Node> topNode = outerNode->cloneNode(isTableElement(outerNode)); |
808 appendNode(topNode, blockElement); | 808 appendNode(topNode, blockElement); |
809 RefPtr<Node> lastNode = topNode; | 809 RefPtr<Node> lastNode = topNode; |
810 | 810 |
811 if (start.deprecatedNode() != outerNode) { | 811 if (start.deprecatedNode() != outerNode && lastNode->isElementNode()) { |
812 Vector<RefPtr<Node> > ancestors; | 812 Vector<RefPtr<Node> > ancestors; |
813 | 813 |
814 // Insert each node from innerNode to outerNode (excluded) in a list. | 814 // Insert each node from innerNode to outerNode (excluded) in a list. |
815 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren
tNode()) | 815 for (Node* n = start.deprecatedNode(); n && n != outerNode; n = n->paren
tNode()) |
816 ancestors.append(n); | 816 ancestors.append(n); |
817 | 817 |
818 // Clone every node between start.deprecatedNode() and outerBlock. | 818 // Clone every node between start.deprecatedNode() and outerBlock. |
819 | 819 |
820 for (size_t i = ancestors.size(); i != 0; --i) { | 820 for (size_t i = ancestors.size(); i != 0; --i) { |
821 Node* item = ancestors[i - 1].get(); | 821 Node* item = ancestors[i - 1].get(); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 return node.release(); | 1269 return node.release(); |
1270 } | 1270 } |
1271 | 1271 |
1272 PassRefPtr<Element> createBlockPlaceholderElement(Document* document) | 1272 PassRefPtr<Element> createBlockPlaceholderElement(Document* document) |
1273 { | 1273 { |
1274 RefPtr<Element> breakNode = document->createElement(brTag, false); | 1274 RefPtr<Element> breakNode = document->createElement(brTag, false); |
1275 return breakNode.release(); | 1275 return breakNode.release(); |
1276 } | 1276 } |
1277 | 1277 |
1278 } // namespace WebCore | 1278 } // namespace WebCore |
OLD | NEW |