| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return isSpaceOrNewline(c) || WTF::Unicode::isPunct(c); | 151 return isSpaceOrNewline(c) || WTF::Unicode::isPunct(c); |
| 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 RefPtr<Range> selectionRange = selection.toNormalizedRange(); | 161 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange(); |
| 162 Vector<DocumentMarker*> markers = selectedFrame->document()->markers().marke
rsInRange(selectionRange.get(), DocumentMarker::MisspellingMarkers()); | 162 Vector<DocumentMarker*> markers = selectedFrame->document()->markers().marke
rsInRange(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 RefPtr<Range> markerRange = selectionRange->cloneRange(ASSERT_NO_EXCEPTION); | 168 RefPtrWillBeRawPtr<Range> markerRange = selectionRange->cloneRange(ASSERT_NO
_EXCEPTION); |
| 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)) |
| 173 return String(); | 173 return String(); |
| 174 | 174 |
| 175 return markerRange->text(); | 175 return markerRange->text(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
enu) | 178 void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
enu) |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 outputItems[i] = subItems[i]; | 420 outputItems[i] = subItems[i]; |
| 421 subMenuItems.swap(outputItems); | 421 subMenuItems.swap(outputItems); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 424 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
| 425 { | 425 { |
| 426 populateSubMenuItems(defaultMenu->items(), data->customItems); | 426 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |