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

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-20T13:19:29 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleSelection.h ('k') | 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) 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 DCHECK(!needsLayoutTreeUpdate(extent)); 143 DCHECK(!needsLayoutTreeUpdate(extent));
144 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid 144 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid
145 // of callers passing |base.istNull()| but |extent.isNotNull()|. 145 // of callers passing |base.istNull()| but |extent.isNotNull()|.
146 SelectionInFlatTree::Builder builder; 146 SelectionInFlatTree::Builder builder;
147 builder.setBaseAndExtentDeprecated(base, extent) 147 builder.setBaseAndExtentDeprecated(base, extent)
148 .setAffinity(affinity) 148 .setAffinity(affinity)
149 .setIsDirectional(isDirectional); 149 .setIsDirectional(isDirectional);
150 return createVisibleSelection(builder.build()); 150 return createVisibleSelection(builder.build());
151 } 151 }
152 152
153 VisibleSelectionInFlatTree createVisibleSelection(
154 const VisiblePositionInFlatTree& base,
155 const VisiblePositionInFlatTree& extent,
156 bool isDirectional) {
157 DCHECK(base.isValid());
158 DCHECK(extent.isValid());
159 // TODO(xiaochengh): We should check |base.isNotNull() || extent.isNull()|
160 // after all call sites have ensured that.
161 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(),
162 base.affinity(), isDirectional);
163 }
164
165 template <typename Strategy> 153 template <typename Strategy>
166 static SelectionType computeSelectionType( 154 static SelectionType computeSelectionType(
167 const PositionTemplate<Strategy>& start, 155 const PositionTemplate<Strategy>& start,
168 const PositionTemplate<Strategy>& end) { 156 const PositionTemplate<Strategy>& end) {
169 if (start.isNull()) { 157 if (start.isNull()) {
170 DCHECK(end.isNull()); 158 DCHECK(end.isNull());
171 return NoSelection; 159 return NoSelection;
172 } 160 }
173 if (start == end) 161 if (start == end)
174 return CaretSelection; 162 return CaretSelection;
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 921
934 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 922 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
935 sel.showTreeForThis(); 923 sel.showTreeForThis();
936 } 924 }
937 925
938 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 926 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
939 if (sel) 927 if (sel)
940 sel->showTreeForThis(); 928 sel->showTreeForThis();
941 } 929 }
942 #endif 930 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698