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

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

Issue 2432173005: Get rid of VisibleSelection::selectionFromContentsOfNode() (Closed)
Patch Set: 2016-10-20T17:14:18 Created 4 years, 2 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, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 m_affinity = other.m_affinity; 188 m_affinity = other.m_affinity;
189 m_selectionType = other.m_selectionType; 189 m_selectionType = other.m_selectionType;
190 m_baseIsFirst = other.m_baseIsFirst; 190 m_baseIsFirst = other.m_baseIsFirst;
191 m_isDirectional = other.m_isDirectional; 191 m_isDirectional = other.m_isDirectional;
192 m_granularity = other.m_granularity; 192 m_granularity = other.m_granularity;
193 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace; 193 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace;
194 return *this; 194 return *this;
195 } 195 }
196 196
197 template <typename Strategy> 197 template <typename Strategy>
198 VisibleSelectionTemplate<Strategy>
199 VisibleSelectionTemplate<Strategy>::selectionFromContentsOfNode(Node* node) {
200 DCHECK(node);
201 DCHECK(!Strategy::editingIgnoresContent(node));
202 DCHECK(!needsLayoutTreeUpdate(*node));
203
204 typename SelectionTemplate<Strategy>::Builder builder;
205 builder.collapse(PositionTemplate<Strategy>::firstPositionInNode(node))
206 .extend(PositionTemplate<Strategy>::lastPositionInNode(node));
207 return VisibleSelectionTemplate::create(builder.build());
208 }
209
210 template <typename Strategy>
211 void VisibleSelectionTemplate<Strategy>::setBase( 198 void VisibleSelectionTemplate<Strategy>::setBase(
212 const PositionTemplate<Strategy>& position) { 199 const PositionTemplate<Strategy>& position) {
213 DCHECK(!needsLayoutTreeUpdate(position)); 200 DCHECK(!needsLayoutTreeUpdate(position));
214 m_base = position; 201 m_base = position;
215 validate(); 202 validate();
216 } 203 }
217 204
218 template <typename Strategy> 205 template <typename Strategy>
219 void VisibleSelectionTemplate<Strategy>::setBase( 206 void VisibleSelectionTemplate<Strategy>::setBase(
220 const VisiblePositionTemplate<Strategy>& visiblePosition) { 207 const VisiblePositionTemplate<Strategy>& visiblePosition) {
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 902
916 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 903 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
917 sel.showTreeForThis(); 904 sel.showTreeForThis();
918 } 905 }
919 906
920 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 907 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
921 if (sel) 908 if (sel)
922 sel->showTreeForThis(); 909 sel->showTreeForThis();
923 } 910 }
924 #endif 911 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698