OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 #if PLATFORM(GTK) | 186 #if PLATFORM(GTK) |
187 case ContextMenuItemTagDelete: | 187 case ContextMenuItemTagDelete: |
188 frame->editor()->performDelete(); | 188 frame->editor()->performDelete(); |
189 break; | 189 break; |
190 case ContextMenuItemTagSelectAll: | 190 case ContextMenuItemTagSelectAll: |
191 frame->editor()->command("SelectAll").execute(); | 191 frame->editor()->command("SelectAll").execute(); |
192 break; | 192 break; |
193 #endif | 193 #endif |
194 case ContextMenuItemTagSpellingGuess: | 194 case ContextMenuItemTagSpellingGuess: |
195 ASSERT(frame->selectedText().length()); | 195 ASSERT(frame->selectedText().length()); |
196 if (frame->editor()->shouldInsertText(item->title(), frame->selectio
n()->toRange().get(), | 196 if (frame->editor()->shouldInsertText(item->title(), frame->selectio
n()->toNormalizedRange().get(), |
197 EditorInsertActionPasted)) { | 197 EditorInsertActionPasted)) { |
198 Document* document = frame->document(); | 198 Document* document = frame->document(); |
199 RefPtr<ReplaceSelectionCommand> command = | 199 RefPtr<ReplaceSelectionCommand> command = |
200 ReplaceSelectionCommand::create(document, createFragmentFrom
Markup(document, item->title(), ""), | 200 ReplaceSelectionCommand::create(document, createFragmentFrom
Markup(document, item->title(), ""), |
201
true, false, true); | 201
true, false, true); |
202 applyCommand(command); | 202 applyCommand(command); |
203 frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded); | 203 frame->revealSelection(RenderLayer::gAlignToEdgeIfNeeded); |
204 } | 204 } |
205 break; | 205 break; |
206 case ContextMenuItemTagIgnoreSpelling: | 206 case ContextMenuItemTagIgnoreSpelling: |
(...skipping 24 matching lines...) Expand all Loading... |
231 break; | 231 break; |
232 case ContextMenuItemTagUnderline: | 232 case ContextMenuItemTagUnderline: |
233 frame->editor()->toggleUnderline(); | 233 frame->editor()->toggleUnderline(); |
234 break; | 234 break; |
235 case ContextMenuItemTagOutline: | 235 case ContextMenuItemTagOutline: |
236 // We actually never enable this because CSS does not have a way to
specify an outline font, | 236 // We actually never enable this because CSS does not have a way to
specify an outline font, |
237 // which may make this difficult to implement. Maybe a special case
of text-shadow? | 237 // which may make this difficult to implement. Maybe a special case
of text-shadow? |
238 break; | 238 break; |
239 case ContextMenuItemTagStartSpeaking: { | 239 case ContextMenuItemTagStartSpeaking: { |
240 ExceptionCode ec; | 240 ExceptionCode ec; |
241 RefPtr<Range> selectedRange = frame->selection()->toRange(); | 241 RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange(
); |
242 if (!selectedRange || selectedRange->collapsed(ec)) { | 242 if (!selectedRange || selectedRange->collapsed(ec)) { |
243 Document* document = result.innerNonSharedNode()->document(); | 243 Document* document = result.innerNonSharedNode()->document(); |
244 selectedRange = document->createRange(); | 244 selectedRange = document->createRange(); |
245 selectedRange->selectNode(document->documentElement(), ec); | 245 selectedRange->selectNode(document->documentElement(), ec); |
246 } | 246 } |
247 m_client->speak(plainText(selectedRange.get())); | 247 m_client->speak(plainText(selectedRange.get())); |
248 break; | 248 break; |
249 } | 249 } |
250 case ContextMenuItemTagStopSpeaking: | 250 case ContextMenuItemTagStopSpeaking: |
251 m_client->stopSpeaking(); | 251 m_client->stopSpeaking(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (Page* page = frame->page()) | 302 if (Page* page = frame->page()) |
303 page->inspectorController()->inspect(result.innerNonSharedNode()
); | 303 page->inspectorController()->inspect(result.innerNonSharedNode()
); |
304 break; | 304 break; |
305 default: | 305 default: |
306 break; | 306 break; |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 } // namespace WebCore | 310 } // namespace WebCore |
311 | 311 |
OLD | NEW |