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

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

Issue 24278008: [oilpan] Handlify Nodes in htmlediting (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 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 | Annotate | Revision Log
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 // FIXME: This may need to do something different from "after". 436 // FIXME: This may need to do something different from "after".
437 return honorEditingBoundaryAtOrAfter(right); 437 return honorEditingBoundaryAtOrAfter(right);
438 } 438 }
439 439
440 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const 440 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePos ition &pos) const
441 { 441 {
442 if (pos.isNull()) 442 if (pos.isNull())
443 return pos; 443 return pos;
444 444
445 Node* highestRoot = highestEditableRoot(deepEquivalent()); 445 Handle<Node> highestRoot = highestEditableRoot(deepEquivalent());
446 446
447 // Return empty position if pos is not somewhere inside the editable region containing this position 447 // Return empty position if pos is not somewhere inside the editable region containing this position
448 if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(hi ghestRoot)) 448 if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(hi ghestRoot.raw()))
449 return VisiblePosition(); 449 return VisiblePosition();
450 450
451 // Return pos itself if the two are from the very same editable region, or b oth are non-editable 451 // Return pos itself if the two are from the very same editable region, or b oth are non-editable
452 // FIXME: In the non-editable case, just because the new position is non-edi table doesn't mean movement 452 // FIXME: In the non-editable case, just because the new position is non-edi table doesn't mean movement
453 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too. 453 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too.
454 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot) 454 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
455 return pos; 455 return pos;
456 456
457 // Return empty position if this position is non-editable, but pos is editab le 457 // Return empty position if this position is non-editable, but pos is editab le
458 // FIXME: Move to the previous non-editable region. 458 // FIXME: Move to the previous non-editable region.
459 if (!highestRoot) 459 if (!highestRoot)
460 return VisiblePosition(); 460 return VisiblePosition();
461 461
462 // Return the last position before pos that is in the same editable region a s this position 462 // Return the last position before pos that is in the same editable region a s this position
463 return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highes tRoot); 463 return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highes tRoot);
464 } 464 }
465 465
466 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrAfter(const VisiblePosi tion &pos) const 466 VisiblePosition VisiblePosition::honorEditingBoundaryAtOrAfter(const VisiblePosi tion &pos) const
467 { 467 {
468 if (pos.isNull()) 468 if (pos.isNull())
469 return pos; 469 return pos;
470 470
471 Node* highestRoot = highestEditableRoot(deepEquivalent()); 471 Handle<Node> highestRoot = highestEditableRoot(deepEquivalent());
472 472
473 // Return empty position if pos is not somewhere inside the editable region containing this position 473 // Return empty position if pos is not somewhere inside the editable region containing this position
474 if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(hi ghestRoot)) 474 if (highestRoot && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(hi ghestRoot.raw()))
475 return VisiblePosition(); 475 return VisiblePosition();
476 476
477 // Return pos itself if the two are from the very same editable region, or b oth are non-editable 477 // Return pos itself if the two are from the very same editable region, or b oth are non-editable
478 // FIXME: In the non-editable case, just because the new position is non-edi table doesn't mean movement 478 // FIXME: In the non-editable case, just because the new position is non-edi table doesn't mean movement
479 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too. 479 // to it is allowed. VisibleSelection::adjustForEditableContent has this pr oblem too.
480 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot) 480 if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
481 return pos; 481 return pos;
482 482
483 // Return empty position if this position is non-editable, but pos is editab le 483 // Return empty position if this position is non-editable, but pos is editab le
484 // FIXME: Move to the next non-editable region. 484 // FIXME: Move to the next non-editable region.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 if (vpos) 752 if (vpos)
753 vpos->showTreeForThis(); 753 vpos->showTreeForThis();
754 } 754 }
755 755
756 void showTree(const WebCore::VisiblePosition& vpos) 756 void showTree(const WebCore::VisiblePosition& vpos)
757 { 757 {
758 vpos.showTreeForThis(); 758 vpos.showTreeForThis();
759 } 759 }
760 760
761 #endif 761 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698