[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e
noam.rosenthal at nokia.com
noam.rosenthal at nokia.com
Fri Jan 21 14:52:23 UTC 2011
The following commit has been merged in the debian/experimental branch:
commit aa0eacc7b0caae230fabb669199283c3f8d1596b
Author: noam.rosenthal at nokia.com <noam.rosenthal at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 3 19:01:58 2011 +0000
2011-01-03 Noam Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Andreas Kling.
[Qt] document.getElementById(...) doesn't return the right object in combination with QGraphicsWidget
https://bugs.webkit.org/show_bug.cgi?id=51464
Added a way to bind any QObject created as a plugin to JavaScript,
by adding a custom member (qtObject) to WebCore::Widget.
Added a test to tst_qwebpage to make sure plugins created
as QGraphicsWidget are accessible through JavaScript.
* bindings/js/ScriptControllerQt.cpp:
(WebCore::ScriptController::createScriptInstanceForWidget):
* platform/Widget.h:
* platform/qt/WidgetQt.cpp:
(WebCore::Widget::Widget):
(WebCore::Widget::setBindingObject):
(WebCore::Widget::bindingObject):
2011-01-03 Noam Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Andreas Kling.
[Qt] document.getElementById(...) doesn't return the right object in combination with QGraphicsWidget
https://bugs.webkit.org/show_bug.cgi?id=51464
Added a way to bind any QObject created as a plugin to JavaScript,
by adding a custom membe to WebCore::Widget.
Added a test to make sure plugins created as QGraphicsWidget are
accessible through JavaScript.
* WebCoreSupport/FrameLoaderClientQt.cpp:
* tests/qwebpage/tst_qwebpage.cpp:
(PluginPage::createPlugin):
(tst_QWebPage::graphicsWidgetPlugin):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index db3efe3..9fc9564 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2011-01-03 Noam Rosenthal <noam.rosenthal at nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] document.getElementById(...) doesn't return the right object in combination with QGraphicsWidget
+ https://bugs.webkit.org/show_bug.cgi?id=51464
+
+ Added a way to bind any QObject created as a plugin to JavaScript,
+ by adding a custom member (qtObject) to WebCore::Widget.
+ Added a test to tst_qwebpage to make sure plugins created
+ as QGraphicsWidget are accessible through JavaScript.
+
+ * bindings/js/ScriptControllerQt.cpp:
+ (WebCore::ScriptController::createScriptInstanceForWidget):
+ * platform/Widget.h:
+ * platform/qt/WidgetQt.cpp:
+ (WebCore::Widget::Widget):
+ (WebCore::Widget::setBindingObject):
+ (WebCore::Widget::bindingObject):
+
2011-01-03 David Hyatt <hyatt at apple.com>
Reviewed by Simon Fraser.
diff --git a/WebCore/bindings/js/ScriptControllerQt.cpp b/WebCore/bindings/js/ScriptControllerQt.cpp
index 55d4ba4..ee7ceff 100644
--- a/WebCore/bindings/js/ScriptControllerQt.cpp
+++ b/WebCore/bindings/js/ScriptControllerQt.cpp
@@ -53,10 +53,15 @@ PassRefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWid
return pluginView->bindingInstance();
}
- QWidget* platformWidget = widget->platformWidget();
- if (!platformWidget)
+ QObject* object = widget->bindingObject();
+
+ if (!object)
+ object = widget->platformWidget();
+
+ if (!object)
return 0;
- return JSC::Bindings::QtInstance::getQtInstance(platformWidget, bindingRootObject(), QScriptEngine::QtOwnership);
+
+ return JSC::Bindings::QtInstance::getQtInstance(object, bindingRootObject(), QScriptEngine::QtOwnership);
}
}
diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h
index c6c1d9a..b18330b 100644
--- a/WebCore/platform/Widget.h
+++ b/WebCore/platform/Widget.h
@@ -41,6 +41,7 @@
#if PLATFORM(QT)
#include <qglobal.h>
+#include <QWeakPointer>
#endif
#if PLATFORM(MAC)
@@ -234,6 +235,11 @@ public:
virtual bool isPluginContainer() const { return false; }
#endif
+#if PLATFORM(QT)
+ QObject* bindingObject() const;
+ void setBindingObject(QObject*);
+#endif
+
// Virtual methods to convert points to/from the containing ScrollView
virtual IntRect convertToContainingView(const IntRect&) const;
virtual IntRect convertFromContainingView(const IntRect&) const;
@@ -278,6 +284,10 @@ private:
WidgetPrivate* m_data;
#endif
+#if PLATFORM(QT)
+ QWeakPointer<QObject> m_bindingObject;
+#endif
+
#if PLATFORM(HAIKU)
PlatformWidget m_topLevelPlatformWidget;
#endif
diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp
index e64d655..5215e66 100644
--- a/WebCore/platform/qt/WidgetQt.cpp
+++ b/WebCore/platform/qt/WidgetQt.cpp
@@ -110,6 +110,16 @@ void Widget::setIsSelected(bool)
notImplemented();
}
+void Widget::setBindingObject(QObject* object)
+{
+ m_bindingObject = object;
+}
+
+QObject* Widget::bindingObject() const
+{
+ return m_bindingObject.data();
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index fb68283..25d562a 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,20 @@
+2011-01-03 Noam Rosenthal <noam.rosenthal at nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] document.getElementById(...) doesn't return the right object in combination with QGraphicsWidget
+ https://bugs.webkit.org/show_bug.cgi?id=51464
+
+ Added a way to bind any QObject created as a plugin to JavaScript,
+ by adding a custom membe to WebCore::Widget.
+ Added a test to make sure plugins created as QGraphicsWidget are
+ accessible through JavaScript.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (PluginPage::createPlugin):
+ (tst_QWebPage::graphicsWidgetPlugin):
+
2011-01-02 Antonio Gomes <agomes at rim.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index fbf3e89..e83d5ef 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -1445,7 +1445,12 @@ public:
graphicsWidget->hide();
}
private:
- QtPluginGraphicsWidget(QGraphicsWidget* w = 0): Widget(0), graphicsWidget(w) {}
+ QtPluginGraphicsWidget(QGraphicsWidget* w = 0)
+ : Widget(0)
+ , graphicsWidget(w)
+ {
+ setBindingObject(graphicsWidget);
+ }
QGraphicsWidget* graphicsWidget;
};
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 2c4b389..6cf5b49 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -91,6 +91,7 @@ private slots:
void destroyPlugin();
void createViewlessPlugin_data();
void createViewlessPlugin();
+ void graphicsWidgetPlugin();
void multiplePageGroupsAndLocalStorage();
void cursorMovements();
void textSelection();
@@ -588,6 +589,8 @@ protected:
result = new QPushButton();
else if (classid == "lineedit")
result = new QLineEdit();
+ else if (classid == "graphicswidget")
+ result = new QGraphicsWidget();
if (result)
result->setObjectName(classid);
calls.append(CallInfo(classid, url, paramNames, paramValues, result));
@@ -677,6 +680,54 @@ static void createPlugin(QWebView *view)
}
}
+void tst_QWebPage::graphicsWidgetPlugin()
+{
+ m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+ QGraphicsWebView webView;
+
+ QSignalSpy loadSpy(&webView, SIGNAL(loadFinished(bool)));
+
+ PluginPage* newPage = new PluginPage(&webView);
+ webView.setPage(newPage);
+
+ // type has to be application/x-qt-plugin
+ webView.setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='graphicswidget' id='mygraphicswidget'/></body></html>"));
+ QTRY_COMPARE(loadSpy.count(), 1);
+ QCOMPARE(newPage->calls.count(), 0);
+
+ webView.setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='graphicswidget' id='mygraphicswidget'/></body></html>"));
+ QTRY_COMPARE(loadSpy.count(), 2);
+ QCOMPARE(newPage->calls.count(), 1);
+ {
+ PluginPage::CallInfo ci = newPage->calls.takeFirst();
+ QCOMPARE(ci.classid, QString::fromLatin1("graphicswidget"));
+ QCOMPARE(ci.url, QUrl());
+ QCOMPARE(ci.paramNames.count(), 3);
+ QCOMPARE(ci.paramValues.count(), 3);
+ QCOMPARE(ci.paramNames.at(0), QString::fromLatin1("type"));
+ QCOMPARE(ci.paramValues.at(0), QString::fromLatin1("application/x-qt-plugin"));
+ QCOMPARE(ci.paramNames.at(1), QString::fromLatin1("classid"));
+ QCOMPARE(ci.paramValues.at(1), QString::fromLatin1("graphicswidget"));
+ QCOMPARE(ci.paramNames.at(2), QString::fromLatin1("id"));
+ QCOMPARE(ci.paramValues.at(2), QString::fromLatin1("mygraphicswidget"));
+ QVERIFY(ci.returnValue);
+ QVERIFY(ci.returnValue->inherits("QGraphicsWidget"));
+ }
+ // test JS bindings
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("document.getElementById('mygraphicswidget').toString()").toString(),
+ QString::fromLatin1("[object HTMLObjectElement]"));
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("mygraphicswidget.toString()").toString(),
+ QString::fromLatin1("[object HTMLObjectElement]"));
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("typeof mygraphicswidget.objectName").toString(),
+ QString::fromLatin1("string"));
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("mygraphicswidget.objectName").toString(),
+ QString::fromLatin1("graphicswidget"));
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("typeof mygraphicswidget.geometryChanged").toString(),
+ QString::fromLatin1("function"));
+ QCOMPARE(newPage->mainFrame()->evaluateJavaScript("mygraphicswidget.geometryChanged.toString()").toString(),
+ QString::fromLatin1("function geometryChanged() {\n [native code]\n}"));
+}
+
void tst_QWebPage::createPluginWithPluginsEnabled()
{
m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list