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

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

Issue 1319433002: Make selectMisspellingAsync() to use VisibleSelection::toNormalizedEphemeralRange() instead of toNor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T15:31:59 Created 5 years, 4 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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return isSpaceOrNewline(c) || WTF::Unicode::isPunct(c); 155 return isSpaceOrNewline(c) || WTF::Unicode::isPunct(c);
156 } 156 }
157 157
158 static String selectMisspellingAsync(LocalFrame* selectedFrame, String& descript ion, uint32_t& hash) 158 static String selectMisspellingAsync(LocalFrame* selectedFrame, String& descript ion, uint32_t& hash)
159 { 159 {
160 VisibleSelection selection = selectedFrame->selection().selection(); 160 VisibleSelection selection = selectedFrame->selection().selection();
161 if (!selection.isCaretOrRange()) 161 if (!selection.isCaretOrRange())
162 return String(); 162 return String();
163 163
164 // Caret and range selections always return valid normalized ranges. 164 // Caret and range selections always return valid normalized ranges.
165 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange(); 165 RefPtrWillBeRawPtr<Range> selectionRange = createRange(selection.toNormalize dEphemeralRange());
166 DocumentMarkerVector markers = selectedFrame->document()->markers().markersI nRange(EphemeralRange(selectionRange.get()), DocumentMarker::MisspellingMarkers( )); 166 DocumentMarkerVector markers = selectedFrame->document()->markers().markersI nRange(EphemeralRange(selectionRange.get()), DocumentMarker::MisspellingMarkers( ));
167 if (markers.size() != 1) 167 if (markers.size() != 1)
168 return String(); 168 return String();
169 description = markers[0]->description(); 169 description = markers[0]->description();
170 hash = markers[0]->hash(); 170 hash = markers[0]->hash();
171 171
172 // Cloning a range fails only for invalid ranges. 172 // Cloning a range fails only for invalid ranges.
173 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(); 173 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange();
174 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset ()); 174 markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset ());
175 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); 175 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset());
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 outputItems[i] = subItems[i]; 466 outputItems[i] = subItems[i];
467 subMenuItems.swap(outputItems); 467 subMenuItems.swap(outputItems);
468 } 468 }
469 469
470 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data) 470 void ContextMenuClientImpl::populateCustomMenuItems(const ContextMenu* defaultMe nu, WebContextMenuData* data)
471 { 471 {
472 populateSubMenuItems(defaultMenu->items(), data->customItems); 472 populateSubMenuItems(defaultMenu->items(), data->customItems);
473 } 473 }
474 474
475 } // namespace blink 475 } // 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