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

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

Issue 2425623002: Get rid of flat tree version of createVisibleSelection() taking two VisiblePositionInFlatTree (Closed)
Patch Set: 2016-10-18T17:29:55 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 VisibleSelectionInFlatTree createVisibleSelection( 153 VisibleSelectionInFlatTree createVisibleSelection(
154 const VisiblePositionInFlatTree& pos, 154 const VisiblePositionInFlatTree& pos,
155 bool isDirectional) { 155 bool isDirectional) {
156 DCHECK(pos.isValid()); 156 DCHECK(pos.isValid());
157 return createVisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(), 157 return createVisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(),
158 pos.affinity(), isDirectional); 158 pos.affinity(), isDirectional);
159 } 159 }
160 160
161 VisibleSelectionInFlatTree createVisibleSelection( 161 VisibleSelectionInFlatTree createVisibleSelection(
162 const VisiblePositionInFlatTree& base,
163 const VisiblePositionInFlatTree& extent,
164 bool isDirectional) {
165 DCHECK(base.isValid());
166 DCHECK(extent.isValid());
167 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()|
168 // after all call sites have ensured that.
169 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(),
170 base.affinity(), isDirectional);
171 }
172
173 VisibleSelectionInFlatTree createVisibleSelection(
174 const EphemeralRangeInFlatTree& range, 162 const EphemeralRangeInFlatTree& range,
175 TextAffinity affinity, 163 TextAffinity affinity,
176 bool isDirectional) { 164 bool isDirectional) {
177 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); 165 DCHECK(!needsLayoutTreeUpdate(range.startPosition()));
178 DCHECK(!needsLayoutTreeUpdate(range.endPosition())); 166 DCHECK(!needsLayoutTreeUpdate(range.endPosition()));
179 SelectionInFlatTree::Builder builder; 167 SelectionInFlatTree::Builder builder;
180 builder.setBaseAndExtent(range).setAffinity(affinity).setIsDirectional( 168 builder.setBaseAndExtent(range).setAffinity(affinity).setIsDirectional(
181 isDirectional); 169 isDirectional);
182 return createVisibleSelection(builder.build()); 170 return createVisibleSelection(builder.build());
183 } 171 }
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 941
954 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 942 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
955 sel.showTreeForThis(); 943 sel.showTreeForThis();
956 } 944 }
957 945
958 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 946 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
959 if (sel) 947 if (sel)
960 sel->showTreeForThis(); 948 sel->showTreeForThis();
961 } 949 }
962 #endif 950 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698