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

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

Issue 2920733002: Rename VisibleSelection::end() to End() (Closed)
Patch Set: 2017-06-01T18:31:38 Created 3 years, 6 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, 2007, 2008, 2009, 2010 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 } // namespace 154 } // namespace
155 155
156 void SelectionAdjuster::AdjustSelectionToAvoidCrossingShadowBoundaries( 156 void SelectionAdjuster::AdjustSelectionToAvoidCrossingShadowBoundaries(
157 VisibleSelection* selection) { 157 VisibleSelection* selection) {
158 // Note: |m_selectionType| isn't computed yet. 158 // Note: |m_selectionType| isn't computed yet.
159 DCHECK(selection->Base().IsNotNull()); 159 DCHECK(selection->Base().IsNotNull());
160 DCHECK(selection->Extent().IsNotNull()); 160 DCHECK(selection->Extent().IsNotNull());
161 DCHECK(selection->Start().IsNotNull()); 161 DCHECK(selection->Start().IsNotNull());
162 DCHECK(selection->end().IsNotNull()); 162 DCHECK(selection->End().IsNotNull());
163 163
164 // TODO(hajimehoshi): Checking treeScope is wrong when a node is 164 // TODO(hajimehoshi): Checking treeScope is wrong when a node is
165 // distributed, but we leave it as it is for backward compatibility. 165 // distributed, but we leave it as it is for backward compatibility.
166 if (selection->Start().AnchorNode()->GetTreeScope() == 166 if (selection->Start().AnchorNode()->GetTreeScope() ==
167 selection->end().AnchorNode()->GetTreeScope()) 167 selection->End().AnchorNode()->GetTreeScope())
168 return; 168 return;
169 169
170 if (selection->IsBaseFirst()) { 170 if (selection->IsBaseFirst()) {
171 const Position& new_end = AdjustPositionForEnd( 171 const Position& new_end = AdjustPositionForEnd(
172 selection->end(), selection->Start().ComputeContainerNode()); 172 selection->End(), selection->Start().ComputeContainerNode());
173 selection->extent_ = new_end; 173 selection->extent_ = new_end;
174 selection->end_ = new_end; 174 selection->end_ = new_end;
175 return; 175 return;
176 } 176 }
177 177
178 const Position& new_start = AdjustPositionForStart( 178 const Position& new_start = AdjustPositionForStart(
179 selection->Start(), selection->end().ComputeContainerNode()); 179 selection->Start(), selection->End().ComputeContainerNode());
180 selection->extent_ = new_start; 180 selection->extent_ = new_start;
181 selection->start_ = new_start; 181 selection->start_ = new_start;
182 } 182 }
183 183
184 // This function is called twice. The first is called when |m_start| and |m_end| 184 // This function is called twice. The first is called when |m_start| and |m_end|
185 // or |m_extent| are same, and the second when |m_start| and |m_end| are changed 185 // or |m_extent| are same, and the second when |m_start| and |m_end| are changed
186 // after downstream/upstream. 186 // after downstream/upstream.
187 void SelectionAdjuster::AdjustSelectionToAvoidCrossingShadowBoundaries( 187 void SelectionAdjuster::AdjustSelectionToAvoidCrossingShadowBoundaries(
188 VisibleSelectionInFlatTree* selection) { 188 VisibleSelectionInFlatTree* selection) {
189 Node* const shadow_host_start = 189 Node* const shadow_host_start =
190 EnclosingShadowHostForStart(selection->Start()); 190 EnclosingShadowHostForStart(selection->Start());
191 Node* const shadow_host_end = EnclosingShadowHostForEnd(selection->end()); 191 Node* const shadow_host_end = EnclosingShadowHostForEnd(selection->End());
192 if (shadow_host_start == shadow_host_end) 192 if (shadow_host_start == shadow_host_end)
193 return; 193 return;
194 194
195 if (selection->IsBaseFirst()) { 195 if (selection->IsBaseFirst()) {
196 Node* const shadow_host = 196 Node* const shadow_host =
197 shadow_host_start ? shadow_host_start : shadow_host_end; 197 shadow_host_start ? shadow_host_start : shadow_host_end;
198 const PositionInFlatTree& new_end = 198 const PositionInFlatTree& new_end =
199 AdjustPositionInFlatTreeForEnd(selection->end(), shadow_host); 199 AdjustPositionInFlatTreeForEnd(selection->End(), shadow_host);
200 selection->extent_ = new_end; 200 selection->extent_ = new_end;
201 selection->end_ = new_end; 201 selection->end_ = new_end;
202 return; 202 return;
203 } 203 }
204 Node* const shadow_host = 204 Node* const shadow_host =
205 shadow_host_end ? shadow_host_end : shadow_host_start; 205 shadow_host_end ? shadow_host_end : shadow_host_start;
206 const PositionInFlatTree& new_start = 206 const PositionInFlatTree& new_start =
207 AdjustPositionInFlatTreeForStart(selection->Start(), shadow_host); 207 AdjustPositionInFlatTreeForStart(selection->Start(), shadow_host);
208 selection->extent_ = new_start; 208 selection->extent_ = new_start;
209 selection->start_ = new_start; 209 selection->start_ = new_start;
210 } 210 }
211 211
212 } // namespace blink 212 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698