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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // needs to be audited. See http://crbug.com/590369 for more details. | 665 // needs to be audited. See http://crbug.com/590369 for more details. |
666 // |VisibleSelection::toNormalizedEphemeralRange| requires clean layout. | 666 // |VisibleSelection::toNormalizedEphemeralRange| requires clean layout. |
667 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 667 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
668 | 668 |
669 Range* selectedRange = | 669 Range* selectedRange = |
670 createRange(selection.computeVisibleSelectionInDOMTreeDeprecated() | 670 createRange(selection.computeVisibleSelectionInDOMTreeDeprecated() |
671 .toNormalizedEphemeralRange()); | 671 .toNormalizedEphemeralRange()); |
672 if (!selectedRange) | 672 if (!selectedRange) |
673 return; | 673 return; |
674 | 674 |
| 675 // |selectedRange| may point nodes in a different root. |
675 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); | 676 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); |
676 | |
677 setBaseAndExtent(selectedRange->startContainer(), | |
678 selectedRange->startOffset(), | |
679 selectedRange->startContainer(), | |
680 selectedRange->startOffset(), ASSERT_NO_EXCEPTION); | |
681 } | 677 } |
682 | 678 |
683 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const { | 679 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const { |
684 DCHECK(n); | 680 DCHECK(n); |
685 | 681 |
686 if (!isAvailable()) | 682 if (!isAvailable()) |
687 return false; | 683 return false; |
688 | 684 |
689 if (frame()->document() != n->document()) | 685 if (frame()->document() != n->document()) |
690 return false; | 686 return false; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 m_treeScope->document().addConsoleMessage( | 809 m_treeScope->document().addConsoleMessage( |
814 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 810 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
815 } | 811 } |
816 | 812 |
817 DEFINE_TRACE(DOMSelection) { | 813 DEFINE_TRACE(DOMSelection) { |
818 visitor->trace(m_treeScope); | 814 visitor->trace(m_treeScope); |
819 ContextClient::trace(visitor); | 815 ContextClient::trace(visitor); |
820 } | 816 } |
821 | 817 |
822 } // namespace blink | 818 } // namespace blink |
OLD | NEW |