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

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

Issue 1333583002: Introduce composed tree version of isEndOfEditableOrNonEditableContent() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-09T13:37:29 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/VisibleUnits.h ('k') | Source/core/editing/VisibleUnitsTest.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, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
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 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1615
1616 VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition) 1616 VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition)
1617 { 1617 {
1618 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival ent()); 1618 ContainerNode* highestRoot = highestEditableRoot(visiblePosition.deepEquival ent());
1619 if (!highestRoot) 1619 if (!highestRoot)
1620 return VisiblePosition(); 1620 return VisiblePosition();
1621 1621
1622 return createVisiblePosition(lastPositionInNode(highestRoot)); 1622 return createVisiblePosition(lastPositionInNode(highestRoot));
1623 } 1623 }
1624 1624
1625 bool isEndOfEditableOrNonEditableContent(const VisiblePosition& p) 1625 template <typename Strategy>
1626 static bool isEndOfEditableOrNonEditableContentAlgorithm(const VisiblePositionTe mplate<Strategy>& p)
1626 { 1627 {
1627 return p.isNotNull() && nextPositionOf(p).isNull(); 1628 return p.isNotNull() && nextPositionOf(p).isNull();
1628 } 1629 }
1629 1630
1631 bool isEndOfEditableOrNonEditableContent(const VisiblePosition& position)
1632 {
1633 return isEndOfEditableOrNonEditableContentAlgorithm<EditingStrategy>(positio n);
1634 }
1635
1636 bool isEndOfEditableOrNonEditableContent(const VisiblePositionInComposedTree& po sition)
1637 {
1638 return isEndOfEditableOrNonEditableContentAlgorithm<EditingInComposedTreeStr ategy>(position);
1639 }
1640
1630 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc tion) 1641 VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direc tion)
1631 { 1642 {
1632 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); 1643 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c);
1633 } 1644 }
1634 1645
1635 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction) 1646 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction)
1636 { 1647 {
1637 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); 1648 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c);
1638 } 1649 }
1639 1650
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale nt()); 3014 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivale nt());
3004 case CanSkipOverEditingBoundary: 3015 case CanSkipOverEditingBoundary:
3005 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent ()); 3016 return skipToStartOfEditingBoundary(prev, visiblePosition.deepEquivalent ());
3006 } 3017 }
3007 3018
3008 ASSERT_NOT_REACHED(); 3019 ASSERT_NOT_REACHED();
3009 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent() ); 3020 return honorEditingBoundaryAtOrBefore(prev, visiblePosition.deepEquivalent() );
3010 } 3021 }
3011 3022
3012 } // namespace blink 3023 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnits.h ('k') | Source/core/editing/VisibleUnitsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698