Changeset 54458 in webkit


Ignore:
Timestamp:
Feb 5, 2010 6:44:55 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-02-05 James Hawkins <jhawkins@chromium.org>

Reviewed by David Levin.

[Chromium] Rename autocomplete* to suggestions* to prepare for the
refactoring of AutocompletePopupMenuClient.

https://bugs.webkit.org/show_bug.cgi?id=34664

  • public/WebView.h:
  • src/AutocompletePopupMenuClient.cpp: (WebKit::AutocompletePopupMenuClient::popupDidHide):
  • src/EditorClientImpl.cpp: (WebKit::EditorClientImpl::textFieldDidEndEditing): (WebKit::EditorClientImpl::doAutofill):
  • src/WebViewImpl.cpp: (WebKit::): (WebKit::WebViewImpl::WebViewImpl): (WebKit::WebViewImpl::mouseDown): (WebKit::WebViewImpl::autocompleteHandleKeyEvent): (WebKit::WebViewImpl::setFocus): (WebKit::WebViewImpl::applyAutofillSuggestions): (WebKit::WebViewImpl::hideAutofillPopup): (WebKit::WebViewImpl::hideSuggestionsPopup): (WebKit::WebViewImpl::refreshSuggestionsPopup):
  • src/WebViewImpl.h: (WebKit::WebViewImpl::suggestionsPopupDidHide):
