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

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

Issue 2911723002: [DMC #24] Add SpellingMarker and GrammarMarker (subclasses of DocumentMarker) (Closed)
Patch Set: Add IsSpellCheckMarker() tests Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | no next file » | 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 21 matching lines...) Expand all
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/dom/ElementTraversal.h" 39 #include "core/dom/ElementTraversal.h"
40 #include "core/editing/Editor.h" 40 #include "core/editing/Editor.h"
41 #include "core/editing/markers/DocumentMarkerController.h" 41 #include "core/editing/markers/DocumentMarkerController.h"
42 #include "core/editing/markers/SpellCheckMarker.h"
42 #include "core/editing/spellcheck/SpellChecker.h" 43 #include "core/editing/spellcheck/SpellChecker.h"
43 #include "core/exported/WebDataSourceImpl.h" 44 #include "core/exported/WebDataSourceImpl.h"
44 #include "core/exported/WebPluginContainerBase.h" 45 #include "core/exported/WebPluginContainerBase.h"
45 #include "core/exported/WebViewBase.h" 46 #include "core/exported/WebViewBase.h"
46 #include "core/frame/LocalFrameView.h" 47 #include "core/frame/LocalFrameView.h"
47 #include "core/frame/Settings.h" 48 #include "core/frame/Settings.h"
48 #include "core/frame/VisualViewport.h" 49 #include "core/frame/VisualViewport.h"
49 #include "core/frame/WebLocalFrameBase.h" 50 #include "core/frame/WebLocalFrameBase.h"
50 #include "core/html/HTMLAnchorElement.h" 51 #include "core/html/HTMLAnchorElement.h"
51 #include "core/html/HTMLFormElement.h" 52 #include "core/html/HTMLFormElement.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 const auto marker_it = 139 const auto marker_it =
139 std::find_if(markers_in_node.begin(), markers_in_node.end(), 140 std::find_if(markers_in_node.begin(), markers_in_node.end(),
140 [=](const DocumentMarker* marker) { 141 [=](const DocumentMarker* marker) {
141 return marker->StartOffset() < selection_end_offset && 142 return marker->StartOffset() < selection_end_offset &&
142 marker->EndOffset() > selection_start_offset; 143 marker->EndOffset() > selection_start_offset;
143 }); 144 });
144 if (marker_it == markers_in_node.end()) 145 if (marker_it == markers_in_node.end())
145 return String(); 146 return String();
146 147
147 const DocumentMarker* const found_marker = *marker_it; 148 const SpellCheckMarker* const found_marker = ToSpellCheckMarker(*marker_it);
148 description = found_marker->Description(); 149 description = found_marker->Description();
149 150
150 Range* const marker_range = 151 Range* const marker_range =
151 Range::Create(*selected_frame->GetDocument(), selection_start_container, 152 Range::Create(*selected_frame->GetDocument(), selection_start_container,
152 found_marker->StartOffset(), selection_start_container, 153 found_marker->StartOffset(), selection_start_container,
153 found_marker->EndOffset()); 154 found_marker->EndOffset());
154 155
155 if (marker_range->GetText().StripWhiteSpace(&IsWhiteSpaceOrPunctuation) != 156 if (marker_range->GetText().StripWhiteSpace(&IsWhiteSpaceOrPunctuation) !=
156 CreateRange(selection_range) 157 CreateRange(selection_range)
157 ->GetText() 158 ->GetText()
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 sub_menu_items.Swap(output_items); 559 sub_menu_items.Swap(output_items);
559 } 560 }
560 561
561 void ContextMenuClientImpl::PopulateCustomMenuItems( 562 void ContextMenuClientImpl::PopulateCustomMenuItems(
562 const ContextMenu* default_menu, 563 const ContextMenu* default_menu,
563 WebContextMenuData* data) { 564 WebContextMenuData* data) {
564 PopulateSubMenuItems(default_menu->Items(), data->custom_items); 565 PopulateSubMenuItems(default_menu->Items(), data->custom_items);
565 } 566 }
566 567
567 } // namespace blink 568 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698