| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void DOMSelection::extend(const Handle<Node>& node, int offset, ExceptionCode& e
c) | 333 void DOMSelection::extend(const Handle<Node>& node, int offset, ExceptionCode& e
c) |
| 334 { | 334 { |
| 335 if (!m_frame) | 335 if (!m_frame) |
| 336 return; | 336 return; |
| 337 | 337 |
| 338 if (!node) { | 338 if (!node) { |
| 339 ec = TYPE_MISMATCH_ERR; | 339 ec = TYPE_MISMATCH_ERR; |
| 340 return; | 340 return; |
| 341 } | 341 } |
| 342 | 342 |
| 343 if (offset < 0 || offset > (node->offsetInCharacters() ? caretMaxOffset(node
.raw()) : (int)node->childNodeCount())) { | 343 if (offset < 0 || offset > (node->offsetInCharacters() ? caretMaxOffset(node
) : (int)node->childNodeCount())) { |
| 344 ec = INDEX_SIZE_ERR; | 344 ec = INDEX_SIZE_ERR; |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 | 347 |
| 348 if (!isValidForPosition(node)) | 348 if (!isValidForPosition(node)) |
| 349 return; | 349 return; |
| 350 | 350 |
| 351 // FIXME: Eliminate legacy editing positions | 351 // FIXME: Eliminate legacy editing positions |
| 352 m_frame->selection()->setExtent(VisiblePosition(createLegacyEditingPosition(
node, offset), DOWNSTREAM)); | 352 m_frame->selection()->setExtent(VisiblePosition(createLegacyEditingPosition(
node, offset), DOWNSTREAM)); |
| 353 } | 353 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 529 |
| 530 bool DOMSelection::isValidForPosition(const Handle<Node>& node) const | 530 bool DOMSelection::isValidForPosition(const Handle<Node>& node) const |
| 531 { | 531 { |
| 532 ASSERT(m_frame); | 532 ASSERT(m_frame); |
| 533 if (!node) | 533 if (!node) |
| 534 return true; | 534 return true; |
| 535 return node->document() == m_frame->document(); | 535 return node->document() == m_frame->document(); |
| 536 } | 536 } |
| 537 | 537 |
| 538 } // namespace WebCore | 538 } // namespace WebCore |
| OLD | NEW |