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

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

Issue 2950053002: Make Position::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-21T17:56:36 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 PositionIteratorAlgorithm<Strategy>::DeprecatedComputePosition() const { 89 PositionIteratorAlgorithm<Strategy>::DeprecatedComputePosition() const {
90 // TODO(yoichio): Share code to check domTreeVersion with EphemeralRange. 90 // TODO(yoichio): Share code to check domTreeVersion with EphemeralRange.
91 DCHECK(IsValid()); 91 DCHECK(IsValid());
92 if (node_after_position_in_anchor_) { 92 if (node_after_position_in_anchor_) {
93 DCHECK_EQ(Strategy::Parent(*node_after_position_in_anchor_), anchor_node_); 93 DCHECK_EQ(Strategy::Parent(*node_after_position_in_anchor_), anchor_node_);
94 DCHECK_NE(offsets_in_anchor_node_[depth_to_anchor_node_], kInvalidOffset); 94 DCHECK_NE(offsets_in_anchor_node_[depth_to_anchor_node_], kInvalidOffset);
95 // FIXME: This check is inadaquete because any ancestor could be ignored by 95 // FIXME: This check is inadaquete because any ancestor could be ignored by
96 // editing 96 // editing
97 if (EditingIgnoresContent( 97 if (EditingIgnoresContent(
98 *Strategy::Parent(*node_after_position_in_anchor_))) 98 *Strategy::Parent(*node_after_position_in_anchor_)))
99 return PositionTemplate<Strategy>::BeforeNode(anchor_node_); 99 return PositionTemplate<Strategy>::BeforeNode(*anchor_node_);
100 return PositionTemplate<Strategy>( 100 return PositionTemplate<Strategy>(
101 anchor_node_, offsets_in_anchor_node_[depth_to_anchor_node_]); 101 anchor_node_, offsets_in_anchor_node_[depth_to_anchor_node_]);
102 } 102 }
103 if (Strategy::HasChildren(*anchor_node_)) 103 if (Strategy::HasChildren(*anchor_node_))
104 return PositionTemplate<Strategy>::LastPositionInOrAfterNode(anchor_node_); 104 return PositionTemplate<Strategy>::LastPositionInOrAfterNode(anchor_node_);
105 return PositionTemplate<Strategy>::EditingPositionOf(anchor_node_, 105 return PositionTemplate<Strategy>::EditingPositionOf(anchor_node_,
106 offset_in_anchor_); 106 offset_in_anchor_);
107 } 107 }
108 108
109 template <typename Strategy> 109 template <typename Strategy>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return false; 371 return false;
372 return Strategy::HasChildren(*anchor_node_) || 372 return Strategy::HasChildren(*anchor_node_) ||
373 offset_in_anchor_ >= Strategy::LastOffsetForEditing(anchor_node_); 373 offset_in_anchor_ >= Strategy::LastOffsetForEditing(anchor_node_);
374 } 374 }
375 375
376 template class CORE_TEMPLATE_EXPORT PositionIteratorAlgorithm<EditingStrategy>; 376 template class CORE_TEMPLATE_EXPORT PositionIteratorAlgorithm<EditingStrategy>;
377 template class CORE_TEMPLATE_EXPORT 377 template class CORE_TEMPLATE_EXPORT
378 PositionIteratorAlgorithm<EditingInFlatTreeStrategy>; 378 PositionIteratorAlgorithm<EditingInFlatTreeStrategy>;
379 379
380 } // namespace blink 380 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.cpp ('k') | third_party/WebKit/Source/core/editing/PositionIteratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698