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

Side by Side Diff: Source/web/WebFrameImpl.cpp

Issue 23703016: [blink] Use functions for AllMarkers and MisspellingMarkers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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) 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 } 1223 }
1224 1224
1225 void WebFrameImpl::replaceMisspelledRange(const WebString& text) 1225 void WebFrameImpl::replaceMisspelledRange(const WebString& text)
1226 { 1226 {
1227 // If this caret selection has two or more markers, this function replace th e range covered by the first marker with the specified word as Microsoft Word do es. 1227 // If this caret selection has two or more markers, this function replace th e range covered by the first marker with the specified word as Microsoft Word do es.
1228 if (pluginContainerFromFrame(frame())) 1228 if (pluginContainerFromFrame(frame()))
1229 return; 1229 return;
1230 RefPtr<Range> caretRange = frame()->selection().toNormalizedRange(); 1230 RefPtr<Range> caretRange = frame()->selection().toNormalizedRange();
1231 if (!caretRange) 1231 if (!caretRange)
1232 return; 1232 return;
1233 Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInR ange(caretRange.get(), DocumentMarker::MisspellingMarkers()); 1233 Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInR ange(caretRange.get(), DocumentMarker::misspellingMarkers());
1234 if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset ()) 1234 if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset ())
1235 return; 1235 return;
1236 RefPtr<Range> markerRange = Range::create(caretRange->ownerDocument(), caret Range->startContainer(), markers[0]->startOffset(), caretRange->endContainer(), markers[0]->endOffset()); 1236 RefPtr<Range> markerRange = Range::create(caretRange->ownerDocument(), caret Range->startContainer(), markers[0]->startOffset(), caretRange->endContainer(), markers[0]->endOffset());
1237 if (!markerRange) 1237 if (!markerRange)
1238 return; 1238 return;
1239 if (!frame()->selection().shouldChangeSelection(markerRange.get())) 1239 if (!frame()->selection().shouldChangeSelection(markerRange.get()))
1240 return; 1240 return;
1241 frame()->selection().setSelection(markerRange.get(), CharacterGranularity); 1241 frame()->selection().setSelection(markerRange.get(), CharacterGranularity);
1242 frame()->editor().replaceSelectionWithText(text, false, false); 1242 frame()->editor().replaceSelectionWithText(text, false, false);
1243 } 1243 }
1244 1244
1245 void WebFrameImpl::removeSpellingMarkers() 1245 void WebFrameImpl::removeSpellingMarkers()
1246 { 1246 {
1247 frame()->document()->markers()->removeMarkers(DocumentMarker::MisspellingMar kers()); 1247 frame()->document()->markers()->removeMarkers(DocumentMarker::misspellingMar kers());
1248 } 1248 }
1249 1249
1250 bool WebFrameImpl::hasSelection() const 1250 bool WebFrameImpl::hasSelection() const
1251 { 1251 {
1252 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame()); 1252 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame());
1253 if (pluginContainer) 1253 if (pluginContainer)
1254 return pluginContainer->plugin()->hasSelection(); 1254 return pluginContainer->plugin()->hasSelection();
1255 1255
1256 // frame()->selection()->isNone() never returns true. 1256 // frame()->selection()->isNone() never returns true.
1257 return frame()->selection().start() != frame()->selection().end(); 1257 return frame()->selection().start() != frame()->selection().end();
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 2464
2465 // There is a possibility that the frame being detached was the only 2465 // There is a possibility that the frame being detached was the only
2466 // pending one. We need to make sure final replies can be sent. 2466 // pending one. We need to make sure final replies can be sent.
2467 flushCurrentScopingEffort(m_findRequestIdentifier); 2467 flushCurrentScopingEffort(m_findRequestIdentifier);
2468 2468
2469 cancelPendingScopingEffort(); 2469 cancelPendingScopingEffort();
2470 } 2470 }
2471 } 2471 }
2472 2472
2473 } // namespace WebKit 2473 } // namespace WebKit
OLDNEW
« Source/core/dom/DocumentMarker.h ('K') | « Source/web/EditorClientImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698