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

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

Issue 2395053002: Prune createVisibleSelectionDeprecated from SelectionAdjuster (Closed)
Patch Set: Add TODO about lazy VS validation 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 | « no previous file | 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, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const VisibleSelectionInFlatTree& selectionInFlatTree) { 201 const VisibleSelectionInFlatTree& selectionInFlatTree) {
202 if (selectionInFlatTree.isNone()) { 202 if (selectionInFlatTree.isNone()) {
203 *selection = VisibleSelection(); 203 *selection = VisibleSelection();
204 return; 204 return;
205 } 205 }
206 206
207 const Position& base = toPositionInDOMTree(selectionInFlatTree.base()); 207 const Position& base = toPositionInDOMTree(selectionInFlatTree.base());
208 const Position& extent = toPositionInDOMTree(selectionInFlatTree.extent()); 208 const Position& extent = toPositionInDOMTree(selectionInFlatTree.extent());
209 209
210 if (isCrossingShadowBoundaries(selectionInFlatTree)) { 210 if (isCrossingShadowBoundaries(selectionInFlatTree)) {
211 *selection = createVisibleSelectionDeprecated(base, extent); 211 DCHECK(base.document());
212
213 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
214 // needs to be audited. See http://crbug.com/590369 for more details.
215 // This layout update call cannot be hoisted out of the |if|, otherwise it's
216 // going to cause performance regression (http://crbug.com/652301).
217 // TODO(yosin): Implement and apply lazy visible selection validation so
218 // that we don't need to update layout here.
219 base.document()->updateStyleAndLayoutIgnorePendingStylesheets();
220
221 *selection = createVisibleSelection(base, extent);
212 return; 222 return;
213 } 223 }
214 224
215 const Position& position1 = toPositionInDOMTree(selectionInFlatTree.start()); 225 const Position& position1 = toPositionInDOMTree(selectionInFlatTree.start());
216 const Position& position2 = toPositionInDOMTree(selectionInFlatTree.end()); 226 const Position& position2 = toPositionInDOMTree(selectionInFlatTree.end());
217 selection->m_base = base; 227 selection->m_base = base;
218 selection->m_extent = extent; 228 selection->m_extent = extent;
219 selection->m_affinity = selectionInFlatTree.m_affinity; 229 selection->m_affinity = selectionInFlatTree.m_affinity;
220 selection->m_isDirectional = selectionInFlatTree.m_isDirectional; 230 selection->m_isDirectional = selectionInFlatTree.m_isDirectional;
221 selection->m_granularity = selectionInFlatTree.m_granularity; 231 selection->m_granularity = selectionInFlatTree.m_granularity;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return; 289 return;
280 } 290 }
281 Node* const shadowHost = shadowHostEnd ? shadowHostEnd : shadowHostStart; 291 Node* const shadowHost = shadowHostEnd ? shadowHostEnd : shadowHostStart;
282 const PositionInFlatTree& newStart = 292 const PositionInFlatTree& newStart =
283 adjustPositionInFlatTreeForStart(selection->start(), shadowHost); 293 adjustPositionInFlatTreeForStart(selection->start(), shadowHost);
284 selection->m_extent = newStart; 294 selection->m_extent = newStart;
285 selection->m_start = newStart; 295 selection->m_start = newStart;
286 } 296 }
287 297
288 } // namespace blink 298 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698