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

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

Issue 602423002: Mixing content editable and non-editable in direction RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per code review comments Created 6 years, 2 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
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // FIXME: Why can't we move left from the last position in a tree? 273 // FIXME: Why can't we move left from the last position in a tree?
274 if (pos.atStartOfTree() || pos.atEndOfTree()) 274 if (pos.atStartOfTree() || pos.atEndOfTree())
275 return VisiblePosition(); 275 return VisiblePosition();
276 276
277 VisiblePosition left = VisiblePosition(pos, DOWNSTREAM); 277 VisiblePosition left = VisiblePosition(pos, DOWNSTREAM);
278 ASSERT(left != *this); 278 ASSERT(left != *this);
279 279
280 if (!stayInEditableContent) 280 if (!stayInEditableContent)
281 return left; 281 return left;
282 282
283 // FIXME: This may need to do something different from "before". 283 return isEnclosingBoxHasLeftToRightDirection(left.deepEquivalent()) ? honorE ditingBoundaryAtOrBefore(left) : honorEditingBoundaryAtOrAfter(left);
leviw_travelin_and_unemployed 2014/10/14 23:04:40 Use the old method and do your bool check here...
Habib Virji 2014/10/16 15:55:09 Done.
284 return honorEditingBoundaryAtOrBefore(left);
285 } 284 }
286 285
287 Position VisiblePosition::rightVisuallyDistinctCandidate() const 286 Position VisiblePosition::rightVisuallyDistinctCandidate() const
288 { 287 {
289 Position p = m_deepPosition; 288 Position p = m_deepPosition;
290 if (p.isNull()) 289 if (p.isNull())
291 return Position(); 290 return Position();
292 291
293 Position downstreamStart = p.downstream(); 292 Position downstreamStart = p.downstream();
294 TextDirection primaryDirection = p.primaryDirection(); 293 TextDirection primaryDirection = p.primaryDirection();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // FIXME: Why can't we move left from the last position in a tree? 440 // FIXME: Why can't we move left from the last position in a tree?
442 if (pos.atStartOfTree() || pos.atEndOfTree()) 441 if (pos.atStartOfTree() || pos.atEndOfTree())
443 return VisiblePosition(); 442 return VisiblePosition();
444 443
445 VisiblePosition right = VisiblePosition(pos, DOWNSTREAM); 444 VisiblePosition right = VisiblePosition(pos, DOWNSTREAM);
446 ASSERT(right != *this); 445 ASSERT(right != *this);
447 446
448 if (!stayInEditableContent) 447 if (!stayInEditableContent)
449 return right; 448 return right;
450 449
451 // FIXME: This may need to do something different from "after". 450 return isEnclosingBoxHasLeftToRightDirection(right.deepEquivalent()) ? honor EditingBoundaryAtOrAfter(right) : honorEditingBoundaryAtOrBefore(right);
452 return honorEditingBoundaryAtOrAfter(right);
453 } 451 }
454 452
455 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const 453 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const
456 { 454 {
457 if (pos.isNull()) 455 if (pos.isNull())
458 return pos; 456 return pos;
459 457
460 ContainerNode* highestRoot = highestEditableRoot(deepEquivalent()); 458 ContainerNode* highestRoot = highestEditableRoot(deepEquivalent());
461 459
462 // Return empty position if pos is not somewhere inside the editable region containing this position 460 // Return empty position if pos is not somewhere inside the editable region containing this position
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 if (vpos) 786 if (vpos)
789 vpos->showTreeForThis(); 787 vpos->showTreeForThis();
790 } 788 }
791 789
792 void showTree(const blink::VisiblePosition& vpos) 790 void showTree(const blink::VisiblePosition& vpos)
793 { 791 {
794 vpos.showTreeForThis(); 792 vpos.showTreeForThis();
795 } 793 }
796 794
797 #endif 795 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698