[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hausmann at webkit.org hausmann at webkit.org
Wed Apr 7 23:30:40 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 94db85c9136c46b55ec69837362d09c286986979
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 11 13:19:35 2009 +0000

    WebCore: Introduce a function for querying the input method status
    in QWebPageClient.
    
    Reviewed by Tor Arne Vestbø.
    
    * platform/qt/QWebPageClient.h:
    
    WebKit/qt: Fix enabling of software input panel when activating editable elements
    in QGraphicsWebView.
    
    Reviewed by Tor Arne Vestbø.
    
    * Api/qgraphicswebview.cpp:
    (QGraphicsWebViewPrivate::inputMethodEnabled): Implement method to
    query for input method support.
    * Api/qwebpage.cpp:
    (QWebPageWidgetClient::inputMethodEnabled): Ditto for QWidget.
    (QWebPagePrivate::handleSoftwareInputPanel): Don't use view() to
    test for input method support. Instead query using QWebPageClient
    and send the SIPR event to the ownerWidget() instead of the view().
    The latter is null for QGraphicsWebView.
    * tests/qwebpage/tst_qwebpage.cpp:
    (EventSpy::EventSpy):
    (EventSpy::eventFilter):
    (tst_QWebPage::inputMethods): Modify the test to verify that SIPR
    events are dispatched when activating focusable content.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50801 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2e957b1..70c0540 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-11  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Tor Arne Vestbø.
+
+        Introduce a function for querying the input method status
+        in QWebPageClient.
+
+        * platform/qt/QWebPageClient.h:
+
 2009-11-11  Benjamin Otte  <otte at gnome.org>
 
         Reviewed by Jan Alonzo.
diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h
index bd99db0..61adb97 100644
--- a/WebCore/platform/qt/QWebPageClient.h
+++ b/WebCore/platform/qt/QWebPageClient.h
@@ -35,6 +35,7 @@ public:
     virtual void scroll(int dx, int dy, const QRect&) = 0;
     virtual void update(const QRect&) = 0;
     virtual void setInputMethodEnabled(bool enable) = 0;
+    virtual bool inputMethodEnabled() const = 0;
 #if QT_VERSION >= 0x040600
     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0;
 #endif
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
index d1f3214..9c4a595 100644
--- a/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -45,6 +45,7 @@ public:
     virtual void scroll(int dx, int dy, const QRect&);
     virtual void update(const QRect& dirtyRect);
     virtual void setInputMethodEnabled(bool enable);
+    virtual bool inputMethodEnabled() const;
 #if QT_VERSION >= 0x040600
     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable);
 #endif
@@ -97,6 +98,15 @@ void QGraphicsWebViewPrivate::setInputMethodEnabled(bool enable)
 #endif
 }
 
+bool QGraphicsWebViewPrivate::inputMethodEnabled() const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    return q->flags() & QGraphicsItem::ItemAcceptsInputMethod;
+#else
+    return false;
+#endif
+}
+
 #if QT_VERSION >= 0x040600
 void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable)
 {
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 830f454..db124d9 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -153,6 +153,7 @@ public:
     virtual void scroll(int dx, int dy, const QRect&);
     virtual void update(const QRect& dirtyRect);
     virtual void setInputMethodEnabled(bool enable);
+    virtual bool inputMethodEnabled() const;
 #if QT_VERSION >= 0x040600
     virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable);
 #endif
@@ -185,6 +186,12 @@ void QWebPageWidgetClient::setInputMethodEnabled(bool enable)
 {
     view->setAttribute(Qt::WA_InputMethodEnabled, enable);
 }
+
+bool QWebPageWidgetClient::inputMethodEnabled() const
+{
+    return view->testAttribute(Qt::WA_InputMethodEnabled);
+}
+
 #if QT_VERSION >= 0x040600
 void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable)
 {
@@ -857,13 +864,13 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
 void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button)
 {
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-    if (q->view() && q->view()->testAttribute(Qt::WA_InputMethodEnabled)
+    if (client && client->inputMethodEnabled()
         && button == Qt::LeftButton && qApp->autoSipEnabled()) {
         QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
-            q->view()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+            client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
         if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
             QEvent event(QEvent::RequestSoftwareInputPanel);
-            QApplication::sendEvent(q->view(), &event);
+            QApplication::sendEvent(client->ownerWidget(), &event);
         }
     }
 
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 714234e..38dc6a0 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,25 @@
+2009-11-11  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Tor Arne Vestbø.
+
+        Fix enabling of software input panel when activating editable elements
+        in QGraphicsWebView.
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebViewPrivate::inputMethodEnabled): Implement method to
+        query for input method support.
+        * Api/qwebpage.cpp:
+        (QWebPageWidgetClient::inputMethodEnabled): Ditto for QWidget.
+        (QWebPagePrivate::handleSoftwareInputPanel): Don't use view() to
+        test for input method support. Instead query using QWebPageClient
+        and send the SIPR event to the ownerWidget() instead of the view().
+        The latter is null for QGraphicsWebView.
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (EventSpy::EventSpy):
+        (EventSpy::eventFilter):
+        (tst_QWebPage::inputMethods): Modify the test to verify that SIPR
+        events are dispatched when activating focusable content.
+
 2009-11-10  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
         Unreviewed documentation fixes.
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 87077e0..ca5dfb6 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -81,6 +81,22 @@ static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
     return timeoutSpy.isEmpty();
 }
 
+class EventSpy : public QObject, public QList<QEvent::Type>
+{
+    Q_OBJECT
+public:
+    EventSpy(QObject* objectToSpy)
+    {
+        objectToSpy->installEventFilter(this);
+    }
+
+    virtual bool eventFilter(QObject* receiver, QEvent* event)
+    {
+        append(event->type());
+        return false;
+    }
+};
+
 class tst_QWebPage : public QObject
 {
     Q_OBJECT
@@ -1334,6 +1350,8 @@ void tst_QWebPage::inputMethods()
                                             "</body></html>");
     page->mainFrame()->setFocus();
 
+    EventSpy viewEventSpy(container);
+
     QWebElementCollection inputs = page->mainFrame()->documentElement().findAll("input");
 
     QMouseEvent evpres(QEvent::MouseButtonPress, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
@@ -1341,6 +1359,18 @@ void tst_QWebPage::inputMethods()
     QMouseEvent evrel(QEvent::MouseButtonRelease, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
     page->event(&evrel);
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
+#endif
+    viewEventSpy.clear();
+
+    page->event(&evpres);
+    page->event(&evrel);
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
+#endif
+
     //ImMicroFocus
     QVariant variant = page->inputMethodQuery(Qt::ImMicroFocus);
     QRect focusRect = variant.toRect();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list