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

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

Issue 1300493003: Get rid of a redundant argument DOWNSTREAM from PositionWithAffinity constructor call sites (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T11:03:14 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/layout/LayoutBlock.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, DOWNSTREAM);
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()), PositionW ithAffinity(prev.deepEquivalent(), UPSTREAM)));
98 } 98 }
99 #endif 99 #endif
100 100
101 switch (rule) { 101 switch (rule) {
102 case CanCrossEditingBoundary: 102 case CanCrossEditingBoundary:
103 return prev; 103 return prev;
104 case CannotCrossEditingBoundary: 104 case CannotCrossEditingBoundary:
105 return honorEditingBoundaryAtOrBefore(prev); 105 return honorEditingBoundaryAtOrBefore(prev);
106 case CanSkipOverEditingBoundary: 106 case CanSkipOverEditingBoundary:
107 return skipToStartOfEditingBoundary(prev); 107 return skipToStartOfEditingBoundary(prev);
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 if (m_affinity != UPSTREAM) 646 if (m_affinity != UPSTREAM)
647 return; 647 return;
648 648
649 if (isNull()) { 649 if (isNull()) {
650 m_affinity = DOWNSTREAM; 650 m_affinity = DOWNSTREAM;
651 return; 651 return;
652 } 652 }
653 653
654 // When not at a line wrap, make sure to end up with DOWNSTREAM affinity. 654 // When not at a line wrap, make sure to end up with DOWNSTREAM affinity.
655 if (!inSameLine(PositionWithAffinityTemplate<Strategy>(deepPosition, DOWNSTR EAM), PositionWithAffinityTemplate<Strategy>(deepPosition, UPSTREAM))) 655 if (!inSameLine(PositionWithAffinityTemplate<Strategy>(deepPosition), Positi onWithAffinityTemplate<Strategy>(deepPosition, UPSTREAM)))
656 return; 656 return;
657 m_affinity = DOWNSTREAM; 657 m_affinity = DOWNSTREAM;
658 } 658 }
659 659
660 UChar32 VisiblePosition::characterAfter() const 660 UChar32 VisiblePosition::characterAfter() const
661 { 661 {
662 // We canonicalize to the first of two equivalent candidates, but the second 662 // We canonicalize to the first of two equivalent candidates, but the second
663 // of the two candidates is the one that will be inside the text node 663 // of the two candidates is the one that will be inside the text node
664 // containing the character after this visible position. 664 // containing the character after this visible position.
665 Position pos = m_deepPosition.downstream(); 665 Position pos = m_deepPosition.downstream();
(...skipping 99 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 | « no previous file | Source/core/layout/LayoutBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698