| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 void DOMSelection::deleteFromDocument() | 440 void DOMSelection::deleteFromDocument() |
| 441 { | 441 { |
| 442 if (!m_frame) | 442 if (!m_frame) |
| 443 return; | 443 return; |
| 444 | 444 |
| 445 FrameSelection& selection = m_frame->selection(); | 445 FrameSelection& selection = m_frame->selection(); |
| 446 | 446 |
| 447 if (selection.isNone()) | 447 if (selection.isNone()) |
| 448 return; | 448 return; |
| 449 | 449 |
| 450 if (isCollapsed()) | |
| 451 selection.modify(FrameSelection::AlterationExtend, DirectionBackward, Ch
aracterGranularity); | |
| 452 | |
| 453 RefPtrWillBeRawPtr<Range> selectedRange = selection.selection().toNormalized
Range(); | 450 RefPtrWillBeRawPtr<Range> selectedRange = selection.selection().toNormalized
Range(); |
| 454 if (!selectedRange) | 451 if (!selectedRange) |
| 455 return; | 452 return; |
| 456 | 453 |
| 457 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); | 454 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); |
| 458 | 455 |
| 459 setBaseAndExtent(selectedRange->startContainer(ASSERT_NO_EXCEPTION), selecte
dRange->startOffset(), selectedRange->startContainer(), selectedRange->startOffs
et(), ASSERT_NO_EXCEPTION); | 456 setBaseAndExtent(selectedRange->startContainer(ASSERT_NO_EXCEPTION), selecte
dRange->startOffset(), selectedRange->startContainer(), selectedRange->startOffs
et(), ASSERT_NO_EXCEPTION); |
| 460 } | 457 } |
| 461 | 458 |
| 462 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const | 459 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 return node->document() == m_frame->document(); | 550 return node->document() == m_frame->document(); |
| 554 } | 551 } |
| 555 | 552 |
| 556 void DOMSelection::addConsoleError(const String& message) | 553 void DOMSelection::addConsoleError(const String& message) |
| 557 { | 554 { |
| 558 if (m_treeScope) | 555 if (m_treeScope) |
| 559 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL
evel, message); | 556 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL
evel, message); |
| 560 } | 557 } |
| 561 | 558 |
| 562 } // namespace WebCore | 559 } // namespace WebCore |
| OLD | NEW |