| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 return; | 641 return; |
| 642 } | 642 } |
| 643 | 643 |
| 644 // TODO(tkent): "Merge the ranges if they intersect" was removed. We show a | 644 // TODO(tkent): "Merge the ranges if they intersect" was removed. We show a |
| 645 // warning message for a while, and continue to collect the usage data. | 645 // warning message for a while, and continue to collect the usage data. |
| 646 // <https://code.google.com/p/chromium/issues/detail?id=353069>. | 646 // <https://code.google.com/p/chromium/issues/detail?id=353069>. |
| 647 Deprecation::countDeprecation(frame(), | 647 Deprecation::countDeprecation(frame(), |
| 648 UseCounter::SelectionAddRangeIntersect); | 648 UseCounter::SelectionAddRangeIntersect); |
| 649 } | 649 } |
| 650 | 650 |
| 651 // https://www.w3.org/TR/selection-api/#dom-selection-deletefromdocument |
| 651 void DOMSelection::deleteFromDocument() { | 652 void DOMSelection::deleteFromDocument() { |
| 652 if (!isAvailable()) | 653 if (!isAvailable()) |
| 653 return; | 654 return; |
| 654 | 655 |
| 656 // The method must invoke deleteContents() ([DOM4]) on the context object's |
| 657 // range if the context object is not empty. Otherwise the method must do |
| 658 // nothing. |
| 659 if (Range* range = documentCachedRange()) { |
| 660 range->deleteContents(ASSERT_NO_EXCEPTION); |
| 661 return; |
| 662 } |
| 663 |
| 664 // The following code is necessary for |
| 665 // editing/selection/deleteFromDocument-crash.html, which assumes |
| 666 // deleteFromDocument() for text selection in a TEXTAREA deletes the TEXTAREA |
| 667 // value. |
| 668 |
| 655 FrameSelection& selection = frame()->selection(); | 669 FrameSelection& selection = frame()->selection(); |
| 656 | 670 |
| 657 if (selection.isNone()) | 671 if (selection.isNone()) |
| 658 return; | 672 return; |
| 659 | 673 |
| 660 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 674 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 661 // needs to be audited. See http://crbug.com/590369 for more details. | 675 // needs to be audited. See http://crbug.com/590369 for more details. |
| 662 // |VisibleSelection::toNormalizedEphemeralRange| requires clean layout. | 676 // |VisibleSelection::toNormalizedEphemeralRange| requires clean layout. |
| 663 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 677 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 664 | 678 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 m_treeScope->document().addConsoleMessage( | 823 m_treeScope->document().addConsoleMessage( |
| 810 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 824 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
| 811 } | 825 } |
| 812 | 826 |
| 813 DEFINE_TRACE(DOMSelection) { | 827 DEFINE_TRACE(DOMSelection) { |
| 814 visitor->trace(m_treeScope); | 828 visitor->trace(m_treeScope); |
| 815 ContextClient::trace(visitor); | 829 ContextClient::trace(visitor); |
| 816 } | 830 } |
| 817 | 831 |
| 818 } // namespace blink | 832 } // namespace blink |
| OLD | NEW |