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

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

Issue 2341053002: Mark the createVisiblePosition overloads as deprecated (Closed)
Patch Set: minor revision Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (!isAvailable()) 236 if (!isAvailable())
237 return; 237 return;
238 238
239 const VisibleSelection& selection = m_frame->selection().selection(); 239 const VisibleSelection& selection = m_frame->selection().selection();
240 240
241 if (selection.isNone()) { 241 if (selection.isNone()) {
242 exceptionState.throwDOMException(InvalidStateError, "there is no selecti on."); 242 exceptionState.throwDOMException(InvalidStateError, "there is no selecti on.");
243 return; 243 return;
244 } 244 }
245 245
246 m_frame->selection().moveTo(createVisiblePosition(selection.end())); 246 m_frame->selection().moveTo(createVisiblePositionDeprecated(selection.end()) );
yosin_UTC9 2016/09/16 02:01:21 Let's use |FrameSelection::moveTo(const Position&,
247 } 247 }
248 248
249 void DOMSelection::collapseToStart(ExceptionState& exceptionState) 249 void DOMSelection::collapseToStart(ExceptionState& exceptionState)
250 { 250 {
251 if (!isAvailable()) 251 if (!isAvailable())
252 return; 252 return;
253 253
254 const VisibleSelection& selection = m_frame->selection().selection(); 254 const VisibleSelection& selection = m_frame->selection().selection();
255 255
256 if (selection.isNone()) { 256 if (selection.isNone()) {
257 exceptionState.throwDOMException(InvalidStateError, "there is no selecti on."); 257 exceptionState.throwDOMException(InvalidStateError, "there is no selecti on.");
258 return; 258 return;
259 } 259 }
260 260
261 m_frame->selection().moveTo(createVisiblePosition(selection.start())); 261 m_frame->selection().moveTo(createVisiblePositionDeprecated(selection.start( )));
yosin_UTC9 2016/09/16 02:01:21 Let's use |FrameSelection::moveTo(const Position&,
262 } 262 }
263 263
264 void DOMSelection::empty() 264 void DOMSelection::empty()
265 { 265 {
266 if (!isAvailable()) 266 if (!isAvailable())
267 return; 267 return;
268 m_frame->selection().clear(); 268 m_frame->selection().clear();
269 } 269 }
270 270
271 void DOMSelection::setBaseAndExtent(Node* baseNode, int baseOffset, Node* extent Node, int extentOffset, ExceptionState& exceptionState) 271 void DOMSelection::setBaseAndExtent(Node* baseNode, int baseOffset, Node* extent Node, int extentOffset, ExceptionState& exceptionState)
(...skipping 10 matching lines...) Expand all
282 exceptionState.throwDOMException(IndexSizeError, String::number(extentOf fset) + " is not a valid extent offset."); 282 exceptionState.throwDOMException(IndexSizeError, String::number(extentOf fset) + " is not a valid extent offset.");
283 return; 283 return;
284 } 284 }
285 285
286 if (!baseNode || !extentNode) 286 if (!baseNode || !extentNode)
287 UseCounter::count(m_frame, UseCounter::SelectionSetBaseAndExtentNull); 287 UseCounter::count(m_frame, UseCounter::SelectionSetBaseAndExtentNull);
288 288
289 if (!isValidForPosition(baseNode) || !isValidForPosition(extentNode)) 289 if (!isValidForPosition(baseNode) || !isValidForPosition(extentNode))
290 return; 290 return;
291 291
292 VisiblePosition visibleBase = createVisiblePosition(createPosition(baseNode, baseOffset)); 292 VisiblePosition visibleBase = createVisiblePositionDeprecated(createPosition (baseNode, baseOffset));
yosin_UTC9 2016/09/16 02:01:21 Since |VisibleSelection| ctor converts passed |Pos
Xiaocheng 2016/09/16 09:14:00 We will still be updating layout here if we are go
293 VisiblePosition visibleExtent = createVisiblePosition(createPosition(extentN ode, extentOffset)); 293 VisiblePosition visibleExtent = createVisiblePositionDeprecated(createPositi on(extentNode, extentOffset));
294 const bool selectionHasDirection = true; 294 const bool selectionHasDirection = true;
295 m_frame->selection().setSelection(VisibleSelection(visibleBase, visibleExten t, selectionHasDirection)); 295 m_frame->selection().setSelection(VisibleSelection(visibleBase, visibleExten t, selectionHasDirection));
296 } 296 }
297 297
298 void DOMSelection::modify(const String& alterString, const String& directionStri ng, const String& granularityString) 298 void DOMSelection::modify(const String& alterString, const String& directionStri ng, const String& granularityString)
299 { 299 {
300 if (!isAvailable()) 300 if (!isAvailable())
301 return; 301 return;
302 302
303 FrameSelection::EAlteration alter; 303 FrameSelection::EAlteration alter;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 588 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
589 } 589 }
590 590
591 DEFINE_TRACE(DOMSelection) 591 DEFINE_TRACE(DOMSelection)
592 { 592 {
593 visitor->trace(m_treeScope); 593 visitor->trace(m_treeScope);
594 DOMWindowProperty::trace(visitor); 594 DOMWindowProperty::trace(visitor);
595 } 595 }
596 596
597 } // namespace blink 597 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698