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

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: 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
« no previous file with comments | « LayoutTests/editing/selection/skip-non-editable-rtl-expected.txt ('k') | 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, 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 // FIXME: This may need to do something different from "before".
yosin_UTC9 2014/09/29 01:29:03 Q: Can we remove this FIXME by this patch?
Habib Virji 2014/09/29 11:13:43 Done.
284 return honorEditingBoundaryAtOrBefore(left); 284 return directionOfEnclosingBlock(left.deepEquivalent()) == LTR ? honorEditin gBoundaryAtOrBefore(left) : honorEditingBoundaryAtOrAfter(left);
yosin_UTC9 2014/09/29 01:29:03 nit: It is better to use |isLeftToRightDirection(T
Habib Virji 2014/09/29 11:13:43 Done.
285 } 285 }
286 286
287 Position VisiblePosition::rightVisuallyDistinctCandidate() const 287 Position VisiblePosition::rightVisuallyDistinctCandidate() const
288 { 288 {
289 Position p = m_deepPosition; 289 Position p = m_deepPosition;
290 if (p.isNull()) 290 if (p.isNull())
291 return Position(); 291 return Position();
292 292
293 Position downstreamStart = p.downstream(); 293 Position downstreamStart = p.downstream();
294 TextDirection primaryDirection = p.primaryDirection(); 294 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? 441 // FIXME: Why can't we move left from the last position in a tree?
442 if (pos.atStartOfTree() || pos.atEndOfTree()) 442 if (pos.atStartOfTree() || pos.atEndOfTree())
443 return VisiblePosition(); 443 return VisiblePosition();
444 444
445 VisiblePosition right = VisiblePosition(pos, DOWNSTREAM); 445 VisiblePosition right = VisiblePosition(pos, DOWNSTREAM);
446 ASSERT(right != *this); 446 ASSERT(right != *this);
447 447
448 if (!stayInEditableContent) 448 if (!stayInEditableContent)
449 return right; 449 return right;
450 450
451 // FIXME: This may need to do something different from "after". 451 // FIXME: This may need to do something different from "after".
yosin_UTC9 2014/09/29 01:29:03 Q: Can we remove this FIXME by this patch?
Habib Virji 2014/09/29 11:13:43 Done.
452 return honorEditingBoundaryAtOrAfter(right); 452 return directionOfEnclosingBlock(right.deepEquivalent()) == LTR ? honorEditi ngBoundaryAtOrAfter(right) : honorEditingBoundaryAtOrBefore(right);
yosin_UTC9 2014/09/29 01:29:03 nit: It is better to use |isLeftToRightDirection(T
Habib Virji 2014/09/29 11:13:43 Done.
453 } 453 }
454 454
455 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const 455 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const
456 { 456 {
457 if (pos.isNull()) 457 if (pos.isNull())
458 return pos; 458 return pos;
459 459
460 ContainerNode* highestRoot = highestEditableRoot(deepEquivalent()); 460 ContainerNode* highestRoot = highestEditableRoot(deepEquivalent());
461 461
462 // Return empty position if pos is not somewhere inside the editable region containing this position 462 // 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) 788 if (vpos)
789 vpos->showTreeForThis(); 789 vpos->showTreeForThis();
790 } 790 }
791 791
792 void showTree(const blink::VisiblePosition& vpos) 792 void showTree(const blink::VisiblePosition& vpos)
793 { 793 {
794 vpos.showTreeForThis(); 794 vpos.showTreeForThis();
795 } 795 }
796 796
797 #endif 797 #endif
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/skip-non-editable-rtl-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698