Location:
trunk/WebKit/chromium
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r54448 r54458  
     12010-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
    1292010-02-05  James Hawkins  <jhawkins@chromium.org>
    230
  • trunk/WebKit/chromium/public/WebView.h

    r54152 r54458  
    232232        int defaultSuggestionIndex) = 0;
    233233
    234     // Hides the autofill popup if any are showing.
     234    // DEPRECATED: WebView::hideSuggestionsPopup is the new way to access this.
    235235    virtual void hideAutofillPopup() = 0;
     236
     237    // Hides the suggestions popup if any are showing.
     238    virtual void hideSuggestionsPopup() = 0;
    236239
    237240
  • trunk/WebKit/chromium/src/AutocompletePopupMenuClient.cpp

    r53716 r54458  
    121121void AutocompletePopupMenuClient::popupDidHide()
    122122{
    123     m_webView->autoCompletePopupDidHide();
     123    m_webView->suggestionsPopupDidHide();
    124124}
    125125
  • trunk/WebKit/chromium/src/EditorClientImpl.cpp

    r52791 r54458  
    11/*
    22 * Copyright (C) 2006, 2007 Apple, Inc.  All rights reserved.
    3  * Copyright (C) 2009 Google, Inc.  All rights reserved.
     3 * Copyright (C) 2010 Google, Inc.  All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    655655
    656656    // Hide any showing popup.
    657     m_webView->hideAutoCompletePopup();
     657    m_webView->hideSuggestionsPopup();
    658658
    659659    if (!m_webView->client())
     
    749749
    750750    if ((!args->autofillOnEmptyValue && value.isEmpty()) || !isCaretAtEnd) {
    751         m_webView->hideAutoCompletePopup();
     751        m_webView->hideSuggestionsPopup();
    752752        return;
    753753    }
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r54195 r54458  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    149149COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery);
    150150
    151 // Note that focusOnShow is false so that the autocomplete popup is shown not
     151// Note that focusOnShow is false so that the suggestions popup is shown not
    152152// activated.  We need the page to still have focus so the user can keep typing
    153153// while the popup is showing.
    154 static const PopupContainerSettings autocompletePopupSettings = {
     154static const PopupContainerSettings suggestionsPopupSettings = {
    155155    false,  // focusOnShow
    156156    false,  // setTextOnIndexChange
     
    158158    true,   // loopSelectionNavigation
    159159    true,   // restrictWidthOfListBox. Same as other browser (Fx, IE, and safari)
    160     // For autocomplete, we use the direction of the input field as the direction
     160    // For suggestions, we use the direction of the input field as the direction
    161161    // of the popup items. The main reason is to keep the display of items in
    162162    // drop-down the same as the items in the input field.
     
    240240    , m_operationsAllowed(WebDragOperationNone)
    241241    , m_dragOperation(WebDragOperationNone)
    242     , m_autocompletePopupShowing(false)
     242    , m_suggestionsPopupShowing(false)
    243243    , m_isTransparent(false)
    244244    , m_tabsToLinks(false)
     
    327327
    328328    // If a text field that has focus is clicked again, we should display the
    329     // autocomplete popup.
     329    // suggestions popup.
    330330    RefPtr<Node> clickedNode;
    331331    if (event.button == WebMouseEvent::ButtonLeft) {
     
    349349
    350350    if (clickedNode.get() && clickedNode == focusedWebCoreNode()) {
    351         // Focus has not changed, show the autocomplete popup.
     351        // Focus has not changed, show the suggestions popup.
    352352        static_cast<EditorClientImpl*>(m_page->editorClient())->
    353353            showFormAutofillForNode(clickedNode.get());
     
    515515bool WebViewImpl::autocompleteHandleKeyEvent(const WebKeyboardEvent& event)
    516516{
    517     if (!m_autocompletePopupShowing
     517    if (!m_suggestionsPopupShowing
    518518        // Home and End should be left to the text field to process.
    519519        || event.windowsKeyCode == VKEY_HOME
     
    523523    // Pressing delete triggers the removal of the selected suggestion from the DB.
    524524    if (event.windowsKeyCode == VKEY_DELETE
    525         && m_autocompletePopup->selectedIndex() != -1) {
     525        && m_suggestionsPopup->selectedIndex() != -1) {
    526526        Node* node = focusedWebCoreNode();
    527527        if (!node || (node->nodeType() != Node::ELEMENT_NODE)) {
     
    535535        }
    536536
    537         int selectedIndex = m_autocompletePopup->selectedIndex();
     537        int selectedIndex = m_suggestionsPopup->selectedIndex();
    538538        HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(element);
    539539        WebString name = inputElement->name();
     
    543543        // deletion.
    544544        m_autocompletePopupClient->removeItemAtIndex(selectedIndex);
    545         refreshAutofillPopup();
     545        refreshSuggestionsPopup();
    546546        return false;
    547547    }
    548548
    549     if (!m_autocompletePopup->isInterestedInEventForKey(event.windowsKeyCode))
     549    if (!m_suggestionsPopup->isInterestedInEventForKey(event.windowsKeyCode))
    550550        return false;
    551551
    552     if (m_autocompletePopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) {
     552    if (m_suggestionsPopup->handleKeyEvent(PlatformKeyboardEventBuilder(event))) {
    553553        // We need to ignore the next Char event after this otherwise pressing
    554554        // enter when selecting an item in the menu will go to the page.
     
    977977        m_imeAcceptEvents = true;
    978978    } else {
    979         hideAutoCompletePopup();
     979        hideSuggestionsPopup();
    980980
    981981        // Clear focus on the currently focused frame if any.
     
    15601560{
    15611561    if (!m_page.get() || suggestions.isEmpty()) {
    1562         hideAutoCompletePopup();
     1562        hideSuggestionsPopup();
    15631563        return;
    15641564    }
     
    15691569        RefPtr<Document> document = focused->document();
    15701570        if (!document.get()) {
    1571             hideAutoCompletePopup();
     1571            hideSuggestionsPopup();
    15721572            return;
    15731573        }
     
    15781578        // carret is at the end and that the text has not changed.
    15791579        if (!focusedNode.get() || focusedNode != PassRefPtr<Node>(node)) {
    1580             hideAutoCompletePopup();
     1580            hideSuggestionsPopup();
    15811581            return;
    15821582        }
     
    15901590            static_cast<HTMLInputElement*>(focusedNode.get());
    15911591
    1592         // The first time the autocomplete is shown we'll create the client and the
    1593         // popup.
     1592        // The first time the suggestions popup is shown we'll create the client
     1593        // and the popup.
    15941594        if (!m_autocompletePopupClient.get())
    15951595            m_autocompletePopupClient.set(new AutocompletePopupMenuClient(this));
     
    15971597                                              suggestions,
    15981598                                              defaultSuggestionIndex);
    1599         if (!m_autocompletePopup.get()) {
    1600             m_autocompletePopup =
     1599        if (!m_suggestionsPopup.get()) {
     1600            m_suggestionsPopup =
    16011601                PopupContainer::create(m_autocompletePopupClient.get(),
    1602                                        autocompletePopupSettings);
     1602                                       suggestionsPopupSettings);
    16031603        }
    16041604
    1605         if (m_autocompletePopupShowing) {
     1605        if (m_suggestionsPopupShowing) {
    16061606            m_autocompletePopupClient->setSuggestions(suggestions);
    1607             refreshAutofillPopup();
     1607            refreshSuggestionsPopup();
    16081608        } else {
    1609             m_autocompletePopup->show(focusedNode->getRect(),
    1610                                       focusedNode->ownerDocument()->view(), 0);
    1611             m_autocompletePopupShowing = true;
     1609            m_suggestionsPopup->show(focusedNode->getRect(),
     1610                                     focusedNode->ownerDocument()->view(), 0);
     1611            m_suggestionsPopupShowing = true;
    16121612        }
    16131613    }
     
    16161616void WebViewImpl::hideAutofillPopup()
    16171617{
    1618     hideAutoCompletePopup();
     1618    hideSuggestionsPopup();
     1619}
     1620
     1621void WebViewImpl::hideSuggestionsPopup()
     1622{
     1623    if (m_suggestionsPopupShowing) {
     1624        m_suggestionsPopup->hidePopup();
     1625        m_suggestionsPopupShowing = false;
     1626    }
    16191627}
    16201628
     
    17791787}
    17801788
    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 
    17941789void WebViewImpl::setIgnoreInputEvents(bool newValue)
    17951790{
     
    18071802#endif
    18081803
    1809 void WebViewImpl::refreshAutofillPopup()
    1810 {
    1811     ASSERT(m_autocompletePopupShowing);
     1804void WebViewImpl::refreshSuggestionsPopup()
     1805{
     1806    ASSERT(m_suggestionsPopupShowing);
    18121807
    18131808    // Hide the popup if it has become empty.
    18141809    if (!m_autocompletePopupClient->listSize()) {
    1815         hideAutoCompletePopup();
    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();
    18221817    // Let's resize the backing window if necessary.
    18231818    if (oldBounds != newBounds) {
    18241819        WebPopupMenuImpl* popupMenu =
    1825             static_cast<WebPopupMenuImpl*>(m_autocompletePopup->client());
     1820            static_cast<WebPopupMenuImpl*>(m_suggestionsPopup->client());
    18261821        popupMenu->client()->setWindowRect(newBounds);
    18271822    }
  • trunk/WebKit/chromium/src/WebViewImpl.h

    r54152 r54458  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    155155        int defaultSuggestionIndex);
    156156    virtual void hideAutofillPopup();
     157    virtual void hideSuggestionsPopup();
    157158    virtual void setScrollbarColors(unsigned inactiveColor,
    158159                                    unsigned activeColor,
     
    262263        WebDragOperationsMask dragSourceOperationMask);
    263264
    264     // Hides the autocomplete popup if it is showing.
    265     void hideAutoCompletePopup();
    266     void autoCompletePopupDidHide();
     265    void suggestionsPopupDidHide()
     266    {
     267        m_suggestionsPopupShowing = false;
     268    }
    267269
    268270#if ENABLE(NOTIFICATIONS)
     
    296298    bool autocompleteHandleKeyEvent(const WebKeyboardEvent&);
    297299
    298     // Repaints the autofill popup.  Should be called when the suggestions have
    299     // changed.  Note that this should only be called when the autofill popup is
    300     // showing.
    301     void refreshAutofillPopup();
     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();
    302304
    303305    // Returns true if the view was scrolled.
     
    394396    WebDragOperation m_dragOperation;
    395397
    396     // The autocomplete popup.  Kept around and reused every-time new suggestions
     398    // The suggestions popup.  Kept around and reused every-time new suggestions
    397399    // should be shown.
    398     RefPtr<WebCore::PopupContainer> m_autocompletePopup;
    399 
    400     // Whether the autocomplete popup 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;
    402404
    403405    // The autocomplete client.
Note: See TracChangeset for help on using the changeset viewer.