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 20 matching lines...) Expand all Loading... |
31 #include "web/ContextMenuClientImpl.h" | 31 #include "web/ContextMenuClientImpl.h" |
32 | 32 |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "core/CSSPropertyNames.h" | 34 #include "core/CSSPropertyNames.h" |
35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
36 #include "core/InputTypeNames.h" | 36 #include "core/InputTypeNames.h" |
37 #include "core/css/CSSStyleDeclaration.h" | 37 #include "core/css/CSSStyleDeclaration.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
40 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
| 41 #include "core/editing/markers/SpellCheckMarker.h" |
41 #include "core/editing/spellcheck/SpellChecker.h" | 42 #include "core/editing/spellcheck/SpellChecker.h" |
42 #include "core/frame/FrameView.h" | 43 #include "core/frame/FrameView.h" |
43 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
44 #include "core/frame/VisualViewport.h" | 45 #include "core/frame/VisualViewport.h" |
45 #include "core/html/HTMLAnchorElement.h" | 46 #include "core/html/HTMLAnchorElement.h" |
46 #include "core/html/HTMLFormElement.h" | 47 #include "core/html/HTMLFormElement.h" |
47 #include "core/html/HTMLImageElement.h" | 48 #include "core/html/HTMLImageElement.h" |
48 #include "core/html/HTMLInputElement.h" | 49 #include "core/html/HTMLInputElement.h" |
49 #include "core/html/HTMLMediaElement.h" | 50 #include "core/html/HTMLMediaElement.h" |
50 #include "core/html/HTMLPlugInElement.h" | 51 #include "core/html/HTMLPlugInElement.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (selection.isNone()) | 113 if (selection.isNone()) |
113 return String(); | 114 return String(); |
114 | 115 |
115 // Caret and range selections always return valid normalized ranges. | 116 // Caret and range selections always return valid normalized ranges. |
116 Range* selectionRange = createRange(selection.toNormalizedEphemeralRange()); | 117 Range* selectionRange = createRange(selection.toNormalizedEphemeralRange()); |
117 DocumentMarkerVector markers = | 118 DocumentMarkerVector markers = |
118 selectedFrame->document()->markers().markersInRange( | 119 selectedFrame->document()->markers().markersInRange( |
119 EphemeralRange(selectionRange), DocumentMarker::MisspellingMarkers()); | 120 EphemeralRange(selectionRange), DocumentMarker::MisspellingMarkers()); |
120 if (markers.size() != 1) | 121 if (markers.size() != 1) |
121 return String(); | 122 return String(); |
122 description = markers[0]->description(); | 123 description = toSpellCheckMarker(markers[0])->description(); |
123 | 124 |
124 // Cloning a range fails only for invalid ranges. | 125 // Cloning a range fails only for invalid ranges. |
125 Range* markerRange = selectionRange->cloneRange(); | 126 Range* markerRange = selectionRange->cloneRange(); |
126 markerRange->setStart(markerRange->startContainer(), | 127 markerRange->setStart(markerRange->startContainer(), |
127 markers[0]->startOffset()); | 128 markers[0]->startOffset()); |
128 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); | 129 markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); |
129 | 130 |
130 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != | 131 if (markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) != |
131 selectionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) | 132 selectionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) |
132 return String(); | 133 return String(); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 subMenuItems.swap(outputItems); | 452 subMenuItems.swap(outputItems); |
452 } | 453 } |
453 | 454 |
454 void ContextMenuClientImpl::populateCustomMenuItems( | 455 void ContextMenuClientImpl::populateCustomMenuItems( |
455 const ContextMenu* defaultMenu, | 456 const ContextMenu* defaultMenu, |
456 WebContextMenuData* data) { | 457 WebContextMenuData* data) { |
457 populateSubMenuItems(defaultMenu->items(), data->customItems); | 458 populateSubMenuItems(defaultMenu->items(), data->customItems); |
458 } | 459 } |
459 | 460 |
460 } // namespace blink | 461 } // namespace blink |
OLD | NEW |