OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Lesser General Public | 5 * modify it under the terms of the GNU Lesser General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 837 |
838 if (type == QMetaType::QByteArray) { | 838 if (type == QMetaType::QByteArray) { |
839 QByteArray qtByteArray = variant.value<QByteArray>(); | 839 QByteArray qtByteArray = variant.value<QByteArray>(); |
840 WTF::RefPtr<WTF::ByteArray> wtfByteArray = WTF::ByteArray::create(qtByte
Array.length()); | 840 WTF::RefPtr<WTF::ByteArray> wtfByteArray = WTF::ByteArray::create(qtByte
Array.length()); |
841 qMemCopy(wtfByteArray->data(), qtByteArray.constData(), qtByteArray.leng
th()); | 841 qMemCopy(wtfByteArray->data(), qtByteArray.constData(), qtByteArray.leng
th()); |
842 return new (exec) JSC::JSByteArray(exec, JSC::JSByteArray::createStructu
re(jsNull()), wtfByteArray.get()); | 842 return new (exec) JSC::JSByteArray(exec, JSC::JSByteArray::createStructu
re(jsNull()), wtfByteArray.get()); |
843 } | 843 } |
844 | 844 |
845 if (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar) { | 845 if (type == QMetaType::QObjectStar || type == QMetaType::QWidgetStar) { |
846 QObject* obj = variant.value<QObject*>(); | 846 QObject* obj = variant.value<QObject*>(); |
847 return QtInstance::getQtInstance(obj, root, QScriptEngine::QtOwnership)-
>createRuntimeObject(exec); | 847 return QtInstance::getQtInstance(obj, root)->createRuntimeObject(exec); |
848 } | 848 } |
849 | 849 |
850 if (type == QMetaType::QVariantMap) { | 850 if (type == QMetaType::QVariantMap) { |
851 // create a new object, and stuff properties into it | 851 // create a new object, and stuff properties into it |
852 JSObject* ret = constructEmptyObject(exec); | 852 JSObject* ret = constructEmptyObject(exec); |
853 QVariantMap map = variant.value<QVariantMap>(); | 853 QVariantMap map = variant.value<QVariantMap>(); |
854 QVariantMap::const_iterator i = map.constBegin(); | 854 QVariantMap::const_iterator i = map.constBegin(); |
855 while (i != map.constEnd()) { | 855 while (i != map.constEnd()) { |
856 QString s = i.key(); | 856 QString s = i.key(); |
857 JSValuePtr val = convertQVariantToValue(exec, root, i.value()); | 857 JSValuePtr val = convertQVariantToValue(exec, root, i.value()); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 } else { | 1686 } else { |
1687 l.append(jsUndefined()); | 1687 l.append(jsUndefined()); |
1688 } | 1688 } |
1689 } | 1689 } |
1690 CallData callData; | 1690 CallData callData; |
1691 CallType callType = m_funcObject->getCallData(callData); | 1691 CallType callType = m_funcObject->getCallData(callData); |
1692 // Stuff in the __qt_sender property, if we can | 1692 // Stuff in the __qt_sender property, if we can |
1693 if (m_funcObject->inherits(&JSFunction::info)) { | 1693 if (m_funcObject->inherits(&JSFunction::info)) { |
1694 JSFunction* fimp = static_cast<JSFunction*>(m_funcObject
.get()); | 1694 JSFunction* fimp = static_cast<JSFunction*>(m_funcObject
.get()); |
1695 | 1695 |
1696 JSObject* qt_sender = QtInstance::getQtInstance(sender()
, ro, QScriptEngine::QtOwnership)->createRuntimeObject(exec); | 1696 JSObject* qt_sender = QtInstance::getQtInstance(sender()
, ro)->createRuntimeObject(exec); |
1697 JSObject* wrapper = new (exec) JSObject(JSObject::create
Structure(jsNull())); | 1697 JSObject* wrapper = new (exec) JSObject(JSObject::create
Structure(jsNull())); |
1698 PutPropertySlot slot; | 1698 PutPropertySlot slot; |
1699 wrapper->put(exec, Identifier(exec, "__qt_sender__"), qt
_sender, slot); | 1699 wrapper->put(exec, Identifier(exec, "__qt_sender__"), qt
_sender, slot); |
1700 ScopeChain oldsc = fimp->scope(); | 1700 ScopeChain oldsc = fimp->scope(); |
1701 ScopeChain sc = oldsc; | 1701 ScopeChain sc = oldsc; |
1702 sc.push(wrapper); | 1702 sc.push(wrapper); |
1703 fimp->setScope(sc); | 1703 fimp->setScope(sc); |
1704 | 1704 |
1705 call(exec, fimp, callType, callData, m_thisObject, l); | 1705 call(exec, fimp, callType, callData, m_thisObject, l); |
1706 fimp->setScope(oldsc); | 1706 fimp->setScope(oldsc); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 return convertQVariantToValue(exec, rootObject(), QVariant::fromValue(va
l)); | 1764 return convertQVariantToValue(exec, rootObject(), QVariant::fromValue(va
l)); |
1765 } | 1765 } |
1766 | 1766 |
1767 return jsUndefined(); | 1767 return jsUndefined(); |
1768 } | 1768 } |
1769 | 1769 |
1770 // =============== | 1770 // =============== |
1771 | 1771 |
1772 } } | 1772 } } |
1773 | 1773 |
OLD | NEW |