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

Unified Diff: Source/core/editing/VisiblePosition.cpp

Issue 1303173010: Move honorEditingBoundaryAtOr{Before,After}() for VisiblePosition to VisibleUnits.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-02T14:17:25 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisiblePosition.cpp
diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
index d293a59e78f61ec8733eb8d6cb153b83b65c48fa..2a5e5f3c8cb0d44b2dec058eec7be31986ef80fc 100644
--- a/Source/core/editing/VisiblePosition.cpp
+++ b/Source/core/editing/VisiblePosition.cpp
@@ -64,74 +64,6 @@ VisiblePosition VisiblePosition::createWithoutCanonicalization(const PositionWit
return visiblePosition;
}
-template <typename Strategy>
-PositionWithAffinityTemplate<Strategy> honorEditingBoundaryAtOrBeforeAlgorithm(const PositionWithAffinityTemplate<Strategy>& pos, const PositionAlgorithm<Strategy>& anchor)
-{
- if (pos.isNull())
- return pos;
-
- ContainerNode* highestRoot = highestEditableRoot(anchor);
-
- // Return empty position if pos is not somewhere inside the editable region containing this position
- if (highestRoot && !pos.position().anchorNode()->isDescendantOf(highestRoot))
- return PositionWithAffinityTemplate<Strategy>();
-
- // Return pos itself if the two are from the very same editable region, or both are non-editable
- // FIXME: In the non-editable case, just because the new position is non-editable doesn't mean movement
- // to it is allowed. VisibleSelection::adjustForEditableContent has this problem too.
- if (highestEditableRoot(pos.position()) == highestRoot)
- return pos;
-
- // Return empty position if this position is non-editable, but pos is editable
- // FIXME: Move to the previous non-editable region.
- if (!highestRoot)
- return PositionWithAffinityTemplate<Strategy>();
-
- // Return the last position before pos that is in the same editable region as this position
- return lastEditablePositionBeforePositionInRoot(pos.position(), highestRoot);
-}
-
-PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity& pos, const Position& anchor)
-{
- return honorEditingBoundaryAtOrBeforeAlgorithm(pos, anchor);
-}
-
-PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionInComposedTreeWithAffinity& pos, const PositionInComposedTree& anchor)
-{
- return honorEditingBoundaryAtOrBeforeAlgorithm(pos, anchor);
-}
-
-VisiblePosition honorEditingBoundaryAtOrBefore(const VisiblePosition& pos, const Position& anchor)
-{
- return createVisiblePosition(honorEditingBoundaryAtOrBeforeOf(pos.toPositionWithAffinity(), anchor));
-}
-
-VisiblePosition honorEditingBoundaryAtOrAfter(const VisiblePosition& pos, const Position& anchor)
-{
- if (pos.isNull())
- return pos;
-
- ContainerNode* highestRoot = highestEditableRoot(anchor);
-
- // Return empty position if pos is not somewhere inside the editable region containing this position
- if (highestRoot && !pos.deepEquivalent().anchorNode()->isDescendantOf(highestRoot))
- return VisiblePosition();
-
- // Return pos itself if the two are from the very same editable region, or both are non-editable
- // FIXME: In the non-editable case, just because the new position is non-editable doesn't mean movement
- // to it is allowed. VisibleSelection::adjustForEditableContent has this problem too.
- if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
- return pos;
-
- // Return empty position if this position is non-editable, but pos is editable
- // FIXME: Move to the next non-editable region.
- if (!highestRoot)
- return VisiblePosition();
-
- // Return the next position after pos that is in the same editable region as this position
- return firstEditableVisiblePositionAfterPositionInRoot(pos.deepEquivalent(), highestRoot);
-}
-
template<typename Strategy>
static PositionWithAffinityTemplate<Strategy> createVisiblePositionAlgorithm(const PositionAlgorithm<Strategy>& position, TextAffinity affinity)
{
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698