Commit cf872146 authored by eric@webkit.org's avatar eric@webkit.org

2010-06-13 Noam Rosenthal <noam.rosenthal@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] tests/hybridPixmap fails
        https://bugs.webkit.org/show_bug.cgi?id=37316

        The problem was that JSC::Instance::createRuntimeObject was never called.
        This is fixed by overloading newRuntimeObject and calling Instance::createRuntimeObject
        in between, instead of creating the runtime object directly inside the static function
        QtPixmapInstance::createRuntimeObject, which had to be renamed as to not overshadow the virtual function.

        This fixes an existing test, tests/hybridPixmap

        * bridge/qt/qt_pixmapruntime.cpp:
        (JSC::Bindings::QtPixmapInstance::newRuntimeObject):
        (JSC::Bindings::QtPixmapInstance::createPixmapRuntimeObject):
        * bridge/qt/qt_pixmapruntime.h:
        * bridge/qt/qt_runtime.cpp:
        (JSC::Bindings::convertQVariantToValue):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@61089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 561a129f
2010-06-13 Noam Rosenthal <noam.rosenthal@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] tests/hybridPixmap fails
https://bugs.webkit.org/show_bug.cgi?id=37316
The problem was that JSC::Instance::createRuntimeObject was never called.
This is fixed by overloading newRuntimeObject and calling Instance::createRuntimeObject
in between, instead of creating the runtime object directly inside the static function
QtPixmapInstance::createRuntimeObject, which had to be renamed as to not overshadow the virtual function.
This fixes an existing test, tests/hybridPixmap
* bridge/qt/qt_pixmapruntime.cpp:
(JSC::Bindings::QtPixmapInstance::newRuntimeObject):
(JSC::Bindings::QtPixmapInstance::createPixmapRuntimeObject):
* bridge/qt/qt_pixmapruntime.h:
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::convertQVariantToValue):
2010-06-13 Noam Rosenthal <noam.rosenthal@nokia.com>
Reviewed by Darin Adler.
......
......@@ -346,10 +346,17 @@ returnEmptyVariant:
return QVariant::fromValue<QImage>(QImage());
return QVariant();
}
JSObject* QtPixmapInstance::createRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data)
RuntimeObject* QtPixmapInstance::newRuntimeObject(ExecState* exec)
{
return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), this);
}
JSObject* QtPixmapInstance::createPixmapRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data)
{
JSLock lock(SilenceAssertionsOnly);
return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), new QtPixmapInstance(root, data));
QtPixmapInstance* instance = new QtPixmapInstance(root, data);
return instance->createRuntimeObject(exec);
}
bool QtPixmapInstance::canHandle(QMetaType::Type hint)
......
......@@ -42,7 +42,8 @@ public:
int height() const;
QPixmap toPixmap();
QImage toImage();
static JSObject* createRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&);
RuntimeObject* newRuntimeObject(ExecState* exec);
static JSObject* createPixmapRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&);
static QVariant variantFromObject(JSObject*, QMetaType::Type hint);
static bool canHandle(QMetaType::Type hint);
};
......
......@@ -877,7 +877,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
}
if (QtPixmapInstance::canHandle(static_cast<QMetaType::Type>(variant.type())))
return QtPixmapInstance::createRuntimeObject(exec, root, variant);
return QtPixmapInstance::createPixmapRuntimeObject(exec, root, variant);
if (type == qMetaTypeId<QWebElement>()) {
if (!root->globalObject()->inherits(&JSDOMWindow::s_info))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment