Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/core/editing/ReplaceSelectionCommand.cpp

Issue 420323002: Move Node::lastDescendantOrSelf() to NodeTraversal and rename to lastWithinOrSelf() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.h ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.h ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698