Changeset 62193 in webkit


Ignore:
Timestamp:
Jun 30, 2010 11:49:33 AM (14 years ago)
Author:
jocelyn.turcotte@nokia.com
Message:

2010-06-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Make sure we catch closed QComboBox popups.
https://bugs.webkit.org/show_bug.cgi?id=39019

The way it works currently is using the QComboBox::show/hidePopup
virtual method to catch popup requests in the middle. There is
some cases however that the popup widget gets closed without
going through the hidePopup method.

This patch adds an event filter to the popup's view to know when
it gets closed and calls hidePopup to call our handling code.
This may get hidePopup called twice but this shouldn't have any
effect.

  • WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopupCombo::QtFallbackWebPopupCombo): (WebCore::QtFallbackWebPopupCombo::eventFilter):
  • WebCoreSupport/QtFallbackWebPopup.h:
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/ChangeLog

    r62171 r62193  
     12010-06-30  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Make sure we catch closed QComboBox popups.
     6        https://bugs.webkit.org/show_bug.cgi?id=39019
     7
     8        The way it works currently is using the QComboBox::show/hidePopup
     9        virtual method to catch popup requests in the middle. There is
     10        some cases however that the popup widget gets closed without
     11        going through the hidePopup method.
     12
     13        This patch adds an event filter to the popup's view to know when
     14        it gets closed and calls hidePopup to call our handling code.
     15        This may get hidePopup called twice but this shouldn't have any
     16        effect.
     17
     18        * WebCoreSupport/QtFallbackWebPopup.cpp:
     19        (WebCore::QtFallbackWebPopupCombo::QtFallbackWebPopupCombo):
     20        (WebCore::QtFallbackWebPopupCombo::eventFilter):
     21        * WebCoreSupport/QtFallbackWebPopup.h:
     22
    1232010-06-30  Simon Hausmann  <simon.hausmann@nokia.com>
    224
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp

    r61935 r62193  
    4848    : m_ownerPopup(ownerPopup)
    4949{
     50    // Install an event filter on the view inside the combo box popup to make sure we know
     51    // when the popup got closed. E.g. QComboBox::hidePopup() won't be called when the popup
     52    // is closed by a mouse wheel event outside its window.
     53    view()->installEventFilter(this);
    5054}
    5155
     
    8084    m_ownerPopup.m_popupVisible = false;
    8185    m_ownerPopup.popupDidHide();
     86}
     87
     88bool QtFallbackWebPopupCombo::eventFilter(QObject* watched, QEvent* event)
     89{
     90    Q_ASSERT(watched == view());
     91
     92    if (event->type() == QEvent::Show && !m_ownerPopup.m_popupVisible)
     93        showPopup();
     94    else if (event->type() == QEvent::Hide && m_ownerPopup.m_popupVisible)
     95        hidePopup();
     96
     97    return false;
    8298}
    8399
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h

    r59614 r62193  
    6363    virtual void showPopup();
    6464    virtual void hidePopup();
     65    virtual bool eventFilter(QObject* watched, QEvent* event);
    6566
    6667private:
Note: See TracChangeset for help on using the changeset viewer.