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

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

Issue 1313883002: Introduce firstRangeOf() as replacement of VisibleSelection::firstRange() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T17:47:14 Created 5 years, 4 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') | Source/core/editing/VisibleSelectionTest.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 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 PositionInComposedTree VisibleSelection::startInComposedTree() const 209 PositionInComposedTree VisibleSelection::startInComposedTree() const
210 { 210 {
211 return m_startInComposedTree; 211 return m_startInComposedTree;
212 } 212 }
213 213
214 PositionInComposedTree VisibleSelection::endInComposedTree() const 214 PositionInComposedTree VisibleSelection::endInComposedTree() const
215 { 215 {
216 return m_endInComposedTree; 216 return m_endInComposedTree;
217 } 217 }
218 218
219 PassRefPtrWillBeRawPtr<Range> VisibleSelection::firstRange() const 219 PassRefPtrWillBeRawPtr<Range> firstRangeOf(const VisibleSelection& selection)
220 { 220 {
221 if (isNone()) 221 if (selection.isNone())
222 return nullptr; 222 return nullptr;
223 Position start = m_start.parentAnchoredEquivalent(); 223 Position start = selection.start().parentAnchoredEquivalent();
224 Position end = m_end.parentAnchoredEquivalent(); 224 Position end = selection.end().parentAnchoredEquivalent();
225 return Range::create(*start.document(), start, end); 225 return Range::create(*start.document(), start, end);
226 } 226 }
227 227
228 bool VisibleSelection::intersectsNode(Node* node) const 228 bool VisibleSelection::intersectsNode(Node* node) const
229 { 229 {
230 if (isNone()) 230 if (isNone())
231 return false; 231 return false;
232 Position start = m_start.parentAnchoredEquivalent(); 232 Position start = m_start.parentAnchoredEquivalent();
233 Position end = m_end.parentAnchoredEquivalent(); 233 Position end = m_end.parentAnchoredEquivalent();
234 TrackExceptionState exceptionState; 234 TrackExceptionState exceptionState;
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 sel.showTreeForThis(); 1244 sel.showTreeForThis();
1245 } 1245 }
1246 1246
1247 void showTree(const blink::VisibleSelection* sel) 1247 void showTree(const blink::VisibleSelection* sel)
1248 { 1248 {
1249 if (sel) 1249 if (sel)
1250 sel->showTreeForThis(); 1250 sel->showTreeForThis();
1251 } 1251 }
1252 1252
1253 #endif 1253 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | Source/core/editing/VisibleSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698