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

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

Issue 340713003: Ignore visibility when checking whether Position is editable or not at DeletetSelectionCommand (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
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too. 468 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too.
469 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot) 469 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
470 return pos; 470 return pos;
471 471
472 // Return empty position if this position is non-editable, but pos is editab le 472 // Return empty position if this position is non-editable, but pos is editab le
473 // FIXME: Move to the previous non-editable region. 473 // FIXME: Move to the previous non-editable region.
474 if (!highestRoot) 474 if (!highestRoot)
475 return VisiblePosition(); 475 return VisiblePosition();
476 476
477 // Return the last position before pos that is in the same editable region a s this position 477 // Return the last position before pos that is in the same editable region a s this position
478 return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highes tRoot); 478 return VisiblePosition(lastEditablePositionBeforePositionInRoot(pos.deepEqui valent(), highestRoot));
479 } 479 }
480 480
481 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrAfter(const VisiblePosi tion &pos) const 481 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrAfter(const VisiblePosi tion &pos) const
482 { 482 {
483 if (pos.isNull()) 483 if (pos.isNull())
484 return pos; 484 return pos;
485 485
486 Node* highestRoot = highestEditableRoot(deepEquivalent()); 486 Node* highestRoot = highestEditableRoot(deepEquivalent());
487 487
488 // Return empty position if pos is not somewhere inside the editable region containing this position 488 // Return empty position if pos is not somewhere inside the editable region containing this position
(...skipping 25 matching lines...) Expand all
514 514
515 // Return pos itself if the two are from the very same editable region, or b oth are non-editable. 515 // Return pos itself if the two are from the very same editable region, or b oth are non-editable.
516 if (highestRootOfPos == highestRoot) 516 if (highestRootOfPos == highestRoot)
517 return pos; 517 return pos;
518 518
519 // If |pos| has an editable root, skip to the start 519 // If |pos| has an editable root, skip to the start
520 if (highestRootOfPos) 520 if (highestRootOfPos)
521 return VisiblePosition(previousVisuallyDistinctCandidate(Position(highes tRootOfPos, Position::PositionIsBeforeAnchor).parentAnchoredEquivalent())); 521 return VisiblePosition(previousVisuallyDistinctCandidate(Position(highes tRootOfPos, Position::PositionIsBeforeAnchor).parentAnchoredEquivalent()));
522 522
523 // That must mean that |pos| is not editable. Return the last position befor e pos that is in the same editable region as this position 523 // That must mean that |pos| is not editable. Return the last position befor e pos that is in the same editable region as this position
524 return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highes tRoot); 524 return VisiblePosition(lastEditablePositionBeforePositionInRoot(pos.deepEqui valent(), highestRoot));
525 } 525 }
526 526
527 VisiblePosition VisiblePosition::skipToEndOfEditingBoundary(const VisiblePositio n &pos) const 527 VisiblePosition VisiblePosition::skipToEndOfEditingBoundary(const VisiblePositio n &pos) const
528 { 528 {
529 if (pos.isNull()) 529 if (pos.isNull())
530 return pos; 530 return pos;
531 531
532 Node* highestRoot = highestEditableRoot(deepEquivalent()); 532 Node* highestRoot = highestEditableRoot(deepEquivalent());
533 Node* highestRootOfPos = highestEditableRoot(pos.deepEquivalent()); 533 Node* highestRootOfPos = highestEditableRoot(pos.deepEquivalent());
534 534
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 if (vpos) 804 if (vpos)
805 vpos->showTreeForThis(); 805 vpos->showTreeForThis();
806 } 806 }
807 807
808 void showTree(const WebCore::VisiblePosition& vpos) 808 void showTree(const WebCore::VisiblePosition& vpos)
809 { 809 {
810 vpos.showTreeForThis(); 810 vpos.showTreeForThis();
811 } 811 }
812 812
813 #endif 813 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698