Changeset 53769 in webkit


Ignore:
Timestamp:
Jan 23, 2010 8:37:44 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-23 Girish Ramakrishnan <Girish Ramakrishnan>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Fix positioning of ComboBox popup in QGraphicsWebView.

Wrap the popup in a QGraphicsProxyWidget, so that the popup
transforms with the item.

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

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

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/ChangeLog

    r53716 r53769  
     12010-01-23  Girish Ramakrishnan  <girish@forwardbias.in>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Fix positioning of ComboBox popup in QGraphicsWebView.
     6       
     7        Wrap the popup in a QGraphicsProxyWidget, so that the popup
     8        transforms with the item.
     9       
     10        https://bugs.webkit.org/show_bug.cgi?id=33887
     11
     12        * WebCoreSupport/QtFallbackWebPopup.cpp:
     13        (WebCore::QtFallbackWebPopupCombo::hidePopup):
     14        (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
     15        (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup):
     16        (WebCore::QtFallbackWebPopup::show):
     17        * WebCoreSupport/QtFallbackWebPopup.h:
     18
    1192010-01-22  Peter Kasting  <pkasting@google.com>
    220
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp

    r53716 r53769  
    11/*
     2 * Copyright (C) 2010 Girish Ramakrishnan <girish@forwardbias.in>
    23 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
    34 *
     
    2324#include "HostWindow.h"
    2425#include "PopupMenuClient.h"
     26#include "qgraphicswebview.h"
    2527#include "QWebPageClient.h"
    2628#include <QAbstractItemView>
    2729#include <QApplication>
     30#include <QGraphicsProxyWidget>
     31#include <QGraphicsScene>
     32#include <QGraphicsView>
    2833#include <QInputContext>
    2934#include <QMouseEvent>
     
    5661
    5762    QComboBox::hidePopup();
     63
     64    if (QGraphicsProxyWidget* proxy = graphicsProxyWidget())
     65        proxy->setVisible(false);
     66
    5867    if (!m_ownerPopup.m_popupVisible)
    5968        return;
     
    6978    , m_popupVisible(false)
    7079    , m_combo(new QtFallbackWebPopupCombo(*this))
     80    , m_proxy(0)
    7181{
    7282    connect(m_combo, SIGNAL(activated(int)),
     
    7686QtFallbackWebPopup::~QtFallbackWebPopup()
    7787{
    78     delete m_combo;
     88    // If we create a proxy, then the deletion of the proxy and the
     89    // combo will be done by the proxy's parent (QGraphicsWebView)
     90    if (!m_proxy)
     91        delete m_combo;
    7992}
    8093
     
    8295{
    8396    populate();
    84     m_combo->setParent(pageClient()->ownerWidget());
    8597    m_combo->setCurrentIndex(currentIndex());
     98    QRect rect = geometry();
     99    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) {
     100        if (!m_proxy) {
     101            m_proxy = new QGraphicsProxyWidget(webView);
     102            m_proxy->setWidget(m_combo);
     103        } else
     104            m_proxy->setVisible(true);
     105        m_proxy->setGeometry(rect);
     106    } else {
     107        m_combo->setParent(pageClient()->ownerWidget());
     108        m_combo->setGeometry(QRect(rect.left(), rect.top(),
     109                               rect.width(), m_combo->sizeHint().height()));
    86110
    87     QRect rect = geometry();
    88     m_combo->setGeometry(QRect(rect.left(), rect.top(),
    89                                rect.width(), m_combo->sizeHint().height()));
     111    }
    90112
    91113    QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
  • trunk/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h

    r53610 r53769  
    2424#include <QComboBox>
    2525
     26class QGraphicsProxyWidget;
     27
    2628namespace WebCore {
    2729
     
    4446    bool m_popupVisible;
    4547    QtFallbackWebPopupCombo* m_combo;
     48    QGraphicsProxyWidget* m_proxy;
    4649
    4750    void populate();
Note: See TracChangeset for help on using the changeset viewer.