Changeset 77212 in webkit


Ignore:
Timestamp:
Jan 31, 2011 8:34:42 PM (13 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2011-01-31 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] QWebElements example from QtWebKit Bridge documentation does not work at all
https://bugs.webkit.org/show_bug.cgi?id=46748

This problem disappears when we register QWebElement using qRegisterMetaType, which we now do in QtInstance.
Added a regression test to tst_QWebFrame.

  • bridge/qt/qt_instance.cpp: (JSC::Bindings::QtInstance::QtInstance):

2011-01-31 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] QWebElements example from QtWebKit Bridge documentation does not work at all
https://bugs.webkit.org/show_bug.cgi?id=46748

Problem was that we need to register QWebElement's variant-type to Qt's meta type system at some point.
This wasn't caught by previous tests inside tst_QWebFrame because it only appears when there's also a QWebElement property.
Added a regression test to tst_QWebFrame.

  • tests/qwebframe/tst_qwebframe.cpp: (MyWebElementSlotOnlyObject::doSomethingWithWebElement): (MyWebElementSlotOnlyObject::tagName):
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77211 r77212  
     12011-01-31  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] QWebElements example from QtWebKit Bridge documentation does not work at all
     6        https://bugs.webkit.org/show_bug.cgi?id=46748
     7
     8        This problem disappears when we register QWebElement using qRegisterMetaType, which we now do in QtInstance.
     9        Added a regression test to tst_QWebFrame.
     10
     11        * bridge/qt/qt_instance.cpp:
     12        (JSC::Bindings::QtInstance::QtInstance):
     13
    1142011-01-27  MORITA Hajime  <morrita@google.com>
    215
  • trunk/Source/WebCore/bridge/qt/qt_instance.cpp

    r77156 r77212  
    3535#include <qmetaobject.h>
    3636#include <qmetatype.h>
     37#include <qwebelement.h>
    3738
    3839namespace JSC {
     
    8586    , m_ownership(ownership)
    8687{
     88    // This is a good place to register Qt metatypes that are in the QtWebKit module, as this is class will initialize if we have a QObject bridge.
     89    qRegisterMetaType<QWebElement>();
    8790}
    8891
  • trunk/Source/WebKit/qt/ChangeLog

    r77183 r77212  
     12011-01-31  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] QWebElements example from QtWebKit Bridge documentation does not work at all
     6        https://bugs.webkit.org/show_bug.cgi?id=46748
     7
     8        Problem was that we need to register QWebElement's variant-type to Qt's meta type system at some point.
     9        This wasn't caught by previous tests inside tst_QWebFrame because it only appears when there's also a QWebElement property.
     10        Added a regression test to tst_QWebFrame.
     11
     12        * tests/qwebframe/tst_qwebframe.cpp:
     13        (MyWebElementSlotOnlyObject::doSomethingWithWebElement):
     14        (MyWebElementSlotOnlyObject::tagName):
     15
    1162011-01-31  Srikumar Bonda  <srikumar.b@gmail.com>
    217
  • trunk/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp

    r75467 r77212  
    515515};
    516516
     517class MyWebElementSlotOnlyObject : public QObject {
     518    Q_OBJECT
     519    Q_PROPERTY(QString tagName READ tagName)
     520public slots:
     521    void doSomethingWithWebElement(const QWebElement& element)
     522    {
     523        m_tagName = element.tagName();
     524    }
     525
     526public:
     527    QString tagName() const
     528    {
     529        return m_tagName;
     530    }
     531private:
     532    QString m_tagName;
     533};
     534
    517535class MyOtherQObject : public MyQObject
    518536{
     
    585603    void findChildren();
    586604    void overloadedSlots();
     605    void webElementSlotOnly();
    587606    void enumerate_data();
    588607    void enumerate();
     
    32583277}
    32593278
     3279void tst_QWebFrame::webElementSlotOnly()
     3280{
     3281    MyWebElementSlotOnlyObject object;
     3282    m_page->mainFrame()->setHtml("<html><head><body></body></html>");
     3283    m_page->mainFrame()->addToJavaScriptWindowObject("myWebElementSlotObject", &object);
     3284    evalJS("myWebElementSlotObject.doSomethingWithWebElement(document.body)");
     3285    QCOMPARE(evalJS("myWebElementSlotObject.tagName"), QString("BODY"));
     3286}
     3287
    32603288QTEST_MAIN(tst_QWebFrame)
    32613289#include "tst_qwebframe.moc"
Note: See TracChangeset for help on using the changeset viewer.