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

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

Issue 1285233004: Get rid of a redundant argument DOWNSTREAM from VisiblePosition constructor call sites (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:36:19 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/SelectionController.cpp ('k') | Source/core/editing/VisibleUnits.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, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 VisiblePosition VisiblePosition::previous(EditingBoundaryCrossingRule rule) cons t 82 VisiblePosition VisiblePosition::previous(EditingBoundaryCrossingRule rule) cons t
83 { 83 {
84 Position pos = previousVisuallyDistinctCandidate(m_deepPosition); 84 Position pos = previousVisuallyDistinctCandidate(m_deepPosition);
85 85
86 // return null visible position if there is no previous visible position 86 // return null visible position if there is no previous visible position
87 if (pos.atStartOfTree()) 87 if (pos.atStartOfTree())
88 return VisiblePosition(); 88 return VisiblePosition();
89 89
90 VisiblePosition prev = VisiblePosition(pos, DOWNSTREAM); 90 VisiblePosition prev = VisiblePosition(pos);
91 ASSERT(prev.deepEquivalent() != m_deepPosition); 91 ASSERT(prev.deepEquivalent() != m_deepPosition);
92 92
93 #if ENABLE(ASSERT) 93 #if ENABLE(ASSERT)
94 // we should always be able to make the affinity DOWNSTREAM, because going p revious from an 94 // we should always be able to make the affinity DOWNSTREAM, because going p revious from an
95 // UPSTREAM position can never yield another UPSTREAM position (unless line wrap length is 0!). 95 // UPSTREAM position can never yield another UPSTREAM position (unless line wrap length is 0!).
96 if (prev.isNotNull() && m_affinity == UPSTREAM) { 96 if (prev.isNotNull() && m_affinity == UPSTREAM) {
97 ASSERT(inSameLine(PositionWithAffinity(prev.deepEquivalent(), DOWNSTREAM ), PositionWithAffinity(prev.deepEquivalent(), UPSTREAM))); 97 ASSERT(inSameLine(PositionWithAffinity(prev.deepEquivalent(), DOWNSTREAM ), PositionWithAffinity(prev.deepEquivalent(), UPSTREAM)));
98 } 98 }
99 #endif 99 #endif
100 100
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 } 258 }
259 259
260 VisiblePosition VisiblePosition::left() const 260 VisiblePosition VisiblePosition::left() const
261 { 261 {
262 Position pos = leftVisuallyDistinctCandidate(); 262 Position pos = leftVisuallyDistinctCandidate();
263 // FIXME: Why can't we move left from the last position in a tree? 263 // FIXME: Why can't we move left from the last position in a tree?
264 if (pos.atStartOfTree() || pos.atEndOfTree()) 264 if (pos.atStartOfTree() || pos.atEndOfTree())
265 return VisiblePosition(); 265 return VisiblePosition();
266 266
267 VisiblePosition left = VisiblePosition(pos, DOWNSTREAM); 267 VisiblePosition left = VisiblePosition(pos);
268 ASSERT(left.deepEquivalent() != m_deepPosition); 268 ASSERT(left.deepEquivalent() != m_deepPosition);
269 269
270 return directionOfEnclosingBlock(left.deepEquivalent()) == LTR ? honorEditin gBoundaryAtOrBefore(left) : honorEditingBoundaryAtOrAfter(left); 270 return directionOfEnclosingBlock(left.deepEquivalent()) == LTR ? honorEditin gBoundaryAtOrBefore(left) : honorEditingBoundaryAtOrAfter(left);
271 } 271 }
272 272
273 Position VisiblePosition::rightVisuallyDistinctCandidate() const 273 Position VisiblePosition::rightVisuallyDistinctCandidate() const
274 { 274 {
275 Position p = m_deepPosition; 275 Position p = m_deepPosition;
276 if (p.isNull()) 276 if (p.isNull())
277 return Position(); 277 return Position();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 419 }
420 } 420 }
421 421
422 VisiblePosition VisiblePosition::right() const 422 VisiblePosition VisiblePosition::right() const
423 { 423 {
424 Position pos = rightVisuallyDistinctCandidate(); 424 Position pos = rightVisuallyDistinctCandidate();
425 // FIXME: Why can't we move left from the last position in a tree? 425 // FIXME: Why can't we move left from the last position in a tree?
426 if (pos.atStartOfTree() || pos.atEndOfTree()) 426 if (pos.atStartOfTree() || pos.atEndOfTree())
427 return VisiblePosition(); 427 return VisiblePosition();
428 428
429 VisiblePosition right = VisiblePosition(pos, DOWNSTREAM); 429 VisiblePosition right = VisiblePosition(pos);
430 ASSERT(right.deepEquivalent() != m_deepPosition); 430 ASSERT(right.deepEquivalent() != m_deepPosition);
431 431
432 return directionOfEnclosingBlock(right.deepEquivalent()) == LTR ? honorEditi ngBoundaryAtOrAfter(right) : honorEditingBoundaryAtOrBefore(right); 432 return directionOfEnclosingBlock(right.deepEquivalent()) == LTR ? honorEditi ngBoundaryAtOrAfter(right) : honorEditingBoundaryAtOrBefore(right);
433 } 433 }
434 434
435 template <typename Strategy> 435 template <typename Strategy>
436 PositionWithAffinityTemplate<Strategy> honorEditingBoundaryAtOrBeforeAlgorithm(c onst PositionWithAffinityTemplate<Strategy>& pos, const PositionAlgorithm<Strate gy>& anchor) 436 PositionWithAffinityTemplate<Strategy> honorEditingBoundaryAtOrBeforeAlgorithm(c onst PositionWithAffinityTemplate<Strategy>& pos, const PositionAlgorithm<Strate gy>& anchor)
437 { 437 {
438 if (pos.isNull()) 438 if (pos.isNull())
439 return pos; 439 return pos;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 else 765 else
766 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); 766 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n");
767 } 767 }
768 768
769 void showTree(const blink::VisiblePosition& vpos) 769 void showTree(const blink::VisiblePosition& vpos)
770 { 770 {
771 vpos.showTreeForThis(); 771 vpos.showTreeForThis();
772 } 772 }
773 773
774 #endif 774 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/SelectionController.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698