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

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

Issue 1311543006: Introduce composed tree version of firstEditableVisiblePositionAfterPositionInRoot() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-08T13:00:05 Add TODO for firstEditableVisiblePositionAfterPositionInRoot() Created 5 years, 3 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
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.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) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 PositionInComposedTree previousVisuallyDistinctCandidate(const PositionInCompose dTree& position) 444 PositionInComposedTree previousVisuallyDistinctCandidate(const PositionInCompose dTree& position)
445 { 445 {
446 return previousVisuallyDistinctCandidateAlgorithm<EditingInComposedTreeStrat egy>(position); 446 return previousVisuallyDistinctCandidateAlgorithm<EditingInComposedTreeStrat egy>(position);
447 } 447 }
448 448
449 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position& position, ContainerNode* highestRoot) 449 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position& position, ContainerNode* highestRoot)
450 { 450 {
451 return createVisiblePosition(firstEditablePositionAfterPositionInRoot(positi on, highestRoot)); 451 return createVisiblePosition(firstEditablePositionAfterPositionInRoot(positi on, highestRoot));
452 } 452 }
453 453
454 VisiblePositionInComposedTree firstEditableVisiblePositionAfterPositionInRoot(co nst PositionInComposedTree& position, ContainerNode* highestRoot)
455 {
456 return createVisiblePosition(firstEditablePositionAfterPositionInRoot(positi on, highestRoot));
457 }
458
454 template <typename Strategy> 459 template <typename Strategy>
455 PositionAlgorithm<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(co nst PositionAlgorithm<Strategy>& position, Node* highestRoot) 460 PositionAlgorithm<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(co nst PositionAlgorithm<Strategy>& position, Node* highestRoot)
456 { 461 {
457 // position falls before highestRoot. 462 // position falls before highestRoot.
458 if (position.compareTo(PositionAlgorithm<Strategy>::firstPositionInNode(high estRoot)) == -1 && highestRoot->hasEditableStyle()) 463 if (position.compareTo(PositionAlgorithm<Strategy>::firstPositionInNode(high estRoot)) == -1 && highestRoot->hasEditableStyle())
459 return PositionAlgorithm<Strategy>::firstPositionInNode(highestRoot); 464 return PositionAlgorithm<Strategy>::firstPositionInNode(highestRoot);
460 465
461 PositionAlgorithm<Strategy> editablePosition = position; 466 PositionAlgorithm<Strategy> editablePosition = position;
462 467
463 if (position.anchorNode()->treeScope() != highestRoot->treeScope()) { 468 if (position.anchorNode()->treeScope() != highestRoot->treeScope()) {
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 // if the selection starts just before a paragraph break, skip over it 1659 // if the selection starts just before a paragraph break, skip over it
1655 if (isEndOfParagraph(visiblePosition)) 1660 if (isEndOfParagraph(visiblePosition))
1656 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui valent()); 1661 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui valent());
1657 1662
1658 // otherwise, make sure to be at the start of the first selected node, 1663 // otherwise, make sure to be at the start of the first selected node,
1659 // instead of possibly at the end of the last node before the selection 1664 // instead of possibly at the end of the last node before the selection
1660 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); 1665 return mostForwardCaretPosition(visiblePosition.deepEquivalent());
1661 } 1666 }
1662 1667
1663 } // namespace blink 1668 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/EditingUtilities.h ('k') | Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698