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

Side by Side Diff: Source/core/editing/htmlediting.cpp

Issue 342553008: Avoid to use abbreviated names in {first,last}EditableVisiblePosition{After,Before}PositionInRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 | no next file » | 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, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 return Position(); 258 return Position();
259 } 259 }
260 260
261 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position& position, Node* highestRoot) 261 VisiblePosition firstEditableVisiblePositionAfterPositionInRoot(const Position& position, Node* highestRoot)
262 { 262 {
263 // position falls before highestRoot. 263 // position falls before highestRoot.
264 if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 && hi ghestRoot->rendererIsEditable()) 264 if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 && hi ghestRoot->rendererIsEditable())
265 return VisiblePosition(firstPositionInNode(highestRoot)); 265 return VisiblePosition(firstPositionInNode(highestRoot));
266 266
267 Position p = position; 267 Position editablePosition = position;
268 268
269 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { 269 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
270 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.de precatedNode()); 270 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(edit ablePosition.deprecatedNode());
271 if (!shadowAncestor) 271 if (!shadowAncestor)
272 return VisiblePosition(); 272 return VisiblePosition();
273 273
274 p = positionAfterNode(shadowAncestor); 274 editablePosition = positionAfterNode(shadowAncestor);
275 } 275 }
276 276
277 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) 277 while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosi tion) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
278 p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(*p.depr ecatedNode()) : nextVisuallyDistinctCandidate(p); 278 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentAfterNode(*editablePosition.deprecatedNode()) : nextVisuallyDistinc tCandidate(editablePosition);
279 279
280 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) 280 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) )
281 return VisiblePosition(); 281 return VisiblePosition();
282 282
283 return VisiblePosition(p); 283 return VisiblePosition(editablePosition);
284 } 284 }
285 285
286 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position& position, Node* highestRoot) 286 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
287 { 287 {
288 // When position falls after highestRoot, the result is easy to compute. 288 // When position falls after highestRoot, the result is easy to compute.
289 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1) 289 if (comparePositions(position, lastPositionInNode(highestRoot)) == 1)
290 return VisiblePosition(lastPositionInNode(highestRoot)); 290 return VisiblePosition(lastPositionInNode(highestRoot));
291 291
292 Position p = position; 292 Position editablePosition = position;
293 293
294 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { 294 if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
295 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.de precatedNode()); 295 Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(edit ablePosition.deprecatedNode());
296 if (!shadowAncestor) 296 if (!shadowAncestor)
297 return VisiblePosition(); 297 return VisiblePosition();
298 298
299 p = firstPositionInOrBeforeNode(shadowAncestor); 299 editablePosition = firstPositionInOrBeforeNode(shadowAncestor);
300 } 300 }
301 301
302 while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->i sDescendantOf(highestRoot)) 302 while (editablePosition.deprecatedNode() && !isEditablePosition(editablePosi tion) && editablePosition.deprecatedNode()->isDescendantOf(highestRoot))
303 p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(*p.dep recatedNode()) : previousVisuallyDistinctCandidate(p); 303 editablePosition = isAtomicNode(editablePosition.deprecatedNode()) ? pos itionInParentBeforeNode(*editablePosition.deprecatedNode()) : previousVisuallyDi stinctCandidate(editablePosition);
304 304
305 if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecated Node()->isDescendantOf(highestRoot)) 305 if (editablePosition.deprecatedNode() && editablePosition.deprecatedNode() ! = highestRoot && !editablePosition.deprecatedNode()->isDescendantOf(highestRoot) )
306 return VisiblePosition(); 306 return VisiblePosition();
307 307
308 return VisiblePosition(p); 308 return VisiblePosition(editablePosition);
309 } 309 }
310 310
311 // FIXME: The method name, comment, and code say three different things here! 311 // FIXME: The method name, comment, and code say three different things here!
312 // Whether or not content before and after this node will collapse onto the same line as it. 312 // Whether or not content before and after this node will collapse onto the same line as it.
313 bool isBlock(const Node* node) 313 bool isBlock(const Node* node)
314 { 314 {
315 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText(); 315 return node && node->renderer() && !node->renderer()->isInline() && !node->r enderer()->isRubyText();
316 } 316 }
317 317
318 bool isInline(const Node* node) 318 bool isInline(const Node* node)
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // if the selection starts just before a paragraph break, skip over it 1115 // if the selection starts just before a paragraph break, skip over it
1116 if (isEndOfParagraph(visiblePosition)) 1116 if (isEndOfParagraph(visiblePosition))
1117 return visiblePosition.next().deepEquivalent().downstream(); 1117 return visiblePosition.next().deepEquivalent().downstream();
1118 1118
1119 // otherwise, make sure to be at the start of the first selected node, 1119 // otherwise, make sure to be at the start of the first selected node,
1120 // instead of possibly at the end of the last node before the selection 1120 // instead of possibly at the end of the last node before the selection
1121 return visiblePosition.deepEquivalent().downstream(); 1121 return visiblePosition.deepEquivalent().downstream();
1122 } 1122 }
1123 1123
1124 } // namespace WebCore 1124 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698