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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 VisiblePosition left() const; | 104 VisiblePosition left() const; |
105 VisiblePosition right() const; | 105 VisiblePosition right() const; |
106 | 106 |
107 UChar32 characterAfter() const; | 107 UChar32 characterAfter() const; |
108 UChar32 characterBefore() const { return previous().characterAfter(); } | 108 UChar32 characterBefore() const { return previous().characterAfter(); } |
109 | 109 |
110 // FIXME: This does not handle [table, 0] correctly. | 110 // FIXME: This does not handle [table, 0] correctly. |
111 Element* rootEditableElement() const { return m_deepPosition.isNotNull() ? m
_deepPosition.anchorNode()->rootEditableElement() : 0; } | 111 Element* rootEditableElement() const { return m_deepPosition.isNotNull() ? m
_deepPosition.anchorNode()->rootEditableElement() : 0; } |
112 | 112 |
113 InlineBoxPosition computeInlineBoxPosition() const | |
114 { | |
115 return m_deepPosition.computeInlineBoxPosition(m_affinity); | |
116 } | |
117 | |
118 // Rect is local to the returned layoutObject | 113 // Rect is local to the returned layoutObject |
119 LayoutRect localCaretRect(LayoutObject*&) const; | 114 LayoutRect localCaretRect(LayoutObject*&) const; |
120 // Bounds of (possibly transformed) caret in absolute coords | 115 // Bounds of (possibly transformed) caret in absolute coords |
121 IntRect absoluteCaretBounds() const; | 116 IntRect absoluteCaretBounds() const; |
122 // Abs x/y position of the caret ignoring transforms. | 117 // Abs x/y position of the caret ignoring transforms. |
123 // FIXME: navigation with transforms should be smarter. | 118 // FIXME: navigation with transforms should be smarter. |
124 int lineDirectionPointForBlockDirectionNavigation() const; | 119 int lineDirectionPointForBlockDirectionNavigation() const; |
125 | 120 |
126 DECLARE_TRACE(); | 121 DECLARE_TRACE(); |
127 | 122 |
128 #ifndef NDEBUG | 123 #ifndef NDEBUG |
129 void debugPosition(const char* msg = "") const; | 124 void debugPosition(const char* msg = "") const; |
130 void formatForDebugger(char* buffer, unsigned length) const; | 125 void formatForDebugger(char* buffer, unsigned length) const; |
131 void showTreeForThis() const; | 126 void showTreeForThis() const; |
132 #endif | 127 #endif |
133 | 128 |
134 private: | 129 private: |
135 template<typename Strategy> | 130 template<typename Strategy> |
136 void init(const PositionAlgorithm<Strategy>&, EAffinity); | 131 void init(const PositionAlgorithm<Strategy>&, EAffinity); |
137 | 132 |
138 Position leftVisuallyDistinctCandidate() const; | 133 Position leftVisuallyDistinctCandidate() const; |
139 Position rightVisuallyDistinctCandidate() const; | 134 Position rightVisuallyDistinctCandidate() const; |
140 | 135 |
141 Position m_deepPosition; | 136 Position m_deepPosition; |
142 EAffinity m_affinity; | 137 EAffinity m_affinity; |
143 }; | 138 }; |
144 | 139 |
| 140 // TODO(yosin) We should move |computeInlineBoxPosition()| to "VisibleUnits.h" |
| 141 // with |Position| version. |
| 142 inline InlineBoxPosition computeInlineBoxPosition(const VisiblePosition& positio
n) |
| 143 { |
| 144 return position.deepEquivalent().computeInlineBoxPosition(position.affinity(
)); |
| 145 } |
| 146 |
145 EphemeralRange makeRange(const VisiblePosition&, const VisiblePosition&); | 147 EphemeralRange makeRange(const VisiblePosition&, const VisiblePosition&); |
146 | 148 |
147 CORE_EXPORT Position canonicalPositionOf(const Position&); | 149 CORE_EXPORT Position canonicalPositionOf(const Position&); |
148 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT
ree&); | 150 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT
ree&); |
149 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity
&, const Position& anchor); | 151 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity
&, const Position& anchor); |
150 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi
onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); | 152 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi
onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); |
151 | 153 |
152 } // namespace blink | 154 } // namespace blink |
153 | 155 |
154 #ifndef NDEBUG | 156 #ifndef NDEBUG |
155 // Outside the WebCore namespace for ease of invocation from gdb. | 157 // Outside the WebCore namespace for ease of invocation from gdb. |
156 void showTree(const blink::VisiblePosition*); | 158 void showTree(const blink::VisiblePosition*); |
157 void showTree(const blink::VisiblePosition&); | 159 void showTree(const blink::VisiblePosition&); |
158 #endif | 160 #endif |
159 | 161 |
160 #endif // VisiblePosition_h | 162 #endif // VisiblePosition_h |
OLD | NEW |