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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(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| |
| 1002 // during insertion, e.g. <iframe src="javascript:..."> |
| 1003 if (!outerNode->inDocument()) |
| 1004 return; |
| 1005 |
1001 // Handle the case of paragraphs with more than one node, | 1006 // Handle the case of paragraphs with more than one node, |
1002 // cloning all the siblings until end.deprecatedNode() is reached. | 1007 // cloning all the siblings until end.deprecatedNode() is reached. |
1003 | 1008 |
1004 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode(
)->isDescendantOf(end.deprecatedNode())) { | 1009 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode(
)->isDescendantOf(end.deprecatedNode())) { |
1005 // If end is not a descendant of outerNode we need to | 1010 // If end is not a descendant of outerNode we need to |
1006 // find the first common ancestor to increase the scope | 1011 // find the first common ancestor to increase the scope |
1007 // of our nextSibling traversal. | 1012 // of our nextSibling traversal. |
1008 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) { | 1013 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) { |
1009 outerNode = outerNode->parentNode(); | 1014 outerNode = outerNode->parentNode(); |
1010 } | 1015 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 return node.release(); | 1463 return node.release(); |
1459 } | 1464 } |
1460 | 1465 |
1461 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1462 { | 1467 { |
1463 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1468 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1464 return breakNode.release(); | 1469 return breakNode.release(); |
1465 } | 1470 } |
1466 | 1471 |
1467 } // namespace WebCore | 1472 } // namespace WebCore |
OLD | NEW |