| OLD | NEW |
| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 void DOMSelection::removeAllRanges() | 387 void DOMSelection::removeAllRanges() |
| 388 { | 388 { |
| 389 if (!m_frame) | 389 if (!m_frame) |
| 390 return; | 390 return; |
| 391 m_frame->selection().clear(); | 391 m_frame->selection().clear(); |
| 392 } | 392 } |
| 393 | 393 |
| 394 void DOMSelection::addRange(Range* newRange) | 394 void DOMSelection::addRange(Range* newRange) |
| 395 { | 395 { |
| 396 ASSERT(newRange); |
| 397 |
| 396 if (!m_frame) | 398 if (!m_frame) |
| 397 return; | 399 return; |
| 398 | 400 |
| 399 // FIXME: Should we throw DOMException for error cases below? | |
| 400 if (!newRange) { | |
| 401 addConsoleError("The given range is null."); | |
| 402 return; | |
| 403 } | |
| 404 | |
| 405 if (!newRange->inDocument()) { | 401 if (!newRange->inDocument()) { |
| 406 addConsoleError("The given range isn't in document."); | 402 addConsoleError("The given range isn't in document."); |
| 407 return; | 403 return; |
| 408 } | 404 } |
| 409 | 405 |
| 410 FrameSelection& selection = m_frame->selection(); | 406 FrameSelection& selection = m_frame->selection(); |
| 411 | 407 |
| 412 if (selection.isNone()) { | 408 if (selection.isNone()) { |
| 413 selection.setSelectedRange(newRange, VP_DEFAULT_AFFINITY); | 409 selection.setSelectedRange(newRange, VP_DEFAULT_AFFINITY); |
| 414 return; | 410 return; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa
geSource, ErrorMessageLevel, message)); | 562 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa
geSource, ErrorMessageLevel, message)); |
| 567 } | 563 } |
| 568 | 564 |
| 569 DEFINE_TRACE(DOMSelection) | 565 DEFINE_TRACE(DOMSelection) |
| 570 { | 566 { |
| 571 visitor->trace(m_treeScope); | 567 visitor->trace(m_treeScope); |
| 572 DOMWindowProperty::trace(visitor); | 568 DOMWindowProperty::trace(visitor); |
| 573 } | 569 } |
| 574 | 570 |
| 575 } // namespace blink | 571 } // namespace blink |
| OLD | NEW |