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

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

Issue 181693003: Have Document::markers() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/web/SpellCheckerClientImpl.cpp » ('j') | 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 static String selectMisspellingAsync(LocalFrame* selectedFrame, DocumentMarker& marker) 153 static String selectMisspellingAsync(LocalFrame* selectedFrame, DocumentMarker& marker)
154 { 154 {
155 VisibleSelection selection = selectedFrame->selection().selection(); 155 VisibleSelection selection = selectedFrame->selection().selection();
156 if (!selection.isCaretOrRange()) 156 if (!selection.isCaretOrRange())
157 return String(); 157 return String();
158 158
159 // Caret and range selections always return valid normalized ranges. 159 // Caret and range selections always return valid normalized ranges.
160 RefPtr<Range> selectionRange = selection.toNormalizedRange(); 160 RefPtr<Range> selectionRange = selection.toNormalizedRange();
161 Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->mark ersInRange(selectionRange.get(), DocumentMarker::MisspellingMarkers()); 161 Vector<DocumentMarker*> markers = selectedFrame->document()->markers().marke rsInRange(selectionRange.get(), DocumentMarker::MisspellingMarkers());
162 if (markers.size() != 1) 162 if (markers.size() != 1)
163 return String(); 163 return String();
164 marker = *markers[0]; 164 marker = *markers[0];
165 165
166 // Cloning a range fails only for invalid ranges. 166 // Cloning a range fails only for invalid ranges.
167 RefPtr<Range> markerRange = selectionRange->cloneRange(ASSERT_NO_EXCEPTION); 167 RefPtr<Range> markerRange = selectionRange->cloneRange(ASSERT_NO_EXCEPTION);
168 markerRange->setStart(markerRange->startContainer(), marker.startOffset()); 168 markerRange->setStart(markerRange->startContainer(), marker.startOffset());
169 markerRange->setEnd(markerRange->endContainer(), marker.endOffset()); 169 markerRange->setEnd(markerRange->endContainer(), marker.endOffset());
170 170
171 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) 171 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation))
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 outputItems[i] = subItems[i]; 412 outputItems[i] = subItems[i];
413 subMenuItems.swap(outputItems); 413 subMenuItems.swap(outputItems);
414 } 414 }
415 415
416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 416 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
417 { 417 {
418 populateSubMenuItems(defaultMenu->items(), data->customItems); 418 populateSubMenuItems(defaultMenu->items(), data->customItems);
419 } 419 }
420 420
421 } // namespace blink 421 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/web/SpellCheckerClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698