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

Side by Side Diff: Source/core/editing/VisiblePosition.h

Issue 1308323004: Introduce absoluteCaretBoundsOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T19:12:35 Rebase 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
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 VisiblePosition right() const; 105 VisiblePosition right() const;
106 106
107 UChar32 characterAfter() const; 107 UChar32 characterAfter() const;
108 UChar32 characterBefore() const; 108 UChar32 characterBefore() const;
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 // Rect is local to the returned layoutObject 113 // Rect is local to the returned layoutObject
114 LayoutRect localCaretRect(LayoutObject*&) const; 114 LayoutRect localCaretRect(LayoutObject*&) const;
115 // Bounds of (possibly transformed) caret in absolute coords
116 IntRect absoluteCaretBounds() const;
117 115
118 DECLARE_TRACE(); 116 DECLARE_TRACE();
119 117
120 #ifndef NDEBUG 118 #ifndef NDEBUG
121 void debugPosition(const char* msg = "") const; 119 void debugPosition(const char* msg = "") const;
122 void formatForDebugger(char* buffer, unsigned length) const; 120 void formatForDebugger(char* buffer, unsigned length) const;
123 void showTreeForThis() const; 121 void showTreeForThis() const;
124 #endif 122 #endif
125 123
126 private: 124 private:
127 template<typename Strategy> 125 template<typename Strategy>
128 void init(const PositionAlgorithm<Strategy>&, TextAffinity); 126 void init(const PositionAlgorithm<Strategy>&, TextAffinity);
129 127
130 Position leftVisuallyDistinctCandidate() const; 128 Position leftVisuallyDistinctCandidate() const;
131 Position rightVisuallyDistinctCandidate() const; 129 Position rightVisuallyDistinctCandidate() const;
132 130
133 Position m_deepPosition; 131 Position m_deepPosition;
134 TextAffinity m_affinity; 132 TextAffinity m_affinity;
135 }; 133 };
136 134
135 // TODO(yosin) We should move |absoluteCaretBoundsOf()| to "VisibleUnits.cpp".
136 // Bounds of (possibly transformed) caret in absolute coords
137 CORE_EXPORT IntRect absoluteCaretBoundsOf(const VisiblePosition&);
138
137 // Abs x/y position of the caret ignoring transforms. 139 // Abs x/y position of the caret ignoring transforms.
138 // TODO(yosin) navigation with transforms should be smarter. 140 // TODO(yosin) navigation with transforms should be smarter.
139 // TODO(yosin) We should move a glboal funciton 141 // TODO(yosin) We should move a glboal funciton
140 // |lineDirectionPointForBlockDirectionNavigationOf()| to "FrameSelection.h" 142 // |lineDirectionPointForBlockDirectionNavigationOf()| to "FrameSelection.h"
141 // as static function. 143 // as static function.
142 int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition&); 144 int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition&);
143 145
144 EphemeralRange makeRange(const VisiblePosition&, const VisiblePosition&); 146 EphemeralRange makeRange(const VisiblePosition&, const VisiblePosition&);
145 147
146 CORE_EXPORT Position canonicalPositionOf(const Position&); 148 CORE_EXPORT Position canonicalPositionOf(const Position&);
147 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT ree&); 149 CORE_EXPORT PositionInComposedTree canonicalPositionOf(const PositionInComposedT ree&);
148 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity &, const Position& anchor); 150 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity &, const Position& anchor);
149 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); 151 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor);
150 152
151 // TODO(yosin) We should move |previousPositionOf()| to "VisibleUnits.cpp" 153 // TODO(yosin) We should move |previousPositionOf()| to "VisibleUnits.cpp"
152 VisiblePosition previousPositionOf(const VisiblePosition&, EditingBoundaryCrossi ngRule = CanCrossEditingBoundary); 154 VisiblePosition previousPositionOf(const VisiblePosition&, EditingBoundaryCrossi ngRule = CanCrossEditingBoundary);
153 155
154 } // namespace blink 156 } // namespace blink
155 157
156 #ifndef NDEBUG 158 #ifndef NDEBUG
157 // Outside the WebCore namespace for ease of invocation from gdb. 159 // Outside the WebCore namespace for ease of invocation from gdb.
158 void showTree(const blink::VisiblePosition*); 160 void showTree(const blink::VisiblePosition*);
159 void showTree(const blink::VisiblePosition&); 161 void showTree(const blink::VisiblePosition&);
160 #endif 162 #endif
161 163
162 #endif // VisiblePosition_h 164 #endif // VisiblePosition_h
OLDNEW
« no previous file with comments | « Source/core/editing/GranularityStrategyTest.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698