| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 { | 337 { |
| 338 ASSERT(node); | 338 ASSERT(node); |
| 339 | 339 |
| 340 if (!m_frame) | 340 if (!m_frame) |
| 341 return; | 341 return; |
| 342 | 342 |
| 343 if (offset < 0) { | 343 if (offset < 0) { |
| 344 exceptionState.throwDOMException(IndexSizeError, String::number(offset)
+ " is not a valid offset."); | 344 exceptionState.throwDOMException(IndexSizeError, String::number(offset)
+ " is not a valid offset."); |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 if (static_cast<unsigned>(offset) > (node->offsetInCharacters() ? node->leng
thOfContents() : node->countChildren())) { | 347 if (static_cast<unsigned>(offset) > node->lengthOfContents()) { |
| 348 exceptionState.throwDOMException(IndexSizeError, String::number(offset)
+ " is larger than the given node's length."); | 348 exceptionState.throwDOMException(IndexSizeError, String::number(offset)
+ " is larger than the given node's length."); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 | 351 |
| 352 if (!isValidForPosition(node)) | 352 if (!isValidForPosition(node)) |
| 353 return; | 353 return; |
| 354 | 354 |
| 355 // FIXME: Eliminate legacy editing positions | 355 // FIXME: Eliminate legacy editing positions |
| 356 m_frame->selection().setExtent(VisiblePosition(createLegacyEditingPosition(n
ode, offset), DOWNSTREAM)); | 356 m_frame->selection().setExtent(VisiblePosition(createLegacyEditingPosition(n
ode, offset), DOWNSTREAM)); |
| 357 } | 357 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa
geSource, ErrorMessageLevel, message)); | 560 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa
geSource, ErrorMessageLevel, message)); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void DOMSelection::trace(Visitor* visitor) | 563 void DOMSelection::trace(Visitor* visitor) |
| 564 { | 564 { |
| 565 visitor->trace(m_treeScope); | 565 visitor->trace(m_treeScope); |
| 566 DOMWindowProperty::trace(visitor); | 566 DOMWindowProperty::trace(visitor); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |