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

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

Issue 1310533002: Move {next,previous}PositionOf() to EditingUtilities.{cpp,h} from Position.{cpp,h} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T09:42:03 Rebase 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 | « Source/core/editing/EditingUtilities.cpp ('k') | 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 27 matching lines...) Expand all
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class Element; 41 class Element;
42 class Node; 42 class Node;
43 class LayoutObject; 43 class LayoutObject;
44 class Text; 44 class Text;
45 enum class TextAffinity; 45 enum class TextAffinity;
46 class TreeScope; 46 class TreeScope;
47 47
48 enum class PositionMoveType {
49 CodePoint, // Move by a single code point.
50 Character, // Move to the next Unicode character break.
51 BackwardDeletion // Subject to platform conventions.
52 };
53
54 enum class PositionAnchorType : unsigned { 48 enum class PositionAnchorType : unsigned {
55 OffsetInAnchor, 49 OffsetInAnchor,
56 BeforeAnchor, 50 BeforeAnchor,
57 AfterAnchor, 51 AfterAnchor,
58 BeforeChildren, 52 BeforeChildren,
59 AfterChildren, 53 AfterChildren,
60 }; 54 };
61 55
62 // Instances of |PositionAlgorithm<Strategy>| are immutable. 56 // Instances of |PositionAlgorithm<Strategy>| are immutable.
63 template <typename Strategy> 57 template <typename Strategy>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 { 383 {
390 return position; 384 return position;
391 } 385 }
392 386
393 template <> 387 template <>
394 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg y>(const Position& position) 388 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg y>(const Position& position)
395 { 389 {
396 return toPositionInComposedTree(position); 390 return toPositionInComposedTree(position);
397 } 391 }
398 392
399 // TODO(yosin) We should move |previousPositionOf()| and |nextPositionOf()|
400 // to "EditingUtilities.h" with |uncheckedPreviousOffset()| and
401 // |uncheckedNextOffset()|.
402 // Move up or down the DOM by one position.
403 // Offsets are computed using layout text for nodes that have layoutObjects -
404 // but note that even when using composed characters, the result may be inside
405 // a single user-visible character if a ligature is formed.
406 CORE_EXPORT Position previousPositionOf(const Position&, PositionMoveType);
407 CORE_EXPORT Position nextPositionOf(const Position&, PositionMoveType);
408 CORE_EXPORT PositionInComposedTree previousPositionOf(const PositionInComposedTr ee&, PositionMoveType);
409 CORE_EXPORT PositionInComposedTree nextPositionOf(const PositionInComposedTree&, PositionMoveType);
410
411 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current);
412 CORE_EXPORT int uncheckedNextOffset(const Node*, int current);
413
414 } // namespace blink 393 } // namespace blink
415 394
416 #ifndef NDEBUG 395 #ifndef NDEBUG
417 // Outside the WebCore namespace for ease of invocation from gdb. 396 // Outside the WebCore namespace for ease of invocation from gdb.
418 void showTree(const blink::Position&); 397 void showTree(const blink::Position&);
419 void showTree(const blink::Position*); 398 void showTree(const blink::Position*);
420 #endif 399 #endif
421 400
422 #endif // Position_h 401 #endif // Position_h
OLDNEW
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | Source/core/editing/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698