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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute(
"getRangeAt", "Selection", String::number(index) + " is not a valid index.")); | 374 es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute(
"getRangeAt", "Selection", String::number(index) + " is not a valid index.")); |
375 return 0; | 375 return 0; |
376 } | 376 } |
377 | 377 |
378 // If you're hitting this, you've added broken multi-range selection support | 378 // If you're hitting this, you've added broken multi-range selection support |
379 ASSERT(rangeCount() == 1); | 379 ASSERT(rangeCount() == 1); |
380 | 380 |
381 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) { | 381 if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) { |
382 ContainerNode* container = shadowAncestor->parentNodeGuaranteedHostFree(
); | 382 ContainerNode* container = shadowAncestor->parentNodeGuaranteedHostFree(
); |
383 int offset = shadowAncestor->nodeIndex(); | 383 int offset = shadowAncestor->nodeIndex(); |
384 return Range::create(&shadowAncestor->document(), container, offset, con
tainer, offset); | 384 return Range::create(shadowAncestor->document(), container, offset, cont
ainer, offset); |
385 } | 385 } |
386 | 386 |
387 const VisibleSelection& selection = m_frame->selection().selection(); | 387 const VisibleSelection& selection = m_frame->selection().selection(); |
388 return selection.firstRange(); | 388 return selection.firstRange(); |
389 } | 389 } |
390 | 390 |
391 void DOMSelection::removeAllRanges() | 391 void DOMSelection::removeAllRanges() |
392 { | 392 { |
393 if (!m_frame) | 393 if (!m_frame) |
394 return; | 394 return; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 bool DOMSelection::isValidForPosition(Node* node) const | 545 bool DOMSelection::isValidForPosition(Node* node) const |
546 { | 546 { |
547 ASSERT(m_frame); | 547 ASSERT(m_frame); |
548 if (!node) | 548 if (!node) |
549 return true; | 549 return true; |
550 return &node->document() == m_frame->document(); | 550 return &node->document() == m_frame->document(); |
551 } | 551 } |
552 | 552 |
553 } // namespace WebCore | 553 } // namespace WebCore |
OLD | NEW |