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

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

Issue 2326593003: Audit the use of UpdateStyleAndLayoutIgnorePendingStylesheets in FrameSelection::revealSelection (Closed)
Patch Set: Created 4 years, 3 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, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 m_frame->editor().respondToChangedSelection(oldSelectionInDOMTree, options); 329 m_frame->editor().respondToChangedSelection(oldSelectionInDOMTree, options);
330 if (userTriggered == UserTriggered) { 330 if (userTriggered == UserTriggered) {
331 ScrollAlignment alignment; 331 ScrollAlignment alignment;
332 332
333 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d()) 333 if (m_frame->editor().behavior().shouldCenterAlignWhenSelectionIsReveale d())
334 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; 334 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded;
335 else 335 else
336 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; 336 alignment = (align == CursorAlignOnScroll::Always) ? ScrollAlignment ::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded;
337 337
338 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh eets
339 // needs to be audited. See http://crbug.com/590369 for more details.
340 document().updateStyleAndLayoutIgnorePendingStylesheets();
341
338 revealSelection(alignment, RevealExtent); 342 revealSelection(alignment, RevealExtent);
339 } 343 }
340 344
341 notifyAccessibilityForSelectionChange(); 345 notifyAccessibilityForSelectionChange();
342 notifyCompositorForSelectionChange(); 346 notifyCompositorForSelectionChange();
343 notifyEventHandlerForSelectionChange(); 347 notifyEventHandlerForSelectionChange();
344 m_frame->localDOMWindow()->enqueueDocumentEvent(Event::create(EventTypeNames ::selectionchange)); 348 m_frame->localDOMWindow()->enqueueDocumentEvent(Event::create(EventTypeNames ::selectionchange));
345 } 349 }
346 350
347 void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec tionOptions options, CursorAlignOnScroll align, TextGranularity granularity) 351 void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec tionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 return form; 1149 return form;
1146 } 1150 }
1147 1151
1148 // Try walking forward in the node tree to find a form element. 1152 // Try walking forward in the node tree to find a form element.
1149 return scanForForm(start); 1153 return scanForForm(start);
1150 } 1154 }
1151 1155
1152 void FrameSelection::revealSelection(const ScrollAlignment& alignment, RevealExt entOption revealExtentOption) 1156 void FrameSelection::revealSelection(const ScrollAlignment& alignment, RevealExt entOption revealExtentOption)
1153 { 1157 {
1154 DCHECK(isAvailable()); 1158 DCHECK(isAvailable());
1155 1159 DCHECK(!document().needsLayoutTreeUpdate());
1156 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1157 // needs to be audited. See http://crbug.com/590369 for more details.
1158 document().updateStyleAndLayoutIgnorePendingStylesheets();
1159 1160
1160 LayoutRect rect; 1161 LayoutRect rect;
1161 1162
1162 switch (getSelectionType()) { 1163 switch (getSelectionType()) {
1163 case NoSelection: 1164 case NoSelection:
1164 return; 1165 return;
1165 case CaretSelection: 1166 case CaretSelection:
1166 rect = LayoutRect(absoluteCaretBounds()); 1167 rect = LayoutRect(absoluteCaretBounds());
1167 break; 1168 break;
1168 case RangeSelection: 1169 case RangeSelection:
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 1380
1380 void showTree(const blink::FrameSelection* sel) 1381 void showTree(const blink::FrameSelection* sel)
1381 { 1382 {
1382 if (sel) 1383 if (sel)
1383 sel->showTreeForThis(); 1384 sel->showTreeForThis();
1384 else 1385 else
1385 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1386 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1386 } 1387 }
1387 1388
1388 #endif 1389 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698