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

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

Issue 2962473002: Make Position::LastPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T14:00:00 Created 3 years, 5 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 | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp » ('j') | 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 } 725 }
726 726
727 template <typename Strategy> 727 template <typename Strategy>
728 PositionTemplate<Strategy> LastEditablePositionBeforePositionInRootAlgorithm( 728 PositionTemplate<Strategy> LastEditablePositionBeforePositionInRootAlgorithm(
729 const PositionTemplate<Strategy>& position, 729 const PositionTemplate<Strategy>& position,
730 Node& highest_root) { 730 Node& highest_root) {
731 DCHECK(!NeedsLayoutTreeUpdate(highest_root)) 731 DCHECK(!NeedsLayoutTreeUpdate(highest_root))
732 << position << ' ' << highest_root; 732 << position << ' ' << highest_root;
733 // When position falls after highestRoot, the result is easy to compute. 733 // When position falls after highestRoot, the result is easy to compute.
734 if (position.CompareTo( 734 if (position.CompareTo(
735 PositionTemplate<Strategy>::LastPositionInNode(&highest_root)) == 1) 735 PositionTemplate<Strategy>::LastPositionInNode(highest_root)) == 1)
736 return PositionTemplate<Strategy>::LastPositionInNode(&highest_root); 736 return PositionTemplate<Strategy>::LastPositionInNode(highest_root);
737 737
738 PositionTemplate<Strategy> editable_position = position; 738 PositionTemplate<Strategy> editable_position = position;
739 739
740 if (position.AnchorNode()->GetTreeScope() != highest_root.GetTreeScope()) { 740 if (position.AnchorNode()->GetTreeScope() != highest_root.GetTreeScope()) {
741 Node* shadow_ancestor = highest_root.GetTreeScope().AncestorInThisScope( 741 Node* shadow_ancestor = highest_root.GetTreeScope().AncestorInThisScope(
742 editable_position.AnchorNode()); 742 editable_position.AnchorNode());
743 if (!shadow_ancestor) 743 if (!shadow_ancestor)
744 return PositionTemplate<Strategy>(); 744 return PositionTemplate<Strategy>();
745 745
746 editable_position = PositionTemplate<Strategy>::FirstPositionInOrBeforeNode( 746 editable_position = PositionTemplate<Strategy>::FirstPositionInOrBeforeNode(
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 return InputType::kDeleteSoftLineBackward; 2179 return InputType::kDeleteSoftLineBackward;
2180 if (granularity == kParagraphBoundary) 2180 if (granularity == kParagraphBoundary)
2181 return InputType::kDeleteHardLineBackward; 2181 return InputType::kDeleteHardLineBackward;
2182 return InputType::kDeleteContentBackward; 2182 return InputType::kDeleteContentBackward;
2183 default: 2183 default:
2184 return InputType::kNone; 2184 return InputType::kNone;
2185 } 2185 }
2186 } 2186 }
2187 2187
2188 } // namespace blink 2188 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditingUtilitiesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698