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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleSelection.cpp

Issue 2953683004: Make Position::AfterNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-22T12:37:16 Created 3 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 // The selection ends in editable content or non-editable content inside a 574 // The selection ends in editable content or non-editable content inside a
575 // different editable ancestor, move backward until non-editable content 575 // different editable ancestor, move backward until non-editable content
576 // inside the same lowest editable ancestor is reached. 576 // inside the same lowest editable ancestor is reached.
577 Element* end_editable_ancestor = 577 Element* end_editable_ancestor =
578 LowestEditableAncestor(end_.ComputeContainerNode()); 578 LowestEditableAncestor(end_.ComputeContainerNode());
579 if (end_root || end_editable_ancestor != base_editable_ancestor) { 579 if (end_root || end_editable_ancestor != base_editable_ancestor) {
580 PositionTemplate<Strategy> p = PreviousVisuallyDistinctCandidate(end_); 580 PositionTemplate<Strategy> p = PreviousVisuallyDistinctCandidate(end_);
581 Element* shadow_ancestor = 581 Element* shadow_ancestor =
582 end_root ? end_root->OwnerShadowHost() : nullptr; 582 end_root ? end_root->OwnerShadowHost() : nullptr;
583 if (p.IsNull() && shadow_ancestor) 583 if (p.IsNull() && shadow_ancestor)
584 p = PositionTemplate<Strategy>::AfterNode(shadow_ancestor); 584 p = PositionTemplate<Strategy>::AfterNode(*shadow_ancestor);
585 while (p.IsNotNull() && 585 while (p.IsNotNull() &&
586 !(LowestEditableAncestor(p.ComputeContainerNode()) == 586 !(LowestEditableAncestor(p.ComputeContainerNode()) ==
587 base_editable_ancestor && 587 base_editable_ancestor &&
588 !IsEditablePosition(p))) { 588 !IsEditablePosition(p))) {
589 Element* root = RootEditableElementOf(p); 589 Element* root = RootEditableElementOf(p);
590 shadow_ancestor = root ? root->OwnerShadowHost() : nullptr; 590 shadow_ancestor = root ? root->OwnerShadowHost() : nullptr;
591 p = IsAtomicNode(p.ComputeContainerNode()) 591 p = IsAtomicNode(p.ComputeContainerNode())
592 ? PositionTemplate<Strategy>::InParentBeforeNode( 592 ? PositionTemplate<Strategy>::InParentBeforeNode(
593 *p.ComputeContainerNode()) 593 *p.ComputeContainerNode())
594 : PreviousVisuallyDistinctCandidate(p); 594 : PreviousVisuallyDistinctCandidate(p);
595 if (p.IsNull() && shadow_ancestor) 595 if (p.IsNull() && shadow_ancestor)
596 p = PositionTemplate<Strategy>::AfterNode(shadow_ancestor); 596 p = PositionTemplate<Strategy>::AfterNode(*shadow_ancestor);
597 } 597 }
598 const VisiblePositionTemplate<Strategy> previous = 598 const VisiblePositionTemplate<Strategy> previous =
599 CreateVisiblePosition(p); 599 CreateVisiblePosition(p);
600 600
601 if (previous.IsNull()) { 601 if (previous.IsNull()) {
602 // The selection crosses an Editing boundary. This is a 602 // The selection crosses an Editing boundary. This is a
603 // programmer error in the editing code. Happy debugging! 603 // programmer error in the editing code. Happy debugging!
604 NOTREACHED(); 604 NOTREACHED();
605 *this = VisibleSelectionTemplate<Strategy>(); 605 *this = VisibleSelectionTemplate<Strategy>();
606 return; 606 return;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 772
773 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 773 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
774 sel.ShowTreeForThis(); 774 sel.ShowTreeForThis();
775 } 775 }
776 776
777 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 777 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
778 if (sel) 778 if (sel)
779 sel->ShowTreeForThis(); 779 sel->ShowTreeForThis();
780 } 780 }
781 #endif 781 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698