Changeset 54458 in webkit
- Timestamp:
- Feb 5, 2010 6:44:55 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r54448 r54458 1 2010-02-05 James Hawkins <jhawkins@chromium.org> 2 3 Reviewed by David Levin. 4 5 [Chromium] Rename autocomplete* to suggestions* to prepare for the 6 refactoring of AutocompletePopupMenuClient. 7 8 https://bugs.webkit.org/show_bug.cgi?id=34664 9 10 * public/WebView.h: 11 * src/AutocompletePopupMenuClient.cpp: 12 (WebKit::AutocompletePopupMenuClient::popupDidHide): 13 * src/EditorClientImpl.cpp: 14 (WebKit::EditorClientImpl::textFieldDidEndEditing): 15 (WebKit::EditorClientImpl::doAutofill): 16 * src/WebViewImpl.cpp: 17 (WebKit::): 18 (WebKit::WebViewImpl::WebViewImpl): 19 (WebKit::WebViewImpl::mouseDown): 20 (WebKit::WebViewImpl::autocompleteHandleKeyEvent): 21 (WebKit::WebViewImpl::setFocus): 22 (WebKit::WebViewImpl::applyAutofillSuggestions): 23 (WebKit::WebViewImpl::hideAutofillPopup): 24 (WebKit::WebViewImpl::hideSuggestionsPopup): 25 (WebKit::WebViewImpl::refreshSuggestionsPopup): 26 * src/WebViewImpl.h: 27 (WebKit::WebViewImpl::suggestionsPopupDidHide): 28 1 29 2010-02-05 James Hawkins <jhawkins@chromium.org> 2 30 -
trunk/WebKit/chromium/public/WebView.h
r54152 r54458 232 232 int defaultSuggestionIndex) = 0; 233 233 234 // Hides the autofill popup if any are showing.234 // DEPRECATED: WebView::hideSuggestionsPopup is the new way to access this. 235 235 virtual void hideAutofillPopup() = 0; 236 237 // Hides the suggestions popup if any are showing. 238 virtual void hideSuggestionsPopup() = 0; 236 239 237 240 -
trunk/WebKit/chromium/src/AutocompletePopupMenuClient.cpp
r53716 r54458 121 121 void AutocompletePopupMenuClient::popupDidHide() 122 122 { 123 m_webView-> autoCompletePopupDidHide();123 m_webView->suggestionsPopupDidHide(); 124 124 } 125 125 -
trunk/WebKit/chromium/src/EditorClientImpl.cpp
r52791 r54458 1 1 /* 2 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. 3 * Copyright (C) 20 09Google, Inc. All rights reserved.3 * Copyright (C) 2010 Google, Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 655 655 656 656 // Hide any showing popup. 657 m_webView->hide AutoCompletePopup();657 m_webView->hideSuggestionsPopup(); 658 658 659 659 if (!m_webView->client()) … … 749 749 750 750 if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) { 751 m_webView->hide AutoCompletePopup();751 m_webView->hideSuggestionsPopup(); 752 752 return; 753 753 } -
trunk/WebKit/chromium/src/WebViewImpl.cpp
r54195 r54458 1 1 /* 2 * Copyright (C) 20 09Google Inc. All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 149 149 COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery); 150 150 151 // Note that focusOnShow is false so that the autocompletepopup is shown not151 // Note that focusOnShow is false so that the suggestions popup is shown not 152 152 // activated. We need the page to still have focus so the user can keep typing 153 153 // while the popup is showing. 154 static const PopupContainerSettings autocompletePopupSettings = {154 static const PopupContainerSettings suggestionsPopupSettings = { 155 155 false, // focusOnShow 156 156 false, // setTextOnIndexChange … … 158 158 true, // loopSelectionNavigation 159 159 true, // restrictWidthOfListBox. Same as other browser (Fx, IE, and safari) 160 // For autocomplete, we use the direction of the input field as the direction160 // For suggestions, we use the direction of the input field as the direction 161 161 // of the popup items. The main reason is to keep the display of items in 162 162 // drop-down the same as the items in the input field. … … 240 240 , m_operationsAllowed(WebDragOperationNone) 241 241 , m_dragOperation(WebDragOperationNone) 242 , m_ autocompletePopupShowing(false)242 , m_suggestionsPopupShowing(false) 243 243 , m_isTransparent(false) 244 244 , m_tabsToLinks(false) … … 327 327 328 328 // If a text field that has focus is clicked again, we should display the 329 // autocompletepopup.329 // suggestions popup. 330 330 RefPtr<Node> clickedNode; 331 331 if (event.button == WebMouseEvent::ButtonLeft) { … … 349 349 350 350 if (clickedNode.get() && clickedNode == focusedWebCoreNode()) { 351 // Focus has not changed, show the autocompletepopup.351 // Focus has not changed, show the suggestions popup. 352 352 static_cast<EditorClientImpl*>(m_page->editorClient())-> 353 353 showFormAutofillForNode(clickedNode.get()); … … 515 515 bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event) 516 516 { 517 if (!m_ autocompletePopupShowing517 if (!m_suggestionsPopupShowing 518 518 // Home and End should be left to the text field to process. 519 519 || event.windowsKeyCode == VKEY_HOME … … 523 523 // Pressing delete triggers the removal of the selected suggestion from the DB. 524 524 if (event.windowsKeyCode == VKEY_DELETE 525 && m_ autocompletePopup->selectedIndex() != -1) {525 && m_suggestionsPopup->selectedIndex() != -1) { 526 526 Node* node = focusedWebCoreNode(); 527 527 if (!node || (node->nodeType() != Node::ELEMENT_NODE)) { … … 535 535 } 536 536 537 int selectedIndex = m_ autocompletePopup->selectedIndex();537 int selectedIndex = m_suggestionsPopup->selectedIndex(); 538 538 HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element); 539 539 WebString name = inputElement->name(); … … 543 543 // deletion. 544 544 m_autocompletePopupClient->removeItemAtIndex(selectedIndex); 545 refresh AutofillPopup();545 refreshSuggestionsPopup(); 546 546 return false; 547 547 } 548 548 549 if (!m_ autocompletePopup->isInterestedInEventForKey(event.windowsKeyCode))549 if (!m_suggestionsPopup->isInterestedInEventForKey(event.windowsKeyCode)) 550 550 return false; 551 551 552 if (m_ autocompletePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) {552 if (m_suggestionsPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) { 553 553 // We need to ignore the next Char event after this otherwise pressing 554 554 // enter when selecting an item in the menu will go to the page. … … 977 977 m_imeAcceptEvents = true; 978 978 } else { 979 hide AutoCompletePopup();979 hideSuggestionsPopup(); 980 980 981 981 // Clear focus on the currently focused frame if any. … … 1560 1560 { 1561 1561 if (!m_page.get() || suggestions.isEmpty()) { 1562 hide AutoCompletePopup();1562 hideSuggestionsPopup(); 1563 1563 return; 1564 1564 } … … 1569 1569 RefPtr<Document> document = focused->document(); 1570 1570 if (!document.get()) { 1571 hide AutoCompletePopup();1571 hideSuggestionsPopup(); 1572 1572 return; 1573 1573 } … … 1578 1578 // carret is at the end and that the text has not changed. 1579 1579 if (!focusedNode.get() || focusedNode != PassRefPtr<Node>(node)) { 1580 hide AutoCompletePopup();1580 hideSuggestionsPopup(); 1581 1581 return; 1582 1582 } … … 1590 1590 static_cast<HTMLInputElement*>(focusedNode.get()); 1591 1591 1592 // The first time the autocomplete is shown we'll create the client and the1593 // popup.1592 // The first time the suggestions popup is shown we'll create the client 1593 // and the popup. 1594 1594 if (!m_autocompletePopupClient.get()) 1595 1595 m_autocompletePopupClient.set(new AutocompletePopupMenuClient(this)); … … 1597 1597 suggestions, 1598 1598 defaultSuggestionIndex); 1599 if (!m_ autocompletePopup.get()) {1600 m_ autocompletePopup =1599 if (!m_suggestionsPopup.get()) { 1600 m_suggestionsPopup = 1601 1601 PopupContainer::create(m_autocompletePopupClient.get(), 1602 autocompletePopupSettings);1602 suggestionsPopupSettings); 1603 1603 } 1604 1604 1605 if (m_ autocompletePopupShowing) {1605 if (m_suggestionsPopupShowing) { 1606 1606 m_autocompletePopupClient->setSuggestions(suggestions); 1607 refresh AutofillPopup();1607 refreshSuggestionsPopup(); 1608 1608 } else { 1609 m_ autocompletePopup->show(focusedNode->getRect(),1610 1611 m_ autocompletePopupShowing = true;1609 m_suggestionsPopup->show(focusedNode->getRect(), 1610 focusedNode->ownerDocument()->view(), 0); 1611 m_suggestionsPopupShowing = true; 1612 1612 } 1613 1613 } … … 1616 1616 void WebViewImpl::hideAutofillPopup() 1617 1617 { 1618 hideAutoCompletePopup(); 1618 hideSuggestionsPopup(); 1619 } 1620 1621 void WebViewImpl::hideSuggestionsPopup() 1622 { 1623 if (m_suggestionsPopupShowing) { 1624 m_suggestionsPopup->hidePopup(); 1625 m_suggestionsPopupShowing = false; 1626 } 1619 1627 } 1620 1628 … … 1779 1787 } 1780 1788 1781 void WebViewImpl::hideAutoCompletePopup()1782 {1783 if (m_autocompletePopupShowing) {1784 m_autocompletePopup->hidePopup();1785 autoCompletePopupDidHide();1786 }1787 }1788 1789 void WebViewImpl::autoCompletePopupDidHide()1790 {1791 m_autocompletePopupShowing = false;1792 }1793 1794 1789 void WebViewImpl::setIgnoreInputEvents(bool newValue) 1795 1790 { … … 1807 1802 #endif 1808 1803 1809 void WebViewImpl::refresh AutofillPopup()1810 { 1811 ASSERT(m_ autocompletePopupShowing);1804 void WebViewImpl::refreshSuggestionsPopup() 1805 { 1806 ASSERT(m_suggestionsPopupShowing); 1812 1807 1813 1808 // Hide the popup if it has become empty. 1814 1809 if (!m_autocompletePopupClient->listSize()) { 1815 hide AutoCompletePopup();1816 return; 1817 } 1818 1819 IntRect oldBounds = m_ autocompletePopup->boundsRect();1820 m_ autocompletePopup->refresh();1821 IntRect newBounds = m_ autocompletePopup->boundsRect();1810 hideSuggestionsPopup(); 1811 return; 1812 } 1813 1814 IntRect oldBounds = m_suggestionsPopup->boundsRect(); 1815 m_suggestionsPopup->refresh(); 1816 IntRect newBounds = m_suggestionsPopup->boundsRect(); 1822 1817 // Let's resize the backing window if necessary. 1823 1818 if (oldBounds != newBounds) { 1824 1819 WebPopupMenuImpl* popupMenu = 1825 static_cast<WebPopupMenuImpl*>(m_ autocompletePopup->client());1820 static_cast<WebPopupMenuImpl*>(m_suggestionsPopup->client()); 1826 1821 popupMenu->client()->setWindowRect(newBounds); 1827 1822 } -
trunk/WebKit/chromium/src/WebViewImpl.h
r54152 r54458 1 1 /* 2 * Copyright (C) 20 09Google Inc. All rights reserved.2 * Copyright (C) 2010 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 155 155 int defaultSuggestionIndex); 156 156 virtual void hideAutofillPopup(); 157 virtual void hideSuggestionsPopup(); 157 158 virtual void setScrollbarColors(unsigned inactiveColor, 158 159 unsigned activeColor, … … 262 263 WebDragOperationsMask dragSourceOperationMask); 263 264 264 // Hides the autocomplete popup if it is showing. 265 void hideAutoCompletePopup(); 266 void autoCompletePopupDidHide(); 265 void suggestionsPopupDidHide() 266 { 267 m_suggestionsPopupShowing = false; 268 } 267 269 268 270 #if ENABLE(NOTIFICATIONS) … … 296 298 bool autocompleteHandleKeyEvent(const WebKeyboardEvent&); 297 299 298 // Repaints the autofill popup. Should be called when the suggestions have299 // changed. Note that this should only be called when the autofill popup is300 // showing.301 void refresh AutofillPopup();300 // Repaints the suggestions popup. Should be called when the suggestions 301 // have changed. Note that this should only be called when the suggestions 302 // popup is showing. 303 void refreshSuggestionsPopup(); 302 304 303 305 // Returns true if the view was scrolled. … … 394 396 WebDragOperation m_dragOperation; 395 397 396 // The autocompletepopup. Kept around and reused every-time new suggestions398 // The suggestions popup. Kept around and reused every-time new suggestions 397 399 // should be shown. 398 RefPtr<WebCore::PopupContainer> m_ autocompletePopup;399 400 // Whether the autocompletepopup is currently showing.401 bool m_ autocompletePopupShowing;400 RefPtr<WebCore::PopupContainer> m_suggestionsPopup; 401 402 // Whether the suggestions popup is currently showing. 403 bool m_suggestionsPopupShowing; 402 404 403 405 // The autocomplete client.
Note: See TracChangeset
for help on using the changeset viewer.