OLD | NEW |
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 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. | 3 * Portions Copyright (c) 2011 Motorola Mobility, 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 VisiblePosition::VisiblePosition(const PositionInComposedTree& pos, TextAffinity
affinity) | 57 VisiblePosition::VisiblePosition(const PositionInComposedTree& pos, TextAffinity
affinity) |
58 { | 58 { |
59 init(pos, affinity); | 59 init(pos, affinity); |
60 } | 60 } |
61 | 61 |
62 VisiblePosition::VisiblePosition(const PositionWithAffinity& positionWithAffinit
y) | 62 VisiblePosition::VisiblePosition(const PositionWithAffinity& positionWithAffinit
y) |
63 { | 63 { |
64 init(positionWithAffinity.position(), positionWithAffinity.affinity()); | 64 init(positionWithAffinity.position(), positionWithAffinity.affinity()); |
65 } | 65 } |
66 | 66 |
67 VisiblePosition VisiblePosition::next(EditingBoundaryCrossingRule rule) const | 67 // TODO(yosin) We should move |nextPositionOf()| to "VisibleUnits.cpp". |
| 68 VisiblePosition nextPositionOf(const VisiblePosition& visiblePosition, EditingBo
undaryCrossingRule rule) |
68 { | 69 { |
69 VisiblePosition next(nextVisuallyDistinctCandidate(m_deepPosition), m_affini
ty); | 70 VisiblePosition next(nextVisuallyDistinctCandidate(visiblePosition.deepEquiv
alent()), visiblePosition.affinity()); |
70 | 71 |
71 switch (rule) { | 72 switch (rule) { |
72 case CanCrossEditingBoundary: | 73 case CanCrossEditingBoundary: |
73 return next; | 74 return next; |
74 case CannotCrossEditingBoundary: | 75 case CannotCrossEditingBoundary: |
75 return honorEditingBoundaryAtOrAfter(next); | 76 return visiblePosition.honorEditingBoundaryAtOrAfter(next); |
76 case CanSkipOverEditingBoundary: | 77 case CanSkipOverEditingBoundary: |
77 return skipToEndOfEditingBoundary(next); | 78 return visiblePosition.skipToEndOfEditingBoundary(next); |
78 } | 79 } |
79 ASSERT_NOT_REACHED(); | 80 ASSERT_NOT_REACHED(); |
80 return honorEditingBoundaryAtOrAfter(next); | 81 return visiblePosition.honorEditingBoundaryAtOrAfter(next); |
81 } | 82 } |
82 | 83 |
83 VisiblePosition previousPositionOf(const VisiblePosition& visiblePosition, Editi
ngBoundaryCrossingRule rule) | 84 VisiblePosition previousPositionOf(const VisiblePosition& visiblePosition, Editi
ngBoundaryCrossingRule rule) |
84 { | 85 { |
85 Position pos = previousVisuallyDistinctCandidate(visiblePosition.deepEquival
ent()); | 86 Position pos = previousVisuallyDistinctCandidate(visiblePosition.deepEquival
ent()); |
86 | 87 |
87 // return null visible position if there is no previous visible position | 88 // return null visible position if there is no previous visible position |
88 if (pos.atStartOfTree()) | 89 if (pos.atStartOfTree()) |
89 return VisiblePosition(); | 90 return VisiblePosition(); |
90 | 91 |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 else | 775 else |
775 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); | 776 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); |
776 } | 777 } |
777 | 778 |
778 void showTree(const blink::VisiblePosition& vpos) | 779 void showTree(const blink::VisiblePosition& vpos) |
779 { | 780 { |
780 vpos.showTreeForThis(); | 781 vpos.showTreeForThis(); |
781 } | 782 } |
782 | 783 |
783 #endif | 784 #endif |
OLD | NEW |