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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2414263002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in toNormalizedEphemeralRange (Closed)
Patch Set: fix nit 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 frame()->spellChecker().requestTextChecking( 1104 frame()->spellChecker().requestTextChecking(
1105 *webElement.constUnwrap<Element>()); 1105 *webElement.constUnwrap<Element>());
1106 } 1106 }
1107 1107
1108 void WebLocalFrameImpl::replaceMisspelledRange(const WebString& text) { 1108 void WebLocalFrameImpl::replaceMisspelledRange(const WebString& text) {
1109 // If this caret selection has two or more markers, this function replace the 1109 // If this caret selection has two or more markers, this function replace the
1110 // range covered by the first marker with the specified word as Microsoft Word 1110 // range covered by the first marker with the specified word as Microsoft Word
1111 // does. 1111 // does.
1112 if (pluginContainerFromFrame(frame())) 1112 if (pluginContainerFromFrame(frame()))
1113 return; 1113 return;
1114
1115 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1116 // needs to be audited. see http://crbug.com/590369 for more details.
1117 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1118
1114 frame()->spellChecker().replaceMisspelledRange(text); 1119 frame()->spellChecker().replaceMisspelledRange(text);
1115 } 1120 }
1116 1121
1117 void WebLocalFrameImpl::removeSpellingMarkers() { 1122 void WebLocalFrameImpl::removeSpellingMarkers() {
1118 frame()->spellChecker().removeSpellingMarkers(); 1123 frame()->spellChecker().removeSpellingMarkers();
1119 } 1124 }
1120 1125
1121 bool WebLocalFrameImpl::hasSelection() const { 1126 bool WebLocalFrameImpl::hasSelection() const {
1122 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); 1127 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1123 if (pluginContainer) 1128 if (pluginContainer)
1124 return pluginContainer->plugin()->hasSelection(); 1129 return pluginContainer->plugin()->hasSelection();
1125 1130
1126 // frame()->selection()->isNone() never returns true. 1131 // frame()->selection()->isNone() never returns true.
1127 return frame()->selection().start() != frame()->selection().end(); 1132 return frame()->selection().start() != frame()->selection().end();
1128 } 1133 }
1129 1134
1130 WebRange WebLocalFrameImpl::selectionRange() const { 1135 WebRange WebLocalFrameImpl::selectionRange() const {
1136 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1137 // needs to be audited. See http://crbug.com/590369 for more details.
1138 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1139
1131 return frame()->selection().selection().toNormalizedEphemeralRange(); 1140 return frame()->selection().selection().toNormalizedEphemeralRange();
1132 } 1141 }
1133 1142
1134 WebString WebLocalFrameImpl::selectionAsText() const { 1143 WebString WebLocalFrameImpl::selectionAsText() const {
1135 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); 1144 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1136 if (pluginContainer) 1145 if (pluginContainer)
1137 return pluginContainer->plugin()->selectionAsText(); 1146 return pluginContainer->plugin()->selectionAsText();
1138 1147
1139 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 1148 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1140 // needs to be audited. See http://crbug.com/590369 for more details. 1149 // needs to be audited. See http://crbug.com/590369 for more details.
1141 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 1150 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1142 1151
1143 String text = frame()->selection().selectedText( 1152 String text = frame()->selection().selectedText(
1144 TextIteratorEmitsObjectReplacementCharacter); 1153 TextIteratorEmitsObjectReplacementCharacter);
1145 #if OS(WIN) 1154 #if OS(WIN)
1146 replaceNewlinesWithWindowsStyleNewlines(text); 1155 replaceNewlinesWithWindowsStyleNewlines(text);
1147 #endif 1156 #endif
1148 replaceNBSPWithSpace(text); 1157 replaceNBSPWithSpace(text);
1149 return text; 1158 return text;
1150 } 1159 }
1151 1160
1152 WebString WebLocalFrameImpl::selectionAsMarkup() const { 1161 WebString WebLocalFrameImpl::selectionAsMarkup() const {
1153 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); 1162 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1154 if (pluginContainer) 1163 if (pluginContainer)
1155 return pluginContainer->plugin()->selectionAsMarkup(); 1164 return pluginContainer->plugin()->selectionAsMarkup();
1156 1165
1166 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1167 // needs to be audited. See http://crbug.com/590369 for more details.
1168 // Selection normalization and markup generation require clean layout.
1169 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1170
1157 return frame()->selection().selectedHTMLForClipboard(); 1171 return frame()->selection().selectedHTMLForClipboard();
1158 } 1172 }
1159 1173
1160 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, 1174 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame,
1161 VisiblePosition position) { 1175 VisiblePosition position) {
1162 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundPosition"); 1176 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundPosition");
1163 1177
1164 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 1178 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1165 // needs to be audited. see http://crbug.com/590369 for more details. 1179 // needs to be audited. see http://crbug.com/590369 for more details.
1166 frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 1180 frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; 2372 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
2359 } else if (metric == "wasAlternateProtocolAvailable") { 2373 } else if (metric == "wasAlternateProtocolAvailable") {
2360 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; 2374 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
2361 } else if (metric == "connectionInfo") { 2375 } else if (metric == "connectionInfo") {
2362 feature = UseCounter::ChromeLoadTimesConnectionInfo; 2376 feature = UseCounter::ChromeLoadTimesConnectionInfo;
2363 } 2377 }
2364 UseCounter::count(frame(), feature); 2378 UseCounter::count(frame(), feature);
2365 } 2379 }
2366 2380
2367 } // namespace blink 2381 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp ('k') | third_party/WebKit/Source/web/WebSurroundingText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698