Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2844983002: Prune ComputeVisibleSelectionInDOMTreeDeprecated from DOMSelection::deleteFromDocument (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698