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

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

Issue 1498253002: Drop [LegacyInterfaceTypeChecking] for most of Selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests Created 5 years 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 int DOMSelection::rangeCount() const 198 int DOMSelection::rangeCount() const
199 { 199 {
200 if (!m_frame) 200 if (!m_frame)
201 return 0; 201 return 0;
202 return m_frame->selection().isNone() ? 0 : 1; 202 return m_frame->selection().isNone() ? 0 : 1;
203 } 203 }
204 204
205 void DOMSelection::collapse(Node* node, int offset, ExceptionState& exceptionSta te) 205 void DOMSelection::collapse(Node* node, int offset, ExceptionState& exceptionSta te)
206 { 206 {
207 ASSERT(node);
208
207 if (!m_frame) 209 if (!m_frame)
208 return; 210 return;
209 211
210 if (!node) {
211 m_frame->selection().clear();
212 return;
213 }
214
215 if (offset < 0) { 212 if (offset < 0) {
216 exceptionState.throwDOMException(IndexSizeError, String::number(offset) + " is not a valid offset."); 213 exceptionState.throwDOMException(IndexSizeError, String::number(offset) + " is not a valid offset.");
217 return; 214 return;
218 } 215 }
219 216
220 if (!isValidForPosition(node)) 217 if (!isValidForPosition(node))
221 return; 218 return;
222 RefPtrWillBeRawPtr<Range> range = Range::create(node->document()); 219 RefPtrWillBeRawPtr<Range> range = Range::create(node->document());
223 range->setStart(node, offset, exceptionState); 220 range->setStart(node, offset, exceptionState);
224 if (exceptionState.hadException()) 221 if (exceptionState.hadException())
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 563 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
567 } 564 }
568 565
569 DEFINE_TRACE(DOMSelection) 566 DEFINE_TRACE(DOMSelection)
570 { 567 {
571 visitor->trace(m_treeScope); 568 visitor->trace(m_treeScope);
572 DOMWindowProperty::trace(visitor); 569 DOMWindowProperty::trace(visitor);
573 } 570 }
574 571
575 } // namespace blink 572 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698