| 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 void ReplaceSelectionCommand::updateNodesInserted(Node *node) | 1457 void ReplaceSelectionCommand::updateNodesInserted(Node *node) |
| 1458 { | 1458 { |
| 1459 if (!node) | 1459 if (!node) |
| 1460 return; | 1460 return; |
| 1461 | 1461 |
| 1462 if (m_startOfInsertedContent.isNull()) | 1462 if (m_startOfInsertedContent.isNull()) |
| 1463 m_startOfInsertedContent = firstPositionInOrBeforeNode(node); | 1463 m_startOfInsertedContent = firstPositionInOrBeforeNode(node); |
| 1464 | 1464 |
| 1465 m_endOfInsertedContent = lastPositionInOrAfterNode(&node->lastDescendant()); | 1465 m_endOfInsertedContent = lastPositionInOrAfterNode(&node->lastDescendantOrSe
lf()); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 // During simple pastes, where we're just pasting a text node into a run of text
, we insert the text node | 1468 // During simple pastes, where we're just pasting a text node into a run of text
, we insert the text node |
| 1469 // directly into the text node that holds the selection. This is much faster th
an the generalized code in | 1469 // directly into the text node that holds the selection. This is much faster th
an the generalized code in |
| 1470 // ReplaceSelectionCommand, and works around <https://bugs.webkit.org/show_bug.c
gi?id=6148> since we don't | 1470 // ReplaceSelectionCommand, and works around <https://bugs.webkit.org/show_bug.c
gi?id=6148> since we don't |
| 1471 // split text nodes. | 1471 // split text nodes. |
| 1472 bool ReplaceSelectionCommand::performTrivialReplace(const ReplacementFragment& f
ragment) | 1472 bool ReplaceSelectionCommand::performTrivialReplace(const ReplacementFragment& f
ragment) |
| 1473 { | 1473 { |
| 1474 if (!fragment.firstChild() || fragment.firstChild() != fragment.lastChild()
|| !fragment.firstChild()->isTextNode()) | 1474 if (!fragment.firstChild() || fragment.firstChild() != fragment.lastChild()
|| !fragment.firstChild()->isTextNode()) |
| 1475 return false; | 1475 return false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1496 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1496 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
| 1497 | 1497 |
| 1498 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1498 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
| 1499 | 1499 |
| 1500 setEndingSelection(selectionAfterReplace); | 1500 setEndingSelection(selectionAfterReplace); |
| 1501 | 1501 |
| 1502 return true; | 1502 return true; |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 } // namespace WebCore | 1505 } // namespace WebCore |
| OLD | NEW |