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

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

Issue 2786573002: Use EphemeralRange instead of Range in Range::isNodeFullyContainded (Closed)
Patch Set: update Created 3 years, 8 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 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 int comparePositions(const PositionWithAffinity& a, 287 int comparePositions(const PositionWithAffinity& a,
288 const PositionWithAffinity& b) { 288 const PositionWithAffinity& b) {
289 return comparePositions(a.position(), b.position()); 289 return comparePositions(a.position(), b.position());
290 } 290 }
291 291
292 int comparePositions(const VisiblePosition& a, const VisiblePosition& b) { 292 int comparePositions(const VisiblePosition& a, const VisiblePosition& b) {
293 return comparePositions(a.deepEquivalent(), b.deepEquivalent()); 293 return comparePositions(a.deepEquivalent(), b.deepEquivalent());
294 } 294 }
295 295
296 bool isNodeFullyContained(const EphemeralRange& range, Node& node) {
tkent 2017/03/29 09:02:17 The second argument should be |const Node&|.
yoichio 2017/03/29 09:25:40 Yes, but Position has non-const Member<Node>.
tkent 2017/03/29 10:39:51 Oh, I see. Please go ahead landing.
297 if (range.isNull())
298 return false;
299
300 if (!NodeTraversal::commonAncestor(*range.startPosition().anchorNode(), node))
301 return false;
302
303 return range.startPosition() <= Position::beforeNode(&node) &&
304 Position::afterNode(&node) <= range.endPosition();
305 }
306
296 // TODO(editing-dev): We should implement real version which refers 307 // TODO(editing-dev): We should implement real version which refers
297 // "user-select" CSS property. 308 // "user-select" CSS property.
298 // TODO(editing-dev): We should make |SelectionAdjuster| to use this funciton 309 // TODO(editing-dev): We should make |SelectionAdjuster| to use this funciton
299 // instead of |isSelectionBondary()|. 310 // instead of |isSelectionBondary()|.
300 bool isUserSelectContain(const Node& node) { 311 bool isUserSelectContain(const Node& node) {
301 return isHTMLTextAreaElement(node) || isHTMLInputElement(node) || 312 return isHTMLTextAreaElement(node) || isHTMLInputElement(node) ||
302 isHTMLSelectElement(node); 313 isHTMLSelectElement(node);
303 } 314 }
304 315
305 enum EditableLevel { Editable, RichlyEditable }; 316 enum EditableLevel { Editable, RichlyEditable };
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 return InputType::DeleteWordBackward; 2154 return InputType::DeleteWordBackward;
2144 if (granularity == LineBoundary) 2155 if (granularity == LineBoundary)
2145 return InputType::DeleteLineBackward; 2156 return InputType::DeleteLineBackward;
2146 return InputType::DeleteContentBackward; 2157 return InputType::DeleteContentBackward;
2147 default: 2158 default:
2148 return InputType::None; 2159 return InputType::None;
2149 } 2160 }
2150 } 2161 }
2151 2162
2152 } // namespace blink 2163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698