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

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

Issue 2432173005: Get rid of VisibleSelection::selectionFromContentsOfNode() (Closed)
Patch Set: 2016-10-20T13:46:03 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 m_affinity = other.m_affinity; 200 m_affinity = other.m_affinity;
201 m_selectionType = other.m_selectionType; 201 m_selectionType = other.m_selectionType;
202 m_baseIsFirst = other.m_baseIsFirst; 202 m_baseIsFirst = other.m_baseIsFirst;
203 m_isDirectional = other.m_isDirectional; 203 m_isDirectional = other.m_isDirectional;
204 m_granularity = other.m_granularity; 204 m_granularity = other.m_granularity;
205 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace; 205 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace;
206 return *this; 206 return *this;
207 } 207 }
208 208
209 template <typename Strategy> 209 template <typename Strategy>
210 VisibleSelectionTemplate<Strategy>
211 VisibleSelectionTemplate<Strategy>::selectionFromContentsOfNode(Node* node) {
212 DCHECK(node);
213 DCHECK(!Strategy::editingIgnoresContent(node));
Xiaocheng 2016/10/20 07:51:03 Can we keep this DCHECK in SelectionTemplate::Buil
yosin_UTC9 2016/10/20 08:35:34 Sure but use |Node::canContainRangeEndPoint()| onl
214 DCHECK(!needsLayoutTreeUpdate(*node));
215
216 typename SelectionTemplate<Strategy>::Builder builder;
217 builder.collapse(PositionTemplate<Strategy>::firstPositionInNode(node))
218 .extend(PositionTemplate<Strategy>::lastPositionInNode(node));
219 return VisibleSelectionTemplate::create(builder.build());
220 }
221
222 template <typename Strategy>
223 void VisibleSelectionTemplate<Strategy>::setBase( 210 void VisibleSelectionTemplate<Strategy>::setBase(
224 const PositionTemplate<Strategy>& position) { 211 const PositionTemplate<Strategy>& position) {
225 DCHECK(!needsLayoutTreeUpdate(position)); 212 DCHECK(!needsLayoutTreeUpdate(position));
226 m_base = position; 213 m_base = position;
227 validate(); 214 validate();
228 } 215 }
229 216
230 template <typename Strategy> 217 template <typename Strategy>
231 void VisibleSelectionTemplate<Strategy>::setBase( 218 void VisibleSelectionTemplate<Strategy>::setBase(
232 const VisiblePositionTemplate<Strategy>& visiblePosition) { 219 const VisiblePositionTemplate<Strategy>& visiblePosition) {
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 914
928 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 915 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
929 sel.showTreeForThis(); 916 sel.showTreeForThis();
930 } 917 }
931 918
932 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 919 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
933 if (sel) 920 if (sel)
934 sel->showTreeForThis(); 921 sel->showTreeForThis();
935 } 922 }
936 #endif 923 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698