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

Side by Side Diff: webkit/glue/webview_impl.cc

Issue 9621: Improving the form autofill menu behavior (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | webkit/port/platform/chromium/PopupMenuChromium.h » ('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 2007 Google Inc. All Rights Reserved. 2 * Copyright 2007 Google Inc. All Rights Reserved.
3 * 3 *
4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
5 * 5 *
6 * ***** BEGIN LICENSE BLOCK ***** 6 * ***** BEGIN LICENSE BLOCK *****
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // member. 415 // member.
416 // The suppress_next_keypress_event_ is set if the KeyDown is handled by 416 // The suppress_next_keypress_event_ is set if the KeyDown is handled by
417 // Webkit. A keyDown event is typically associated with a keyPress(char) 417 // Webkit. A keyDown event is typically associated with a keyPress(char)
418 // event and a keyUp event. We reset this flag here as this is a new keyDown 418 // event and a keyUp event. We reset this flag here as this is a new keyDown
419 // event. 419 // event.
420 suppress_next_keypress_event_ = false; 420 suppress_next_keypress_event_ = false;
421 421
422 // Give autocomplete a chance to consume the key events it is interested in. 422 // Give autocomplete a chance to consume the key events it is interested in.
423 if (autocomplete_popup_ && 423 if (autocomplete_popup_ &&
424 autocomplete_popup_->isInterestedInEventForKey(event.key_code)) { 424 autocomplete_popup_->isInterestedInEventForKey(event.key_code)) {
425 if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) 425 if (autocomplete_popup_->handleKeyEvent(MakePlatformKeyboardEvent(event))) {
426 #if defined(OS_WIN)
427 // We need to ignore the next CHAR event after this otherwise pressing
428 // enter when selecting an item in the menu will go to the page.
429 if (WebInputEvent::KEY_DOWN == event.type)
430 suppress_next_keypress_event_ = true;
431 #endif
426 return true; 432 return true;
433 }
427 return false; 434 return false;
428 } 435 }
429 436
430 // A new key being pressed should hide the popup. 437 // A new key being pressed should hide the popup.
431 if (event.type == WebInputEvent::KEY_DOWN) 438 if (event.type == WebInputEvent::KEY_DOWN)
432 HideAutoCompletePopup(); 439 HideAutoCompletePopup();
433 440
434 Frame* frame = GetFocusedWebCoreFrame(); 441 Frame* frame = GetFocusedWebCoreFrame();
435 if (!frame) 442 if (!frame)
436 return false; 443 return false;
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 if (suggestions.size() > 0) { 1524 if (suggestions.size() > 0) {
1518 autocomplete_popup_client_ = 1525 autocomplete_popup_client_ =
1519 adoptRef(new AutocompletePopupMenuClient(this, input_elem, 1526 adoptRef(new AutocompletePopupMenuClient(this, input_elem,
1520 suggestions, 1527 suggestions,
1521 default_suggestion_index)); 1528 default_suggestion_index));
1522 // Autocomplete popup does not get focused. We need the page to still 1529 // Autocomplete popup does not get focused. We need the page to still
1523 // have focus so the user can keep typing when the popup is showing. 1530 // have focus so the user can keep typing when the popup is showing.
1524 autocomplete_popup_ = 1531 autocomplete_popup_ =
1525 WebCore::PopupContainer::create(autocomplete_popup_client_.get(), 1532 WebCore::PopupContainer::create(autocomplete_popup_client_.get(),
1526 false); 1533 false);
1534 autocomplete_popup_->setTextOnIndexChange(false);
1527 autocomplete_popup_->show(focused_node->getRect(), frame->view(), 0); 1535 autocomplete_popup_->show(focused_node->getRect(), frame->view(), 0);
1528 } 1536 }
1529 } 1537 }
1530 } 1538 }
1531 1539
1532 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { 1540 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
1533 if (is_new_navigation) 1541 if (is_new_navigation)
1534 *is_new_navigation = observed_new_navigation_; 1542 *is_new_navigation = observed_new_navigation_;
1535 1543
1536 #ifndef NDEBUG 1544 #ifndef NDEBUG
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); 1686 MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher);
1679 } 1687 }
1680 1688
1681 void WebViewImpl::HideAutoCompletePopup() { 1689 void WebViewImpl::HideAutoCompletePopup() {
1682 if (autocomplete_popup_) { 1690 if (autocomplete_popup_) {
1683 autocomplete_popup_->hidePopup(); 1691 autocomplete_popup_->hidePopup();
1684 autocomplete_popup_.clear(); 1692 autocomplete_popup_.clear();
1685 autocomplete_popup_client_.clear(); 1693 autocomplete_popup_client_.clear();
1686 } 1694 }
1687 } 1695 }
OLDNEW
« no previous file with comments | « no previous file | webkit/port/platform/chromium/PopupMenuChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698