Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 Node* blockStart = enclosingBlock(insertionPos.deprecatedNode()); | 1075 Node* blockStart = enclosingBlock(insertionPos.deprecatedNode()); |
| 1076 if ((isListElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListElement(refNode->firstChild()))) | 1076 if ((isListElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListElement(refNode->firstChild()))) |
| 1077 && blockStart && blockStart->renderer()->isListItem()) | 1077 && blockStart && blockStart->renderer()->isListItem()) |
| 1078 refNode = insertAsListItems(toHTMLElement(refNode), blockStart, insertio nPos, insertedNodes); | 1078 refNode = insertAsListItems(toHTMLElement(refNode), blockStart, insertio nPos, insertedNodes); |
| 1079 else { | 1079 else { |
| 1080 insertNodeAt(refNode, insertionPos); | 1080 insertNodeAt(refNode, insertionPos); |
| 1081 insertedNodes.respondToNodeInsertion(*refNode); | 1081 insertedNodes.respondToNodeInsertion(*refNode); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 // Mutation events (bug 22634) may have already removed the inserted content | 1084 // Mutation events (bug 22634) may have already removed the inserted content |
| 1085 if (!refNode->inDocument()) | 1085 if (!refNode || !refNode->inDocument()) |
|
Yuta Kitamura
2014/04/02 09:34:49
nit: Test for |!refNode| should probably be done r
yosin_UTC9
2014/04/03 05:01:50
Done.
| |
| 1086 return; | 1086 return; |
| 1087 | 1087 |
| 1088 bool plainTextFragment = isPlainTextMarkup(refNode.get()); | 1088 bool plainTextFragment = isPlainTextMarkup(refNode.get()); |
| 1089 | 1089 |
| 1090 while (node) { | 1090 while (node) { |
| 1091 RefPtr<Node> next = node->nextSibling(); | 1091 RefPtr<Node> next = node->nextSibling(); |
| 1092 fragment.removeNode(node.get()); | 1092 fragment.removeNode(node.get()); |
| 1093 insertNodeAfter(node, refNode); | 1093 insertNodeAfter(node, refNode); |
| 1094 insertedNodes.respondToNodeInsertion(*node); | 1094 insertedNodes.respondToNodeInsertion(*node); |
| 1095 | 1095 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1494 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
| 1495 | 1495 |
| 1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); | 1496 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); |
| 1497 | 1497 |
| 1498 setEndingSelection(selectionAfterReplace); | 1498 setEndingSelection(selectionAfterReplace); |
| 1499 | 1499 |
| 1500 return true; | 1500 return true; |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 } // namespace WebCore | 1503 } // namespace WebCore |
| OLD | NEW |