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

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

Issue 1286993006: Introduce isRenderedCharacter(Position) function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:39:43 Created 5 years, 4 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 | « no previous file | Source/core/editing/Position.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, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 bool atStartOfTree() const; 197 bool atStartOfTree() const;
198 bool atEndOfTree() const; 198 bool atEndOfTree() const;
199 199
200 // These return useful visually equivalent positions. 200 // These return useful visually equivalent positions.
201 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const; 201 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const;
202 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const; 202 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const;
203 203
204 bool isCandidate() const; 204 bool isCandidate() const;
205 bool inRenderedText() const; 205 bool inRenderedText() const;
206 bool isRenderedCharacter() const;
207 206
208 InlineBoxPosition computeInlineBoxPosition(EAffinity) const; 207 InlineBoxPosition computeInlineBoxPosition(EAffinity) const;
209 InlineBoxPosition computeInlineBoxPosition(EAffinity, TextDirection primaryD irection) const; 208 InlineBoxPosition computeInlineBoxPosition(EAffinity, TextDirection primaryD irection) const;
210 209
211 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*); 210 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*);
212 static bool nodeIsUserSelectNone(Node*); 211 static bool nodeIsUserSelectNone(Node*);
213 static bool nodeIsUserSelectAll(const Node*); 212 static bool nodeIsUserSelectAll(const Node*);
214 static Node* rootUserSelectAllForNode(Node*); 213 static Node* rootUserSelectAllForNode(Node*);
215 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode); 214 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode);
216 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode); 215 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 int m_offset; 250 int m_offset;
252 PositionAnchorType m_anchorType; 251 PositionAnchorType m_anchorType;
253 }; 252 };
254 253
255 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat egy>; 254 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat egy>;
256 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom posedTreeStrategy>; 255 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom posedTreeStrategy>;
257 256
258 using Position = PositionAlgorithm<EditingStrategy>; 257 using Position = PositionAlgorithm<EditingStrategy>;
259 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>; 258 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>;
260 259
260 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
261 // |VisiblePosition::characterAfter()| and |VisiblePosition::characterBefore()|.
262 // TODO(yosin) We should move |isRenderedCharacter()| to "VisibleUnits.cpp",
263 // since it is used only in "editing/commands/"
264 CORE_EXPORT bool isRenderedCharacter(const Position&);
265
261 template <typename Strategy> 266 template <typename Strategy>
262 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b) 267 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b)
263 { 268 {
264 if (a.isNull()) 269 if (a.isNull())
265 return b.isNull(); 270 return b.isNull();
266 271
267 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType()) 272 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType())
268 return false; 273 return false;
269 274
270 if (!a.isOffsetInAnchor()) { 275 if (!a.isOffsetInAnchor()) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 455
451 } // namespace blink 456 } // namespace blink
452 457
453 #ifndef NDEBUG 458 #ifndef NDEBUG
454 // Outside the WebCore namespace for ease of invocation from gdb. 459 // Outside the WebCore namespace for ease of invocation from gdb.
455 void showTree(const blink::Position&); 460 void showTree(const blink::Position&);
456 void showTree(const blink::Position*); 461 void showTree(const blink::Position*);
457 #endif 462 #endif
458 463
459 #endif // Position_h 464 #endif // Position_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698