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

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

Issue 239703007: Rename Node::lastDescendant() / Node::highestAncestor() for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename highestAncestor() as well Created 6 years, 8 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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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