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

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

Issue 1315543002: Introduce createRange(const EphemeralRange&) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return false; 236 return false;
237 Position start = m_start.parentAnchoredEquivalent(); 237 Position start = m_start.parentAnchoredEquivalent();
238 Position end = m_end.parentAnchoredEquivalent(); 238 Position end = m_end.parentAnchoredEquivalent();
239 TrackExceptionState exceptionState; 239 TrackExceptionState exceptionState;
240 return Range::intersectsNode(node, start, end, exceptionState) && !exception State.hadException(); 240 return Range::intersectsNode(node, start, end, exceptionState) && !exception State.hadException();
241 } 241 }
242 242
243 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const 243 PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const
244 { 244 {
245 const EphemeralRange range = toNormalizedEphemeralRange(); 245 const EphemeralRange range = toNormalizedEphemeralRange();
246 if (range.isNull()) 246 if (range.isNull())
tkent 2015/08/24 09:38:05 We can remove these two lines.
yosin_UTC9 2015/08/24 13:19:22 Done
247 return nullptr; 247 return nullptr;
248 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); 248 return createRange(range);
249 } 249 }
250 250
251 template <typename Strategy> 251 template <typename Strategy>
252 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR angeTemplate<Strategy>& range) 252 static EphemeralRangeTemplate<Strategy> normalizeRangeAlgorithm(const EphemeralR angeTemplate<Strategy>& range)
253 { 253 {
254 ASSERT(range.isNotNull()); 254 ASSERT(range.isNotNull());
255 range.document().updateLayoutIgnorePendingStylesheets(); 255 range.document().updateLayoutIgnorePendingStylesheets();
256 256
257 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is 257 // TODO(yosin) We should not call |parentAnchoredEquivalent()|, it is
258 // redundant. 258 // redundant.
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 sel.showTreeForThis(); 1252 sel.showTreeForThis();
1253 } 1253 }
1254 1254
1255 void showTree(const blink::VisibleSelection* sel) 1255 void showTree(const blink::VisibleSelection* sel)
1256 { 1256 {
1257 if (sel) 1257 if (sel)
1258 sel->showTreeForThis(); 1258 sel->showTreeForThis();
1259 } 1259 }
1260 1260
1261 #endif 1261 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698