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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 | 1008 |
1009 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode(
)->isDescendantOf(end.deprecatedNode())) { | 1009 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode(
)->isDescendantOf(end.deprecatedNode())) { |
1010 // If end is not a descendant of outerNode we need to | 1010 // If end is not a descendant of outerNode we need to |
1011 // find the first common ancestor to increase the scope | 1011 // find the first common ancestor to increase the scope |
1012 // of our nextSibling traversal. | 1012 // of our nextSibling traversal. |
1013 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) { | 1013 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) { |
1014 outerNode = outerNode->parentNode(); | 1014 outerNode = outerNode->parentNode(); |
1015 } | 1015 } |
1016 | 1016 |
1017 RefPtr<Node> startNode = start.deprecatedNode(); | 1017 RefPtr<Node> startNode = start.deprecatedNode(); |
1018 for (RefPtr<Node> node = NodeTraversal::nextSkippingChildren(startNode.g
et(), outerNode.get()); node; node = NodeTraversal::nextSkippingChildren(node.ge
t(), outerNode.get())) { | 1018 for (RefPtr<Node> node = NodeTraversal::nextSkippingChildren(*startNode,
outerNode.get()); node; node = NodeTraversal::nextSkippingChildren(*node, outer
Node.get())) { |
1019 // Move lastNode up in the tree as much as node was moved up in the | 1019 // Move lastNode up in the tree as much as node was moved up in the |
1020 // tree by NodeTraversal::nextSkippingChildren, so that the relative
depth between | 1020 // tree by NodeTraversal::nextSkippingChildren, so that the relative
depth between |
1021 // node and the original start node is maintained in the clone. | 1021 // node and the original start node is maintained in the clone. |
1022 while (startNode->parentNode() != node->parentNode()) { | 1022 while (startNode->parentNode() != node->parentNode()) { |
1023 startNode = startNode->parentNode(); | 1023 startNode = startNode->parentNode(); |
1024 lastNode = lastNode->parentNode(); | 1024 lastNode = lastNode->parentNode(); |
1025 } | 1025 } |
1026 | 1026 |
1027 RefPtr<Node> clonedNode = node->cloneNode(true); | 1027 RefPtr<Node> clonedNode = node->cloneNode(true); |
1028 insertNodeAfter(clonedNode, lastNode); | 1028 insertNodeAfter(clonedNode, lastNode); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |