| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 void ReplacementFragment::removeNode(PassRefPtr<Node> node) | 222 void ReplacementFragment::removeNode(PassRefPtr<Node> node) |
| 223 { | 223 { |
| 224 if (!node) | 224 if (!node) |
| 225 return; | 225 return; |
| 226 | 226 |
| 227 ContainerNode* parent = node->nonShadowBoundaryParentNode(); | 227 ContainerNode* parent = node->nonShadowBoundaryParentNode(); |
| 228 if (!parent) | 228 if (!parent) |
| 229 return; | 229 return; |
| 230 | 230 |
| 231 parent->removeChild(node.get(), ASSERT_NO_EXCEPTION); | 231 parent->removeChild(node.get()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ReplacementFragment::insertNodeBefore(PassRefPtr<Node> node, Node* refNode) | 234 void ReplacementFragment::insertNodeBefore(PassRefPtr<Node> node, Node* refNode) |
| 235 { | 235 { |
| 236 if (!node || !refNode) | 236 if (!node || !refNode) |
| 237 return; | 237 return; |
| 238 | 238 |
| 239 ContainerNode* parent = refNode->nonShadowBoundaryParentNode(); | 239 ContainerNode* parent = refNode->nonShadowBoundaryParentNode(); |
| 240 if (!parent) | 240 if (!parent) |
| 241 return; | 241 return; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 253 | 253 |
| 254 return holder.release(); | 254 return holder.release(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) | 257 void ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment(Element*
holder) |
| 258 { | 258 { |
| 259 if (!holder) | 259 if (!holder) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 while (RefPtr<Node> node = holder->firstChild()) { | 262 while (RefPtr<Node> node = holder->firstChild()) { |
| 263 holder->removeChild(node.get(), ASSERT_NO_EXCEPTION); | 263 holder->removeChild(node.get()); |
| 264 m_fragment->appendChild(node.get(), ASSERT_NO_EXCEPTION); | 264 m_fragment->appendChild(node.get(), ASSERT_NO_EXCEPTION); |
| 265 } | 265 } |
| 266 | 266 |
| 267 removeNode(holder); | 267 removeNode(holder); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void ReplacementFragment::removeUnrenderedNodes(Node* holder) | 270 void ReplacementFragment::removeUnrenderedNodes(Node* holder) |
| 271 { | 271 { |
| 272 Vector<RefPtr<Node> > unrendered; | 272 Vector<RefPtr<Node> > unrendered; |
| 273 | 273 |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 // If we're in the middle of a list item, we should split it into two separa
te | 1421 // If we're in the middle of a list item, we should split it into two separa
te |
| 1422 // list items and insert these nodes between them. | 1422 // list items and insert these nodes between them. |
| 1423 if (isMiddle) { | 1423 if (isMiddle) { |
| 1424 int textNodeOffset = insertPos.offsetInContainerNode(); | 1424 int textNodeOffset = insertPos.offsetInContainerNode(); |
| 1425 if (insertPos.deprecatedNode()->isTextNode() && textNodeOffset > 0) | 1425 if (insertPos.deprecatedNode()->isTextNode() && textNodeOffset > 0) |
| 1426 splitTextNode(toText(insertPos.deprecatedNode()), textNodeOffset); | 1426 splitTextNode(toText(insertPos.deprecatedNode()), textNodeOffset); |
| 1427 splitTreeToNode(insertPos.deprecatedNode(), lastNode, true); | 1427 splitTreeToNode(insertPos.deprecatedNode(), lastNode, true); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 while (RefPtr<Node> listItem = listElement->firstChild()) { | 1430 while (RefPtr<Node> listItem = listElement->firstChild()) { |
| 1431 listElement->removeChild(listItem.get(), ASSERT_NO_EXCEPTION); | 1431 listElement->removeChild(listItem.get()); |
| 1432 if (isStart || isMiddle) { | 1432 if (isStart || isMiddle) { |
| 1433 insertNodeBefore(listItem, lastNode); | 1433 insertNodeBefore(listItem, lastNode); |
| 1434 insertedNodes.respondToNodeInsertion(listItem.get()); | 1434 insertedNodes.respondToNodeInsertion(listItem.get()); |
| 1435 } else if (isEnd) { | 1435 } else if (isEnd) { |
| 1436 insertNodeAfter(listItem, lastNode); | 1436 insertNodeAfter(listItem, lastNode); |
| 1437 insertedNodes.respondToNodeInsertion(listItem.get()); | 1437 insertedNodes.respondToNodeInsertion(listItem.get()); |
| 1438 lastNode = listItem.get(); | 1438 lastNode = listItem.get(); |
| 1439 } else | 1439 } else |
| 1440 ASSERT_NOT_REACHED(); | 1440 ASSERT_NOT_REACHED(); |
| 1441 } | 1441 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1486 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
| 1487 | 1487 |
| 1488 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1488 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
| 1489 | 1489 |
| 1490 setEndingSelection(selectionAfterReplace); | 1490 setEndingSelection(selectionAfterReplace); |
| 1491 | 1491 |
| 1492 return true; | 1492 return true; |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 } // namespace WebCore | 1495 } // namespace WebCore |
| OLD | NEW |