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

Side by Side Diff: Source/WebKit/chromium/src/ContextMenuClientImpl.cpp

Issue 16081007: Introduce toHTMLInputElement(Node*), and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp » ('j') | 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Send the frame and page URLs in any case. 287 // Send the frame and page URLs in any case.
288 data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame()); 288 data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
289 if (selectedFrame != m_webView->mainFrameImpl()->frame()) { 289 if (selectedFrame != m_webView->mainFrameImpl()->frame()) {
290 data.frameURL = urlFromFrame(selectedFrame); 290 data.frameURL = urlFromFrame(selectedFrame);
291 RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->cu rrentItem(); 291 RefPtr<HistoryItem> historyItem = selectedFrame->loader()->history()->cu rrentItem();
292 if (historyItem) 292 if (historyItem)
293 data.frameHistoryItem = WebHistoryItem(historyItem); 293 data.frameHistoryItem = WebHistoryItem(historyItem);
294 } 294 }
295 295
296 if (r.isSelected()) { 296 if (r.isSelected()) {
297 if (!r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag) || !static_ cast<HTMLInputElement*>(r.innerNonSharedNode())->isPasswordField()) 297 if (!r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag) || !toHTMLI nputElement(r.innerNonSharedNode())->isPasswordField())
298 data.selectedText = selectedFrame->editor()->selectedText().stripWhi teSpace(); 298 data.selectedText = selectedFrame->editor()->selectedText().stripWhi teSpace();
299 } 299 }
300 300
301 if (r.isContentEditable()) { 301 if (r.isContentEditable()) {
302 data.isEditable = true; 302 data.isEditable = true;
303 #if ENABLE(INPUT_SPEECH) 303 #if ENABLE(INPUT_SPEECH)
304 if (r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) { 304 if (r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag))
305 data.isSpeechInputEnabled = 305 data.isSpeechInputEnabled = toHTMLInputElement(r.innerNonSharedNode( ))->isSpeechEnabled();
306 static_cast<HTMLInputElement*>(r.innerNonSharedNode())->isSpeech Enabled();
307 }
308 #endif 306 #endif
309 // When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled 307 // When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled
310 // words and attaches suggestions to these markers in the background. Th erefore, when a user right-clicks 308 // words and attaches suggestions to these markers in the background. Th erefore, when a user right-clicks
311 // a mouse on a word, Chrome just needs to find a spelling marker on the word instead of spellchecking it. 309 // a mouse on a word, Chrome just needs to find a spelling marker on the word instead of spellchecking it.
312 if (selectedFrame->settings() && selectedFrame->settings()->asynchronous SpellCheckingEnabled()) { 310 if (selectedFrame->settings() && selectedFrame->settings()->asynchronous SpellCheckingEnabled()) {
313 DocumentMarker marker; 311 DocumentMarker marker;
314 data.misspelledWord = selectMisspellingAsync(selectedFrame, marker); 312 data.misspelledWord = selectMisspellingAsync(selectedFrame, marker);
315 data.misspellingHash = marker.hash(); 313 data.misspellingHash = marker.hash();
316 if (marker.description().length()) { 314 if (marker.description().length()) {
317 Vector<String> suggestions; 315 Vector<String> suggestions;
(...skipping 14 matching lines...) Expand all
332 m_webView->spellCheckClient()->spellCheck( 330 m_webView->spellCheckClient()->spellCheck(
333 data.misspelledWord, misspelledOffset, misspelledLength, 331 data.misspelledWord, misspelledOffset, misspelledLength,
334 &data.dictionarySuggestions); 332 &data.dictionarySuggestions);
335 if (!misspelledLength) 333 if (!misspelledLength)
336 data.misspelledWord.reset(); 334 data.misspelledWord.reset();
337 } 335 }
338 } 336 }
339 } 337 }
340 HTMLFormElement* form = selectedFrame->selection()->currentForm(); 338 HTMLFormElement* form = selectedFrame->selection()->currentForm();
341 if (form && r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) { 339 if (form && r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag)) {
342 HTMLInputElement* selectedElement = static_cast<HTMLInputElement*>(r .innerNonSharedNode()); 340 HTMLInputElement* selectedElement = toHTMLInputElement(r.innerNonSha redNode());
343 if (selectedElement) { 341 if (selectedElement) {
344 WebSearchableFormData ws = WebSearchableFormData(WebFormElement( form), WebInputElement(selectedElement)); 342 WebSearchableFormData ws = WebSearchableFormData(WebFormElement( form), WebInputElement(selectedElement));
345 if (ws.url().isValid()) 343 if (ws.url().isValid())
346 data.keywordURL = ws.url(); 344 data.keywordURL = ws.url();
347 } 345 }
348 } 346 }
349 } 347 }
350 348
351 #if OS(DARWIN) 349 #if OS(DARWIN)
352 if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState) 350 if (selectedFrame->editor()->selectionHasStyle(CSSPropertyDirection, "ltr") != FalseTriState)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 outputItems[i] = subItems[i]; 407 outputItems[i] = subItems[i];
410 subMenuItems.swap(outputItems); 408 subMenuItems.swap(outputItems);
411 } 409 }
412 410
413 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data) 411 void ContextMenuClientImpl::populateCustomMenuItems(const WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
414 { 412 {
415 populateSubMenuItems(defaultMenu->items(), data->customItems); 413 populateSubMenuItems(defaultMenu->items(), data->customItems);
416 } 414 }
417 415
418 } // namespace WebKit 416 } // namespace WebKit
OLDNEW
« no previous file with comments | « no previous file | Source/WebKit/chromium/src/DOMUtilitiesPrivate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698