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/Editor.cpp

Issue 2144673003: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in SearchBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whoops, let's maybe compile first. Created 4 years, 5 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 DCHECK(frame().document()); 1226 DCHECK(frame().document());
1227 ApplyStyleCommand::create(*frame().document(), blockStyle, editingAction )->apply(); 1227 ApplyStyleCommand::create(*frame().document(), blockStyle, editingAction )->apply();
1228 } 1228 }
1229 1229
1230 // Set the remaining style as the typing style. 1230 // Set the remaining style as the typing style.
1231 frame().selection().setTypingStyle(typingStyle); 1231 frame().selection().setTypingStyle(typingStyle);
1232 } 1232 }
1233 1233
1234 bool Editor::findString(const String& target, FindOptions options) 1234 bool Editor::findString(const String& target, FindOptions options)
1235 { 1235 {
1236 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited.
1237 // see http://crbug.com/590369 for more details.
1238 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
dglazkov 2016/07/13 22:40:11 This can go up one more, to EditorCommand and Loca
1239
1236 VisibleSelection selection = frame().selection().selection(); 1240 VisibleSelection selection = frame().selection().selection();
1237 1241
1238 // TODO(yosin) We should make |findRangeOfString()| to return 1242 // TODO(yosin) We should make |findRangeOfString()| to return
1239 // |EphemeralRange| rather than|Range| object. 1243 // |EphemeralRange| rather than|Range| object.
1240 Range* resultRange = findRangeOfString(target, EphemeralRange(selection.star t(), selection.end()), static_cast<FindOptions>(options | FindAPICall)); 1244 Range* resultRange = findRangeOfString(target, EphemeralRange(selection.star t(), selection.end()), static_cast<FindOptions>(options | FindAPICall));
1241 1245
1242 if (!resultRange) 1246 if (!resultRange)
1243 return false; 1247 return false;
1244 1248
1245 frame().selection().setSelection(VisibleSelection(EphemeralRange(resultRange ))); 1249 frame().selection().setSelection(VisibleSelection(EphemeralRange(resultRange )));
1246 frame().selection().revealSelection(); 1250 frame().selection().revealSelection();
1247 return true; 1251 return true;
1248 } 1252 }
1249 1253
1250 Range* Editor::findStringAndScrollToVisible(const String& target, Range* previou sMatch, FindOptions options) 1254 Range* Editor::findStringAndScrollToVisible(const String& target, Range* previou sMatch, FindOptions options)
1251 { 1255 {
1256 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited.
1257 // see http://crbug.com/590369 for more details.
1258 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
dglazkov 2016/07/13 22:40:10 This can go up one more as well, to WebLocalFrameI
1259
1252 Range* nextMatch = findRangeOfString(target, EphemeralRangeInFlatTree(previo usMatch), options); 1260 Range* nextMatch = findRangeOfString(target, EphemeralRangeInFlatTree(previo usMatch), options);
1253 if (!nextMatch) 1261 if (!nextMatch)
1254 return nullptr; 1262 return nullptr;
1255 1263
1256 Node* firstNode = nextMatch->firstNode(); 1264 Node* firstNode = nextMatch->firstNode();
1257 firstNode->layoutObject()->scrollRectToVisible(LayoutRect(nextMatch->boundin gBox()), 1265 firstNode->layoutObject()->scrollRectToVisible(LayoutRect(nextMatch->boundin gBox()),
1258 ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeed ed, UserScroll); 1266 ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeed ed, UserScroll);
1259 firstNode->document().setSequentialFocusNavigationStartingPoint(firstNode); 1267 firstNode->document().setSequentialFocusNavigationStartingPoint(firstNode);
1260 1268
1261 return nextMatch; 1269 return nextMatch;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 1431
1424 DEFINE_TRACE(Editor) 1432 DEFINE_TRACE(Editor)
1425 { 1433 {
1426 visitor->trace(m_frame); 1434 visitor->trace(m_frame);
1427 visitor->trace(m_lastEditCommand); 1435 visitor->trace(m_lastEditCommand);
1428 visitor->trace(m_undoStack); 1436 visitor->trace(m_undoStack);
1429 visitor->trace(m_mark); 1437 visitor->trace(m_mark);
1430 } 1438 }
1431 1439
1432 } // namespace blink 1440 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698