Chromium Code Reviews

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

Issue 1329253002: WIP: prefer using EphemeralRange for SpellChecker. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use ScopedDisposal<T> Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 209 matching lines...)
220 { 220 {
221 return m_endInComposedTree; 221 return m_endInComposedTree;
222 } 222 }
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);
yosin_UTC9 2015/09/10 06:37:03 Please change to use |firstEphemeralRangeOf()|. We
231 } 231 }
232 232
233 EphemeralRange firstEphemeralRangeOf(const VisibleSelection& selection)
234 {
235 if (selection.isNone())
236 return EphemeralRange();
237 Position start = selection.start().parentAnchoredEquivalent();
yosin_UTC9 2015/09/10 06:37:03 nit: |const Position|.
238 Position end = selection.end().parentAnchoredEquivalent();
yosin_UTC9 2015/09/10 06:37:04 nit: |const Position|.
239 return EphemeralRange(start, end);
240 }
241
233 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const 242 EphemeralRange VisibleSelection::toNormalizedEphemeralRange() const
234 { 243 {
235 if (isNone()) 244 if (isNone())
236 return EphemeralRange(); 245 return EphemeralRange();
237 246
238 // Make sure we have an updated layout since this function is called 247 // Make sure we have an updated layout since this function is called
239 // in the course of running edit commands which modify the DOM. 248 // in the course of running edit commands which modify the DOM.
240 // Failing to call this can result in equivalentXXXPosition calls returning 249 // Failing to call this can result in equivalentXXXPosition calls returning
241 // incorrect results. 250 // incorrect results.
242 m_start.document()->updateLayout(); 251 m_start.document()->updateLayout();
(...skipping 977 matching lines...)
1220 sel.showTreeForThis(); 1229 sel.showTreeForThis();
1221 } 1230 }
1222 1231
1223 void showTree(const blink::VisibleSelection* sel) 1232 void showTree(const blink::VisibleSelection* sel)
1224 { 1233 {
1225 if (sel) 1234 if (sel)
1226 sel->showTreeForThis(); 1235 sel->showTreeForThis();
1227 } 1236 }
1228 1237
1229 #endif 1238 #endif
OLDNEW

Powered by Google App Engine