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

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

Issue 1316303002: Move a member function intersectsNode() out from VisibleSelection class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-27T17:53:54 Created 5 years, 3 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 | « Source/core/editing/VisibleSelection.h ('k') | no next file » | 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 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection) 224 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection)
225 { 225 {
226 if (selection.isNone()) 226 if (selection.isNone())
227 return nullptr; 227 return nullptr;
228 Position start = selection.start().parentAnchoredEquivalent(); 228 Position start = selection.start().parentAnchoredEquivalent();
229 Position end = selection.end().parentAnchoredEquivalent(); 229 Position end = selection.end().parentAnchoredEquivalent();
230 return Range::create(*start.document(), start, end); 230 return Range::create(*start.document(), start, end);
231 } 231 }
232 232
233 bool VisibleSelection::intersectsNode(Node* node) const 233 // TODO(yosin) We should move |intersectsNode()| to "FrameSelection.cpp".
234 bool intersectsNode(const VisibleSelection& selection, Node* node)
234 { 235 {
235 if (isNone()) 236 if (selection.isNone())
236 return false; 237 return false;
237 Position start = m_start.parentAnchoredEquivalent(); 238 Position start = selection.start().parentAnchoredEquivalent();
238 Position end = m_end.parentAnchoredEquivalent(); 239 Position end = selection.end().parentAnchoredEquivalent();
239 TrackExceptionState exceptionState; 240 TrackExceptionState exceptionState;
241 // TODO(yosin) We should avoid to use |Range::intersectsNode()|.
240 return Range::intersectsNode(node, start, end, exceptionState) && !exception State.hadException(); 242 return Range::intersectsNode(node, start, end, exceptionState) && !exception State.hadException();
241 } 243 }
242 244
243 template <typename Strategy> 245 template <typename Strategy>
244 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR angeTemplate<Strategy>& range) 246 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR angeTemplate<Strategy>& range)
245 { 247 {
246 ASSERT(range.isNotNull()); 248 ASSERT(range.isNotNull());
247 range.document().updateLayoutIgnorePendingStylesheets(); 249 range.document().updateLayoutIgnorePendingStylesheets();
248 250
249 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is 251 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 sel.showTreeForThis(); 1246 sel.showTreeForThis();
1245 } 1247 }
1246 1248
1247 void showTree(const blink::VisibleSelection* sel) 1249 void showTree(const blink::VisibleSelection* sel)
1248 { 1250 {
1249 if (sel) 1251 if (sel)
1250 sel->showTreeForThis(); 1252 sel->showTreeForThis();
1251 } 1253 }
1252 1254
1253 #endif 1255 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698