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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 return; | 664 return; |
665 | 665 |
666 // The method must invoke deleteContents() ([DOM4]) on the context object's | 666 // The method must invoke deleteContents() ([DOM4]) on the context object's |
667 // range if the context object is not empty. Otherwise the method must do | 667 // range if the context object is not empty. Otherwise the method must do |
668 // nothing. | 668 // nothing. |
669 if (Range* range = DocumentCachedRange()) { | 669 if (Range* range = DocumentCachedRange()) { |
670 range->deleteContents(ASSERT_NO_EXCEPTION); | 670 range->deleteContents(ASSERT_NO_EXCEPTION); |
671 return; | 671 return; |
672 } | 672 } |
673 | 673 |
| 674 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 675 // needs to be audited. See http://crbug.com/590369 for more details. |
| 676 GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 677 |
674 // The following code is necessary for | 678 // The following code is necessary for |
675 // editing/selection/deleteFromDocument-crash.html, which assumes | 679 // editing/selection/deleteFromDocument-crash.html, which assumes |
676 // deleteFromDocument() for text selection in a TEXTAREA deletes the TEXTAREA | 680 // deleteFromDocument() for text selection in a TEXTAREA deletes the TEXTAREA |
677 // value. | 681 // value. |
678 | 682 |
679 FrameSelection& selection = GetFrame()->Selection(); | 683 FrameSelection& selection = GetFrame()->Selection(); |
680 | 684 |
681 if (selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsNone()) | 685 if (selection.ComputeVisibleSelectionInDOMTree().IsNone()) |
682 return; | 686 return; |
683 | 687 |
684 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets | |
685 // needs to be audited. See http://crbug.com/590369 for more details. | |
686 // |VisibleSelection::toNormalizedEphemeralRange| requires clean layout. | |
687 GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); | |
688 | |
689 Range* selected_range = | 688 Range* selected_range = |
690 CreateRange(selection.ComputeVisibleSelectionInDOMTreeDeprecated() | 689 CreateRange(selection.ComputeVisibleSelectionInDOMTree() |
691 .ToNormalizedEphemeralRange()); | 690 .ToNormalizedEphemeralRange()); |
692 if (!selected_range) | 691 if (!selected_range) |
693 return; | 692 return; |
694 | 693 |
695 // |selectedRange| may point nodes in a different root. | 694 // |selectedRange| may point nodes in a different root. |
696 selected_range->deleteContents(ASSERT_NO_EXCEPTION); | 695 selected_range->deleteContents(ASSERT_NO_EXCEPTION); |
697 } | 696 } |
698 | 697 |
699 bool DOMSelection::containsNode(const Node* n, bool allow_partial) const { | 698 bool DOMSelection::containsNode(const Node* n, bool allow_partial) const { |
700 DCHECK(n); | 699 DCHECK(n); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 tree_scope_->GetDocument().AddConsoleMessage( | 829 tree_scope_->GetDocument().AddConsoleMessage( |
831 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); | 830 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); |
832 } | 831 } |
833 | 832 |
834 DEFINE_TRACE(DOMSelection) { | 833 DEFINE_TRACE(DOMSelection) { |
835 visitor->Trace(tree_scope_); | 834 visitor->Trace(tree_scope_); |
836 ContextClient::Trace(visitor); | 835 ContextClient::Trace(visitor); |
837 } | 836 } |
838 | 837 |
839 } // namespace blink | 838 } // namespace blink |
OLD | NEW |