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

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

Issue 1270023002: CANCEL Untemplatize PositionAlgorithm<Strategy>::rendersInDifferentPosition() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-03T14:53:18 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/dom/Position.cpp » ('j') | Source/core/dom/Position.cpp » ('J')
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // - BeforeAnchor 0 136 // - BeforeAnchor 0
137 // - AfterChildren last editing offset in anchor node 137 // - AfterChildren last editing offset in anchor node
138 // - AfterAnchor last editing offset in anchor node 138 // - AfterAnchor last editing offset in anchor node
139 // Editing operations will change in anchor node rather than nodes around 139 // Editing operations will change in anchor node rather than nodes around
140 // anchor node. 140 // anchor node.
141 int computeEditingOffset() const; 141 int computeEditingOffset() const;
142 142
143 // New code should not use this function. 143 // New code should not use this function.
144 int deprecatedEditingOffset() const; 144 int deprecatedEditingOffset() const;
145 145
146 // |deprecatedEditingOffset()| is used only for layout object related
147 // functions, |isRenderedCharacter()|, |inRenderedText()|, and
148 // |rendersInDifferentPosition()|.
149 // New code should not use this function.
150 int deprecatedOffset() const { return m_offset; }
151
146 // These are convenience methods which are smart about whether the position is neighbor anchored or parent anchored 152 // These are convenience methods which are smart about whether the position is neighbor anchored or parent anchored
147 Node* computeNodeBeforePosition() const; 153 Node* computeNodeBeforePosition() const;
148 Node* computeNodeAfterPosition() const; 154 Node* computeNodeAfterPosition() const;
149 155
150 // Returns node as |Range::firstNode()|. This position must be a 156 // Returns node as |Range::firstNode()|. This position must be a
151 // |PositionAnchorType::OffsetInAhcor| to behave as |Range| boundary point. 157 // |PositionAnchorType::OffsetInAhcor| to behave as |Range| boundary point.
152 Node* nodeAsRangeFirstNode() const; 158 Node* nodeAsRangeFirstNode() const;
153 159
154 // Similar to |nodeAsRangeLastNode()|, but returns a node in a range. 160 // Similar to |nodeAsRangeLastNode()|, but returns a node in a range.
155 Node* nodeAsRangeLastNode() const; 161 Node* nodeAsRangeLastNode() const;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 bool atStartOfTree() const; 209 bool atStartOfTree() const;
204 bool atEndOfTree() const; 210 bool atEndOfTree() const;
205 211
206 // These return useful visually equivalent positions. 212 // These return useful visually equivalent positions.
207 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const; 213 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const;
208 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const; 214 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const;
209 215
210 bool isCandidate() const; 216 bool isCandidate() const;
211 bool inRenderedText() const; 217 bool inRenderedText() const;
212 bool isRenderedCharacter() const; 218 bool isRenderedCharacter() const;
213 bool rendersInDifferentPosition(const PositionAlgorithm<Strategy>&) const;
214 219
215 InlineBoxPosition computeInlineBoxPosition(EAffinity) const; 220 InlineBoxPosition computeInlineBoxPosition(EAffinity) const;
216 InlineBoxPosition computeInlineBoxPosition(EAffinity, TextDirection primaryD irection) const; 221 InlineBoxPosition computeInlineBoxPosition(EAffinity, TextDirection primaryD irection) const;
217 222
218 TextDirection primaryDirection() const; 223 TextDirection primaryDirection() const;
219 224
220 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*); 225 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*);
221 static bool nodeIsUserSelectNone(Node*); 226 static bool nodeIsUserSelectNone(Node*);
222 static bool nodeIsUserSelectAll(const Node*); 227 static bool nodeIsUserSelectAll(const Node*);
223 static Node* rootUserSelectAllForNode(Node*); 228 static Node* rootUserSelectAllForNode(Node*);
(...skipping 22 matching lines...) Expand all
246 { 251 {
247 visitor->trace(m_anchorNode); 252 visitor->trace(m_anchorNode);
248 } 253 }
249 254
250 private: 255 private:
251 bool isAfterAnchorOrAfterChildren() const 256 bool isAfterAnchorOrAfterChildren() const
252 { 257 {
253 return isAfterAnchor() || isAfterChildren(); 258 return isAfterAnchor() || isAfterChildren();
254 } 259 }
255 260
256 int renderedOffset() const;
257
258 RefPtrWillBeMember<Node> m_anchorNode; 261 RefPtrWillBeMember<Node> m_anchorNode;
259 // m_offset can be the offset inside m_anchorNode, or if editingIgnoresConte nt(m_anchorNode) 262 // m_offset can be the offset inside m_anchorNode, or if editingIgnoresConte nt(m_anchorNode)
260 // returns true, then other places in editing will treat m_offset == 0 as "b efore the anchor" 263 // returns true, then other places in editing will treat m_offset == 0 as "b efore the anchor"
261 // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalen t for more info. 264 // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalen t for more info.
262 int m_offset; 265 int m_offset;
263 PositionAnchorType m_anchorType; 266 PositionAnchorType m_anchorType;
264 bool m_isLegacyEditingPosition; 267 bool m_isLegacyEditingPosition;
265 }; 268 };
266 269
267 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat egy>; 270 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat egy>;
268 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom posedTreeStrategy>; 271 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom posedTreeStrategy>;
269 272
270 using Position = PositionAlgorithm<EditingStrategy>; 273 using Position = PositionAlgorithm<EditingStrategy>;
271 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>; 274 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>;
272 275
276 bool rendersInDifferentPosition(const Position&, const Position&);
277
273 inline Position createLegacyEditingPosition(PassRefPtrWillBeRawPtr<Node> node, i nt offset) 278 inline Position createLegacyEditingPosition(PassRefPtrWillBeRawPtr<Node> node, i nt offset)
274 { 279 {
275 return Position::createLegacyEditingPosition(node, offset); 280 return Position::createLegacyEditingPosition(node, offset);
276 } 281 }
277 282
278 template <typename Strategy> 283 template <typename Strategy>
279 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b) 284 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b)
280 { 285 {
281 if (a.isNull()) 286 if (a.isNull())
282 return b.isNull(); 287 return b.isNull();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 472
468 } // namespace blink 473 } // namespace blink
469 474
470 #ifndef NDEBUG 475 #ifndef NDEBUG
471 // Outside the WebCore namespace for ease of invocation from gdb. 476 // Outside the WebCore namespace for ease of invocation from gdb.
472 void showTree(const blink::Position&); 477 void showTree(const blink::Position&);
473 void showTree(const blink::Position*); 478 void showTree(const blink::Position*);
474 #endif 479 #endif
475 480
476 #endif // Position_h 481 #endif // Position_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Position.cpp » ('j') | Source/core/dom/Position.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698