OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // abc| UPSTREAM |VisiblePosition| | 65 // abc| UPSTREAM |VisiblePosition| |
66 // |def DOWNSTREAM |VisiblePosition| | 66 // |def DOWNSTREAM |VisiblePosition| |
67 // | 67 // |
68 // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped line, | 68 // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped line, |
69 // otherwise it will be converted to DOWNSTREAM. | 69 // otherwise it will be converted to DOWNSTREAM. |
70 class CORE_EXPORT VisiblePosition final { | 70 class CORE_EXPORT VisiblePosition final { |
71 DISALLOW_ALLOCATION(); | 71 DISALLOW_ALLOCATION(); |
72 public: | 72 public: |
73 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { } | 73 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { } |
74 | 74 |
75 // TODO(yosin) We should use |visiblePositionOf()| instead of constructor, | 75 // TODO(yosin) We should use |createVisiblePosition()| instead of |
76 // and make constructors to have private accessibility, since constructors | 76 // constructor, and make constructors to have private accessibility, since |
77 // aren't simple, e.g. they update layout tree. | 77 // constructors aren't simple, e.g. they update layout tree. |
78 explicit VisiblePosition(const Position&, TextAffinity = VP_DEFAULT_AFFINITY
); | 78 explicit VisiblePosition(const Position&, TextAffinity = VP_DEFAULT_AFFINITY
); |
79 | 79 |
80 // Node: Other than |visiblePositionOf()|, we should not use | 80 // Node: Other than |createVisiblePosition()|, we should not use |
81 // |createWithoutCanonicalization()|. | 81 // |createWithoutCanonicalization()|. |
82 static VisiblePosition createWithoutCanonicalization(const PositionWithAffin
ity& canonicalized); | 82 static VisiblePosition createWithoutCanonicalization(const PositionWithAffin
ity& canonicalized); |
83 | 83 |
84 // Intentionally delete |operator==()| and |operator!=()| for reducing | 84 // Intentionally delete |operator==()| and |operator!=()| for reducing |
85 // compilation error message. | 85 // compilation error message. |
86 // TODO(yosin) We'll have |equals()| when we have use cases of checking | 86 // TODO(yosin) We'll have |equals()| when we have use cases of checking |
87 // equality of both position and affinity. | 87 // equality of both position and affinity. |
88 bool operator==(const VisiblePosition&) const = delete; | 88 bool operator==(const VisiblePosition&) const = delete; |
89 bool operator!=(const VisiblePosition&) const = delete; | 89 bool operator!=(const VisiblePosition&) const = delete; |
90 | 90 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT
ree&); | 132 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT
ree&); |
133 | 133 |
134 // TODO(yosin) We should move |honorEditingBoundaryAtOr{Before,After} to | 134 // TODO(yosin) We should move |honorEditingBoundaryAtOr{Before,After} to |
135 // "VisibleUnits.cpp" as static function. | 135 // "VisibleUnits.cpp" as static function. |
136 // next() and previous() will increment/decrement by a character cluster. | 136 // next() and previous() will increment/decrement by a character cluster. |
137 VisiblePosition honorEditingBoundaryAtOrBefore(const VisiblePosition&, const Pos
ition& anchor); | 137 VisiblePosition honorEditingBoundaryAtOrBefore(const VisiblePosition&, const Pos
ition& anchor); |
138 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity
&, const Position& anchor); | 138 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity
&, const Position& anchor); |
139 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi
onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); | 139 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi
onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); |
140 VisiblePosition honorEditingBoundaryAtOrAfter(const VisiblePosition&, const Posi
tion& anchor); | 140 VisiblePosition honorEditingBoundaryAtOrAfter(const VisiblePosition&, const Posi
tion& anchor); |
141 | 141 |
142 CORE_EXPORT VisiblePosition visiblePositionOf(const Position&, TextAffinity = VP
_DEFAULT_AFFINITY); | 142 CORE_EXPORT VisiblePosition createVisiblePosition(const Position&, TextAffinity
= VP_DEFAULT_AFFINITY); |
143 CORE_EXPORT VisiblePosition visiblePositionOf(const PositionWithAffinity&); | 143 CORE_EXPORT VisiblePosition createVisiblePosition(const PositionWithAffinity&); |
144 CORE_EXPORT VisiblePosition visiblePositionOf(const PositionInComposedTree&, Tex
tAffinity = VP_DEFAULT_AFFINITY); | 144 CORE_EXPORT VisiblePosition createVisiblePosition(const PositionInComposedTree&,
TextAffinity = VP_DEFAULT_AFFINITY); |
145 | 145 |
146 } // namespace blink | 146 } // namespace blink |
147 | 147 |
148 #ifndef NDEBUG | 148 #ifndef NDEBUG |
149 // Outside the WebCore namespace for ease of invocation from gdb. | 149 // Outside the WebCore namespace for ease of invocation from gdb. |
150 void showTree(const blink::VisiblePosition*); | 150 void showTree(const blink::VisiblePosition*); |
151 void showTree(const blink::VisiblePosition&); | 151 void showTree(const blink::VisiblePosition&); |
152 #endif | 152 #endif |
153 | 153 |
154 #endif // VisiblePosition_h | 154 #endif // VisiblePosition_h |
OLD | NEW |