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

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

Issue 1878473002: ASSERT -> DCHECK in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (options & FrameSelection::DoNotAdjustInFlatTree) { 95 if (options & FrameSelection::DoNotAdjustInFlatTree) {
96 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(m_select ion.base()), toPositionInFlatTree(m_selection.extent())); 96 m_selectionInFlatTree.setWithoutValidation(toPositionInFlatTree(m_select ion.base()), toPositionInFlatTree(m_selection.extent()));
97 return; 97 return;
98 } 98 }
99 99
100 SelectionAdjuster::adjustSelectionInFlatTree(&m_selectionInFlatTree, m_selec tion); 100 SelectionAdjuster::adjustSelectionInFlatTree(&m_selectionInFlatTree, m_selec tion);
101 } 101 }
102 102
103 void SelectionEditor::setVisibleSelection(const VisibleSelectionInFlatTree& newS election, FrameSelection::SetSelectionOptions options) 103 void SelectionEditor::setVisibleSelection(const VisibleSelectionInFlatTree& newS election, FrameSelection::SetSelectionOptions options)
104 { 104 {
105 ASSERT(!(options & FrameSelection::DoNotAdjustInFlatTree)); 105 DCHECK(!(options & FrameSelection::DoNotAdjustInFlatTree));
106 m_selectionInFlatTree = newSelection; 106 m_selectionInFlatTree = newSelection;
107 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInFlatT ree); 107 SelectionAdjuster::adjustSelectionInDOMTree(&m_selection, m_selectionInFlatT ree);
108 } 108 }
109 109
110 void SelectionEditor::resetXPosForVerticalArrowNavigation() 110 void SelectionEditor::resetXPosForVerticalArrowNavigation()
111 { 111 {
112 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation(); 112 m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation();
113 } 113 }
114 114
115 void SelectionEditor::setIsDirectional(bool isDirectional) 115 void SelectionEditor::setIsDirectional(bool isDirectional)
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 { 861 {
862 Node* selectStartTarget = m_selection.extent().computeContainerNode(); 862 Node* selectStartTarget = m_selection.extent().computeContainerNode();
863 if (!selectStartTarget) 863 if (!selectStartTarget)
864 return DispatchEventResult::NotCanceled; 864 return DispatchEventResult::NotCanceled;
865 865
866 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart)); 866 return selectStartTarget->dispatchEvent(Event::createCancelableBubble(EventT ypeNames::selectstart));
867 } 867 }
868 868
869 void SelectionEditor::didChangeVisibleSelection() 869 void SelectionEditor::didChangeVisibleSelection()
870 { 870 {
871 ASSERT(m_observingVisibleSelection); 871 DCHECK(m_observingVisibleSelection);
872 // Invalidate the logical range when the underlying VisibleSelection has cha nged. 872 // Invalidate the logical range when the underlying VisibleSelection has cha nged.
873 if (m_logicalRange) { 873 if (m_logicalRange) {
874 m_logicalRange->dispose(); 874 m_logicalRange->dispose();
875 m_logicalRange = nullptr; 875 m_logicalRange = nullptr;
876 } 876 }
877 m_selection.clearChangeObserver(); 877 m_selection.clearChangeObserver();
878 m_observingVisibleSelection = false; 878 m_observingVisibleSelection = false;
879 } 879 }
880 880
881 void SelectionEditor::startObservingVisibleSelectionChange() 881 void SelectionEditor::startObservingVisibleSelectionChange()
882 { 882 {
883 ASSERT(!m_observingVisibleSelection); 883 DCHECK(!m_observingVisibleSelection);
884 m_selection.setChangeObserver(*this); 884 m_selection.setChangeObserver(*this);
885 m_observingVisibleSelection = true; 885 m_observingVisibleSelection = true;
886 } 886 }
887 887
888 void SelectionEditor::stopObservingVisibleSelectionChangeIfNecessary() 888 void SelectionEditor::stopObservingVisibleSelectionChangeIfNecessary()
889 { 889 {
890 if (!m_observingVisibleSelection) 890 if (!m_observingVisibleSelection)
891 return; 891 return;
892 m_selection.clearChangeObserver(); 892 m_selection.clearChangeObserver();
893 m_observingVisibleSelection = false; 893 m_observingVisibleSelection = false;
894 } 894 }
895 895
896 void SelectionEditor::updateIfNeeded() 896 void SelectionEditor::updateIfNeeded()
897 { 897 {
898 m_selection.updateIfNeeded(); 898 m_selection.updateIfNeeded();
899 m_selectionInFlatTree.updateIfNeeded(); 899 m_selectionInFlatTree.updateIfNeeded();
900 } 900 }
901 901
902 DEFINE_TRACE(SelectionEditor) 902 DEFINE_TRACE(SelectionEditor)
903 { 903 {
904 visitor->trace(m_frameSelection); 904 visitor->trace(m_frameSelection);
905 visitor->trace(m_selection); 905 visitor->trace(m_selection);
906 visitor->trace(m_selectionInFlatTree); 906 visitor->trace(m_selectionInFlatTree);
907 visitor->trace(m_logicalRange); 907 visitor->trace(m_logicalRange);
908 VisibleSelectionChangeObserver::trace(visitor); 908 VisibleSelectionChangeObserver::trace(visitor);
909 } 909 }
910 910
911 } // namespace blink 911 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698