diff options
Diffstat (limited to 'src/qml/qml')
52 files changed, 732 insertions, 365 deletions
diff --git a/src/qml/qml/ftw/qfastmetabuilder.cpp b/src/qml/qml/ftw/qfastmetabuilder.cpp index 9663c1e944..02f50911ea 100644 --- a/src/qml/qml/ftw/qfastmetabuilder.cpp +++ b/src/qml/qml/ftw/qfastmetabuilder.cpp @@ -42,6 +42,8 @@ #include "qfastmetabuilder_p.h" #include <QtCore/qmetaobject.h> +#include <private/qobject_p.h> +#include <private/qmetaobject_p.h> QT_BEGIN_NAMESPACE @@ -50,65 +52,6 @@ struct QFastMetaBuilderHeader int fieldCount; }; -struct QMetaObjectPrivate -{ - int revision; - int className; - int classInfoCount, classInfoData; - int methodCount, methodData; - int propertyCount, propertyData; - int enumeratorCount, enumeratorData; - int constructorCount, constructorData; //since revision 2 - int flags; //since revision 3 - int signalCount; //since revision 4 -}; - -enum MetaObjectFlag { - DynamicMetaObject = 0x01 -}; - -enum PropertyFlags { - Invalid = 0x00000000, - Readable = 0x00000001, - Writable = 0x00000002, - Resettable = 0x00000004, - EnumOrFlag = 0x00000008, - StdCppSet = 0x00000100, -// Override = 0x00000200, - Constant = 0x00000400, - Final = 0x00000800, - Designable = 0x00001000, - ResolveDesignable = 0x00002000, - Scriptable = 0x00004000, - ResolveScriptable = 0x00008000, - Stored = 0x00010000, - ResolveStored = 0x00020000, - Editable = 0x00040000, - ResolveEditable = 0x00080000, - User = 0x00100000, - ResolveUser = 0x00200000, - Notify = 0x00400000, - Revisioned = 0x00800000 -}; - -enum MethodFlags { - AccessPrivate = 0x00, - AccessProtected = 0x01, - AccessPublic = 0x02, - AccessMask = 0x03, //mask - - MethodMethod = 0x00, - MethodSignal = 0x04, - MethodSlot = 0x08, - MethodConstructor = 0x0c, - MethodTypeMask = 0x0c, - - MethodCompatibility = 0x10, - MethodCloned = 0x20, - MethodScriptable = 0x40, - MethodRevisioned = 0x80 -}; - #define FMBHEADER_FIELD_COUNT 1 #define HEADER_FIELD_COUNT 14 @@ -175,7 +118,7 @@ QFastMetaBuilder::StringRef QFastMetaBuilder::init(int classNameLength, int dataIndex = HEADER_FIELD_COUNT; - p->revision = 4; + p->revision = 6; p->className = 0; // Class infos @@ -364,6 +307,7 @@ void QFastMetaBuilder::fromData(QMetaObject *output, const QMetaObject *parent, output->d.superdata = parent; output->d.stringdata = data.constData() + header(data)->fieldCount * sizeof(uint); output->d.data = fieldPointer(data); + output->d.extradata = 0; } QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 6f552450ef..ca6b13e7f8 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -170,12 +170,18 @@ int QQmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { if (!m_expression) return -1; - if (QQmlDebugService::isDebuggingEnabled()) { - QQmlProfilerService::startRange(QQmlProfilerService::HandlingSignal); - QQmlProfilerService::rangeData(QQmlProfilerService::HandlingSignal, QLatin1String(m_signal.signature()) % QLatin1String(": ") % m_expression->expression()); - QQmlProfilerService::rangeLocation(QQmlProfilerService::HandlingSignal, m_expression->sourceFile(), m_expression->lineNumber(), m_expression->columnNumber()); + + if (QQmlDebugService::isDebuggingEnabled()) QV8DebugService::instance()->signalEmitted(QString::fromAscii(m_signal.signature())); + + QQmlHandlingSignalProfiler prof; + if (prof.enabled) { + prof.setSignalInfo(QString::fromLatin1(m_signal.signature()), + m_expression->expression()); + prof.setLocation(m_expression->sourceFile(), m_expression->lineNumber(), + m_expression->columnNumber()); } + m_isEvaluating = true; if (!m_paramsValid) { if (!m_signal.parameterTypes().isEmpty()) @@ -191,7 +197,6 @@ int QQmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } if (m_params) m_params->clearValues(); m_isEvaluating = false; - QQmlProfilerService::endRange(QQmlProfilerService::HandlingSignal); return -1; } else { return QObject::qt_metacall(c, id, a); diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 65247e1e80..23c4adc7b4 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -3609,16 +3609,19 @@ bool QQmlCompiler::completeComponentBuild() bool isSharable = false; binding.rewrittenExpression = rewriteBinding(binding.expression.asAST(), expression, &isSharable); - if (isSharable && !binding.property->isValueTypeSubProperty && !binding.property->isAlias /* See above re alias */ && + if (isSharable && !binding.property->isAlias /* See above re alias */ && binding.property->type != qMetaTypeId<QQmlBinding*>()) { binding.dataType = BindingReference::V8; sharedBindings.append(b); + + if (componentStats) + componentStats->componentStat.sharedBindings.append(b->value->location); } else { binding.dataType = BindingReference::QtScript; - } - if (componentStats) - componentStats->componentStat.scriptBindings.append(b->value->location); + if (componentStats) + componentStats->componentStat.scriptBindings.append(b->value->location); + } } if (!sharedBindings.isEmpty()) { @@ -3699,6 +3702,25 @@ void QQmlCompiler::dumpStats() qWarning().nospace() << output.constData(); } + qWarning().nospace() << " Shared Bindings: " << stat.sharedBindings.count(); + { + QByteArray output; + for (int ii = 0; ii < stat.sharedBindings.count(); ++ii) { + if (0 == (ii % 10)) { + if (ii) output.append("\n"); + output.append(" "); + } + + output.append("("); + output.append(QByteArray::number(stat.sharedBindings.at(ii).start.line)); + output.append(":"); + output.append(QByteArray::number(stat.sharedBindings.at(ii).start.column)); + output.append(") "); + } + if (!output.isEmpty()) + qWarning().nospace() << output.constData(); + } + qWarning().nospace() << " QScript Bindings: " << stat.scriptBindings.count(); { QByteArray output; diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 9b13b7e63b..3b6fdf1473 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -450,6 +450,7 @@ private: int ids; QList<QQmlScript::LocationSpan> scriptBindings; + QList<QQmlScript::LocationSpan> sharedBindings; QList<QQmlScript::LocationSpan> optimizedBindings; int objects; }; diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index e168f063c0..5dd8fc8ae9 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -51,6 +51,7 @@ #include "qqmlengine.h" #include "qqmlbinding_p.h" #include "qqmlbinding_p_p.h" +#include "qqmlglobal_p.h" #include "qqmlscript_p.h" #include <private/qqmlprofilerservice_p.h> #include <private/qqmlenginedebugservice_p.h> @@ -738,14 +739,15 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) QQmlEnginePrivate *enginePriv = QQmlEnginePrivate::get(engine); - bool isRoot = enginePriv->inProgressCreations == 0; + if (enginePriv->inProgressCreations == 0) { + // only track root, since further ones might not be properly nested + profiler = new QQmlObjectCreatingProfiler(); + } + enginePriv->inProgressCreations++; state.errors.clear(); state.completePending = true; - if (isRoot) - QQmlProfilerService::startRange(QQmlProfilerService::Creating); - enginePriv->referenceScarceResources(); state.vme.init(context, cc, start, creationContext); QObject *rv = state.vme.execute(&state.errors); @@ -761,13 +763,12 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) if (!context->isInternal) context->asQQmlContextPrivate()->instances.append(rv); QQmlEngineDebugService::instance()->objectCreated(engine, rv); - if (isRoot) { - QQmlProfilerService::rangeData(QQmlProfilerService::Creating, - buildTypeNameForDebug(rv->metaObject())); + + if (profiler && profiler->enabled) { + profiler->setTypeName(buildTypeNameForDebug(rv->metaObject())); QQmlData *data = QQmlData::get(rv); Q_ASSERT(data); - QQmlProfilerService::rangeLocation(QQmlProfilerService::Creating, - cc->url, data->lineNumber, data->columnNumber); + profiler->setLocation(cc->url, data->lineNumber, data->columnNumber); } } @@ -823,7 +824,8 @@ void QQmlComponentPrivate::completeCreate() QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); complete(ep, &state); - QQmlProfilerService::endRange(QQmlProfilerService::Creating); + delete profiler; + profiler = 0; } } diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index 731fb6a8a7..b03dd68936 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -62,6 +62,7 @@ #include "qqmlvme_p.h" #include "qqmlerror.h" #include "qqml.h" +#include "../debugger/qqmlprofilerservice_p.h" #include <QtCore/QString> #include <QtCore/QStringList> @@ -83,7 +84,7 @@ class Q_QML_PRIVATE_EXPORT QQmlComponentPrivate : public QObjectPrivate, public Q_DECLARE_PUBLIC(QQmlComponent) public: - QQmlComponentPrivate() : typeData(0), progress(0.), start(-1), cc(0), engine(0), creationContext(0) {} + QQmlComponentPrivate() : typeData(0), progress(0.), start(-1), cc(0), engine(0), creationContext(0), profiler(0) {} QObject *beginCreate(QQmlContextData *); void completeCreate(); @@ -116,6 +117,7 @@ public: QQmlEngine *engine; QQmlGuardedContextData creationContext; + QQmlObjectCreatingProfiler *profiler; void clear(); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 8cfe635543..ee5a0c954e 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -355,7 +355,8 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) QQmlEnginePrivate::~QQmlEnginePrivate() { - Q_ASSERT(inProgressCreations == 0); + if (inProgressCreations) + qWarning() << QQmlEngine::tr("There are still \"%1\" items in the process of being created at engine destruction.").arg(inProgressCreations); while (cleanup) { QQmlCleanup *c = cleanup; @@ -965,13 +966,13 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) QQmlData *data = QQmlData::get(object); if (data && data->deferredComponent) { - if (QQmlDebugService::isDebuggingEnabled()) { - QQmlProfilerService::startRange(QQmlProfilerService::Creating); + QQmlObjectCreatingProfiler prof; + if (prof.enabled) { QQmlType *type = QQmlMetaType::qmlType(object->metaObject()); - QString typeName = type ? type->qmlTypeName() : QString::fromUtf8(object->metaObject()->className()); - QQmlProfilerService::rangeData(QQmlProfilerService::Creating, typeName); + prof.setTypeName(type ? type->qmlTypeName() + : QString::fromUtf8(object->metaObject()->className())); if (data->outerContext) - QQmlProfilerService::rangeLocation(QQmlProfilerService::Creating, data->outerContext->url, data->lineNumber, data->columnNumber); + prof.setLocation(data->outerContext->url, data->lineNumber, data->columnNumber); } QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine); @@ -982,7 +983,6 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) data->deferredComponent = 0; QQmlComponentPrivate::complete(ep, &state); - QQmlProfilerService::endRange(QQmlProfilerService::Creating); } } @@ -1411,7 +1411,7 @@ void QQmlEngine::addImportPath(const QString& path) imports \c com.mycompany.Feature will cause the QQmlEngine to look in \c /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components provided by that module. A \c qmldir file is required for defining the - type version mapping and possibly declarative extensions plugins. + type version mapping and possibly QML extensions plugins. By default, the list contains the directory of the application executable, paths specified in the \c QML_IMPORT_PATH environment variable, diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 3fbb80c280..ecdbf21d4b 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -78,13 +78,13 @@ QQmlJavaScriptExpression::~QQmlJavaScriptExpression() clearGuards(); } -static QQmlJavaScriptExpression::VTable QDeclarativeExpressionPrivate_jsvtable = { +static QQmlJavaScriptExpression::VTable QQmlExpressionPrivate_jsvtable = { QQmlExpressionPrivate::expressionIdentifier, QQmlExpressionPrivate::expressionChanged }; QQmlExpressionPrivate::QQmlExpressionPrivate() -: QQmlJavaScriptExpression(&QDeclarativeExpressionPrivate_jsvtable), +: QQmlJavaScriptExpression(&QQmlExpressionPrivate_jsvtable), expressionFunctionValid(true), expressionFunctionRewritten(false), extractExpressionFromFunction(false), line(-1), dataRef(0) { diff --git a/src/qml/qml/qqmlextensioninterface.h b/src/qml/qml/qqmlextensioninterface.h index 63ef1adc08..194319431d 100644 --- a/src/qml/qml/qqmlextensioninterface.h +++ b/src/qml/qml/qqmlextensioninterface.h @@ -66,8 +66,13 @@ public: virtual void initializeEngine(QQmlEngine *engine, const char *uri) = 0; }; +#define QQmlTypesExtensionInterface_iid "org.qt-project.Qt.QQmlTypesExtensionInterface" + Q_DECLARE_INTERFACE(QQmlTypesExtensionInterface, "org.qt-project.Qt.QQmlTypesExtensionInterface/1.0") -Q_DECLARE_INTERFACE(QQmlExtensionInterface, "org.qt-project.Qt.QQmlExtensionInterface/1.0") + +#define QQmlExtensionInterface_iid "org.qt-project.Qt.QQmlExtensionInterface" + +Q_DECLARE_INTERFACE(QQmlExtensionInterface, QQmlExtensionInterface_iid) QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlimageprovider.h b/src/qml/qml/qqmlimageprovider.h index d59cfc42ca..fe06925123 100644 --- a/src/qml/qml/qqmlimageprovider.h +++ b/src/qml/qml/qqmlimageprovider.h @@ -59,7 +59,7 @@ class Q_QML_EXPORT QQuickTextureFactory : public QObject { public: QQuickTextureFactory(); - ~QQuickTextureFactory(); + virtual ~QQuickTextureFactory(); virtual QSGTexture *createTexture(QQuickCanvas *canvas) const = 0; virtual QSize textureSize() const = 0; diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp index ee622ba048..834d4bbb97 100644 --- a/src/qml/qml/qqmlincubator.cpp +++ b/src/qml/qml/qqmlincubator.cpp @@ -376,17 +376,18 @@ void QQmlIncubationController::incubateFor(int msecs) /*! Incubate objects while the bool pointed to by \a flag is true, or until there are no -more objects to incubate. +more objects to incubate, or up to msecs if msecs is not zero. Generally this method is used in conjunction with a thread or a UNIX signal that sets the bool pointed to by \a flag to false when it wants incubation to be interrupted. */ -void QQmlIncubationController::incubateWhile(bool *flag) +void QQmlIncubationController::incubateWhile(volatile bool *flag, int msecs) { if (!d || d->incubatorCount == 0) return; - QQmlVME::Interrupt i(flag); + QQmlVME::Interrupt i(flag, msecs * 1000000); + i.reset(); do { QQmlIncubatorPrivate *p = (QQmlIncubatorPrivate*)d->incubatorList.first(); p->incubate(i); diff --git a/src/qml/qml/qqmlincubator.h b/src/qml/qml/qqmlincubator.h index 5d8ae7d6c3..2fb2aaf2f1 100644 --- a/src/qml/qml/qqmlincubator.h +++ b/src/qml/qml/qqmlincubator.h @@ -42,6 +42,7 @@ #ifndef QQMLINCUBATOR_H #define QQMLINCUBATOR_H +#include <QtQml/qtqmlglobal.h> #include <QtQml/qqmlerror.h> QT_BEGIN_HEADER @@ -110,7 +111,7 @@ public: int incubatingObjectCount() const; void incubateFor(int msecs); - void incubateWhile(bool *flag); + void incubateWhile(volatile bool *flag, int msecs=0); protected: virtual void incubatingObjectCountChanged(int); diff --git a/src/qml/qml/qqmlinstruction.cpp b/src/qml/qml/qqmlinstruction.cpp index 72f04c9d61..b37117e69b 100644 --- a/src/qml/qml/qqmlinstruction.cpp +++ b/src/qml/qml/qqmlinstruction.cpp @@ -190,7 +190,7 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; break; case QQmlInstruction::StoreSignal: - qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); + qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value; break; case QQmlInstruction::StoreImportedScript: qWarning().nospace() << idx << "\t\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value; @@ -199,7 +199,7 @@ void QQmlCompiledData::dump(QQmlInstruction *instr, int idx) qWarning().nospace() << idx << "\t\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope << "\t" << instr->storeScriptString.bindingId; break; case QQmlInstruction::AssignSignalObject: - qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << primitives.at(instr->assignSignalObject.signal); + qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal; break; case QQmlInstruction::AssignCustomType: qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.primitive << "\t" << instr->assignCustomType.type; diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 4dc30f27ea..d684378832 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -524,7 +524,10 @@ v8::Handle<v8::Value> QQmlNumberExtension::fromLocaleString(const v8::Arguments& static v8::Handle<v8::Value> locale_get_firstDayOfWeek(v8::Local<v8::String>, const v8::AccessorInfo &info) { GET_LOCALE_DATA_RESOURCE(info.This()); - return v8::Integer::New(r->locale.firstDayOfWeek()); + int fdow = int(r->locale.firstDayOfWeek()); + if (fdow == 7) + fdow = 0; // Qt::Sunday = 7, but Sunday is 0 in JS Date + return v8::Integer::New(fdow); } static v8::Handle<v8::Value> locale_get_measurementSystem(v8::Local<v8::String>, const v8::AccessorInfo &info) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 9b132a4647..93c6aa1f00 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -50,6 +50,8 @@ #include <QtCore/qdebug.h> +#include <ctype.h> // for toupper + Q_DECLARE_METATYPE(QJSValue) Q_DECLARE_METATYPE(QQmlV8Handle); diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 095ee79867..a128cd9055 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -149,6 +149,7 @@ public: bool hasOverride() const { return !(flags & IsValueTypeVirtual) && !(flags & HasAccessors) && overrideIndex >= 0; } + bool hasRevision() const { return !(flags & HasAccessors) && revision != 0; } // Returns -1 if not a value type virtual property inline int getValueTypeCoreIndex() const; diff --git a/src/qml/qml/qqmlpropertyvalueinterceptor_p.h b/src/qml/qml/qqmlpropertyvalueinterceptor_p.h index f8b8643a00..cf449c9eff 100644 --- a/src/qml/qml/qqmlpropertyvalueinterceptor_p.h +++ b/src/qml/qml/qqmlpropertyvalueinterceptor_p.h @@ -67,7 +67,10 @@ public: virtual void setTarget(const QQmlProperty &property) = 0; virtual void write(const QVariant &value) = 0; }; -Q_DECLARE_INTERFACE(QQmlPropertyValueInterceptor, "com.trolltech.qml.QQmlPropertyValueInterceptor") + +#define QQmlPropertyValueInterceptor_iid "org.qt-project.Qt.QQmlPropertyValueInterceptor" + +Q_DECLARE_INTERFACE(QQmlPropertyValueInterceptor, QQmlPropertyValueInterceptor_iid) QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlpropertyvaluesource.h b/src/qml/qml/qqmlpropertyvaluesource.h index 910b23877e..bbd3c2f594 100644 --- a/src/qml/qml/qqmlpropertyvaluesource.h +++ b/src/qml/qml/qqmlpropertyvaluesource.h @@ -58,7 +58,10 @@ public: virtual ~QQmlPropertyValueSource(); virtual void setTarget(const QQmlProperty &) = 0; }; -Q_DECLARE_INTERFACE(QQmlPropertyValueSource, "com.trolltech.qml.QQmlPropertyValueSource") + +#define QQmlPropertyValueSource_iid "org.qt-project.Qt.QQmlPropertyValueSource" + +Q_DECLARE_INTERFACE(QQmlPropertyValueSource, QQmlPropertyValueSource_iid) QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlrewrite.cpp b/src/qml/qml/qqmlrewrite.cpp index 828f7bf641..72bd23955b 100644 --- a/src/qml/qml/qqmlrewrite.cpp +++ b/src/qml/qml/qqmlrewrite.cpp @@ -51,6 +51,45 @@ DEFINE_BOOL_CONFIG_OPTION(rewriteDump, QML_REWRITE_DUMP); namespace QQmlRewrite { +static void rewriteStringLiteral(AST::StringLiteral *ast, const QString *code, int startPosition, TextWriter *writer) +{ + const unsigned position = ast->firstSourceLocation().begin() - startPosition + 1; + const unsigned length = ast->literalToken.length - 2; + const QStringRef spell = code->midRef(position, length); + const int end = spell.size(); + int index = 0; + + while (index < end) { + const QChar ch = spell.at(index++); + + if (index < end && ch == QLatin1Char('\\')) { + int pos = index; + + // skip a possibly empty sequence of \r characters + while (pos < end && spell.at(pos) == QLatin1Char('\r')) + ++pos; + + if (pos < end && spell.at(pos) == QLatin1Char('\n')) { + // This is a `\' followed by a newline terminator. + // In this case there's nothing to replace. We keep the code + // as it is and we resume the searching. + index = pos + 1; // refresh the index + } + } else if (ch == QLatin1Char('\r') || ch == QLatin1Char('\n')) { + const QString sep = ch == QLatin1Char('\r') ? QLatin1String("\\r") : QLatin1String("\\n"); + const int pos = index - 1; + QString s = sep; + + while (index < end && spell.at(index) == ch) { + s += sep; + ++index; + } + + writer->replace(position + pos, index - pos, s); + } + } +} + bool SharedBindingTester::isSharable(const QString &code) { Engine engine; @@ -204,40 +243,7 @@ bool RewriteBinding::visit(AST::ExpressionStatement *ast) bool RewriteBinding::visit(AST::StringLiteral *ast) { - /* When rewriting the code for bindings, we have to remove ILLEGAL JS tokens like newlines. - They're still in multi-line strings, because the QML parser allows them, but we have to - rewrite them to be JS compliant. - - For performance reasons, we don't go for total correctness. \r is only replaced if a - \n was found (since most line endings are \n or \r\n) and QChar::LineSeparator is not - even considered. QTBUG-24064. - - Note that rewriteSignalHandler has a function just like this one, for the same reason. - */ - - unsigned startOfString = ast->firstSourceLocation().begin() + 1 - _position; - unsigned stringLength = ast->firstSourceLocation().length - 2; - - int lastIndex = -1; - bool foundNewLine = false; - QStringRef subStr(_code, startOfString, stringLength); - while (true) { - lastIndex = subStr.indexOf(QLatin1Char('\n'), lastIndex + 1); - if (lastIndex == -1) - break; - foundNewLine = true; - _writer->replace(startOfString+lastIndex, 1, QLatin1String("\\n")); - } - - if (foundNewLine) { - while (true) { - lastIndex = subStr.indexOf(QLatin1Char('\r'), lastIndex + 1); - if (lastIndex == -1) - break; - _writer->replace(startOfString+lastIndex, 1, QLatin1String("\\r")); - } - } - + rewriteStringLiteral(ast, _code, _position, _writer); return false; } @@ -361,6 +367,13 @@ void RewriteBinding::rewriteCaseStatements(AST::StatementList *statements, bool } } +RewriteSignalHandler::RewriteSignalHandler() + : _writer(0) + , _code(0) + , _position(0) +{ +} + void RewriteSignalHandler::accept(AST::Node *node) { AST::Node::acceptChild(node, this); @@ -368,42 +381,10 @@ void RewriteSignalHandler::accept(AST::Node *node) bool RewriteSignalHandler::visit(AST::StringLiteral *ast) { - unsigned startOfExpressionStatement = ast->firstSourceLocation().begin() - _position; - _strStarts << startOfExpressionStatement + 1; - _strLens << ast->firstSourceLocation().length - 2; - + rewriteStringLiteral(ast, _code, _position, _writer); return false; } -void RewriteSignalHandler::rewriteMultilineStrings(QString &code) -{ - QList<int> replaceR, replaceN; - for (int i=0; i < _strStarts.count(); i++) { - QStringRef curSubstr = QStringRef(&code, _strStarts[i], _strLens[i]); - int lastIndex = -1; - while (true) { - lastIndex = curSubstr.indexOf(QLatin1Char('\n'), lastIndex + 1); - if (lastIndex == -1) - break; - replaceN << _strStarts[i]+lastIndex; - } - - if (replaceN.count()) { - while (true) { - lastIndex = curSubstr.indexOf(QLatin1Char('\r'), lastIndex + 1); - if (lastIndex == -1) - break; - replaceR << _strStarts[i]+lastIndex; - } - } - } - for (int ii = replaceN.count() - 1; ii >= 0; ii--) - code.replace(replaceN[ii], 1, QLatin1String("\\n")); - if (replaceR.count()) - for (int ii = replaceR.count() - 1; ii >= 0; ii--) - code.replace(replaceR[ii], 1, QLatin1String("\\r")); -} - QString RewriteSignalHandler::operator()(QQmlJS::AST::Node *node, const QString &code, const QString &name) { if (rewriteDump()) { @@ -417,13 +398,15 @@ QString RewriteSignalHandler::operator()(QQmlJS::AST::Node *node, const QString if (!expression && !statement) return code; - _strStarts.clear(); - _strLens.clear(); + TextWriter w; + _writer = &w; + _code = &code; + _position = expression ? expression->firstSourceLocation().begin() : statement->firstSourceLocation().begin(); accept(node); QString rewritten = code; - rewriteMultilineStrings(rewritten); + w.write(&rewritten); rewritten = QStringLiteral("(function ") + name + QStringLiteral("() { ") + rewritten + QStringLiteral(" })"); diff --git a/src/qml/qml/qqmlrewrite_p.h b/src/qml/qml/qqmlrewrite_p.h index e915d797df..1d69839878 100644 --- a/src/qml/qml/qqmlrewrite_p.h +++ b/src/qml/qml/qqmlrewrite_p.h @@ -126,11 +126,12 @@ private: class RewriteSignalHandler: protected AST::Visitor { - QList<int> _strStarts; - QList<int> _strLens; + TextWriter *_writer; + const QString *_code; int _position; public: + RewriteSignalHandler(); QString operator()(QQmlJS::AST::Node *node, const QString &code, const QString &name); protected: diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index cde2885f0c..5cbb2f6943 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1578,13 +1578,12 @@ void QQmlTypeData::downloadProgressChanged(qreal p) void QQmlTypeData::compile() { Q_ASSERT(m_compiledData == 0); - QQmlProfilerService::startRange(QQmlProfilerService::Compiling); m_compiledData = new QQmlCompiledData(typeLoader()->engine()); m_compiledData->url = finalUrl(); m_compiledData->name = finalUrlString(); - QQmlProfilerService::rangeLocation(QQmlProfilerService::Compiling, QUrl(m_compiledData->name),1,1); - QQmlProfilerService::rangeData(QQmlProfilerService::Compiling, m_compiledData->name); + + QQmlCompilingProfiler prof(m_compiledData->name); QQmlCompiler compiler(&scriptParser._pool); if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { @@ -1592,7 +1591,6 @@ void QQmlTypeData::compile() m_compiledData->release(); m_compiledData = 0; } - QQmlProfilerService::endRange(QQmlProfilerService::Compiling); } void QQmlTypeData::resolveTypes() diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h index 8c8d4d079e..844f2cc98b 100644 --- a/src/qml/qml/qqmlvme_p.h +++ b/src/qml/qml/qqmlvme_p.h @@ -97,7 +97,7 @@ public: class Interrupt { public: inline Interrupt(); - inline Interrupt(bool *runWhile); + inline Interrupt(volatile bool *runWhile, int nsecs=0); inline Interrupt(int nsecs); inline void reset(); @@ -105,13 +105,11 @@ public: private: enum Mode { None, Time, Flag }; Mode mode; - union { - struct { - QElapsedTimer timer; - int nsecs; - }; - bool *runWhile; + struct { + QElapsedTimer timer; + int nsecs; }; + volatile bool *runWhile; }; QQmlVME() : data(0), componentAttached(0) {} @@ -202,23 +200,23 @@ private: }; QQmlVME::Interrupt::Interrupt() -: mode(None) + : mode(None), nsecs(0), runWhile(0) { } -QQmlVME::Interrupt::Interrupt(bool *runWhile) -: mode(Flag), runWhile(runWhile) +QQmlVME::Interrupt::Interrupt(volatile bool *runWhile, int nsecs) + : mode(Flag), nsecs(nsecs), runWhile(runWhile) { } QQmlVME::Interrupt::Interrupt(int nsecs) -: mode(Time), nsecs(nsecs) + : mode(Time), nsecs(nsecs), runWhile(0) { } void QQmlVME::Interrupt::reset() { - if (mode == Time) + if (mode == Time || nsecs) timer.start(); } @@ -229,7 +227,7 @@ bool QQmlVME::Interrupt::shouldInterrupt() const } else if (mode == Time) { return timer.nsecsElapsed() > nsecs; } else if (mode == Flag) { - return !*runWhile; + return !*runWhile || (nsecs && timer.nsecsElapsed() > nsecs); } else { return false; } diff --git a/src/qml/qml/qquickworkerscript.cpp b/src/qml/qml/qquickworkerscript.cpp index f91aa28509..529f181e7a 100644 --- a/src/qml/qml/qquickworkerscript.cpp +++ b/src/qml/qml/qquickworkerscript.cpp @@ -202,7 +202,7 @@ QQuickWorkerScriptEnginePrivate::WorkerEngine::~WorkerEngine() void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() { - initDeclarativeGlobalObject(); + initQmlGlobalObject(); #define CALL_ONMESSAGE_SCRIPT \ "(function(object, message) { "\ "var isfunction = false; "\ diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp index c03292d74d..4fd84945fc 100644 --- a/src/qml/qml/v4/qv4bindings.cpp +++ b/src/qml/qml/v4/qv4bindings.cpp @@ -50,6 +50,7 @@ #include <private/qqmlprofilerservice_p.h> #include <private/qqmlmetatype_p.h> #include <private/qqmltrace_p.h> +#include <private/qqmlstringconverters_p.h> #include <QtQml/qqmlinfo.h> #include <QtCore/qnumeric.h> @@ -86,9 +87,11 @@ struct Register { QVariant *getvariantptr() { return (QVariant *)typeDataPtr(); } QString *getstringptr() { return (QString *)typeDataPtr(); } QUrl *geturlptr() { return (QUrl *)typeDataPtr(); } + QColor *getcolorptr() { return (QColor *)typeDataPtr(); } const QVariant *getvariantptr() const { return (QVariant *)typeDataPtr(); } const QString *getstringptr() const { return (QString *)typeDataPtr(); } const QUrl *geturlptr() const { return (QUrl *)typeDataPtr(); } + const QColor *getcolorptr() const { return (QColor *)typeDataPtr(); } void *typeDataPtr() { return (void *)&data; } void *typeMemory() { return (void *)data; } @@ -112,6 +115,7 @@ struct Register { inline void cleanup(); inline void cleanupString(); inline void cleanupUrl(); + inline void cleanupColor(); inline void cleanupVariant(); inline void copy(const Register &other); @@ -135,6 +139,8 @@ void Register::cleanup() getstringptr()->~QString(); } else if (dataType == QUrlType) { geturlptr()->~QUrl(); + } else if (dataType == QColorType) { + getcolorptr()->~QColor(); } else if (dataType == QVariantType) { getvariantptr()->~QVariant(); } @@ -154,6 +160,12 @@ void Register::cleanupUrl() setUndefined(); } +void Register::cleanupColor() +{ + getcolorptr()->~QColor(); + setUndefined(); +} + void Register::cleanupVariant() { getvariantptr()->~QVariant(); @@ -168,6 +180,8 @@ void Register::copy(const Register &other) new (getstringptr()) QString(*other.getstringptr()); else if (other.dataType == QUrlType) new (geturlptr()) QUrl(*other.geturlptr()); + else if (other.dataType == QColorType) + new (getcolorptr()) QColor(*other.getcolorptr()); else if (other.dataType == QVariantType) new (getvariantptr()) QVariant(*other.getvariantptr()); } @@ -181,6 +195,8 @@ void Register::init(Type type) new (getstringptr()) QString(); else if (dataType == QUrlType) new (geturlptr()) QUrl(); + else if (dataType == QColorType) + new (getcolorptr()) QColor(); else if (dataType == QVariantType) new (getvariantptr()) QVariant(); } @@ -256,7 +272,8 @@ void QV4Bindings::Binding::destroy() int QV4Bindings::Binding::propertyIndex() const { - return property; + //mask out the type information set for value types + return property & 0xFF00FFFF; } QObject *QV4Bindings::Binding::object() const @@ -662,6 +679,11 @@ inline quint32 QV4Bindings::toUint32(qreal n) MARK_REGISTER(reg); \ } +#define COLOR_REGISTER(reg) { \ + registers[(reg)].settype(QColorType); \ + MARK_REGISTER(reg); \ +} + #define VARIANT_REGISTER(reg) { \ registers[(reg)].settype(QVariantType); \ MARK_REGISTER(reg); \ @@ -1022,6 +1044,27 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(ConvertStringToUrl, unaryop) + QML_V4_BEGIN_INSTR(ConvertStringToColor, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + const QString tmp(*src.getstringptr()); + if (instr->unaryop.src == instr->unaryop.output) { + output.cleanupString(); + MARK_CLEAN_REGISTER(instr->unaryop.output); + } + QColor *colorPtr = output.getcolorptr(); + new (colorPtr) QColor(QQmlStringConverters::colorFromString(tmp)); + + COLOR_REGISTER(instr->unaryop.output); + } + } + QML_V4_END_INSTR(ConvertStringToUrl, unaryop) + QML_V4_BEGIN_INSTR(ConvertUrlToBool, unaryop) { const Register &src = registers[instr->unaryop.src]; @@ -1059,6 +1102,40 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks, } QML_V4_END_INSTR(ConvertUrlToString, unaryop) + QML_V4_BEGIN_INSTR(ConvertColorToBool, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + // for compatibility with color behavior in v8, always true + output.setbool(true); + } + } + QML_V4_END_INSTR(ConvertColorToBool, unaryop) + + QML_V4_BEGIN_INSTR(ConvertColorToString, unaryop) + { + const Register &src = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + // ### NaN + if (src.isUndefined()) { + output.setUndefined(); + } else { + const QColor tmp(*src.getcolorptr()); + if (instr->unaryop.src == instr->unaryop.output) { + output.cleanupColor(); + MARK_CLEAN_REGISTER(instr->unaryop.output); + } + // to maintain behaviour with QtQuick 1.0, we just output normal toString() value. + new (output.getstringptr()) QString(QVariant(tmp).toString()); + STRING_REGISTER(instr->unaryop.output); + } + } + QML_V4_END_INSTR(ConvertColorToString, unaryop) + QML_V4_BEGIN_INSTR(ResolveUrl, unaryop) { const Register &src = registers[instr->unaryop.src]; diff --git a/src/qml/qml/v4/qv4bindings_p.h b/src/qml/qml/v4/qv4bindings_p.h index 61d29a6f57..1824fa4ee9 100644 --- a/src/qml/qml/v4/qv4bindings_p.h +++ b/src/qml/qml/v4/qv4bindings_p.h @@ -96,6 +96,8 @@ private: int index:30; bool enabled:1; bool updating:1; + // Encoding of property is coreIndex | (propType << 16) | (valueTypeIndex << 24) + // propType and valueTypeIndex are only set if the property is a value type property int property; QObject *scope; int line; diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp index d61fd580c7..f8fe3b4b57 100644 --- a/src/qml/qml/v4/qv4compiler.cpp +++ b/src/qml/qml/v4/qv4compiler.cpp @@ -63,7 +63,7 @@ static bool qmlEnableV4 = true; using namespace QQmlJS; QV4CompilerPrivate::QV4CompilerPrivate() -: _function(0) , _block(0) , _discarded(false) + : _function(0) , _block(0) , _discarded(false), registerCount(0) { } @@ -75,6 +75,7 @@ void QV4CompilerPrivate::trace(int line, int column) bytecode.clear(); this->currentReg = _function->tempCount; + this->registerCount = qMax(this->registerCount, this->currentReg); foreach (IR::BasicBlock *bb, _function->basicBlocks) { if (! bb->isTerminated() && (bb->index + 1) < _function->basicBlocks.size()) @@ -344,6 +345,9 @@ void QV4CompilerPrivate::visitName(IR::Name *e) case QMetaType::QUrl: regType = QUrlType; break; + case QMetaType::QColor: + regType = QColorType; + break; default: if (propTy == QQmlMetaType::QQuickAnchorLineMetaTypeId()) { @@ -581,6 +585,12 @@ void QV4CompilerPrivate::convertToBool(IR::Expr *expr, int reg) gen(i); } return; + case IR::ColorType: { + Instr::ConvertColorToBool i; + i.output = i.src = reg; + gen(i); + } return; + default: discard(); break; @@ -880,6 +890,7 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::RealType: opcode = V4Instr::ConvertRealToBool; break; case IR::StringType: opcode = V4Instr::ConvertStringToBool; break; case IR::UrlType: opcode = V4Instr::ConvertUrlToBool; break; + case IR::ColorType: opcode = V4Instr::ConvertColorToBool; break; default: break; } // switch } else if (targetTy == IR::IntType) { @@ -908,6 +919,7 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::IntType: opcode = V4Instr::ConvertIntToString; break; case IR::RealType: opcode = V4Instr::ConvertRealToString; break; case IR::UrlType: opcode = V4Instr::ConvertUrlToString; break; + case IR::ColorType: opcode = V4Instr::ConvertColorToString; break; default: break; } // switch } else if (targetTy == IR::UrlType) { @@ -920,11 +932,17 @@ void QV4CompilerPrivate::visitMove(IR::Move *s) case IR::BoolType: gen(V4Instr::ConvertBoolToString, convToString); sourceTy = IR::StringType; break; case IR::IntType: gen(V4Instr::ConvertIntToString, convToString); sourceTy = IR::StringType; break; case IR::RealType: gen(V4Instr::ConvertRealToString, convToString); sourceTy = IR::StringType; break; + case IR::ColorType: gen(V4Instr::ConvertColorToString, convToString); sourceTy = IR::StringType; break; default: break; } // switch if (sourceTy == IR::StringType) opcode = V4Instr::ConvertStringToUrl; + } else if (targetTy == IR::ColorType) { + switch (sourceTy) { + case IR::StringType: opcode = V4Instr::ConvertStringToColor; break; + default: break; + } // switch } if (opcode != V4Instr::Noop) { V4Instr conv; @@ -989,6 +1007,9 @@ void QV4CompilerPrivate::visitRet(IR::Ret *s) case IR::UrlType: test.regType = QMetaType::QUrl; break; + case IR::ColorType: + test.regType = QMetaType::QColor; + break; case IR::SGAnchorLineType: test.regType = QQmlMetaType::QQuickAnchorLineMetaTypeId(); break; @@ -1119,7 +1140,7 @@ bool QV4CompilerPrivate::compile(QQmlJS::AST::Node *node) qerr << endl; } - if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF) + if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF || registerCount > 31) return false; return true; diff --git a/src/qml/qml/v4/qv4compiler_p_p.h b/src/qml/qml/v4/qv4compiler_p_p.h index 4b74a1d1c5..a9209d978f 100644 --- a/src/qml/qml/v4/qv4compiler_p_p.h +++ b/src/qml/qml/v4/qv4compiler_p_p.h @@ -231,6 +231,7 @@ private: void discard() { _discarded = true; } bool _discarded; quint8 currentReg; + quint8 registerCount; bool usedSubscriptionIdsChanged; quint32 currentBlockMask; diff --git a/src/qml/qml/v4/qv4instruction.cpp b/src/qml/qml/v4/qv4instruction.cpp index 08b2570747..efbd2b2c1c 100644 --- a/src/qml/qml/v4/qv4instruction.cpp +++ b/src/qml/qml/v4/qv4instruction.cpp @@ -171,12 +171,21 @@ void Bytecode::dump(const V4Instr *i, int address) const case V4Instr::ConvertStringToUrl: INSTR_DUMP << "\t" << "ConvertStringToUrl" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::ConvertStringToColor: + INSTR_DUMP << "\t" << "ConvertStringToColor" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::ConvertUrlToBool: INSTR_DUMP << "\t" << "ConvertUrlToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; case V4Instr::ConvertUrlToString: INSTR_DUMP << "\t" << "ConvertUrlToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; + case V4Instr::ConvertColorToBool: + INSTR_DUMP << "\t" << "ConvertColorToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; + case V4Instr::ConvertColorToString: + INSTR_DUMP << "\t" << "ConvertColorToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; + break; case V4Instr::ResolveUrl: INSTR_DUMP << "\t" << "ResolveUrl" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")"; break; diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h index 8150eedf54..964c95513f 100644 --- a/src/qml/qml/v4/qv4instruction_p.h +++ b/src/qml/qml/v4/qv4instruction_p.h @@ -92,8 +92,11 @@ QT_BEGIN_NAMESPACE F(ConvertStringToInt, unaryop) \ F(ConvertStringToReal, unaryop) \ F(ConvertStringToUrl, unaryop) \ + F(ConvertStringToColor, unaryop) \ F(ConvertUrlToBool, unaryop) \ F(ConvertUrlToString, unaryop) \ + F(ConvertColorToBool, unaryop) \ + F(ConvertColorToString, unaryop) \ F(ResolveUrl, unaryop) \ F(MathSinReal, unaryop) \ F(MathCosReal, unaryop) \ diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp index be822145a4..3b33898cd1 100644 --- a/src/qml/qml/v4/qv4ir.cpp +++ b/src/qml/qml/v4/qv4ir.cpp @@ -59,6 +59,7 @@ inline const char *typeName(Type t) case VoidType: return "void"; case StringType: return "string"; case UrlType: return "url"; + case ColorType: return "color"; case SGAnchorLineType: return "SGAnchorLine"; case AttachType: return "AttachType"; case ObjectType: return "object"; @@ -77,7 +78,7 @@ inline bool isNumberType(IR::Type ty) inline bool isStringType(IR::Type ty) { - return ty == IR::StringType || ty == IR::UrlType; + return ty == IR::StringType || ty == IR::UrlType || ty == IR::ColorType; } IR::Type maxType(IR::Type left, IR::Type right) diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h index 48a08adf9f..e80c7e2869 100644 --- a/src/qml/qml/v4/qv4ir_p.h +++ b/src/qml/qml/v4/qv4ir_p.h @@ -142,6 +142,7 @@ enum Type { VoidType, StringType, UrlType, + ColorType, SGAnchorLineType, AttachType, ObjectType, diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 1956be8e72..0efb2686df 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -70,6 +70,9 @@ static IR::Type irTypeFromVariantType(int t, QQmlEnginePrivate *engine, const QM case QMetaType::QUrl: return IR::UrlType; + case QMetaType::QColor: + return IR::ColorType; + default: if (t == QQmlMetaType::QQuickAnchorLineMetaTypeId()) { return IR::SGAnchorLineType; @@ -438,7 +441,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QQmlPropertyData *data = cache->property(name); - if (data && data->revision != 0) { + if (data && data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); @@ -459,7 +462,7 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) QQmlPropertyData *data = cache->property(name); - if (data && data->revision != 0) { + if (data && data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); @@ -610,7 +613,7 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) if (!data || data->isFunction()) return false; // Don't support methods (or non-existing properties ;) - if (data->revision != 0) { + if (data->hasRevision()) { if (qmlVerboseCompiler()) qWarning() << "*** versioned symbol:" << name; discard(); diff --git a/src/qml/qml/v4/qv4program_p.h b/src/qml/qml/v4/qv4program_p.h index b6b03e438b..d23cc6192f 100644 --- a/src/qml/qml/v4/qv4program_p.h +++ b/src/qml/qml/v4/qv4program_p.h @@ -96,6 +96,7 @@ enum QQmlRegisterType { QStringType = FirstCleanupType, QUrlType, QVariantType, + QColorType }; const char *QV4Program::data() const diff --git a/src/qml/qml/v8/qjsconverter_p.h b/src/qml/qml/v8/qjsconverter_p.h index 29fef3c700..d85f9aa0cf 100644 --- a/src/qml/qml/v8/qjsconverter_p.h +++ b/src/qml/qml/v8/qjsconverter_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsengine.h b/src/qml/qml/v8/qjsengine.h index 1521c752d4..fa2584bf81 100644 --- a/src/qml/qml/v8/qjsengine.h +++ b/src/qml/qml/v8/qjsengine.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsengine_p.h b/src/qml/qml/v8/qjsengine_p.h index ecd5f7cc86..9866aa84b9 100644 --- a/src/qml/qml/v8/qjsengine_p.h +++ b/src/qml/qml/v8/qjsengine_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsvalue.h b/src/qml/qml/v8/qjsvalue.h index 30ea2e7345..209090ed47 100644 --- a/src/qml/qml/v8/qjsvalue.h +++ b/src/qml/qml/v8/qjsvalue.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** @@ -25,7 +43,6 @@ #define QJSVALUE_H #include <QtQml/qtqmlglobal.h> - #include <QtCore/qstring.h> #include <QtCore/qlist.h> #include <QtCore/qsharedpointer.h> @@ -69,7 +86,7 @@ public: QJSValue(const QString &value); QJSValue(const QLatin1String &value); #ifndef QT_NO_CAST_FROM_ASCII - QT_ASCII_CAST_WARN_CONSTRUCTOR QJSValue(const char *str); + QT_ASCII_CAST_WARN QJSValue(const char *str); #endif QJSValue &operator=(const QJSValue &other); diff --git a/src/qml/qml/v8/qjsvalue_impl_p.h b/src/qml/qml/v8/qjsvalue_impl_p.h index cd33859c50..fbddcfa5ba 100644 --- a/src/qml/qml/v8/qjsvalue_impl_p.h +++ b/src/qml/qml/v8/qjsvalue_impl_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsvalue_p.h b/src/qml/qml/v8/qjsvalue_p.h index 3eccba64bd..acfe958cb6 100644 --- a/src/qml/qml/v8/qjsvalue_p.h +++ b/src/qml/qml/v8/qjsvalue_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsvalueiterator.h b/src/qml/qml/v8/qjsvalueiterator.h index c47f07d43b..3c1b450dd8 100644 --- a/src/qml/qml/v8/qjsvalueiterator.h +++ b/src/qml/qml/v8/qjsvalueiterator.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** @@ -24,6 +42,7 @@ #ifndef QSCRIPTVALUEITERATOR_H #define QSCRIPTVALUEITERATOR_H +#include <QtQml/qtqmlglobal.h> #include <QtQml/qjsvalue.h> #include <QtCore/qscopedpointer.h> diff --git a/src/qml/qml/v8/qjsvalueiterator_impl_p.h b/src/qml/qml/v8/qjsvalueiterator_impl_p.h index 131296ecac..2c060b21a7 100644 --- a/src/qml/qml/v8/qjsvalueiterator_impl_p.h +++ b/src/qml/qml/v8/qjsvalueiterator_impl_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qjsvalueiterator_p.h b/src/qml/qml/v8/qjsvalueiterator_p.h index 2a5bcdec22..f5f4c44441 100644 --- a/src/qml/qml/v8/qjsvalueiterator_p.h +++ b/src/qml/qml/v8/qjsvalueiterator_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 5284832ae1..7d7aaa2148 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1096,8 +1096,17 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) V8THROW_ERROR("Qt.createQmlObject(): Component is not ready"); QObject *obj = component.beginCreate(effectiveContext); - if (obj) + if (obj) { QQmlData::get(obj, true)->setImplicitDestructible(); + + obj->setParent(parentArg); + + QList<QQmlPrivate::AutoParentFunction> functions = QQmlMetaType::parentFunctions(); + for (int ii = 0; ii < functions.count(); ++ii) { + if (QQmlPrivate::Parented == functions.at(ii)(obj, parentArg)) + break; + } + } component.completeCreate(); if (component.isError()) { @@ -1107,14 +1116,6 @@ v8::Handle<v8::Value> createQmlObject(const v8::Arguments &args) Q_ASSERT(obj); - obj->setParent(parentArg); - - QList<QQmlPrivate::AutoParentFunction> functions = QQmlMetaType::parentFunctions(); - for (int ii = 0; ii < functions.count(); ++ii) { - if (QQmlPrivate::Parented == functions.at(ii)(obj, parentArg)) - break; - } - return v8engine->newQObject(obj); } diff --git a/src/qml/qml/v8/qscript_impl_p.h b/src/qml/qml/v8/qscript_impl_p.h index fdbf2f0097..d4acc4502a 100644 --- a/src/qml/qml/v8/qscript_impl_p.h +++ b/src/qml/qml/v8/qscript_impl_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qscriptisolate_p.h b/src/qml/qml/v8/qscriptisolate_p.h index 4afa74756f..77848557a4 100644 --- a/src/qml/qml/v8/qscriptisolate_p.h +++ b/src/qml/qml/v8/qscriptisolate_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qscriptoriginalglobalobject_p.h b/src/qml/qml/v8/qscriptoriginalglobalobject_p.h index 12321cc71a..e4661c1bf2 100644 --- a/src/qml/qml/v8/qscriptoriginalglobalobject_p.h +++ b/src/qml/qml/v8/qscriptoriginalglobalobject_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qscriptshareddata_p.h b/src/qml/qml/v8/qscriptshareddata_p.h index df95b26206..d3491c70ee 100644 --- a/src/qml/qml/v8/qscriptshareddata_p.h +++ b/src/qml/qml/v8/qscriptshareddata_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qscripttools_p.h b/src/qml/qml/v8/qscripttools_p.h index fcea205f61..d69e9c83ad 100644 --- a/src/qml/qml/v8/qscripttools_p.h +++ b/src/qml/qml/v8/qscripttools_p.h @@ -3,19 +3,37 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 4c2cce1525..8e8223fea1 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -75,12 +75,14 @@ static bool ObjectComparisonCallback(v8::Local<v8::Object> lhs, v8::Local<v8::Ob if (lhs == rhs) return true; + if (lhs.IsEmpty() || rhs.IsEmpty()) + return false; + QV8ObjectResource *lhsr = static_cast<QV8ObjectResource*>(lhs->GetExternalResource()); QV8ObjectResource *rhsr = static_cast<QV8ObjectResource*>(rhs->GetExternalResource()); - Q_ASSERT(lhsr->engine == rhsr->engine); - if (lhsr && rhsr) { + Q_ASSERT(lhsr->engine == rhsr->engine); QV8ObjectResource::ResourceType lhst = lhsr->resourceType(); QV8ObjectResource::ResourceType rhst = rhsr->resourceType(); @@ -874,7 +876,7 @@ void QV8Engine::ensurePerThreadIsolate() perThreadEngineData.setLocalData(new ThreadData); } -void QV8Engine::initDeclarativeGlobalObject() +void QV8Engine::initQmlGlobalObject() { v8::HandleScope handels; v8::Context::Scope contextScope(m_context); @@ -885,7 +887,7 @@ void QV8Engine::initDeclarativeGlobalObject() void QV8Engine::setEngine(QQmlEngine *engine) { m_engine = engine; - initDeclarativeGlobalObject(); + initQmlGlobalObject(); } void QV8Engine::setException(v8::Handle<v8::Value> value, v8::Handle<v8::Message> msg) diff --git a/src/qml/qml/v8/qv8engine_impl_p.h b/src/qml/qml/v8/qv8engine_impl_p.h index ebb21f851c..7173ae4c01 100644 --- a/src/qml/qml/v8/qv8engine_impl_p.h +++ b/src/qml/qml/v8/qv8engine_impl_p.h @@ -5,17 +5,35 @@ ** ** This file is part of the QtQml module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL-ONLY$ +** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** ** -** If you have questions regarding the use of this file, please contact -** us via http://www.qt-project.org/. ** ** $QT_END_LICENSE$ ** diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 22a8d7599f..bc57b27085 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -283,7 +283,7 @@ public: inline void pop(); }; - void initDeclarativeGlobalObject(); + void initQmlGlobalObject(); void setEngine(QQmlEngine *engine); QQmlEngine *engine() { return m_engine; } v8::Local<v8::Object> global() { return m_context->Global(); } diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index b84ae339be..78b2cb719c 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -513,7 +513,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject if (!result) return v8::Handle<v8::Value>(); - if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) { + if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) { QQmlData *ddata = QQmlData::get(object); if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) return v8::Handle<v8::Value>(); @@ -673,7 +673,7 @@ bool QV8QObjectWrapper::SetProperty(QV8Engine *engine, QObject *object, const QH if (!result) return false; - if (revisionMode == QV8QObjectWrapper::CheckRevision && result->revision != 0) { + if (revisionMode == QV8QObjectWrapper::CheckRevision && result->hasRevision()) { QQmlData *ddata = QQmlData::get(object); if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) return false; |