| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::Spelling | DocumentMarker::Gram
mar); | 161 Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->mark
ersInRange(selectionRange.get(), DocumentMarker::Spelling | DocumentMarker::Gram
mar); |
| 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_S
TATE); | 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)) |
| 172 return String(); | 172 return String(); |
| 173 | 173 |
| 174 return markerRange->text(); | 174 return markerRange->text(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
enu) | 177 void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM
enu) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 outputItems[i] = subItems[i]; | 404 outputItems[i] = subItems[i]; |
| 405 subMenuItems.swap(outputItems); | 405 subMenuItems.swap(outputItems); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) | 408 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu*
defaultMenu, WebContextMenuData* data) |
| 409 { | 409 { |
| 410 populateSubMenuItems(defaultMenu->items(), data->customItems); | 410 populateSubMenuItems(defaultMenu->items(), data->customItems); |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace WebKit | 413 } // namespace WebKit |
| OLD | NEW |