| 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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 } | 1480 } |
| 1481 | 1481 |
| 1482 void ReplaceSelectionCommand::updateNodesInserted(Node *node) | 1482 void ReplaceSelectionCommand::updateNodesInserted(Node *node) |
| 1483 { | 1483 { |
| 1484 if (!node) | 1484 if (!node) |
| 1485 return; | 1485 return; |
| 1486 | 1486 |
| 1487 if (m_startOfInsertedContent.isNull()) | 1487 if (m_startOfInsertedContent.isNull()) |
| 1488 m_startOfInsertedContent = firstPositionInOrBeforeNode(node); | 1488 m_startOfInsertedContent = firstPositionInOrBeforeNode(node); |
| 1489 | 1489 |
| 1490 m_endOfInsertedContent = lastPositionInOrAfterNode(&node->lastDescendantOrSe
lf()); | 1490 m_endOfInsertedContent = lastPositionInOrAfterNode(&NodeTraversal::lastWithi
nOrSelf(*node)); |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 // During simple pastes, where we're just pasting a text node into a run of text
, we insert the text node | 1493 // During simple pastes, where we're just pasting a text node into a run of text
, we insert the text node |
| 1494 // directly into the text node that holds the selection. This is much faster th
an the generalized code in | 1494 // directly into the text node that holds the selection. This is much faster th
an the generalized code in |
| 1495 // ReplaceSelectionCommand, and works around <https://bugs.webkit.org/show_bug.c
gi?id=6148> since we don't | 1495 // ReplaceSelectionCommand, and works around <https://bugs.webkit.org/show_bug.c
gi?id=6148> since we don't |
| 1496 // split text nodes. | 1496 // split text nodes. |
| 1497 bool ReplaceSelectionCommand::performTrivialReplace(const ReplacementFragment& f
ragment) | 1497 bool ReplaceSelectionCommand::performTrivialReplace(const ReplacementFragment& f
ragment) |
| 1498 { | 1498 { |
| 1499 if (!fragment.firstChild() || fragment.firstChild() != fragment.lastChild()
|| !fragment.firstChild()->isTextNode()) | 1499 if (!fragment.firstChild() || fragment.firstChild() != fragment.lastChild()
|| !fragment.firstChild()->isTextNode()) |
| 1500 return false; | 1500 return false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1530 void ReplaceSelectionCommand::trace(Visitor* visitor) | 1530 void ReplaceSelectionCommand::trace(Visitor* visitor) |
| 1531 { | 1531 { |
| 1532 visitor->trace(m_startOfInsertedContent); | 1532 visitor->trace(m_startOfInsertedContent); |
| 1533 visitor->trace(m_endOfInsertedContent); | 1533 visitor->trace(m_endOfInsertedContent); |
| 1534 visitor->trace(m_insertionStyle); | 1534 visitor->trace(m_insertionStyle); |
| 1535 visitor->trace(m_documentFragment); | 1535 visitor->trace(m_documentFragment); |
| 1536 CompositeEditCommand::trace(visitor); | 1536 CompositeEditCommand::trace(visitor); |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 } // namespace blink | 1539 } // namespace blink |
| OLD | NEW |