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

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

Issue 1326563002: Introduce visiblePositionOf() with PositionWithAffinity as replacement of VisiblePosition constructo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T10:55:04 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/SelectionController.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // otherwise it will be converted to DOWNSTREAM. 69 // otherwise it will be converted to DOWNSTREAM.
70 class CORE_EXPORT VisiblePosition final { 70 class CORE_EXPORT VisiblePosition final {
71 DISALLOW_ALLOCATION(); 71 DISALLOW_ALLOCATION();
72 public: 72 public:
73 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { } 73 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { }
74 74
75 // TODO(yosin) We should use |visiblePositionOf()| instead of constructor, 75 // TODO(yosin) We should use |visiblePositionOf()| instead of constructor,
76 // and make constructors to have private accessibility, since constructors 76 // and make constructors to have private accessibility, since constructors
77 // aren't simple, e.g. they update layout tree. 77 // aren't simple, e.g. they update layout tree.
78 explicit VisiblePosition(const Position&, TextAffinity = VP_DEFAULT_AFFINITY ); 78 explicit VisiblePosition(const Position&, TextAffinity = VP_DEFAULT_AFFINITY );
79 explicit VisiblePosition(const PositionWithAffinity&);
80 79
81 // Node: Other than |visiblePositionOf()|, we should not use 80 // Node: Other than |visiblePositionOf()|, we should not use
82 // |createWithoutCanonicalization()|. 81 // |createWithoutCanonicalization()|.
83 static VisiblePosition createWithoutCanonicalization(const PositionWithAffin ity& canonicalized); 82 static VisiblePosition createWithoutCanonicalization(const PositionWithAffin ity& canonicalized);
84 83
85 // Intentionally delete |operator==()| and |operator!=()| for reducing 84 // Intentionally delete |operator==()| and |operator!=()| for reducing
86 // compilation error message. 85 // compilation error message.
87 // TODO(yosin) We'll have |equals()| when we have use cases of checking 86 // TODO(yosin) We'll have |equals()| when we have use cases of checking
88 // equality of both position and affinity. 87 // equality of both position and affinity.
89 bool operator==(const VisiblePosition&) const = delete; 88 bool operator==(const VisiblePosition&) const = delete;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 138
140 // TODO(yosin) We should move |honorEditingBoundaryAtOr{Before,After} to 139 // TODO(yosin) We should move |honorEditingBoundaryAtOr{Before,After} to
141 // "VisibleUnits.cpp" as static function. 140 // "VisibleUnits.cpp" as static function.
142 // next() and previous() will increment/decrement by a character cluster. 141 // next() and previous() will increment/decrement by a character cluster.
143 VisiblePosition honorEditingBoundaryAtOrBefore(const VisiblePosition&, const Pos ition& anchor); 142 VisiblePosition honorEditingBoundaryAtOrBefore(const VisiblePosition&, const Pos ition& anchor);
144 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity &, const Position& anchor); 143 PositionWithAffinity honorEditingBoundaryAtOrBeforeOf(const PositionWithAffinity &, const Position& anchor);
145 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor); 144 PositionInComposedTreeWithAffinity honorEditingBoundaryAtOrBeforeOf(const Positi onInComposedTreeWithAffinity&, const PositionInComposedTree& anchor);
146 VisiblePosition honorEditingBoundaryAtOrAfter(const VisiblePosition&, const Posi tion& anchor); 145 VisiblePosition honorEditingBoundaryAtOrAfter(const VisiblePosition&, const Posi tion& anchor);
147 146
148 CORE_EXPORT VisiblePosition visiblePositionOf(const Position&, TextAffinity = VP _DEFAULT_AFFINITY); 147 CORE_EXPORT VisiblePosition visiblePositionOf(const Position&, TextAffinity = VP _DEFAULT_AFFINITY);
148 CORE_EXPORT VisiblePosition visiblePositionOf(const PositionWithAffinity&);
149 CORE_EXPORT VisiblePosition visiblePositionOf(const PositionInComposedTree&, Tex tAffinity = VP_DEFAULT_AFFINITY); 149 CORE_EXPORT VisiblePosition visiblePositionOf(const PositionInComposedTree&, Tex tAffinity = VP_DEFAULT_AFFINITY);
150 150
151 } // namespace blink 151 } // namespace blink
152 152
153 #ifndef NDEBUG 153 #ifndef NDEBUG
154 // Outside the WebCore namespace for ease of invocation from gdb. 154 // Outside the WebCore namespace for ease of invocation from gdb.
155 void showTree(const blink::VisiblePosition*); 155 void showTree(const blink::VisiblePosition*);
156 void showTree(const blink::VisiblePosition&); 156 void showTree(const blink::VisiblePosition&);
157 #endif 157 #endif
158 158
159 #endif // VisiblePosition_h 159 #endif // VisiblePosition_h
OLDNEW
« no previous file with comments | « Source/core/editing/SelectionController.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698