OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 static String selectMisspellingAsync(LocalFrame* selectedFrame, DocumentMarker&
marker) | 154 static String selectMisspellingAsync(LocalFrame* selectedFrame, DocumentMarker&
marker) |
155 { | 155 { |
156 VisibleSelection selection = selectedFrame->selection().selection(); | 156 VisibleSelection selection = selectedFrame->selection().selection(); |
157 if (!selection.isCaretOrRange()) | 157 if (!selection.isCaretOrRange()) |
158 return String(); | 158 return String(); |
159 | 159 |
160 // Caret and range selections always return valid normalized ranges. | 160 // Caret and range selections always return valid normalized ranges. |
161 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange(); | 161 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange(); |
162 Vector<DocumentMarker*> markers = selectedFrame->document()->markers().marke
rsInRange(selectionRange.get(), DocumentMarker::MisspellingMarkers()); | 162 WillBeHeapVector<DocumentMarker*> markers = selectedFrame->document()->marke
rs().markersInRange(selectionRange.get(), DocumentMarker::MisspellingMarkers()); |
163 if (markers.size() != 1) | 163 if (markers.size() != 1) |
164 return String(); | 164 return String(); |
165 marker = *markers[0]; | 165 marker = *markers[0]; |
166 | 166 |
167 // Cloning a range fails only for invalid ranges. | 167 // Cloning a range fails only for invalid ranges. |
168 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(); | 168 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(); |
169 markerRange->setStart(markerRange->startContainer(), marker.startOffset()); | 169 markerRange->setStart(markerRange->startContainer(), marker.startOffset()); |
170 markerRange->setEnd(markerRange->endContainer(), marker.endOffset()); | 170 markerRange->setEnd(markerRange->endContainer(), marker.endOffset()); |
171 | 171 |
172 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) | 172 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != selec
tionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 outputItems[i] = subItems[i]; | 419 outputItems[i] = subItems[i]; |
420 subMenuItems.swap(outputItems); | 420 subMenuItems.swap(outputItems); |
421 } | 421 } |
422 | 422 |
423 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 423 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
424 { | 424 { |
425 populateSubMenuItems(defaultMenu->items(), data->customItems); | 425 populateSubMenuItems(defaultMenu->items(), data->customItems); |
426 } | 426 } |
427 | 427 |
428 } // namespace blink | 428 } // namespace blink |
OLD | NEW |