summaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-21 11:26:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-21 11:26:36 (GMT)
commitcf3b0c21a480f4008ba6a53fbab47104299cea8c (patch)
treeb671b97ab8b396e5ab04fdb8eb6e2d9d6a7443e2 /src/3rdparty
parent2fdac06f820f2362d3ca83ab6d73ed874d903098 (diff)
parent7a3b4a0bfed6365f0c5bd2f3b99a5585d0ef9eb8 (diff)
downloadQt-cf3b0c21a480f4008ba6a53fbab47104299cea8c.zip
Qt-cf3b0c21a480f4008ba6a53fbab47104299cea8c.tar.gz
Qt-cf3b0c21a480f4008ba6a53fbab47104299cea8c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-webkit into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-webkit: Updated WebKit to 19de3d2848b715f937eb375a078672cc8e9b8185 Updated WebKit to 19de3d2848b715f937eb375a078672cc8e9b8185 Updated WebKit to 515aae71494436816cd0250cdc52caa4f2566aef Update S60 stuff after renaming the webkit component. Update qmlchanges from import org.webkit to QtWebKit Updated WebKit to e32cb21d4f1787147bcb681883b96a95f867749a Updated WebKit to a99218d1984be36e00966f988123fa7e2b18eec5 Remove the old WebView element in src/import. The new one is in src/3rdparty/webkit Updated WebKit to d7a095a2a9514e1f132b779b99279585820b46f5 Updated WebKit to c6f08f4c13f88491a5d1ae1794c72166af0c26ba
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/ChangeLog11
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro46
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h132
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp145
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h56
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp71
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h121
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.cpp136
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.h53
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram_p.h129
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.cpp131
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.h58
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring_p.h112
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp142
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h50
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h73
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp556
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h99
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h754
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp275
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro7
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp175
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro12
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp435
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h196
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp1922
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri19
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro4
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog49
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLInputElement.h4
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit.pro3
-rw-r--r--src/3rdparty/webkit/WebKit/ChangeLog8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog227
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp33
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro74
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/plugin.cpp (renamed from src/3rdparty/webkit/JavaScriptCore/qt/api/qtscriptglobal.h)51
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp1022
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h371
-rw-r--r--src/3rdparty/webkit/WebKit/qt/declarative/qmldir1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp76
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp63
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc1
51 files changed, 1984 insertions, 5962 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index f5b6af3..98460a0 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-6623b5da196390748dc619461739f9cb84524736
+19de3d2848b715f937eb375a078672cc8e9b8185
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index 51d08a0..1f067bf 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-17 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Upstream the WebKit QML integration plugin
+ https://bugs.webkit.org/show_bug.cgi?id=40050
+
+ Add to the build the QML WebKit integration plugin.
+
+ * WebKit.pro:
+
2010-06-17 Mark Brand <mabrand@mabrand.nl>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro b/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro
deleted file mode 100644
index 3c2691e..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro
+++ /dev/null
@@ -1,46 +0,0 @@
-TARGET = QtScript
-TEMPLATE = lib
-QT = core
-
-INCLUDEPATH += $$PWD
-
-CONFIG += building-libs
-
-isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../../generated
-!CONFIG(release, debug|release) {
- OBJECTS_DIR = obj/debug
-} else { # Release
- OBJECTS_DIR = obj/release
-}
-
-isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../..
-include($$PWD/../../../WebKit.pri)
-
-include($$PWD/../../JavaScriptCore.pri)
-addJavaScriptCoreLib(../..)
-
-INCLUDEPATH += $$PWD/../../API
-
-SOURCES += $$PWD/qscriptengine.cpp \
- $$PWD/qscriptengine_p.cpp \
- $$PWD/qscriptvalue.cpp \
- $$PWD/qscriptstring.cpp \
- $$PWD/qscriptprogram.cpp \
- $$PWD/qscriptsyntaxcheckresult.cpp \
-
-HEADERS += $$PWD/qtscriptglobal.h \
- $$PWD/qscriptengine.h \
- $$PWD/qscriptengine_p.h \
- $$PWD/qscriptvalue.h \
- $$PWD/qscriptvalue_p.h \
- $$PWD/qscriptconverter_p.h \
- $$PWD/qscriptstring.h \
- $$PWD/qscriptstring_p.h \
- $$PWD/qscriptprogram.h \
- $$PWD/qscriptprogram_p.h \
- $$PWD/qscriptsyntaxcheckresult.h \
-
-
-!static: DEFINES += QT_MAKEDLL
-
-DESTDIR = $$OUTPUT_DIR/lib
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h
deleted file mode 100644
index cd86e20..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptconverter_p_h
-#define qscriptconverter_p_h
-
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvarlengtharray.h>
-
-extern char *qdtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve, char **digits_str);
-
-/*
- \internal
- \class QScriptConverter
- QScriptValue and QScriptEngine helper class. This class's responsibility is to convert values
- between JS values and Qt/C++ values.
-
- This is a nice way to inline these functions in both QScriptValue and QScriptEngine.
-*/
-class QScriptConverter {
-public:
- static quint32 toArrayIndex(const JSStringRef jsstring)
- {
- // FIXME this function should be exported by JSC C API.
- QString qstring = toString(jsstring);
-
- bool ok;
- quint32 idx = qstring.toUInt(&ok);
- if (!ok || toString(idx) != qstring)
- idx = 0xffffffff;
-
- return idx;
- }
-
- static QString toString(const JSStringRef str)
- {
- return QString(reinterpret_cast<const QChar*>(JSStringGetCharactersPtr(str)), JSStringGetLength(str));
- }
- static JSStringRef toString(const QString& str)
- {
- return JSStringCreateWithUTF8CString(str.toUtf8().constData());
- }
- static JSStringRef toString(const char* str)
- {
- return JSStringCreateWithUTF8CString(str);
- }
- static QString toString(double value)
- {
- // FIXME this should be easier. The ideal fix is to create
- // a new function in JSC C API which could cover the functionality.
-
- if (qIsNaN(value))
- return QString::fromLatin1("NaN");
- if (qIsInf(value))
- return QString::fromLatin1(value < 0 ? "-Infinity" : "Infinity");
- if (!value)
- return QString::fromLatin1("0");
-
- QVarLengthArray<char, 25> buf;
- int decpt;
- int sign;
- char* result = 0;
- char* endresult;
- (void)qdtoa(value, 0, 0, &decpt, &sign, &endresult, &result);
-
- if (!result)
- return QString();
-
- int resultLen = endresult - result;
- if (decpt <= 0 && decpt > -6) {
- buf.resize(-decpt + 2 + sign);
- qMemSet(buf.data(), '0', -decpt + 2 + sign);
- if (sign) // fix the sign.
- buf[0] = '-';
- buf[sign + 1] = '.';
- buf.append(result, resultLen);
- } else {
- if (sign)
- buf.append('-');
- int length = buf.size() - sign + resultLen;
- if (decpt <= 21 && decpt > 0) {
- if (length <= decpt) {
- const char* zeros = "0000000000000000000000000";
- buf.append(result, resultLen);
- buf.append(zeros, decpt - length);
- } else {
- buf.append(result, decpt);
- buf.append('.');
- buf.append(result + decpt, resultLen - decpt);
- }
- } else if (result[0] >= '0' && result[0] <= '9') {
- if (length > 1) {
- buf.append(result, 1);
- buf.append('.');
- buf.append(result + 1, resultLen - 1);
- } else
- buf.append(result, resultLen);
- buf.append('e');
- buf.append(decpt >= 0 ? '+' : '-');
- int e = qAbs(decpt - 1);
- if (e >= 100)
- buf.append('0' + e / 100);
- if (e >= 10)
- buf.append('0' + (e % 100) / 10);
- buf.append('0' + e % 10);
- }
- }
- free(result);
- buf.append(0);
- return QString::fromLatin1(buf.constData());
- }
-};
-
-#endif // qscriptconverter_p_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp
deleted file mode 100644
index 6a3edc1..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptengine.h"
-
-#include "qscriptengine_p.h"
-#include "qscriptprogram_p.h"
-#include "qscriptsyntaxcheckresult_p.h"
-#include "qscriptvalue_p.h"
-
-/*!
- Constructs a QScriptEngine object.
-
- The globalObject() is initialized to have properties as described in ECMA-262, Section 15.1.
-*/
-QScriptEngine::QScriptEngine()
- : d_ptr(new QScriptEnginePrivate(this))
-{
-}
-
-/*!
- Destroys this QScriptEngine.
-*/
-QScriptEngine::~QScriptEngine()
-{
-}
-
-/*!
- Checks the syntax of the given \a program. Returns a
- QScriptSyntaxCheckResult object that contains the result of the check.
-*/
-QScriptSyntaxCheckResult QScriptEngine::checkSyntax(const QString &program)
-{
- // FIXME This is not optimal.
- // The JSC C API needs a context to perform a syntax check, it means that a QScriptEnginePrivate
- // had to be created. This function is static so we have to create QScriptEnginePrivate for each
- // call. We can't remove the "static" for compatibility reason, at least up to Qt5.
- // QScriptSyntaxCheckResultPrivate takes ownership of newly created engine. The engine will be
- // kept as long as it is needed for lazy evaluation of properties of
- // the QScriptSyntaxCheckResultPrivate.
- QScriptEnginePrivate* engine = new QScriptEnginePrivate(/* q_ptr */ 0);
- return QScriptSyntaxCheckResultPrivate::get(engine->checkSyntax(program));
-}
-
-/*!
- Evaluates \a program, using \a lineNumber as the base line number,
- and returns the result of the evaluation.
-
- The script code will be evaluated in the current context.
-
- The evaluation of \a program can cause an exception in the
- engine; in this case the return value will be the exception
- that was thrown (typically an \c{Error} object). You can call
- hasUncaughtException() to determine if an exception occurred in
- the last call to evaluate().
-
- \a lineNumber is used to specify a starting line number for \a
- program; line number information reported by the engine that pertain
- to this evaluation (e.g. uncaughtExceptionLineNumber()) will be
- based on this argument. For example, if \a program consists of two
- lines of code, and the statement on the second line causes a script
- exception, uncaughtExceptionLineNumber() would return the given \a
- lineNumber plus one. When no starting line number is specified, line
- numbers will be 1-based.
-
- \a fileName is used for error reporting. For example in error objects
- the file name is accessible through the "fileName" property if it's
- provided with this function.
-*/
-QScriptValue QScriptEngine::evaluate(const QString& program, const QString& fileName, int lineNumber)
-{
- return QScriptValuePrivate::get(d_ptr->evaluate(program, fileName, lineNumber));
-}
-
-QScriptValue QScriptEngine::evaluate(const QScriptProgram& program)
-{
- return QScriptValuePrivate::get(d_ptr->evaluate(QScriptProgramPrivate::get(program)));
-}
-
-/*!
- Runs the garbage collector.
-
- The garbage collector will attempt to reclaim memory by locating and disposing of objects that are
- no longer reachable in the script environment.
-
- Normally you don't need to call this function; the garbage collector will automatically be invoked
- when the QScriptEngine decides that it's wise to do so (i.e. when a certain number of new objects
- have been created). However, you can call this function to explicitly request that garbage
- collection should be performed as soon as possible.
-*/
-void QScriptEngine::collectGarbage()
-{
- d_ptr->collectGarbage();
-}
-
-/*!
- Returns a handle that represents the given string, \a str.
-
- QScriptString can be used to quickly look up properties, and
- compare property names, of script objects.
-
- \sa QScriptValue::property()
-*/
-QScriptString QScriptEngine::toStringHandle(const QString& str)
-{
- return QScriptStringPrivate::get(d_ptr->toStringHandle(str));
-}
-
-/*!
- Returns a QScriptValue of the primitive type Null.
-
- \sa undefinedValue()
-*/
-QScriptValue QScriptEngine::nullValue()
-{
- return QScriptValue(this, QScriptValue::NullValue);
-}
-
-/*!
- Returns a QScriptValue of the primitive type Undefined.
-
- \sa nullValue()
-*/
-QScriptValue QScriptEngine::undefinedValue()
-{
- return QScriptValue(this, QScriptValue::UndefinedValue);
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h
deleted file mode 100644
index ee066c9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptengine_h
-#define qscriptengine_h
-
-#include "qscriptprogram.h"
-#include "qscriptstring.h"
-#include "qscriptsyntaxcheckresult.h"
-#include <QtCore/qobject.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-
-class QScriptValue;
-class QScriptEnginePrivate;
-
-// Internal typedef
-typedef QExplicitlySharedDataPointer<QScriptEnginePrivate> QScriptEnginePtr;
-
-class QScriptEngine : public QObject {
-public:
- QScriptEngine();
- ~QScriptEngine();
-
- static QScriptSyntaxCheckResult checkSyntax(const QString& program);
- QScriptValue evaluate(const QString& program, const QString& fileName = QString(), int lineNumber = 1);
- QScriptValue evaluate(const QScriptProgram& program);
- void collectGarbage();
-
- QScriptString toStringHandle(const QString& str);
-
- QScriptValue nullValue();
- QScriptValue undefinedValue();
-private:
- friend class QScriptEnginePrivate;
-
- QScriptEnginePtr d_ptr;
-};
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp
deleted file mode 100644
index 32551b0..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptengine_p.h"
-
-#include "qscriptprogram_p.h"
-#include "qscriptvalue_p.h"
-
-/*!
- Constructs a default QScriptEnginePrivate object, a new global context will be created.
- \internal
-*/
-QScriptEnginePrivate::QScriptEnginePrivate(const QScriptEngine* engine)
- : q_ptr(const_cast<QScriptEngine*>(engine))
- , m_context(JSGlobalContextCreate(0))
-{
-}
-
-QScriptEnginePrivate::~QScriptEnginePrivate()
-{
- JSGlobalContextRelease(m_context);
-}
-
-QScriptSyntaxCheckResultPrivate* QScriptEnginePrivate::checkSyntax(const QString& program)
-{
- JSValueRef exception;
- if (JSCheckScriptSyntax(m_context, QScriptConverter::toString(program), /* url */ 0, /* starting line */ 1, &exception))
- return new QScriptSyntaxCheckResultPrivate(this);
- JSValueProtect(m_context, exception);
- return new QScriptSyntaxCheckResultPrivate(this, const_cast<JSObjectRef>(exception));
-}
-
-/*!
- Evaluates program and returns the result of the evaluation.
- \internal
-*/
-QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QString& program, const QString& fileName, int lineNumber)
-{
- JSStringRef script = QScriptConverter::toString(program);
- JSStringRef file = QScriptConverter::toString(fileName);
- return new QScriptValuePrivate(this, evaluate(script, file, lineNumber));
-}
-
-/*!
- Evaluates program and returns the result of the evaluation.
- \internal
-*/
-QScriptValuePrivate* QScriptEnginePrivate::evaluate(const QScriptProgramPrivate* program)
-{
- if (program->isNull())
- return new QScriptValuePrivate;
- return new QScriptValuePrivate(this, evaluate(program->program(), program->file(), program->line()));
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h
deleted file mode 100644
index bf958ba..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptengine_p_h
-#define qscriptengine_p_h
-
-#include "qscriptconverter_p.h"
-#include "qscriptengine.h"
-#include "qscriptstring_p.h"
-#include "qscriptsyntaxcheckresult_p.h"
-#include "qscriptvalue.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-
-class QScriptEngine;
-class QScriptSyntaxCheckResultPrivate;
-
-class QScriptEnginePrivate : public QSharedData {
-public:
- static QScriptEnginePtr get(const QScriptEngine* q) { Q_ASSERT(q); return q->d_ptr; }
- static QScriptEngine* get(const QScriptEnginePrivate* d) { Q_ASSERT(d); return d->q_ptr; }
-
- QScriptEnginePrivate(const QScriptEngine*);
- ~QScriptEnginePrivate();
-
- QScriptSyntaxCheckResultPrivate* checkSyntax(const QString& program);
- QScriptValuePrivate* evaluate(const QString& program, const QString& fileName, int lineNumber);
- QScriptValuePrivate* evaluate(const QScriptProgramPrivate* program);
- inline JSValueRef evaluate(JSStringRef program, JSStringRef fileName, int lineNumber);
- inline void collectGarbage();
-
- inline JSValueRef makeJSValue(double number) const;
- inline JSValueRef makeJSValue(int number) const;
- inline JSValueRef makeJSValue(uint number) const;
- inline JSValueRef makeJSValue(const QString& string) const;
- inline JSValueRef makeJSValue(bool number) const;
- inline JSValueRef makeJSValue(QScriptValue::SpecialValue value) const;
-
- inline QScriptStringPrivate* toStringHandle(const QString& str) const;
-
- inline JSGlobalContextRef context() const;
-private:
- QScriptEngine* q_ptr;
- JSGlobalContextRef m_context;
-};
-
-
-JSValueRef QScriptEnginePrivate::evaluate(JSStringRef program, JSStringRef fileName, int lineNumber)
-{
- JSValueRef exception;
- JSValueRef result = JSEvaluateScript(m_context, program, /* Global Object */ 0, fileName, lineNumber, &exception);
- if (!result)
- return exception; // returns an exception
- return result;
-}
-
-void QScriptEnginePrivate::collectGarbage()
-{
- JSGarbageCollect(m_context);
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(double number) const
-{
- return JSValueMakeNumber(m_context, number);
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(int number) const
-{
- return JSValueMakeNumber(m_context, number);
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(uint number) const
-{
- return JSValueMakeNumber(m_context, number);
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(const QString& string) const
-{
- return JSValueMakeString(m_context, QScriptConverter::toString(string));
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(bool value) const
-{
- return JSValueMakeBoolean(m_context, value);
-}
-
-JSValueRef QScriptEnginePrivate::makeJSValue(QScriptValue::SpecialValue value) const
-{
- if (value == QScriptValue::NullValue)
- return JSValueMakeNull(m_context);
- return JSValueMakeUndefined(m_context);
-}
-
-QScriptStringPrivate* QScriptEnginePrivate::toStringHandle(const QString& str) const
-{
- return new QScriptStringPrivate(str);
-}
-
-JSGlobalContextRef QScriptEnginePrivate::context() const
-{
- return m_context;
-}
-
-#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.cpp
deleted file mode 100644
index d7d4948..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptprogram.h"
-
-#include "qscriptprogram_p.h"
-
-/*!
- \internal
-
- \class QScriptProgram
-
- \brief The QScriptProgram class encapsulates a Qt Script program.
-
- \ingroup script
-
- QScriptProgram retains the compiled representation of the script if
- possible. Thus, QScriptProgram can be used to evaluate the same
- script multiple times more efficiently.
-
- \code
- QScriptEngine engine;
- QScriptProgram program("1 + 2");
- QScriptValue result = engine.evaluate(program);
- \endcode
-*/
-
-/*!
- Constructs a null QScriptProgram.
-*/
-QScriptProgram::QScriptProgram()
- : d_ptr(new QScriptProgramPrivate)
-{}
-
-/*!
- Constructs a new QScriptProgram with the given \a sourceCode, \a
- fileName and \a firstLineNumber.
-*/
-QScriptProgram::QScriptProgram(const QString& sourceCode,
- const QString fileName,
- int firstLineNumber)
- : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber))
-{}
-
-/*!
- Destroys this QScriptProgram.
-*/
-QScriptProgram::~QScriptProgram()
-{}
-
-/*!
- Constructs a new QScriptProgram that is a copy of \a other.
-*/
-QScriptProgram::QScriptProgram(const QScriptProgram& other)
-{
- d_ptr = other.d_ptr;
-}
-
-/*!
- Assigns the \a other value to this QScriptProgram.
-*/
-QScriptProgram& QScriptProgram::operator=(const QScriptProgram& other)
-{
- d_ptr = other.d_ptr;
- return *this;
-}
-
-/*!
- Returns true if this QScriptProgram is null; otherwise
- returns false.
-*/
-bool QScriptProgram::isNull() const
-{
- return d_ptr->isNull();
-}
-
-/*!
- Returns the source code of this program.
-*/
-QString QScriptProgram::sourceCode() const
-{
- return d_ptr->sourceCode();
-}
-
-/*!
- Returns the filename associated with this program.
-*/
-QString QScriptProgram::fileName() const
-{
- return d_ptr->fileName();
-}
-
-/*!
- Returns the line number associated with this program.
-*/
-int QScriptProgram::firstLineNumber() const
-{
- return d_ptr->firstLineNumber();
-}
-
-/*!
- Returns true if this QScriptProgram is equal to \a other;
- otherwise returns false.
-*/
-bool QScriptProgram::operator==(const QScriptProgram& other) const
-{
- return d_ptr == other.d_ptr || *d_ptr == *other.d_ptr;
-}
-
-/*!
- Returns true if this QScriptProgram is not equal to \a other;
- otherwise returns false.
-*/
-bool QScriptProgram::operator!=(const QScriptProgram& other) const
-{
- return d_ptr != other.d_ptr && *d_ptr != *other.d_ptr;
-}
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.h
deleted file mode 100644
index 93c8a3c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptprogram_h
-#define qscriptprogram_h
-
-#include "qtscriptglobal.h"
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-
-class QScriptProgramPrivate;
-class Q_JAVASCRIPT_EXPORT QScriptProgram {
-public:
- QScriptProgram();
- QScriptProgram(const QString& sourceCode,
- const QString fileName = QString(),
- int firstLineNumber = 1);
- QScriptProgram(const QScriptProgram& other);
- ~QScriptProgram();
-
- QScriptProgram& operator=(const QScriptProgram& other);
-
- bool isNull() const;
-
- QString sourceCode() const;
- QString fileName() const;
- int firstLineNumber() const;
-
- bool operator==(const QScriptProgram& other) const;
- bool operator!=(const QScriptProgram& other) const;
-
-private:
- QExplicitlySharedDataPointer<QScriptProgramPrivate> d_ptr;
- Q_DECLARE_PRIVATE(QScriptProgram)
-};
-
-#endif // qscriptprogram_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram_p.h
deleted file mode 100644
index 6e80e85..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptprogram_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptprogram_p_h
-#define qscriptprogram_p_h
-
-#include "qscriptconverter_p.h"
-#include "qscriptprogram.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-
-/*
- FIXME The QScriptProgramPrivate potentially could be much faster. In current implementation we
- gain CPU time only by avoiding QString -> JSStringRef conversion. In the ideal world we should
- have a function inside the JSC C API that could provide us "parse once, execute multiple times"
- functionality.
-*/
-
-class QScriptProgramPrivate : public QSharedData {
-public:
- inline static QScriptProgramPrivate* get(const QScriptProgram& program);
- inline QScriptProgramPrivate();
- inline QScriptProgramPrivate(const QString& sourceCode,
- const QString fileName,
- int firstLineNumber);
-
- inline ~QScriptProgramPrivate();
-
- inline bool isNull() const;
-
- inline QString sourceCode() const;
- inline QString fileName() const;
- inline int firstLineNumber() const;
-
- inline bool operator==(const QScriptProgramPrivate& other) const;
- inline bool operator!=(const QScriptProgramPrivate& other) const;
-
- inline JSStringRef program() const;
- inline JSStringRef file() const;
- inline int line() const;
-private:
- JSStringRef m_program;
- JSStringRef m_fileName;
- int m_line;
-};
-
-QScriptProgramPrivate* QScriptProgramPrivate::get(const QScriptProgram& program)
-{
- return const_cast<QScriptProgramPrivate*>(program.d_ptr.constData());
-}
-
-QScriptProgramPrivate::QScriptProgramPrivate()
- : m_program(0)
- , m_fileName(0)
- , m_line(-1)
-{}
-
-QScriptProgramPrivate::QScriptProgramPrivate(const QString& sourceCode,
- const QString fileName,
- int firstLineNumber)
- : m_program(QScriptConverter::toString(sourceCode))
- , m_fileName(QScriptConverter::toString(fileName))
- , m_line(firstLineNumber)
-{}
-
-QScriptProgramPrivate::~QScriptProgramPrivate()
-{
- if (!isNull()) {
- JSStringRelease(m_program);
- JSStringRelease(m_fileName);
- }
-}
-
-bool QScriptProgramPrivate::isNull() const
-{
- return !m_program;
-}
-
-QString QScriptProgramPrivate::sourceCode() const
-{
- return QScriptConverter::toString(m_program);
-}
-
-QString QScriptProgramPrivate::fileName() const
-{
- return QScriptConverter::toString(m_fileName);
-}
-
-int QScriptProgramPrivate::firstLineNumber() const
-{
- return m_line;
-}
-
-bool QScriptProgramPrivate::operator==(const QScriptProgramPrivate& other) const
-{
- return m_line == other.m_line
- && JSStringIsEqual(m_fileName, other.m_fileName)
- && JSStringIsEqual(m_program, other.m_program);
-}
-
-bool QScriptProgramPrivate::operator!=(const QScriptProgramPrivate& other) const
-{
- return m_line != other.m_line
- || !JSStringIsEqual(m_fileName, other.m_fileName)
- || !JSStringIsEqual(m_program, other.m_program);
-}
-
-JSStringRef QScriptProgramPrivate::program() const { return m_program; }
-JSStringRef QScriptProgramPrivate::file() const {return m_fileName; }
-int QScriptProgramPrivate::line() const { return m_line; }
-
-#endif // qscriptprogram_p_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.cpp
deleted file mode 100644
index 83c03c5..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptstring.h"
-
-#include "qscriptstring_p.h"
-#include <QtCore/qhash.h>
-
-/*!
- Constructs an invalid QScriptString.
-*/
-QScriptString::QScriptString()
- : d_ptr(new QScriptStringPrivate())
-{
-}
-/*!
- Constructs an QScriptString from internal representation
- \internal
-*/
-QScriptString::QScriptString(QScriptStringPrivate* d)
- : d_ptr(d)
-{
-}
-
-/*!
- Constructs a new QScriptString that is a copy of \a other.
-*/
-QScriptString::QScriptString(const QScriptString& other)
-{
- d_ptr = other.d_ptr;
-}
-
-/*!
- Destroys this QScriptString.
-*/
-QScriptString::~QScriptString()
-{
-}
-
-/*!
- Assigns the \a other value to this QScriptString.
-*/
-QScriptString& QScriptString::operator=(const QScriptString& other)
-{
- d_ptr = other.d_ptr;
- return *this;
-}
-
-/*!
- Returns true if this QScriptString is valid; otherwise
- returns false.
-*/
-bool QScriptString::isValid() const
-{
- return d_ptr->isValid();
-}
-
-/*!
- Returns true if this QScriptString is equal to \a other;
- otherwise returns false.
-*/
-bool QScriptString::operator==(const QScriptString& other) const
-{
- return d_ptr == other.d_ptr || *d_ptr == *(other.d_ptr);
-}
-
-/*!
- Returns true if this QScriptString is not equal to \a other;
- otherwise returns false.
-*/
-bool QScriptString::operator!=(const QScriptString& other) const
-{
- return d_ptr != other.d_ptr || *d_ptr != *(other.d_ptr);
-}
-
-/*!
- Attempts to convert this QScriptString to a QtScript array index,
- and returns the result.
-
- If a conversion error occurs, *\a{ok} is set to false; otherwise
- *\a{ok} is set to true.
-*/
-quint32 QScriptString::toArrayIndex(bool* ok) const
-{
- return d_ptr->toArrayIndex(ok);
-}
-
-/*!
- Returns the string that this QScriptString represents, or a
- null string if this QScriptString is not valid.
-
- \sa isValid()
-*/
-QString QScriptString::toString() const
-{
- return d_ptr->toString();
-}
-
-/*!
- Returns the string that this QScriptString represents, or a
- null string if this QScriptString is not valid.
-
- \sa toString()
-*/
-QScriptString::operator QString() const
-{
- return d_ptr->toString();
-}
-
-uint qHash(const QScriptString& key)
-{
- return qHash(QScriptStringPrivate::get(key)->id());
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.h
deleted file mode 100644
index 16593bc..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptstring_h
-#define qscriptstring_h
-
-#include "qtscriptglobal.h"
-#include <QtCore/qshareddata.h>
-#include <QtCore/qstring.h>
-
-class QScriptStringPrivate;
-typedef QExplicitlySharedDataPointer<QScriptStringPrivate> QScriptStringPtr;
-
-class Q_JAVASCRIPT_EXPORT QScriptString {
-public:
- QScriptString();
- QScriptString(const QScriptString& other);
- ~QScriptString();
-
- QScriptString& operator=(const QScriptString& other);
-
- bool isValid() const;
-
- bool operator==(const QScriptString& other) const;
- bool operator!=(const QScriptString& other) const;
-
- quint32 toArrayIndex(bool* ok = 0) const;
-
- QString toString() const;
- operator QString() const;
-
-private:
- QScriptString(QScriptStringPrivate* d);
-
- QScriptStringPtr d_ptr;
-
- friend class QScriptStringPrivate;
-};
-
-uint qHash(const QScriptString& key);
-
-#endif // qscriptstring_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring_p.h
deleted file mode 100644
index f4fd117..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptstring_p.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptstring_p_h
-#define qscriptstring_p_h
-
-#include "qscriptconverter_p.h"
-#include "qscriptstring.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qshareddata.h>
-
-class QScriptStringPrivate : public QSharedData {
-public:
- inline QScriptStringPrivate();
- inline QScriptStringPrivate(const QString& qtstring);
- inline ~QScriptStringPrivate();
-
- static inline QScriptString get(QScriptStringPrivate* d);
- static inline QScriptStringPtr get(const QScriptString& p);
-
- inline bool isValid() const;
-
- inline bool operator==(const QScriptStringPrivate& other) const;
- inline bool operator!=(const QScriptStringPrivate& other) const;
-
- inline quint32 toArrayIndex(bool* ok = 0) const;
-
- inline QString toString() const;
-
- inline quint64 id() const;
-
-private:
- JSStringRef m_string;
-};
-
-
-QScriptStringPrivate::QScriptStringPrivate()
- : m_string(0)
-{}
-
-QScriptStringPrivate::QScriptStringPrivate(const QString& qtstring)
- : m_string(JSStringRetain(QScriptConverter::toString(qtstring)))
-{}
-
-QScriptStringPrivate::~QScriptStringPrivate()
-{
- if (isValid())
- JSStringRelease(m_string);
-}
-
-QScriptString QScriptStringPrivate::get(QScriptStringPrivate* d)
-{
- Q_ASSERT(d);
- return QScriptString(d);
-}
-
-QScriptStringPtr QScriptStringPrivate::get(const QScriptString& p)
-{
- return p.d_ptr;
-}
-
-bool QScriptStringPrivate::isValid() const
-{
- return m_string;
-}
-
-bool QScriptStringPrivate::operator==(const QScriptStringPrivate& other) const
-{
- return isValid() && other.isValid() && JSStringIsEqual(m_string, other.m_string);
-}
-
-bool QScriptStringPrivate::operator!=(const QScriptStringPrivate& other) const
-{
- return isValid() && other.isValid() && !JSStringIsEqual(m_string, other.m_string);
-}
-
-quint32 QScriptStringPrivate::toArrayIndex(bool* ok) const
-{
- quint32 idx = QScriptConverter::toArrayIndex(m_string);
- if (ok)
- *ok = (idx != 0xffffffff);
- return idx;
-}
-
-QString QScriptStringPrivate::toString() const
-{
- return QScriptConverter::toString(m_string);
-}
-
-quint64 QScriptStringPrivate::id() const
-{
- return reinterpret_cast<quint32>(m_string);
-}
-
-#endif // qscriptstring_p_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
deleted file mode 100644
index 2085f5b..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptsyntaxcheckresult.h"
-#include "qscriptsyntaxcheckresult_p.h"
-
-/*!
- \class QScriptSyntaxCheckResult
-
- \brief The QScriptSyntaxCheckResult class provides the result of a script syntax check.
-
- \ingroup script
- \mainclass
-
- QScriptSyntaxCheckResult is returned by QScriptEngine::checkSyntax() to
- provide information about the syntactical (in)correctness of a script.
-*/
-
-/*!
- \enum QScriptSyntaxCheckResult::State
-
- This enum specifies the state of a syntax check.
-
- \value Error The program contains a syntax error.
- \value Intermediate The program is incomplete.
- \value Valid The program is a syntactically correct Qt Script program.
-*/
-
-/*!
- Constructs a new QScriptSyntaxCheckResult from the \a other result.
-*/
-QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult& other)
- : d_ptr(other.d_ptr)
-{}
-
-/*!
- Constructs a new QScriptSyntaxCheckResult from an internal representation.
- \internal
-*/
-QScriptSyntaxCheckResult::QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate* d)
- : d_ptr(d)
-{}
-
-/*!
- Destroys this QScriptSyntaxCheckResult.
-*/
-QScriptSyntaxCheckResult::~QScriptSyntaxCheckResult()
-{}
-
-/*!
- Assigns the \a other result to this QScriptSyntaxCheckResult, and returns a
- reference to this QScriptSyntaxCheckResult.
-*/
-QScriptSyntaxCheckResult& QScriptSyntaxCheckResult::operator=(const QScriptSyntaxCheckResult& other)
-{
- d_ptr = other.d_ptr;
- return *this;
-}
-
-/*!
- Returns the state of this QScriptSyntaxCheckResult.
-*/
-QScriptSyntaxCheckResult::State QScriptSyntaxCheckResult::state() const
-{
- return d_ptr->state();
-}
-
-/*!
- Returns the error line number of this QScriptSyntaxCheckResult, or -1 if
- there is no error.
-
- \sa state(), errorMessage()
-*/
-int QScriptSyntaxCheckResult::errorLineNumber() const
-{
- return d_ptr->errorLineNumber();
-}
-
-/*!
- Returns the error column number of this QScriptSyntaxCheckResult, or -1 if
- there is no error.
-
- \sa state(), errorLineNumber()
-*/
-int QScriptSyntaxCheckResult::errorColumnNumber() const
-{
- return d_ptr->errorColumnNumber();
-}
-
-/*!
- Returns the error message of this QScriptSyntaxCheckResult, or an empty
- string if there is no error.
-
- \sa state(), errorLineNumber()
-*/
-QString QScriptSyntaxCheckResult::errorMessage() const
-{
- return d_ptr->errorMessage();
-}
-
-QScriptSyntaxCheckResultPrivate::~QScriptSyntaxCheckResultPrivate()
-{
- if (m_exception)
- JSValueUnprotect(m_engine->context(), m_exception);
-}
-
-QString QScriptSyntaxCheckResultPrivate::errorMessage() const
-{
- if (m_exception)
- return QScriptConverter::toString(JSValueToStringCopy(m_engine->context(), m_exception, /* exception */ 0));
- return QString();
-}
-
-int QScriptSyntaxCheckResultPrivate::errorLineNumber() const
-{
- if (!m_exception)
- return -1;
- // m_exception is an instance of the Exception so it has "line" attribute.
- JSValueRef line = JSObjectGetProperty(m_engine->context(),
- m_exception,
- QScriptConverter::toString("line"),
- /* exceptions */0);
- return JSValueToNumber(m_engine->context(), line, /* exceptions */0);
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h
deleted file mode 100644
index aa57744..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptsyntaxcheckresult_h
-#define qscriptsyntaxcheckresult_h
-
-#include "qtscriptglobal.h"
-#include <QtCore/qshareddata.h>
-
-class QScriptSyntaxCheckResultPrivate;
-class Q_JAVASCRIPT_EXPORT QScriptSyntaxCheckResult {
-public:
- enum State {
- Error,
- Intermediate,
- Valid
- };
-
- QScriptSyntaxCheckResult(const QScriptSyntaxCheckResult& other);
- ~QScriptSyntaxCheckResult();
- QScriptSyntaxCheckResult& operator=(const QScriptSyntaxCheckResult& other);
-
- State state() const;
- int errorLineNumber() const;
- int errorColumnNumber() const;
- QString errorMessage() const;
-
-private:
- QScriptSyntaxCheckResult(QScriptSyntaxCheckResultPrivate* d);
- QExplicitlySharedDataPointer<QScriptSyntaxCheckResultPrivate> d_ptr;
-
- friend class QScriptSyntaxCheckResultPrivate;
-};
-#endif // qscriptsyntaxcheckresult_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h
deleted file mode 100644
index 6e1a131..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptsyntaxcheckresult_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptsyntaxcheckresult_p_h
-#define qscriptsyntaxcheckresult_p_h
-
-#include "qscriptconverter_p.h"
-#include "qscriptengine_p.h"
-#include "qscriptsyntaxcheckresult.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qshareddata.h>
-
-class QScriptSyntaxCheckResultPrivate : public QSharedData {
-public:
- static inline QScriptSyntaxCheckResult get(QScriptSyntaxCheckResultPrivate* p);
- inline QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine);
- inline QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine, JSObjectRef value);
- ~QScriptSyntaxCheckResultPrivate();
-
- inline QScriptSyntaxCheckResult::State state() const;
- int errorLineNumber() const;
- inline int errorColumnNumber() const;
- QString errorMessage() const;
-private:
- JSObjectRef m_exception;
- QScriptEnginePtr m_engine;
-};
-
-QScriptSyntaxCheckResult QScriptSyntaxCheckResultPrivate::get(QScriptSyntaxCheckResultPrivate* p)
-{
- return QScriptSyntaxCheckResult(p);
-}
-
-QScriptSyntaxCheckResultPrivate::QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine)
- : m_exception(0)
- , m_engine(const_cast<QScriptEnginePrivate*>(engine))
-{}
-
-QScriptSyntaxCheckResultPrivate::QScriptSyntaxCheckResultPrivate(const QScriptEnginePrivate* engine, JSObjectRef value)
- : m_exception(value)
- , m_engine(const_cast<QScriptEnginePrivate*>(engine))
-{}
-
-QScriptSyntaxCheckResult::State QScriptSyntaxCheckResultPrivate::state() const
-{
- // FIXME This function doesn't return QScriptSyntaxCheckResult::Intermediate
- return m_exception ? QScriptSyntaxCheckResult::Error : QScriptSyntaxCheckResult::Valid;
-}
-
-int QScriptSyntaxCheckResultPrivate::errorColumnNumber() const
-{
- // FIXME JSC C API doesn't expose the error column number.
- return m_exception ? 1 : -1;
-}
-
-
-#endif // qscriptsyntaxcheckresult_p_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp
deleted file mode 100644
index 127fe04..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-
-#include "qscriptvalue.h"
-
-#include "qscriptengine.h"
-#include "qscriptengine_p.h"
-#include "qscriptvalue_p.h"
-#include <QtCore/qdebug.h>
-
-/*!
- Constructs an invalid value.
-*/
-QScriptValue::QScriptValue()
- : d_ptr(new QScriptValuePrivate())
-{
-}
-
-/*!
- Constructs a new QScriptValue with a boolean \a value.
-*/
-QScriptValue::QScriptValue(bool value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a number \a value.
-*/
-QScriptValue::QScriptValue(int value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a number \a value.
-*/
-QScriptValue::QScriptValue(uint value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a number \a value.
-*/
-QScriptValue::QScriptValue(qsreal value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a string \a value.
-*/
-QScriptValue::QScriptValue(const QString& value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a special \a value.
-*/
-QScriptValue::QScriptValue(SpecialValue value)
- : d_ptr(new QScriptValuePrivate(value))
-{
-}
-
-/*!
- Constructs a new QScriptValue with a string \a value.
-*/
-QScriptValue::QScriptValue(const char* value)
- : d_ptr(new QScriptValuePrivate(QString::fromUtf8(value)))
-{
-}
-
-/*!
- Block automatic convertion to bool
- \internal
-*/
-QScriptValue::QScriptValue(void* d)
-{
- Q_ASSERT(false);
-}
-
-/*!
- Constructs a new QScriptValue from private
- \internal
-*/
-QScriptValue::QScriptValue(QScriptValuePrivate* d)
- : d_ptr(d)
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the boolean \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, bool value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the integer \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, int value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the unsigned integer \a value and
- registers it with the script \a engine.
- */
-QScriptValue::QScriptValue(QScriptEngine* engine, uint value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the qsreal \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, qsreal value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the string \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, const QString& value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the string \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, const char* value)
- : d_ptr(new QScriptValuePrivate(engine, QString::fromUtf8(value)))
-{
-}
-
-/*!
- \obsolete
-
- Constructs a new QScriptValue with the special \a value and
- registers it with the script \a engine.
-*/
-QScriptValue::QScriptValue(QScriptEngine* engine, SpecialValue value)
- : d_ptr(new QScriptValuePrivate(engine, value))
-{
-}
-
-/*!
- Constructs a new QScriptValue that is a copy of \a other.
-
- Note that if \a other is an object (i.e., isObject() would return
- true), then only a reference to the underlying object is copied into
- the new script value (i.e., the object itself is not copied).
-*/
-QScriptValue::QScriptValue(const QScriptValue& other)
- : d_ptr(other.d_ptr)
-{
-}
-
-/*!
- Destroys this QScriptValue.
-*/
-QScriptValue::~QScriptValue()
-{
-}
-
-/*!
- Returns true if this QScriptValue is valid; otherwise returns
- false.
-*/
-bool QScriptValue::isValid() const
-{
- return d_ptr->isValid();
-}
-
-/*!
- Returns true if this QScriptValue is of the primitive type Boolean;
- otherwise returns false.
-
- \sa toBool()
-*/
-bool QScriptValue::isBool() const
-{
- return d_ptr->isBool();
-}
-
-/*!
- \obsolete
-
- Use isBool() instead.
- Returns true if this QScriptValue is of the primitive type Boolean;
- otherwise returns false.
-*/
-bool QScriptValue::isBoolean() const
-{
- return d_ptr->isBool();
-}
-
-/*!
- Returns true if this QScriptValue is of the primitive type Number;
- otherwise returns false.
-
- \sa toNumber()
-*/
-bool QScriptValue::isNumber() const
-{
- return d_ptr->isNumber();
-}
-
-/*!
- Returns true if this QScriptValue is of the primitive type Null;
- otherwise returns false.
-
- \sa QScriptEngine::nullValue()
-*/
-bool QScriptValue::isNull() const
-{
- return d_ptr->isNull();
-}
-
-/*!
- Returns true if this QScriptValue is of the primitive type String;
- otherwise returns false.
-
- \sa toString()
-*/
-bool QScriptValue::isString() const
-{
- return d_ptr->isString();
-}
-
-/*!
- Returns true if this QScriptValue is of the primitive type Undefined;
- otherwise returns false.
-
- \sa QScriptEngine::undefinedValue()
-*/
-bool QScriptValue::isUndefined() const
-{
- return d_ptr->isUndefined();
-}
-
-/*!
- Returns true if this QScriptValue is an object of the Error class;
- otherwise returns false.
-
- \sa QScriptContext::throwError()
-*/
-bool QScriptValue::isError() const
-{
- return d_ptr->isError();
-}
-
-/*!
- Returns true if this QScriptValue is of the Object type; otherwise
- returns false.
-
- Note that function values, variant values, and QObject values are
- objects, so this function returns true for such values.
-
- \sa toObject(), QScriptEngine::newObject()
-*/
-bool QScriptValue::isObject() const
-{
- return d_ptr->isObject();
-}
-
-/*!
- Returns true if this QScriptValue is a function; otherwise returns
- false.
-
- \sa call()
-*/
-bool QScriptValue::isFunction() const
-{
- return d_ptr->isFunction();
-}
-
-/*!
- Returns the string value of this QScriptValue, as defined in
- \l{ECMA-262} section 9.8, "ToString".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's toString() function (and possibly valueOf()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa isString()
-*/
-QString QScriptValue::toString() const
-{
- return d_ptr->toString();
-}
-
-/*!
- Returns the number value of this QScriptValue, as defined in
- \l{ECMA-262} section 9.3, "ToNumber".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa isNumber(), toInteger(), toInt32(), toUInt32(), toUInt16()
-*/
-qsreal QScriptValue::toNumber() const
-{
- return d_ptr->toNumber();
-}
-
-/*!
- Returns the boolean value of this QScriptValue, using the conversion
- rules described in \l{ECMA-262} section 9.2, "ToBoolean".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa isBool()
-*/
-bool QScriptValue::toBool() const
-{
- return d_ptr->toBool();
-}
-
-/*!
- \obsolete
-
- Use toBool() instead.
-*/
-bool QScriptValue::toBoolean() const
-{
- return d_ptr->toBool();
-}
-
-/*!
- Returns the integer value of this QScriptValue, using the conversion
- rules described in \l{ECMA-262} section 9.4, "ToInteger".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa toNumber()
-*/
-qsreal QScriptValue::toInteger() const
-{
- return d_ptr->toInteger();
-}
-
-/*!
- Returns the signed 32-bit integer value of this QScriptValue, using
- the conversion rules described in \l{ECMA-262} section 9.5, "ToInt32".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa toNumber(), toUInt32()
-*/
-qint32 QScriptValue::toInt32() const
-{
- return d_ptr->toInt32();
-}
-
-/*!
- Returns the unsigned 32-bit integer value of this QScriptValue, using
- the conversion rules described in \l{ECMA-262} section 9.6, "ToUint32".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa toNumber(), toInt32()
-*/
-quint32 QScriptValue::toUInt32() const
-{
- return d_ptr->toUInt32();
-}
-
-/*!
- Returns the unsigned 16-bit integer value of this QScriptValue, using
- the conversion rules described in \l{ECMA-262} section 9.7, "ToUint16".
-
- Note that if this QScriptValue is an object, calling this function
- has side effects on the script engine, since the engine will call
- the object's valueOf() function (and possibly toString()) in an
- attempt to convert the object to a primitive value (possibly
- resulting in an uncaught script exception).
-
- \sa toNumber()
-*/
-quint16 QScriptValue::toUInt16() const
-{
- return d_ptr->toUInt16();
-}
-
-/*!
- Calls this QScriptValue as a function, using \a thisObject as
- the `this' object in the function call, and passing \a args
- as arguments to the function. Returns the value returned from
- the function.
-
- If this QScriptValue is not a function, call() does nothing
- and returns an invalid QScriptValue.
-
- Note that if \a thisObject is not an object, the global object
- (see \l{QScriptEngine::globalObject()}) will be used as the
- `this' object.
-
- Calling call() can cause an exception to occur in the script engine;
- in that case, call() returns the value that was thrown (typically an
- \c{Error} object). You can call
- QScriptEngine::hasUncaughtException() to determine if an exception
- occurred.
-
- \snippet doc/src/snippets/code/src_script_qscriptvalue.cpp 2
-
- \sa construct()
-*/
-QScriptValue QScriptValue::call(const QScriptValue& thisObject, const QScriptValueList& args)
-{
- return d_ptr->call(thisObject.d_ptr.data(), args);
-}
-
-/*!
- Returns the QScriptEngine that created this QScriptValue,
- or 0 if this QScriptValue is invalid or the value is not
- associated with a particular engine.
-*/
-QScriptEngine* QScriptValue::engine() const
-{
- QScriptEnginePrivate* engine = d_ptr->engine();
- if (engine)
- return QScriptEnginePrivate::get(engine);
- return 0;
-}
-
-/*!
- Assigns the \a other value to this QScriptValue.
-
- Note that if \a other is an object (isObject() returns true),
- only a reference to the underlying object will be assigned;
- the object itself will not be copied.
-*/
-QScriptValue& QScriptValue::operator=(const QScriptValue& other)
-{
- d_ptr = other.d_ptr;
- return *this;
-}
-
-/*!
- Returns true if this QScriptValue is equal to \a other, otherwise
- returns false. The comparison follows the behavior described in
- \l{ECMA-262} section 11.9.3, "The Abstract Equality Comparison
- Algorithm".
-
- This function can return true even if the type of this QScriptValue
- is different from the type of the \a other value; i.e. the
- comparison is not strict. For example, comparing the number 9 to
- the string "9" returns true; comparing an undefined value to a null
- value returns true; comparing a \c{Number} object whose primitive
- value is 6 to a \c{String} object whose primitive value is "6"
- returns true; and comparing the number 1 to the boolean value
- \c{true} returns true. If you want to perform a comparison
- without such implicit value conversion, use strictlyEquals().
-
- Note that if this QScriptValue or the \a other value are objects,
- calling this function has side effects on the script engine, since
- the engine will call the object's valueOf() function (and possibly
- toString()) in an attempt to convert the object to a primitive value
- (possibly resulting in an uncaught script exception).
-
- \sa strictlyEquals(), lessThan()
-*/
-bool QScriptValue::equals(const QScriptValue& other) const
-{
- return d_ptr == other.d_ptr || d_ptr->equals(QScriptValuePrivate::get(other));
-}
-
-/*!
- Returns true if this QScriptValue is equal to \a other using strict
- comparison (no conversion), otherwise returns false. The comparison
- follows the behavior described in \l{ECMA-262} section 11.9.6, "The
- Strict Equality Comparison Algorithm".
-
- If the type of this QScriptValue is different from the type of the
- \a other value, this function returns false. If the types are equal,
- the result depends on the type, as shown in the following table:
-
- \table
- \header \o Type \o Result
- \row \o Undefined \o true
- \row \o Null \o true
- \row \o Boolean \o true if both values are true, false otherwise
- \row \o Number \o false if either value is NaN (Not-a-Number); true if values are equal, false otherwise
- \row \o String \o true if both values are exactly the same sequence of characters, false otherwise
- \row \o Object \o true if both values refer to the same object, false otherwise
- \endtable
-
- \sa equals()
-*/
-bool QScriptValue::strictlyEquals(const QScriptValue& other) const
-{
- return d_ptr == other.d_ptr || d_ptr->strictlyEquals(QScriptValuePrivate::get(other));
-}
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h
deleted file mode 100644
index d45aed3..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptvalue_h
-#define qscriptvalue_h
-
-#include <QtCore/qlist.h>
-#include <QtCore/qshareddata.h>
-
-class QScriptEngine;
-class QScriptValuePrivate;
-
-class QScriptValue;
-typedef QList<QScriptValue> QScriptValueList;
-
-typedef double qsreal;
-
-class QScriptValue {
-public:
- enum SpecialValue {
- NullValue,
- UndefinedValue
- };
-
- QScriptValue();
- QScriptValue(bool value);
- QScriptValue(int value);
- QScriptValue(uint value);
- QScriptValue(qsreal value);
- QScriptValue(const QString& value);
- QScriptValue(const char* value);
- QScriptValue(SpecialValue value);
- QScriptValue(const QScriptValue& other);
-
- QScriptValue(QScriptEngine* engine, bool value);
- QScriptValue(QScriptEngine* engine, int value);
- QScriptValue(QScriptEngine* engine, uint value);
- QScriptValue(QScriptEngine* engine, qsreal value);
- QScriptValue(QScriptEngine* engine, const QString& value);
- QScriptValue(QScriptEngine* engine, const char* value);
- QScriptValue(QScriptEngine* engine, SpecialValue value);
-
- ~QScriptValue();
-
- QScriptValue& operator=(const QScriptValue& other);
- bool equals(const QScriptValue& other) const;
- bool strictlyEquals(const QScriptValue& other) const;
-
- QScriptEngine* engine() const;
-
- bool isValid() const;
- bool isBool() const;
- bool isBoolean() const;
- bool isNumber() const;
- bool isFunction() const;
- bool isNull() const;
- bool isString() const;
- bool isUndefined() const;
- bool isObject() const;
- bool isError() const;
-
- QString toString() const;
- qsreal toNumber() const;
- bool toBool() const;
- bool toBoolean() const;
- qsreal toInteger() const;
- qint32 toInt32() const;
- quint32 toUInt32() const;
- quint16 toUInt16() const;
-
- QScriptValue call(const QScriptValue& thisObject = QScriptValue(),
- const QScriptValueList& args = QScriptValueList());
-
-private:
- QScriptValue(void*);
- QScriptValue(QScriptValuePrivate*);
-
- QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr;
-
- friend class QScriptValuePrivate;
-};
-
-#endif // qscriptvalue_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h b/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h
deleted file mode 100644
index e5c2a82..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qscriptvalue_p_h
-#define qscriptvalue_p_h
-
-#include "qscriptconverter_p.h"
-#include "qscriptengine_p.h"
-#include "qscriptvalue.h"
-#include <JavaScriptCore/JavaScript.h>
-#include <QtCore/qmath.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qvarlengtharray.h>
-
-class QScriptEngine;
-class QScriptValue;
-
-/*
- \internal
- \class QScriptValuePrivate
-
- Implementation of QScriptValue.
- The implementation is based on a state machine. The states names are included in
- QScriptValuePrivate::State. Each method should check for the current state and then perform a
- correct action.
-
- State:
- Invalid -> QSVP is invalid, no assumptions should be made about class members (apart from m_value).
- CString -> QSVP is created from QString or const char* and no JSC engine has been associated yet.
- Current value is kept in m_string,
- CNumber -> QSVP is created from int, uint, double... and no JSC engine has been bind yet. Current
- value is kept in m_number
- CBool -> QSVP is created from bool and no JSC engine has been associated yet. Current value is kept
- in m_number
- CSpecial -> QSVP is Undefined or Null, but a JSC engine hasn't been associated yet, current value
- is kept in m_number (cast of QScriptValue::SpecialValue)
- JSValue -> QSVP is associated with engine, but there is no information about real type, the state
- have really short live cycle. Normally it is created as a function call result.
- JSPrimitive -> QSVP is associated with engine, and it is sure that it isn't a JavaScript object.
- JSObject -> QSVP is associated with engine, and it is sure that it is a JavaScript object.
-
- Each state keep all necessary information to invoke all methods, if not it should be changed to
- a proper state. Changed state shouldn't be reverted.
-*/
-
-class QScriptValuePrivate : public QSharedData {
-public:
- inline static QScriptValuePrivate* get(const QScriptValue& q);
- inline static QScriptValue get(const QScriptValuePrivate* d);
- inline static QScriptValue get(QScriptValuePrivate* d);
-
- inline ~QScriptValuePrivate();
-
- inline QScriptValuePrivate();
- inline QScriptValuePrivate(const QString& string);
- inline QScriptValuePrivate(bool value);
- inline QScriptValuePrivate(int number);
- inline QScriptValuePrivate(uint number);
- inline QScriptValuePrivate(qsreal number);
- inline QScriptValuePrivate(QScriptValue::SpecialValue value);
-
- inline QScriptValuePrivate(const QScriptEngine* engine, bool value);
- inline QScriptValuePrivate(const QScriptEngine* engine, int value);
- inline QScriptValuePrivate(const QScriptEngine* engine, uint value);
- inline QScriptValuePrivate(const QScriptEngine* engine, qsreal value);
- inline QScriptValuePrivate(const QScriptEngine* engine, const QString& value);
- inline QScriptValuePrivate(const QScriptEngine* engine, QScriptValue::SpecialValue value);
-
- inline QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value);
- inline QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value, JSObjectRef object);
-
- inline bool isValid() const;
- inline bool isBool();
- inline bool isNumber();
- inline bool isNull();
- inline bool isString();
- inline bool isUndefined();
- inline bool isError();
- inline bool isObject();
- inline bool isFunction();
-
- inline QString toString() const;
- inline qsreal toNumber() const;
- inline bool toBool() const;
- inline qsreal toInteger() const;
- inline qint32 toInt32() const;
- inline quint32 toUInt32() const;
- inline quint16 toUInt16() const;
-
- inline bool equals(QScriptValuePrivate* other);
- inline bool strictlyEquals(const QScriptValuePrivate* other) const;
- inline bool assignEngine(QScriptEnginePrivate* engine);
-
- inline QScriptValuePrivate* call(const QScriptValuePrivate* , const QScriptValueList& args);
-
- inline JSGlobalContextRef context() const;
- inline JSValueRef value() const;
- inline JSObjectRef object() const;
- inline QScriptEnginePrivate* engine() const;
-
-private:
- // Please, update class documentation when you change the enum.
- enum State {
- Invalid = 0,
- CString = 0x1000,
- CNumber,
- CBool,
- CSpecial,
- JSValue = 0x2000, // JS values are equal or higher then this value.
- JSPrimitive,
- JSObject
- } m_state;
- QScriptEnginePtr m_engine;
- QString m_string;
- qsreal m_number;
- JSValueRef m_value;
- JSObjectRef m_object;
-
- inline void setValue(JSValueRef);
-
- inline bool inherits(const char*);
- inline State refinedJSValue();
-
- inline bool isJSBased() const;
- inline bool isNumberBased() const;
- inline bool isStringBased() const;
-};
-
-QScriptValuePrivate* QScriptValuePrivate::get(const QScriptValue& q) { return q.d_ptr.data(); }
-
-QScriptValue QScriptValuePrivate::get(const QScriptValuePrivate* d)
-{
- return QScriptValue(const_cast<QScriptValuePrivate*>(d));
-}
-
-QScriptValue QScriptValuePrivate::get(QScriptValuePrivate* d)
-{
- return QScriptValue(d);
-}
-
-QScriptValuePrivate::~QScriptValuePrivate()
-{
- if (m_value)
- JSValueUnprotect(context(), m_value);
-}
-
-QScriptValuePrivate::QScriptValuePrivate()
- : m_state(Invalid)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QString& string)
- : m_state(CString)
- , m_string(string)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(bool value)
- : m_state(CBool)
- , m_number(value)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(int number)
- : m_state(CNumber)
- , m_number(number)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(uint number)
- : m_state(CNumber)
- , m_number(number)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(qsreal number)
- : m_state(CNumber)
- , m_number(number)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(QScriptValue::SpecialValue value)
- : m_state(CSpecial)
- , m_number(value)
- , m_value(0)
-{
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, bool value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CBool;
- m_number = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, int value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CNumber;
- m_number = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, uint value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CNumber;
- m_number = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, qsreal value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CNumber;
- m_number = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, const QString& value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CString;
- m_string = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEngine* engine, QScriptValue::SpecialValue value)
- : m_state(JSPrimitive)
-{
- if (!engine) {
- // slower path reinitialization
- m_state = CSpecial;
- m_number = value;
- m_value = 0;
- } else {
- m_engine = QScriptEnginePrivate::get(engine);
- m_value = m_engine->makeJSValue(value);
- JSValueProtect(context(), m_value);
- }
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value)
- : m_state(JSValue)
- , m_engine(const_cast<QScriptEnginePrivate*>(engine))
- , m_value(value)
-{
- Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
-}
-
-QScriptValuePrivate::QScriptValuePrivate(const QScriptEnginePrivate* engine, JSValueRef value, JSObjectRef object)
- : m_state(JSObject)
- , m_engine(const_cast<QScriptEnginePrivate*>(engine))
- , m_value(value)
- , m_object(object)
-{
- Q_ASSERT(engine);
- JSValueProtect(context(), m_value);
-}
-
-bool QScriptValuePrivate::isValid() const { return m_state != Invalid; }
-
-bool QScriptValuePrivate::isBool()
-{
- switch (m_state) {
- case CBool:
- return true;
- case JSValue:
- if (refinedJSValue() != JSPrimitive)
- return false;
- // Fall-through.
- case JSPrimitive:
- return JSValueIsBoolean(context(), value());
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isNumber()
-{
- switch (m_state) {
- case CNumber:
- return true;
- case JSValue:
- if (refinedJSValue() != JSPrimitive)
- return false;
- // Fall-through.
- case JSPrimitive:
- return JSValueIsNumber(context(), value());
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isNull()
-{
- switch (m_state) {
- case CSpecial:
- return m_number == static_cast<int>(QScriptValue::NullValue);
- case JSValue:
- if (refinedJSValue() != JSPrimitive)
- return false;
- // Fall-through.
- case JSPrimitive:
- return JSValueIsNull(context(), value());
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isString()
-{
- switch (m_state) {
- case CString:
- return true;
- case JSValue:
- if (refinedJSValue() != JSPrimitive)
- return false;
- // Fall-through.
- case JSPrimitive:
- return JSValueIsString(context(), value());
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isUndefined()
-{
- switch (m_state) {
- case CSpecial:
- return m_number == static_cast<int>(QScriptValue::UndefinedValue);
- case JSValue:
- if (refinedJSValue() != JSPrimitive)
- return false;
- // Fall-through.
- case JSPrimitive:
- return JSValueIsUndefined(context(), value());
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isError()
-{
- switch (m_state) {
- case JSValue:
- if (refinedJSValue() != JSObject)
- return false;
- // Fall-through.
- case JSObject:
- return inherits("Error");
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isObject()
-{
- switch (m_state) {
- case JSValue:
- return refinedJSValue() == JSObject;
- case JSObject:
- return true;
-
- default:
- return false;
- }
-}
-
-bool QScriptValuePrivate::isFunction()
-{
- switch (m_state) {
- case JSValue:
- if (refinedJSValue() != JSObject)
- return false;
- // Fall-through.
- case JSObject:
- return JSObjectIsFunction(context(), object());
- default:
- return false;
- }
-}
-
-QString QScriptValuePrivate::toString() const
-{
- switch (m_state) {
- case Invalid:
- return QString();
- case CBool:
- return m_number ? QString::fromLatin1("true") : QString::fromLatin1("false");
- case CString:
- return m_string;
- case CNumber:
- return QScriptConverter::toString(m_number);
- case CSpecial:
- return m_number == QScriptValue::NullValue ? QString::fromLatin1("null") : QString::fromLatin1("undefined");
- case JSValue:
- case JSPrimitive:
- case JSObject:
- return QScriptConverter::toString(JSValueToStringCopy(context(), value(), /* exception */ 0));
- }
-
- Q_ASSERT_X(false, "toString()", "Not all states are included in the previous switch statement.");
- return QString(); // Avoid compiler warning.
-}
-
-qsreal QScriptValuePrivate::toNumber() const
-{
- switch (m_state) {
- case JSValue:
- case JSPrimitive:
- case JSObject:
- return JSValueToNumber(context(), value(), /* exception */ 0);
- case CNumber:
- return m_number;
- case CBool:
- return m_number ? 1 : 0;
- case Invalid:
- return 0;
- case CSpecial:
- return m_number == QScriptValue::NullValue ? 0 : qQNaN();
- case CString:
- bool ok;
- qsreal result = m_string.toDouble(&ok);
- if (ok)
- return result;
- result = m_string.toInt(&ok, 0); // Try other bases.
- if (ok)
- return result;
- if (m_string == "Infinity" || m_string == "-Infinity")
- return qInf();
- return m_string.length() ? qQNaN() : 0;
- }
-
- Q_ASSERT_X(false, "toNumber()", "Not all states are included in the previous switch statement.");
- return 0; // Avoid compiler warning.
-}
-
-bool QScriptValuePrivate::toBool() const
-{
- switch (m_state) {
- case JSValue:
- case JSPrimitive:
- return JSValueToBoolean(context(), value());
- case JSObject:
- return true;
- case CNumber:
- return !(qIsNaN(m_number) || !m_number);
- case CBool:
- return m_number;
- case Invalid:
- case CSpecial:
- return false;
- case CString:
- return m_string.length();
- }
-
- Q_ASSERT_X(false, "toBool()", "Not all states are included in the previous switch statement.");
- return false; // Avoid compiler warning.
-}
-
-qsreal QScriptValuePrivate::toInteger() const
-{
- qsreal result = toNumber();
- if (qIsNaN(result))
- return 0;
- if (qIsInf(result))
- return result;
- return (result > 0) ? qFloor(result) : -1 * qFloor(-result);
-}
-
-qint32 QScriptValuePrivate::toInt32() const
-{
- qsreal result = toInteger();
- // Orginaly it should look like that (result == 0 || qIsInf(result) || qIsNaN(result)), but
- // some of these operation are invoked in toInteger subcall.
- if (qIsInf(result))
- return 0;
- return result;
-}
-
-quint32 QScriptValuePrivate::toUInt32() const
-{
- qsreal result = toInteger();
- // Orginaly it should look like that (result == 0 || qIsInf(result) || qIsNaN(result)), but
- // some of these operation are invoked in toInteger subcall.
- if (qIsInf(result))
- return 0;
- return result;
-}
-
-quint16 QScriptValuePrivate::toUInt16() const
-{
- return toInt32();
-}
-
-
-bool QScriptValuePrivate::equals(QScriptValuePrivate* other)
-{
- if (!isValid() || !other->isValid())
- return false;
-
- if ((m_state == other->m_state) && !isJSBased()) {
- if (isNumberBased())
- return m_number == other->m_number;
- return m_string == other->m_string;
- }
-
- if (isJSBased() && !other->isJSBased()) {
- if (!other->assignEngine(engine())) {
- qWarning("equals(): Cannot compare to a value created in a different engine");
- return false;
- }
- } else if (!isJSBased() && other->isJSBased()) {
- if (!other->assignEngine(other->engine())) {
- qWarning("equals(): Cannot compare to a value created in a different engine");
- return false;
- }
- }
-
- return JSValueIsEqual(context(), value(), other->value(), /* exception */ 0);
-}
-
-bool QScriptValuePrivate::strictlyEquals(const QScriptValuePrivate* other) const
-{
- if (m_state != other->m_state)
- return false;
- if (isJSBased()) {
- if (other->engine() != engine()) {
- qWarning("strictlyEquals(): Cannot compare to a value created in a different engine");
- return false;
- }
- return JSValueIsStrictEqual(context(), value(), other->value());
- }
- if (isStringBased())
- return m_string == other->m_string;
- if (isNumberBased())
- return m_number == other->m_number;
-
- return false; // Invalid state.
-}
-
-/*!
- Tries to assign \a engine to this value. Returns true on success; otherwise returns false.
-*/
-bool QScriptValuePrivate::assignEngine(QScriptEnginePrivate* engine)
-{
- JSValueRef value;
- switch (m_state) {
- case CBool:
- value = engine->makeJSValue(static_cast<bool>(m_number));
- break;
- case CString:
- value = engine->makeJSValue(m_string);
- break;
- case CNumber:
- value = engine->makeJSValue(m_number);
- break;
- case CSpecial:
- value = engine->makeJSValue(static_cast<QScriptValue::SpecialValue>(m_number));
- break;
- default:
- if (!isJSBased())
- Q_ASSERT_X(!isJSBased(), "assignEngine()", "Not all states are included in the previous switch statement.");
- else
- qWarning("JSValue can't be rassigned to an another engine.");
- return false;
- }
- m_engine = engine;
- m_state = JSPrimitive;
- setValue(value);
- return true;
-}
-
-QScriptValuePrivate* QScriptValuePrivate::call(const QScriptValuePrivate*, const QScriptValueList& args)
-{
- switch (m_state) {
- case JSValue:
- if (refinedJSValue() != JSObject)
- return new QScriptValuePrivate;
- // Fall-through.
- case JSObject:
- {
- // Convert all arguments and bind to the engine.
- int argc = args.size();
- QVarLengthArray<JSValueRef, 8> argv(argc);
- QScriptValueList::const_iterator i = args.constBegin();
- for (int j = 0; i != args.constEnd(); j++, i++) {
- QScriptValuePrivate* value = QScriptValuePrivate::get(*i);
- if (!value->assignEngine(engine())) {
- qWarning("QScriptValue::call() failed: cannot call function with values created in a different engine");
- return new QScriptValuePrivate;
- }
- argv[j] = value->value();
- }
-
- // Make the call
- JSValueRef exception = 0;
- JSValueRef result = JSObjectCallAsFunction(context(), object(), /* thisObject */ 0, argc, argv.constData(), &exception);
- if (!result && exception)
- return new QScriptValuePrivate(engine(), exception);
- if (result && !exception)
- return new QScriptValuePrivate(engine(), result);
- }
- // this QSV is not a function <-- !result && !exception. Fall-through.
- default:
- return new QScriptValuePrivate;
- }
-}
-
-QScriptEnginePrivate* QScriptValuePrivate::engine() const
-{
- // As long as m_engine is an autoinitializated pointer we can safely return it without
- // checking current state.
- return m_engine.data();
-}
-
-JSGlobalContextRef QScriptValuePrivate::context() const
-{
- Q_ASSERT(isJSBased());
- return m_engine->context();
-}
-
-JSValueRef QScriptValuePrivate::value() const
-{
- Q_ASSERT(isJSBased());
- return m_value;
-}
-
-JSObjectRef QScriptValuePrivate::object() const
-{
- Q_ASSERT(m_state == JSObject);
- return m_object;
-}
-
-void QScriptValuePrivate::setValue(JSValueRef value)
-{
- if (m_value)
- JSValueUnprotect(context(), m_value);
- if (value)
- JSValueProtect(context(), value);
- m_value = value;
-}
-
-/*!
- \internal
- Returns true if QSV is created from constructor with the given \a name, it has to be a
- built-in type.
-*/
-bool QScriptValuePrivate::inherits(const char* name)
-{
- Q_ASSERT(isJSBased());
- JSObjectRef globalObject = JSContextGetGlobalObject(context());
- JSValueRef error = JSObjectGetProperty(context(), globalObject, QScriptConverter::toString(name), 0);
- return JSValueIsInstanceOfConstructor(context(), value(), JSValueToObject(context(), error, /* exception */ 0), /* exception */ 0);
-}
-
-/*!
- \internal
- Refines the state of this QScriptValuePrivate. Returns the new state.
-*/
-QScriptValuePrivate::State QScriptValuePrivate::refinedJSValue()
-{
- Q_ASSERT(m_state == JSValue);
- if (!JSValueIsObject(context(), value())) {
- m_state = JSPrimitive;
- } else {
- m_state = JSObject;
- // We are sure that value is an JSObject, so we can const_cast safely without
- // calling JSC C API (JSValueToObject(context(), value(), /* exceptions */ 0)).
- m_object = const_cast<JSObjectRef>(m_value);
- }
- return m_state;
-}
-
-/*!
- \internal
- Returns true if QSV have an engine associated.
-*/
-bool QScriptValuePrivate::isJSBased() const { return m_state >= JSValue; }
-
-/*!
- \internal
- Returns true if current value of QSV is placed in m_number.
-*/
-bool QScriptValuePrivate::isNumberBased() const { return !isJSBased() && !isStringBased() && m_state != Invalid; }
-
-/*!
- \internal
- Returns true if current value of QSV is placed in m_string.
-*/
-bool QScriptValuePrivate::isStringBased() const { return m_state == CString; }
-
-#endif // qscriptvalue_p_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro
deleted file mode 100644
index d521dd8..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TEMPLATE = app
-TARGET = tst_qscriptengine
-QT += testlib
-isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../..
-include(../tests.pri)
-
-SOURCES += tst_qscriptengine.cpp
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
deleted file mode 100644
index 2632796..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "qscriptengine.h"
-#include "qscriptprogram.h"
-#include "qscriptsyntaxcheckresult.h"
-#include "qscriptvalue.h"
-#include <QtTest/qtest.h>
-
-class tst_QScriptEngine : public QObject {
- Q_OBJECT
-
-public:
- tst_QScriptEngine() {}
- virtual ~tst_QScriptEngine() {}
-
-public slots:
- void init() {}
- void cleanup() {}
-
-private slots:
- void evaluate();
- void collectGarbage();
- void nullValue();
- void undefinedValue();
- void evaluateProgram();
- void checkSyntax_data();
- void checkSyntax();
-};
-
-/* Evaluating a script that throw an unhandled exception should return an invalid value. */
-void tst_QScriptEngine::evaluate()
-{
- QScriptEngine engine;
- QVERIFY2(engine.evaluate("1+1").isValid(), "the expression should be evaluated and an valid result should be returned");
- QVERIFY2(engine.evaluate("ping").isValid(), "Script throwing an unhandled exception should return an exception value");
-}
-
-/* Test garbage collection, at least try to not crash. */
-void tst_QScriptEngine::collectGarbage()
-{
- QScriptEngine engine;
- QScriptValue foo = engine.evaluate("( function foo() {return 'pong';} )");
- QVERIFY(foo.isFunction());
- engine.collectGarbage();
- QCOMPARE(foo.call().toString(), QString::fromAscii("pong"));
-}
-
-void tst_QScriptEngine::nullValue()
-{
- QScriptEngine engine;
- QScriptValue value = engine.nullValue();
- QVERIFY(value.isValid());
- QVERIFY(value.isNull());
-}
-
-void tst_QScriptEngine::undefinedValue()
-{
- QScriptEngine engine;
- QScriptValue value = engine.undefinedValue();
- QVERIFY(value.isValid());
- QVERIFY(value.isUndefined());
-}
-
-void tst_QScriptEngine::evaluateProgram()
-{
- QScriptEngine eng;
- {
- QString code("1 + 2");
- QString fileName("hello.js");
- int lineNumber = 123;
- QScriptProgram program(code, fileName, lineNumber);
- QVERIFY(!program.isNull());
- QCOMPARE(program.sourceCode(), code);
- QCOMPARE(program.fileName(), fileName);
- QCOMPARE(program.firstLineNumber(), lineNumber);
-
- QScriptValue expected = eng.evaluate(code);
- for (int x = 0; x < 10; ++x) {
- QScriptValue ret = eng.evaluate(program);
- QVERIFY(ret.equals(expected));
- }
-
- // operator=
- QScriptProgram sameProgram = program;
- QVERIFY(sameProgram == program);
- QVERIFY(eng.evaluate(sameProgram).equals(expected));
-
- // copy constructor
- QScriptProgram sameProgram2(program);
- QVERIFY(sameProgram2 == program);
- QVERIFY(eng.evaluate(sameProgram2).equals(expected));
-
- QScriptProgram differentProgram("2 + 3");
- QVERIFY(differentProgram != program);
- QVERIFY(!eng.evaluate(differentProgram).equals(expected));
- }
-
- // Program that accesses variable in the scope
- {
- QScriptProgram program("a");
- QVERIFY(!program.isNull());
- {
- QScriptValue ret = eng.evaluate(program);
- QVERIFY(ret.isError());
- QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: a"));
- }
- {
- QScriptValue ret = eng.evaluate(program);
- QVERIFY(ret.isError());
- }
- eng.evaluate("a = 456");
- {
- QScriptValue ret = eng.evaluate(program);
- QVERIFY(!ret.isError());
- QCOMPARE(ret.toNumber(), 456.0);
- }
- }
-
- // Program that creates closure
- {
- QScriptProgram program("(function() { var count = 0; return function() { return count++; }; })");
- QVERIFY(!program.isNull());
- QScriptValue createCounter = eng.evaluate(program);
- QVERIFY(createCounter.isFunction());
- QScriptValue counter = createCounter.call();
- QVERIFY(counter.isFunction());
- {
- QScriptValue ret = counter.call();
- QVERIFY(ret.isNumber());
- }
- QScriptValue counter2 = createCounter.call();
- QVERIFY(counter2.isFunction());
- QVERIFY(!counter2.equals(counter));
- {
- QScriptValue ret = counter2.call();
- QVERIFY(ret.isNumber());
- }
- }
-
- // Same program run in different engines
- {
- QString code("1 + 2");
- QScriptProgram program(code);
- QVERIFY(!program.isNull());
- double expected = eng.evaluate(program).toNumber();
- for (int x = 0; x < 2; ++x) {
- QScriptEngine eng2;
- for (int y = 0; y < 2; ++y) {
- double ret = eng2.evaluate(program).toNumber();
- QCOMPARE(ret, expected);
- }
- }
- }
-
- // No program
- {
- QScriptProgram program;
- QVERIFY(program.isNull());
- QScriptValue ret = eng.evaluate(program);
- QVERIFY(!ret.isValid());
- }
-}
-
-void tst_QScriptEngine::checkSyntax_data()
-{
- QTest::addColumn<QString>("code");
- QTest::addColumn<int>("expectedState");
- QTest::addColumn<int>("errorLineNumber");
- QTest::addColumn<int>("errorColumnNumber");
- QTest::addColumn<QString>("errorMessage");
-
- QTest::newRow("0")
- << QString("0") << int(QScriptSyntaxCheckResult::Valid)
- << -1 << -1 << "";
- QTest::newRow("if (")
- << QString("if (\n") << int(QScriptSyntaxCheckResult::Intermediate)
- << 1 << 4 << "";
- QTest::newRow("if else")
- << QString("\nif else") << int(QScriptSyntaxCheckResult::Error)
- << 2 << 4 << "SyntaxError: Parse error";
- QTest::newRow("{if}")
- << QString("{\n{\nif\n}\n") << int(QScriptSyntaxCheckResult::Error)
- << 4 << 1 << "SyntaxError: Parse error";
- QTest::newRow("foo[")
- << QString("foo[") << int(QScriptSyntaxCheckResult::Error)
- << 1 << 4 << "SyntaxError: Parse error";
- QTest::newRow("foo['bar']")
- << QString("foo['bar']") << int(QScriptSyntaxCheckResult::Valid)
- << -1 << -1 << "";
-
- QTest::newRow("/*")
- << QString("/*") << int(QScriptSyntaxCheckResult::Intermediate)
- << 1 << 1 << "Unclosed comment at end of file";
- QTest::newRow("/*\nMy comment")
- << QString("/*\nMy comment") << int(QScriptSyntaxCheckResult::Intermediate)
- << 1 << 1 << "Unclosed comment at end of file";
- QTest::newRow("/*\nMy comment */\nfoo = 10")
- << QString("/*\nMy comment */\nfoo = 10") << int(QScriptSyntaxCheckResult::Valid)
- << -1 << -1 << "";
- QTest::newRow("foo = 10 /*")
- << QString("foo = 10 /*") << int(QScriptSyntaxCheckResult::Intermediate)
- << -1 << -1 << "";
- QTest::newRow("foo = 10; /*")
- << QString("foo = 10; /*") << int(QScriptSyntaxCheckResult::Intermediate)
- << 1 << 11 << "Expected `end of file'";
- QTest::newRow("foo = 10 /* My comment */")
- << QString("foo = 10 /* My comment */") << int(QScriptSyntaxCheckResult::Valid)
- << -1 << -1 << "";
-
- QTest::newRow("/=/")
- << QString("/=/") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
- QTest::newRow("/=/g")
- << QString("/=/g") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
- QTest::newRow("/a/")
- << QString("/a/") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
- QTest::newRow("/a/g")
- << QString("/a/g") << int(QScriptSyntaxCheckResult::Valid) << -1 << -1 << "";
-}
-
-void tst_QScriptEngine::checkSyntax()
-{
- QFETCH(QString, code);
- QFETCH(int, expectedState);
- QFETCH(int, errorLineNumber);
- QFETCH(int, errorColumnNumber);
- QFETCH(QString, errorMessage);
-
- QScriptSyntaxCheckResult result = QScriptEngine::checkSyntax(code);
-
- // assignment
- {
- QScriptSyntaxCheckResult copy = result;
- QCOMPARE(copy.state(), result.state());
- QCOMPARE(copy.errorLineNumber(), result.errorLineNumber());
- QCOMPARE(copy.errorColumnNumber(), result.errorColumnNumber());
- QCOMPARE(copy.errorMessage(), result.errorMessage());
- }
- {
- QScriptSyntaxCheckResult copy(result);
- QCOMPARE(copy.state(), result.state());
- QCOMPARE(copy.errorLineNumber(), result.errorLineNumber());
- QCOMPARE(copy.errorColumnNumber(), result.errorColumnNumber());
- QCOMPARE(copy.errorMessage(), result.errorMessage());
- }
-
- if (expectedState == QScriptSyntaxCheckResult::Intermediate)
- QEXPECT_FAIL("", "QScriptSyntaxCheckResult::state() doesn't return the Intermediate state", Abort);
- QCOMPARE(result.state(), QScriptSyntaxCheckResult::State(expectedState));
- QCOMPARE(result.errorLineNumber(), errorLineNumber);
- if (expectedState != QScriptSyntaxCheckResult::Valid && errorColumnNumber != 1)
- QEXPECT_FAIL("", "QScriptSyntaxCheckResult::errorColumnNumber() doesn't return correct value", Continue);
- QCOMPARE(result.errorColumnNumber(), errorColumnNumber);
- QCOMPARE(result.errorMessage(), errorMessage);
-}
-
-
-QTEST_MAIN(tst_QScriptEngine)
-#include "tst_qscriptengine.moc"
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro
deleted file mode 100644
index 5ad9b7c..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/qscriptstring.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-TEMPLATE = app
-TARGET = tst_qscriptstring
-QT += testlib
-include(../tests.pri)
-
-SOURCES += tst_qscriptstring.cpp
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp
deleted file mode 100644
index ff31835..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptstring/tst_qscriptstring.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef tst_qscriptstring_h
-#define tst_qscriptstring_h
-
-#include "qscriptengine.h"
-#include "qscriptstring.h"
-#include <QtCore/qhash.h>
-#include <QtTest/QtTest>
-
-class tst_QScriptString : public QObject {
- Q_OBJECT
-
-public:
- tst_QScriptString();
- virtual ~tst_QScriptString();
-
-private slots:
- void test();
- void hash();
- void toArrayIndex_data();
- void toArrayIndex();
-};
-
-tst_QScriptString::tst_QScriptString()
-{
-}
-
-tst_QScriptString::~tst_QScriptString()
-{
-}
-
-void tst_QScriptString::test()
-{
- QScriptEngine eng;
- {
- QScriptString str;
- QVERIFY(!str.isValid());
- QVERIFY(str == str);
- QVERIFY(!(str != str));
- QVERIFY(str.toString().isNull());
-
- QScriptString str1(str);
- QVERIFY(!str1.isValid());
-
- QScriptString str2 = str;
- QVERIFY(!str2.isValid());
-
- QCOMPARE(str.toArrayIndex(), quint32(0xffffffff));
- }
- for (int x = 0; x < 2; ++x) {
- QString ciao = QString::fromLatin1("ciao");
- QScriptString str = eng.toStringHandle(ciao);
- QVERIFY(str.isValid());
- QVERIFY(str == str);
- QVERIFY(!(str != str));
- QCOMPARE(str.toString(), ciao);
-
- QScriptString str1(str);
- QCOMPARE(str, str1);
-
- QScriptString str2 = str;
- QCOMPARE(str, str2);
-
- QScriptString str3 = eng.toStringHandle(ciao);
- QVERIFY(str3.isValid());
- QCOMPARE(str, str3);
-
- eng.collectGarbage();
-
- QVERIFY(str.isValid());
- QCOMPARE(str.toString(), ciao);
- QVERIFY(str1.isValid());
- QCOMPARE(str1.toString(), ciao);
- QVERIFY(str2.isValid());
- QCOMPARE(str2.toString(), ciao);
- QVERIFY(str3.isValid());
- QCOMPARE(str3.toString(), ciao);
- }
- {
- QScriptEngine* eng2 = new QScriptEngine;
- QString one = QString::fromLatin1("one");
- QString two = QString::fromLatin1("two");
- QScriptString oneInterned = eng2->toStringHandle(one);
- QCOMPARE(oneInterned.toString(), one);
- QScriptString twoInterned = eng2->toStringHandle(two);
- QCOMPARE(twoInterned.toString(), two);
- QVERIFY(oneInterned != twoInterned);
- QVERIFY(!(oneInterned == twoInterned));
-
- delete eng2;
- }
-}
-
-void tst_QScriptString::hash()
-{
- QScriptEngine engine;
- QHash<QScriptString, int> stringToInt;
- QScriptString foo = engine.toStringHandle("foo");
-
- QScriptString bar = engine.toStringHandle("bar");
- QVERIFY(!stringToInt.contains(foo));
- for (int i = 0; i < 1000000; ++i)
- stringToInt.insert(foo, 123);
- QCOMPARE(stringToInt.value(foo), 123);
- QVERIFY(!stringToInt.contains(bar));
- stringToInt.insert(bar, 456);
- QCOMPARE(stringToInt.value(bar), 456);
- QCOMPARE(stringToInt.value(foo), 123);
-}
-
-void tst_QScriptString::toArrayIndex_data()
-{
- QTest::addColumn<QString>("input");
- QTest::addColumn<bool>("expectSuccess");
- QTest::addColumn<quint32>("expectedIndex");
- QTest::newRow("foo") << QString::fromLatin1("foo") << false << quint32(0xffffffff);
- QTest::newRow("empty") << QString::fromLatin1("") << false << quint32(0xffffffff);
- QTest::newRow("0") << QString::fromLatin1("0") << true << quint32(0);
- QTest::newRow("00") << QString::fromLatin1("00") << false << quint32(0xffffffff);
- QTest::newRow("1") << QString::fromLatin1("1") << true << quint32(1);
- QTest::newRow("123") << QString::fromLatin1("123") << true << quint32(123);
- QTest::newRow("-1") << QString::fromLatin1("-1") << false << quint32(0xffffffff);
- QTest::newRow("0a") << QString::fromLatin1("0a") << false << quint32(0xffffffff);
- QTest::newRow("0x1") << QString::fromLatin1("0x1") << false << quint32(0xffffffff);
- QTest::newRow("01") << QString::fromLatin1("01") << false << quint32(0xffffffff);
- QTest::newRow("101a") << QString::fromLatin1("101a") << false << quint32(0xffffffff);
- QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe);
- QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff);
- QTest::newRow("11111111111") << QString::fromLatin1("11111111111") << false << quint32(0xffffffff);
- QTest::newRow("0.0") << QString::fromLatin1("0.0") << false << quint32(0xffffffff);
- QTest::newRow("1.0") << QString::fromLatin1("1.0") << false << quint32(0xffffffff);
- QTest::newRow("1.5") << QString::fromLatin1("1.5") << false << quint32(0xffffffff);
- QTest::newRow("1.") << QString::fromLatin1("1.") << false << quint32(0xffffffff);
- QTest::newRow(".1") << QString::fromLatin1(".1") << false << quint32(0xffffffff);
- QTest::newRow("1e0") << QString::fromLatin1("1e0") << false << quint32(0xffffffff);
-}
-
-void tst_QScriptString::toArrayIndex()
-{
- QFETCH(QString, input);
- QFETCH(bool, expectSuccess);
- QFETCH(quint32, expectedIndex);
- QScriptEngine engine;
- for (int x = 0; x < 2; ++x) {
- bool isArrayIndex;
- bool* ptr = (!x) ? &isArrayIndex : (bool*)0;
- quint32 result = engine.toStringHandle(input).toArrayIndex(ptr);
- if (!x)
- QCOMPARE(isArrayIndex, expectSuccess);
- QCOMPARE(result, expectedIndex);
- }
-}
-
-QTEST_MAIN(tst_QScriptString)
-#include "tst_qscriptstring.moc"
-
-#endif // tst_qscriptstring_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
deleted file mode 100644
index 35cc17d..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-TARGET = tst_qscriptvalue
-QT += testlib
-isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../..
-include(../tests.pri)
-
-SOURCES += \
- tst_qscriptvalue.cpp \
- tst_qscriptvalue_generated.cpp
-
-HEADERS += \
- tst_qscriptvalue.h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp
deleted file mode 100644
index 82f0901..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "tst_qscriptvalue.h"
-#include <QtCore/qnumeric.h>
-
-tst_QScriptValue::tst_QScriptValue()
- : engine(0)
-{
-}
-
-tst_QScriptValue::~tst_QScriptValue()
-{
- delete engine;
-}
-
-void tst_QScriptValue::dataHelper(InitDataFunction init, DefineDataFunction define)
-{
- QTest::addColumn<QString>("__expression__");
- (this->*init)();
- QHash<QString, QScriptValue>::const_iterator it;
- for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {
- m_currentExpression = it.key();
- (this->*define)(it.key().toLatin1());
- }
- m_currentExpression = QString();
-}
-
-QTestData& tst_QScriptValue::newRow(const char* tag)
-{
- return QTest::newRow(tag) << m_currentExpression;
-}
-
-void tst_QScriptValue::testHelper(TestFunction fun)
-{
- QFETCH(QString, __expression__);
- QScriptValue value = m_values.value(__expression__);
- (this->*fun)(__expression__.toLatin1(), value);
-}
-
-
-void tst_QScriptValue::ctor()
-{
- QScriptEngine eng;
- {
- QScriptValue v;
- QCOMPARE(v.isValid(), false);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(&eng, QScriptValue::UndefinedValue);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isUndefined(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(&eng, QScriptValue::NullValue);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNull(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(&eng, false);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isBoolean(), true);
- QCOMPARE(v.isBool(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toBoolean(), false);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(&eng, int(1));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(int(0x43211234));
- QVERIFY(v.isNumber());
- QCOMPARE(v.toInt32(), 0x43211234);
- }
- {
- QScriptValue v(&eng, uint(1));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(uint(0x43211234));
- QVERIFY(v.isNumber());
- QCOMPARE(v.toUInt32(), uint(0x43211234));
- }
- {
- QScriptValue v(&eng, 1.0);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(12345678910.5);
- QVERIFY(v.isNumber());
- QCOMPARE(v.toNumber(), 12345678910.5);
- }
- {
- QScriptValue v(&eng, "ciao");
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isString(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toString(), QLatin1String("ciao"));
- QCOMPARE(v.engine(), &eng);
- }
- {
- QScriptValue v(&eng, QString("ciao"));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isString(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toString(), QLatin1String("ciao"));
- QCOMPARE(v.engine(), &eng);
- }
- // copy constructor, operator=
- {
- QScriptValue v(&eng, 1.0);
- QScriptValue v2(v);
- QCOMPARE(v2.strictlyEquals(v), true);
- QCOMPARE(v2.engine(), &eng);
-
- QScriptValue v3(v);
- QCOMPARE(v3.strictlyEquals(v), true);
- QCOMPARE(v3.strictlyEquals(v2), true);
- QCOMPARE(v3.engine(), &eng);
-
- QScriptValue v4(&eng, 2.0);
- QCOMPARE(v4.strictlyEquals(v), false);
- v3 = v4;
- QCOMPARE(v3.strictlyEquals(v), false);
- QCOMPARE(v3.strictlyEquals(v4), true);
-
- v2 = QScriptValue();
- QCOMPARE(v2.strictlyEquals(v), false);
- QCOMPARE(v.toNumber(), 1.0);
-
- QScriptValue v5(v);
- QCOMPARE(v5.strictlyEquals(v), true);
- v = QScriptValue();
- QCOMPARE(v5.strictlyEquals(v), false);
- QCOMPARE(v5.toNumber(), 1.0);
- }
-
- // constructors that take no engine argument
- {
- QScriptValue v(QScriptValue::UndefinedValue);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isUndefined(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(QScriptValue::NullValue);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNull(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(false);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isBoolean(), true);
- QCOMPARE(v.isBool(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toBoolean(), false);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(int(1));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(uint(1));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(1.0);
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isNumber(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toNumber(), 1.0);
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v("ciao");
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isString(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toString(), QLatin1String("ciao"));
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- {
- QScriptValue v(QString("ciao"));
- QCOMPARE(v.isValid(), true);
- QCOMPARE(v.isString(), true);
- QCOMPARE(v.isObject(), false);
- QCOMPARE(v.toString(), QLatin1String("ciao"));
- QCOMPARE(v.engine(), (QScriptEngine*)0);
- }
- // copy constructor, operator=
- {
- QScriptValue v(1.0);
- QScriptValue v2(v);
- QCOMPARE(v2.strictlyEquals(v), true);
- QCOMPARE(v2.engine(), (QScriptEngine*)0);
-
- QScriptValue v3(v);
- QCOMPARE(v3.strictlyEquals(v), true);
- QCOMPARE(v3.strictlyEquals(v2), true);
- QCOMPARE(v3.engine(), (QScriptEngine*)0);
-
- QScriptValue v4(2.0);
- QCOMPARE(v4.strictlyEquals(v), false);
- v3 = v4;
- QCOMPARE(v3.strictlyEquals(v), false);
- QCOMPARE(v3.strictlyEquals(v4), true);
-
- v2 = QScriptValue();
- QCOMPARE(v2.strictlyEquals(v), false);
- QCOMPARE(v.toNumber(), 1.0);
-
- QScriptValue v5(v);
- QCOMPARE(v5.strictlyEquals(v), true);
- v = QScriptValue();
- QCOMPARE(v5.strictlyEquals(v), false);
- QCOMPARE(v5.toNumber(), 1.0);
- }
-
- // 0 engine
- QVERIFY(QScriptValue(0, QScriptValue::UndefinedValue).isUndefined());
- QVERIFY(QScriptValue(0, QScriptValue::NullValue).isNull());
- QVERIFY(QScriptValue(0, false).isBool());
- QVERIFY(QScriptValue(0, int(1)).isNumber());
- QVERIFY(QScriptValue(0, uint(1)).isNumber());
- QVERIFY(QScriptValue(0, 1.0).isNumber());
- QVERIFY(QScriptValue(0, "ciao").isString());
- QVERIFY(QScriptValue(0, QString("ciao")).isString());
-}
-
-void tst_QScriptValue::toStringSimple_data()
-{
- QTest::addColumn<QString>("code");
- QTest::addColumn<QString>("result");
-
- QTest::newRow("string") << QString::fromAscii("'hello'") << QString::fromAscii("hello");
- QTest::newRow("string utf") << QString::fromUtf8("'ąśćżźółńę'") << QString::fromUtf8("ąśćżźółńę");
- QTest::newRow("expression") << QString::fromAscii("1 + 4") << QString::fromAscii("5");
- QTest::newRow("null") << QString::fromAscii("null") << QString::fromAscii("null");
- QTest::newRow("boolean") << QString::fromAscii("false") << QString::fromAscii("false");
- QTest::newRow("undefined") << QString::fromAscii("undefined") << QString::fromAscii("undefined");
- QTest::newRow("object") << QString::fromAscii("new Object") << QString::fromAscii("[object Object]");
-}
-
-/* Test conversion to string from different JSC types */
-void tst_QScriptValue::toStringSimple()
-{
- QFETCH(QString, code);
- QFETCH(QString, result);
-
- QScriptEngine engine;
- QCOMPARE(engine.evaluate(code).toString(), result);
-}
-
-void tst_QScriptValue::copyConstructor_data()
-{
- QScriptEngine engine;
- QScriptValue nnumber(123);
- QScriptValue nstring("ping");
- QScriptValue number(engine.evaluate("1"));
- QScriptValue string(engine.evaluate("'foo'"));
- QScriptValue object(engine.evaluate("new Object"));
- QScriptValue undefined(engine.evaluate("undefined"));
- QScriptValue null(engine.evaluate("null"));
-
- QTest::addColumn<QScriptValue>("value");
- QTest::addColumn<QString>("result");
-
- QTest::newRow("native number") << nnumber << QString::number(123);
- QTest::newRow("native string") << nstring << QString("ping");
- QTest::newRow("number") << number << QString::fromAscii("1");
- QTest::newRow("string") << string << QString::fromAscii("foo");
- QTest::newRow("object") << object << QString::fromAscii("[object Object]");
- QTest::newRow("undefined") << undefined << QString::fromAscii("undefined");
- QTest::newRow("null") << null << QString::fromAscii("null");
-}
-
-void tst_QScriptValue::copyConstructor()
-{
- QFETCH(QScriptValue, value);
- QFETCH(QString, result);
-
- QVERIFY(value.isValid());
- QScriptValue tmp(value);
- QVERIFY(tmp.isValid());
- QCOMPARE(tmp.toString(), result);
-}
-
-void tst_QScriptValue::assignOperator_data()
-{
- copyConstructor_data();
-}
-
-void tst_QScriptValue::assignOperator()
-{
- QFETCH(QScriptValue, value);
- QFETCH(QString, result);
-
- QScriptValue tmp;
- tmp = value;
- QVERIFY(tmp.isValid());
- QCOMPARE(tmp.toString(), result);
-}
-
-/* Test internal data sharing between a diffrenet QScriptValue. */
-void tst_QScriptValue::dataSharing()
-{
- QScriptEngine engine;
- QScriptValue v1;
- QScriptValue v2(v1);
-
- v1 = engine.evaluate("1"); // v1 == 1 ; v2 invalid.
- QVERIFY(v1.isValid());
- QVERIFY(!v2.isValid());
-
- v2 = v1; // v1 == 1; v2 == 1.
- QVERIFY(v1.isValid());
- QVERIFY(v2.isValid());
-
- v1 = engine.evaluate("obj = new Date"); // v1 == [object Date] ; v2 == 1.
- QVERIFY(v1.isValid());
- QVERIFY(v2.isValid());
- QVERIFY(v2.toString() != v1.toString());
-
- // TODO add object manipulation (v1 and v2 point to the same object).
-}
-
-void tst_QScriptValue::constructors_data()
-{
- QScriptEngine engine;
-
- QTest::addColumn<QScriptValue>("value");
- QTest::addColumn<QString>("string");
- QTest::addColumn<bool>("valid");
- QTest::addColumn<bool>("object");
-
- QTest::newRow("invalid") << QScriptValue() << QString() << false << false;
- QTest::newRow("number") << QScriptValue(-21) << QString::number(-21) << true << false;
- QTest::newRow("bool") << QScriptValue(true) << QString::fromAscii("true") << true << false;
- QTest::newRow("double") << QScriptValue(21.12) << QString::number(21.12) << true << false;
- QTest::newRow("string") << QScriptValue("AlaMaKota") << QString::fromAscii("AlaMaKota") << true << false;
- QTest::newRow("object") << engine.evaluate("new Object") << QString::fromAscii("[object Object]") << true << true;
- QTest::newRow("null") << QScriptValue(QScriptValue::NullValue)<< QString::fromAscii("null") << true << false;
- QTest::newRow("undef") << QScriptValue(QScriptValue::UndefinedValue)<< QString::fromAscii("undefined") << true << false;
-}
-
-void tst_QScriptValue::constructors()
-{
- QFETCH(QScriptValue, value);
- QFETCH(QString, string);
- QFETCH(bool, valid);
- QFETCH(bool, object);
-
- QCOMPARE(value.isValid(), valid);
- QCOMPARE(value.toString(), string);
- QCOMPARE(value.isObject(), object);
-}
-
-void tst_QScriptValue::call()
-{
- QScriptEngine engine;
- QScriptValue ping = engine.evaluate("( function() {return 'ping';} )");
- QScriptValue incr = engine.evaluate("( function(i) {return i + 1;} )");
- QScriptValue one(1);
- QScriptValue five(5);
- QScriptValue result;
-
- QVERIFY(one.isValid());
- QVERIFY(five.isValid());
-
- QVERIFY(ping.isValid());
- QVERIFY(ping.isFunction());
- result = ping.call();
- QVERIFY(result.isValid());
- QCOMPARE(result.toString(), QString::fromUtf8("ping"));
-
- QVERIFY(incr.isValid());
- QVERIFY(incr.isFunction());
- result = incr.call(QScriptValue(), QScriptValueList() << one);
- QVERIFY(result.isValid());
- QCOMPARE(result.toString(), QString("2"));
-
- QCOMPARE(incr.call(QScriptValue(), QScriptValueList() << five).toString(), QString::fromAscii("6"));
-
- QVERIFY(incr.call().isValid()); // Exception.
-}
-
-
-QTEST_MAIN(tst_QScriptValue)
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
deleted file mode 100644
index 28154a9..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef tst_qscriptvalue_h
-#define tst_qscriptvalue_h
-
-#include "qscriptengine.h"
-#include "qscriptvalue.h"
-#include <QtCore/qnumeric.h>
-#include <QtTest/qtest.h>
-
-Q_DECLARE_METATYPE(QScriptValue*);
-Q_DECLARE_METATYPE(QScriptValue);
-
-class tst_QScriptValue : public QObject {
- Q_OBJECT
-
-public:
- tst_QScriptValue();
- virtual ~tst_QScriptValue();
-
-private slots:
- void toStringSimple_data();
- void toStringSimple();
- void copyConstructor_data();
- void copyConstructor();
- void assignOperator_data();
- void assignOperator();
- void dataSharing();
- void constructors_data();
- void constructors();
- void call();
- void ctor();
-
- // Generated test functions.
- void isBool_data();
- void isBool();
-
- void isBoolean_data();
- void isBoolean();
-
- void isNumber_data();
- void isNumber();
-
- void isFunction_data();
- void isFunction();
-
- void isNull_data();
- void isNull();
-
- void isObject_data();
- void isObject();
-
- void isString_data();
- void isString();
-
- void isUndefined_data();
- void isUndefined();
-
- void isValid_data();
- void isValid();
-
- void toString_data();
- void toString();
-
- void toNumber_data();
- void toNumber();
-
- void toBool_data();
- void toBool();
-
- void toBoolean_data();
- void toBoolean();
-
- void toInteger_data();
- void toInteger();
-
- void toInt32_data();
- void toInt32();
-
- void toUInt32_data();
- void toUInt32();
-
- void toUInt16_data();
- void toUInt16();
-
-private:
- typedef void (tst_QScriptValue::*InitDataFunction)();
- typedef void (tst_QScriptValue::*DefineDataFunction)(const char*);
- void dataHelper(InitDataFunction init, DefineDataFunction define);
- QTestData& newRow(const char* tag);
-
- typedef void (tst_QScriptValue::*TestFunction)(const char*, const QScriptValue&);
- void testHelper(TestFunction fun);
-
- // Generated functions
-
- void initScriptValues();
-
- void isBool_initData();
- void isBool_makeData(const char* expr);
- void isBool_test(const char* expr, const QScriptValue& value);
-
- void isBoolean_initData();
- void isBoolean_makeData(const char* expr);
- void isBoolean_test(const char* expr, const QScriptValue& value);
-
- void isNumber_initData();
- void isNumber_makeData(const char* expr);
- void isNumber_test(const char* expr, const QScriptValue&);
-
- void isFunction_initData();
- void isFunction_makeData(const char* expr);
- void isFunction_test(const char* expr, const QScriptValue& value);
-
- void isNull_initData();
- void isNull_makeData(const char* expr);
- void isNull_test(const char* expr, const QScriptValue& value);
-
- void isObject_initData();
- void isObject_makeData(const char* expr);
- void isObject_test(const char* expr, const QScriptValue& value);
-
- void isString_initData();
- void isString_makeData(const char* expr);
- void isString_test(const char* expr, const QScriptValue& value);
-
- void isUndefined_initData();
- void isUndefined_makeData(const char* expr);
- void isUndefined_test(const char* expr, const QScriptValue& value);
-
- void isValid_initData();
- void isValid_makeData(const char* expr);
- void isValid_test(const char* expr, const QScriptValue& value);
-
- void toString_initData();
- void toString_makeData(const char*);
- void toString_test(const char*, const QScriptValue&);
-
- void toNumber_initData();
- void toNumber_makeData(const char*);
- void toNumber_test(const char*, const QScriptValue&);
-
- void toBool_initData();
- void toBool_makeData(const char*);
- void toBool_test(const char*, const QScriptValue&);
-
- void toBoolean_initData();
- void toBoolean_makeData(const char*);
- void toBoolean_test(const char*, const QScriptValue&);
-
- void toInteger_initData();
- void toInteger_makeData(const char*);
- void toInteger_test(const char*, const QScriptValue&);
-
- void toInt32_initData();
- void toInt32_makeData(const char*);
- void toInt32_test(const char*, const QScriptValue&);
-
- void toUInt32_initData();
- void toUInt32_makeData(const char*);
- void toUInt32_test(const char*, const QScriptValue&);
-
- void toUInt16_initData();
- void toUInt16_makeData(const char*);
- void toUInt16_test(const char*, const QScriptValue&);
-
-private:
- QScriptEngine* engine;
- QHash<QString, QScriptValue> m_values;
- QString m_currentExpression;
-};
-
-#define DEFINE_TEST_FUNCTION(name) \
-void tst_QScriptValue::name##_data() { dataHelper(&tst_QScriptValue::name##_initData, &tst_QScriptValue::name##_makeData); } \
-void tst_QScriptValue::name() { testHelper(&tst_QScriptValue::name##_test); }
-
-
-
-#endif // tst_qscriptvalue_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp b/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
deleted file mode 100644
index 970c960..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp
+++ /dev/null
@@ -1,1922 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "tst_qscriptvalue.h"
-
-#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr)
-
-void tst_QScriptValue::initScriptValues()
-{
- m_values.clear();
- if (engine)
- delete engine;
- engine = new QScriptEngine;
- DEFINE_TEST_VALUE(QScriptValue());
- DEFINE_TEST_VALUE(QScriptValue(QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(true));
- DEFINE_TEST_VALUE(QScriptValue(false));
- DEFINE_TEST_VALUE(QScriptValue(int(122)));
- DEFINE_TEST_VALUE(QScriptValue(uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(0));
- DEFINE_TEST_VALUE(QScriptValue(0.0));
- DEFINE_TEST_VALUE(QScriptValue(123.0));
- DEFINE_TEST_VALUE(QScriptValue(6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(-6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(0x10000));
- DEFINE_TEST_VALUE(QScriptValue(0x10001));
- DEFINE_TEST_VALUE(QScriptValue(qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(qInf()));
- DEFINE_TEST_VALUE(QScriptValue(-qInf()));
- DEFINE_TEST_VALUE(QScriptValue("NaN"));
- DEFINE_TEST_VALUE(QScriptValue("Infinity"));
- DEFINE_TEST_VALUE(QScriptValue("-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue("ciao"));
- DEFINE_TEST_VALUE(QScriptValue(QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(QString("")));
- DEFINE_TEST_VALUE(QScriptValue(QString()));
- DEFINE_TEST_VALUE(QScriptValue(QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(QString("12.4")));
- DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(0, QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(0, true));
- DEFINE_TEST_VALUE(QScriptValue(0, false));
- DEFINE_TEST_VALUE(QScriptValue(0, int(122)));
- DEFINE_TEST_VALUE(QScriptValue(0, uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(0, 0));
- DEFINE_TEST_VALUE(QScriptValue(0, 0.0));
- DEFINE_TEST_VALUE(QScriptValue(0, 123.0));
- DEFINE_TEST_VALUE(QScriptValue(0, 6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0, -6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x10000));
- DEFINE_TEST_VALUE(QScriptValue(0, 0x10001));
- DEFINE_TEST_VALUE(QScriptValue(0, qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(0, qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(0, qInf()));
- DEFINE_TEST_VALUE(QScriptValue(0, -qInf()));
- DEFINE_TEST_VALUE(QScriptValue(0, "NaN"));
- DEFINE_TEST_VALUE(QScriptValue(0, "Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(0, "-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(0, "ciao"));
- DEFINE_TEST_VALUE(QScriptValue(0, QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString()));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(0, QString("12.3")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::UndefinedValue));
- DEFINE_TEST_VALUE(QScriptValue(engine, QScriptValue::NullValue));
- DEFINE_TEST_VALUE(QScriptValue(engine, true));
- DEFINE_TEST_VALUE(QScriptValue(engine, false));
- DEFINE_TEST_VALUE(QScriptValue(engine, int(122)));
- DEFINE_TEST_VALUE(QScriptValue(engine, uint(124)));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0.0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 123.0));
- DEFINE_TEST_VALUE(QScriptValue(engine, 6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(engine, -6.37e-8));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x43211234));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x10000));
- DEFINE_TEST_VALUE(QScriptValue(engine, 0x10001));
- DEFINE_TEST_VALUE(QScriptValue(engine, qSNaN()));
- DEFINE_TEST_VALUE(QScriptValue(engine, qQNaN()));
- DEFINE_TEST_VALUE(QScriptValue(engine, qInf()));
- DEFINE_TEST_VALUE(QScriptValue(engine, -qInf()));
- DEFINE_TEST_VALUE(QScriptValue(engine, "NaN"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "-Infinity"));
- DEFINE_TEST_VALUE(QScriptValue(engine, "ciao"));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString::fromLatin1("ciao")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString()));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("0")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("123")));
- DEFINE_TEST_VALUE(QScriptValue(engine, QString("1.23")));
- DEFINE_TEST_VALUE(engine->evaluate("[]"));
- DEFINE_TEST_VALUE(engine->evaluate("{}"));
- DEFINE_TEST_VALUE(engine->evaluate("Object.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Date.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Array.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Function.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Error.prototype"));
- DEFINE_TEST_VALUE(engine->evaluate("Object"));
- DEFINE_TEST_VALUE(engine->evaluate("Array"));
- DEFINE_TEST_VALUE(engine->evaluate("Number"));
- DEFINE_TEST_VALUE(engine->evaluate("Function"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { return 1; })"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { return 'ciao'; })"));
- DEFINE_TEST_VALUE(engine->evaluate("(function() { throw new Error('foo'); })"));
- DEFINE_TEST_VALUE(engine->evaluate("/foo/"));
- DEFINE_TEST_VALUE(engine->evaluate("new Object()"));
- DEFINE_TEST_VALUE(engine->evaluate("new Array()"));
- DEFINE_TEST_VALUE(engine->evaluate("new Error()"));
- DEFINE_TEST_VALUE(engine->evaluate("a = new Object(); a.foo = 22; a.foo"));
- DEFINE_TEST_VALUE(engine->evaluate("Undefined"));
- DEFINE_TEST_VALUE(engine->evaluate("Null"));
- DEFINE_TEST_VALUE(engine->evaluate("True"));
- DEFINE_TEST_VALUE(engine->evaluate("False"));
- DEFINE_TEST_VALUE(engine->evaluate("undefined"));
- DEFINE_TEST_VALUE(engine->evaluate("null"));
- DEFINE_TEST_VALUE(engine->evaluate("true"));
- DEFINE_TEST_VALUE(engine->evaluate("false"));
- DEFINE_TEST_VALUE(engine->evaluate("122"));
- DEFINE_TEST_VALUE(engine->evaluate("124"));
- DEFINE_TEST_VALUE(engine->evaluate("0"));
- DEFINE_TEST_VALUE(engine->evaluate("0.0"));
- DEFINE_TEST_VALUE(engine->evaluate("123.0"));
- DEFINE_TEST_VALUE(engine->evaluate("6.37e-8"));
- DEFINE_TEST_VALUE(engine->evaluate("-6.37e-8"));
- DEFINE_TEST_VALUE(engine->evaluate("0x43211234"));
- DEFINE_TEST_VALUE(engine->evaluate("0x10000"));
- DEFINE_TEST_VALUE(engine->evaluate("0x10001"));
- DEFINE_TEST_VALUE(engine->evaluate("NaN"));
- DEFINE_TEST_VALUE(engine->evaluate("Infinity"));
- DEFINE_TEST_VALUE(engine->evaluate("-Infinity"));
- DEFINE_TEST_VALUE(engine->evaluate("'ciao'"));
- DEFINE_TEST_VALUE(engine->evaluate("''"));
- DEFINE_TEST_VALUE(engine->evaluate("'0'"));
- DEFINE_TEST_VALUE(engine->evaluate("'123'"));
- DEFINE_TEST_VALUE(engine->evaluate("'12.4'"));
- DEFINE_TEST_VALUE(engine->nullValue());
- DEFINE_TEST_VALUE(engine->undefinedValue());
-}
-
-
-void tst_QScriptValue::isValid_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isValid_makeData(const char* expr)
-{
- static QSet<QString> isValid;
- if (isValid.isEmpty()) {
- isValid << "QScriptValue(QScriptValue::UndefinedValue)"
- << "QScriptValue(QScriptValue::NullValue)"
- << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(int(122))"
- << "QScriptValue(uint(124))"
- << "QScriptValue(0)"
- << "QScriptValue(0.0)"
- << "QScriptValue(123.0)"
- << "QScriptValue(6.37e-8)"
- << "QScriptValue(-6.37e-8)"
- << "QScriptValue(0x43211234)"
- << "QScriptValue(0x10000)"
- << "QScriptValue(0x10001)"
- << "QScriptValue(qSNaN())"
- << "QScriptValue(qQNaN())"
- << "QScriptValue(qInf())"
- << "QScriptValue(-qInf())"
- << "QScriptValue(\"NaN\")"
- << "QScriptValue(\"Infinity\")"
- << "QScriptValue(\"-Infinity\")"
- << "QScriptValue(\"ciao\")"
- << "QScriptValue(QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(QString(\"\"))"
- << "QScriptValue(QString())"
- << "QScriptValue(QString(\"0\"))"
- << "QScriptValue(QString(\"123\"))"
- << "QScriptValue(QString(\"12.4\"))"
- << "QScriptValue(0, QScriptValue::UndefinedValue)"
- << "QScriptValue(0, QScriptValue::NullValue)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(0, int(122))"
- << "QScriptValue(0, uint(124))"
- << "QScriptValue(0, 0)"
- << "QScriptValue(0, 0.0)"
- << "QScriptValue(0, 123.0)"
- << "QScriptValue(0, 6.37e-8)"
- << "QScriptValue(0, -6.37e-8)"
- << "QScriptValue(0, 0x43211234)"
- << "QScriptValue(0, 0x10000)"
- << "QScriptValue(0, 0x10001)"
- << "QScriptValue(0, qSNaN())"
- << "QScriptValue(0, qQNaN())"
- << "QScriptValue(0, qInf())"
- << "QScriptValue(0, -qInf())"
- << "QScriptValue(0, \"NaN\")"
- << "QScriptValue(0, \"Infinity\")"
- << "QScriptValue(0, \"-Infinity\")"
- << "QScriptValue(0, \"ciao\")"
- << "QScriptValue(0, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(0, QString(\"\"))"
- << "QScriptValue(0, QString())"
- << "QScriptValue(0, QString(\"0\"))"
- << "QScriptValue(0, QString(\"123\"))"
- << "QScriptValue(0, QString(\"12.3\"))"
- << "QScriptValue(engine, QScriptValue::UndefinedValue)"
- << "QScriptValue(engine, QScriptValue::NullValue)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "QScriptValue(engine, int(122))"
- << "QScriptValue(engine, uint(124))"
- << "QScriptValue(engine, 0)"
- << "QScriptValue(engine, 0.0)"
- << "QScriptValue(engine, 123.0)"
- << "QScriptValue(engine, 6.37e-8)"
- << "QScriptValue(engine, -6.37e-8)"
- << "QScriptValue(engine, 0x43211234)"
- << "QScriptValue(engine, 0x10000)"
- << "QScriptValue(engine, 0x10001)"
- << "QScriptValue(engine, qSNaN())"
- << "QScriptValue(engine, qQNaN())"
- << "QScriptValue(engine, qInf())"
- << "QScriptValue(engine, -qInf())"
- << "QScriptValue(engine, \"NaN\")"
- << "QScriptValue(engine, \"Infinity\")"
- << "QScriptValue(engine, \"-Infinity\")"
- << "QScriptValue(engine, \"ciao\")"
- << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(engine, QString(\"\"))"
- << "QScriptValue(engine, QString())"
- << "QScriptValue(engine, QString(\"0\"))"
- << "QScriptValue(engine, QString(\"123\"))"
- << "QScriptValue(engine, QString(\"1.23\"))"
- << "engine->evaluate(\"[]\")"
- << "engine->evaluate(\"{}\")"
- << "engine->evaluate(\"Object.prototype\")"
- << "engine->evaluate(\"Date.prototype\")"
- << "engine->evaluate(\"Array.prototype\")"
- << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Error.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")"
- << "engine->evaluate(\"new Object()\")"
- << "engine->evaluate(\"new Array()\")"
- << "engine->evaluate(\"new Error()\")"
- << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"
- << "engine->evaluate(\"Undefined\")"
- << "engine->evaluate(\"Null\")"
- << "engine->evaluate(\"True\")"
- << "engine->evaluate(\"False\")"
- << "engine->evaluate(\"undefined\")"
- << "engine->evaluate(\"null\")"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")"
- << "engine->evaluate(\"122\")"
- << "engine->evaluate(\"124\")"
- << "engine->evaluate(\"0\")"
- << "engine->evaluate(\"0.0\")"
- << "engine->evaluate(\"123.0\")"
- << "engine->evaluate(\"6.37e-8\")"
- << "engine->evaluate(\"-6.37e-8\")"
- << "engine->evaluate(\"0x43211234\")"
- << "engine->evaluate(\"0x10000\")"
- << "engine->evaluate(\"0x10001\")"
- << "engine->evaluate(\"NaN\")"
- << "engine->evaluate(\"Infinity\")"
- << "engine->evaluate(\"-Infinity\")"
- << "engine->evaluate(\"'ciao'\")"
- << "engine->evaluate(\"''\")"
- << "engine->evaluate(\"'0'\")"
- << "engine->evaluate(\"'123'\")"
- << "engine->evaluate(\"'12.4'\")"
- << "engine->nullValue()"
- << "engine->undefinedValue()";
- }
- newRow(expr) << isValid.contains(expr);
-}
-
-void tst_QScriptValue::isValid_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isValid(), expected);
- QCOMPARE(value.isValid(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isValid)
-
-
-void tst_QScriptValue::isBool_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isBool_makeData(const char* expr)
-{
- static QSet<QString> isBool;
- if (isBool.isEmpty()) {
- isBool << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")";
- }
- newRow(expr) << isBool.contains(expr);
-}
-
-void tst_QScriptValue::isBool_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isBool(), expected);
- QCOMPARE(value.isBool(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isBool)
-
-
-void tst_QScriptValue::isBoolean_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isBoolean_makeData(const char* expr)
-{
- static QSet<QString> isBoolean;
- if (isBoolean.isEmpty()) {
- isBoolean << "QScriptValue(true)"
- << "QScriptValue(false)"
- << "QScriptValue(0, true)"
- << "QScriptValue(0, false)"
- << "QScriptValue(engine, true)"
- << "QScriptValue(engine, false)"
- << "engine->evaluate(\"true\")"
- << "engine->evaluate(\"false\")";
- }
- newRow(expr) << isBoolean.contains(expr);
-}
-
-void tst_QScriptValue::isBoolean_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isBoolean(), expected);
- QCOMPARE(value.isBoolean(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isBoolean)
-
-
-void tst_QScriptValue::isNumber_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isNumber_makeData(const char* expr)
-{
- static QSet<QString> isNumber;
- if (isNumber.isEmpty()) {
- isNumber << "QScriptValue(int(122))"
- << "QScriptValue(uint(124))"
- << "QScriptValue(0)"
- << "QScriptValue(0.0)"
- << "QScriptValue(123.0)"
- << "QScriptValue(6.37e-8)"
- << "QScriptValue(-6.37e-8)"
- << "QScriptValue(0x43211234)"
- << "QScriptValue(0x10000)"
- << "QScriptValue(0x10001)"
- << "QScriptValue(qSNaN())"
- << "QScriptValue(qQNaN())"
- << "QScriptValue(qInf())"
- << "QScriptValue(-qInf())"
- << "QScriptValue(0, int(122))"
- << "QScriptValue(0, uint(124))"
- << "QScriptValue(0, 0)"
- << "QScriptValue(0, 0.0)"
- << "QScriptValue(0, 123.0)"
- << "QScriptValue(0, 6.37e-8)"
- << "QScriptValue(0, -6.37e-8)"
- << "QScriptValue(0, 0x43211234)"
- << "QScriptValue(0, 0x10000)"
- << "QScriptValue(0, 0x10001)"
- << "QScriptValue(0, qSNaN())"
- << "QScriptValue(0, qQNaN())"
- << "QScriptValue(0, qInf())"
- << "QScriptValue(0, -qInf())"
- << "QScriptValue(engine, int(122))"
- << "QScriptValue(engine, uint(124))"
- << "QScriptValue(engine, 0)"
- << "QScriptValue(engine, 0.0)"
- << "QScriptValue(engine, 123.0)"
- << "QScriptValue(engine, 6.37e-8)"
- << "QScriptValue(engine, -6.37e-8)"
- << "QScriptValue(engine, 0x43211234)"
- << "QScriptValue(engine, 0x10000)"
- << "QScriptValue(engine, 0x10001)"
- << "QScriptValue(engine, qSNaN())"
- << "QScriptValue(engine, qQNaN())"
- << "QScriptValue(engine, qInf())"
- << "QScriptValue(engine, -qInf())"
- << "engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")"
- << "engine->evaluate(\"122\")"
- << "engine->evaluate(\"124\")"
- << "engine->evaluate(\"0\")"
- << "engine->evaluate(\"0.0\")"
- << "engine->evaluate(\"123.0\")"
- << "engine->evaluate(\"6.37e-8\")"
- << "engine->evaluate(\"-6.37e-8\")"
- << "engine->evaluate(\"0x43211234\")"
- << "engine->evaluate(\"0x10000\")"
- << "engine->evaluate(\"0x10001\")"
- << "engine->evaluate(\"NaN\")"
- << "engine->evaluate(\"Infinity\")"
- << "engine->evaluate(\"-Infinity\")";
- }
- newRow(expr) << isNumber.contains(expr);
-}
-
-void tst_QScriptValue::isNumber_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isNumber(), expected);
- QCOMPARE(value.isNumber(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isNumber)
-
-
-void tst_QScriptValue::isFunction_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isFunction_makeData(const char* expr)
-{
- static QSet<QString> isFunction;
- if (isFunction.isEmpty()) {
- isFunction << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")";
- }
- newRow(expr) << isFunction.contains(expr);
-}
-
-void tst_QScriptValue::isFunction_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isFunction(), expected);
- QCOMPARE(value.isFunction(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isFunction)
-
-
-void tst_QScriptValue::isNull_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isNull_makeData(const char* expr)
-{
- static QSet<QString> isNull;
- if (isNull.isEmpty()) {
- isNull << "QScriptValue(QScriptValue::NullValue)"
- << "QScriptValue(0, QScriptValue::NullValue)"
- << "QScriptValue(engine, QScriptValue::NullValue)"
- << "engine->evaluate(\"null\")"
- << "engine->nullValue()";
- }
- newRow(expr) << isNull.contains(expr);
-}
-
-void tst_QScriptValue::isNull_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isNull(), expected);
- QCOMPARE(value.isNull(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isNull)
-
-
-void tst_QScriptValue::isString_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isString_makeData(const char* expr)
-{
- static QSet<QString> isString;
- if (isString.isEmpty()) {
- isString << "QScriptValue(\"NaN\")"
- << "QScriptValue(\"Infinity\")"
- << "QScriptValue(\"-Infinity\")"
- << "QScriptValue(\"ciao\")"
- << "QScriptValue(QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(QString(\"\"))"
- << "QScriptValue(QString())"
- << "QScriptValue(QString(\"0\"))"
- << "QScriptValue(QString(\"123\"))"
- << "QScriptValue(QString(\"12.4\"))"
- << "QScriptValue(0, \"NaN\")"
- << "QScriptValue(0, \"Infinity\")"
- << "QScriptValue(0, \"-Infinity\")"
- << "QScriptValue(0, \"ciao\")"
- << "QScriptValue(0, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(0, QString(\"\"))"
- << "QScriptValue(0, QString())"
- << "QScriptValue(0, QString(\"0\"))"
- << "QScriptValue(0, QString(\"123\"))"
- << "QScriptValue(0, QString(\"12.3\"))"
- << "QScriptValue(engine, \"NaN\")"
- << "QScriptValue(engine, \"Infinity\")"
- << "QScriptValue(engine, \"-Infinity\")"
- << "QScriptValue(engine, \"ciao\")"
- << "QScriptValue(engine, QString::fromLatin1(\"ciao\"))"
- << "QScriptValue(engine, QString(\"\"))"
- << "QScriptValue(engine, QString())"
- << "QScriptValue(engine, QString(\"0\"))"
- << "QScriptValue(engine, QString(\"123\"))"
- << "QScriptValue(engine, QString(\"1.23\"))"
- << "engine->evaluate(\"'ciao'\")"
- << "engine->evaluate(\"''\")"
- << "engine->evaluate(\"'0'\")"
- << "engine->evaluate(\"'123'\")"
- << "engine->evaluate(\"'12.4'\")";
- }
- newRow(expr) << isString.contains(expr);
-}
-
-void tst_QScriptValue::isString_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isString(), expected);
- QCOMPARE(value.isString(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isString)
-
-
-void tst_QScriptValue::isUndefined_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isUndefined_makeData(const char* expr)
-{
- static QSet<QString> isUndefined;
- if (isUndefined.isEmpty()) {
- isUndefined << "QScriptValue(QScriptValue::UndefinedValue)"
- << "QScriptValue(0, QScriptValue::UndefinedValue)"
- << "QScriptValue(engine, QScriptValue::UndefinedValue)"
- << "engine->evaluate(\"{}\")"
- << "engine->evaluate(\"undefined\")"
- << "engine->undefinedValue()";
- }
- newRow(expr) << isUndefined.contains(expr);
-}
-
-void tst_QScriptValue::isUndefined_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isUndefined(), expected);
- QCOMPARE(value.isUndefined(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isUndefined)
-
-
-
-
-
-void tst_QScriptValue::isObject_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::isObject_makeData(const char* expr)
-{
- static QSet<QString> isObject;
- if (isObject.isEmpty()) {
- isObject << "engine->evaluate(\"[]\")"
- << "engine->evaluate(\"Object.prototype\")"
- << "engine->evaluate(\"Date.prototype\")"
- << "engine->evaluate(\"Array.prototype\")"
- << "engine->evaluate(\"Function.prototype\")"
- << "engine->evaluate(\"Error.prototype\")"
- << "engine->evaluate(\"Object\")"
- << "engine->evaluate(\"Array\")"
- << "engine->evaluate(\"Number\")"
- << "engine->evaluate(\"Function\")"
- << "engine->evaluate(\"(function() { return 1; })\")"
- << "engine->evaluate(\"(function() { return 'ciao'; })\")"
- << "engine->evaluate(\"(function() { throw new Error('foo'); })\")"
- << "engine->evaluate(\"/foo/\")"
- << "engine->evaluate(\"new Object()\")"
- << "engine->evaluate(\"new Array()\")"
- << "engine->evaluate(\"new Error()\")"
- << "engine->evaluate(\"Undefined\")"
- << "engine->evaluate(\"Null\")"
- << "engine->evaluate(\"True\")"
- << "engine->evaluate(\"False\")";
- }
- newRow(expr) << isObject.contains(expr);
-}
-
-void tst_QScriptValue::isObject_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.isObject(), expected);
- QCOMPARE(value.isObject(), expected);
-}
-
-DEFINE_TEST_FUNCTION(isObject)
-
-
-void tst_QScriptValue::toString_initData()
-{
- QTest::addColumn<QString>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toString_makeData(const char* expr)
-{
- static QHash<QString, QString> toString;
- if (toString.isEmpty()) {
- toString.insert("QScriptValue()", "");
- toString.insert("QScriptValue(QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(true)", "true");
- toString.insert("QScriptValue(false)", "false");
- toString.insert("QScriptValue(int(122))", "122");
- toString.insert("QScriptValue(uint(124))", "124");
- toString.insert("QScriptValue(0)", "0");
- toString.insert("QScriptValue(0.0)", "0");
- toString.insert("QScriptValue(123.0)", "123");
- toString.insert("QScriptValue(6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(-6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(0x43211234)", "1126240820");
- toString.insert("QScriptValue(0x10000)", "65536");
- toString.insert("QScriptValue(0x10001)", "65537");
- toString.insert("QScriptValue(qSNaN())", "NaN");
- toString.insert("QScriptValue(qQNaN())", "NaN");
- toString.insert("QScriptValue(qInf())", "Infinity");
- toString.insert("QScriptValue(-qInf())", "-Infinity");
- toString.insert("QScriptValue(\"NaN\")", "NaN");
- toString.insert("QScriptValue(\"Infinity\")", "Infinity");
- toString.insert("QScriptValue(\"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(\"ciao\")", "ciao");
- toString.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(QString(\"\"))", "");
- toString.insert("QScriptValue(QString())", "");
- toString.insert("QScriptValue(QString(\"0\"))", "0");
- toString.insert("QScriptValue(QString(\"123\"))", "123");
- toString.insert("QScriptValue(QString(\"12.4\"))", "12.4");
- toString.insert("QScriptValue(0, QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(0, QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(0, true)", "true");
- toString.insert("QScriptValue(0, false)", "false");
- toString.insert("QScriptValue(0, int(122))", "122");
- toString.insert("QScriptValue(0, uint(124))", "124");
- toString.insert("QScriptValue(0, 0)", "0");
- toString.insert("QScriptValue(0, 0.0)", "0");
- toString.insert("QScriptValue(0, 123.0)", "123");
- toString.insert("QScriptValue(0, 6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(0, -6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(0, 0x43211234)", "1126240820");
- toString.insert("QScriptValue(0, 0x10000)", "65536");
- toString.insert("QScriptValue(0, 0x10001)", "65537");
- toString.insert("QScriptValue(0, qSNaN())", "NaN");
- toString.insert("QScriptValue(0, qQNaN())", "NaN");
- toString.insert("QScriptValue(0, qInf())", "Infinity");
- toString.insert("QScriptValue(0, -qInf())", "-Infinity");
- toString.insert("QScriptValue(0, \"NaN\")", "NaN");
- toString.insert("QScriptValue(0, \"Infinity\")", "Infinity");
- toString.insert("QScriptValue(0, \"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(0, \"ciao\")", "ciao");
- toString.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(0, QString(\"\"))", "");
- toString.insert("QScriptValue(0, QString())", "");
- toString.insert("QScriptValue(0, QString(\"0\"))", "0");
- toString.insert("QScriptValue(0, QString(\"123\"))", "123");
- toString.insert("QScriptValue(0, QString(\"12.3\"))", "12.3");
- toString.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", "undefined");
- toString.insert("QScriptValue(engine, QScriptValue::NullValue)", "null");
- toString.insert("QScriptValue(engine, true)", "true");
- toString.insert("QScriptValue(engine, false)", "false");
- toString.insert("QScriptValue(engine, int(122))", "122");
- toString.insert("QScriptValue(engine, uint(124))", "124");
- toString.insert("QScriptValue(engine, 0)", "0");
- toString.insert("QScriptValue(engine, 0.0)", "0");
- toString.insert("QScriptValue(engine, 123.0)", "123");
- toString.insert("QScriptValue(engine, 6.37e-8)", "6.37e-8");
- toString.insert("QScriptValue(engine, -6.37e-8)", "-6.37e-8");
- toString.insert("QScriptValue(engine, 0x43211234)", "1126240820");
- toString.insert("QScriptValue(engine, 0x10000)", "65536");
- toString.insert("QScriptValue(engine, 0x10001)", "65537");
- toString.insert("QScriptValue(engine, qSNaN())", "NaN");
- toString.insert("QScriptValue(engine, qQNaN())", "NaN");
- toString.insert("QScriptValue(engine, qInf())", "Infinity");
- toString.insert("QScriptValue(engine, -qInf())", "-Infinity");
- toString.insert("QScriptValue(engine, \"NaN\")", "NaN");
- toString.insert("QScriptValue(engine, \"Infinity\")", "Infinity");
- toString.insert("QScriptValue(engine, \"-Infinity\")", "-Infinity");
- toString.insert("QScriptValue(engine, \"ciao\")", "ciao");
- toString.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", "ciao");
- toString.insert("QScriptValue(engine, QString(\"\"))", "");
- toString.insert("QScriptValue(engine, QString())", "");
- toString.insert("QScriptValue(engine, QString(\"0\"))", "0");
- toString.insert("QScriptValue(engine, QString(\"123\"))", "123");
- toString.insert("QScriptValue(engine, QString(\"1.23\"))", "1.23");
- toString.insert("engine->evaluate(\"[]\")", "");
- toString.insert("engine->evaluate(\"{}\")", "undefined");
- toString.insert("engine->evaluate(\"Object.prototype\")", "[object Object]");
- toString.insert("engine->evaluate(\"Date.prototype\")", "Invalid Date");
- toString.insert("engine->evaluate(\"Array.prototype\")", "");
- toString.insert("engine->evaluate(\"Function.prototype\")", "function () {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Error.prototype\")", "Error: Unknown error");
- toString.insert("engine->evaluate(\"Object\")", "function Object() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Array\")", "function Array() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Number\")", "function Number() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"Function\")", "function Function() {\n [native code]\n}");
- toString.insert("engine->evaluate(\"(function() { return 1; })\")", "function () { return 1; }");
- toString.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", "function () { return 'ciao'; }");
- toString.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", "function () { throw new Error('foo'); }");
- toString.insert("engine->evaluate(\"/foo/\")", "/foo/");
- toString.insert("engine->evaluate(\"new Object()\")", "[object Object]");
- toString.insert("engine->evaluate(\"new Array()\")", "");
- toString.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error");
- toString.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", "22");
- toString.insert("engine->evaluate(\"Undefined\")", "ReferenceError: Can't find variable: Undefined");
- toString.insert("engine->evaluate(\"Null\")", "ReferenceError: Can't find variable: Null");
- toString.insert("engine->evaluate(\"True\")", "ReferenceError: Can't find variable: True");
- toString.insert("engine->evaluate(\"False\")", "ReferenceError: Can't find variable: False");
- toString.insert("engine->evaluate(\"undefined\")", "undefined");
- toString.insert("engine->evaluate(\"null\")", "null");
- toString.insert("engine->evaluate(\"true\")", "true");
- toString.insert("engine->evaluate(\"false\")", "false");
- toString.insert("engine->evaluate(\"122\")", "122");
- toString.insert("engine->evaluate(\"124\")", "124");
- toString.insert("engine->evaluate(\"0\")", "0");
- toString.insert("engine->evaluate(\"0.0\")", "0");
- toString.insert("engine->evaluate(\"123.0\")", "123");
- toString.insert("engine->evaluate(\"6.37e-8\")", "6.37e-8");
- toString.insert("engine->evaluate(\"-6.37e-8\")", "-6.37e-8");
- toString.insert("engine->evaluate(\"0x43211234\")", "1126240820");
- toString.insert("engine->evaluate(\"0x10000\")", "65536");
- toString.insert("engine->evaluate(\"0x10001\")", "65537");
- toString.insert("engine->evaluate(\"NaN\")", "NaN");
- toString.insert("engine->evaluate(\"Infinity\")", "Infinity");
- toString.insert("engine->evaluate(\"-Infinity\")", "-Infinity");
- toString.insert("engine->evaluate(\"'ciao'\")", "ciao");
- toString.insert("engine->evaluate(\"''\")", "");
- toString.insert("engine->evaluate(\"'0'\")", "0");
- toString.insert("engine->evaluate(\"'123'\")", "123");
- toString.insert("engine->evaluate(\"'12.4'\")", "12.4");
- toString.insert("engine->nullValue()", "null");
- toString.insert("engine->undefinedValue()", "undefined");
- }
- newRow(expr) << toString.value(expr);
-}
-
-void tst_QScriptValue::toString_test(const char*, const QScriptValue& value)
-{
- QFETCH(QString, expected);
- QCOMPARE(value.toString(), expected);
- QCOMPARE(value.toString(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toString)
-
-
-void tst_QScriptValue::toNumber_initData()
-{
- QTest::addColumn<qsreal>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toNumber_makeData(const char* expr)
-{
- static QHash<QString, qsreal> toNumber;
- if (toNumber.isEmpty()) {
- toNumber.insert("QScriptValue()", 0);
- toNumber.insert("QScriptValue(QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(true)", 1);
- toNumber.insert("QScriptValue(false)", 0);
- toNumber.insert("QScriptValue(int(122))", 122);
- toNumber.insert("QScriptValue(uint(124))", 124);
- toNumber.insert("QScriptValue(0)", 0);
- toNumber.insert("QScriptValue(0.0)", 0);
- toNumber.insert("QScriptValue(123.0)", 123);
- toNumber.insert("QScriptValue(6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(-6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(0x10000)", 65536);
- toNumber.insert("QScriptValue(0x10001)", 65537);
- toNumber.insert("QScriptValue(qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(qInf())", qInf());
- toNumber.insert("QScriptValue(-qInf())", qInf());
- toNumber.insert("QScriptValue(\"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(\"Infinity\")", qInf());
- toNumber.insert("QScriptValue(\"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(\"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(QString(\"\"))", 0);
- toNumber.insert("QScriptValue(QString())", 0);
- toNumber.insert("QScriptValue(QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(QString(\"12.4\"))", 12.4);
- toNumber.insert("QScriptValue(0, QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(0, true)", 1);
- toNumber.insert("QScriptValue(0, false)", 0);
- toNumber.insert("QScriptValue(0, int(122))", 122);
- toNumber.insert("QScriptValue(0, uint(124))", 124);
- toNumber.insert("QScriptValue(0, 0)", 0);
- toNumber.insert("QScriptValue(0, 0.0)", 0);
- toNumber.insert("QScriptValue(0, 123.0)", 123);
- toNumber.insert("QScriptValue(0, 6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(0, -6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(0, 0x10000)", 65536);
- toNumber.insert("QScriptValue(0, 0x10001)", 65537);
- toNumber.insert("QScriptValue(0, qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(0, qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(0, qInf())", qInf());
- toNumber.insert("QScriptValue(0, -qInf())", qInf());
- toNumber.insert("QScriptValue(0, \"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(0, \"Infinity\")", qInf());
- toNumber.insert("QScriptValue(0, \"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(0, \"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(0, QString(\"\"))", 0);
- toNumber.insert("QScriptValue(0, QString())", 0);
- toNumber.insert("QScriptValue(0, QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(0, QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(0, QString(\"12.3\"))", 12.3);
- toNumber.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", qQNaN());
- toNumber.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toNumber.insert("QScriptValue(engine, true)", 1);
- toNumber.insert("QScriptValue(engine, false)", 0);
- toNumber.insert("QScriptValue(engine, int(122))", 122);
- toNumber.insert("QScriptValue(engine, uint(124))", 124);
- toNumber.insert("QScriptValue(engine, 0)", 0);
- toNumber.insert("QScriptValue(engine, 0.0)", 0);
- toNumber.insert("QScriptValue(engine, 123.0)", 123);
- toNumber.insert("QScriptValue(engine, 6.37e-8)", 6.369999999999999e-08);
- toNumber.insert("QScriptValue(engine, -6.37e-8)", -6.369999999999999e-08);
- toNumber.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toNumber.insert("QScriptValue(engine, 0x10000)", 65536);
- toNumber.insert("QScriptValue(engine, 0x10001)", 65537);
- toNumber.insert("QScriptValue(engine, qSNaN())", qQNaN());
- toNumber.insert("QScriptValue(engine, qQNaN())", qQNaN());
- toNumber.insert("QScriptValue(engine, qInf())", qInf());
- toNumber.insert("QScriptValue(engine, -qInf())", qInf());
- toNumber.insert("QScriptValue(engine, \"NaN\")", qQNaN());
- toNumber.insert("QScriptValue(engine, \"Infinity\")", qInf());
- toNumber.insert("QScriptValue(engine, \"-Infinity\")", qInf());
- toNumber.insert("QScriptValue(engine, \"ciao\")", qQNaN());
- toNumber.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", qQNaN());
- toNumber.insert("QScriptValue(engine, QString(\"\"))", 0);
- toNumber.insert("QScriptValue(engine, QString())", 0);
- toNumber.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toNumber.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toNumber.insert("QScriptValue(engine, QString(\"1.23\"))", 1.23);
- toNumber.insert("engine->evaluate(\"[]\")", 0);
- toNumber.insert("engine->evaluate(\"{}\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Object.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Date.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Array.prototype\")", 0);
- toNumber.insert("engine->evaluate(\"Function.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Error.prototype\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Object\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Array\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Number\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Function\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { return 1; })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", qQNaN());
- toNumber.insert("engine->evaluate(\"/foo/\")", qQNaN());
- toNumber.insert("engine->evaluate(\"new Object()\")", qQNaN());
- toNumber.insert("engine->evaluate(\"new Array()\")", 0);
- toNumber.insert("engine->evaluate(\"new Error()\")", qQNaN());
- toNumber.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toNumber.insert("engine->evaluate(\"Undefined\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Null\")", qQNaN());
- toNumber.insert("engine->evaluate(\"True\")", qQNaN());
- toNumber.insert("engine->evaluate(\"False\")", qQNaN());
- toNumber.insert("engine->evaluate(\"undefined\")", qQNaN());
- toNumber.insert("engine->evaluate(\"null\")", 0);
- toNumber.insert("engine->evaluate(\"true\")", 1);
- toNumber.insert("engine->evaluate(\"false\")", 0);
- toNumber.insert("engine->evaluate(\"122\")", 122);
- toNumber.insert("engine->evaluate(\"124\")", 124);
- toNumber.insert("engine->evaluate(\"0\")", 0);
- toNumber.insert("engine->evaluate(\"0.0\")", 0);
- toNumber.insert("engine->evaluate(\"123.0\")", 123);
- toNumber.insert("engine->evaluate(\"6.37e-8\")", 6.369999999999999e-08);
- toNumber.insert("engine->evaluate(\"-6.37e-8\")", -6.369999999999999e-08);
- toNumber.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toNumber.insert("engine->evaluate(\"0x10000\")", 65536);
- toNumber.insert("engine->evaluate(\"0x10001\")", 65537);
- toNumber.insert("engine->evaluate(\"NaN\")", qQNaN());
- toNumber.insert("engine->evaluate(\"Infinity\")", qInf());
- toNumber.insert("engine->evaluate(\"-Infinity\")", qInf());
- toNumber.insert("engine->evaluate(\"'ciao'\")", qQNaN());
- toNumber.insert("engine->evaluate(\"''\")", 0);
- toNumber.insert("engine->evaluate(\"'0'\")", 0);
- toNumber.insert("engine->evaluate(\"'123'\")", 123);
- toNumber.insert("engine->evaluate(\"'12.4'\")", 12.4);
- toNumber.insert("engine->nullValue()", 0);
- toNumber.insert("engine->undefinedValue()", qQNaN());
- }
- newRow(expr) << toNumber.value(expr);
-}
-
-void tst_QScriptValue::toNumber_test(const char*, const QScriptValue& value)
-{
- QFETCH(qsreal, expected);
- if (qIsNaN(expected)) {
- QVERIFY(qIsNaN(value.toNumber()));
- return;
- }
- if (qIsInf(expected)) {
- QVERIFY(qIsInf(value.toNumber()));
- QVERIFY(qIsInf(value.toNumber()));
- return;
- }
- QCOMPARE(value.toNumber(), expected);
- QCOMPARE(value.toNumber(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toNumber)
-
-
-void tst_QScriptValue::toBool_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toBool_makeData(const char* expr)
-{
- static QHash<QString, bool> toBool;
- if (toBool.isEmpty()) {
- toBool.insert("QScriptValue()", false);
- toBool.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(true)", true);
- toBool.insert("QScriptValue(false)", false);
- toBool.insert("QScriptValue(int(122))", true);
- toBool.insert("QScriptValue(uint(124))", true);
- toBool.insert("QScriptValue(0)", false);
- toBool.insert("QScriptValue(0.0)", false);
- toBool.insert("QScriptValue(123.0)", true);
- toBool.insert("QScriptValue(6.37e-8)", true);
- toBool.insert("QScriptValue(-6.37e-8)", true);
- toBool.insert("QScriptValue(0x43211234)", true);
- toBool.insert("QScriptValue(0x10000)", true);
- toBool.insert("QScriptValue(0x10001)", true);
- toBool.insert("QScriptValue(qSNaN())", false);
- toBool.insert("QScriptValue(qQNaN())", false);
- toBool.insert("QScriptValue(qInf())", true);
- toBool.insert("QScriptValue(-qInf())", true);
- toBool.insert("QScriptValue(\"NaN\")", true);
- toBool.insert("QScriptValue(\"Infinity\")", true);
- toBool.insert("QScriptValue(\"-Infinity\")", true);
- toBool.insert("QScriptValue(\"ciao\")", true);
- toBool.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(QString(\"\"))", false);
- toBool.insert("QScriptValue(QString())", false);
- toBool.insert("QScriptValue(QString(\"0\"))", true);
- toBool.insert("QScriptValue(QString(\"123\"))", true);
- toBool.insert("QScriptValue(QString(\"12.4\"))", true);
- toBool.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(0, QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(0, true)", true);
- toBool.insert("QScriptValue(0, false)", false);
- toBool.insert("QScriptValue(0, int(122))", true);
- toBool.insert("QScriptValue(0, uint(124))", true);
- toBool.insert("QScriptValue(0, 0)", false);
- toBool.insert("QScriptValue(0, 0.0)", false);
- toBool.insert("QScriptValue(0, 123.0)", true);
- toBool.insert("QScriptValue(0, 6.37e-8)", true);
- toBool.insert("QScriptValue(0, -6.37e-8)", true);
- toBool.insert("QScriptValue(0, 0x43211234)", true);
- toBool.insert("QScriptValue(0, 0x10000)", true);
- toBool.insert("QScriptValue(0, 0x10001)", true);
- toBool.insert("QScriptValue(0, qSNaN())", false);
- toBool.insert("QScriptValue(0, qQNaN())", false);
- toBool.insert("QScriptValue(0, qInf())", true);
- toBool.insert("QScriptValue(0, -qInf())", true);
- toBool.insert("QScriptValue(0, \"NaN\")", true);
- toBool.insert("QScriptValue(0, \"Infinity\")", true);
- toBool.insert("QScriptValue(0, \"-Infinity\")", true);
- toBool.insert("QScriptValue(0, \"ciao\")", true);
- toBool.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(0, QString(\"\"))", false);
- toBool.insert("QScriptValue(0, QString())", false);
- toBool.insert("QScriptValue(0, QString(\"0\"))", true);
- toBool.insert("QScriptValue(0, QString(\"123\"))", true);
- toBool.insert("QScriptValue(0, QString(\"12.3\"))", true);
- toBool.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
- toBool.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
- toBool.insert("QScriptValue(engine, true)", true);
- toBool.insert("QScriptValue(engine, false)", false);
- toBool.insert("QScriptValue(engine, int(122))", true);
- toBool.insert("QScriptValue(engine, uint(124))", true);
- toBool.insert("QScriptValue(engine, 0)", false);
- toBool.insert("QScriptValue(engine, 0.0)", false);
- toBool.insert("QScriptValue(engine, 123.0)", true);
- toBool.insert("QScriptValue(engine, 6.37e-8)", true);
- toBool.insert("QScriptValue(engine, -6.37e-8)", true);
- toBool.insert("QScriptValue(engine, 0x43211234)", true);
- toBool.insert("QScriptValue(engine, 0x10000)", true);
- toBool.insert("QScriptValue(engine, 0x10001)", true);
- toBool.insert("QScriptValue(engine, qSNaN())", false);
- toBool.insert("QScriptValue(engine, qQNaN())", false);
- toBool.insert("QScriptValue(engine, qInf())", true);
- toBool.insert("QScriptValue(engine, -qInf())", true);
- toBool.insert("QScriptValue(engine, \"NaN\")", true);
- toBool.insert("QScriptValue(engine, \"Infinity\")", true);
- toBool.insert("QScriptValue(engine, \"-Infinity\")", true);
- toBool.insert("QScriptValue(engine, \"ciao\")", true);
- toBool.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"\"))", false);
- toBool.insert("QScriptValue(engine, QString())", false);
- toBool.insert("QScriptValue(engine, QString(\"0\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"123\"))", true);
- toBool.insert("QScriptValue(engine, QString(\"1.23\"))", true);
- toBool.insert("engine->evaluate(\"[]\")", true);
- toBool.insert("engine->evaluate(\"{}\")", false);
- toBool.insert("engine->evaluate(\"Object.prototype\")", true);
- toBool.insert("engine->evaluate(\"Date.prototype\")", true);
- toBool.insert("engine->evaluate(\"Array.prototype\")", true);
- toBool.insert("engine->evaluate(\"Function.prototype\")", true);
- toBool.insert("engine->evaluate(\"Error.prototype\")", true);
- toBool.insert("engine->evaluate(\"Object\")", true);
- toBool.insert("engine->evaluate(\"Array\")", true);
- toBool.insert("engine->evaluate(\"Number\")", true);
- toBool.insert("engine->evaluate(\"Function\")", true);
- toBool.insert("engine->evaluate(\"(function() { return 1; })\")", true);
- toBool.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
- toBool.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
- toBool.insert("engine->evaluate(\"/foo/\")", true);
- toBool.insert("engine->evaluate(\"new Object()\")", true);
- toBool.insert("engine->evaluate(\"new Array()\")", true);
- toBool.insert("engine->evaluate(\"new Error()\")", true);
- toBool.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true);
- toBool.insert("engine->evaluate(\"Undefined\")", true);
- toBool.insert("engine->evaluate(\"Null\")", true);
- toBool.insert("engine->evaluate(\"True\")", true);
- toBool.insert("engine->evaluate(\"False\")", true);
- toBool.insert("engine->evaluate(\"undefined\")", false);
- toBool.insert("engine->evaluate(\"null\")", false);
- toBool.insert("engine->evaluate(\"true\")", true);
- toBool.insert("engine->evaluate(\"false\")", false);
- toBool.insert("engine->evaluate(\"122\")", true);
- toBool.insert("engine->evaluate(\"124\")", true);
- toBool.insert("engine->evaluate(\"0\")", false);
- toBool.insert("engine->evaluate(\"0.0\")", false);
- toBool.insert("engine->evaluate(\"123.0\")", true);
- toBool.insert("engine->evaluate(\"6.37e-8\")", true);
- toBool.insert("engine->evaluate(\"-6.37e-8\")", true);
- toBool.insert("engine->evaluate(\"0x43211234\")", true);
- toBool.insert("engine->evaluate(\"0x10000\")", true);
- toBool.insert("engine->evaluate(\"0x10001\")", true);
- toBool.insert("engine->evaluate(\"NaN\")", false);
- toBool.insert("engine->evaluate(\"Infinity\")", true);
- toBool.insert("engine->evaluate(\"-Infinity\")", true);
- toBool.insert("engine->evaluate(\"'ciao'\")", true);
- toBool.insert("engine->evaluate(\"''\")", false);
- toBool.insert("engine->evaluate(\"'0'\")", true);
- toBool.insert("engine->evaluate(\"'123'\")", true);
- toBool.insert("engine->evaluate(\"'12.4'\")", true);
- toBool.insert("engine->nullValue()", false);
- toBool.insert("engine->undefinedValue()", false);
- }
- newRow(expr) << toBool.value(expr);
-}
-
-void tst_QScriptValue::toBool_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.toBool(), expected);
- QCOMPARE(value.toBool(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toBool)
-
-
-void tst_QScriptValue::toBoolean_initData()
-{
- QTest::addColumn<bool>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toBoolean_makeData(const char* expr)
-{
- static QHash<QString, bool> toBoolean;
- if (toBoolean.isEmpty()) {
- toBoolean.insert("QScriptValue()", false);
- toBoolean.insert("QScriptValue(QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(true)", true);
- toBoolean.insert("QScriptValue(false)", false);
- toBoolean.insert("QScriptValue(int(122))", true);
- toBoolean.insert("QScriptValue(uint(124))", true);
- toBoolean.insert("QScriptValue(0)", false);
- toBoolean.insert("QScriptValue(0.0)", false);
- toBoolean.insert("QScriptValue(123.0)", true);
- toBoolean.insert("QScriptValue(6.37e-8)", true);
- toBoolean.insert("QScriptValue(-6.37e-8)", true);
- toBoolean.insert("QScriptValue(0x43211234)", true);
- toBoolean.insert("QScriptValue(0x10000)", true);
- toBoolean.insert("QScriptValue(0x10001)", true);
- toBoolean.insert("QScriptValue(qSNaN())", false);
- toBoolean.insert("QScriptValue(qQNaN())", false);
- toBoolean.insert("QScriptValue(qInf())", true);
- toBoolean.insert("QScriptValue(-qInf())", true);
- toBoolean.insert("QScriptValue(\"NaN\")", true);
- toBoolean.insert("QScriptValue(\"Infinity\")", true);
- toBoolean.insert("QScriptValue(\"-Infinity\")", true);
- toBoolean.insert("QScriptValue(\"ciao\")", true);
- toBoolean.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(QString(\"\"))", false);
- toBoolean.insert("QScriptValue(QString())", false);
- toBoolean.insert("QScriptValue(QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(QString(\"12.4\"))", true);
- toBoolean.insert("QScriptValue(0, QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(0, QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(0, true)", true);
- toBoolean.insert("QScriptValue(0, false)", false);
- toBoolean.insert("QScriptValue(0, int(122))", true);
- toBoolean.insert("QScriptValue(0, uint(124))", true);
- toBoolean.insert("QScriptValue(0, 0)", false);
- toBoolean.insert("QScriptValue(0, 0.0)", false);
- toBoolean.insert("QScriptValue(0, 123.0)", true);
- toBoolean.insert("QScriptValue(0, 6.37e-8)", true);
- toBoolean.insert("QScriptValue(0, -6.37e-8)", true);
- toBoolean.insert("QScriptValue(0, 0x43211234)", true);
- toBoolean.insert("QScriptValue(0, 0x10000)", true);
- toBoolean.insert("QScriptValue(0, 0x10001)", true);
- toBoolean.insert("QScriptValue(0, qSNaN())", false);
- toBoolean.insert("QScriptValue(0, qQNaN())", false);
- toBoolean.insert("QScriptValue(0, qInf())", true);
- toBoolean.insert("QScriptValue(0, -qInf())", true);
- toBoolean.insert("QScriptValue(0, \"NaN\")", true);
- toBoolean.insert("QScriptValue(0, \"Infinity\")", true);
- toBoolean.insert("QScriptValue(0, \"-Infinity\")", true);
- toBoolean.insert("QScriptValue(0, \"ciao\")", true);
- toBoolean.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"\"))", false);
- toBoolean.insert("QScriptValue(0, QString())", false);
- toBoolean.insert("QScriptValue(0, QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(0, QString(\"12.3\"))", true);
- toBoolean.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", false);
- toBoolean.insert("QScriptValue(engine, QScriptValue::NullValue)", false);
- toBoolean.insert("QScriptValue(engine, true)", true);
- toBoolean.insert("QScriptValue(engine, false)", false);
- toBoolean.insert("QScriptValue(engine, int(122))", true);
- toBoolean.insert("QScriptValue(engine, uint(124))", true);
- toBoolean.insert("QScriptValue(engine, 0)", false);
- toBoolean.insert("QScriptValue(engine, 0.0)", false);
- toBoolean.insert("QScriptValue(engine, 123.0)", true);
- toBoolean.insert("QScriptValue(engine, 6.37e-8)", true);
- toBoolean.insert("QScriptValue(engine, -6.37e-8)", true);
- toBoolean.insert("QScriptValue(engine, 0x43211234)", true);
- toBoolean.insert("QScriptValue(engine, 0x10000)", true);
- toBoolean.insert("QScriptValue(engine, 0x10001)", true);
- toBoolean.insert("QScriptValue(engine, qSNaN())", false);
- toBoolean.insert("QScriptValue(engine, qQNaN())", false);
- toBoolean.insert("QScriptValue(engine, qInf())", true);
- toBoolean.insert("QScriptValue(engine, -qInf())", true);
- toBoolean.insert("QScriptValue(engine, \"NaN\")", true);
- toBoolean.insert("QScriptValue(engine, \"Infinity\")", true);
- toBoolean.insert("QScriptValue(engine, \"-Infinity\")", true);
- toBoolean.insert("QScriptValue(engine, \"ciao\")", true);
- toBoolean.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"\"))", false);
- toBoolean.insert("QScriptValue(engine, QString())", false);
- toBoolean.insert("QScriptValue(engine, QString(\"0\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"123\"))", true);
- toBoolean.insert("QScriptValue(engine, QString(\"1.23\"))", true);
- toBoolean.insert("engine->evaluate(\"[]\")", true);
- toBoolean.insert("engine->evaluate(\"{}\")", false);
- toBoolean.insert("engine->evaluate(\"Object.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Date.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Array.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Function.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Error.prototype\")", true);
- toBoolean.insert("engine->evaluate(\"Object\")", true);
- toBoolean.insert("engine->evaluate(\"Array\")", true);
- toBoolean.insert("engine->evaluate(\"Number\")", true);
- toBoolean.insert("engine->evaluate(\"Function\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { return 1; })\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", true);
- toBoolean.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", true);
- toBoolean.insert("engine->evaluate(\"/foo/\")", true);
- toBoolean.insert("engine->evaluate(\"new Object()\")", true);
- toBoolean.insert("engine->evaluate(\"new Array()\")", true);
- toBoolean.insert("engine->evaluate(\"new Error()\")", true);
- toBoolean.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", true);
- toBoolean.insert("engine->evaluate(\"Undefined\")", true);
- toBoolean.insert("engine->evaluate(\"Null\")", true);
- toBoolean.insert("engine->evaluate(\"True\")", true);
- toBoolean.insert("engine->evaluate(\"False\")", true);
- toBoolean.insert("engine->evaluate(\"undefined\")", false);
- toBoolean.insert("engine->evaluate(\"null\")", false);
- toBoolean.insert("engine->evaluate(\"true\")", true);
- toBoolean.insert("engine->evaluate(\"false\")", false);
- toBoolean.insert("engine->evaluate(\"122\")", true);
- toBoolean.insert("engine->evaluate(\"124\")", true);
- toBoolean.insert("engine->evaluate(\"0\")", false);
- toBoolean.insert("engine->evaluate(\"0.0\")", false);
- toBoolean.insert("engine->evaluate(\"123.0\")", true);
- toBoolean.insert("engine->evaluate(\"6.37e-8\")", true);
- toBoolean.insert("engine->evaluate(\"-6.37e-8\")", true);
- toBoolean.insert("engine->evaluate(\"0x43211234\")", true);
- toBoolean.insert("engine->evaluate(\"0x10000\")", true);
- toBoolean.insert("engine->evaluate(\"0x10001\")", true);
- toBoolean.insert("engine->evaluate(\"NaN\")", false);
- toBoolean.insert("engine->evaluate(\"Infinity\")", true);
- toBoolean.insert("engine->evaluate(\"-Infinity\")", true);
- toBoolean.insert("engine->evaluate(\"'ciao'\")", true);
- toBoolean.insert("engine->evaluate(\"''\")", false);
- toBoolean.insert("engine->evaluate(\"'0'\")", true);
- toBoolean.insert("engine->evaluate(\"'123'\")", true);
- toBoolean.insert("engine->evaluate(\"'12.4'\")", true);
- toBoolean.insert("engine->nullValue()", false);
- toBoolean.insert("engine->undefinedValue()", false);
- }
- newRow(expr) << toBoolean.value(expr);
-}
-
-void tst_QScriptValue::toBoolean_test(const char*, const QScriptValue& value)
-{
- QFETCH(bool, expected);
- QCOMPARE(value.toBoolean(), expected);
- QCOMPARE(value.toBoolean(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toBoolean)
-
-
-void tst_QScriptValue::toInteger_initData()
-{
- QTest::addColumn<qsreal>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toInteger_makeData(const char* expr)
-{
- static QHash<QString, qsreal> toInteger;
- if (toInteger.isEmpty()) {
- toInteger.insert("QScriptValue()", 0);
- toInteger.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(true)", 1);
- toInteger.insert("QScriptValue(false)", 0);
- toInteger.insert("QScriptValue(int(122))", 122);
- toInteger.insert("QScriptValue(uint(124))", 124);
- toInteger.insert("QScriptValue(0)", 0);
- toInteger.insert("QScriptValue(0.0)", 0);
- toInteger.insert("QScriptValue(123.0)", 123);
- toInteger.insert("QScriptValue(6.37e-8)", 0);
- toInteger.insert("QScriptValue(-6.37e-8)", 0);
- toInteger.insert("QScriptValue(0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(0x10000)", 65536);
- toInteger.insert("QScriptValue(0x10001)", 65537);
- toInteger.insert("QScriptValue(qSNaN())", 0);
- toInteger.insert("QScriptValue(qQNaN())", 0);
- toInteger.insert("QScriptValue(qInf())", qInf());
- toInteger.insert("QScriptValue(-qInf())", qInf());
- toInteger.insert("QScriptValue(\"NaN\")", 0);
- toInteger.insert("QScriptValue(\"Infinity\")", qInf());
- toInteger.insert("QScriptValue(\"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(\"ciao\")", 0);
- toInteger.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(QString(\"\"))", 0);
- toInteger.insert("QScriptValue(QString())", 0);
- toInteger.insert("QScriptValue(QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(QString(\"12.4\"))", 12);
- toInteger.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(0, true)", 1);
- toInteger.insert("QScriptValue(0, false)", 0);
- toInteger.insert("QScriptValue(0, int(122))", 122);
- toInteger.insert("QScriptValue(0, uint(124))", 124);
- toInteger.insert("QScriptValue(0, 0)", 0);
- toInteger.insert("QScriptValue(0, 0.0)", 0);
- toInteger.insert("QScriptValue(0, 123.0)", 123);
- toInteger.insert("QScriptValue(0, 6.37e-8)", 0);
- toInteger.insert("QScriptValue(0, -6.37e-8)", 0);
- toInteger.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(0, 0x10000)", 65536);
- toInteger.insert("QScriptValue(0, 0x10001)", 65537);
- toInteger.insert("QScriptValue(0, qSNaN())", 0);
- toInteger.insert("QScriptValue(0, qQNaN())", 0);
- toInteger.insert("QScriptValue(0, qInf())", qInf());
- toInteger.insert("QScriptValue(0, -qInf())", qInf());
- toInteger.insert("QScriptValue(0, \"NaN\")", 0);
- toInteger.insert("QScriptValue(0, \"Infinity\")", qInf());
- toInteger.insert("QScriptValue(0, \"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(0, \"ciao\")", 0);
- toInteger.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(0, QString(\"\"))", 0);
- toInteger.insert("QScriptValue(0, QString())", 0);
- toInteger.insert("QScriptValue(0, QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(0, QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toInteger.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toInteger.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toInteger.insert("QScriptValue(engine, true)", 1);
- toInteger.insert("QScriptValue(engine, false)", 0);
- toInteger.insert("QScriptValue(engine, int(122))", 122);
- toInteger.insert("QScriptValue(engine, uint(124))", 124);
- toInteger.insert("QScriptValue(engine, 0)", 0);
- toInteger.insert("QScriptValue(engine, 0.0)", 0);
- toInteger.insert("QScriptValue(engine, 123.0)", 123);
- toInteger.insert("QScriptValue(engine, 6.37e-8)", 0);
- toInteger.insert("QScriptValue(engine, -6.37e-8)", 0);
- toInteger.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toInteger.insert("QScriptValue(engine, 0x10000)", 65536);
- toInteger.insert("QScriptValue(engine, 0x10001)", 65537);
- toInteger.insert("QScriptValue(engine, qSNaN())", 0);
- toInteger.insert("QScriptValue(engine, qQNaN())", 0);
- toInteger.insert("QScriptValue(engine, qInf())", qInf());
- toInteger.insert("QScriptValue(engine, -qInf())", qInf());
- toInteger.insert("QScriptValue(engine, \"NaN\")", 0);
- toInteger.insert("QScriptValue(engine, \"Infinity\")", qInf());
- toInteger.insert("QScriptValue(engine, \"-Infinity\")", qInf());
- toInteger.insert("QScriptValue(engine, \"ciao\")", 0);
- toInteger.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toInteger.insert("QScriptValue(engine, QString(\"\"))", 0);
- toInteger.insert("QScriptValue(engine, QString())", 0);
- toInteger.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toInteger.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toInteger.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toInteger.insert("engine->evaluate(\"[]\")", 0);
- toInteger.insert("engine->evaluate(\"{}\")", 0);
- toInteger.insert("engine->evaluate(\"Object.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Date.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Array.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Function.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Error.prototype\")", 0);
- toInteger.insert("engine->evaluate(\"Object\")", 0);
- toInteger.insert("engine->evaluate(\"Array\")", 0);
- toInteger.insert("engine->evaluate(\"Number\")", 0);
- toInteger.insert("engine->evaluate(\"Function\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toInteger.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toInteger.insert("engine->evaluate(\"/foo/\")", 0);
- toInteger.insert("engine->evaluate(\"new Object()\")", 0);
- toInteger.insert("engine->evaluate(\"new Array()\")", 0);
- toInteger.insert("engine->evaluate(\"new Error()\")", 0);
- toInteger.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toInteger.insert("engine->evaluate(\"Undefined\")", 0);
- toInteger.insert("engine->evaluate(\"Null\")", 0);
- toInteger.insert("engine->evaluate(\"True\")", 0);
- toInteger.insert("engine->evaluate(\"False\")", 0);
- toInteger.insert("engine->evaluate(\"undefined\")", 0);
- toInteger.insert("engine->evaluate(\"null\")", 0);
- toInteger.insert("engine->evaluate(\"true\")", 1);
- toInteger.insert("engine->evaluate(\"false\")", 0);
- toInteger.insert("engine->evaluate(\"122\")", 122);
- toInteger.insert("engine->evaluate(\"124\")", 124);
- toInteger.insert("engine->evaluate(\"0\")", 0);
- toInteger.insert("engine->evaluate(\"0.0\")", 0);
- toInteger.insert("engine->evaluate(\"123.0\")", 123);
- toInteger.insert("engine->evaluate(\"6.37e-8\")", 0);
- toInteger.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toInteger.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toInteger.insert("engine->evaluate(\"0x10000\")", 65536);
- toInteger.insert("engine->evaluate(\"0x10001\")", 65537);
- toInteger.insert("engine->evaluate(\"NaN\")", 0);
- toInteger.insert("engine->evaluate(\"Infinity\")", qInf());
- toInteger.insert("engine->evaluate(\"-Infinity\")", qInf());
- toInteger.insert("engine->evaluate(\"'ciao'\")", 0);
- toInteger.insert("engine->evaluate(\"''\")", 0);
- toInteger.insert("engine->evaluate(\"'0'\")", 0);
- toInteger.insert("engine->evaluate(\"'123'\")", 123);
- toInteger.insert("engine->evaluate(\"'12.4'\")", 12);
- toInteger.insert("engine->nullValue()", 0);
- toInteger.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toInteger.value(expr);
-}
-
-void tst_QScriptValue::toInteger_test(const char*, const QScriptValue& value)
-{
- QFETCH(qsreal, expected);
- if (qIsInf(expected)) {
- QVERIFY(qIsInf(value.toInteger()));
- QVERIFY(qIsInf(value.toInteger()));
- return;
- }
- QCOMPARE(value.toInteger(), expected);
- QCOMPARE(value.toInteger(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toInteger)
-
-
-void tst_QScriptValue::toInt32_initData()
-{
- QTest::addColumn<qint32>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toInt32_makeData(const char* expr)
-{
- static QHash<QString, qint32> toInt32;
- if (toInt32.isEmpty()) {
- toInt32.insert("QScriptValue()", 0);
- toInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(true)", 1);
- toInt32.insert("QScriptValue(false)", 0);
- toInt32.insert("QScriptValue(int(122))", 122);
- toInt32.insert("QScriptValue(uint(124))", 124);
- toInt32.insert("QScriptValue(0)", 0);
- toInt32.insert("QScriptValue(0.0)", 0);
- toInt32.insert("QScriptValue(123.0)", 123);
- toInt32.insert("QScriptValue(6.37e-8)", 0);
- toInt32.insert("QScriptValue(-6.37e-8)", 0);
- toInt32.insert("QScriptValue(0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(0x10000)", 65536);
- toInt32.insert("QScriptValue(0x10001)", 65537);
- toInt32.insert("QScriptValue(qSNaN())", 0);
- toInt32.insert("QScriptValue(qQNaN())", 0);
- toInt32.insert("QScriptValue(qInf())", 0);
- toInt32.insert("QScriptValue(-qInf())", 0);
- toInt32.insert("QScriptValue(\"NaN\")", 0);
- toInt32.insert("QScriptValue(\"Infinity\")", 0);
- toInt32.insert("QScriptValue(\"-Infinity\")", 0);
- toInt32.insert("QScriptValue(\"ciao\")", 0);
- toInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(QString(\"\"))", 0);
- toInt32.insert("QScriptValue(QString())", 0);
- toInt32.insert("QScriptValue(QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(QString(\"12.4\"))", 12);
- toInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(0, true)", 1);
- toInt32.insert("QScriptValue(0, false)", 0);
- toInt32.insert("QScriptValue(0, int(122))", 122);
- toInt32.insert("QScriptValue(0, uint(124))", 124);
- toInt32.insert("QScriptValue(0, 0)", 0);
- toInt32.insert("QScriptValue(0, 0.0)", 0);
- toInt32.insert("QScriptValue(0, 123.0)", 123);
- toInt32.insert("QScriptValue(0, 6.37e-8)", 0);
- toInt32.insert("QScriptValue(0, -6.37e-8)", 0);
- toInt32.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(0, 0x10000)", 65536);
- toInt32.insert("QScriptValue(0, 0x10001)", 65537);
- toInt32.insert("QScriptValue(0, qSNaN())", 0);
- toInt32.insert("QScriptValue(0, qQNaN())", 0);
- toInt32.insert("QScriptValue(0, qInf())", 0);
- toInt32.insert("QScriptValue(0, -qInf())", 0);
- toInt32.insert("QScriptValue(0, \"NaN\")", 0);
- toInt32.insert("QScriptValue(0, \"Infinity\")", 0);
- toInt32.insert("QScriptValue(0, \"-Infinity\")", 0);
- toInt32.insert("QScriptValue(0, \"ciao\")", 0);
- toInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(0, QString(\"\"))", 0);
- toInt32.insert("QScriptValue(0, QString())", 0);
- toInt32.insert("QScriptValue(0, QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(0, QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toInt32.insert("QScriptValue(engine, true)", 1);
- toInt32.insert("QScriptValue(engine, false)", 0);
- toInt32.insert("QScriptValue(engine, int(122))", 122);
- toInt32.insert("QScriptValue(engine, uint(124))", 124);
- toInt32.insert("QScriptValue(engine, 0)", 0);
- toInt32.insert("QScriptValue(engine, 0.0)", 0);
- toInt32.insert("QScriptValue(engine, 123.0)", 123);
- toInt32.insert("QScriptValue(engine, 6.37e-8)", 0);
- toInt32.insert("QScriptValue(engine, -6.37e-8)", 0);
- toInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toInt32.insert("QScriptValue(engine, 0x10000)", 65536);
- toInt32.insert("QScriptValue(engine, 0x10001)", 65537);
- toInt32.insert("QScriptValue(engine, qSNaN())", 0);
- toInt32.insert("QScriptValue(engine, qQNaN())", 0);
- toInt32.insert("QScriptValue(engine, qInf())", 0);
- toInt32.insert("QScriptValue(engine, -qInf())", 0);
- toInt32.insert("QScriptValue(engine, \"NaN\")", 0);
- toInt32.insert("QScriptValue(engine, \"Infinity\")", 0);
- toInt32.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toInt32.insert("QScriptValue(engine, \"ciao\")", 0);
- toInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toInt32.insert("QScriptValue(engine, QString(\"\"))", 0);
- toInt32.insert("QScriptValue(engine, QString())", 0);
- toInt32.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toInt32.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toInt32.insert("engine->evaluate(\"[]\")", 0);
- toInt32.insert("engine->evaluate(\"{}\")", 0);
- toInt32.insert("engine->evaluate(\"Object.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Date.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Array.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Function.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Error.prototype\")", 0);
- toInt32.insert("engine->evaluate(\"Object\")", 0);
- toInt32.insert("engine->evaluate(\"Array\")", 0);
- toInt32.insert("engine->evaluate(\"Number\")", 0);
- toInt32.insert("engine->evaluate(\"Function\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toInt32.insert("engine->evaluate(\"/foo/\")", 0);
- toInt32.insert("engine->evaluate(\"new Object()\")", 0);
- toInt32.insert("engine->evaluate(\"new Array()\")", 0);
- toInt32.insert("engine->evaluate(\"new Error()\")", 0);
- toInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toInt32.insert("engine->evaluate(\"Undefined\")", 0);
- toInt32.insert("engine->evaluate(\"Null\")", 0);
- toInt32.insert("engine->evaluate(\"True\")", 0);
- toInt32.insert("engine->evaluate(\"False\")", 0);
- toInt32.insert("engine->evaluate(\"undefined\")", 0);
- toInt32.insert("engine->evaluate(\"null\")", 0);
- toInt32.insert("engine->evaluate(\"true\")", 1);
- toInt32.insert("engine->evaluate(\"false\")", 0);
- toInt32.insert("engine->evaluate(\"122\")", 122);
- toInt32.insert("engine->evaluate(\"124\")", 124);
- toInt32.insert("engine->evaluate(\"0\")", 0);
- toInt32.insert("engine->evaluate(\"0.0\")", 0);
- toInt32.insert("engine->evaluate(\"123.0\")", 123);
- toInt32.insert("engine->evaluate(\"6.37e-8\")", 0);
- toInt32.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toInt32.insert("engine->evaluate(\"0x10000\")", 65536);
- toInt32.insert("engine->evaluate(\"0x10001\")", 65537);
- toInt32.insert("engine->evaluate(\"NaN\")", 0);
- toInt32.insert("engine->evaluate(\"Infinity\")", 0);
- toInt32.insert("engine->evaluate(\"-Infinity\")", 0);
- toInt32.insert("engine->evaluate(\"'ciao'\")", 0);
- toInt32.insert("engine->evaluate(\"''\")", 0);
- toInt32.insert("engine->evaluate(\"'0'\")", 0);
- toInt32.insert("engine->evaluate(\"'123'\")", 123);
- toInt32.insert("engine->evaluate(\"'12.4'\")", 12);
- toInt32.insert("engine->nullValue()", 0);
- toInt32.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toInt32.value(expr);
-}
-
-void tst_QScriptValue::toInt32_test(const char*, const QScriptValue& value)
-{
- QFETCH(qint32, expected);
- QCOMPARE(value.toInt32(), expected);
- QCOMPARE(value.toInt32(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toInt32)
-
-
-void tst_QScriptValue::toUInt32_initData()
-{
- QTest::addColumn<quint32>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toUInt32_makeData(const char* expr)
-{
- static QHash<QString, quint32> toUInt32;
- if (toUInt32.isEmpty()) {
- toUInt32.insert("QScriptValue()", 0);
- toUInt32.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(true)", 1);
- toUInt32.insert("QScriptValue(false)", 0);
- toUInt32.insert("QScriptValue(int(122))", 122);
- toUInt32.insert("QScriptValue(uint(124))", 124);
- toUInt32.insert("QScriptValue(0)", 0);
- toUInt32.insert("QScriptValue(0.0)", 0);
- toUInt32.insert("QScriptValue(123.0)", 123);
- toUInt32.insert("QScriptValue(6.37e-8)", 0);
- toUInt32.insert("QScriptValue(-6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(0x10000)", 65536);
- toUInt32.insert("QScriptValue(0x10001)", 65537);
- toUInt32.insert("QScriptValue(qSNaN())", 0);
- toUInt32.insert("QScriptValue(qQNaN())", 0);
- toUInt32.insert("QScriptValue(qInf())", 0);
- toUInt32.insert("QScriptValue(-qInf())", 0);
- toUInt32.insert("QScriptValue(\"NaN\")", 0);
- toUInt32.insert("QScriptValue(\"Infinity\")", 0);
- toUInt32.insert("QScriptValue(\"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(\"ciao\")", 0);
- toUInt32.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(QString())", 0);
- toUInt32.insert("QScriptValue(QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(QString(\"12.4\"))", 12);
- toUInt32.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(0, true)", 1);
- toUInt32.insert("QScriptValue(0, false)", 0);
- toUInt32.insert("QScriptValue(0, int(122))", 122);
- toUInt32.insert("QScriptValue(0, uint(124))", 124);
- toUInt32.insert("QScriptValue(0, 0)", 0);
- toUInt32.insert("QScriptValue(0, 0.0)", 0);
- toUInt32.insert("QScriptValue(0, 123.0)", 123);
- toUInt32.insert("QScriptValue(0, 6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0, -6.37e-8)", 0);
- toUInt32.insert("QScriptValue(0, 0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(0, 0x10000)", 65536);
- toUInt32.insert("QScriptValue(0, 0x10001)", 65537);
- toUInt32.insert("QScriptValue(0, qSNaN())", 0);
- toUInt32.insert("QScriptValue(0, qQNaN())", 0);
- toUInt32.insert("QScriptValue(0, qInf())", 0);
- toUInt32.insert("QScriptValue(0, -qInf())", 0);
- toUInt32.insert("QScriptValue(0, \"NaN\")", 0);
- toUInt32.insert("QScriptValue(0, \"Infinity\")", 0);
- toUInt32.insert("QScriptValue(0, \"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(0, \"ciao\")", 0);
- toUInt32.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(0, QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(0, QString())", 0);
- toUInt32.insert("QScriptValue(0, QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(0, QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toUInt32.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toUInt32.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toUInt32.insert("QScriptValue(engine, true)", 1);
- toUInt32.insert("QScriptValue(engine, false)", 0);
- toUInt32.insert("QScriptValue(engine, int(122))", 122);
- toUInt32.insert("QScriptValue(engine, uint(124))", 124);
- toUInt32.insert("QScriptValue(engine, 0)", 0);
- toUInt32.insert("QScriptValue(engine, 0.0)", 0);
- toUInt32.insert("QScriptValue(engine, 123.0)", 123);
- toUInt32.insert("QScriptValue(engine, 6.37e-8)", 0);
- toUInt32.insert("QScriptValue(engine, -6.37e-8)", 0);
- toUInt32.insert("QScriptValue(engine, 0x43211234)", 1126240820);
- toUInt32.insert("QScriptValue(engine, 0x10000)", 65536);
- toUInt32.insert("QScriptValue(engine, 0x10001)", 65537);
- toUInt32.insert("QScriptValue(engine, qSNaN())", 0);
- toUInt32.insert("QScriptValue(engine, qQNaN())", 0);
- toUInt32.insert("QScriptValue(engine, qInf())", 0);
- toUInt32.insert("QScriptValue(engine, -qInf())", 0);
- toUInt32.insert("QScriptValue(engine, \"NaN\")", 0);
- toUInt32.insert("QScriptValue(engine, \"Infinity\")", 0);
- toUInt32.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toUInt32.insert("QScriptValue(engine, \"ciao\")", 0);
- toUInt32.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString())", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toUInt32.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toUInt32.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toUInt32.insert("engine->evaluate(\"[]\")", 0);
- toUInt32.insert("engine->evaluate(\"{}\")", 0);
- toUInt32.insert("engine->evaluate(\"Object.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Date.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Array.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Function.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Error.prototype\")", 0);
- toUInt32.insert("engine->evaluate(\"Object\")", 0);
- toUInt32.insert("engine->evaluate(\"Array\")", 0);
- toUInt32.insert("engine->evaluate(\"Number\")", 0);
- toUInt32.insert("engine->evaluate(\"Function\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toUInt32.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toUInt32.insert("engine->evaluate(\"/foo/\")", 0);
- toUInt32.insert("engine->evaluate(\"new Object()\")", 0);
- toUInt32.insert("engine->evaluate(\"new Array()\")", 0);
- toUInt32.insert("engine->evaluate(\"new Error()\")", 0);
- toUInt32.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toUInt32.insert("engine->evaluate(\"Undefined\")", 0);
- toUInt32.insert("engine->evaluate(\"Null\")", 0);
- toUInt32.insert("engine->evaluate(\"True\")", 0);
- toUInt32.insert("engine->evaluate(\"False\")", 0);
- toUInt32.insert("engine->evaluate(\"undefined\")", 0);
- toUInt32.insert("engine->evaluate(\"null\")", 0);
- toUInt32.insert("engine->evaluate(\"true\")", 1);
- toUInt32.insert("engine->evaluate(\"false\")", 0);
- toUInt32.insert("engine->evaluate(\"122\")", 122);
- toUInt32.insert("engine->evaluate(\"124\")", 124);
- toUInt32.insert("engine->evaluate(\"0\")", 0);
- toUInt32.insert("engine->evaluate(\"0.0\")", 0);
- toUInt32.insert("engine->evaluate(\"123.0\")", 123);
- toUInt32.insert("engine->evaluate(\"6.37e-8\")", 0);
- toUInt32.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toUInt32.insert("engine->evaluate(\"0x43211234\")", 1126240820);
- toUInt32.insert("engine->evaluate(\"0x10000\")", 65536);
- toUInt32.insert("engine->evaluate(\"0x10001\")", 65537);
- toUInt32.insert("engine->evaluate(\"NaN\")", 0);
- toUInt32.insert("engine->evaluate(\"Infinity\")", 0);
- toUInt32.insert("engine->evaluate(\"-Infinity\")", 0);
- toUInt32.insert("engine->evaluate(\"'ciao'\")", 0);
- toUInt32.insert("engine->evaluate(\"''\")", 0);
- toUInt32.insert("engine->evaluate(\"'0'\")", 0);
- toUInt32.insert("engine->evaluate(\"'123'\")", 123);
- toUInt32.insert("engine->evaluate(\"'12.4'\")", 12);
- toUInt32.insert("engine->nullValue()", 0);
- toUInt32.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toUInt32.value(expr);
-}
-
-void tst_QScriptValue::toUInt32_test(const char*, const QScriptValue& value)
-{
- QFETCH(quint32, expected);
- QCOMPARE(value.toUInt32(), expected);
- QCOMPARE(value.toUInt32(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toUInt32)
-
-
-void tst_QScriptValue::toUInt16_initData()
-{
- QTest::addColumn<quint16>("expected");
- initScriptValues();
-}
-
-void tst_QScriptValue::toUInt16_makeData(const char* expr)
-{
- static QHash<QString, quint16> toUInt16;
- if (toUInt16.isEmpty()) {
- toUInt16.insert("QScriptValue()", 0);
- toUInt16.insert("QScriptValue(QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(true)", 1);
- toUInt16.insert("QScriptValue(false)", 0);
- toUInt16.insert("QScriptValue(int(122))", 122);
- toUInt16.insert("QScriptValue(uint(124))", 124);
- toUInt16.insert("QScriptValue(0)", 0);
- toUInt16.insert("QScriptValue(0.0)", 0);
- toUInt16.insert("QScriptValue(123.0)", 123);
- toUInt16.insert("QScriptValue(6.37e-8)", 0);
- toUInt16.insert("QScriptValue(-6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0x43211234)", 4660);
- toUInt16.insert("QScriptValue(0x10000)", 0);
- toUInt16.insert("QScriptValue(0x10001)", 1);
- toUInt16.insert("QScriptValue(qSNaN())", 0);
- toUInt16.insert("QScriptValue(qQNaN())", 0);
- toUInt16.insert("QScriptValue(qInf())", 0);
- toUInt16.insert("QScriptValue(-qInf())", 0);
- toUInt16.insert("QScriptValue(\"NaN\")", 0);
- toUInt16.insert("QScriptValue(\"Infinity\")", 0);
- toUInt16.insert("QScriptValue(\"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(\"ciao\")", 0);
- toUInt16.insert("QScriptValue(QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(QString())", 0);
- toUInt16.insert("QScriptValue(QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(QString(\"12.4\"))", 12);
- toUInt16.insert("QScriptValue(0, QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(0, QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(0, true)", 1);
- toUInt16.insert("QScriptValue(0, false)", 0);
- toUInt16.insert("QScriptValue(0, int(122))", 122);
- toUInt16.insert("QScriptValue(0, uint(124))", 124);
- toUInt16.insert("QScriptValue(0, 0)", 0);
- toUInt16.insert("QScriptValue(0, 0.0)", 0);
- toUInt16.insert("QScriptValue(0, 123.0)", 123);
- toUInt16.insert("QScriptValue(0, 6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0, -6.37e-8)", 0);
- toUInt16.insert("QScriptValue(0, 0x43211234)", 4660);
- toUInt16.insert("QScriptValue(0, 0x10000)", 0);
- toUInt16.insert("QScriptValue(0, 0x10001)", 1);
- toUInt16.insert("QScriptValue(0, qSNaN())", 0);
- toUInt16.insert("QScriptValue(0, qQNaN())", 0);
- toUInt16.insert("QScriptValue(0, qInf())", 0);
- toUInt16.insert("QScriptValue(0, -qInf())", 0);
- toUInt16.insert("QScriptValue(0, \"NaN\")", 0);
- toUInt16.insert("QScriptValue(0, \"Infinity\")", 0);
- toUInt16.insert("QScriptValue(0, \"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(0, \"ciao\")", 0);
- toUInt16.insert("QScriptValue(0, QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(0, QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(0, QString())", 0);
- toUInt16.insert("QScriptValue(0, QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(0, QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(0, QString(\"12.3\"))", 12);
- toUInt16.insert("QScriptValue(engine, QScriptValue::UndefinedValue)", 0);
- toUInt16.insert("QScriptValue(engine, QScriptValue::NullValue)", 0);
- toUInt16.insert("QScriptValue(engine, true)", 1);
- toUInt16.insert("QScriptValue(engine, false)", 0);
- toUInt16.insert("QScriptValue(engine, int(122))", 122);
- toUInt16.insert("QScriptValue(engine, uint(124))", 124);
- toUInt16.insert("QScriptValue(engine, 0)", 0);
- toUInt16.insert("QScriptValue(engine, 0.0)", 0);
- toUInt16.insert("QScriptValue(engine, 123.0)", 123);
- toUInt16.insert("QScriptValue(engine, 6.37e-8)", 0);
- toUInt16.insert("QScriptValue(engine, -6.37e-8)", 0);
- toUInt16.insert("QScriptValue(engine, 0x43211234)", 4660);
- toUInt16.insert("QScriptValue(engine, 0x10000)", 0);
- toUInt16.insert("QScriptValue(engine, 0x10001)", 1);
- toUInt16.insert("QScriptValue(engine, qSNaN())", 0);
- toUInt16.insert("QScriptValue(engine, qQNaN())", 0);
- toUInt16.insert("QScriptValue(engine, qInf())", 0);
- toUInt16.insert("QScriptValue(engine, -qInf())", 0);
- toUInt16.insert("QScriptValue(engine, \"NaN\")", 0);
- toUInt16.insert("QScriptValue(engine, \"Infinity\")", 0);
- toUInt16.insert("QScriptValue(engine, \"-Infinity\")", 0);
- toUInt16.insert("QScriptValue(engine, \"ciao\")", 0);
- toUInt16.insert("QScriptValue(engine, QString::fromLatin1(\"ciao\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString())", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"0\"))", 0);
- toUInt16.insert("QScriptValue(engine, QString(\"123\"))", 123);
- toUInt16.insert("QScriptValue(engine, QString(\"1.23\"))", 1);
- toUInt16.insert("engine->evaluate(\"[]\")", 0);
- toUInt16.insert("engine->evaluate(\"{}\")", 0);
- toUInt16.insert("engine->evaluate(\"Object.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Date.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Array.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Function.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Error.prototype\")", 0);
- toUInt16.insert("engine->evaluate(\"Object\")", 0);
- toUInt16.insert("engine->evaluate(\"Array\")", 0);
- toUInt16.insert("engine->evaluate(\"Number\")", 0);
- toUInt16.insert("engine->evaluate(\"Function\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { return 1; })\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { return 'ciao'; })\")", 0);
- toUInt16.insert("engine->evaluate(\"(function() { throw new Error('foo'); })\")", 0);
- toUInt16.insert("engine->evaluate(\"/foo/\")", 0);
- toUInt16.insert("engine->evaluate(\"new Object()\")", 0);
- toUInt16.insert("engine->evaluate(\"new Array()\")", 0);
- toUInt16.insert("engine->evaluate(\"new Error()\")", 0);
- toUInt16.insert("engine->evaluate(\"a = new Object(); a.foo = 22; a.foo\")", 22);
- toUInt16.insert("engine->evaluate(\"Undefined\")", 0);
- toUInt16.insert("engine->evaluate(\"Null\")", 0);
- toUInt16.insert("engine->evaluate(\"True\")", 0);
- toUInt16.insert("engine->evaluate(\"False\")", 0);
- toUInt16.insert("engine->evaluate(\"undefined\")", 0);
- toUInt16.insert("engine->evaluate(\"null\")", 0);
- toUInt16.insert("engine->evaluate(\"true\")", 1);
- toUInt16.insert("engine->evaluate(\"false\")", 0);
- toUInt16.insert("engine->evaluate(\"122\")", 122);
- toUInt16.insert("engine->evaluate(\"124\")", 124);
- toUInt16.insert("engine->evaluate(\"0\")", 0);
- toUInt16.insert("engine->evaluate(\"0.0\")", 0);
- toUInt16.insert("engine->evaluate(\"123.0\")", 123);
- toUInt16.insert("engine->evaluate(\"6.37e-8\")", 0);
- toUInt16.insert("engine->evaluate(\"-6.37e-8\")", 0);
- toUInt16.insert("engine->evaluate(\"0x43211234\")", 4660);
- toUInt16.insert("engine->evaluate(\"0x10000\")", 0);
- toUInt16.insert("engine->evaluate(\"0x10001\")", 1);
- toUInt16.insert("engine->evaluate(\"NaN\")", 0);
- toUInt16.insert("engine->evaluate(\"Infinity\")", 0);
- toUInt16.insert("engine->evaluate(\"-Infinity\")", 0);
- toUInt16.insert("engine->evaluate(\"'ciao'\")", 0);
- toUInt16.insert("engine->evaluate(\"''\")", 0);
- toUInt16.insert("engine->evaluate(\"'0'\")", 0);
- toUInt16.insert("engine->evaluate(\"'123'\")", 123);
- toUInt16.insert("engine->evaluate(\"'12.4'\")", 12);
- toUInt16.insert("engine->nullValue()", 0);
- toUInt16.insert("engine->undefinedValue()", 0);
- }
- newRow(expr) << toUInt16.value(expr);
-}
-
-void tst_QScriptValue::toUInt16_test(const char*, const QScriptValue& value)
-{
- QFETCH(quint16, expected);
- QCOMPARE(value.toUInt16(), expected);
- QCOMPARE(value.toUInt16(), expected);
-}
-
-DEFINE_TEST_FUNCTION(toUInt16)
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri b/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri
deleted file mode 100644
index 5af3383..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri
+++ /dev/null
@@ -1,19 +0,0 @@
-QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
-QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
-mac:!static:contains(QT_CONFIG, qt_framework):!CONFIG(webkit_no_framework) {
- LIBS += -framework QtScript
- QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
-} else {
- win32-*|wince* {
- LIBS += -lQtScript$${QT_MAJOR_VERSION}
- } else {
- LIBS += -lQtScript
- }
-}
-
-CONFIG(release, debug|release) {
- DEFINES += NDEBUG
-}
-
-INCLUDEPATH += $$PWD/../api
-
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro b/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro
deleted file mode 100644
index 7c3f590..0000000
--- a/src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = qscriptengine \
- qscriptvalue \
- qscriptstring
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 1e7351f..c2daf34 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 6623b5da196390748dc619461739f9cb84524736
+ 19de3d2848b715f937eb375a078672cc8e9b8185
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index c17a8aa..ddd04c1 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-06-18 Ananth Jasty <ext-ananth.jasty@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Text spacing miscalculation when using wordSpacing.
+ https://bugs.webkit.org/show_bug.cgi?id=40483
+
+ Removed wordSpacing compensation in FontQt whitespace width
+ calculation. The QFontMetrics::width() overload that takes
+ a character does not take QFont's word spacing into account.
+
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::Font::floatWidthForComplexText):
+
+2010-06-13 Robert Hogan <robert@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ WebCore EventHandler needs to take account of onLoad events
+ fired before layout() complete
+
+ https://bugs.webkit.org/show_bug.cgi?id=40102
+
+ WebCore 'cheats' by firing onLoad events before the frame's layout
+ has been performed. This can result in event listeners performing
+ operations that depend on the document's final layout, such as
+ scrolling operations.
+
+ When scrolling a frameview in eventhandler ensure the layout is complete.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::scrollRecursively):
+
+2010-06-10 Raine Makelainen <raine.makelainen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Impossible to set input method hints based HTML5 input types
+ https://bugs.webkit.org/show_bug.cgi?id=40107
+
+ Helper methods for checking "tel", "number", "email",
+ and "url" input element types.
+
+ * html/HTMLInputElement.h:
+ (WebCore::HTMLInputElement::isTelephoneField):
+ (WebCore::HTMLInputElement::isNumberField):
+ (WebCore::HTMLInputElement::isEmailField):
+ (WebCore::HTMLInputElement::isUrlField):
+
2010-06-17 Mark Brand <mabrand@mabrand.nl>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h
index c3b0a73..087cffa 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h
+++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h
@@ -128,6 +128,10 @@ public:
virtual bool isSearchField() const { return m_type == SEARCH; }
virtual bool isInputTypeHidden() const { return m_type == HIDDEN; }
virtual bool isPasswordField() const { return m_type == PASSWORD; }
+ bool isTelephoneField() const { return m_type == TELEPHONE; }
+ bool isNumberField() const { return m_type == NUMBER; }
+ bool isEmailField() const { return m_type == EMAIL; }
+ bool isUrlField() const { return m_type == URL; }
bool checked() const { return m_checked; }
void setChecked(bool, bool sendChangeEvent = false);
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
index c40299c..1654257 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
@@ -952,6 +952,9 @@ bool EventHandler::scrollOverflow(ScrollDirection direction, ScrollGranularity g
bool EventHandler::scrollRecursively(ScrollDirection direction, ScrollGranularity granularity, Node* startingNode)
{
+ // The layout needs to be up to date to determine if we can scroll. We may be
+ // here because of an onLoad event, in which case the final layout hasn't been performed yet.
+ m_frame->document()->updateLayoutIgnorePendingStylesheets();
bool handled = scrollOverflow(direction, granularity, startingNode);
if (!handled) {
Frame* frame = m_frame;
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
index ae1033e..d75f156 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt.cpp
@@ -182,7 +182,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon
return 0;
if (run.length() == 1 && treatAsSpace(run[0]))
- return QFontMetrics(font()).width(run[0]) - m_wordSpacing + run.padding();
+ return QFontMetrics(font()).width(run[0]) + run.padding();
String sanitized = Font::normalizeSpaces(String(run.characters(), run.length()));
QString string = fromRawDataWithoutRef(sanitized);
diff --git a/src/3rdparty/webkit/WebKit.pro b/src/3rdparty/webkit/WebKit.pro
index 84fcb56..c7df391 100644
--- a/src/3rdparty/webkit/WebKit.pro
+++ b/src/3rdparty/webkit/WebKit.pro
@@ -9,6 +9,9 @@ SUBDIRS += \
# If the source exists, built it
exists($$PWD/WebKitTools/QtTestBrowser): SUBDIRS += WebKitTools/QtTestBrowser
+contains(QT_CONFIG, declarative) {
+ exists($$PWD/WebKit/qt/declarative): SUBDIRS += WebKit/qt/declarative
+}
exists($$PWD/JavaScriptCore/jsc.pro): SUBDIRS += JavaScriptCore/jsc.pro
exists($$PWD/WebKit/qt/tests): SUBDIRS += WebKit/qt/tests
exists($$PWD/WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro): SUBDIRS += WebKitTools/DumpRenderTree/qt/DumpRenderTree.pro
diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog
index bee3298..0bf9bed 100644
--- a/src/3rdparty/webkit/WebKit/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-18 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [qt] Better check for the declarative plugin inclusion.
+
+ * WebKit.pro:
+
2010-03-22 Kevin Decker <kdecker@apple.com>
Reviewed by Simon Fraser.
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 475d22d..3df2970 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,230 @@
+2010-06-18 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix documentation for the declarative module import.
+
+ * declarative/qdeclarativewebview.cpp:
+
+2010-06-18 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Antti Koivisto.
+
+ REGRESSION(r60958) [Qt] qwebpage::inputMethods auto-test fails
+ https://bugs.webkit.org/show_bug.cgi?id=40830
+
+ When activating a regular input method field, always set or unset the ImhHiddenText
+ input method hint.
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::setInputMethodState):
+
+2010-06-10 Raine Makelainen <raine.makelainen@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Impossible to set input method hints based HTML5 input types
+ https://bugs.webkit.org/show_bug.cgi?id=40107
+
+ EditorClientQt to set input method hints for "number", "tel",
+ "email", and "url" HTML input elements.
+
+ Tests for HTML input elements and input method hints added for
+ QGraphicsWebView and QWebView.
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::setInputMethodState):
+ * tests/qgraphicswebview/resources/input_types.html: Added.
+ * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
+ (GraphicsWebView::GraphicsWebView):
+ (GraphicsWebView::fireMouseClick):
+ (tst_QGraphicsWebView::focusInputTypes):
+ * tests/qgraphicswebview/tst_qgraphicswebview.qrc: Added.
+ * tests/qwebview/resources/input_types.html: Added.
+ * tests/qwebview/tst_qwebview.cpp:
+ (WebView::fireMouseClick):
+ (tst_QWebView::focusInputTypes):
+ * tests/qwebview/tst_qwebview.qrc:
+
+2010-06-18 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix documentation issue on the onAlert handler.
+ Fix compilation issue with QT_NO_ACTION.
+
+ * declarative/qdeclarativewebview.cpp:
+ * declarative/qdeclarativewebview_p.h:
+
+2010-06-18 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Change the target path to QtWebKit.
+
+ * declarative/declarative.pro:
+
+2010-06-17 Robert Hogan <robert@webkit.org>
+
+ [Qt] Build fix
+
+ Unreviewed.
+
+ Remove includes in qdeclarativewebview*.* that rely on an installation
+ of QtWebKit.
+
+ * declarative/qdeclarativewebview.cpp:
+ * declarative/qdeclarativewebview_p.h:
+
+2010-06-17 Alexis Menard <alexis.menard@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Upstream the WebKit QML integration plugin
+ https://bugs.webkit.org/show_bug.cgi?id=40050
+
+ Add to the Qt port the QML WebKit integration plugin.
+ QDeclarativeWebView is creating the item and expose
+ properties. The C++ API is not public, only the
+ properties are.
+
+ * declarative/declarative.pro: Added.
+ * declarative/plugin.cpp: Added.
+ (WebKitQmlPlugin::registerTypes):
+ * declarative/qdeclarativewebview.cpp: Added.
+ (QDeclarativeWebViewPrivate::QDeclarativeWebViewPrivate):
+ (QDeclarativeWebViewPrivate::):
+ (QDeclarativeWebViewPrivate::windowObjectsAppend):
+ (GraphicsWebView::GraphicsWebView):
+ (GraphicsWebView::mousePressEvent):
+ (GraphicsWebView::mouseReleaseEvent):
+ (GraphicsWebView::mouseDoubleClickEvent):
+ (GraphicsWebView::timerEvent):
+ (GraphicsWebView::mouseMoveEvent):
+ (QDeclarativeWebView::QDeclarativeWebView):
+ (QDeclarativeWebView::~QDeclarativeWebView):
+ (QDeclarativeWebView::init):
+ (QDeclarativeWebView::componentComplete):
+ (QDeclarativeWebView::status):
+ (QDeclarativeWebView::progress):
+ (QDeclarativeWebView::doLoadStarted):
+ (QDeclarativeWebView::doLoadProgress):
+ (QDeclarativeWebView::pageUrlChanged):
+ (QDeclarativeWebView::doLoadFinished):
+ (QDeclarativeWebView::url):
+ (QDeclarativeWebView::setUrl):
+ (QDeclarativeWebView::preferredWidth):
+ (QDeclarativeWebView::setPreferredWidth):
+ (QDeclarativeWebView::preferredHeight):
+ (QDeclarativeWebView::setPreferredHeight):
+ (QDeclarativeWebView::evaluateJavaScript):
+ (QDeclarativeWebView::updateDeclarativeWebViewSize):
+ (QDeclarativeWebView::initialLayout):
+ (QDeclarativeWebView::updateContentsSize):
+ (QDeclarativeWebView::geometryChanged):
+ (QDeclarativeWebView::javaScriptWindowObjects):
+ (QDeclarativeWebView::qmlAttachedProperties):
+ (QDeclarativeWebViewPrivate::updateWindowObjects):
+ (QDeclarativeWebView::renderingEnabled):
+ (QDeclarativeWebView::setRenderingEnabled):
+ (QDeclarativeWebView::heuristicZoom):
+ (QDeclarativeWebView::pressGrabTime):
+ (QDeclarativeWebView::setPressGrabTime):
+ (QDeclarativeWebView::backAction):
+ (QDeclarativeWebView::forwardAction):
+ (QDeclarativeWebView::reloadAction):
+ (QDeclarativeWebView::stopAction):
+ (QDeclarativeWebView::title):
+ (QDeclarativeWebView::icon):
+ (QDeclarativeWebView::setStatusText):
+ (QDeclarativeWebView::windowObjectCleared):
+ (QDeclarativeWebView::statusText):
+ (QDeclarativeWebView::page):
+ (QDeclarativeWebView::settingsObject):
+ (QDeclarativeWebView::setPage):
+ (QDeclarativeWebView::load):
+ (QDeclarativeWebView::html):
+ (QDeclarativeWebView::setHtml):
+ (QDeclarativeWebView::setContent):
+ (QDeclarativeWebView::history):
+ (QDeclarativeWebView::settings):
+ (QDeclarativeWebView::createWindow):
+ (QDeclarativeWebView::newWindowComponent):
+ (QDeclarativeWebView::setNewWindowComponent):
+ (QDeclarativeWebView::newWindowParent):
+ (QDeclarativeWebView::setNewWindowParent):
+ (QDeclarativeWebView::contentsSize):
+ (QDeclarativeWebView::contentsScale):
+ (QDeclarativeWebView::setContentsScale):
+ (QDeclarativeWebView::elementAreaAt):
+ (QDeclarativeWebPage::QDeclarativeWebPage):
+ (QDeclarativeWebPage::~QDeclarativeWebPage):
+ (QDeclarativeWebPage::chooseFile):
+ (QDeclarativeWebPage::javaScriptAlert):
+ (QDeclarativeWebPage::javaScriptConfirm):
+ (QDeclarativeWebPage::javaScriptPrompt):
+ (QDeclarativeWebPage::viewItem):
+ (QDeclarativeWebPage::createWindow):
+ * declarative/qdeclarativewebview_p.h: Added.
+ (QDeclarativeWebView::):
+ (QDeclarativeWebView::isComponentCompletePublic):
+ (QDeclarativeWebViewAttached::QDeclarativeWebViewAttached):
+ (QDeclarativeWebViewAttached::windowObjectName):
+ (QDeclarativeWebViewAttached::setWindowObjectName):
+ (QDeclarativeWebSettings::QDeclarativeWebSettings):
+ (QDeclarativeWebSettings::standardFontFamily):
+ (QDeclarativeWebSettings::setStandardFontFamily):
+ (QDeclarativeWebSettings::fixedFontFamily):
+ (QDeclarativeWebSettings::setFixedFontFamily):
+ (QDeclarativeWebSettings::serifFontFamily):
+ (QDeclarativeWebSettings::setSerifFontFamily):
+ (QDeclarativeWebSettings::sansSerifFontFamily):
+ (QDeclarativeWebSettings::setSansSerifFontFamily):
+ (QDeclarativeWebSettings::cursiveFontFamily):
+ (QDeclarativeWebSettings::setCursiveFontFamily):
+ (QDeclarativeWebSettings::fantasyFontFamily):
+ (QDeclarativeWebSettings::setFantasyFontFamily):
+ (QDeclarativeWebSettings::minimumFontSize):
+ (QDeclarativeWebSettings::setMinimumFontSize):
+ (QDeclarativeWebSettings::minimumLogicalFontSize):
+ (QDeclarativeWebSettings::setMinimumLogicalFontSize):
+ (QDeclarativeWebSettings::defaultFontSize):
+ (QDeclarativeWebSettings::setDefaultFontSize):
+ (QDeclarativeWebSettings::defaultFixedFontSize):
+ (QDeclarativeWebSettings::setDefaultFixedFontSize):
+ (QDeclarativeWebSettings::autoLoadImages):
+ (QDeclarativeWebSettings::setAutoLoadImages):
+ (QDeclarativeWebSettings::javascriptEnabled):
+ (QDeclarativeWebSettings::setJavascriptEnabled):
+ (QDeclarativeWebSettings::javaEnabled):
+ (QDeclarativeWebSettings::setJavaEnabled):
+ (QDeclarativeWebSettings::pluginsEnabled):
+ (QDeclarativeWebSettings::setPluginsEnabled):
+ (QDeclarativeWebSettings::privateBrowsingEnabled):
+ (QDeclarativeWebSettings::setPrivateBrowsingEnabled):
+ (QDeclarativeWebSettings::javascriptCanOpenWindows):
+ (QDeclarativeWebSettings::setJavascriptCanOpenWindows):
+ (QDeclarativeWebSettings::javascriptCanAccessClipboard):
+ (QDeclarativeWebSettings::setJavascriptCanAccessClipboard):
+ (QDeclarativeWebSettings::developerExtrasEnabled):
+ (QDeclarativeWebSettings::setDeveloperExtrasEnabled):
+ (QDeclarativeWebSettings::linksIncludedInFocusChain):
+ (QDeclarativeWebSettings::setLinksIncludedInFocusChain):
+ (QDeclarativeWebSettings::zoomTextOnly):
+ (QDeclarativeWebSettings::setZoomTextOnly):
+ (QDeclarativeWebSettings::printElementBackgrounds):
+ (QDeclarativeWebSettings::setPrintElementBackgrounds):
+ (QDeclarativeWebSettings::offlineStorageDatabaseEnabled):
+ (QDeclarativeWebSettings::setOfflineStorageDatabaseEnabled):
+ (QDeclarativeWebSettings::offlineWebApplicationCacheEnabled):
+ (QDeclarativeWebSettings::setOfflineWebApplicationCacheEnabled):
+ (QDeclarativeWebSettings::localStorageDatabaseEnabled):
+ (QDeclarativeWebSettings::setLocalStorageDatabaseEnabled):
+ (QDeclarativeWebSettings::localContentCanAccessRemoteUrls):
+ (QDeclarativeWebSettings::setLocalContentCanAccessRemoteUrls):
+ * declarative/qmldir: Added.
+ * docs/qtwebkit.qdocconf:
+
2010-06-17 Mark Brand <mabrand@mabrand.nl>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index 0ce6383..1cebef7 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -599,20 +599,29 @@ void EditorClientQt::setInputMethodState(bool active)
QWebPageClient* webPageClient = m_page->d->client;
if (webPageClient) {
#if QT_VERSION >= 0x040600
- bool isPasswordField = false;
- if (!active) {
- // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag
- // for password fields. The Qt platform is responsible for determining which widget
- // will receive input method events for password fields.
- Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
- if (frame && frame->document() && frame->document()->focusedNode()) {
- if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) {
- HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
- active = isPasswordField = inputElement->isPasswordField();
- }
+ HTMLInputElement* inputElement = 0;
+ Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+ if (frame && frame->document() && frame->document()->focusedNode())
+ if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag))
+ inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
+
+ if (inputElement) {
+ if (!active) {
+ // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag
+ // for password fields. The Qt platform is responsible for determining which widget
+ // will receive input method events for password fields.
+ active = inputElement->isPasswordField();
+ webPageClient->setInputMethodHint(Qt::ImhHiddenText, active);
+ } else {
+ // Set input method hints for "number", "tel", "email", and "url" input elements.
+ webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField());
+ webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField());
+ webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField());
+ webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField());
+ webPageClient->setInputMethodHint(Qt::ImhHiddenText, inputElement->isPasswordField());
}
}
- webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField);
+
#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
// disables auto-uppercase and predictive text for mobile devices
webPageClient->setInputMethodHint(Qt::ImhNoAutoUppercase, true);
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
new file mode 100644
index 0000000..924329a
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/declarative.pro
@@ -0,0 +1,74 @@
+TARGET = qmlwebkitplugin
+TARGETPATH = QtWebKit
+
+TEMPLATE = lib
+CONFIG += qt plugin
+
+win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+
+QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
+copy2build.input = QMLDIRFILE
+CONFIG(QTDIR_build) {
+ copy2build.output = $$QT_BUILD_TREE/imports/$$TARGETPATH/qmldir
+} else {
+ copy2build.output = $$OUTPUT_DIR/imports/$$TARGETPATH/qmldir
+}
+!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS
+copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+copy2build.name = COPY ${QMAKE_FILE_IN}
+copy2build.CONFIG += no_link
+QMAKE_EXTRA_COMPILERS += copy2build
+
+TARGET = $$qtLibraryTarget($$TARGET)
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+
+wince*:LIBS += $$QMAKE_LIBS_GUI
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY = All -Tcb
+ load(armcc_warnings)
+}
+
+include(../../../WebKit.pri)
+
+QT += declarative
+
+linux-* {
+ # From Creator's src/rpath.pri:
+ # Do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
+ # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var.
+ QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+ MY_RPATH = $$join(QMAKE_RPATHDIR, ":")
+
+ QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${MY_RPATH}\'
+ QMAKE_RPATHDIR =
+} else {
+ QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+}
+
+SOURCES += qdeclarativewebview.cpp plugin.cpp
+HEADERS += qdeclarativewebview_p.h
+
+CONFIG(QTDIR_build) {
+ DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH
+} else {
+ DESTDIR = $$OUTPUT_DIR/imports/$$TARGETPATH
+}
+target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+
+qmldir.files += $$PWD/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+symbian:{
+ load(data_caging_paths)
+ include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
+
+ importFiles.sources = qmlwebkitplugin.dll qmldir
+ importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
+
+ DEPLOYMENT = importFiles
+}
+
+INSTALLS += target qmldir
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/qtscriptglobal.h b/src/3rdparty/webkit/WebKit/qt/declarative/plugin.cpp
index 29749c0..f1f165e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/qtscriptglobal.h
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/plugin.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,28 +17,27 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef qtscriptglobal_h
-#define qtscriptglobal_h
-
-#include <QtCore/qglobal.h>
-
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
-# if defined(QT_NODLL)
-# elif defined(QT_MAKEDLL) /* create a Qt DLL library */
-# if defined(QT_BUILD_JAVASCRIPT_LIB)
-# define Q_JAVASCRIPT_EXPORT Q_DECL_EXPORT
-# else
-# define Q_JAVASCRIPT_EXPORT Q_DECL_IMPORT
-# endif
-# elif defined(QT_DLL) /* use a Qt DLL library */
-# define Q_JAVASCRIPT_EXPORT
-# endif
-#endif
-
-#if defined(QT_SHARED)
-# define Q_JAVASCRIPT_EXPORT Q_DECL_EXPORT
-#else
-# define Q_JAVASCRIPT_EXPORT
-#endif
-
-#endif
+#include "qdeclarativewebview_p.h"
+
+#include <QtDeclarative/qdeclarative.h>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+
+QT_BEGIN_NAMESPACE
+
+class WebKitQmlPlugin : public QDeclarativeExtensionPlugin {
+ Q_OBJECT
+public:
+ virtual void registerTypes(const char* uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit"));
+ qmlRegisterType<QDeclarativeWebSettings>();
+ qmlRegisterType<QDeclarativeWebView>(uri, 1, 0, "WebView");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(qmlwebkitplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin));
+
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
new file mode 100644
index 0000000..a349bec
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp
@@ -0,0 +1,1022 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+#include "qdeclarativewebview_p.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QEvent>
+#include <QtCore/QFile>
+#include <QtDeclarative/QDeclarativeContext>
+#include <QtDeclarative/QDeclarativeEngine>
+#include <QtDeclarative/qdeclarative.h>
+#include <QtGui/QApplication>
+#include <QtGui/QGraphicsSceneMouseEvent>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QMouseEvent>
+#include <QtGui/QPen>
+#include "qwebelement.h"
+#include "qwebframe.h"
+#include "qwebpage.h"
+#include "qwebsettings.h"
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeWebViewPrivate {
+public:
+ QDeclarativeWebViewPrivate(QDeclarativeWebView* qq)
+ : q(qq)
+ , preferredwidth(0)
+ , preferredheight(0)
+ , progress(1.0)
+ , status(QDeclarativeWebView::Null)
+ , pending(PendingNone)
+ , newWindowComponent(0)
+ , newWindowParent(0)
+ , rendering(true)
+ {
+ }
+
+ QDeclarativeWebView* q;
+
+ QUrl url; // page url might be different if it has not loaded yet
+ GraphicsWebView* view;
+
+ int preferredwidth, preferredheight;
+ qreal progress;
+ QDeclarativeWebView::Status status;
+ QString statusText;
+ enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending;
+ QUrl pendingUrl;
+ QString pendingString;
+ QByteArray pendingData;
+ mutable QDeclarativeWebSettings settings;
+ QDeclarativeComponent* newWindowComponent;
+ QDeclarativeItem* newWindowParent;
+
+ static void windowObjectsAppend(QDeclarativeListProperty<QObject>* prop, QObject* o)
+ {
+ static_cast<QDeclarativeWebViewPrivate*>(prop->data)->windowObjects.append(o);
+ static_cast<QDeclarativeWebViewPrivate*>(prop->data)->updateWindowObjects();
+ }
+
+ void updateWindowObjects();
+ QObjectList windowObjects;
+
+ bool rendering;
+};
+
+GraphicsWebView::GraphicsWebView(QDeclarativeWebView* parent)
+ : QGraphicsWebView(parent)
+ , parent(parent)
+ , pressTime(400)
+{
+}
+
+void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event)
+{
+ setFocus();
+ pressPoint = event->pos();
+ if (pressTime) {
+ pressTimer.start(pressTime, this);
+ parent->setKeepMouseGrab(false);
+ } else {
+ grabMouse();
+ parent->setKeepMouseGrab(true);
+ }
+ QGraphicsWebView::mousePressEvent(event);
+}
+
+void GraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
+{
+ QGraphicsWebView::mouseReleaseEvent(event);
+ pressTimer.stop();
+ parent->setKeepMouseGrab(false);
+ ungrabMouse();
+}
+
+void GraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
+{
+ QMouseEvent* me = new QMouseEvent(QEvent::MouseButtonDblClick, (event->pos() / parent->contentsScale()).toPoint(), event->button(), event->buttons(), 0);
+ emit doubleClick(event->pos().x(), event->pos().y());
+ delete me;
+}
+
+void GraphicsWebView::timerEvent(QTimerEvent* event)
+{
+ if (event->timerId() == pressTimer.timerId()) {
+ pressTimer.stop();
+ grabMouse();
+ parent->setKeepMouseGrab(true);
+ }
+}
+
+void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
+{
+ if (pressTimer.isActive()) {
+ if ((event->pos() - pressPoint).manhattanLength() > QApplication::startDragDistance())
+ pressTimer.stop();
+ }
+ if (parent->keepMouseGrab())
+ QGraphicsWebView::mouseMoveEvent(event);
+}
+
+/*!
+ \qmlclass WebView QDeclarativeWebView
+ \since 4.7
+ \brief The WebView item allows you to add web content to a canvas.
+ \inherits Item
+
+ A WebView renders web content based on a URL.
+
+ This type is made available by importing the \c QtWebKit module:
+
+ \bold{import QtWebKit 1.0}
+
+ If the width and height of the item is not set, they will
+ dynamically adjust to a size appropriate for the content.
+ This width may be large for typical online web pages.
+
+ If the width or height is explictly set, the rendered website
+ will be clipped, not scaled, to fit into the set dimensions.
+
+ If the preferredWidth is set, the width will be this amount or larger,
+ usually laying out the web content to fit the preferredWidth.
+
+ \qml
+ import QtWebKit 1.0
+
+ WebView {
+ url: "http://www.nokia.com"
+ preferredWidth: 490
+ preferredHeight: 400
+ scale: 0.5
+ smooth: false
+ smoothCache: true
+ }
+ \endqml
+
+ \image webview.png
+
+ The item includes no scrolling, scaling,
+ toolbars, etc., those must be implemented around WebView. See the WebBrowser example
+ for a demonstration of this.
+
+ When this item has keyboard focus, all keyboard input will be sent directly to the
+ web page within.
+*/
+
+/*!
+ \internal
+ \class QDeclarativeWebView
+ \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView.
+
+ A WebView renders web content base on a URL.
+
+ \image webview.png
+
+ The item includes no scrolling, scaling,
+ toolbars, etc., those must be implemented around WebView. See the WebBrowser example
+ for a demonstration of this.
+
+ A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView.
+*/
+
+QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) : QDeclarativeItem(parent)
+{
+ init();
+}
+
+QDeclarativeWebView::~QDeclarativeWebView()
+{
+ delete d;
+}
+
+void QDeclarativeWebView::init()
+{
+ d = new QDeclarativeWebViewPrivate(this);
+
+ QWebSettings::enablePersistentStorage();
+
+ setAcceptedMouseButtons(Qt::LeftButton);
+ setFlag(QGraphicsItem::ItemHasNoContents, true);
+ setClip(true);
+
+ d->view = new GraphicsWebView(this);
+ d->view->setResizesToContents(true);
+ QWebPage* wp = new QDeclarativeWebPage(this);
+ setPage(wp);
+ connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize()));
+ connect(d->view, SIGNAL(doubleClick(int, int)), this, SIGNAL(doubleClick(int, int)));
+ connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged()));
+}
+
+void QDeclarativeWebView::componentComplete()
+{
+ QDeclarativeItem::componentComplete();
+ page()->setNetworkAccessManager(qmlEngine(this)->networkAccessManager());
+
+ switch (d->pending) {
+ case QDeclarativeWebViewPrivate::PendingUrl:
+ setUrl(d->pendingUrl);
+ break;
+ case QDeclarativeWebViewPrivate::PendingHtml:
+ setHtml(d->pendingString, d->pendingUrl);
+ break;
+ case QDeclarativeWebViewPrivate::PendingContent:
+ setContent(d->pendingData, d->pendingString, d->pendingUrl);
+ break;
+ default:
+ break;
+ }
+ d->pending = QDeclarativeWebViewPrivate::PendingNone;
+ d->updateWindowObjects();
+}
+
+QDeclarativeWebView::Status QDeclarativeWebView::status() const
+{
+ return d->status;
+}
+
+
+/*!
+ \qmlproperty real WebView::progress
+ This property holds the progress of loading the current URL, from 0 to 1.
+
+ If you just want to know when progress gets to 1, use
+ WebView::onLoadFinished() or WebView::onLoadFailed() instead.
+*/
+qreal QDeclarativeWebView::progress() const
+{
+ return d->progress;
+}
+
+void QDeclarativeWebView::doLoadStarted()
+{
+ if (!d->url.isEmpty()) {
+ d->status = Loading;
+ emit statusChanged(d->status);
+ }
+ emit loadStarted();
+}
+
+void QDeclarativeWebView::doLoadProgress(int p)
+{
+ if (d->progress == p / 100.0)
+ return;
+ d->progress = p / 100.0;
+ emit progressChanged();
+}
+
+void QDeclarativeWebView::pageUrlChanged()
+{
+ updateContentsSize();
+
+ if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank")))
+ || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty()))
+ {
+ d->url = page()->mainFrame()->url();
+ if (d->url == QUrl(QLatin1String("about:blank")))
+ d->url = QUrl();
+ emit urlChanged();
+ }
+}
+
+void QDeclarativeWebView::doLoadFinished(bool ok)
+{
+ if (ok) {
+ d->status = d->url.isEmpty() ? Null : Ready;
+ emit loadFinished();
+ } else {
+ d->status = Error;
+ emit loadFailed();
+ }
+ emit statusChanged(d->status);
+}
+
+/*!
+ \qmlproperty url WebView::url
+ This property holds the URL to the page displayed in this item. It can be set,
+ but also can change spontaneously (eg. because of network redirection).
+
+ If the url is empty, the page is blank.
+
+ The url is always absolute (QML will resolve relative URL strings in the context
+ of the containing QML document).
+*/
+QUrl QDeclarativeWebView::url() const
+{
+ return d->url;
+}
+
+void QDeclarativeWebView::setUrl(const QUrl& url)
+{
+ if (url == d->url)
+ return;
+
+ if (isComponentComplete()) {
+ d->url = url;
+ updateContentsSize();
+ QUrl seturl = url;
+ if (seturl.isEmpty())
+ seturl = QUrl(QLatin1String("about:blank"));
+
+ Q_ASSERT(!seturl.isRelative());
+
+ page()->mainFrame()->load(seturl);
+
+ emit urlChanged();
+ } else {
+ d->pending = d->PendingUrl;
+ d->pendingUrl = url;
+ }
+}
+
+/*!
+ \qmlproperty int WebView::preferredWidth
+ This property holds the ideal width for displaying the current URL.
+*/
+int QDeclarativeWebView::preferredWidth() const
+{
+ return d->preferredwidth;
+}
+
+void QDeclarativeWebView::setPreferredWidth(int width)
+{
+ if (d->preferredwidth == width)
+ return;
+ d->preferredwidth = width;
+ updateContentsSize();
+ emit preferredWidthChanged();
+}
+
+/*!
+ \qmlproperty int WebView::preferredHeight
+ This property holds the ideal height for displaying the current URL.
+ This only affects the area zoomed by heuristicZoom().
+*/
+int QDeclarativeWebView::preferredHeight() const
+{
+ return d->preferredheight;
+}
+
+void QDeclarativeWebView::setPreferredHeight(int height)
+{
+ if (d->preferredheight == height)
+ return;
+ d->preferredheight = height;
+ updateContentsSize();
+ emit preferredHeightChanged();
+}
+
+/*!
+ \qmlmethod bool WebView::evaluateJavaScript(string)
+
+ Evaluates the \a scriptSource JavaScript inside the context of the
+ main web frame, and returns the result of the last executed statement.
+
+ Note that this JavaScript does \e not have any access to QML objects
+ except as made available as windowObjects.
+*/
+QVariant QDeclarativeWebView::evaluateJavaScript(const QString& scriptSource)
+{
+ return this->page()->mainFrame()->evaluateJavaScript(scriptSource);
+}
+
+void QDeclarativeWebView::updateDeclarativeWebViewSize()
+{
+ QSizeF size = d->view->geometry().size() * contentsScale();
+ setImplicitWidth(size.width());
+ setImplicitHeight(size.height());
+}
+
+void QDeclarativeWebView::initialLayout()
+{
+ // nothing useful to do at this point
+}
+
+void QDeclarativeWebView::updateContentsSize()
+{
+ if (page()) {
+ page()->setPreferredContentsSize(QSize(
+ d->preferredwidth>0 ? d->preferredwidth : width(),
+ d->preferredheight>0 ? d->preferredheight : height()));
+ }
+}
+
+void QDeclarativeWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
+{
+ QWebPage* webPage = page();
+ if (newGeometry.size() != oldGeometry.size() && webPage) {
+ QSize contentSize = webPage->preferredContentsSize();
+ if (widthValid())
+ contentSize.setWidth(width());
+ if (heightValid())
+ contentSize.setHeight(height());
+ if (contentSize != webPage->preferredContentsSize())
+ webPage->setPreferredContentsSize(contentSize);
+ }
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+}
+
+/*!
+ \qmlproperty list<object> WebView::javaScriptWindowObjects
+
+ A list of QML objects to expose to the web page.
+
+ Each object will be added as a property of the web frame's window object. The
+ property name is controlled by the value of \c WebView.windowObjectName
+ attached property.
+
+ Exposing QML objects to a web page allows JavaScript executing in the web
+ page itself to communicate with QML, by reading and writing properties and
+ by calling methods of the exposed QML objects.
+
+ This example shows how to call into a QML method using a window object.
+
+ \qml
+ WebView {
+ javaScriptWindowObjects: QtObject {
+ WebView.windowObjectName: "qml"
+
+ function qmlCall() {
+ console.log("This call is in QML!");
+ }
+ }
+
+ html: "<script>console.log(\"This is in WebKit!\"); window.qml.qmlCall();</script>"
+ }
+ \endqml
+
+ The output of the example will be:
+ \code
+ This is in WebKit!
+ This call is in QML!
+ \endcode
+
+ If Javascript is not enabled for the page, then this property does nothing.
+*/
+QDeclarativeListProperty<QObject> QDeclarativeWebView::javaScriptWindowObjects()
+{
+ return QDeclarativeListProperty<QObject>(this, d, &QDeclarativeWebViewPrivate::windowObjectsAppend);
+}
+
+QDeclarativeWebViewAttached* QDeclarativeWebView::qmlAttachedProperties(QObject* o)
+{
+ return new QDeclarativeWebViewAttached(o);
+}
+
+void QDeclarativeWebViewPrivate::updateWindowObjects()
+{
+ if (!q->isComponentCompletePublic() || !q->page())
+ return;
+
+ for (int i = 0; i < windowObjects.count(); ++i) {
+ QObject* object = windowObjects.at(i);
+ QDeclarativeWebViewAttached* attached = static_cast<QDeclarativeWebViewAttached *>(qmlAttachedPropertiesObject<QDeclarativeWebView>(object));
+ if (attached && !attached->windowObjectName().isEmpty())
+ q->page()->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object);
+ }
+}
+
+bool QDeclarativeWebView::renderingEnabled() const
+{
+ return d->rendering;
+}
+
+void QDeclarativeWebView::setRenderingEnabled(bool enabled)
+{
+ if (d->rendering == enabled)
+ return;
+ d->rendering = enabled;
+ emit renderingEnabledChanged();
+ d->view->setTiledBackingStoreFrozen(!enabled);
+}
+
+/*!
+ \qmlsignal WebView::onDoubleClick(clickx, clicky)
+
+ The WebView does not pass double-click events to the web engine, but rather
+ emits this signals.
+*/
+
+/*!
+ \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom)
+
+ Finds a zoom that:
+ \list
+ \i shows a whole item
+ \i includes (\a clickX, \a clickY)
+ \i fits into the preferredWidth and preferredHeight
+ \i zooms by no more than \a maxZoom
+ \i is more than 10% above the current zoom
+ \endlist
+
+ If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise,
+ no signal is emitted and returns false.
+*/
+bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxZoom)
+{
+ if (contentsScale() >= maxZoom / scale())
+ return false;
+ qreal ozf = contentsScale();
+ QRect showArea = elementAreaAt(clickX, clickY, d->preferredwidth / maxZoom, d->preferredheight / maxZoom);
+ qreal z = qMin(qreal(d->preferredwidth) / showArea.width(), qreal(d->preferredheight) / showArea.height());
+ if (z > maxZoom / scale())
+ z = maxZoom / scale();
+ if (z / ozf > 1.2) {
+ QRectF r(showArea.left() * z, showArea.top() * z, showArea.width() * z, showArea.height() * z);
+ emit zoomTo(z, r.x() + r.width() / 2, r.y() + r.height() / 2);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ \qmlproperty int WebView::pressGrabTime
+
+ The number of milliseconds the user must press before the WebView
+ starts passing move events through to the web engine (rather than
+ letting other QML elements such as a Flickable take them).
+
+ Defaults to 400ms. Set to 0 to always grab and pass move events to
+ the web engine.
+*/
+int QDeclarativeWebView::pressGrabTime() const
+{
+ return d->view->pressTime;
+}
+
+void QDeclarativeWebView::setPressGrabTime(int millis)
+{
+ if (d->view->pressTime == millis)
+ return;
+ d->view->pressTime = millis;
+ emit pressGrabTimeChanged();
+}
+
+#ifndef QT_NO_ACTION
+/*!
+ \qmlproperty action WebView::back
+ This property holds the action for causing the previous URL in the history to be displayed.
+*/
+QAction* QDeclarativeWebView::backAction() const
+{
+ return page()->action(QWebPage::Back);
+}
+
+/*!
+ \qmlproperty action WebView::forward
+ This property holds the action for causing the next URL in the history to be displayed.
+*/
+QAction* QDeclarativeWebView::forwardAction() const
+{
+ return page()->action(QWebPage::Forward);
+}
+
+/*!
+ \qmlproperty action WebView::reload
+ This property holds the action for reloading with the current URL
+*/
+QAction* QDeclarativeWebView::reloadAction() const
+{
+ return page()->action(QWebPage::Reload);
+}
+
+/*!
+ \qmlproperty action WebView::stop
+ This property holds the action for stopping loading with the current URL
+*/
+QAction* QDeclarativeWebView::stopAction() const
+{
+ return page()->action(QWebPage::Stop);
+}
+#endif // QT_NO_ACTION
+
+/*!
+ \qmlproperty real WebView::title
+ This property holds the title of the web page currently viewed
+
+ By default, this property contains an empty string.
+*/
+QString QDeclarativeWebView::title() const
+{
+ return page()->mainFrame()->title();
+}
+
+/*!
+ \qmlproperty pixmap WebView::icon
+ This property holds the icon associated with the web page currently viewed
+*/
+QPixmap QDeclarativeWebView::icon() const
+{
+ return page()->mainFrame()->icon().pixmap(QSize(256, 256));
+}
+
+/*!
+ \qmlproperty string WebView::statusText
+
+ This property is the current status suggested by the current web page. In a web browser,
+ such status is often shown in some kind of status bar.
+*/
+void QDeclarativeWebView::setStatusText(const QString& text)
+{
+ d->statusText = text;
+ emit statusTextChanged();
+}
+
+void QDeclarativeWebView::windowObjectCleared()
+{
+ d->updateWindowObjects();
+}
+
+QString QDeclarativeWebView::statusText() const
+{
+ return d->statusText;
+}
+
+QWebPage* QDeclarativeWebView::page() const
+{
+ return d->view->page();
+}
+
+// The QObject interface to settings().
+/*!
+ \qmlproperty string WebView::settings.standardFontFamily
+ \qmlproperty string WebView::settings.fixedFontFamily
+ \qmlproperty string WebView::settings.serifFontFamily
+ \qmlproperty string WebView::settings.sansSerifFontFamily
+ \qmlproperty string WebView::settings.cursiveFontFamily
+ \qmlproperty string WebView::settings.fantasyFontFamily
+
+ \qmlproperty int WebView::settings.minimumFontSize
+ \qmlproperty int WebView::settings.minimumLogicalFontSize
+ \qmlproperty int WebView::settings.defaultFontSize
+ \qmlproperty int WebView::settings.defaultFixedFontSize
+
+ \qmlproperty bool WebView::settings.autoLoadImages
+ \qmlproperty bool WebView::settings.javascriptEnabled
+ \qmlproperty bool WebView::settings.javaEnabled
+ \qmlproperty bool WebView::settings.pluginsEnabled
+ \qmlproperty bool WebView::settings.privateBrowsingEnabled
+ \qmlproperty bool WebView::settings.javascriptCanOpenWindows
+ \qmlproperty bool WebView::settings.javascriptCanAccessClipboard
+ \qmlproperty bool WebView::settings.developerExtrasEnabled
+ \qmlproperty bool WebView::settings.linksIncludedInFocusChain
+ \qmlproperty bool WebView::settings.zoomTextOnly
+ \qmlproperty bool WebView::settings.printElementBackgrounds
+ \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled
+ \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled
+ \qmlproperty bool WebView::settings.localStorageDatabaseEnabled
+ \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls
+
+ These properties give access to the settings controlling the web view.
+
+ See QWebSettings for details of these properties.
+
+ \qml
+ WebView {
+ settings.pluginsEnabled: true
+ settings.standardFontFamily: "Arial"
+ ...
+ }
+ \endqml
+*/
+QDeclarativeWebSettings* QDeclarativeWebView::settingsObject() const
+{
+ d->settings.s = page()->settings();
+ return &d->settings;
+}
+
+void QDeclarativeWebView::setPage(QWebPage* page)
+{
+ if (d->view->page() == page)
+ return;
+
+ d->view->setPage(page);
+ updateContentsSize();
+ page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
+ page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ connect(page->mainFrame(), SIGNAL(urlChanged(QUrl)), this, SLOT(pageUrlChanged()));
+ connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
+ connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged()));
+ connect(page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged()));
+ connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout()));
+ connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize)));
+
+ connect(page, SIGNAL(loadStarted()), this, SLOT(doLoadStarted()));
+ connect(page, SIGNAL(loadProgress(int)), this, SLOT(doLoadProgress(int)));
+ connect(page, SIGNAL(loadFinished(bool)), this, SLOT(doLoadFinished(bool)));
+ connect(page, SIGNAL(statusBarMessage(QString)), this, SLOT(setStatusText(QString)));
+
+ connect(page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(windowObjectCleared()));
+
+ page->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
+
+}
+
+/*!
+ \qmlsignal WebView::onLoadStarted()
+
+ This handler is called when the web engine begins loading
+ a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed()
+ will be emitted.
+*/
+
+/*!
+ \qmlsignal WebView::onLoadFinished()
+
+ This handler is called when the web engine \e successfully
+ finishes loading a page, including any component content
+ (WebView::onLoadFailed() will be emitted otherwise).
+
+ \sa progress
+*/
+
+/*!
+ \qmlsignal WebView::onLoadFailed()
+
+ This handler is called when the web engine fails loading
+ a page or any component content
+ (WebView::onLoadFinished() will be emitted on success).
+*/
+
+void QDeclarativeWebView::load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation, const QByteArray& body)
+{
+ page()->mainFrame()->load(request, operation, body);
+}
+
+QString QDeclarativeWebView::html() const
+{
+ return page()->mainFrame()->toHtml();
+}
+
+/*!
+ \qmlproperty string WebView::html
+ This property holds HTML text set directly
+
+ The html property can be set as a string.
+
+ \qml
+ WebView {
+ html: "<p>This is <b>HTML</b>."
+ }
+ \endqml
+*/
+void QDeclarativeWebView::setHtml(const QString& html, const QUrl& baseUrl)
+{
+ updateContentsSize();
+ if (isComponentComplete())
+ page()->mainFrame()->setHtml(html, baseUrl);
+ else {
+ d->pending = d->PendingHtml;
+ d->pendingUrl = baseUrl;
+ d->pendingString = html;
+ }
+ emit htmlChanged();
+}
+
+void QDeclarativeWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl)
+{
+ updateContentsSize();
+
+ if (isComponentComplete())
+ page()->mainFrame()->setContent(data, mimeType, qmlContext(this)->resolvedUrl(baseUrl));
+ else {
+ d->pending = d->PendingContent;
+ d->pendingUrl = baseUrl;
+ d->pendingString = mimeType;
+ d->pendingData = data;
+ }
+}
+
+QWebHistory* QDeclarativeWebView::history() const
+{
+ return page()->history();
+}
+
+QWebSettings* QDeclarativeWebView::settings() const
+{
+ return page()->settings();
+}
+
+QDeclarativeWebView* QDeclarativeWebView::createWindow(QWebPage::WebWindowType type)
+{
+ switch (type) {
+ case QWebPage::WebBrowserWindow: {
+ if (!d->newWindowComponent && d->newWindowParent)
+ qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored");
+ else if (d->newWindowComponent && !d->newWindowParent)
+ qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored");
+ else if (d->newWindowComponent && d->newWindowParent) {
+ QDeclarativeWebView* webview = 0;
+ QDeclarativeContext* windowContext = new QDeclarativeContext(qmlContext(this));
+
+ QObject* newObject = d->newWindowComponent->create(windowContext);
+ if (newObject) {
+ windowContext->setParent(newObject);
+ QDeclarativeItem* item = qobject_cast<QDeclarativeItem *>(newObject);
+ if (!item)
+ delete newObject;
+ else {
+ webview = item->findChild<QDeclarativeWebView*>();
+ if (!webview)
+ delete item;
+ else {
+ newObject->setParent(d->newWindowParent);
+ static_cast<QGraphicsObject*>(item)->setParentItem(d->newWindowParent);
+ }
+ }
+ } else
+ delete windowContext;
+
+ return webview;
+ }
+ }
+ break;
+ case QWebPage::WebModalDialog: {
+ // Not supported
+ }
+ }
+ return 0;
+}
+
+/*!
+ \qmlproperty component WebView::newWindowComponent
+
+ This property holds the component to use for new windows.
+ The component must have a WebView somewhere in its structure.
+
+ When the web engine requests a new window, it will be an instance of
+ this component.
+
+ The parent of the new window is set by newWindowParent. It must be set.
+*/
+QDeclarativeComponent* QDeclarativeWebView::newWindowComponent() const
+{
+ return d->newWindowComponent;
+}
+
+void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent* newWindow)
+{
+ if (newWindow == d->newWindowComponent)
+ return;
+ d->newWindowComponent = newWindow;
+ emit newWindowComponentChanged();
+}
+
+
+/*!
+ \qmlproperty item WebView::newWindowParent
+
+ The parent item for new windows.
+
+ \sa newWindowComponent
+*/
+QDeclarativeItem* QDeclarativeWebView::newWindowParent() const
+{
+ return d->newWindowParent;
+}
+
+void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem* parent)
+{
+ if (parent == d->newWindowParent)
+ return;
+ if (d->newWindowParent && parent) {
+ QList<QGraphicsItem *> children = d->newWindowParent->childItems();
+ for (int i = 0; i < children.count(); ++i)
+ children.at(i)->setParentItem(parent);
+ }
+ d->newWindowParent = parent;
+ emit newWindowParentChanged();
+}
+
+QSize QDeclarativeWebView::contentsSize() const
+{
+ return page()->mainFrame()->contentsSize() * contentsScale();
+}
+
+qreal QDeclarativeWebView::contentsScale() const
+{
+ return d->view->scale();
+}
+
+void QDeclarativeWebView::setContentsScale(qreal scale)
+{
+ if (scale == d->view->scale())
+ return;
+ d->view->setScale(scale);
+ updateDeclarativeWebViewSize();
+ emit contentsScaleChanged();
+}
+
+/*!
+ Returns the area of the largest element at position (\a x,\a y) that is no larger
+ than \a maxWidth by \a maxHeight pixels.
+
+ May return an area larger in the case when no smaller element is at the position.
+*/
+QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxWidth, int maxHeight) const
+{
+ QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x, y));
+ QRect hitRect = hit.boundingRect();
+ QWebElement element = hit.enclosingBlockElement();
+ if (maxWidth <= 0)
+ maxWidth = INT_MAX;
+ if (maxHeight <= 0)
+ maxHeight = INT_MAX;
+ while (!element.parent().isNull() && element.geometry().width() <= maxWidth && element.geometry().height() <= maxHeight) {
+ hitRect = element.geometry();
+ element = element.parent();
+ }
+ return hitRect;
+}
+
+/*!
+ \internal
+ \class QDeclarativeWebPage
+ \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins.
+
+ \sa QDeclarativeWebView
+*/
+QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView* parent) :
+ QWebPage(parent)
+{
+}
+
+QDeclarativeWebPage::~QDeclarativeWebPage()
+{
+}
+
+QString QDeclarativeWebPage::chooseFile(QWebFrame* originatingFrame, const QString& oldFile)
+{
+ // Not supported (it's modal)
+ Q_UNUSED(originatingFrame)
+ Q_UNUSED(oldFile)
+ return oldFile;
+}
+
+/*!
+ \qmlsignal WebView::onAlert(message)
+
+ The handler is called when the web engine sends a JavaScript alert. The \a message is the text
+ to be displayed in the alert to the user.
+*/
+
+
+void QDeclarativeWebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString& msg)
+{
+ Q_UNUSED(originatingFrame)
+ emit viewItem()->alert(msg);
+}
+
+bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString& msg)
+{
+ // Not supported (it's modal)
+ Q_UNUSED(originatingFrame)
+ Q_UNUSED(msg)
+ return false;
+}
+
+bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString& msg, const QString& defaultValue, QString* result)
+{
+ // Not supported (it's modal)
+ Q_UNUSED(originatingFrame)
+ Q_UNUSED(msg)
+ Q_UNUSED(defaultValue)
+ Q_UNUSED(result)
+ return false;
+}
+
+
+QDeclarativeWebView* QDeclarativeWebPage::viewItem()
+{
+ return static_cast<QDeclarativeWebView*>(parent());
+}
+
+QWebPage* QDeclarativeWebPage::createWindow(WebWindowType type)
+{
+ QDeclarativeWebView* newView = viewItem()->createWindow(type);
+ if (newView)
+ return newView->page();
+ return 0;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h
new file mode 100644
index 0000000..b2055bf
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h
@@ -0,0 +1,371 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+#ifndef qdeclarativewebview_p_h
+#define qdeclarativewebview_p_h
+
+#include <QtCore/QBasicTimer>
+#include <QtCore/QUrl>
+#include <QtDeclarative/QDeclarativeItem>
+#include <QtGui/QAction>
+#include <QtNetwork/QNetworkAccessManager>
+#include "qgraphicswebview.h"
+#include "qwebpage.h"
+
+
+QT_BEGIN_HEADER
+
+class QWebHistory;
+class QWebSettings;
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+class QDeclarativeWebSettings;
+class QDeclarativeWebViewPrivate;
+class QNetworkRequest;
+class QDeclarativeWebView;
+class QDeclarativeWebViewPrivate;
+
+class QDeclarativeWebPage : public QWebPage {
+ Q_OBJECT
+public:
+ explicit QDeclarativeWebPage(QDeclarativeWebView *parent);
+ ~QDeclarativeWebPage();
+protected:
+ QWebPage *createWindow(WebWindowType type);
+ QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile);
+ void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg);
+ bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg);
+ bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result);
+
+private:
+ QDeclarativeWebView *viewItem();
+};
+
+class GraphicsWebView : public QGraphicsWebView {
+ Q_OBJECT
+public:
+ GraphicsWebView(QDeclarativeWebView* parent = 0);
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent* event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ void timerEvent(QTimerEvent* event);
+Q_SIGNALS:
+ void doubleClick(int clickX, int clickY);
+private:
+ QDeclarativeWebView *parent;
+ QPointF pressPoint;
+ QBasicTimer pressTimer;
+ int pressTime; // milliseconds before the touch event becomes a "tap and hold"
+ friend class QDeclarativeWebView;
+};
+
+class QDeclarativeWebViewAttached;
+
+// TODO: browser plugins
+
+class QDeclarativeWebView : public QDeclarativeItem {
+ Q_OBJECT
+
+ Q_ENUMS(Status SelectionMode)
+
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged)
+ Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged)
+
+ Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
+
+ Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged)
+
+ Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged)
+ Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged)
+ Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
+ Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+
+#ifndef QT_NO_ACTION
+ Q_PROPERTY(QAction* reload READ reloadAction CONSTANT)
+ Q_PROPERTY(QAction* back READ backAction CONSTANT)
+ Q_PROPERTY(QAction* forward READ forwardAction CONSTANT)
+ Q_PROPERTY(QAction* stop READ stopAction CONSTANT)
+#endif
+
+ Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT)
+
+ Q_PROPERTY(QDeclarativeListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
+
+ Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged)
+ Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged)
+
+ Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged)
+
+ Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged)
+ Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
+
+public:
+ QDeclarativeWebView(QDeclarativeItem *parent = 0);
+ ~QDeclarativeWebView();
+
+ QUrl url() const;
+ void setUrl(const QUrl &);
+
+ QString title() const;
+
+ QPixmap icon() const;
+
+ Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom);
+ QRect elementAreaAt(int x, int y, int minwidth, int minheight) const;
+
+ int pressGrabTime() const;
+ void setPressGrabTime(int);
+
+ int preferredWidth() const;
+ void setPreferredWidth(int);
+ int preferredHeight() const;
+ void setPreferredHeight(int);
+
+ enum Status { Null, Ready, Loading, Error };
+ Status status() const;
+ qreal progress() const;
+ QString statusText() const;
+
+#ifndef QT_NO_ACTION
+ QAction *reloadAction() const;
+ QAction *backAction() const;
+ QAction *forwardAction() const;
+ QAction *stopAction() const;
+#endif
+
+ QWebPage *page() const;
+ void setPage(QWebPage *page);
+
+ void load(const QNetworkRequest &request,
+ QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
+ const QByteArray &body = QByteArray());
+
+ QString html() const;
+
+ void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
+ void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl());
+
+ QWebHistory* history() const;
+ QWebSettings* settings() const;
+ QDeclarativeWebSettings *settingsObject() const;
+
+ bool renderingEnabled() const;
+ void setRenderingEnabled(bool);
+
+ QDeclarativeListProperty<QObject> javaScriptWindowObjects();
+
+ static QDeclarativeWebViewAttached* qmlAttachedProperties(QObject*);
+
+ QDeclarativeComponent *newWindowComponent() const;
+ void setNewWindowComponent(QDeclarativeComponent *newWindow);
+ QDeclarativeItem* newWindowParent() const;
+ void setNewWindowParent(QDeclarativeItem* newWindow);
+
+ bool isComponentCompletePublic() const { return isComponentComplete(); }
+
+ QSize contentsSize() const;
+
+ void setContentsScale(qreal scale);
+ qreal contentsScale() const;
+
+Q_SIGNALS:
+ void preferredWidthChanged();
+ void preferredHeightChanged();
+ void urlChanged();
+ void progressChanged();
+ void statusChanged(Status);
+ void titleChanged(const QString&);
+ void iconChanged();
+ void statusTextChanged();
+ void htmlChanged();
+ void pressGrabTimeChanged();
+ void newWindowComponentChanged();
+ void newWindowParentChanged();
+ void renderingEnabledChanged();
+ void contentsSizeChanged(const QSize&);
+ void contentsScaleChanged();
+
+ void loadStarted();
+ void loadFinished();
+ void loadFailed();
+
+ void doubleClick(int clickX, int clickY);
+
+ void zoomTo(qreal zoom, int centerX, int centerY);
+
+ void alert(const QString& message);
+
+public Q_SLOTS:
+ QVariant evaluateJavaScript(const QString&);
+
+private Q_SLOTS:
+ void doLoadStarted();
+ void doLoadProgress(int p);
+ void doLoadFinished(bool ok);
+ void setStatusText(const QString&);
+ void windowObjectCleared();
+ void pageUrlChanged();
+ void initialLayout();
+
+ void updateDeclarativeWebViewSize();
+
+ virtual void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry);
+ QDeclarativeWebView* createWindow(QWebPage::WebWindowType type);
+
+private:
+ void updateContentsSize();
+ void init();
+ virtual void componentComplete();
+ Q_DISABLE_COPY(QDeclarativeWebView)
+ QDeclarativeWebViewPrivate* d;
+ QMouseEvent* sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent*);
+ QMouseEvent* sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent*);
+ friend class QDeclarativeWebPage;
+};
+
+class QDeclarativeWebViewAttached : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName)
+public:
+ QDeclarativeWebViewAttached(QObject* parent)
+ : QObject(parent)
+ {
+ }
+
+ QString windowObjectName() const
+ {
+ return m_windowObjectName;
+ }
+
+ void setWindowObjectName(const QString &n)
+ {
+ m_windowObjectName = n;
+ }
+
+private:
+ QString m_windowObjectName;
+};
+
+class QDeclarativeWebSettings : public QObject {
+ Q_OBJECT
+
+ Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily)
+ Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily)
+ Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily)
+ Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily)
+ Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily)
+ Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily)
+
+ Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize)
+ Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize)
+ Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize)
+ Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize)
+
+ Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages)
+ Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled)
+ Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled)
+ Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled)
+ Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled)
+ Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows)
+ Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard)
+ Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled)
+ Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain)
+ Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly)
+ Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds)
+ Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled)
+ Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled)
+ Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled)
+ Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls)
+
+public:
+ QDeclarativeWebSettings() {}
+
+ QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); }
+ void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont, f); }
+ QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); }
+ void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont, f); }
+ QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); }
+ void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont, f); }
+ QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); }
+ void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont, f); }
+ QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); }
+ void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont, f); }
+ QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); }
+ void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont, f); }
+
+ int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); }
+ void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize, size); }
+ int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); }
+ void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize, size); }
+ int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); }
+ void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize, size); }
+ int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); }
+ void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize, size); }
+
+ bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); }
+ void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); }
+ bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); }
+ void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); }
+ bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); }
+ void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); }
+ bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); }
+ void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); }
+ bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); }
+ void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); }
+ bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); }
+ void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); }
+ bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); }
+ void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); }
+ bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); }
+ void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); }
+ bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); }
+ void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); }
+ bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); }
+ void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); }
+ bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); }
+ void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); }
+ bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); }
+ void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); }
+ bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); }
+ void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); }
+ bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); }
+ void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); }
+ bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); }
+ void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); }
+
+ QWebSettings *s;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeWebView)
+QML_DECLARE_TYPE(QDeclarativeWebSettings)
+QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES)
+
+QT_END_HEADER
+
+#endif
diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qmldir b/src/3rdparty/webkit/WebKit/qt/declarative/qmldir
new file mode 100644
index 0000000..dcfdd06
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/declarative/qmldir
@@ -0,0 +1 @@
+plugin qmlwebkitplugin
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf
index 292c124..5f877c2 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdocconf
@@ -3,8 +3,8 @@
project = qtwebkit
description = "Qt WebKit API Documentation"
-headerdirs = $SRCDIR/WebKit/qt/Api
-sourcedirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/docs $SRCDIR/JavaScriptCore/qt/api
+headerdirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/declarative
+sourcedirs = $SRCDIR/WebKit/qt/Api $SRCDIR/WebKit/qt/docs $SRCDIR/JavaScriptCore/qt/api $SRCDIR/WebKit/qt/declarative
outputdir = $OUTPUT_DIR/doc/html
outputformats = HTML
sources.fileextensions = "*.cpp *.doc *.qdoc *.h"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html
new file mode 100644
index 0000000..18ab314
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/resources/input_types.html
@@ -0,0 +1,8 @@
+<html><body>
+<input type='text' maxlength='20' style='position: absolute; left: 10px; top: 0px; height: 50px; width: 100px;'/><br>
+<input type='password' style='position: absolute; left: 10px; top: 50px; height: 50px; width: 100px;'/><br>
+<input type='tel' style='position: absolute; left: 10px; top: 100px; height: 50px; width: 100px;'/><br>
+<input type='number' style='position: absolute; left: 10px; top: 150px; height: 50px; width: 100px;'/><br>
+<input type='email' style='position: absolute; left: 10px; top: 200px; height: 50px; width: 100px;'/><br>
+<input type='url' style='position: absolute; left: 10px; top: 250px; height: 50px; width: 100px;'/><br>"
+</body></html> \ No newline at end of file
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index ebe847d..e06524d 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -19,6 +19,7 @@
#include "../util.h"
#include <QtTest/QtTest>
+#include <QGraphicsSceneMouseEvent>
#include <QGraphicsView>
#include <qgraphicswebview.h>
#include <qwebpage.h>
@@ -32,6 +33,7 @@ private slots:
void qgraphicswebview();
void crashOnViewlessWebPages();
void microFocusCoordinates();
+ void focusInputTypes();
};
void tst_QGraphicsWebView::qgraphicswebview()
@@ -75,6 +77,29 @@ private slots:
}
};
+class GraphicsWebView : public QGraphicsWebView
+{
+ Q_OBJECT
+
+public:
+ GraphicsWebView(QGraphicsItem* parent = 0): QGraphicsWebView(parent)
+ {
+ }
+
+ void fireMouseClick(QPointF point) {
+ QGraphicsSceneMouseEvent presEv(QEvent::GraphicsSceneMousePress);
+ presEv.setPos(point);
+ presEv.setButton(Qt::LeftButton);
+ presEv.setButtons(Qt::LeftButton);
+ QGraphicsSceneMouseEvent relEv(QEvent::GraphicsSceneMouseRelease);
+ relEv.setPos(point);
+ relEv.setButton(Qt::LeftButton);
+ relEv.setButtons(Qt::LeftButton);
+ QGraphicsWebView::sceneEvent(&presEv);
+ QGraphicsWebView::sceneEvent(&relEv);
+ }
+};
+
void tst_QGraphicsWebView::crashOnViewlessWebPages()
{
QGraphicsScene scene;
@@ -140,6 +165,57 @@ void tst_QGraphicsWebView::microFocusCoordinates()
delete view;
}
+void tst_QGraphicsWebView::focusInputTypes()
+{
+ QWebPage* page = new QWebPage;
+ GraphicsWebView* webView = new GraphicsWebView;
+ webView->setPage( page );
+ QGraphicsView* view = new QGraphicsView;
+ QGraphicsScene* scene = new QGraphicsScene(view);
+ view->setScene(scene);
+ scene->addItem(webView);
+ view->setGeometry(QRect(0,0,500,500));
+ QCoreApplication::processEvents();
+ QUrl url("qrc:///resources/input_types.html");
+ page->mainFrame()->load(url);
+ page->mainFrame()->setFocus();
+
+ QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
+
+ // 'text' type
+ webView->fireMouseClick(QPointF(20.0, 10.0));
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
+ QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase);
+ QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText);
+#else
+ QVERIFY(webView->inputMethodHints() == Qt::ImhNone);
+#endif
+
+ // 'password' field
+ webView->fireMouseClick(QPointF(20.0, 60.0));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText);
+
+ // 'tel' field
+ webView->fireMouseClick(QPointF(20.0, 110.0));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly);
+
+ // 'number' field
+ webView->fireMouseClick(QPointF(20.0, 160.0));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly);
+
+ // 'email' field
+ webView->fireMouseClick(QPointF(20.0, 210.0));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly);
+
+ // 'url' field
+ webView->fireMouseClick(QPointF(20.0, 260.0));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly);
+
+ delete webView;
+ delete view;
+}
+
+
QTEST_MAIN(tst_QGraphicsWebView)
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc
new file mode 100644
index 0000000..c91bb9c
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>resources/input_types.html</file>
+</qresource>
+</RCC>
+
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html
new file mode 100644
index 0000000..18ab314
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/input_types.html
@@ -0,0 +1,8 @@
+<html><body>
+<input type='text' maxlength='20' style='position: absolute; left: 10px; top: 0px; height: 50px; width: 100px;'/><br>
+<input type='password' style='position: absolute; left: 10px; top: 50px; height: 50px; width: 100px;'/><br>
+<input type='tel' style='position: absolute; left: 10px; top: 100px; height: 50px; width: 100px;'/><br>
+<input type='number' style='position: absolute; left: 10px; top: 150px; height: 50px; width: 100px;'/><br>
+<input type='email' style='position: absolute; left: 10px; top: 200px; height: 50px; width: 100px;'/><br>
+<input type='url' style='position: absolute; left: 10px; top: 250px; height: 50px; width: 100px;'/><br>"
+</body></html> \ No newline at end of file
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index 100399e..835ad82 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -30,8 +30,6 @@
#include <qwebkitversion.h>
#include <qwebframe.h>
-#include <QDebug>
-
class tst_QWebView : public QObject
{
Q_OBJECT
@@ -49,10 +47,25 @@ private slots:
void reusePage_data();
void reusePage();
void microFocusCoordinates();
+ void focusInputTypes();
void crashTests();
};
+class WebView : public QWebView
+{
+ Q_OBJECT
+
+public:
+ void fireMouseClick(QPoint point) {
+ QMouseEvent presEv(QEvent::MouseButtonPress, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent relEv(QEvent::MouseButtonRelease, point, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+ QWebView::mousePressEvent(&presEv);
+ QWebView::mousePressEvent(&relEv);
+ }
+
+};
+
// This will be called before the first test function is executed.
// It is only called once.
void tst_QWebView::initTestCase()
@@ -230,6 +243,52 @@ void tst_QWebView::microFocusCoordinates()
QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-50)), currentMicroFocus.toRect());
}
+void tst_QWebView::focusInputTypes()
+{
+ QWebPage* page = new QWebPage;
+ WebView* webView = new WebView;
+ webView->setPage( page );
+
+ QCoreApplication::processEvents();
+ QUrl url("qrc:///resources/input_types.html");
+ page->mainFrame()->load(url);
+ page->mainFrame()->setFocus();
+
+ QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
+
+ // 'text' type
+ webView->fireMouseClick(QPoint(20, 10));
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
+ QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase);
+ QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText);
+#else
+ QVERIFY(webView->inputMethodHints() == Qt::ImhNone);
+#endif
+
+ // 'password' field
+ webView->fireMouseClick(QPoint(20, 60));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText);
+
+ // 'tel' field
+ webView->fireMouseClick(QPoint(20, 110));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly);
+
+ // 'number' field
+ webView->fireMouseClick(QPoint(20, 160));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly);
+
+ // 'email' field
+ webView->fireMouseClick(QPoint(20, 210));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly);
+
+ // 'url' field
+ webView->fireMouseClick(QPoint(20, 260));
+ QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly);
+
+ delete webView;
+
+}
+
QTEST_MAIN(tst_QWebView)
#include "tst_qwebview.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc
index 5abc64c..8710a9a 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc
@@ -2,6 +2,7 @@
<qresource>
<file>resources/index.html</file>
<file>resources/frame_a.html</file>
+ <file>resources/input_types.html</file>
</qresource>
</RCC>