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

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

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

Powered by Google App Engine
This is Rietveld 408576698