summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lupdate/qscript.g
diff options
context:
space:
mode:
Diffstat (limited to 'tools/linguist/lupdate/qscript.g')
0 files changed, 0 insertions, 0 deletions
letions(-) create mode 100644 src/declarative/qml/qmldirparser.cpp create mode 100644 src/declarative/qml/qmldirparser_p.h diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index a8df61e..5e0c3e0 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -51,7 +51,8 @@ SOURCES += \ $$PWD/qmllistscriptclass.cpp \ $$PWD/qmlworkerscript.cpp \ $$PWD/qmlimageprovider.cpp \ - $$PWD/qmlnetworkaccessmanagerfactory.cpp + $$PWD/qmlnetworkaccessmanagerfactory.cpp \ + $$PWD/qmldirparser.cpp HEADERS += \ $$PWD/qmlparser_p.h \ $$PWD/qmlglobal_p.h \ @@ -119,7 +120,8 @@ HEADERS += \ $$PWD/qmlscriptclass_p.h \ $$PWD/qmlguard_p.h \ $$PWD/qmlimageprovider.h \ - $$PWD/qmlnetworkaccessmanagerfactory.h + $$PWD/qmlnetworkaccessmanagerfactory.h \ + $$PWD/qmldirparser_p.h QT += sql include(parser/parser.pri) include(rewriter/rewriter.pri) diff --git a/src/declarative/qml/qmldirparser.cpp b/src/declarative/qml/qmldirparser.cpp new file mode 100644 index 0000000..c7de233 --- /dev/null +++ b/src/declarative/qml/qmldirparser.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmldirparser_p.h" +#include "qmlerror.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +QmlDirParser::QmlDirParser() +{ +} + +QmlDirParser::~QmlDirParser() +{ +} + +QUrl QmlDirParser::url() const +{ + return _url; +} + +void QmlDirParser::setUrl(const QUrl &url) +{ + _url = url; +} + +QString QmlDirParser::source() const +{ + return _source; +} + +void QmlDirParser::setSource(const QString &source) +{ + _source = source; +} + +bool QmlDirParser::parse() +{ + _errors.clear(); + _plugins.clear(); + _components.clear(); + + QTextStream stream(&_source); + int lineNumber = 0; + + forever { + ++lineNumber; + + const QString line = stream.readLine(); + if (line.isNull()) + break; + + QString sections[3]; + int sectionCount = 0; + + int index = 0; + const int length = line.length(); + + while (index != length) { + const QChar ch = line.at(index); + + if (ch.isSpace()) { + do { ++index; } + while (index != length && line.at(index).isSpace()); + + } else if (ch == QLatin1Char('#')) { + // recognized a comment + break; + + } else { + const int start = index; + + do { ++index; } + while (index != length && !line.at(index).isSpace()); + + const QString lexeme = line.mid(start, index - start); + + if (sectionCount >= 3) { + reportError(lineNumber, start, QLatin1String("unexpected token")); + + } else { + sections[sectionCount++] = lexeme; + } + } + } + + if (sectionCount == 0) { + continue; // no sections, no party. + + } else if (sections[0] == QLatin1String("plugin")) { + if (sectionCount < 2) { + reportError(lineNumber, -1, + QString::fromUtf8("plugin directive requires 2 arguments, but %1 were provided").arg(sectionCount + 1)); + + continue; + } + + const Plugin entry(sections[1], sections[2]); + + _plugins.append(entry); + + } else if (sectionCount == 3) { + const QString &version = sections[1]; + const int dotIndex = version.indexOf(QLatin1Char('.')); + + if (dotIndex == -1) { + qWarning() << "expected '.'"; // ### use reportError + + } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) { + qWarning() << "unexpected '.'"; // ### use reportError + + } else { + bool validVersionNumber = false; + const int majorVersion = version.left(dotIndex).toInt(&validVersionNumber); + + if (validVersionNumber) { + const int minorVersion = version.mid(dotIndex + 1).toInt(&validVersionNumber); + + if (validVersionNumber) { + const Component entry(sections[0], sections[2], majorVersion, minorVersion); + + _components.append(entry); + } + } + } + } else { + // ### use reportError + qWarning() << "a component declaration requires 3 arguments, but" << (sectionCount + 1) << "were provided"; + } + } + + return hasError(); +} + +void QmlDirParser::reportError(int line, int column, const QString &description) +{ + QmlError error; + error.setUrl(_url); + error.setLine(line); + error.setColumn(column); + error.setDescription(description); + _errors.append(error); +} + +bool QmlDirParser::hasError() const +{ + if (! _errors.isEmpty()) + return true; + + return false; +} + +QList QmlDirParser::errors() const +{ + return _errors; +} + +QList QmlDirParser::plugins() const +{ + return _plugins; +} + +QList QmlDirParser::components() const +{ + return _components; +} + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmldirparser_p.h b/src/declarative/qml/qmldirparser_p.h new file mode 100644 index 0000000..ff8b0f8 --- /dev/null +++ b/src/declarative/qml/qmldirparser_p.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLDIRPARSER_P_H +#define QMLDIRPARSER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QmlError; + +class QmlDirParser +{ + Q_DISABLE_COPY(QmlDirParser) + +public: + QmlDirParser(); + ~QmlDirParser(); + + QUrl url() const; + void setUrl(const QUrl &url); + + QString source() const; + void setSource(const QString &source); + + bool parse(); + + bool hasError() const; + QList errors() const; + + struct Plugin + { + Plugin() {} + + Plugin(const QString &name, const QString &path) + : name(name), path(path) {} + + QString name; + QString path; + }; + + struct Component + { + Component() + : majorVersion(0), minorVersion(0) {} + + Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) + : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} + + QString typeName; + QString fileName; + int majorVersion; + int minorVersion; + }; + + QList components() const; + QList plugins() const; + +private: + void reportError(int line, int column, const QString &message); + +private: + QList _errors; + QUrl _url; + QString _source; + QList _components; + QList _plugins; +}; + +QT_END_NAMESPACE + +#endif // QMLDIRPARSER_P_H diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index cf26f58..6f26a07 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -66,6 +66,7 @@ #include "qmlscriptclass_p.h" #include "qmlnetworkaccessmanagerfactory.h" #include "qmlimageprovider.h" +#include "qmldirparser_p.h" #include @@ -1262,24 +1263,21 @@ struct QmlEnginePrivate::ImportedNamespace { qmldircontent = QString::fromUtf8(qmldir.readAll()); } } - QString typespace = QString::fromUtf8(type)+QLatin1Char(' '); - QStringList lines = qmldircontent.split(QLatin1Char('\n')); - foreach (QString line, lines) { - if (line.isEmpty() || line.at(0) == QLatin1Char('#')) - continue; - if (line.startsWith(typespace)) { - int space1 = line.indexOf(QLatin1Char(' ')); - int space2 = space1 >=0 ? line.indexOf(QLatin1Char(' '),space1+1) : -1; - QString mapversions = line.mid(space1+1,space2<0?line.length()-space1-1:space2-space1-1); - int dot = mapversions.indexOf(QLatin1Char('.')); - int mapvmaj = mapversions.left(dot).toInt(); - if (mapvmaj<=vmaj) { - if (mapvmaj= mapversions.mid(dot+1).toInt()) { - QStringRef mapfile = space2<0 ? QStringRef() : line.midRef(space2+1,line.length()-space2-1); - if (url_return) - *url_return = url.resolved(QUrl(mapfile.toString())); - return true; - } + + const QString typespace = QString::fromUtf8(type); + + QmlDirParser qmldirParser; + qmldirParser.setUrl(url); + qmldirParser.setSource(qmldircontent); + qmldirParser.parse(); + + foreach (const QmlDirParser::Component &c, qmldirParser.components()) { // ### TODO: cache the components + if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) { + if (c.typeName == typespace) { + if (url_return) + *url_return = url.resolved(QUrl(c.fileName)); + + return true; } } } -- cgit v0.12 From af9bee69a9d902cffb4b590012cba79328fd2a1b Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 19 Feb 2010 15:29:33 +0100 Subject: Added QmlExtensionPlugin and QmlExtensionInterface. --- src/declarative/qml/qml.pri | 9 +++++++-- src/declarative/qml/qmlextensioninterface.h | 25 +++++++++++++++++++++++ src/declarative/qml/qmlextensionplugin.cpp | 12 +++++++++++ src/declarative/qml/qmlextensionplugin.h | 31 +++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 src/declarative/qml/qmlextensioninterface.h create mode 100644 src/declarative/qml/qmlextensionplugin.cpp create mode 100644 src/declarative/qml/qmlextensionplugin.h diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 5e0c3e0..6c74863 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -52,7 +52,9 @@ SOURCES += \ $$PWD/qmlworkerscript.cpp \ $$PWD/qmlimageprovider.cpp \ $$PWD/qmlnetworkaccessmanagerfactory.cpp \ - $$PWD/qmldirparser.cpp + $$PWD/qmldirparser.cpp \ + $$PWD/qmlextensionplugin.cpp + HEADERS += \ $$PWD/qmlparser_p.h \ $$PWD/qmlglobal_p.h \ @@ -121,7 +123,10 @@ HEADERS += \ $$PWD/qmlguard_p.h \ $$PWD/qmlimageprovider.h \ $$PWD/qmlnetworkaccessmanagerfactory.h \ - $$PWD/qmldirparser_p.h + $$PWD/qmldirparser_p.h \ + $$PWD/qmlextensioninterface.h \ + $$PWD/qmlextensionplugin.h + QT += sql include(parser/parser.pri) include(rewriter/rewriter.pri) diff --git a/src/declarative/qml/qmlextensioninterface.h b/src/declarative/qml/qmlextensioninterface.h new file mode 100644 index 0000000..d336e6e --- /dev/null +++ b/src/declarative/qml/qmlextensioninterface.h @@ -0,0 +1,25 @@ +#ifndef QMLEXTENSIONINTERFACE_H +#define QMLEXTENSIONINTERFACE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlEngine; + +struct Q_DECLARATIVE_EXPORT QmlExtensionInterface +{ + virtual void initialize(QmlEngine *engine) = 0; +}; + +Q_DECLARE_INTERFACE(QmlExtensionInterface, "com.trolltech.Qt.QmlExtensionInterface/1.0") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLEXTENSIONINTERFACE_H diff --git a/src/declarative/qml/qmlextensionplugin.cpp b/src/declarative/qml/qmlextensionplugin.cpp new file mode 100644 index 0000000..15ad44e --- /dev/null +++ b/src/declarative/qml/qmlextensionplugin.cpp @@ -0,0 +1,12 @@ + +#include "qmlextensionplugin.h" + +QmlExtensionPlugin::QmlExtensionPlugin(QObject *parent) + : QObject(parent) +{ +} + +QmlExtensionPlugin::~QmlExtensionPlugin() +{ +} + diff --git a/src/declarative/qml/qmlextensionplugin.h b/src/declarative/qml/qmlextensionplugin.h new file mode 100644 index 0000000..8f3194f --- /dev/null +++ b/src/declarative/qml/qmlextensionplugin.h @@ -0,0 +1,31 @@ +#ifndef QMLEXTENSIONPLUGIN_H +#define QMLEXTENSIONPLUGIN_H + +#include + +#include "qmlextensioninterface.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QmlEngine; + +class Q_DECLARATIVE_EXPORT QmlExtensionPlugin : public QObject, public QmlExtensionInterface +{ + Q_OBJECT + Q_INTERFACES(QmlExtensionInterface) +public: + explicit QmlExtensionPlugin(QObject *parent = 0); + ~QmlExtensionPlugin(); + + virtual void initialize(QmlEngine *engine) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLEXTENSIONPLUGIN_H -- cgit v0.12 From 3731e214baeb44434f12f773b1c68e772f25323e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 19 Feb 2010 18:16:36 +0100 Subject: Get rid of the unfriendly ImportedNamespace::isBuiltin flag. The `isBuiltin' flag doesn't play nice with hybrid apps where the types in a namespace are provided by both C++ and QML code. Done-with: mae --- src/declarative/qml/qmlengine.cpp | 43 +++++++++++++++------------------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 6f26a07..7a60f9c 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1227,7 +1227,6 @@ struct QmlEnginePrivate::ImportedNamespace { QList majversions; QList minversions; QList isLibrary; - QList isBuiltin; // Types provided by C++ code (including plugins) QList qmlDirContent; bool find(const QByteArray& type, int *vmajor, int *vminor, QmlType** type_return, QUrl* url_return) const @@ -1236,23 +1235,22 @@ struct QmlEnginePrivate::ImportedNamespace { int vmaj = majversions.at(i); int vmin = minversions.at(i); - if (isBuiltin.at(i)) { - QByteArray qt = uris.at(i).toUtf8(); - qt += '/'; - qt += type; + QByteArray qt = uris.at(i).toUtf8(); + qt += '/'; + qt += type; + if (qmlImportTrace()) + qDebug() << "Look in" << qt; + QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin); + if (vmajor) *vmajor = vmaj; + if (vminor) *vminor = vmin; + if (t) { if (qmlImportTrace()) - qDebug() << "Look in" << qt; - QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin); - if (vmajor) *vmajor = vmaj; - if (vminor) *vminor = vmin; - if (t) { - if (qmlImportTrace()) - qDebug() << "Found" << qt; - if (type_return) - *type_return = t; - return true; - } + qDebug() << "Found" << qt; + if (type_return) + *type_return = t; + return true; } + QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml")); QString qmldircontent = qmlDirContent.at(i); if (vmaj>=0 || !qmldircontent.isEmpty()) { @@ -1321,7 +1319,6 @@ public: set.insert(prefix,(s=new QmlEnginePrivate::ImportedNamespace)); } QString url = uri; - bool isbuiltin = false; if (importType == QmlScriptParser::Import::Library) { url.replace(QLatin1Char('.'),QLatin1Char('/')); bool found = false; @@ -1334,16 +1331,11 @@ public: break; } } - if (!found) { - // XXX assume it is a built-in type qualifier - isbuiltin = true; - } QFactoryLoader *l = loader(); QmlModuleFactoryInterface *factory = qobject_cast(l->instance(uri)); if (factory) { factory->defineModuleOnce(uri); - isbuiltin = true; } } else { url = base.resolved(QUrl(url)).toString(); @@ -1353,7 +1345,6 @@ public: s->majversions.prepend(vmaj); s->minversions.prepend(vmin); s->isLibrary.prepend(importType == QmlScriptParser::Import::Library); - s->isBuiltin.prepend(isbuiltin); s->qmlDirContent.prepend(qmldircontent); return true; } @@ -1376,10 +1367,11 @@ public: if (s) { if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return)) return true; - if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) { + if (s->urls.count() == 1 && !s->isLibrary[0] && url_return) { *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml"))); return true; } + } if (url_return) { *url_return = base.resolved(QUrl(QString::fromUtf8(type + ".qml"))); @@ -1440,9 +1432,6 @@ static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePri QList types = QmlMetaType::qmlTypes(); for (int ii = 0; ii < set.uris.count(); ++ii) { - if (!set.isBuiltin.at(ii)) - continue; - QByteArray base = set.uris.at(ii).toUtf8() + '/'; int major = set.majversions.at(ii); int minor = set.minversions.at(ii); -- cgit v0.12 From 4d3ca81b0aeef6f6496f3e89451f5369ce5efa99 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 19 Feb 2010 12:26:32 +0100 Subject: QStringBuilder: reduce the size of the generated code A simple concatenation of 2 string does not benefit from the QStringBuilder trick, yet, this would produce more code with QT_USE_FAST_OPERATOR_PLUS This commit specialize the QStringBuilder with two QString so it produce the same code as without it. Reviewed-by: joao Reviewed-by: hjk --- src/corelib/tools/qstringbuilder.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 74661c2..4ff1b36 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -117,6 +117,20 @@ public: }; +template <> +class QStringBuilder +{ + public: + QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {} + + operator QString() const + { QString r(a); r += b; return r; } + QByteArray toLatin1() const { return QString(*this).toLatin1(); } + + const QString &a; + const QString &b; +}; + template <> struct QConcatenable : private QAbstractConcatenable { typedef char type; -- cgit v0.12 From 8302f412660410775887c6c524aa87fb67aebde1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 19 Feb 2010 12:48:28 +0100 Subject: QStringBuilder: Do not resize if not required. This reduce a lot the binary size. And is also faster. It is not source compatible if customer have made their own QConcatenable. But this class is not documented, and it is easy to fix. Reviewed-by: Joao Reviewed-by: hjk --- src/corelib/tools/qstringbuilder.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 4ff1b36..9fe3fd7 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -100,14 +100,18 @@ public: operator QString() const { - QString s(QConcatenable< QStringBuilder >::size(*this), - Qt::Uninitialized); + const uint size = QConcatenable< QStringBuilder >::size(*this); + QString s(size, Qt::Uninitialized); QChar *d = s.data(); + const QChar * const start = d; QConcatenable< QStringBuilder >::appendTo(*this, d); - // this resize is necessary since we allocate a bit too much - // when dealing with variable sized 8-bit encodings - s.resize(d - s.data()); + + if (!QConcatenable< QStringBuilder >::ExactSize && size != d - start) { + // this resize is necessary since we allocate a bit too much + // when dealing with variable sized 8-bit encodings + s.resize(d - start); + } return s; } QByteArray toLatin1() const { return QString(*this).toLatin1(); } @@ -116,7 +120,6 @@ public: const B &b; }; - template <> class QStringBuilder { @@ -134,6 +137,7 @@ class QStringBuilder template <> struct QConcatenable : private QAbstractConcatenable { typedef char type; + enum { ExactSize = true }; static int size(const char) { return 1; } static inline void appendTo(const char c, QChar *&out) { @@ -144,6 +148,7 @@ template <> struct QConcatenable : private QAbstractConcatenable template <> struct QConcatenable { typedef QLatin1Char type; + enum { ExactSize = true }; static int size(const QLatin1Char) { return 1; } static inline void appendTo(const QLatin1Char c, QChar *&out) { @@ -154,6 +159,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QChar type; + enum { ExactSize = true }; static int size(const QChar) { return 1; } static inline void appendTo(const QChar c, QChar *&out) { @@ -164,6 +170,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QCharRef type; + enum { ExactSize = true }; static int size(const QCharRef &) { return 1; } static inline void appendTo(const QCharRef &c, QChar *&out) { @@ -174,6 +181,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QLatin1String type; + enum { ExactSize = true }; static int size(const QLatin1String &a) { return qstrlen(a.latin1()); } static inline void appendTo(const QLatin1String &a, QChar *&out) { @@ -186,6 +194,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QLatin1Literal type; + enum { ExactSize = true }; static int size(const QLatin1Literal &a) { return a.size(); } static inline void appendTo(const QLatin1Literal &a, QChar *&out) { @@ -197,6 +206,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QString type; + enum { ExactSize = true }; static int size(const QString &a) { return a.size(); } static inline void appendTo(const QString &a, QChar *&out) { @@ -209,6 +219,7 @@ template <> struct QConcatenable template <> struct QConcatenable { typedef QStringRef type; + enum { ExactSize = true }; static int size(const QStringRef &a) { return a.size(); } static inline void appendTo(QStringRef a, QChar *&out) { @@ -222,6 +233,7 @@ template <> struct QConcatenable template struct QConcatenable : private QAbstractConcatenable { typedef char type[N]; + enum { ExactSize = false }; static int size(const char[N]) { return N - 1; @@ -235,6 +247,7 @@ template struct QConcatenable : private QAbstractConcatenable template struct QConcatenable : private QAbstractConcatenable { typedef const char type[N]; + enum { ExactSize = false }; static int size(const char[N]) { return N - 1; } static inline void appendTo(const char a[N], QChar *&out) { @@ -245,6 +258,7 @@ template struct QConcatenable : private QAbstractConcaten template <> struct QConcatenable : private QAbstractConcatenable { typedef char const *type; + enum { ExactSize = false }; static int size(const char *a) { return qstrlen(a); } static inline void appendTo(const char *a, QChar *&out) { @@ -255,6 +269,7 @@ template <> struct QConcatenable : private QAbstractConcatenable template <> struct QConcatenable : private QAbstractConcatenable { typedef QByteArray type; + enum { ExactSize = false }; static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); } static inline void appendTo(const QByteArray &ba, QChar *&out) { @@ -267,6 +282,7 @@ template struct QConcatenable< QStringBuilder > { typedef QStringBuilder type; + enum { ExactSize = QConcatenable::ExactSize && QConcatenable::ExactSize }; static int size(const type &p) { return QConcatenable::size(p.a) + QConcatenable::size(p.b); -- cgit v0.12 From 5d3eb7a1062744afad06882e9a8f59c84fd4e8b7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 18 Feb 2010 20:52:45 +0100 Subject: Compile with QT_USE_FAST_OPERATOR_PLUS Reviewed-by: Joao --- src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 4 ++-- src/corelib/io/qurl.cpp | 2 +- src/qt3support/text/q3textedit.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 7a1bfd5..5fbc876 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -179,7 +179,7 @@ void InspectorClientQt::populateSetting(const String& key, InspectorController:: return; } - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); QVariant storedValue = qsettings.value(settingKey); storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); @@ -196,7 +196,7 @@ void InspectorClientQt::storeSetting(const String& key, const InspectorControlle } QVariant valueToStore = settingToVariant(setting); - QString settingKey(settingStoragePrefix + key); + QString settingKey(settingStoragePrefix + QString(key)); qsettings.setValue(settingKey, valueToStore); qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 076cc33..0290fb8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -6348,7 +6348,7 @@ QUrl QUrl::fromUserInput(const QString &userInput) return QUrl::fromLocalFile(trimmedString); QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode); - QUrl urlPrepended = QUrl::fromEncoded((QLatin1String("http://") + trimmedString).toUtf8(), QUrl::TolerantMode); + QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode); // Check the most common case of a valid url with scheme and host // We check if the port would be valid by adding the scheme to handle the case host:port diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp index 7f51bea..d4f75ed 100644 --- a/src/qt3support/text/q3textedit.cpp +++ b/src/qt3support/text/q3textedit.cpp @@ -6238,7 +6238,7 @@ void Q3TextEdit::optimParseTags(QString * line, int lineNo, int indexOffset) } else { tmp = tagStack.isEmpty() ? 0 : tagStack.pop(); if (!tmp) { - if (((QLatin1Char('/') + cur->tag) == tag->tag) || + if ((QString(QLatin1Char('/') + cur->tag) == tag->tag) || (tag->tag == QLatin1String("/font") && cur->tag.left(4) == QLatin1String("font"))) { // set up the left and parent of this tag tag->leftTag = cur; -- cgit v0.12 From 1f0e2e9825453fc0d8efa91b21afa8e8a9b4951f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 19 Feb 2010 13:39:56 +0100 Subject: Enable QT_USE_FAST_CONCATENATION by default for compiling Qt But disable it with GCC 4.0 as it is known to cause problems due to a compiler bug Reviewed-by: Joao Reviewed-by: hjk --- src/corelib/tools/qstring.h | 10 ++++++++++ src/qbase.pri | 1 + 2 files changed, 11 insertions(+) diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 8de3c7d..a59c0bd 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -73,6 +73,16 @@ typedef std::basic_string QStdWString; #error qstring.h must be included before any header file that defines truncate #endif +#if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0) +//There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum +# ifdef QT_USE_FAST_OPERATOR_PLUS +# undef QT_USE_FAST_OPERATOR_PLUS +# endif +# ifdef QT_USE_FAST_CONCATENATION +# undef QT_USE_FAST_CONCATENATION +# endif +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/qbase.pri b/src/qbase.pri index ef5d9e5..835ed0e 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -157,6 +157,7 @@ contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code +DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end -- cgit v0.12 From f922243bbbab238fa63b220eaf74a5f1b429758c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 21 Feb 2010 19:52:54 +0100 Subject: Compilation on symbian --- src/corelib/tools/qlocale_symbian.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index b1a7caa..58e3ba8 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -841,7 +841,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const return symbianTimeFormat(); case DateTimeFormatLong: case DateTimeFormatShort: - return symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat(); + return QString(symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat()); case DateToStringShort: case DateToStringLong: return symbianDateToString(in.toDate(), (type == DateToStringShort) ); @@ -851,8 +851,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeToStringShort: case DateTimeToStringLong: { const QDateTime dt = in.toDateTime(); - return symbianDateToString(dt.date(), (type == DateTimeToStringShort) ) - + QLatin1Char(' ') + symbianTimeToString(dt.time()); + return QString(symbianDateToString(dt.date(), (type == DateTimeToStringShort) ) + + QLatin1Char(' ') + symbianTimeToString(dt.time())); } case MeasurementSystem: return static_cast(symbianMeasurementSystem()); -- cgit v0.12 From 1f049c91f91e069a975a72c1087a279d011535a5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Sun, 21 Feb 2010 19:47:01 +0100 Subject: loopback network example: Make use of bytesToWrite() Reviewed-by: TrustMe --- examples/network/loopback/dialog.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp index 27cff31..b504e36 100644 --- a/examples/network/loopback/dialog.cpp +++ b/examples/network/loopback/dialog.cpp @@ -44,12 +44,12 @@ #include "dialog.h" -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) static const int TotalBytes = 50 * 1024 * 1024; #else static const int TotalBytes = 5 * 1024 * 1024; #endif -static const int PayloadSize = 65536; +static const int PayloadSize = 64 * 1024; // 64 KB Dialog::Dialog(QWidget *parent) : QDialog(parent) @@ -130,6 +130,7 @@ void Dialog::acceptConnection() void Dialog::startTransfer() { + // called when the TCP client connected to the loopback server bytesToWrite = TotalBytes - (int)tcpClient.write(QByteArray(PayloadSize, '@')); clientStatusLabel->setText(tr("Connected")); } @@ -155,8 +156,11 @@ void Dialog::updateServerProgress() void Dialog::updateClientProgress(qint64 numBytes) { + // callen when the TCP client has written some bytes bytesWritten += (int)numBytes; - if (bytesToWrite > 0) + + // only write more if not finished and when the Qt write buffer is below a certain size. + if (bytesToWrite > 0 && tcpClient.bytesToWrite() <= 4*PayloadSize) bytesToWrite -= (int)tcpClient.write(QByteArray(qMin(bytesToWrite, PayloadSize), '@')); clientProgressBar->setMaximum(TotalBytes); -- cgit v0.12 From 6f63f4a78090f50f40f2c65af85120a715835dab Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 22 Feb 2010 13:17:11 +1000 Subject: Fixed shadow builds on Unix. --- qmake/Makefile.unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index fa98fd6..d4f5849 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -66,7 +66,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ - -I$(BUILD_PATH)/tools/shared \ + -I$(SOURCE_PATH)/tools/shared \ -DQT_NO_PCRE \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ -- cgit v0.12 From 30ae64eaf42a2d7f80f70fb01c77a6ebcdfd1e98 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 22 Feb 2010 16:17:46 +1000 Subject: Fixes: make check not checking that target is up to date Builds the target executable if needed before running the test LR on BKing's machine. Reviewed-by: Lincoln Ramsay --- mkspecs/features/qttest_p4.prf | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qttest_p4.prf b/mkspecs/features/qttest_p4.prf index e0b22f2..53c0d74 100644 --- a/mkspecs/features/qttest_p4.prf +++ b/mkspecs/features/qttest_p4.prf @@ -20,12 +20,32 @@ check.path = . macx: check.commands += ./$(QMAKE_TARGET).app/Contents/MacOS/$(QMAKE_TARGET) else:unix: check.commands += ./$(QMAKE_TARGET) else:win32: { - CONFIG(debug, debug|release):check.commands += debug\\$(QMAKE_TARGET) - else:check.commands += release\\$(QMAKE_TARGET) + CONFIG(debug, debug|release):check.commands += $(DESTDIR_TARGET) + else:check.commands += $(DESTDIR_TARGET) } embedded: check.commands += -qws QMAKE_EXTRA_TARGETS += check +!debug_and_release|build_pass { + check.depends = $(DESTDIR_TARGET) +} else { + check.CONFIG = recursive + # In debug and release mode, only run the test once. + # Run debug if available, release otherwise. + debug_and_release { + check.target = dummy_check + check.recurse_target = check + debug { + real_check.depends = debug-check + real_check.target = check + QMAKE_EXTRA_TARGETS += real_check + } else { + real_check.depends = release-check + real_check.target = check + QMAKE_EXTRA_TARGETS += real_check + } + } +} target.path += $$[QT_INSTALL_PREFIX]/tests/qt4 INSTALLS += target -- cgit v0.12 From 0a1e2e645bc1952c89d6ef560eccbe68e51f6ca8 Mon Sep 17 00:00:00 2001 From: ninerider Date: Mon, 22 Feb 2010 09:34:19 +0100 Subject: Fixes for the Windows Mobile plattform These fixes mainly concern compiling issues. --- tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp | 2 +- tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro | 2 +- .../gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp | 7 +++++++ .../gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp | 6 ++++++ .../gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp | 6 ++++++ .../qfile_vs_qnetworkaccessmanager.pro | 2 +- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index b325250..1238804 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -156,6 +156,7 @@ private slots: } void sizeSpeedWithoutFilterLowLevel() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); #ifdef Q_OS_WIN const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); wchar_t appendedPath[MAX_PATH]; @@ -173,7 +174,6 @@ private slots: } FindClose(hSearch); #else - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); DIR *dir = opendir(qPrintable(testdir.absolutePath())); QVERIFY(dir); diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro index 295cb50..eca619f 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = qfileinfo +TARGET = tst_qfileinfo DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp index 1028f42..6c4ca08 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp @@ -42,7 +42,14 @@ #include "view.h" #include + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif + #ifndef QT_NO_OPENGL #include #endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp index 527713f..63b0da9 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp @@ -39,7 +39,13 @@ ** ****************************************************************************/ #include + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif #ifdef Q_WS_X11 extern void qt_x11_wait_for_window_manager(QWidget *); diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp index 7419206..3f30393 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp @@ -39,7 +39,13 @@ ** ****************************************************************************/ #include + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif class ItemMover : public QObject { diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro index 99d1935..89f5d31 100644 --- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = qfile_vs_qnetworkaccessmanager +TARGET = tst_qfile_vs_qnetworkaccessmanager DEPENDPATH += . INCLUDEPATH += . -- cgit v0.12 From 1eb303d4f14dfcffcca3f11cacca7a73f1e53342 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 19 Feb 2010 12:05:44 +0100 Subject: Don't use vgClear() for semi-transparent brushes. If the brush is not totally opaque we should not use vgClear() at this point because vgClear() does not support blending. Instead it writes the values directly into the surface which clobbers any existing content. The bug exhibits itself when a child widget fills itself with any transparent color. Instead of blending with the parent widget's content, it writes the semi-transparent color directly to the surface, overwriting the parent content and leaving the surface in a somewhat undefined state because the alpha channel is not honoured unless Qt::WA_TranslucentBackground is set. Task-number: QTBUG-8007 Reviewed-by: Rhys Weatherley --- src/openvg/qpaintengine_vg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 6813d2f..da47f06 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -2399,7 +2399,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; // Check to see if we can use vgClear() for faster filling. - if (brush.style() == Qt::SolidPattern && + if (brush.style() == Qt::SolidPattern && brush.isOpaque() && clipTransformIsSimple(d->transform) && d->opacity == 1.0f && clearRect(rect, brush.color())) { return; @@ -2442,7 +2442,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QVGPaintEngine); // Check to see if we can use vgClear() for faster filling. - if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && + if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 && clearRect(rect, color)) { return; } -- cgit v0.12 From a8af0c1aba81716bd0f609b1d9afe5c10951b303 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 22 Feb 2010 10:44:32 +0200 Subject: Changed canonical paths to absolute paths in symmake. Canonical paths were resolving to empty if the paths didn't exist, which causes problems for clean platform builds. Using absolute paths instead will generate all required paths. This will cause a minor inconvenience of warnings about some nonexistent paths during makefile generation phase of abld builds, but this is unavoidable. Sbsv2 builds do not display any warnings. Reviewed-by: Janne Anttila --- qmake/generators/symbian/symmake.cpp | 35 +++++++++++++---------------------- qmake/generators/symbian/symmake.h | 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index a712434..217c1c3 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -109,11 +109,13 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q { static QString epocRootStr; if (epocRootStr.isEmpty()) { - QFileInfo efi(epocRoot()); - epocRootStr = efi.canonicalFilePath(); - if (epocRootStr.isEmpty()) { + epocRootStr = epocRoot(); + QFileInfo efi(epocRootStr); + if (!efi.exists() || epocRootStr.isEmpty()) { fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); epocRootStr = "/"; + } else { + epocRootStr = efi.absoluteFilePath(); } if (!epocRootStr.endsWith("/")) epocRootStr += "/"; @@ -137,16 +139,8 @@ QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const Q return resultPath; } -QString SymbianMakefileGenerator::canonizePath(const QString& origPath) +QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) { - // Since current path gets appended almost always anyway, use it as default - // for nonexisting paths. - static QString defaultPath; - if (defaultPath.isEmpty()) { - QFileInfo fi("."); - defaultPath = fi.canonicalFilePath(); - } - // Prepend epocroot to any paths beginning with "/epoc32/" QString resultPath = QDir::fromNativeSeparators(origPath); if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) @@ -154,16 +148,13 @@ QString SymbianMakefileGenerator::canonizePath(const QString& origPath) QFileInfo fi(fileInfo(resultPath)); if (fi.isDir()) { - resultPath = fi.canonicalFilePath(); + resultPath = fi.absoluteFilePath(); } else { - resultPath = fi.canonicalPath(); + resultPath = fi.absolutePath(); } resultPath = QDir::cleanPath(resultPath); - if (resultPath.isEmpty()) - resultPath = defaultPath; - return resultPath; } @@ -695,7 +686,7 @@ void SymbianMakefileGenerator::initMmpVariables() srcpaths << project->values("UI_DIR"); QDir current = QDir::current(); - QString canonizedCurrent = canonizePath("."); + QString absolutizedCurrent = absolutizePath("."); for (int j = 0; j < srcpaths.size(); ++j) { QFileInfo fi(fileInfo(srcpaths.at(j))); @@ -703,10 +694,10 @@ void SymbianMakefileGenerator::initMmpVariables() if (fi.suffix().startsWith("c")) { if (fi.filePath().length() > fi.fileName().length()) { appendIfnotExist(srcincpaths, fi.path()); - sources[canonizePath(fi.path())] += fi.fileName(); + sources[absolutizePath(fi.path())] += fi.fileName(); } else { - sources[canonizedCurrent] += fi.fileName(); - appendIfnotExist(srcincpaths, canonizedCurrent); + sources[absolutizedCurrent] += fi.fileName(); + appendIfnotExist(srcincpaths, absolutizedCurrent); } } } @@ -720,7 +711,7 @@ void SymbianMakefileGenerator::initMmpVariables() incpaths << project->values("UI_DIR"); for (int j = 0; j < incpaths.size(); ++j) { - QString includepath = canonizePath(incpaths.at(j)); + QString includepath = absolutizePath(incpaths.at(j)); appendIfnotExist(sysincspaths, includepath); appendAbldTempDirs(sysincspaths, includepath); } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 77d61da..542284c 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -84,7 +84,7 @@ protected: void removeSpecialCharacters(QString& str); QString fixPathForMmp(const QString& origPath, const QDir& parentDir); - QString canonizePath(const QString& origPath); + QString absolutizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); void generatePkgFile(const QString &iconFile, DeploymentList &depList); -- cgit v0.12 From f25f7a2a19ba4c21b7a5d9fee02a9ae71c9f60ef Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 22 Feb 2010 09:50:22 +0100 Subject: Copy useBackendOptimization setting when QStaticText is detached When the QStaticText is detached, we would previously reset the value of useBackendOptimizations rather than copy it into the new data. Reviewed-by: Gunnar --- src/gui/text/qstatictext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 623ee54..9313e65 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -356,7 +356,7 @@ QStaticTextPrivate::QStaticTextPrivate() QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other) : text(other.text), font(other.font), maximumSize(other.maximumSize), matrix(other.matrix), items(0), itemCount(0), glyphPool(0), positionPool(0), needsClipRect(false), - useBackendOptimizations(false), textFormat(other.textFormat) + useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat) { ref = 1; } -- cgit v0.12 From 1ecfec9950fb66378035f92be8c8b13b1b891872 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 09:21:49 +0100 Subject: Fix compilation on Windows For some reason, the MSVC compiler choose the operator+(const QString &, const QString &) instead of operator+(const WebCore::String &, const WebCore::String &) resulting in errors when QT_USE_FAST_OPERATOR_PLUS is used Reviewed-by: Jocelyn Turcotte --- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 79fc51e..5c87fe6 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -368,7 +368,7 @@ static inline void handleElementNamespaces(Element* newElement, const QXmlStream for (int i = 0; i < ns.count(); ++i) { const QXmlStreamNamespaceDeclaration &decl = ns[i]; String namespaceURI = decl.namespaceUri(); - String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + decl.prefix(); + String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix()); newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec); if (ec) // exception setting attributes return; -- cgit v0.12 From 10bec2ab7be43f4a8507901fc9eeecf0b33af5a1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 10:38:06 +0100 Subject: Fix compilation With the QT_USE_OPERATOR_PLUS, we need to cast before converting to QVariant --- tools/assistant/lib/qhelpdbreader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/lib/qhelpdbreader.cpp b/tools/assistant/lib/qhelpdbreader.cpp index 6dd949a..5c0f595 100644 --- a/tools/assistant/lib/qhelpdbreader.cpp +++ b/tools/assistant/lib/qhelpdbreader.cpp @@ -205,7 +205,7 @@ QByteArray QHelpDBReader::fileData(const QString &virtualFolder, "NamespaceTable d WHERE a.Id=b.FileId AND (b.Name=? OR b.Name=?) AND b.FolderId=c.Id " "AND c.Name=? AND c.NamespaceId=d.Id AND d.Name=?")); m_query->bindValue(0, filePath); - m_query->bindValue(1, QLatin1String("./") + filePath); + m_query->bindValue(1, QString(QLatin1String("./") + filePath)); m_query->bindValue(2, virtualFolder); m_query->bindValue(3, m_namespace); m_query->exec(); -- cgit v0.12 From b9db89f7d299305769e207088a00345dbe82cf1d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 22 Feb 2010 11:32:39 +0100 Subject: Fix build on Mac OS X Reviewed-by: Olivier --- src/corelib/global/qlibraryinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index a9ea44a..d5041c9 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -439,7 +439,7 @@ QLibraryInfo::location(LibraryLocation loc) QCFType urlRef = CFBundleCopyBundleURL(bundleRef); if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); - return QDir::cleanPath(path + QLatin1String("/Contents/") + ret); + return QDir::cleanPath(QString(path) + QLatin1String("/Contents/") + ret); } } #endif -- cgit v0.12 From 561f2a3bf1ec74df87c3cd7c2641d34ce321c842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 22 Feb 2010 11:40:41 +0100 Subject: Stabilize style sheet benchmarks. --- tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp index 226b661..d051b12 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -82,6 +82,7 @@ void tst_qstylesheetstyle::empty() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet("/*" + QString::number(i) + "*/"); @@ -94,6 +95,7 @@ void tst_qstylesheetstyle::empty_events() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet("/*" + QString::number(i) + "*/"); @@ -112,6 +114,7 @@ void tst_qstylesheetstyle::simple() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); @@ -124,6 +127,7 @@ void tst_qstylesheetstyle::simple_events() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); @@ -175,8 +179,13 @@ void tst_qstylesheetstyle::grid() w->setStyleSheet("/* */"); if(show) { w->show(); + QTest::qWaitForWindowShown(w); + QApplication::flush(); + QApplication::processEvents(); QTest::qWait(30); + QApplication::processEvents(); } + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/"); -- cgit v0.12 From 80fc5bf17e5f049a395d6a5612843c69c5b0fde1 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 22 Feb 2010 12:21:06 +0100 Subject: Introduced QmlEngine::importExtension. importExtension can be used to import QmlExtensionInterface(s) into a QmlEngine. --- src/declarative/qml/qmlengine.cpp | 21 ++++++++++++++++++++- src/declarative/qml/qmlengine.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 7a60f9c..1f5caa5 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -67,7 +67,7 @@ #include "qmlnetworkaccessmanagerfactory.h" #include "qmlimageprovider.h" #include "qmldirparser_p.h" - +#include "qmlextensioninterface.h" #include #include @@ -82,6 +82,7 @@ #include #include #include +#include #include #include #include @@ -1530,6 +1531,24 @@ void QmlEngine::addImportPath(const QString& path) } /*! + Imports the given \a extension into this QmlEngine. Returns + true if the extension was successfully imported. + + \sa QmlExtensionInterface +*/ +bool QmlEngine::importExtension(const QString &fileName) +{ + QPluginLoader loader(fileName); + + if (QmlExtensionInterface *iface = qobject_cast(loader.instance())) { + iface->initialize(this); + return true; + } + + return false; +} + +/*! \property QmlEngine::offlineStoragePath \brief the directory for storing offline user data diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index 64d0b9d..13a67b0 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -78,6 +78,7 @@ public: void clearComponentCache(); void addImportPath(const QString& dir); + bool importExtension(const QString &fileName); void setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *); QmlNetworkAccessManagerFactory *networkAccessManagerFactory() const; -- cgit v0.12 From 460394f8f225cc60e5dc1ad9804a6c8dd078fc05 Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 22 Feb 2010 12:30:55 +0100 Subject: Compilation fix for AIX --- src/3rdparty/libpng/png.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index 14e3416..5ea2b0d 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -386,7 +386,7 @@ #include "zlib.h" #endif -#ifdef AIX +#ifdef _AIX #define jmpbuf __jmpbuf #endif -- cgit v0.12 From 0406b2665167d85b3cf348b615a049fb757afa62 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 22 Feb 2010 12:32:58 +0100 Subject: amend the doc, as suggested by rittk Task-number: QTBUG-8070 --- src/corelib/io/qdatastream.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index f27ecc1..0b98e1e 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -158,10 +158,9 @@ QT_BEGIN_NAMESPACE \section1 Reading and writing Qt collection classes - The Qt collection classes can also be serialized to a QDataStream. + The Qt container classes can also be serialized to a QDataStream. These include QList, QLinkedList, QVector, QSet, QHash, and QMap. - These classes have have stream operators declared as non-member of - the class. + The stream operators are declared as non-members of the classes. \target Serializing Qt Classes \section1 Reading and writing other Qt classes. -- cgit v0.12 From 4f2d34ed13bd63413e726229fd50c4b33f2d0127 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 22 Feb 2010 12:36:30 +0100 Subject: Port http example to QNetworkAccessManager QHttp. Must. Die. Reviewed-by: Peter Hartmann --- examples/network/http/httpwindow.cpp | 129 ++++++++++++++++++----------------- examples/network/http/httpwindow.h | 23 ++++--- examples/network/http/main.cpp | 1 - 3 files changed, 82 insertions(+), 71 deletions(-) diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp index 95fc82f..ec7cd33 100644 --- a/examples/network/http/httpwindow.cpp +++ b/examples/network/http/httpwindow.cpp @@ -49,9 +49,9 @@ HttpWindow::HttpWindow(QWidget *parent) : QDialog(parent) { #ifndef QT_NO_OPENSSL - urlLineEdit = new QLineEdit("https://"); + urlLineEdit = new QLineEdit("https://qt.nokia.com/"); #else - urlLineEdit = new QLineEdit("http://"); + urlLineEdit = new QLineEdit("http://qt.nokia.com/"); #endif urlLabel = new QLabel(tr("&URL:")); @@ -70,21 +70,14 @@ HttpWindow::HttpWindow(QWidget *parent) progressDialog = new QProgressDialog(this); - http = new QHttp(this); - connect(urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableDownloadButton())); - connect(http, SIGNAL(requestFinished(int,bool)), - this, SLOT(httpRequestFinished(int,bool))); - connect(http, SIGNAL(dataReadProgress(int,int)), - this, SLOT(updateDataReadProgress(int,int))); - connect(http, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), - this, SLOT(readResponseHeader(QHttpResponseHeader))); - connect(http, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)), - this, SLOT(slotAuthenticationRequired(QString,quint16,QAuthenticator*))); + + connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*))); #ifndef QT_NO_OPENSSL - connect(http, SIGNAL(sslErrors(QList)), - this, SLOT(sslErrors(QList))); + connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList)), + this, SLOT(sslErrors(QNetworkReply*,QList))); #endif connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile())); @@ -104,9 +97,21 @@ HttpWindow::HttpWindow(QWidget *parent) urlLineEdit->setFocus(); } +void HttpWindow::startRequest(QUrl url) +{ + reply = qnam.get(QNetworkRequest(url)); + connect(reply, SIGNAL(finished()), + this, SLOT(httpFinished())); + connect(reply, SIGNAL(readyRead()), + this, SLOT(httpReadyRead())); + connect(reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(updateDataReadProgress(qint64,qint64))); +} + void HttpWindow::downloadFile() { - QUrl url(urlLineEdit->text()); + url = urlLineEdit->text(); + QFileInfo fileInfo(url.path()); QString fileName = fileInfo.fileName(); if (fileName.isEmpty()) @@ -132,35 +137,26 @@ void HttpWindow::downloadFile() return; } - QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp; - http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port()); - - if (!url.userName().isEmpty()) - http->setUser(url.userName(), url.password()); - - httpRequestAborted = false; - QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/"); - if (path.isEmpty()) - path = "/"; - httpGetId = http->get(path, file); progressDialog->setWindowTitle(tr("HTTP")); progressDialog->setLabelText(tr("Downloading %1.").arg(fileName)); downloadButton->setEnabled(false); + + // schedule the request + httpRequestAborted = false; + startRequest(url); } void HttpWindow::cancelDownload() { statusLabel->setText(tr("Download canceled.")); httpRequestAborted = true; - http->abort(); + reply->abort(); downloadButton->setEnabled(true); } -void HttpWindow::httpRequestFinished(int requestId, bool error) +void HttpWindow::httpFinished() { - if (requestId != httpGetId) - return; if (httpRequestAborted) { if (file) { file->close(); @@ -168,54 +164,58 @@ void HttpWindow::httpRequestFinished(int requestId, bool error) delete file; file = 0; } - + reply->deleteLater(); progressDialog->hide(); return; } - if (requestId != httpGetId) - return; - progressDialog->hide(); + file->flush(); file->close(); - if (error) { + + QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (reply->error()) { file->remove(); QMessageBox::information(this, tr("HTTP"), tr("Download failed: %1.") - .arg(http->errorString())); + .arg(reply->errorString())); + downloadButton->setEnabled(true); + } else if (!redirectionTarget.isNull()) { + QUrl newUrl = url.resolved(redirectionTarget.toUrl()); + if (QMessageBox::question(this, tr("HTTP"), + tr("Redirect to %1 ?").arg(newUrl.toString()), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + url = newUrl; + reply->deleteLater(); + file->open(QIODevice::WriteOnly); + file->resize(0); + startRequest(url); + return; + } } else { QString fileName = QFileInfo(QUrl(urlLineEdit->text()).path()).fileName(); statusLabel->setText(tr("Downloaded %1 to current directory.").arg(fileName)); + downloadButton->setEnabled(true); } - downloadButton->setEnabled(true); + reply->deleteLater(); + reply = 0; delete file; file = 0; } -void HttpWindow::readResponseHeader(const QHttpResponseHeader &responseHeader) +void HttpWindow::httpReadyRead() { - switch (responseHeader.statusCode()) { - case 200: // Ok - case 301: // Moved Permanently - case 302: // Found - case 303: // See Other - case 307: // Temporary Redirect - // these are not error conditions - break; - - default: - QMessageBox::information(this, tr("HTTP"), - tr("Download failed: %1.") - .arg(responseHeader.reasonPhrase())); - httpRequestAborted = true; - progressDialog->hide(); - http->abort(); - } + // this slot gets called everytime the QNetworkReply has new data. + // We read all of its new data and write it into the file. + // That way we use less RAM than when reading it at the finished() + // signal of the QNetworkReply + if (file) + file->write(reply->readAll()); } -void HttpWindow::updateDataReadProgress(int bytesRead, int totalBytes) +void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes) { if (httpRequestAborted) return; @@ -229,14 +229,19 @@ void HttpWindow::enableDownloadButton() downloadButton->setEnabled(!urlLineEdit->text().isEmpty()); } -void HttpWindow::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator) +void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator) { QDialog dlg; Ui::Dialog ui; ui.setupUi(&dlg); dlg.adjustSize(); - ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName)); - + ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host())); + + // Did the URL have information? Fill the UI + // This is only relevant if the URL-supplied credentials were wrong + ui.userEdit->setText(url.userName()); + ui.passwordEdit->setText(url.password()); + if (dlg.exec() == QDialog::Accepted) { authenticator->setUser(ui.userEdit->text()); authenticator->setPassword(ui.passwordEdit->text()); @@ -244,7 +249,7 @@ void HttpWindow::slotAuthenticationRequired(const QString &hostName, quint16, QA } #ifndef QT_NO_OPENSSL -void HttpWindow::sslErrors(const QList &errors) +void HttpWindow::sslErrors(QNetworkReply*,const QList &errors) { QString errorString; foreach (const QSslError &error, errors) { @@ -253,10 +258,10 @@ void HttpWindow::sslErrors(const QList &errors) errorString += error.errorString(); } - if (QMessageBox::warning(this, tr("HTTP Example"), + if (QMessageBox::warning(this, tr("HTTP"), tr("One or more SSL errors has occurred: %1").arg(errorString), QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) { - http->ignoreSslErrors(); + reply->ignoreSslErrors(); } } #endif diff --git a/examples/network/http/httpwindow.h b/examples/network/http/httpwindow.h index 9dca8a5..83898af 100644 --- a/examples/network/http/httpwindow.h +++ b/examples/network/http/httpwindow.h @@ -43,18 +43,21 @@ #define HTTPWINDOW_H #include +#include +#include QT_BEGIN_NAMESPACE class QDialogButtonBox; class QFile; -class QHttp; -class QHttpResponseHeader; class QLabel; class QLineEdit; class QProgressDialog; class QPushButton; class QSslError; class QAuthenticator; +class QNetworkReply; + + QT_END_NAMESPACE class HttpWindow : public QDialog @@ -64,16 +67,18 @@ class HttpWindow : public QDialog public: HttpWindow(QWidget *parent = 0); + void startRequest(QUrl url); + private slots: void downloadFile(); void cancelDownload(); - void httpRequestFinished(int requestId, bool error); - void readResponseHeader(const QHttpResponseHeader &responseHeader); - void updateDataReadProgress(int bytesRead, int totalBytes); + void httpFinished(); + void httpReadyRead(); + void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes); void enableDownloadButton(); - void slotAuthenticationRequired(const QString &, quint16, QAuthenticator *); + void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *); #ifndef QT_NO_OPENSSL - void sslErrors(const QList &errors); + void sslErrors(QNetworkReply*,const QList &errors); #endif private: @@ -85,7 +90,9 @@ private: QPushButton *quitButton; QDialogButtonBox *buttonBox; - QHttp *http; + QUrl url; + QNetworkAccessManager qnam; + QNetworkReply *reply; QFile *file; int httpGetId; bool httpRequestAborted; diff --git a/examples/network/http/main.cpp b/examples/network/http/main.cpp index ecbe100..817b2be 100644 --- a/examples/network/http/main.cpp +++ b/examples/network/http/main.cpp @@ -46,7 +46,6 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager."); HttpWindow httpWin; httpWin.show(); return httpWin.exec(); -- cgit v0.12 From 5e95e1bb510d24b9b7889191144a4842fd8569c1 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 22 Feb 2010 12:43:57 +0100 Subject: QNetworkRequest: Doc enhancement Reviewed-by: David Boddie --- src/network/access/qnetworkrequest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index a2bef67..c4ff24d 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -138,6 +138,8 @@ QT_BEGIN_NAMESPACE default follow redirections: it's up to the application to determine if the requested redirection should be allowed, according to its security policies. + The returned URL might be relative. Use QUrl::resolved() + to create an absolute URL out of it. \value ConnectionEncryptedAttribute Replies only, type: QVariant::Bool (default: false) -- cgit v0.12 From 66fb4038649cfd1d660204bf7c70f99a409ede4f Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 22 Feb 2010 13:02:23 +0100 Subject: Compilation fix for Symbian --- src/3rdparty/libpng/pngpriv.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index 13c2b3f..87a4ba6 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -74,7 +74,9 @@ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) -# include /* defines _WINDOWS_ macro */ +# if !defined(__SYMBIAN32__) +# include /* defines _WINDOWS_ macro */ +# endif /* I have no idea why is this necessary... */ # ifdef _MSC_VER # include -- cgit v0.12 From bab18de3932a802568d6d9e0cea9e76f02e6bf5d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 22 Feb 2010 12:53:50 +0100 Subject: fix crash on Windows CE on WM_SETTINGCHANGE On Windows CE, lParam parameter is a constant, not a char pointer. The only valid value is INI_INTL. Task-number: QTBUG-7943 Reviewed-by: ninerider --- src/gui/kernel/qapplication_win.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 0a4869b..aac834d 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1905,8 +1905,13 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam break; if (!msg.wParam) { +#ifdef Q_WS_WINCE + // On Windows CE, lParam parameter is a constant, not a char pointer. + if (msg.lParam == INI_INTL) { +#else QString area = QString::fromWCharArray((wchar_t*)msg.lParam); if (area == QLatin1String("intl")) { +#endif QLocalePrivate::updateSystemPrivate(); if (!widget->testAttribute(Qt::WA_SetLocale)) widget->dptr()->setLocale_helper(QLocale(), true); -- cgit v0.12 From 93ba9e3bc2bb4879d6b35b98d7d16c19f7c8221f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 13:39:40 +0100 Subject: Stylesheet: Fix size specified in QToolbar::handle Regression since f0243e70e05a3368582fd0478d840096d6b60c3f We added a new rule (SE_ToolBarHandle) and the baseStyle was calling pixelMetric(PM_ToolBarHandleExtent) on itself, bypassing the QStyleSheetStyle Reviewed-by: Thierry Task-number: QTBUG-8348 --- src/gui/styles/qstylesheetstyle.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index b36294a..c550938 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -5743,6 +5743,13 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction); } +#ifndef QT_NO_TOOLBAR + case SE_ToolBarHandle: + if (hasStyleRule(w, PseudoElement_ToolBarHandle)) + return ParentStyle::subElementRect(se, opt, w); + break; +#endif //QT_NO_TOOLBAR + default: break; } -- cgit v0.12 From e271f9c64f1be3a3608d2010a3561d512650f547 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 22 Feb 2010 13:52:46 +0100 Subject: Compile. --- src/declarative/util/qmlview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index e990e83..8844430 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -427,8 +427,6 @@ void QmlView::continueExecute() */ void QmlView::setRootObject(QObject *obj) { - Q_D(QmlView); - if (QmlGraphicsItem *item = qobject_cast(obj)) { d->scene.addItem(item); -- cgit v0.12 From cdeb85498e4cbd37022ba2bf4dc594db2326d0a4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 22 Feb 2010 14:02:08 +0100 Subject: Document the QmlExtensionPlugin interface. --- src/declarative/qml/qmlextensioninterface.h | 41 ++++++++++++++++ src/declarative/qml/qmlextensionplugin.cpp | 75 +++++++++++++++++++++++++++++ src/declarative/qml/qmlextensionplugin.h | 41 ++++++++++++++++ 3 files changed, 157 insertions(+) diff --git a/src/declarative/qml/qmlextensioninterface.h b/src/declarative/qml/qmlextensioninterface.h index d336e6e..d37a5bc 100644 --- a/src/declarative/qml/qmlextensioninterface.h +++ b/src/declarative/qml/qmlextensioninterface.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QMLEXTENSIONINTERFACE_H #define QMLEXTENSIONINTERFACE_H diff --git a/src/declarative/qml/qmlextensionplugin.cpp b/src/declarative/qml/qmlextensionplugin.cpp index 15ad44e..c1195d2 100644 --- a/src/declarative/qml/qmlextensionplugin.cpp +++ b/src/declarative/qml/qmlextensionplugin.cpp @@ -1,6 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ #include "qmlextensionplugin.h" +QT_BEGIN_NAMESPACE + +/*! + \since 4.7 + \class QmlExtensionPlugin + \brief The QmlExtensionPlugin class provides an abstract base for custom QML extension plugins. + + \ingroup plugins + + QmlExtensionPlugin is a plugin interface that makes it + possible to offer extensions that can be loaded dynamically into + applications using the QmlEngine class. + + Writing a QML extension plugin is achieved by subclassing this + base class, reimplementing the pure virtual initialize() + function, and exporting the class using the Q_EXPORT_PLUGIN2() + macro. See \l {How to Create Qt Plugins} for details. + + \sa QmlEngine::importExtension() +*/ + +/*! + \fn void QmlExtensionPlugin::initialize(QmlEngine *engine) + + Initializes the extension specified in the given \a engine. +*/ + +/*! + Constructs a QML extension plugin with the given \a parent. + + Note that this constructor is invoked automatically by the + Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + explicitly. +*/ QmlExtensionPlugin::QmlExtensionPlugin(QObject *parent) : QObject(parent) { @@ -10,3 +84,4 @@ QmlExtensionPlugin::~QmlExtensionPlugin() { } +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlextensionplugin.h b/src/declarative/qml/qmlextensionplugin.h index 8f3194f..eda7d0c 100644 --- a/src/declarative/qml/qmlextensionplugin.h +++ b/src/declarative/qml/qmlextensionplugin.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QMLEXTENSIONPLUGIN_H #define QMLEXTENSIONPLUGIN_H -- cgit v0.12 From d9838f300b652fe58c8c5af7097b236d93eb9725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 22 Feb 2010 14:33:19 +0100 Subject: Stabilize QWidget benchmarks. This commit also removes the complexToplevelResize test; it is not suitable for automated testing as the output is too unstable. --- .../benchmarks/gui/kernel/qwidget/tst_qwidget.cpp | 297 ++++++++------------- 1 file changed, 110 insertions(+), 187 deletions(-) diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp index f21bd44..8c30be4 100644 --- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -42,33 +42,35 @@ #include #include -class tst_QWidget : public QObject +static void processEvents() { - Q_OBJECT - - -private slots: - void update_data(); - void updateOpaque_data(); - void updateOpaque(); - void updateTransparent_data(); - void updateTransparent(); - void updatePartial_data(); - void updatePartial(); - void updateComplex_data(); - void updateComplex(); - - void complexToplevelResize(); -}; + QApplication::flush(); + QApplication::processEvents(); + QApplication::processEvents(); +} class UpdateWidget : public QWidget { public: - UpdateWidget(int rows, int columns) : QWidget(0) + UpdateWidget(int rows, int columns) + : QWidget(0), rowCount(0), columnCount(0), opaqueChildren(false) { + fill(rows, columns); + } + + UpdateWidget(QWidget *parent = 0) + : QWidget(parent), rowCount(0), columnCount(0), opaqueChildren(false) {} + + void fill(int rows, int columns) + { + if (rows == rowCount && columns == columnCount) + return; + delete layout(); QGridLayout *layout = new QGridLayout; - for (int row = 0; row < rows; ++row) { - for (int column = 0; column < columns; ++column) { + rowCount = rows; + columnCount = columns; + for (int row = 0; row < rowCount; ++row) { + for (int column = 0; column < columnCount; ++column) { UpdateWidget *widget = new UpdateWidget; widget->setFixedSize(20, 20); layout->addWidget(widget, row, column); @@ -76,9 +78,20 @@ public: } } setLayout(layout); + adjustSize(); + QTest::qWait(250); + processEvents(); } - UpdateWidget(QWidget *parent = 0) : QWidget(parent) {} + void setOpaqueChildren(bool enable) + { + if (opaqueChildren != enable) { + foreach (QWidget *w, children) + w->setAttribute(Qt::WA_OpaquePaintEvent, enable); + opaqueChildren = enable; + processEvents(); + } + } void paintEvent(QPaintEvent *) { @@ -93,75 +106,86 @@ public: QRegion updateRegion; QList children; + int rowCount; + int columnCount; + bool opaqueChildren; }; -void tst_QWidget::update_data() +class tst_QWidget : public QObject { - QTest::addColumn("rows"); - QTest::addColumn("columns"); - QTest::addColumn("numUpdates"); - - QTest::newRow("10x10x1") << 10 << 10 << 1; - QTest::newRow("10x10x10") << 10 << 10 << 10; - QTest::newRow("25x25x1") << 25 << 25 << 1; - QTest::newRow("25x25x10") << 25 << 25 << 10; - QTest::newRow("25x25x100") << 25 << 25 << 100; -} + Q_OBJECT -void tst_QWidget::updateOpaque_data() -{ - update_data(); -} +public slots: + void initTestCase(); + void init(); -void tst_QWidget::updateOpaque() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); +private slots: + void update_data(); + void update(); + void updatePartial_data(); + void updatePartial(); + void updateComplex_data(); + void updateComplex(); - UpdateWidget widget(rows, columns); - foreach (QWidget *w, widget.children) { - w->setAttribute(Qt::WA_OpaquePaintEvent); - } +private: + UpdateWidget widget; +}; +void tst_QWidget::initTestCase() +{ widget.show(); - QApplication::processEvents(); + QTest::qWaitForWindowShown(&widget); + QTest::qWait(300); + processEvents(); +} - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); - QApplication::processEvents(); - i = (i + 1) % n; - } - } +void tst_QWidget::init() +{ + QVERIFY(widget.isVisible()); + for (int i = 0; i < 3; ++i) + processEvents(); } -void tst_QWidget::updateTransparent_data() +void tst_QWidget::update_data() { - update_data(); + QTest::addColumn("rows"); + QTest::addColumn("columns"); + QTest::addColumn("numUpdates"); + QTest::addColumn("opaque"); + + QTest::newRow("10x10x1 transparent") << 10 << 10 << 1 << false; + QTest::newRow("10x10x10 transparent") << 10 << 10 << 10 << false; + QTest::newRow("10x10x100 transparent") << 10 << 10 << 100 << false; + QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true; + QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true; + QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true; + QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false; + QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false; + QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false; + QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true; + QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true; + QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true; } -void tst_QWidget::updateTransparent() +void tst_QWidget::update() { QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); + for (int i = 0; i < widget.children.size(); ++i) { + for (int j = 0; j < numUpdates; ++j) + widget.children.at(i)->update(); QApplication::processEvents(); - i = (i + 1) % n; } } + + QApplication::flush(); } void tst_QWidget::updatePartial_data() @@ -174,24 +198,23 @@ void tst_QWidget::updatePartial() QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { + for (int i = 0; i < widget.children.size(); ++i) { QWidget *w = widget.children[i]; const int x = w->width() / 2; const int y = w->height() / 2; - w->update(0, 0, x, y); - w->update(x, 0, x, y); - w->update(0, y, x, y); - w->update(x, y, x, y); + for (int j = 0; j < numUpdates; ++j) { + w->update(0, 0, x, y); + w->update(x, 0, x, y); + w->update(0, y, x, y); + w->update(x, y, x, y); + } QApplication::processEvents(); - i = (i + 1) % n; } } } @@ -206,127 +229,27 @@ void tst_QWidget::updateComplex() QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { + for (int i = 0; i < widget.children.size(); ++i) { QWidget *w = widget.children[i]; const int x = w->width() / 2; const int y = w->height() / 2; - w->update(QRegion(0, 0, x, y, QRegion::Ellipse)); - w->update(QRegion(x, y, x, y, QRegion::Ellipse)); + QRegion r1(0, 0, x, y, QRegion::Ellipse); + QRegion r2(x, y, x, y, QRegion::Ellipse); + for (int j = 0; j < numUpdates; ++j) { + w->update(r1); + w->update(r2); + } QApplication::processEvents(); - i = (i + 1) % n; } } } -class ResizeWidget : public QWidget -{ -public: - ResizeWidget(); -}; - -ResizeWidget::ResizeWidget() : QWidget(0) -{ - QBoxLayout *topLayout = new QVBoxLayout; - - QMenuBar *menubar = new QMenuBar; - QMenu* popup = menubar->addMenu("&File"); - popup->addAction("&Quit", qApp, SLOT(quit())); - topLayout->setMenuBar(menubar); - - QBoxLayout *buttons = new QHBoxLayout; - buttons->setMargin(5); - buttons->addStretch(10); - for (int i = 1; i <= 4; i++ ) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - buttons = new QHBoxLayout; - buttons->addStretch(10); - for (int i = 11; i <= 16; i++) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - QBoxLayout *buttons2 = new QHBoxLayout; - buttons2->addStretch(10); - topLayout->addLayout(buttons2); - - QPushButton *button = new QPushButton; - button->setText("Button five"); - buttons2->addWidget(button); - - button = new QPushButton; - button->setText("Button 6"); - buttons2->addWidget(button); - - QTextEdit *bigWidget = new QTextEdit; - bigWidget->setText("This widget will get all the remaining space"); - bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain); - topLayout->addWidget(bigWidget); - - const int numRows = 6; - const int labelCol = 0; - const int linedCol = 1; - const int multiCol = 2; - - QGridLayout *grid = new QGridLayout; - for (int row = 0; row < numRows; row++) { - QLineEdit *lineEdit = new QLineEdit; - grid->addWidget(lineEdit, row, linedCol); - QLabel *label = new QLabel(QString("Line &%1").arg(row + 1)); - grid->addWidget(label, row, labelCol); - } - topLayout->addLayout(grid); - - QTextEdit *multiLineEdit = new QTextEdit; - grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol); - - grid->setColumnStretch(linedCol, 10); - grid->setColumnStretch(multiCol, 20); - - QLabel* statusBar = new QLabel; - statusBar->setText("Let's pretend this is a status bar"); - statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken); - statusBar->setFixedHeight(statusBar->sizeHint().height()); - statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); - topLayout->addWidget(statusBar); - - topLayout->activate(); - setLayout(topLayout); -} - -void tst_QWidget::complexToplevelResize() -{ - ResizeWidget w; - w.show(); - - QApplication::processEvents(); - - const int minSize = 100; - const int maxSize = 800; - int size = minSize; - - QBENCHMARK { - w.resize(size, size); - size = qMax(minSize, (size + 10) % maxSize); - QApplication::processEvents(); - QApplication::processEvents(); - } -} - QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v0.12 From 28cbbf0ce72b33a259f097a070571589e49f8923 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 22 Feb 2010 14:56:46 +0100 Subject: Fix assert in fontengine when using rotated/scaled QStaticText Reviewed-By: Eskil --- src/gui/text/qfontengine.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c000457..e5975d2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -587,8 +587,9 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t) { QImage i = alphaMapForGlyph(glyph); if (t.type() > QTransform::TxTranslate) - i = i.transformed(t); + i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... + return i; } @@ -597,11 +598,14 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q QImage alphaMask = alphaMapForGlyph(glyph, t); QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); + QVector colorTable = alphaMask.colorTable(); for (int y=0; y Date: Mon, 22 Feb 2010 14:58:41 +0100 Subject: QFontDialog::exec() never returns on OSX The problem is the fact that this dialog is never meant to be used this way. Instead it should be called through the static function ::getFont(...). I reimplemented this code path and made sure that this works. Task-number: QTBUG-7769 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfontdialog.cpp | 58 ++++++++------- src/gui/dialogs/qfontdialog.h | 3 + src/gui/dialogs/qfontdialog_mac.mm | 148 ++++++++++++++++++++++++++++++++++++- src/gui/dialogs/qfontdialog_p.h | 6 ++ 4 files changed, 188 insertions(+), 27 deletions(-) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 56580a9..4358313 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -989,33 +989,23 @@ void QFontDialog::open(QObject *receiver, const char *member) void QFontDialog::setVisible(bool visible) { Q_D(QFontDialog); - if (visible) - d->selectedFont = QFont(); - -#if defined(Q_WS_MAC) - bool isCurrentlyVisible = (isVisible() || d->delegate); - - if (!visible == !isCurrentlyVisible) - return; - if (visible) { - if (!(d->opts & DontUseNativeDialog) && QFontDialogPrivate::sharedFontPanelAvailable) { - d->delegate = QFontDialogPrivate::openCocoaFontPanel( - currentFont(), parentWidget(), windowTitle(), options(), d); - QFontDialogPrivate::sharedFontPanelAvailable = false; + if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) return; - } + } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) + return; - setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags); - } else { - if (d->delegate) { - QFontDialogPrivate::closeCocoaFontPanel(d->delegate); - d->delegate = 0; - QFontDialogPrivate::sharedFontPanelAvailable = true; - return; + if (d->canBeNativeDialog()){ + if (d->setVisible_sys(visible)){ + d->nativeDialogInUse = true; + // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below + // updates the state correctly, but skips showing the non-native version: + setAttribute(Qt::WA_DontShowOnScreen, true); + } else { + d->nativeDialogInUse = false; + setAttribute(Qt::WA_DontShowOnScreen, false); } } -#endif QDialog::setVisible(visible); } @@ -1032,11 +1022,14 @@ void QFontDialog::done(int result) Q_D(QFontDialog); QDialog::done(result); if (result == Accepted) { - d->selectedFont = currentFont(); + // We check if this is the same font we had before, if so we emit currentFontChanged + QFont selectedFont = currentFont(); + if(selectedFont != d->selectedFont) + emit(currentFontChanged(selectedFont)); + d->selectedFont = selectedFont; emit fontSelected(d->selectedFont); - } else { + } else d->selectedFont = QFont(); - } if (d->receiverToDisconnectOnClose) { disconnect(this, SIGNAL(fontSelected(QFont)), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); @@ -1045,6 +1038,21 @@ void QFontDialog::done(int result) d->memberToDisconnectOnClose.clear(); } +bool QFontDialogPrivate::canBeNativeDialog() +{ + Q_Q(QFontDialog); + if (nativeDialogInUse) + return true; + if (q->testAttribute(Qt::WA_DontShowOnScreen)) + return false; + if (opts & QFontDialog::DontUseNativeDialog) + return false; + + QLatin1String staticName(QFontDialog::staticMetaObject.className()); + QLatin1String dynamicName(q->metaObject()->className()); + return (staticName == dynamicName); +} + /*! \fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name) \since 4.5 diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h index e6f209e..6035a3a 100644 --- a/src/gui/dialogs/qfontdialog.h +++ b/src/gui/dialogs/qfontdialog.h @@ -131,6 +131,9 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int)) Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int)) Q_PRIVATE_SLOT(d_func(), void _q_updateSample()) +#if defined(Q_WS_MAC) + Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel()) +#endif }; Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 68f5f00..67d32b8 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -49,6 +49,7 @@ #include #include #include +#include #include #import #import @@ -372,7 +373,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) [NSApp endModalSession:mModalSession]; mModalSession = 0; } - + // Hack alert! + // Since this code path was never intended to be followed when starting from exec + // we need to force the dialog to communicate the new font, otherwise the signal + // won't get emitted. + if(code == NSOKButton) + mPriv->sampleEdit->setFont([self qtFont]); mPriv->done((code == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); } else { [NSApp stopModalWithCode:code]; @@ -567,7 +573,6 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial, [ourPanel makeKeyAndOrderFront:ourPanel]; } } - return delegate; } @@ -640,6 +645,145 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) [static_cast(delegate) setQtFont:font]; } +void *QFontDialogPrivate::_q_constructNativePanel() +{ + QMacCocoaAutoReleasePool pool; + + bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists]; + NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel]; + [sharedFontPanel setHidesOnDeactivate:false]; + + // hack to ensure that QCocoaApplication's validModesForFontPanel: + // implementation is honored + if (!sharedFontPanelExisted) { + [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel]; + [sharedFontPanel close]; + } + + NSPanel *ourPanel = 0; + NSView *stolenContentView = 0; + NSButton *okButton = 0; + NSButton *cancelButton = 0; + + CGFloat dialogExtraWidth = 0.0; + CGFloat dialogExtraHeight = 0.0; + + // compute dialogExtra{Width,Height} + dialogExtraWidth = 2.0 * DialogSideMargin; + dialogExtraHeight = DialogTopMargin + ButtonTopMargin + ButtonMinHeight + + ButtonBottomMargin; + + // compute initial contents rectangle + NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]]; + contentRect.size.width += dialogExtraWidth; + contentRect.size.height += dialogExtraHeight; + + // create the new panel + ourPanel = [[NSPanel alloc] initWithContentRect:contentRect + styleMask:StyleMask + backing:NSBackingStoreBuffered + defer:YES]; + [ourPanel setReleasedWhenClosed:YES]; + + stolenContentView = [sharedFontPanel contentView]; + + // steal the font panel's contents view + [stolenContentView retain]; + [sharedFontPanel setContentView:0]; + + { + // create a new content view and add the stolen one as a subview + NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } }; + NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect]; + [ourContentView addSubview:stolenContentView]; + + // create OK and Cancel buttons and add these as subviews + okButton = macCreateButton("&OK", ourContentView); + cancelButton = macCreateButton("Cancel", ourContentView); + + [ourPanel setContentView:ourContentView]; + [ourPanel setDefaultButtonCell:[okButton cell]]; + } + // create a delegate and set it + QCocoaFontPanelDelegate *delegate = + [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel + stolenContentView:stolenContentView + okButton:okButton + cancelButton:cancelButton + priv:this + extraWidth:dialogExtraWidth + extraHeight:dialogExtraHeight]; + [ourPanel setDelegate:delegate]; + [[NSFontManager sharedFontManager] setDelegate:delegate]; +#ifdef QT_MAC_USE_COCOA + [[NSFontManager sharedFontManager] setTarget:delegate]; +#endif + setFont(delegate, QApplication::font()); + + { + // hack to get correct initial layout + NSRect frameRect = [ourPanel frame]; + frameRect.size.width += 1.0; + [ourPanel setFrame:frameRect display:NO]; + frameRect.size.width -= 1.0; + frameRect.size = [delegate windowWillResize:ourPanel toSize:frameRect.size]; + [ourPanel setFrame:frameRect display:NO]; + [ourPanel center]; + } + NSString *title = @"Select font"; + [ourPanel setTitle:title]; + + [delegate setModalSession:[NSApp beginModalSessionForWindow:ourPanel]]; + return delegate; +} + +void QFontDialogPrivate::mac_nativeDialogModalHelp() +{ + // Copied from QFileDialogPrivate + // Do a queued meta-call to open the native modal dialog so it opens after the new + // event loop has started to execute (in QDialog::exec). Using a timer rather than + // a queued meta call is intentional to ensure that the call is only delivered when + // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not + // running (which is the case if e.g a top-most QEventLoop has been + // interrupted, and the second-most event loop has not yet been reactivated (regardless + // if [NSApp run] is still on the stack)), showing a native modal dialog will fail. + if (nativeDialogInUse) { + Q_Q(QFontDialog); + QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel())); + } +} + +// The problem with the native font dialog is that OS X does not +// offer a proper dialog, but a panel (i.e. without Ok and Cancel buttons). +// This means we need to "construct" a native dialog by taking the panel +// and "adding" the buttons. +void QFontDialogPrivate::_q_macRunNativeAppModalPanel() +{ + QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active); + Q_Q(QFontDialog); + QCocoaFontPanelDelegate *delegate = (QCocoaFontPanelDelegate *)_q_constructNativePanel(); + NSWindow *ourPanel = [delegate actualPanel]; + [ourPanel retain]; + int rval = [NSApp runModalForWindow:ourPanel]; + QAbstractEventDispatcher::instance()->interrupt(); + [ourPanel release]; + [delegate cleanUpAfterMyself]; + [delegate release]; + bool isOk = (rval == NSOKButton); + if(isOk) + rescode = QDialog::Accepted; + else + rescode = QDialog::Rejected; +} + +bool QFontDialogPrivate::setVisible_sys(bool visible) +{ + Q_Q(QFontDialog); + if (!visible == q->isHidden()) + return false; + return visible; +} + QT_END_NAMESPACE #endif diff --git a/src/gui/dialogs/qfontdialog_p.h b/src/gui/dialogs/qfontdialog_p.h index ca2b10b..7654a80 100644 --- a/src/gui/dialogs/qfontdialog_p.h +++ b/src/gui/dialogs/qfontdialog_p.h @@ -152,6 +152,12 @@ public: inline QFontDialog *fontDialog() { return q_func(); } void *delegate; + bool nativeDialogInUse; + bool canBeNativeDialog(); + bool setVisible_sys(bool visible); + void *_q_constructNativePanel(); + void _q_macRunNativeAppModalPanel(); + void mac_nativeDialogModalHelp(); static bool sharedFontPanelAvailable; #endif -- cgit v0.12 From 56779980a6f5735649828542eef6a52361668952 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 22 Feb 2010 15:08:12 +0100 Subject: Fix a memory hole in QGraphicsItemPrivate. Reviewed-by:bnilsen --- src/gui/graphicsview/qgraphicsitem_p.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index b3ca3b5..2c92364 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -156,8 +156,8 @@ public: needSortChildren(0), allChildrenDirty(0), fullUpdatePending(0), - flags(0), dirtyChildrenBoundingRect(1), + flags(0), paintedViewBoundingRectsNeedRepaint(0), dirtySceneTransform(1), geometryChanged(1), @@ -474,11 +474,11 @@ public: quint32 inSetPosHelper : 1; quint32 needSortChildren : 1; quint32 allChildrenDirty : 1; + quint32 fullUpdatePending : 1; + quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 fullUpdatePending : 1; quint32 flags : 17; - quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -492,10 +492,10 @@ public: quint32 sceneTransformTranslateOnly : 1; quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; - - // New 32 bits quint32 mouseSetsFocus : 1; quint32 explicitActivate : 1; + + // New 32 bits quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; @@ -503,6 +503,7 @@ public: quint32 scenePosDescendants : 1; quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; + quint32 padding : 25; // Optional stacking order int globalStackingOrder; -- cgit v0.12 From bbbd8d402ed5c37d43bd419e7b461f9bacad792f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 19 Feb 2010 20:36:03 +0100 Subject: Compile This test no longer uses QtOpenGL, therefore it doesn't need to try to link with it. Reviewed-by: Eskil --- tests/auto/qstatictext/qstatictext.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qstatictext/qstatictext.pro b/tests/auto/qstatictext/qstatictext.pro index a759a90..0f1ca68 100644 --- a/tests/auto/qstatictext/qstatictext.pro +++ b/tests/auto/qstatictext/qstatictext.pro @@ -1,4 +1,4 @@ load(qttest_p4) -QT = core gui opengl +QT = core gui SOURCES += tst_qstatictext.cpp -- cgit v0.12 From d033442f92cfee0de952578044bbcb5e858ee835 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 22 Feb 2010 14:39:39 +0100 Subject: Imporve win64 support for mingw Reviewed-by: ogoffart --- src/activeqt/container/qaxbase.cpp | 4 +--- src/activeqt/container/qaxwidget.cpp | 34 +++++++++++++---------------- src/activeqt/control/qaxserverbase.cpp | 10 ++++----- src/corelib/kernel/qcoreapplication_win.cpp | 12 +++++----- src/corelib/thread/qmutex.cpp | 7 +++--- src/gui/kernel/qkeymapper_win.cpp | 2 +- src/gui/painting/qdrawhelper.cpp | 34 ++++++++++++++--------------- src/gui/painting/qdrawhelper_p.h | 2 +- src/gui/text/qfontengine_win.cpp | 6 ++--- src/qt3support/text/q3richtext.cpp | 2 +- src/qt3support/text/q3textstream.cpp | 2 +- src/qt3support/tools/q3gcache.cpp | 10 ++++----- src/qt3support/tools/q3gdict.cpp | 4 ++-- 13 files changed, 61 insertions(+), 68 deletions(-) diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 02a29d9..7692749 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -1353,11 +1353,9 @@ bool QAxBase::initializeFromFile(IUnknown** ptr) // There seams to be a naming problem in mingw headers -#ifdef Q_CC_GNU -#ifndef COAUTHIDENTITY +#if defined(Q_CC_GNU) && !defined(COAUTHIDENTITY) && !defined(__MINGW64_VERSION_MAJOR) #define COAUTHIDENTITY AUTH_IDENTITY #endif -#endif /*! diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp index 9149320..7d2dde7 100644 --- a/src/activeqt/container/qaxwidget.cpp +++ b/src/activeqt/container/qaxwidget.cpp @@ -77,25 +77,21 @@ // #define QAX_SUPPORT_BORDERSPACE // missing interface from win32api -#if defined(Q_CC_GNU) -# if !defined(IOleInPlaceObjectWindowless) -# undef INTERFACE -# define INTERFACE IOleInPlaceObjectWindowless - DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) - { - STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - STDMETHOD(GetWindow)(THIS_ HWND*) PURE; - STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; - STDMETHOD(InPlaceDeactivate)(THIS) PURE; - STDMETHOD(UIDeactivate)(THIS) PURE; - STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; - STDMETHOD(ReactivateAndUndo)(THIS) PURE; - STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; - STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; - }; -# endif +#if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR) + DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject) + { + STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + STDMETHOD(GetWindow)(THIS_ HWND*) PURE; + STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE; + STDMETHOD(InPlaceDeactivate)(THIS) PURE; + STDMETHOD(UIDeactivate)(THIS) PURE; + STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE; + STDMETHOD(ReactivateAndUndo)(THIS) PURE; + STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE; + STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE; + }; #endif #include "../shared/qaxtypes.h" diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 5fa0aad..ce71490 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -1536,7 +1536,7 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos) HINSTANCE hInst = (HINSTANCE)qAxInstance; EnterCriticalSection(&createWindowSection); QString cn(QLatin1String("QAxControl")); - cn += QString::number((int)ActiveXProc); + cn += QString::number((quintptr)ActiveXProc); if (!atom) { WNDCLASS wcTemp; wcTemp.style = CS_DBLCLKS; @@ -1599,10 +1599,10 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast( - reinterpret_cast(createPopup(action->menu())) + reinterpret_cast(createPopup(action->menu())) ); } else { - itemId = static_cast(reinterpret_cast(action)); + itemId = static_cast(reinterpret_cast(action)); actionMap.remove(itemId); actionMap.insert(itemId, action); } @@ -1646,10 +1646,10 @@ void QAxServerBase::createMenu(QMenuBar *menuBar) ushort itemId; if (flags & MF_POPUP) { itemId = static_cast( - reinterpret_cast(createPopup(action->menu())) + reinterpret_cast(createPopup(action->menu())) ); } else { - itemId = static_cast(reinterpret_cast(action)); + itemId = static_cast(reinterpret_cast(action)); actionMap.insert(itemId, action); } AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16()); diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 5990f86..566626d 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -1021,14 +1021,14 @@ QString decodeMSG(const MSG& msg) LPWINDOWPOS winPos = (LPWINDOWPOS)lParam; if (!winPos) break; - QString hwndAfter = valueCheck((uint)winPos->hwndInsertAfter, - FLAG_STRING((uint)HWND_BOTTOM, "HWND_BOTTOM"), - FLAG_STRING((int)HWND_NOTOPMOST, "HWND_NOTOPMOST"), - FLAG_STRING((uint)HWND_TOP, "HWND_TOP"), - FLAG_STRING((int)HWND_TOPMOST, "HWND_TOPMOST"), + QString hwndAfter = valueCheck(quint64(winPos->hwndInsertAfter), + FLAG_STRING((quintptr)HWND_BOTTOM, "HWND_BOTTOM"), + FLAG_STRING((quintptr)HWND_NOTOPMOST, "HWND_NOTOPMOST"), + FLAG_STRING((quintptr)HWND_TOP, "HWND_TOP"), + FLAG_STRING((quintptr)HWND_TOPMOST, "HWND_TOPMOST"), FLAG_STRING()); if (hwndAfter.size() == 0) - hwndAfter = QString::number((uint)winPos->hwndInsertAfter, 16); + hwndAfter = QString::number((quintptr)winPos->hwndInsertAfter, 16); QString flags = flagCheck(winPos->flags, FLGSTR(SWP_DRAWFRAME), FLGSTR(SWP_FRAMECHANGED), diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index ec50ac8..43df13a 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -41,6 +41,7 @@ #include "qplatformdefs.h" #include "qmutex.h" +#include #ifndef QT_NO_THREAD #include "qatomic.h" @@ -159,8 +160,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it @@ -197,8 +197,7 @@ void QMutex::lock() if (!isLocked) { #ifndef QT_NO_DEBUG if (d->owner == self) - qWarning("QMutex::lock: Deadlock detected in thread %ld", - long(d->owner)); + qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner; #endif // didn't get the lock, wait for it diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 578f32a..e555c5c 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -619,7 +619,7 @@ void QKeyMapperPrivate::clearMappings() /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ - LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT); + LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT); // keyboardInputLocale = qt_localeFromLCID(newLCID); bool bidi = false; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 070491d..fae26e0 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3700,7 +3700,7 @@ template <> Q_STATIC_TEMPLATE_SPECIALIZATION inline quint32 alpha_4(const qargb8555 *src) { - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint8 *src8 = reinterpret_cast(src); return src8[0] << 24 | src8[3] << 16 | src8[6] << 8 | src8[9]; } @@ -4026,8 +4026,8 @@ template <> inline void interpolate_pixel_4(qargb8565 *dest, const qargb8565 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4122,8 +4122,8 @@ template <> inline void interpolate_pixel_4(qargb8555 *dest, const qargb8555 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); @@ -4218,8 +4218,8 @@ template <> inline void interpolate_pixel_4(qrgb888 *dest, const qrgb888 *src, quint32 alpha) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = eff_alpha_4(alpha, dest); const quint32 ia = eff_ialpha_4(alpha, dest); @@ -4291,8 +4291,8 @@ template inline void interpolate_pixel_4(DST *dest, quint8 a, const SRC *src, quint8 b) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); dest[0] = dest[0].byte_mul(a) + DST(src[0]).byte_mul(b); dest[1] = dest[1].byte_mul(a) + DST(src[1]).byte_mul(b); @@ -4303,8 +4303,8 @@ inline void interpolate_pixel_4(DST *dest, quint8 a, template inline void blend_sourceOver_4(DST *dest, const SRC *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4319,8 +4319,8 @@ inline void blend_sourceOver_4(DST *dest, const SRC *src) template <> inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4333,8 +4333,8 @@ inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src) template <> inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { @@ -4347,8 +4347,8 @@ inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src) template <> inline void blend_sourceOver_4(qargb6666 *dest, const qargb6666 *src) { - Q_ASSERT((long(dest) & 0x3) == 0); - Q_ASSERT((long(src) & 0x3) == 0); + Q_ASSERT((quintptr(dest) & 0x3) == 0); + Q_ASSERT((quintptr(src) & 0x3) == 0); const quint32 a = alpha_4(src); if (a == 0xffffffff) { diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index cb0db4f..2f78b00 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1649,7 +1649,7 @@ inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count) return; } - const int align = (long(dest) & 3); + const int align = (quintptr(dest) & 3); switch (align) { case 1: *dest++ = qrgb666(*src++); --count; case 2: *dest++ = qrgb666(*src++); --count; diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 1a815d3..55e93bd 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -208,7 +208,7 @@ void QFontEngineWin::getCMap() unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; loadKerningPairs(designToDevice); - _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFullName)).toLatin1(); + _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); lineWidth = otm->otmsUnderscoreSize; fsType = otm->otmfsType; free(otm); @@ -1006,8 +1006,8 @@ QFontEngine::Properties QFontEngineWin::properties() const Properties p; p.emSquare = unitsPerEm; p.italicAngle = otm->otmItalicAngle; - p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFamilyName)).toLatin1(); - p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpStyleName)).toLatin1(); + p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1(); + p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1(); #ifndef QT_NO_PRINTER p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName); #endif diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index 21383bd..8614076 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap &attr, imageName = attr[QLatin1String("source")]; if (!imageName.isEmpty()) { - imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory); + imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((quintptr)&factory); if (!pixmap_map) pixmap_map = new QMap; if (pixmap_map->contains(imgId)) { diff --git a/src/qt3support/text/q3textstream.cpp b/src/qt3support/text/q3textstream.cpp index 41aab4d..8c86c7c 100644 --- a/src/qt3support/text/q3textstream.cpp +++ b/src/qt3support/text/q3textstream.cpp @@ -2084,7 +2084,7 @@ Q3TextStream &Q3TextStream::operator<<( void *ptr ) setf( hex, basefield ); setf( showbase ); unsetf( uppercase ); - output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE ); + output_int( I_LONG | I_UNSIGNED, (quintptr)ptr, FALSE ); flags( f ); return *this; } diff --git a/src/qt3support/tools/q3gcache.cpp b/src/qt3support/tools/q3gcache.cpp index a31f827..ada8330 100644 --- a/src/qt3support/tools/q3gcache.cpp +++ b/src/qt3support/tools/q3gcache.cpp @@ -226,7 +226,7 @@ public: bool remove_ascii(Q3CacheItem *item) { return Q3GDict::remove_ascii((const char *)item->key,item); } bool remove_int(Q3CacheItem *item) - { return Q3GDict::remove_int((long)item->key,item);} + { return Q3GDict::remove_int((quintptr)item->key,item);} void statistics() { Q3GDict::statistics(); } @@ -426,7 +426,7 @@ bool Q3GCache::insert_other(const char *key, Q3PtrCollection::Item data, if (keytype == AsciiKey) dict->insert_ascii(key, ci); else - dict->insert_int((long)key, ci); + dict->insert_int((quintptr)key, ci); tCost += cost; return true; } @@ -486,7 +486,7 @@ Q3PtrCollection::Item Q3GCache::take_other(const char *key) if (keytype == AsciiKey) ci = dict->take_ascii(key); else - ci = dict->take_int((long)key); + ci = dict->take_int((quintptr)key); Item d; if (ci) { d = ci->data; @@ -563,7 +563,7 @@ Q3PtrCollection::Item Q3GCache::find_string(const QString &key, bool ref) const Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const { Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key) - : dict->find_int((long)key); + : dict->find_int((quintptr)key); #if defined(QT_DEBUG) lruList->finds++; #endif @@ -811,7 +811,7 @@ const char *Q3GCacheIterator::getKeyAscii() const long Q3GCacheIterator::getKeyInt() const { Q3CacheItem *item = it->current(); - return item ? (long)item->key : 0; + return item ? (quintptr)item->key : 0; } /*! diff --git a/src/qt3support/tools/q3gdict.cpp b/src/qt3support/tools/q3gdict.cpp index a968407..e8144fe 100644 --- a/src/qt3support/tools/q3gdict.cpp +++ b/src/qt3support/tools/q3gdict.cpp @@ -437,7 +437,7 @@ Q3PtrCollection::Item Q3GDict::look_int(long key, Q3PtrCollection::Item d, int o Q3PtrCollection::Item Q3GDict::look_ptr(void *key, Q3PtrCollection::Item d, int op) { Q3PtrBucket *n; - int index = (int)((ulong)key % vlen); // simple hash + int index = (int)((quintptr)key % vlen); // simple hash if (op == op_find) { // find for (n=(Q3PtrBucket*)vec[index]; n; n=(Q3PtrBucket*)n->getNext()) { @@ -650,7 +650,7 @@ Q3PtrBucket *Q3GDict::unlink_ptr(void *key, Q3PtrCollection::Item d) return 0; Q3PtrBucket *n; Q3PtrBucket *prev = 0; - int index = (int)((ulong)key % vlen); + int index = (int)((quintptr)key % vlen); for (n=(Q3PtrBucket *)vec[index]; n; n=(Q3PtrBucket *)n->getNext()) { bool found = (n->getKey() == key); if (found && d) -- cgit v0.12 From 0bcf45bf9f0adc8cf9e3486845819447d153bd5e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 22 Feb 2010 15:49:26 +0100 Subject: Fix build with wingw Reviewed-by: ogoffart --- src/corelib/tools/qlocale.cpp | 10 +++++----- src/corelib/tools/qstringbuilder.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b4bfcaf..84bc154 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -465,7 +465,7 @@ static QString winToQtFormat(const QString &sys_fmt) if (text == QLatin1String("'")) result += QLatin1String("''"); else - result += QLatin1Char('\'') + text + QLatin1Char('\''); + result += QString(QLatin1Char('\'') + text + QLatin1Char('\'')); continue; } @@ -681,8 +681,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeFormatLong: case DateTimeFormatShort: - return query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString() - + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString(); + return QString(query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString() + + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString()); case DayNameLong: case DayNameShort: return winDayName(in.toInt(), (type == DayNameShort)); @@ -698,8 +698,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case DateTimeToStringShort: case DateTimeToStringLong: { const QDateTime dt = in.toDateTime(); - return winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE) - + QLatin1Char(' ') + winTimeToString(dt.time()); } + return QString(winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE) + + QLatin1Char(' ') + winTimeToString(dt.time())); } case ZeroDigit: locale_info = LOCALE_SNATIVEDIGITS; diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 9fe3fd7..0c3ba06 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -107,7 +107,7 @@ public: const QChar * const start = d; QConcatenable< QStringBuilder >::appendTo(*this, d); - if (!QConcatenable< QStringBuilder >::ExactSize && size != d - start) { + if (!QConcatenable< QStringBuilder >::ExactSize && int(size) != d - start) { // this resize is necessary since we allocate a bit too much // when dealing with variable sized 8-bit encodings s.resize(d - start); -- cgit v0.12 From 0094e35f2303f5cf43d8fb97330efce916250bf9 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 22 Feb 2010 13:40:17 +0100 Subject: QAbstractSocket: Clarify documentation Reviewed-by: Thiago --- src/network/socket/qabstractsocket.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 829df89..275c436 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -155,6 +155,9 @@ See the \l network/fortuneclient and \l network/blockingfortuneclient examples for an overview of both approaches. + \note We discourage the use of the blocking functions together + with signals. One of the two possibilities should be used. + QAbstractSocket can be used with QTextStream and QDataStream's stream operators (operator<<() and operator>>()). There is one issue to be aware of, though: You must make sure that enough data @@ -1682,9 +1685,12 @@ static int qt_timeout_value(int msecs, int elapsed) If msecs is -1, this function will not time out. - Note: This function may wait slightly longer than \a msecs, + \note This function may wait slightly longer than \a msecs, depending on the time it takes to complete the host lookup. + \note Multiple calls to this functions do not accumulate the time. + If the function times out, the connecting process will be aborted. + \sa connectToHost(), connected() */ bool QAbstractSocket::waitForConnected(int msecs) @@ -1722,7 +1728,7 @@ bool QAbstractSocket::waitForConnected(int msecs) d->_q_startConnecting(QHostInfo::fromName(d->hostName)); } if (state() == UnconnectedState) - return false; + return false; // connect not im progress anymore! bool timedOut = true; #if defined (QABSTRACTSOCKET_DEBUG) -- cgit v0.12 From 7a328e4f69f10f4fea6d48746ff214030794328d Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Mon, 22 Feb 2010 16:19:44 +0100 Subject: Build fix for 976a2b6ad1f95175d8d0be2d1eb7603cf4e4026a. Forgot to add some #ifdef's. Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfontdialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 4358313..a4bf15d 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -994,7 +994,7 @@ void QFontDialog::setVisible(bool visible) return; } else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) return; - +#ifdef Q_WS_MAC if (d->canBeNativeDialog()){ if (d->setVisible_sys(visible)){ d->nativeDialogInUse = true; @@ -1006,7 +1006,7 @@ void QFontDialog::setVisible(bool visible) setAttribute(Qt::WA_DontShowOnScreen, false); } } - +#endif // Q_WS_MAC QDialog::setVisible(visible); } @@ -1038,6 +1038,7 @@ void QFontDialog::done(int result) d->memberToDisconnectOnClose.clear(); } +#ifdef Q_WS_MAC bool QFontDialogPrivate::canBeNativeDialog() { Q_Q(QFontDialog); @@ -1052,6 +1053,7 @@ bool QFontDialogPrivate::canBeNativeDialog() QLatin1String dynamicName(q->metaObject()->className()); return (staticName == dynamicName); } +#endif // Q_WS_MAC /*! \fn QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget* parent, const char* name) -- cgit v0.12 From c42343ab8bedda2700b16b10ee7a7409130cb500 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 16:25:46 +0100 Subject: Fix test with gcc 4.0 where QT_USE_FAST_CONCATENATION cannot be enabled. On GCC 4.0 we disabled the possibility to use the fast operator plus as a bug in the compiler makes it impossible to add enums. There is no normal operator+ for these case. Always test the operator% instead. Reviewed-by: joao --- tests/auto/qstringbuilder1/stringbuilder.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp index 8e95818..e9ae7a6 100644 --- a/tests/auto/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/qstringbuilder1/stringbuilder.cpp @@ -44,6 +44,14 @@ // "some literal", but replacing all vocals by their umlauted UTF-8 string :) #define UTF8_LITERAL "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" + +//fix for gcc4.0: if the operator+ does not exist without QT_USE_FAST_OPERATOR_PLUS +#ifndef QT_USE_FAST_CONCATENATION +#define Q % +#else +#define Q P +#endif + void runScenario() { // set codec for C strings to 0, enforcing Latin1 @@ -59,13 +67,13 @@ void runScenario() QString r; QByteArray ba(LITERAL); - r = l1literal P l1literal; + r = l1literal Q l1literal; QCOMPARE(r, r2); r = string P string; QCOMPARE(r, r2); - r = stringref P stringref; + r = stringref Q stringref; QCOMPARE(r, QString(stringref.toString() + stringref.toString())); - r = string P l1literal; + r = string Q l1literal; QCOMPARE(r, r2); r = string P l1string; QCOMPARE(r, r2); -- cgit v0.12 From 895b9bedc3746723f6c77754df3c428dbc0661d3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 22 Feb 2010 17:23:23 +0100 Subject: QSortFilterProxyModel: Sorting occured unnecessarily when the dynamicSortFilter is turned off We should not sort when inserting items if the dinamicSortFilter flag is set to false. Note that some of the test used to rely on the fact that it was sorted. Those test have been fixed. The patch has been contributed to us in the task. Task-number: QTBUG-7716 Reviewed-by: Thierry --- src/gui/itemviews/qsortfilterproxymodel.cpp | 8 ++--- .../tst_qsortfilterproxymodel.cpp | 38 +++++++++++++++++++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index e73013c..c63a07b 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -563,7 +563,7 @@ QVector > > QSortFilterProxyModelPrivate::proxy_interva int proxy_item = 0; int source_items_index = 0; QVector source_items_in_interval; - bool compare = (orient == Qt::Vertical && source_sort_column >= 0); + bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter); while (source_items_index < source_items.size()) { source_items_in_interval.clear(); int first_new_source_item = source_items.at(source_items_index); @@ -1244,7 +1244,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsInserted( const QModelIndex &source_parent, int start, int end) { source_items_inserted(source_parent, start, end, Qt::Vertical); - if (update_source_sort_column()) //previous call to update_source_sort_column may fail if the model has no column. + if (update_source_sort_column() && dynamic_sortfilter) //previous call to update_source_sort_column may fail if the model has no column. sort(); // now it should succeed so we need to make sure to sort again } @@ -1281,8 +1281,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted( if (source_parent.isValid()) return; //we sort according to the root column only if (source_sort_column == -1) { - //we update the source_sort_column depending on the prox_sort_column - if (update_source_sort_column()) + //we update the source_sort_column depending on the proxy_sort_column + if (update_source_sort_column() && dynamic_sortfilter) sort(); } else { if (start <= source_sort_column) diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 5b2b0cf..56eaf25 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -137,6 +137,7 @@ private slots: void task255652_removeRowsRecursive(); void taskQTBUG_6205_doubleProxySelectionSetSourceModel(); void taskQTBUG_7537_appearsAndSort(); + void taskQTBUG_7716_unnecessaryDynamicSorting(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -918,15 +919,16 @@ void tst_QSortFilterProxyModel::removeRows() QStandardItemModel model; QSortFilterProxyModel proxy; proxy.setSourceModel(&model); - if (sortOrder != -1) - proxy.sort(0, static_cast(sortOrder)); - if (!filter.isEmpty()) - proxy.setFilterRegExp(QRegExp(filter)); // prepare model foreach (QString s, initial) model.appendRow(new QStandardItem(s)); + if (sortOrder != -1) + proxy.sort(0, static_cast(sortOrder)); + if (!filter.isEmpty()) + proxy.setFilterRegExp(QRegExp(filter)); + // remove the rows QCOMPARE(proxy.removeRows(position, count, QModelIndex()), success); QCOMPARE(model.rowCount(QModelIndex()), expectedSource.count()); @@ -2419,6 +2421,7 @@ void tst_QSortFilterProxyModel::sortColumnTracking2() { QStandardItemModel model; QSortFilterProxyModel proxyModel; + proxyModel.setDynamicSortFilter(true); proxyModel.setSourceModel(&model); proxyModel.sort(0); @@ -2921,5 +2924,32 @@ void tst_QSortFilterProxyModel::taskQTBUG_7537_appearsAndSort() QCOMPARE(spyChanged2.count(), 1); } +void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting() +{ + QStringListModel model; + const QStringList initial = QString("bravo charlie delta echo").split(" "); + model.setStringList(initial); + QSortFilterProxyModel proxy; + proxy.setDynamicSortFilter(false); + proxy.setSourceModel(&model); + proxy.sort(Qt::AscendingOrder); + + //append two rows + int maxrows = proxy.rowCount(QModelIndex()); + model.insertRows(maxrows, 2); + model.setData(model.index(maxrows, 0), QString("alpha")); + model.setData(model.index(maxrows + 1, 0), QString("fondue")); + + //append new items to the initial string list and compare with model + QStringList expected = initial; + expected << QString("alpha") << QString("fondue"); + + //if bug 7716 is present, new rows were prepended, when they should have been appended + for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { + QModelIndex index = proxy.index(row, 0, QModelIndex()); + QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row)); + } +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" -- cgit v0.12 From 20fc9f2e264f34dd8580949ddbe5511b78ab0ac4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 22 Feb 2010 15:54:36 +0100 Subject: Load QML extensions. This allows projects which use the QtDeclarative module to register QML types and functions through C++ extensions. Reviewed-by: mae --- src/declarative/qml/qmldirparser.cpp | 11 +++++ src/declarative/qml/qmldirparser_p.h | 2 + src/declarative/qml/qmlengine.cpp | 67 +++++++++++++++++++---------- src/declarative/qml/qmlengine.h | 2 +- src/declarative/qml/qmlengine_p.h | 1 + src/declarative/qml/qmlextensioninterface.h | 2 +- src/declarative/qml/qmlextensionplugin.h | 2 +- 7 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/declarative/qml/qmldirparser.cpp b/src/declarative/qml/qmldirparser.cpp index c7de233..60beb72 100644 --- a/src/declarative/qml/qmldirparser.cpp +++ b/src/declarative/qml/qmldirparser.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE QmlDirParser::QmlDirParser() + : _isParsed(false) { } @@ -72,11 +73,21 @@ QString QmlDirParser::source() const void QmlDirParser::setSource(const QString &source) { + _isParsed = false; _source = source; } +bool QmlDirParser::isParsed() const +{ + return _isParsed; +} + bool QmlDirParser::parse() { + if (_isParsed) + return true; + + _isParsed = true; _errors.clear(); _plugins.clear(); _components.clear(); diff --git a/src/declarative/qml/qmldirparser_p.h b/src/declarative/qml/qmldirparser_p.h index ff8b0f8..c58c03f 100644 --- a/src/declarative/qml/qmldirparser_p.h +++ b/src/declarative/qml/qmldirparser_p.h @@ -74,6 +74,7 @@ public: QString source() const; void setSource(const QString &source); + bool isParsed() const; bool parse(); bool hasError() const; @@ -116,6 +117,7 @@ private: QString _source; QList _components; QList _plugins; + unsigned _isParsed: 1; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index ce2a693..d47db9b 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -97,7 +97,6 @@ #include #include -#include #include #include @@ -1249,12 +1248,13 @@ struct QmlEnginePrivate::ImportedNamespace { QByteArray qt = uris.at(i).toUtf8(); qt += '/'; qt += type; + if (qmlImportTrace()) qDebug() << "Look in" << qt; QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin); - if (vmajor) *vmajor = vmaj; - if (vminor) *vminor = vmin; if (t) { + if (vmajor) *vmajor = vmaj; + if (vminor) *vminor = vmin; if (qmlImportTrace()) qDebug() << "Found" << qt; if (type_return) @@ -1273,7 +1273,7 @@ struct QmlEnginePrivate::ImportedNamespace { } } - const QString typespace = QString::fromUtf8(type); + const QString typeName = QString::fromUtf8(type); QmlDirParser qmldirParser; qmldirParser.setUrl(url); @@ -1282,7 +1282,7 @@ struct QmlEnginePrivate::ImportedNamespace { foreach (const QmlDirParser::Component &c, qmldirParser.components()) { // ### TODO: cache the components if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) { - if (c.typeName == typespace) { + if (c.typeName == typeName) { if (url_return) *url_return = url.resolved(QUrl(c.fileName)); @@ -1290,6 +1290,7 @@ struct QmlEnginePrivate::ImportedNamespace { } } } + } else { // XXX search non-files too! (eg. zip files, see QT-524) QFileInfo f(toLocalFileOrQrc(url)); @@ -1304,9 +1305,6 @@ struct QmlEnginePrivate::ImportedNamespace { } }; -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QmlModuleFactoryInterface_iid, QLatin1String("/qmlmodules"))) - class QmlImportsPrivate { public: QmlImportsPrivate() : ref(1) @@ -1319,7 +1317,9 @@ public: delete s; } - bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType, const QStringList& importPath) + QSet qmlDirFilesForWhichPluginsHaveBeenLoaded; + + bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType, const QStringList& importPath, QmlEngine *engine) { QmlEnginePrivate::ImportedNamespace *s; if (prefix.isEmpty()) { @@ -1331,26 +1331,48 @@ public: } QString url = uri; if (importType == QmlScriptParser::Import::Library) { - url.replace(QLatin1Char('.'),QLatin1Char('/')); + url.replace(QLatin1Char('.'), QLatin1Char('/')); bool found = false; - foreach (QString p, importPath) { - QString dir = p+QLatin1Char('/')+url; + QString content; + QString dir; + QStringList paths = importPath; + paths.prepend(QFileInfo(base.toLocalFile()).path()); + foreach (const QString &p, paths) { + dir = p+QLatin1Char('/')+url; QFileInfo fi(dir+QLatin1String("/qmldir")); + const QString absoluteFilePath = fi.absoluteFilePath(); + if (fi.isFile()) { - url = QUrl::fromLocalFile(fi.absolutePath()).toString(); found = true; + + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); + + QFile file(absoluteFilePath); + if (file.open(QFile::ReadOnly)) + content = QString::fromUtf8(file.readAll()); + + if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) { + qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath); + + QmlDirParser qmldirParser; + qmldirParser.setSource(content); + qmldirParser.parse(); + + foreach (const QmlDirParser::Plugin &plugin, qmldirParser.plugins()) { + const QFileInfo pluginFileInfo(dir + QDir::separator() + plugin.path, plugin.name); + const QString pluginFilePath = pluginFileInfo.absoluteFilePath(); + engine->importExtension(pluginFilePath, uri); + } + } + break; } } - QFactoryLoader *l = loader(); - QmlModuleFactoryInterface *factory = - qobject_cast(l->instance(uri)); - if (factory) { - factory->defineModuleOnce(uri); - } + } else { url = base.resolved(QUrl(url)).toString(); } + s->uris.prepend(uri); s->urls.prepend(url); s->majversions.prepend(vmaj); @@ -1546,12 +1568,12 @@ void QmlEngine::addImportPath(const QString& path) \sa QmlExtensionInterface */ -bool QmlEngine::importExtension(const QString &fileName) +bool QmlEngine::importExtension(const QString &fileName, const QString &uri) { QPluginLoader loader(fileName); if (QmlExtensionInterface *iface = qobject_cast(loader.instance())) { - iface->initialize(this); + iface->initialize(this, uri); return true; } @@ -1604,7 +1626,8 @@ QString QmlEngine::offlineStoragePath() const */ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const { - bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath); + QmlEngine *engine = QmlEnginePrivate::get(const_cast(this)); + bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath, engine); if (qmlImportTrace()) qDebug() << "QmlEngine::addToImport(" << imports << uri << prefix << vmaj << '.' << vmin << (importType==QmlScriptParser::Import::Library? "Library" : "File") << ": " << ok; return ok; diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index 13a67b0..dd2012a 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -78,7 +78,7 @@ public: void clearComponentCache(); void addImportPath(const QString& dir); - bool importExtension(const QString &fileName); + bool importExtension(const QString &fileName, const QString &uri); void setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *); QmlNetworkAccessManagerFactory *networkAccessManagerFactory() const; diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 3fe7991..d916286 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -263,6 +263,7 @@ public: QmlImportsPrivate *d; }; + bool addToImport(Imports*, const QString& qmlDirContent,const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const; bool resolveType(const Imports&, const QByteArray& type, QmlType** type_return, QUrl* url_return, diff --git a/src/declarative/qml/qmlextensioninterface.h b/src/declarative/qml/qmlextensioninterface.h index d37a5bc..cbdd34c 100644 --- a/src/declarative/qml/qmlextensioninterface.h +++ b/src/declarative/qml/qmlextensioninterface.h @@ -54,7 +54,7 @@ class QmlEngine; struct Q_DECLARATIVE_EXPORT QmlExtensionInterface { - virtual void initialize(QmlEngine *engine) = 0; + virtual void initialize(QmlEngine *engine, const QString &uri) = 0; }; Q_DECLARE_INTERFACE(QmlExtensionInterface, "com.trolltech.Qt.QmlExtensionInterface/1.0") diff --git a/src/declarative/qml/qmlextensionplugin.h b/src/declarative/qml/qmlextensionplugin.h index eda7d0c..82553e7 100644 --- a/src/declarative/qml/qmlextensionplugin.h +++ b/src/declarative/qml/qmlextensionplugin.h @@ -62,7 +62,7 @@ public: explicit QmlExtensionPlugin(QObject *parent = 0); ~QmlExtensionPlugin(); - virtual void initialize(QmlEngine *engine) = 0; + virtual void initialize(QmlEngine *engine, const QString &uri) = 0; }; QT_END_NAMESPACE -- cgit v0.12 From bab4c3056c11ba3607acce3314ecfe172d00cf96 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 22 Feb 2010 17:59:59 +0100 Subject: Fix memory leak when lazily binding QScriptValue to an engine Avoid the engine's list of free script values from growing without bounds. When a QScriptValue is initially not bound, its private will be allocated from the normal heap (and not from the engine's pool of privates, because there is no engine at this point). But when a value is later bound (e.g. by setting it as a property of an object, or by passing it as argument to QScriptValue::call()) and is subsequently destroyed, its private will be handed to the engine, which will add it to its free-list (hence the memory is not freed). This allocation/deallocation asymmetry causes this list go keep growing. The solution is to limit the size of the free-list, and free the memory of the private immediately when the list has reached a certain size. Task-number: QTBUG-8400 Reviewed-by: Olivier Goffart --- src/script/api/qscriptengine.cpp | 2 +- src/script/api/qscriptengine_p.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 1bd7377..1199263 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -768,7 +768,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng) } // namespace QScript QScriptEnginePrivate::QScriptEnginePrivate() - : registeredScriptValues(0), freeScriptValues(0), + : registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0), registeredScriptStrings(0), inEval(false) { qMetaTypeId(); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 6780b2c..401d6d2 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -255,6 +255,8 @@ public: int agentLineNumber; QScriptValuePrivate *registeredScriptValues; QScriptValuePrivate *freeScriptValues; + static const int maxFreeScriptValues = 256; + int freeScriptValuesCount; QScriptStringPrivate *registeredScriptStrings; QHash m_typeInfos; int processEventsInterval; @@ -377,6 +379,7 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz if (freeScriptValues) { QScriptValuePrivate *p = freeScriptValues; freeScriptValues = p->next; + --freeScriptValuesCount; return p; } return reinterpret_cast(qMalloc(size)); @@ -384,8 +387,13 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p) { - p->next = freeScriptValues; - freeScriptValues = p; + if (freeScriptValuesCount < maxFreeScriptValues) { + p->next = freeScriptValues; + freeScriptValues = p; + ++freeScriptValuesCount; + } else { + qFree(p); + } } inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value) -- cgit v0.12 From 8597e03495f54614e53c6063f1f13077a08109fd Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 23 Feb 2010 08:46:27 +1000 Subject: Improve performance of VGPath creation by reusing the same path The vgClearPath() function can be used to clear a path for reuse more efficiently than destroying the path and creating a new one. Task-number: QT-2974 Reviewed-by: Daniel Pope --- src/openvg/qpaintengine_vg.cpp | 124 ++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 57 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index da47f06..4192dbb 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -131,8 +131,9 @@ public: void draw(VGPath path, const QPen& pen, const QBrush& brush, VGint rule = VG_EVEN_ODD); void stroke(VGPath path, const QPen& pen); void fill(VGPath path, const QBrush& brush, VGint rule = VG_EVEN_ODD); - VGPath vectorPathToVGPath(const QVectorPath& path); - VGPath painterPathToVGPath(const QPainterPath& path); + inline void releasePath(VGPath path); + VGPath vectorPathToVGPath(const QVectorPath& path, bool forceNewPath = false); + VGPath painterPathToVGPath(const QPainterPath& path, bool forceNewPath = false); VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode); VGPaintType setBrush (VGPaint paint, const QBrush& brush, VGMatrixMode mode, @@ -178,6 +179,8 @@ public: VGPath roundRectPath; // Cached path for quick drawing of rounded rects. #endif + VGPath reusablePath; // Reusable path for vectorPathToVGPath(), etc. + QTransform transform; // Currently active transform. bool simpleTransform; // True if the transform is simple (non-projective). qreal penScale; // Pen scaling factor from "transform". @@ -350,6 +353,8 @@ void QVGPaintEnginePrivate::init() roundRectPath = 0; #endif + reusablePath = 0; + simpleTransform = true; pathTransformSet = false; penScale = 1.0; @@ -446,6 +451,15 @@ void QVGPaintEnginePrivate::initObjects() VG_PATH_CAPABILITY_ALL); vgAppendPathData(linePath, 2, segments, coords); #endif + + // This path can be reused over and over by calling vgClearPath(). + reusablePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + 32 + 1, // segmentCapacityHint + 32 * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); } void QVGPaintEnginePrivate::destroy() @@ -465,6 +479,8 @@ void QVGPaintEnginePrivate::destroy() if (roundRectPath) vgDestroyPath(roundRectPath); #endif + if (reusablePath) + vgDestroyPath(reusablePath); #if !defined(QVG_NO_DRAW_GLYPHS) QVGFontCache::Iterator it; @@ -541,19 +557,32 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) qt_scaleForTransform(transform, &penScale); } -VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) +inline void QVGPaintEnginePrivate::releasePath(VGPath path) +{ + if (path == reusablePath) + vgClearPath(path, VG_PATH_CAPABILITY_ALL); + else + vgDestroyPath(path); +} + +VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path, bool forceNewPath) { int count = path.elementCount(); const qreal *points = path.points(); const QPainterPath::ElementType *elements = path.elements(); - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath; + if (forceNewPath) { + vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + count + 1, // segmentCapacityHint + count * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); + } else { + vgpath = reusablePath; + } // Size is sufficient segments for drawRoundedRect() paths. QVarLengthArray segments; @@ -725,17 +754,22 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) return vgpath; } -VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) +VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path, bool forceNewPath) { int count = path.elementCount(); - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath; + if (forceNewPath) { + vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F, + 1.0f, // scale + 0.0f, // bias + count + 1, // segmentCapacityHint + count * 2, // coordCapacityHint + VG_PATH_CAPABILITY_ALL); + } else { + vgpath = reusablePath; + } if (count == 0) return vgpath; @@ -954,13 +988,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius, vgModifyPathCoords(vgpath, 0, 9, pts); } #else - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 10, // segmentCapacityHint - 17 * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath vgpath = reusablePath; vgAppendPathData(vgpath, 10, roundedrect_types, pts); #endif @@ -1516,7 +1544,7 @@ void QVGPaintEngine::draw(const QVectorPath &path) d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); else d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) @@ -1527,7 +1555,7 @@ void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) d->fill(vgpath, brush, VG_EVEN_ODD); else d->fill(vgpath, brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) @@ -1535,7 +1563,7 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) Q_D(QVGPaintEngine); VGPath vgpath = d->vectorPathToVGPath(path); d->stroke(vgpath, pen); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } // Determine if a co-ordinate transform is simple enough to allow @@ -1731,7 +1759,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) default: break; } - vgDestroyPath(vgpath); + d->releasePath(vgpath); vgSeti(VG_MASKING, VG_TRUE); d->maskValid = true; @@ -2048,7 +2076,7 @@ void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) default: break; } - vgDestroyPath(vgpath); + d->releasePath(vgpath); vgSeti(VG_MASKING, VG_TRUE); d->maskValid = true; @@ -2487,7 +2515,7 @@ void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); d->draw(vgpath, s->pen, s->brush); #if defined(QVG_NO_MODIFY_PATH) - vgDestroyPath(vgpath); + d->releasePath(vgpath); #endif } else { QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode); @@ -2636,13 +2664,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) Q_D(QVGPaintEngine); if (d->simpleTransform) { QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 4, // segmentCapacityHint - 12, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; static VGubyte segments[4] = { VG_MOVE_TO_ABS, VG_SCCWARC_TO_REL, @@ -2666,7 +2688,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) coords[11] = 0.0f; vgAppendPathData(path, 4, segments, coords); d->draw(path, s->pen, s->brush); - vgDestroyPath(path); + d->releasePath(path); } else { // The projective transform version of an ellipse is difficult. // Generate a QVectorPath containing cubic curves and transform that. @@ -2690,7 +2712,7 @@ void QVGPaintEngine::drawPath(const QPainterPath &path) d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); else d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); + d->releasePath(vgpath); } void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) @@ -2765,13 +2787,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD { Q_D(QVGPaintEngine); QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { @@ -2805,20 +2821,14 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD d->draw(path, s->pen, s->brush, VG_EVEN_ODD); break; } - vgDestroyPath(path); + d->releasePath(path); } void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { Q_D(QVGPaintEngine); QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); + VGPath path = d->reusablePath; QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { @@ -2852,7 +2862,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr d->draw(path, s->pen, s->brush, VG_EVEN_ODD); break; } - vgDestroyPath(path); + d->releasePath(path); } void QVGPaintEnginePrivate::setImageOptions() @@ -3251,7 +3261,7 @@ void QVGFontGlyphCache::cacheGlyphs ti.fontEngine->getUnscaledGlyph(glyph, &path, &metrics); VGPath vgPath; if (!path.isEmpty()) { - vgPath = d->painterPathToVGPath(path); + vgPath = d->painterPathToVGPath(path, true); } else { // Probably a "space" character with no visible outline. vgPath = VG_INVALID_HANDLE; -- cgit v0.12 From f91f64ee2d0caa86b004bf3653f286116681fa3d Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 23 Feb 2010 10:24:22 +1000 Subject: Updates to low-level audio documentation. Detail state changes and error states in QAudioInput and QAudioOutput documentation. Reviewed-by: Derick Hawcroft --- src/multimedia/audio/qaudioinput.cpp | 74 +++++++++++++++------------------ src/multimedia/audio/qaudiooutput.cpp | 78 +++++++++++++++-------------------- 2 files changed, 66 insertions(+), 86 deletions(-) diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 45cafc1..fd892dd 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -190,18 +190,18 @@ QAudioInput::~QAudioInput() Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. + If able to successfully get audio data from the systems audio device the + state() is set to either QAudio::ActiveState or QAudio::IdleState, + error() is set to QAudio::NoError and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ void QAudioInput::start(QIODevice* device) { - /* - -If currently not StoppedState, stop - -If previous start was push mode, delete internal QIODevice. - -open audio input. - If ok, NoError and ActiveState, else OpenError and StoppedState. - -emit stateChanged() - */ d->start(device); } @@ -210,19 +210,18 @@ void QAudioInput::start(QIODevice* device) transfer. This QIODevice can be used to read() audio data directly. + If able to access the systems audio device the state() is set to + QAudio::IdleState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ QIODevice* QAudioInput::start() { - /* - -If currently not StoppedState, stop - -If no internal QIODevice, create one. - -open audio input. - -If ok, NoError and IdleState, else OpenError and StoppedState - -emit stateChanged() - -return internal QIODevice - */ return d->start(0); } @@ -236,17 +235,14 @@ QAudioFormat QAudioInput::format() const } /*! - Stops the audio input. + Stops the audio input, detaching from the system resource. + + Sets error() to QAudio::NoError, state() to QAudio::StoppedState and + emit stateChanged() signal. */ void QAudioInput::stop() { - /* - -If StoppedState, return - -set to StoppedState - -detach from audio device - -emit stateChanged() - */ d->stop(); } @@ -256,42 +252,32 @@ void QAudioInput::stop() void QAudioInput::reset() { - /* - -drop all buffered audio, set buffers to zero. - -call stop() - */ d->reset(); } /*! Stops processing audio data, preserving buffered audio data. + + Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and + emit stateChanged() signal. */ void QAudioInput::suspend() { - /* - -If not ActiveState|IdleState, return - -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState - -emit stateChanged() - */ d->suspend(); } /*! Resumes processing audio data after a suspend(). + + Sets error() to QAudio::NoError. + Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). + Sets state() to QAudio::IdleState if you previously called start(). + emits stateChanged() signal. */ void QAudioInput::resume() { - /* - -If SuspendedState, return - -resume audio - -(PULL MODE): set ActiveState, NoError - -(PUSH MODE): set IdleState, NoError - -kick start audio if needed - -emit stateChanged() - */ d->resume(); } @@ -327,6 +313,9 @@ int QAudioInput::bufferSize() const /*! Returns the amount of audio data available to read in bytes. + + NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState + state, otherwise returns zero. */ int QAudioInput::bytesReady() const @@ -352,7 +341,10 @@ int QAudioInput::periodSize() const /*! Sets the interval for notify() signal to be emitted. This is based on the \a ms of audio data processed - not on actual real-time. The resolution of the timer is platform specific. + not on actual real-time. + The minimum resolution of the timer is platform specific and values + should be checked with notifyInterval() to confirm actual value + being used. */ void QAudioInput::setNotifyInterval(int ms) diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index afd8a84..b0b5244 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -202,18 +202,18 @@ QAudioFormat QAudioOutput::format() const Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. + If able to successfully output audio data to the systems audio device the + state() is set to QAudio::ActiveState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ void QAudioOutput::start(QIODevice* device) { - /* - -If currently not StoppedState, stop. - -If previous start was push mode, delete internal QIODevice. - -open audio output. - -If ok, NoError and ActiveState, else OpenError and StoppedState - -emit stateChanged() - */ d->start(device); } @@ -221,34 +221,30 @@ void QAudioOutput::start(QIODevice* device) Returns a pointer to the QIODevice being used to handle the data transfer. This QIODevice can be used to write() audio data directly. + If able to access the systems audio device the state() is set to + QAudio::IdleState, error() is set to QAudio::NoError + and the stateChanged() signal is emitted. + + If a problem occurs during this process the error() is set to QAudio::OpenError, + state() is set to QAudio::StoppedState and stateChanged() signal is emitted. + \sa QIODevice */ QIODevice* QAudioOutput::start() { - /* - -If currently not StoppedState, stop. - -If no internal QIODevice, create one. - -open audio output. - -If ok, NoError and IdleState, else OpenError and StoppedState - -emit stateChanged() - -return internal QIODevice - */ return d->start(0); } /*! - Stops the audio output. + Stops the audio output, detaching from the system resource. + + Sets error() to QAudio::NoError, state() to QAudio::StoppedState and + emit stateChanged() signal. */ void QAudioOutput::stop() { - /* - -If StoppedState, return - -set to StoppedState - -detach from audio device - -emit stateChanged() - */ d->stop(); } @@ -258,55 +254,44 @@ void QAudioOutput::stop() void QAudioOutput::reset() { - /* - -drop all buffered audio, set buffers to zero. - -call stop() - */ d->reset(); } /*! Stops processing audio data, preserving buffered audio data. + + Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and + emit stateChanged() signal. */ void QAudioOutput::suspend() { - /* - -If not ActiveState|IdleState, return - -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState - -emit stateChanged() - */ d->suspend(); } /*! Resumes processing audio data after a suspend(). + + Sets error() to QAudio::NoError. + Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). + Sets state() to QAudio::IdleState if you previously called start(). + emits stateChanged() signal. */ void QAudioOutput::resume() { - /* - -If SuspendedState, return - -resume audio - -(PULL MODE): set ActiveState, NoError - -(PUSH MODE): set IdleState, NoError - -kick start audio if needed - -emit stateChanged() - */ d->resume(); } /*! Returns the free space available in bytes in the audio buffer. + + NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState + state, otherwise returns zero. */ int QAudioOutput::bytesFree() const { - /* - -If not ActiveState|IdleState, return 0 - -return space available in audio buffer in bytes - */ return d->bytesFree(); } @@ -353,7 +338,10 @@ int QAudioOutput::bufferSize() const /*! Sets the interval for notify() signal to be emitted. This is based on the \a ms of audio data processed - not on actual real-time. The resolution of the timer is platform specific. + not on actual real-time. + The minimum resolution of the timer is platform specific and values + should be checked with notifyInterval() to confirm actual value + being used. */ void QAudioOutput::setNotifyInterval(int ms) -- cgit v0.12 From a2c998ecdabda8635151d0dcd29ba69354ab20ec Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 23 Feb 2010 10:50:58 +1000 Subject: Test bug QTBUG-5974 --- tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index e70c7f1..8513a3b 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -249,6 +249,10 @@ void tst_QmlListModel::static_types_data() QTest::newRow("bool") << "ListElement { foo: true }" << QVariant(true); + + QTest::newRow("enum") + << "ListElement { foo: Text.AlignHCenter }" + << QVariant("QTBUG-5974:ListElement: constant script support for property value"); } void tst_QmlListModel::static_types() @@ -262,6 +266,10 @@ void tst_QmlListModel::static_types() QmlComponent component(&engine); component.setData(qml.toUtf8(), QUrl::fromLocalFile(QString("dummy.qml"))); + + if (value.toString().startsWith("QTBUG-")) + QEXPECT_FAIL("",value.toString().toLatin1(),Abort); + QVERIFY(!component.isError()); QmlListModel *obj = qobject_cast(component.create()); @@ -301,7 +309,7 @@ void tst_QmlListModel::error_data() QTest::newRow("bindings not allowed in ListElement") << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" - << "ListElement: cannot use script for property value"; + << "ListElement: cannot use script for property value"; // but note QTBUG-5974 QTest::newRow("random object list properties allowed in ListElement") << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" -- cgit v0.12 From d7c472e23b678b2898d34a37166e61402818e271 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 23 Feb 2010 11:35:38 +1000 Subject: run qmlmoduleplugin test --- tests/auto/declarative/declarative.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index b4a0d0f..45b5218 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -44,6 +44,7 @@ SUBDIRS += \ qmllistmodel \ # Cover qmlmetaproperty \ # Cover qmlmetatype \ # Cover + qmlmoduleplugin \ # Cover qmlnumberformatter \ # Cover qmlpixmapcache \ # Cover qmlpropertymap \ # Cover -- cgit v0.12 From ce78e4124d57a3c517e6de88696a09ad399c703f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 11:08:37 +1000 Subject: Add documentation on QMLs memory management assumptions --- doc/src/declarative/extending.qdoc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 0456f3f..d3e6c14 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -375,6 +375,37 @@ object will only be returned if it has previously been created. \l {Extending QML - Attached Properties Example} shows the complete code used to implement the rsvp attached property. +\section1 Memory Management and QVariant types + +It is an elements responsibility to ensure that it does not access or return +pointers to invalid objects. QML makes the following guarentees: + +\list +\o An object assigned to an QObject (or QObject-derived) pointer property will be +valid at the time of assignment. + +Following assignment, it is the responsibility of the class to subsequently guard +this pointer, either through a class specific method or the generic QPointer class. + +\o An object assigned to a QVariant will be valid at the time of assignment. + +When assigning an object to a QVariant property, QML will always use a QMetaType::QObjectStar +typed QVariant. It is the responsibility of the class to guard the pointer. A +general rule when writing a class that uses QVariant properties is to check the +type of the QVariant when it is set and if the type is not handled by your class, +reset it to an invalid variant. + +\o An object assigned to a QObject (or QObject-derived) list property will be +valid at the time of assignment. + +Following assignment, it is the responsibility of the class to subsequently guard +this pointer, either through a class specific method or the generic QPointer class. +\endlist + +Elements should assume that any QML assigned object can be deleted at any time, and +respond accordingly. If documented as such an element need not continue to work in +this situation, but it must not crash. + \section1 Signal Support \snippet examples/declarative/extending/signal/example.qml 0 -- cgit v0.12 From c41f7c7a4dbb2ac0c76e20628aaedeabec6f4497 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 22 Feb 2010 17:26:20 +1000 Subject: Better support modelData for object list models. modelData will now correctly return the actual object. --- src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index b96f399..9216793 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -415,7 +415,7 @@ int QmlGraphicsVisualDataModelDataMetaObject::createProperty(const char *name, c if (model->m_listAccessor->type() == QmlListAccessor::ListProperty) { model->ensureRoles(); QObject *object = model->m_listAccessor->at(data->m_index).value(); - if (object && object->property(name).isValid()) + if (object && (object->property(name).isValid() || qstrcmp(name,"modelData")==0)) return QmlOpenMetaObject::createProperty(name, type); } } -- cgit v0.12 From 5955a7bd3bcef20558238e2de0c66fac9eccdf57 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 12:41:24 +1000 Subject: Small QmlMetaProperty code cleanup --- src/declarative/qml/qmlmetaproperty.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 7c273dc..332d126 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -811,22 +811,22 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data return writeEnumProperty(prop, coreIdx, object, v, flags); } - int t = property.propType; - int vt = value.userType(); + int propertyType = property.propType; + int variantType = value.userType(); QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(context); - if (t == QVariant::Url) { + if (propertyType == QVariant::Url) { QUrl u; bool found = false; - if (vt == QVariant::Url) { + if (variantType == QVariant::Url) { u = value.toUrl(); found = true; - } else if (vt == QVariant::ByteArray) { + } else if (variantType == QVariant::ByteArray) { u = QUrl(QString::fromUtf8(value.toByteArray())); found = true; - } else if (vt == QVariant::String) { + } else if (variantType == QVariant::String) { u = QUrl(value.toString()); found = true; } @@ -840,12 +840,12 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data void *argv[] = { &u, 0, &status, &flags }; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv); - } else if (vt == t) { + } else if (variantType == propertyType) { void *a[] = { (void *)value.constData(), 0, &status, &flags }; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); - } else if (qMetaTypeId() == t) { + } else if (qMetaTypeId() == propertyType) { void *a[] = { (void *)&value, 0, &status, &flags }; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); @@ -858,7 +858,7 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data return false; QObject *o = *(QObject **)value.constData(); - const QMetaObject *propMo = rawMetaObjectForType(enginePriv, t); + const QMetaObject *propMo = rawMetaObjectForType(enginePriv, propertyType); if (o) valMo = o->metaObject(); @@ -914,25 +914,25 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data } } else { - Q_ASSERT(vt != t); + Q_ASSERT(variantType != propertyType); QVariant v = value; - if (v.convert((QVariant::Type)t)) { + if (v.convert((QVariant::Type)propertyType)) { void *a[] = { (void *)v.constData(), 0, &status, &flags}; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); - } else if ((uint)t >= QVariant::UserType && vt == QVariant::String) { - QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(t); + } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) { + QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(propertyType); if (!con) return false; QVariant v = con(value.toString()); - if (v.userType() == t) { + if (v.userType() == propertyType) { void *a[] = { (void *)v.constData(), 0, &status, &flags}; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } - } else if (vt == QVariant::String) { + } else if (variantType == QVariant::String) { bool ok = false; - QVariant v = QmlStringConverters::variantFromString(value.toString(), t, &ok); + QVariant v = QmlStringConverters::variantFromString(value.toString(), propertyType, &ok); if (!ok) return false; -- cgit v0.12 From 0bc70bc54e1e67468db1dd11ec4fad3a178768c3 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 12:45:21 +1000 Subject: Rename qmllist autotest to qmllistreference --- tests/auto/declarative/declarative.pro | 2 +- tests/auto/declarative/qmllist/data/MyType.qml | 5 - .../auto/declarative/qmllist/data/engineTypes.qml | 9 - .../declarative/qmllist/data/variantToList.qml | 10 - tests/auto/declarative/qmllist/qmllist.pro | 5 - tests/auto/declarative/qmllist/tst_qmllist.cpp | 574 --------------------- .../declarative/qmllistreference/data/MyType.qml | 5 + .../qmllistreference/data/engineTypes.qml | 9 + .../qmllistreference/data/variantToList.qml | 10 + .../qmllistreference/qmllistreference.pro | 5 + .../qmllistreference/tst_qmllistreference.cpp | 574 +++++++++++++++++++++ 11 files changed, 604 insertions(+), 604 deletions(-) delete mode 100644 tests/auto/declarative/qmllist/data/MyType.qml delete mode 100644 tests/auto/declarative/qmllist/data/engineTypes.qml delete mode 100644 tests/auto/declarative/qmllist/data/variantToList.qml delete mode 100644 tests/auto/declarative/qmllist/qmllist.pro delete mode 100644 tests/auto/declarative/qmllist/tst_qmllist.cpp create mode 100644 tests/auto/declarative/qmllistreference/data/MyType.qml create mode 100644 tests/auto/declarative/qmllistreference/data/engineTypes.qml create mode 100644 tests/auto/declarative/qmllistreference/data/variantToList.qml create mode 100644 tests/auto/declarative/qmllistreference/qmllistreference.pro create mode 100644 tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 645f794..870c92b 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -39,7 +39,7 @@ SUBDIRS += \ qmlinfo \ # Cover qmlinstruction \ # Cover qmllanguage \ # Cover - qmllist \ # Cover + qmllistreference \ # Cover qmllistmodel \ # Cover qmlmetaproperty \ # Cover qmlmetatype \ # Cover diff --git a/tests/auto/declarative/qmllist/data/MyType.qml b/tests/auto/declarative/qmllist/data/MyType.qml deleted file mode 100644 index d08f35b..0000000 --- a/tests/auto/declarative/qmllist/data/MyType.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.6 - -QtObject { - property int a -} diff --git a/tests/auto/declarative/qmllist/data/engineTypes.qml b/tests/auto/declarative/qmllist/data/engineTypes.qml deleted file mode 100644 index 670aee4..0000000 --- a/tests/auto/declarative/qmllist/data/engineTypes.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - property list myList - - myList: [ MyType { a: 1 }, - MyType { a: 9 } ] - -} diff --git a/tests/auto/declarative/qmllist/data/variantToList.qml b/tests/auto/declarative/qmllist/data/variantToList.qml deleted file mode 100644 index 0c2d0aa..0000000 --- a/tests/auto/declarative/qmllist/data/variantToList.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Qt 4.6 - -QtObject { - property list myList; - myList: QtObject {} - - property var value: myList - property int test: value.length -} - diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro deleted file mode 100644 index b2145ed..0000000 --- a/tests/auto/declarative/qmllist/qmllist.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmllist.cpp diff --git a/tests/auto/declarative/qmllist/tst_qmllist.cpp b/tests/auto/declarative/qmllist/tst_qmllist.cpp deleted file mode 100644 index 76def1c..0000000 --- a/tests/auto/declarative/qmllist/tst_qmllist.cpp +++ /dev/null @@ -1,574 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -inline QUrl TEST_FILE(const QString &filename) -{ - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); -} - -inline QUrl TEST_FILE(const char *filename) -{ - return TEST_FILE(QLatin1String(filename)); -} - -class tst_QmlList : public QObject -{ - Q_OBJECT -public: - tst_QmlList() {} - -private slots: - void qmllistreference(); - void qmllistreference_invalid(); - void isValid(); - void object(); - void listElementType(); - void canAppend(); - void canAt(); - void canClear(); - void canCount(); - void append(); - void at(); - void clear(); - void count(); - void copy(); - void qmlmetaproperty(); - void engineTypes(); - void variantToList(); -}; - -class TestType : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlListProperty data READ dataProperty); - Q_PROPERTY(int intProperty READ intProperty); - -public: - TestType() : property(this, data) {} - QmlListProperty dataProperty() { return property; } - int intProperty() const { return 10; } - - QList data; - QmlListProperty property; -}; -QML_DECLARE_TYPE(TestType); -QML_DEFINE_NOCREATE_TYPE(TestType); - -void tst_QmlList::qmllistreference() -{ - TestType tt; - - QmlListReference r(&tt, "data"); - QVERIFY(r.isValid() == true); - QCOMPARE(r.count(), 0); - - tt.data.append(&tt); - QCOMPARE(r.count(), 1); -} - -void tst_QmlList::qmllistreference_invalid() -{ - TestType tt; - - // Invalid - { - QmlListReference r; - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } - - // Non-property - { - QmlListReference r(&tt, "blah"); - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } - - // Non-list property - { - QmlListReference r(&tt, "intProperty"); - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } -} - -void tst_QmlList::isValid() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.isValid() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.isValid() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.isValid() == true); - delete tt; - QVERIFY(ref.isValid() == false); - } -} - -void tst_QmlList::object() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.object() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.object() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.object() == tt); - delete tt; - QVERIFY(ref.object() == 0); - } -} - -void tst_QmlList::listElementType() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.listElementType() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.listElementType() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.listElementType() == &TestType::staticMetaObject); - delete tt; - QVERIFY(ref.listElementType() == 0); - } -} - -void tst_QmlList::canAppend() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canAppend() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canAppend() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canAppend() == true); - delete tt; - QVERIFY(ref.canAppend() == false); - } - - { - TestType tt; - tt.property.append = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canAppend() == false); - } -} - -void tst_QmlList::canAt() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canAt() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canAt() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canAt() == true); - delete tt; - QVERIFY(ref.canAt() == false); - } - - { - TestType tt; - tt.property.at = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canAt() == false); - } -} - -void tst_QmlList::canClear() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canClear() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canClear() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canClear() == true); - delete tt; - QVERIFY(ref.canClear() == false); - } - - { - TestType tt; - tt.property.clear = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canClear() == false); - } -} - -void tst_QmlList::canCount() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canCount() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canCount() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canCount() == true); - delete tt; - QVERIFY(ref.canCount() == false); - } - - { - TestType tt; - tt.property.count = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canCount() == false); - } -} - -void tst_QmlList::append() -{ - TestType *tt = new TestType; - QObject object; - - { - QmlListReference ref; - QVERIFY(ref.append(tt) == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.append(tt) == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.append(tt) == true); - QVERIFY(tt->data.count() == 1); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(ref.append(&object) == false); - QVERIFY(tt->data.count() == 1); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(ref.append(0) == true); - QVERIFY(tt->data.count() == 2); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(tt->data.at(1) == 0); - delete tt; - QVERIFY(ref.append(0) == false); - } - - { - TestType tt; - tt.property.append = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.append(&tt) == false); - } -} - -void tst_QmlList::at() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.at(0) == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.at(0) == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.at(0) == tt); - QVERIFY(ref.at(1) == 0); - QVERIFY(ref.at(2) == tt); - delete tt; - QVERIFY(ref.at(0) == 0); - } - - { - TestType tt; - tt.data.append(&tt); - tt.property.at = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.at(0) == 0); - } -} - -void tst_QmlList::clear() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.clear() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.clear() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.clear() == true); - QVERIFY(tt->data.count() == 0); - delete tt; - QVERIFY(ref.clear() == false); - } - - { - TestType tt; - tt.property.clear = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.clear() == false); - } -} - -void tst_QmlList::count() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.count() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.count() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.count() == 3); - tt->data.removeAt(1); - QVERIFY(ref.count() == 2); - delete tt; - QVERIFY(ref.count() == 0); - } - - { - TestType tt; - tt.data.append(&tt); - tt.property.count = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.count() == 0); - } -} - -void tst_QmlList::copy() -{ - TestType tt; - tt.data.append(&tt); - tt.data.append(0); - tt.data.append(&tt); - - QmlListReference *r1 = new QmlListReference(&tt, "data"); - QVERIFY(r1->count() == 3); - - QmlListReference r2(*r1); - QmlListReference r3; - r3 = *r1; - - QVERIFY(r2.count() == 3); - QVERIFY(r3.count() == 3); - - delete r1; - - QVERIFY(r2.count() == 3); - QVERIFY(r3.count() == 3); - - tt.data.removeAt(2); - - QVERIFY(r2.count() == 2); - QVERIFY(r3.count() == 2); -} - -void tst_QmlList::qmlmetaproperty() -{ - TestType tt; - tt.data.append(&tt); - tt.data.append(0); - tt.data.append(&tt); - - QmlMetaProperty prop(&tt, QLatin1String("data")); - QVariant v = prop.read(); - QVERIFY(v.userType() == qMetaTypeId()); - QmlListReference ref = qvariant_cast(v); - QVERIFY(ref.count() == 3); - QVERIFY(ref.listElementType() == &TestType::staticMetaObject); -} - -void tst_QmlList::engineTypes() -{ - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("engineTypes.qml")); - - QObject *o = component.create(); - QVERIFY(o); - - QmlMetaProperty p1(o, QLatin1String("myList")); - QVERIFY(p1.propertyCategory() == QmlMetaProperty::Normal); - - QmlMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); - QVERIFY(p2.propertyCategory() == QmlMetaProperty::List); - QVariant v = p2.read(); - QVERIFY(v.userType() == qMetaTypeId()); - QmlListReference ref = qvariant_cast(v); - QVERIFY(ref.count() == 2); - QVERIFY(ref.listElementType()); - QVERIFY(ref.listElementType() != &QObject::staticMetaObject); - - delete o; -} - -void tst_QmlList::variantToList() -{ - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("variantToList.qml")); - - QObject *o = component.create(); - QVERIFY(o); - - QVERIFY(o->property("value").userType() == qMetaTypeId()); - QCOMPARE(o->property("test").toInt(), 1); - - delete o; -} - -QTEST_MAIN(tst_QmlList) - -#include "tst_qmllist.moc" diff --git a/tests/auto/declarative/qmllistreference/data/MyType.qml b/tests/auto/declarative/qmllistreference/data/MyType.qml new file mode 100644 index 0000000..d08f35b --- /dev/null +++ b/tests/auto/declarative/qmllistreference/data/MyType.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + property int a +} diff --git a/tests/auto/declarative/qmllistreference/data/engineTypes.qml b/tests/auto/declarative/qmllistreference/data/engineTypes.qml new file mode 100644 index 0000000..670aee4 --- /dev/null +++ b/tests/auto/declarative/qmllistreference/data/engineTypes.qml @@ -0,0 +1,9 @@ +import Qt 4.6 + +QtObject { + property list myList + + myList: [ MyType { a: 1 }, + MyType { a: 9 } ] + +} diff --git a/tests/auto/declarative/qmllistreference/data/variantToList.qml b/tests/auto/declarative/qmllistreference/data/variantToList.qml new file mode 100644 index 0000000..0c2d0aa --- /dev/null +++ b/tests/auto/declarative/qmllistreference/data/variantToList.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +QtObject { + property list myList; + myList: QtObject {} + + property var value: myList + property int test: value.length +} + diff --git a/tests/auto/declarative/qmllistreference/qmllistreference.pro b/tests/auto/declarative/qmllistreference/qmllistreference.pro new file mode 100644 index 0000000..fa49d5a --- /dev/null +++ b/tests/auto/declarative/qmllistreference/qmllistreference.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qmllistreference.cpp diff --git a/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp new file mode 100644 index 0000000..6122f1e --- /dev/null +++ b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp @@ -0,0 +1,574 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} + +class tst_qmllistreference : public QObject +{ + Q_OBJECT +public: + tst_qmllistreference() {} + +private slots: + void qmllistreference(); + void qmllistreference_invalid(); + void isValid(); + void object(); + void listElementType(); + void canAppend(); + void canAt(); + void canClear(); + void canCount(); + void append(); + void at(); + void clear(); + void count(); + void copy(); + void qmlmetaproperty(); + void engineTypes(); + void variantToList(); +}; + +class TestType : public QObject +{ + Q_OBJECT + Q_PROPERTY(QmlListProperty data READ dataProperty); + Q_PROPERTY(int intProperty READ intProperty); + +public: + TestType() : property(this, data) {} + QmlListProperty dataProperty() { return property; } + int intProperty() const { return 10; } + + QList data; + QmlListProperty property; +}; +QML_DECLARE_TYPE(TestType); +QML_DEFINE_NOCREATE_TYPE(TestType); + +void tst_qmllistreference::qmllistreference() +{ + TestType tt; + + QmlListReference r(&tt, "data"); + QVERIFY(r.isValid() == true); + QCOMPARE(r.count(), 0); + + tt.data.append(&tt); + QCOMPARE(r.count(), 1); +} + +void tst_qmllistreference::qmllistreference_invalid() +{ + TestType tt; + + // Invalid + { + QmlListReference r; + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } + + // Non-property + { + QmlListReference r(&tt, "blah"); + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } + + // Non-list property + { + QmlListReference r(&tt, "intProperty"); + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } +} + +void tst_qmllistreference::isValid() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.isValid() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.isValid() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.isValid() == true); + delete tt; + QVERIFY(ref.isValid() == false); + } +} + +void tst_qmllistreference::object() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.object() == 0); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.object() == 0); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.object() == tt); + delete tt; + QVERIFY(ref.object() == 0); + } +} + +void tst_qmllistreference::listElementType() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.listElementType() == 0); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.listElementType() == 0); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.listElementType() == &TestType::staticMetaObject); + delete tt; + QVERIFY(ref.listElementType() == 0); + } +} + +void tst_qmllistreference::canAppend() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.canAppend() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.canAppend() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.canAppend() == true); + delete tt; + QVERIFY(ref.canAppend() == false); + } + + { + TestType tt; + tt.property.append = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.canAppend() == false); + } +} + +void tst_qmllistreference::canAt() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.canAt() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.canAt() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.canAt() == true); + delete tt; + QVERIFY(ref.canAt() == false); + } + + { + TestType tt; + tt.property.at = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.canAt() == false); + } +} + +void tst_qmllistreference::canClear() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.canClear() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.canClear() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.canClear() == true); + delete tt; + QVERIFY(ref.canClear() == false); + } + + { + TestType tt; + tt.property.clear = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.canClear() == false); + } +} + +void tst_qmllistreference::canCount() +{ + TestType *tt = new TestType; + + { + QmlListReference ref; + QVERIFY(ref.canCount() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.canCount() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.canCount() == true); + delete tt; + QVERIFY(ref.canCount() == false); + } + + { + TestType tt; + tt.property.count = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.canCount() == false); + } +} + +void tst_qmllistreference::append() +{ + TestType *tt = new TestType; + QObject object; + + { + QmlListReference ref; + QVERIFY(ref.append(tt) == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.append(tt) == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.append(tt) == true); + QVERIFY(tt->data.count() == 1); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(ref.append(&object) == false); + QVERIFY(tt->data.count() == 1); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(ref.append(0) == true); + QVERIFY(tt->data.count() == 2); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(tt->data.at(1) == 0); + delete tt; + QVERIFY(ref.append(0) == false); + } + + { + TestType tt; + tt.property.append = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.append(&tt) == false); + } +} + +void tst_qmllistreference::at() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QmlListReference ref; + QVERIFY(ref.at(0) == 0); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.at(0) == 0); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.at(0) == tt); + QVERIFY(ref.at(1) == 0); + QVERIFY(ref.at(2) == tt); + delete tt; + QVERIFY(ref.at(0) == 0); + } + + { + TestType tt; + tt.data.append(&tt); + tt.property.at = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.at(0) == 0); + } +} + +void tst_qmllistreference::clear() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QmlListReference ref; + QVERIFY(ref.clear() == false); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.clear() == false); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.clear() == true); + QVERIFY(tt->data.count() == 0); + delete tt; + QVERIFY(ref.clear() == false); + } + + { + TestType tt; + tt.property.clear = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.clear() == false); + } +} + +void tst_qmllistreference::count() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QmlListReference ref; + QVERIFY(ref.count() == 0); + } + + { + QmlListReference ref(tt, "blah"); + QVERIFY(ref.count() == 0); + } + + { + QmlListReference ref(tt, "data"); + QVERIFY(ref.count() == 3); + tt->data.removeAt(1); + QVERIFY(ref.count() == 2); + delete tt; + QVERIFY(ref.count() == 0); + } + + { + TestType tt; + tt.data.append(&tt); + tt.property.count = 0; + QmlListReference ref(&tt, "data"); + QVERIFY(ref.count() == 0); + } +} + +void tst_qmllistreference::copy() +{ + TestType tt; + tt.data.append(&tt); + tt.data.append(0); + tt.data.append(&tt); + + QmlListReference *r1 = new QmlListReference(&tt, "data"); + QVERIFY(r1->count() == 3); + + QmlListReference r2(*r1); + QmlListReference r3; + r3 = *r1; + + QVERIFY(r2.count() == 3); + QVERIFY(r3.count() == 3); + + delete r1; + + QVERIFY(r2.count() == 3); + QVERIFY(r3.count() == 3); + + tt.data.removeAt(2); + + QVERIFY(r2.count() == 2); + QVERIFY(r3.count() == 2); +} + +void tst_qmllistreference::qmlmetaproperty() +{ + TestType tt; + tt.data.append(&tt); + tt.data.append(0); + tt.data.append(&tt); + + QmlMetaProperty prop(&tt, QLatin1String("data")); + QVariant v = prop.read(); + QVERIFY(v.userType() == qMetaTypeId()); + QmlListReference ref = qvariant_cast(v); + QVERIFY(ref.count() == 3); + QVERIFY(ref.listElementType() == &TestType::staticMetaObject); +} + +void tst_qmllistreference::engineTypes() +{ + QmlEngine engine; + QmlComponent component(&engine, TEST_FILE("engineTypes.qml")); + + QObject *o = component.create(); + QVERIFY(o); + + QmlMetaProperty p1(o, QLatin1String("myList")); + QVERIFY(p1.propertyCategory() == QmlMetaProperty::Normal); + + QmlMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); + QVERIFY(p2.propertyCategory() == QmlMetaProperty::List); + QVariant v = p2.read(); + QVERIFY(v.userType() == qMetaTypeId()); + QmlListReference ref = qvariant_cast(v); + QVERIFY(ref.count() == 2); + QVERIFY(ref.listElementType()); + QVERIFY(ref.listElementType() != &QObject::staticMetaObject); + + delete o; +} + +void tst_qmllistreference::variantToList() +{ + QmlEngine engine; + QmlComponent component(&engine, TEST_FILE("variantToList.qml")); + + QObject *o = component.create(); + QVERIFY(o); + + QVERIFY(o->property("value").userType() == qMetaTypeId()); + QCOMPARE(o->property("test").toInt(), 1); + + delete o; +} + +QTEST_MAIN(tst_qmllistreference) + +#include "tst_qmllistreference.moc" -- cgit v0.12 From c151647c01dd8034ee77a00520430cfb516a6a38 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 12:56:39 +1000 Subject: Cleanup warnings in qmlmetaproperty test --- .../qmlmetaproperty/tst_qmlmetaproperty.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index 050cd3f..b763b6e 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -129,7 +129,7 @@ void tst_qmlmetaproperty::qmlmetaproperty() { QmlMetaProperty prop; - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); QVERIFY(expression != 0); @@ -218,7 +218,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object() { QmlMetaProperty prop(&object); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); QVERIFY(expression != 0); @@ -264,7 +264,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object() { QmlMetaProperty prop(&dobject); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); @@ -319,7 +319,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string() { QmlMetaProperty prop(&object, QString("defaultProperty")); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); QVERIFY(expression != 0); @@ -365,7 +365,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string() { QmlMetaProperty prop(&dobject, QString("defaultProperty")); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); @@ -414,7 +414,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string() { QmlMetaProperty prop(&dobject, QString("onClicked")); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); @@ -468,7 +468,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_context() { QmlMetaProperty prop(&object, engine.rootContext()); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); QVERIFY(expression != 0); @@ -514,7 +514,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_context() { QmlMetaProperty prop(&dobject, engine.rootContext()); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); @@ -569,7 +569,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context() { QmlMetaProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); QVERIFY(expression != 0); @@ -615,7 +615,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context() { QmlMetaProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); @@ -664,7 +664,7 @@ void tst_qmlmetaproperty::qmlmetaproperty_object_string_context() { QmlMetaProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - QGuard binding(new QmlBinding(QString(), 0, 0)); + QGuard binding(new QmlBinding(QLatin1String("null"), 0, engine.rootContext())); binding->setTarget(prop); QVERIFY(binding != 0); QGuard expression(new QmlExpression()); -- cgit v0.12 From 23316b14f28eb1b135b6e8e90fa6fdb34dc39b59 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 13:06:22 +1000 Subject: Fix but in QmlMetaProperty assignment operator QTBUG-8166 --- src/declarative/qml/qmlmetaproperty.cpp | 2 + .../qmlmetaproperty/tst_qmlmetaproperty.cpp | 43 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 332d126..1742c43 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -378,7 +378,9 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other) d->object = other.d->object; d->isDefaultProperty = other.d->isDefaultProperty; + d->isNameCached = other.d->isNameCached; d->core = other.d->core; + d->nameCache = other.d->nameCache; d->valueType = other.d->valueType; diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index b763b6e..c289641 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -121,6 +121,7 @@ private slots: // Bugs void crashOnValueProperty(); + void copy(); private: QmlEngine engine; }; @@ -1131,6 +1132,48 @@ void tst_qmlmetaproperty::crashOnValueProperty() QCOMPARE(p.read(), QVariant(20)); } +void tst_qmlmetaproperty::copy() +{ + PropertyObject object; + + QmlMetaProperty *property = new QmlMetaProperty(&object, QLatin1String("defaultProperty")); + QCOMPARE(property->name(), QString("defaultProperty")); + QCOMPARE(property->read(), QVariant(10)); + QCOMPARE(property->type(), QmlMetaProperty::Property); + QCOMPARE(property->propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(property->propertyType(), (int)QVariant::Int); + + QmlMetaProperty p1(*property); + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QmlMetaProperty::Property); + QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QmlMetaProperty p2(&object, QLatin1String("url")); + QCOMPARE(p2.name(), QString("url")); + p2 = *property; + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QmlMetaProperty::Property); + QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); + + delete property; property = 0; + + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QmlMetaProperty::Property); + QCOMPARE(p1.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QmlMetaProperty::Property); + QCOMPARE(p2.propertyCategory(), QmlMetaProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); +} + QTEST_MAIN(tst_qmlmetaproperty) #include "tst_qmlmetaproperty.moc" -- cgit v0.12 From 04532ba052559b265b1bc85dc143d8aeeb02149f Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 23 Feb 2010 13:40:03 +1000 Subject: alsa backend for low-level audio doesn't pass new unit tests New unit tests have identified issues with alsa backend. These issues need to be resolved before new unit tests are added. * stateChanged() signal should only be emitted on change of state currently signals can be emitted multiple times. * elapsedUSecs() currently uses alsa to provide this value but this is not reliable enough and this time is reset when suspend/resuming. This is not correct operation. * for output data is being lost when input cant be read from QIODevice but cannot be written to audio sub system. Task-number:QTBUG-8440 Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_alsa_p.cpp | 121 +++++++++------------------ src/multimedia/audio/qaudiooutput_alsa_p.cpp | 64 ++++++-------- 2 files changed, 67 insertions(+), 118 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 26e46b3..6010f3c 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -217,9 +217,11 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) //set to pull mode pullMode = true; audioSource = device; + deviceState = QAudio::ActiveState; } else { //set to push mode pullMode = false; + deviceState = QAudio::IdleState; audioSource = new InputPrivate(this); audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered); } @@ -413,7 +415,6 @@ bool QAudioInputPrivate::open() timer->start(period_time*chunks/2000); errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; totalTimeValue = 0; @@ -439,7 +440,7 @@ int QAudioInputPrivate::bytesReady() const if(resuming) return period_size; - if(deviceState != QAudio::ActiveState) + if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return 0; int frames = snd_pcm_avail_update(handle); if((int)frames > (int)buffer_frames) @@ -450,8 +451,8 @@ int QAudioInputPrivate::bytesReady() const qint64 QAudioInputPrivate::read(char* data, qint64 len) { - Q_UNUSED(data) Q_UNUSED(len) + // Read in some audio data and write it to QIODevice, pull mode if ( !handle ) return 0; @@ -468,7 +469,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if (readFrames >= 0) { err = snd_pcm_frames_to_bytes(handle, readFrames); #ifdef DEBUG_AUDIO - qDebug()< 0) { // got some send it onward #ifdef DEBUG_AUDIO - qDebug()<<"PULL: frames to write to QIODevice = "<< + qDebug()<<"frames to write to QIODevice = "<< snd_pcm_bytes_to_frames( handle, (int)err )<<" ("<write(audioBuffer,err); + if(l < 0) { + close(); + errorState = QAudio::IOError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + } else if(l == 0) { + if (deviceState != QAudio::IdleState) { + errorState = QAudio::NoError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } + } else { + totalTimeValue += err; + resuming = false; + if (deviceState != QAudio::ActiveState) { + errorState = QAudio::NoError; + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } + } + return l; - qint64 l = audioSource->write(audioBuffer,err); - if(l < 0) { - close(); - errorState = QAudio::IOError; - deviceState = QAudio::StoppedState; - emit stateChanged(deviceState); - } else if(l == 0) { - errorState = QAudio::NoError; - deviceState = QAudio::IdleState; } else { - totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.frequency(); + memcpy(data,audioBuffer,err); + totalTimeValue += err; resuming = false; - errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + errorState = QAudio::NoError; + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } + return err; } - return l; } return 0; } @@ -569,7 +588,7 @@ int QAudioInputPrivate::notifyInterval() const qint64 QAudioInputPrivate::processedUSecs() const { - return totalTimeValue; + return qint64(1000000) * totalTimeValue / settings.frequency(); } void QAudioInputPrivate::suspend() @@ -617,34 +636,10 @@ bool QAudioInputPrivate::deviceReady() qint64 QAudioInputPrivate::elapsedUSecs() const { - if(!handle) - return 0; - if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - snd_pcm_status_t* status; - snd_pcm_status_alloca(&status); - - snd_timestamp_t t1,t2; - if( snd_pcm_status(handle, status) >= 0) { - snd_pcm_status_get_tstamp(status,&t1); - snd_pcm_status_get_trigger_tstamp(status,&t2); - t1.tv_sec-=t2.tv_sec; - - signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec; - if(l < 0) { - t1.tv_sec--; - l = -l; - l %= 1000000; - } - return ((t1.tv_sec * 1000000)+l); - } else - return 0; -#else return clockStamp.elapsed()*1000; -#endif } void QAudioInputPrivate::reset() @@ -670,43 +665,7 @@ InputPrivate::~InputPrivate() qint64 InputPrivate::readData( char* data, qint64 len) { - // push mode, user read() called - if((audioDevice->state() != QAudio::ActiveState) && !audioDevice->resuming) - return 0; - - int readFrames; - int count=0, err = 0; - - while(count < 5) { - int frames = snd_pcm_bytes_to_frames(audioDevice->handle, len); - readFrames = snd_pcm_readi(audioDevice->handle, data, frames); - if (readFrames >= 0) { - err = snd_pcm_frames_to_bytes(audioDevice->handle, readFrames); -#ifdef DEBUG_AUDIO - qDebug()<errorState = QAudio::IOError; - err = 0; - break; - } else { - if(readFrames == -EPIPE) { - audioDevice->errorState = QAudio::UnderrunError; - err = snd_pcm_prepare(audioDevice->handle); - } else if(readFrames == -ESTRPIPE) { - err = snd_pcm_prepare(audioDevice->handle); - } - if(err != 0) break; - } - count++; - } - if(err > 0 && readFrames > 0) { - audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.frequency()*1000; - audioDevice->deviceState = QAudio::ActiveState; - return err; - } - return 0; + return audioDevice->read(data,len); } qint64 InputPrivate::writeData(const char* data, qint64 len) diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 7b89cef..b127103 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -259,6 +259,7 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StoppedState) return; + errorState = QAudio::NoError; deviceState = QAudio::StoppedState; close(); emit stateChanged(deviceState); @@ -494,10 +495,13 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) err = snd_pcm_writei( handle, data, frames ); } if(err > 0) { - totalTimeValue += err*1000000/settings.frequency(); + totalTimeValue += err; resuming = false; errorState = QAudio::NoError; - deviceState = QAudio::ActiveState; + if (deviceState != QAudio::ActiveState) { + deviceState = QAudio::ActiveState; + emit stateChanged(deviceState); + } return snd_pcm_frames_to_bytes( handle, err ); } else err = xrun_recovery(err); @@ -542,7 +546,7 @@ int QAudioOutputPrivate::notifyInterval() const qint64 QAudioOutputPrivate::processedUSecs() const { - return totalTimeValue; + return qint64(1000000) * totalTimeValue / settings.frequency(); } void QAudioOutputPrivate::resume() @@ -562,10 +566,8 @@ void QAudioOutputPrivate::resume() bytesAvailable = (int)snd_pcm_frames_to_bytes(handle, buffer_frames); } resuming = true; - if(pullMode) - deviceState = QAudio::ActiveState; - else - deviceState = QAudio::IdleState; + + deviceState = QAudio::ActiveState; errorState = QAudio::NoError; timer->start(period_time/1000); @@ -637,7 +639,9 @@ bool QAudioOutputPrivate::deviceReady() // Got some data to output if(deviceState != QAudio::ActiveState) return true; - write(audioBuffer,l); + qint64 bytesWritten = write(audioBuffer,l); + if (bytesWritten != l) + audioSource->seek(audioSource->pos()-(l-bytesWritten)); bytesAvailable = bytesFree(); } else if(l == 0) { @@ -645,9 +649,11 @@ bool QAudioOutputPrivate::deviceReady() bytesAvailable = bytesFree(); if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { // Underrun - errorState = QAudio::UnderrunError; - deviceState = QAudio::IdleState; - emit stateChanged(deviceState); + if (deviceState != QAudio::IdleState) { + errorState = QAudio::UnderrunError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } } } else if(l < 0) { @@ -655,8 +661,17 @@ bool QAudioOutputPrivate::deviceReady() errorState = QAudio::IOError; emit stateChanged(deviceState); } - } else + } else { bytesAvailable = bytesFree(); + if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) { + // Underrun + if (deviceState != QAudio::IdleState) { + errorState = QAudio::UnderrunError; + deviceState = QAudio::IdleState; + emit stateChanged(deviceState); + } + } + } if(deviceState != QAudio::ActiveState) return true; @@ -671,35 +686,10 @@ bool QAudioOutputPrivate::deviceReady() qint64 QAudioOutputPrivate::elapsedUSecs() const { - if(!handle) - return 0; - if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - snd_pcm_status_t* status; - snd_pcm_status_alloca(&status); - - snd_timestamp_t t1,t2; - if( snd_pcm_status(handle, status) >= 0) { - snd_pcm_status_get_tstamp(status,&t1); - snd_pcm_status_get_trigger_tstamp(status,&t2); - t1.tv_sec-=t2.tv_sec; - - signed long l = (signed long)t1.tv_usec - (signed long)t2.tv_usec; - if(l < 0) { - t1.tv_sec--; - l = -l; - l %= 1000000; - } - return ((t1.tv_sec * 1000000)+l); - } else - return 0; -#else return clockStamp.elapsed()*1000; -#endif - return 0; } void QAudioOutputPrivate::reset() -- cgit v0.12 From c48ce6292d52b6f0a2a0ba54109a426d33eb7842 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 23 Feb 2010 13:42:25 +1000 Subject: Work. --- tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp index 0d7f985..ddd1e5e 100644 --- a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp +++ b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp @@ -77,6 +77,11 @@ public: { return QStringList() << QLatin1String("com.nokia.AutoTestQmlPluginType"); } + + void defineModule(const QString& uri) + { + Q_ASSERT(uri == "com.nokia.AutoTestQmlPluginType"); + } }; #include "plugin.moc" -- cgit v0.12 From e988763395625171bed001b5916d4da003d39aee Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 23 Feb 2010 13:58:24 +1000 Subject: Doc. --- doc/src/declarative/advtutorial1.qdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc index 2c99819..e7f4f1a 100644 --- a/doc/src/declarative/advtutorial1.qdoc +++ b/doc/src/declarative/advtutorial1.qdoc @@ -51,20 +51,20 @@ Here is the QML code for the basic elements. The game window: \snippet declarative/tutorials/samegame/samegame1/samegame.qml 0 -This gives you a basic game window, with room for the game canvas. A new game -button and room to display the score. The one thing you may not recognize here +This gives you a basic game window, with room for the game canvas, a new game +button and room to display the score. One thing you may not recognize here is the \l SystemPalette item. This item provides access to the Qt system palette and is used to make the button look more like a system button (for exact native -feel you would use a \l QPushButton). Since we want a fully functional button, -we use the QML elements Text and MouseArea inside a Rectangle to assemble a -button. Below is the code which we wrote to do this: +feel you would use a \l QPushButton). In this case we've created our own custom +Button element using the QML elements Text and MouseArea inside a Rectangle. +Below is the code which we wrote to do this (Button.qml): \snippet declarative/tutorials/samegame/samegame1/Button.qml 0 Note that this Button component was written to be fairly generic, in case we want to use a similarly styled button later. -And here is a simple block: +And here is a simple block (Block.qml): \snippet declarative/tutorials/samegame/samegame1/Block.qml 0 -- cgit v0.12 From f8eee22dcdd9b6b530c0e5c346e16552352ec03b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 23 Feb 2010 15:40:22 +1000 Subject: Add XmlRole::isKey property for incremental data changes when reload() is called. Task-number: QT-2831 --- src/declarative/util/qmlxmllistmodel.cpp | 175 +++++++++++--- .../qmlxmllistmodel/tst_qmlxmllistmodel.cpp | 254 +++++++++++++++++++++ 2 files changed, 400 insertions(+), 29 deletions(-) diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp index df2102a..5de4d6f 100644 --- a/src/declarative/util/qmlxmllistmodel.cpp +++ b/src/declarative/util/qmlxmllistmodel.cpp @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE QML_DEFINE_TYPE(Qt,4,6,XmlRole,QmlXmlListModelRole) QML_DEFINE_TYPE(Qt,4,6,XmlListModel,QmlXmlListModel) +typedef QPair QmlXmlListRange; + /*! \qmlclass XmlRole QmlXmlListModelRole \brief The XmlRole element allows you to specify a role for an XmlListModel. @@ -94,14 +96,26 @@ QML_DEFINE_TYPE(Qt,4,6,XmlListModel,QmlXmlListModel) \endqml */ +/*! + \qmlproperty bool XmlRole::isKey + Defines whether this is a key role. + + Key roles are used to to determine whether a set of values should + be updated or added to the XML list model when XmlListModel::reload() + is called. + + \sa XmlListModel +*/ + class Q_DECLARATIVE_EXPORT QmlXmlListModelRole : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString query READ query WRITE setQuery) + Q_PROPERTY(bool isKey READ isKey WRITE setIsKey) public: - QmlXmlListModelRole() {} + QmlXmlListModelRole() : m_isKey(false) {} ~QmlXmlListModelRole() {} QString name() const { return m_name; } @@ -117,6 +131,9 @@ public: m_query = query; } + bool isKey() const { return m_isKey; } + void setIsKey(bool b) { m_isKey = b; } + bool isValid() { return !m_name.isEmpty() && !m_query.isEmpty(); } @@ -124,6 +141,7 @@ public: private: QString m_name; QString m_query; + bool m_isKey; }; QT_END_NAMESPACE QML_DECLARE_TYPE(QmlXmlListModelRole) @@ -166,7 +184,6 @@ public: int doQuery(QString query, QString namespaces, QByteArray data, QmlXmlRoleList *roleObjects) { QMutexLocker locker(&m_mutex); - m_modelData.clear(); m_size = 0; m_data = data; m_query = QLatin1String("doc($src)") + query; @@ -188,6 +205,16 @@ public: return m_modelData; } + QList insertedItemRanges() { + QMutexLocker locker(&m_mutex); + return m_insertedItemRanges; + } + + QList removedItemRanges() { + QMutexLocker locker(&m_mutex); + return m_removedItemRanges; + } + Q_SIGNALS: void queryCompleted(int queryId, int size); @@ -197,13 +224,12 @@ protected: m_mutex.lock(); int queryId = m_queryId; doQueryJob(); - if (m_size > 0) - doSubQueryJob(); + doSubQueryJob(); m_data.clear(); // no longer needed m_mutex.unlock(); m_mutex.lock(); - if (!m_abort && m_size > 0) + if (!m_abort) emit queryCompleted(queryId, m_size); if (!m_restart) m_condition.wait(&m_mutex); @@ -216,6 +242,8 @@ protected: private: void doQueryJob(); void doSubQueryJob(); + void getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const; + void addIndexToRangeList(QList *ranges, int index) const; private: QMutex m_mutex; @@ -231,6 +259,9 @@ private: int m_queryId; const QmlXmlRoleList *m_roleObjects; QList > m_modelData; + QStringList m_keysValues; + QList m_insertedItemRanges; + QList m_removedItemRanges; }; void QmlXmlQuery::doQueryJob() @@ -275,6 +306,40 @@ void QmlXmlQuery::doQueryJob() m_size = count; } +void QmlXmlQuery::getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const +{ + QStringList keysQueries; + for (int i=0; icount(); i++) { + if (m_roleObjects->at(i)->isKey()) + keysQueries << m_roleObjects->at(i)->query(); + } + QString keysQuery; + if (keysQueries.count() == 1) + keysQuery = m_prefix + keysQueries[0]; + else if (keysQueries.count() > 1) + keysQuery = m_prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")"); + + if (!keysQuery.isEmpty()) { + query->setQuery(keysQuery); + QXmlResultItems resultItems; + query->evaluateTo(&resultItems); + QXmlItem item(resultItems.next()); + while (!item.isNull()) { + values->append(item.toAtomicValue().toString()); + item = resultItems.next(); + } + } +} + +void QmlXmlQuery::addIndexToRangeList(QList *ranges, int index) const { + if (ranges->isEmpty()) + ranges->append(qMakePair(index, 1)); + else if (ranges->last().first + ranges->last().second == index) + ranges->last().second += 1; + else + ranges->append(qMakePair(index, 1)); +} + void QmlXmlQuery::doSubQueryJob() { m_modelData.clear(); @@ -285,6 +350,35 @@ void QmlXmlQuery::doSubQueryJob() QXmlQuery subquery; subquery.bindVariable(QLatin1String("inputDocument"), &b); + QStringList keysValues; + getValuesOfKeyRoles(&keysValues, &subquery); + + // See if any values of key roles have been inserted or removed. + m_insertedItemRanges.clear(); + m_removedItemRanges.clear(); + if (m_keysValues.isEmpty()) { + m_insertedItemRanges << qMakePair(0, m_size); + } else { + if (keysValues != m_keysValues) { + QStringList temp; + for (int i=0; isize(); ++i) { QmlXmlListModelRole *role = m_roleObjects->at(i); @@ -296,13 +390,13 @@ void QmlXmlQuery::doSubQueryJob() continue; } subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + role->query() + QLatin1String(" return if ($v) then ") + role->query() + QLatin1String(" else \"\")")); - QXmlResultItems output3; - subquery.evaluateTo(&output3); - QXmlItem item(output3.next()); + QXmlResultItems resultItems; + subquery.evaluateTo(&resultItems); + QXmlItem item(resultItems.next()); QList resultList; while (!item.isNull()) { resultList << item.toAtomicValue(); //### we used to trim strings - item = output3.next(); + item = resultItems.next(); } //### should warn here if things have gone wrong. while (resultList.count() < m_size) @@ -408,25 +502,40 @@ void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role) /*! \qmlclass XmlListModel QmlXmlListModel - \brief The XmlListModel element allows you to specify a model using XPath expressions. + \brief The XmlListModel element is used to specify a model using XPath expressions. - XmlListModel allows you to construct a model from XML data that can then be used as a data source - for the view classes (ListView, PathView, GridView) and any other classes that interact with model - data (like Repeater). + XmlListModel is used to create a model from XML data that can be used as a data source + for the view classes (such as ListView, PathView, GridView) and other classes that interact with model + data (such as Repeater). - The following is an example of a model containing news from a Yahoo RSS feed: + Here is an example of a model containing news from a Yahoo RSS feed: \qml XmlListModel { id: feedModel source: "http://rss.news.yahoo.com/rss/oceania" query: "/rss/channel/item" XmlRole { name: "title"; query: "title/string()" } - XmlRole { name: "link"; query: "link/string()" } + XmlRole { name: "pubDate"; query: "pubDate/string()" } XmlRole { name: "description"; query: "description/string()" } } \endqml - \note The model is currently static, so the above is really just a snapshot of an RSS feed. To force a - reload of the entire model, you can call the reload function. + + You can also define certain roles as "keys" so that the model only adds data + that contains new values for these keys when reload() is called. + + For example, if the roles above were defined like this: + + \qml + XmlRole { name: "title"; query: "title/string()"; isKey: true } + XmlRole { name: "pubDate"; query: "pubDate/string()"; isKey: true } + \endqml + + Then when reload() is called, the model will only add new items with a + "title" and "pubDate" value combination that is not already present in + the model. + + This is useful to provide incremental updates and avoid repainting an + entire model in a view. */ QmlXmlListModel::QmlXmlListModel(QObject *parent) @@ -632,8 +741,13 @@ void QmlXmlListModel::componentComplete() /*! \qmlmethod XmlListModel::reload() - Reloads the model. All the existing model data will be removed, and the model - will be rebuilt from scratch. + Reloads the model. + + If no key roles have been specified, all existing model + data is removed, and the model is rebuilt from scratch. + + Otherwise, items are only added if the model does not already + contain items with matching key role values. */ void QmlXmlListModel::reload() { @@ -645,12 +759,8 @@ void QmlXmlListModel::reload() d->qmlXmlQuery.abort(); d->queryId = -1; - //clear existing data - int count = d->size; - d->size = 0; - d->data.clear(); - if (count > 0) - emit itemsRemoved(0, count); + if (d->size < 0) + d->size = 0; if (d->src.isEmpty() && d->xml.isEmpty()) return; @@ -717,12 +827,19 @@ void QmlXmlListModel::queryCompleted(int id, int size) Q_D(QmlXmlListModel); if (id != d->queryId) return; + bool sizeChanged = size != d->size; d->size = size; - if (size > 0) { - d->data = d->qmlXmlQuery.modelData(); - emit itemsInserted(0, d->size); + d->data = d->qmlXmlQuery.modelData(); + + QList removed = d->qmlXmlQuery.removedItemRanges(); + for (int i=0; i inserted = d->qmlXmlQuery.insertedItemRanges(); + for (int i=0; i +#include +#include #ifdef QTEST_XMLPATTERNS #include @@ -46,6 +48,12 @@ #include #include "../../../shared/util.h" +typedef QPair QmlXmlListRange; +typedef QList QmlXmlModelData; + +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QmlXmlModelData) + class tst_qmlxmllistmodel : public QObject { @@ -61,8 +69,47 @@ private slots: void roles(); void roleErrors(); void uniqueRoleNames(); + void useKeys(); + void useKeys_data(); + void noKeysValueChanges(); + void keysChanged(); private: + QString makeItemXmlAndData(const QString &data, QmlXmlModelData *modelData = 0) const + { + if (modelData) + modelData->clear(); + QString xml; + + if (!data.isEmpty()) { + QStringList items = data.split(";"); + foreach(const QString &item, items) { + QVariantList variants; + xml += QLatin1String(""); + QStringList fields = item.split(","); + foreach(const QString &field, fields) { + QStringList values = field.split("="); + Q_ASSERT(values.count() == 2); + xml += QString("<%1>%2").arg(values[0], values[1]); + if (!modelData) + continue; + bool isNum = false; + int number = values[1].toInt(&isNum); + if (isNum) + variants << number; + else + variants << values[1]; + } + xml += QLatin1String(""); + if (modelData) + modelData->append(variants); + } + } + + QString decl = ""; + return decl + QLatin1String("") + xml + QLatin1String(""); + } + QmlEngine engine; }; @@ -194,6 +241,213 @@ void tst_qmlxmllistmodel::uniqueRoleNames() delete listModel; } +void tst_qmlxmllistmodel::useKeys() +{ + // If using incremental updates through keys, the model should only + // insert & remove some of the items, instead of throwing everything + // away and causing the view to repaint the whole view. + + QFETCH(QString, oldXml); + QFETCH(int, oldCount); + QFETCH(QString, newXml); + QFETCH(QmlXmlModelData, newData); + QFETCH(QList, insertRanges); + QFETCH(QList, removeRanges); + + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QmlXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + + model->setXml(oldXml); + QTRY_COMPARE(model->count(), oldCount); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + model->setXml(newXml); + + if (oldCount != newData.count()) { + QTRY_COMPARE(model->count(), newData.count()); + QCOMPARE(spyCount.count(), 1); + } else { + QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0); + QCOMPARE(spyCount.count(), 0); + } + + QList roles = model->roles(); + for (int i=0; icount(); i++) { + for (int j=0; jdata(i, roles[j]), newData[i][j]); + } + + QCOMPARE(spyInsert.count(), insertRanges.count()); + for (int i=0; i("oldXml"); + QTest::addColumn("oldCount"); + QTest::addColumn("newXml"); + QTest::addColumn("newData"); + QTest::addColumn >("insertRanges"); + QTest::addColumn >("removeRanges"); + + QmlXmlModelData modelData; + + QTest::newRow("append 1") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics", &modelData) + << modelData + << (QList() << qMakePair(1, 1)) + << QList(); + + QTest::newRow("append multiple") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling", &modelData) + << modelData + << (QList() << qMakePair(1, 2)) + << QList(); + + QTest::newRow("insert in different spots") + << makeItemXmlAndData("name=B,age=35,sport=Athletics") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) + << modelData + << (QList() << qMakePair(0, 1) << qMakePair(2,2)) + << QList(); + + QTest::newRow("insert in middle") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=D,age=55,sport=Golf") << 2 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) + << modelData + << (QList() << qMakePair(1, 2)) + << QList(); + + QTest::newRow("remove first") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2 + << makeItemXmlAndData("name=B,age=35,sport=Athletics", &modelData) + << modelData + << QList() + << (QList() << qMakePair(0, 1)); + + QTest::newRow("remove last") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2 + << makeItemXmlAndData("name=A,age=25,sport=Football", &modelData) + << modelData + << QList() + << (QList() << qMakePair(1, 1)); + + QTest::newRow("remove from multiple spots") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 5 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=C,age=45,sport=Curling", &modelData) + << modelData + << QList() + << (QList() << qMakePair(1, 1) << qMakePair(3,2)); + + QTest::newRow("remove all") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling") << 3 + << makeItemXmlAndData("", &modelData) + << modelData + << QList() + << (QList() << qMakePair(0, 3)); + + QTest::newRow("replace item") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData) + << modelData + << (QList() << qMakePair(0, 1)) + << (QList() << qMakePair(0, 1)); + + QTest::newRow("add and remove simultaneously") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4 + << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData) + << modelData + << (QList() << qMakePair(1, 1)) + << (QList() << qMakePair(0, 1) << qMakePair(2,2)); +} + +void tst_qmlxmllistmodel::noKeysValueChanges() +{ + // The 'key' roles are 'name' and 'age', as defined in roleKeys.qml. + // If a 'sport' value is changed, the model should not be reloaded, + // since 'sport' is not marked as a key. + + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QmlXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + + QString xml; + + xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics"); + model->setXml(xml); + QTRY_COMPARE(model->count(), 2); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + xml = makeItemXmlAndData("name=A,age=25,sport=AussieRules;name=B,age=35,sport=Athletics"); + model->setXml(xml); + + // wait for the new xml data to be set, and verify no signals were emitted + for (int i=0; i<50; i++) { + QTest::qWait(100); + if (model->data(0, model->roles()[2]).toString() != QLatin1String("AussieRules")) + break; + } + QCOMPARE(model->data(0, model->roles()[2]).toString(), QLatin1String("AussieRules")); + + QVERIFY(spyInsert.count() == 0); + QVERIFY(spyRemove.count() == 0); + QVERIFY(spyCount.count() == 0); + + QCOMPARE(model->count(), 2); +} + +void tst_qmlxmllistmodel::keysChanged() +{ + // If the key roles change, the next time the data is reloaded, it should + // delete all its data and build a clean model (i.e. same behaviour as + // if no keys are set). + + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QmlXmlListModel *model = qobject_cast(component.create()); + QVERIFY(model != 0); + + QString xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics"); + model->setXml(xml); + QTRY_COMPARE(model->count(), 2); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey")); + model->setXml(xml); + + QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0); + + QCOMPARE(spyInsert.count(), 1); + QCOMPARE(spyInsert[0][0].toInt(), 0); + QCOMPARE(spyInsert[0][1].toInt(), 2); + + QCOMPARE(spyRemove.count(), 1); + QCOMPARE(spyRemove[0][0].toInt(), 0); + QCOMPARE(spyRemove[0][1].toInt(), 2); + + QCOMPARE(spyCount.count(), 0); +} + QTEST_MAIN(tst_qmlxmllistmodel) #include "tst_qmlxmllistmodel.moc" -- cgit v0.12 From 66b8d89feb2850dbc06503fa66f5963d48616c1d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 23 Feb 2010 15:40:26 +1000 Subject: Add support for setting the root index when using a QAbstractItemModel. Task-number: QT-2777 --- doc/src/declarative/elements.qdoc | 1 + .../graphicsitems/qmlgraphicsvisualitemmodel.cpp | 165 ++++++++++++++++++++- .../graphicsitems/qmlgraphicsvisualitemmodel_p.h | 7 + 3 files changed, 169 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 682a2ac..b218b64 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -88,6 +88,7 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l Binding \o \l ListModel, \l ListElement \o \l VisualItemModel +\o \l VisualDataModel \o \l XmlListModel and XmlRole \o \l DateTimeFormatter \o \l NumberFormatter diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index b96f399..4f28da7 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -327,7 +327,7 @@ public: if (m_listModelInterface) return m_listModelInterface->count(); if (m_abstractItemModel) - return m_abstractItemModel->rowCount(); + return m_abstractItemModel->rowCount(m_root); if (m_listAccessor) return m_listAccessor->count(); return 0; @@ -348,6 +348,8 @@ public: QVariant m_modelVariant; QmlListAccessor *m_listAccessor; + + QModelIndex m_root; }; class QmlGraphicsVisualDataModelDataMetaObject : public QmlOpenMetaObject @@ -461,7 +463,7 @@ QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId) QHash::const_iterator it = model->m_roleNames.find(propName); if (it != model->m_roleNames.end()) { roleToProp.insert(*it, propId); - QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0); + QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root); return model->m_abstractItemModel->data(index, *it); } } @@ -560,6 +562,39 @@ QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject //--------------------------------------------------------------------------- +/*! + \qmlclass VisualDataModel QmlGraphicsVisualDataModel + \brief The VisualDataModel encapsulates a model and delegate + + A VisualDataModel encapsulates a model and the delegate that will + be instantiated for items in the model. + + It is usually not necessary to create a VisualDataModel directly, + since the QML views will create one internally. + + The example below illustrates using a VisualDataModel with a ListView. + + \code + VisualDataModel { + id: visualModel + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { text: "Name:" + name} + } + } + } + ListView { + width: 100 + height: 100 + anchors.fill: parent + model: visualModel + } + \endcode +*/ + QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel() : QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(0))) { @@ -579,6 +614,20 @@ QmlGraphicsVisualDataModel::~QmlGraphicsVisualDataModel() d->m_delegateDataType->release(); } +/*! + \qmlproperty model VisualDataModel::model + This property holds the model providing data for the VisualDataModel. + + The model provides a set of data that is used to create the items + for a view. For large or dynamic datasets the model is usually + provided by a C++ model object. The C++ model object must be a \l + {QAbstractItemModel} subclass or a simple list. + + Models can also be created directly in QML, using a \l{ListModel} or + \l{XmlListModel}. + + \sa {qmlmodels}{Data Models} +*/ QVariant QmlGraphicsVisualDataModel::model() const { Q_D(const QmlGraphicsVisualDataModel); @@ -682,6 +731,16 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model) } } +/*! + \qmlproperty component VisualDataModel::delegate + + The delegate provides a template defining each item instantiated by a view. + The index is exposed as an accessible \c index property. Properties of the + model are also available depending upon the type of \l {qmlmodels}{Data Model}. + + Here is an example delegate: + \snippet doc/src/snippets/declarative/listview/listview.qml 0 +*/ QmlComponent *QmlGraphicsVisualDataModel::delegate() const { Q_D(const QmlGraphicsVisualDataModel); @@ -705,6 +764,105 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) } } +/*! + \qmlproperty QModelIndex VisualDataModel::rootIndex + + QAbstractItemModel provides a heirachical tree of data, whereas + QML only operates on list data. rootIndex allows the children of + any node in a QAbstractItemModel to be provided by this model. + + This property only affects models of type QAbstractItemModel. + + \code + // main.cpp + Q_DECLARE_METATYPE(QModelIndex) + + class MyModel : public QDirModel + { + Q_OBJECT + public: + MyModel(QmlContext *ctxt) : QDirModel(), context(ctxt) { + QHash roles = roleNames(); + roles.insert(FilePathRole, "path"); + setRoleNames(roles); + context->setContextProperty("myModel", this); + context->setContextProperty("myRoot", QVariant::fromValue(index(0,0,QModelIndex()))); + } + + Q_INVOKABLE void setRoot(const QString &path) { + QModelIndex root = index(path); + context->setContextProperty("myRoot", QVariant::fromValue(root)); + } + + QmlContext *context; + }; + + int main(int argc, char ** argv) + { + QApplication app(argc, argv); + + QmlView view; + view.setSource(QUrl("qrc:view.qml")); + + MyModel model(view.rootContext()); + + view.execute(); + view.show(); + + return app.exec(); + } + + #include "main.moc" + \endcode + + \code + // view.qml + import Qt 4.6 + + ListView { + width: 200 + height: 200 + model: VisualDataModel { + model: myModel + rootIndex: myRoot + delegate: Component { + Rectangle { + height: 25; width: 100 + Text { text: path } + MouseRegion { + anchors.fill: parent; + onClicked: myModel.setRoot(path) + } + } + } + } + } + \endcode + +*/ +QModelIndex QmlGraphicsVisualDataModel::rootIndex() const +{ + Q_D(const QmlGraphicsVisualDataModel); + return d->m_root; +} + +void QmlGraphicsVisualDataModel::setRootIndex(const QModelIndex &root) +{ + Q_D(QmlGraphicsVisualDataModel); + if (d->m_root != root) { + int oldCount = d->modelCount(); + d->m_root = root; + int newCount = d->modelCount(); + if (d->m_delegate && oldCount) + emit itemsRemoved(0, oldCount); + if (d->m_delegate && newCount) + emit itemsInserted(0, newCount); + if (newCount != oldCount) + emit countChanged(); + emit rootIndexChanged(); + } +} + QString QmlGraphicsVisualDataModel::part() const { Q_D(const QmlGraphicsVisualDataModel); @@ -786,7 +944,6 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v if (d->modelCount() <= 0 || !d->m_delegate) return 0; - QObject *nobj = d->m_cache.getItem(index); if (!nobj) { QmlContext *ccontext = d->m_context; @@ -943,7 +1100,7 @@ void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count, if (d->m_listModelInterface) { data->setValue(propId, d->m_listModelInterface->data(ii, QList() << role).value(role)); } else if (d->m_abstractItemModel) { - QModelIndex index = d->m_abstractItemModel->index(ii, 0); + QModelIndex index = d->m_abstractItemModel->index(ii, 0, d->m_root); data->setValue(propId, d->m_abstractItemModel->data(index, role)); } } diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h index 49f9b27..7dc41a8 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h @@ -49,6 +49,8 @@ QT_BEGIN_HEADER +Q_DECLARE_METATYPE(QModelIndex) + QT_BEGIN_NAMESPACE QT_MODULE(Declarative) @@ -147,6 +149,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsVisualDataModel : public QmlGraphicsVisual Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate) Q_PROPERTY(QString part READ part WRITE setPart) Q_PROPERTY(QObject *parts READ parts CONSTANT) + Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged) Q_CLASSINFO("DefaultProperty", "delegate") public: QmlGraphicsVisualDataModel(); @@ -159,6 +162,9 @@ public: QmlComponent *delegate() const; void setDelegate(QmlComponent *); + QModelIndex rootIndex() const; + void setRootIndex(const QModelIndex &root); + QString part() const; void setPart(const QString &); @@ -178,6 +184,7 @@ public: Q_SIGNALS: void createdPackage(int index, QmlPackage *package); void destroyingPackage(QmlPackage *package); + void rootIndexChanged(); private Q_SLOTS: void _q_itemsChanged(int, int, const QList &); -- cgit v0.12 From cd8d8d49f78c1cbb8ad3546e66a461b9e6e29ff5 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 14:24:20 +1000 Subject: Make QmlBinding (and friends) private QmlBinding exposes way too many implementation details to be confident about making it public right now. --- doc/src/declarative/extending.qdoc | 12 -- src/declarative/qml/qml.pri | 2 +- src/declarative/qml/qmlbinding.cpp | 2 +- src/declarative/qml/qmlbinding.h | 132 --------------------- src/declarative/qml/qmlbinding_p.h | 76 +++++++++--- src/declarative/qml/qmlbinding_p_p.h | 89 ++++++++++++++ src/declarative/qml/qmlcompiledbindings_p.h | 2 +- src/declarative/qml/qmlcompiler.cpp | 2 +- src/declarative/qml/qmlcomponent.cpp | 2 +- src/declarative/qml/qmlengine.cpp | 2 +- src/declarative/qml/qmlenginedebug.cpp | 2 +- src/declarative/qml/qmlmetaproperty.cpp | 2 +- src/declarative/qml/qmlobjectscriptclass.cpp | 2 +- src/declarative/qml/qmlpropertycache.cpp | 4 +- src/declarative/qml/qmlvme.cpp | 4 +- src/declarative/util/qmlpropertychanges.cpp | 2 +- src/declarative/util/qmlstate.cpp | 2 +- src/declarative/util/qmlstategroup.cpp | 2 +- src/declarative/util/qmltransitionmanager.cpp | 2 +- tests/auto/declarative/qmldebug/tst_qmldebug.cpp | 2 +- .../qmlmetaproperty/tst_qmlmetaproperty.cpp | 2 +- 21 files changed, 169 insertions(+), 178 deletions(-) delete mode 100644 src/declarative/qml/qmlbinding.h create mode 100644 src/declarative/qml/qmlbinding_p_p.h diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index d3e6c14..396ddab 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -557,18 +557,6 @@ to be used in bindings should have a NOTIFY signal instead. \l {Extending QML - Binding Example} shows the BirthdayParty example updated to include NOTIFY signals for use in binding. -\section1 Binding and Script Properties - -While generally no changes are needed to a C++ class to use property -binding, sometimes more advanced interaction between the binding engine and -an object is desirable. To facilitate this, there is a special exception -in the bind engine for allowing an object to access the binding directly. - -If a binding is assigned to a property with a type of QmlBinding -pointer (ie. \c {QmlBinding *}), each time the binding value changes, -a QmlBinding instance is assigned to that property. The QmlBinding instance -allows the object to read the binding and to evaluate the binding's current value. - \section1 Extension Objects \snippet examples/declarative/extending/extended/example.qml 0 diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 2313c37..f09a944 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -60,8 +60,8 @@ HEADERS += \ $$PWD/qmlinstruction_p.h \ $$PWD/qmlvmemetaobject_p.h \ $$PWD/qml.h \ - $$PWD/qmlbinding.h \ $$PWD/qmlbinding_p.h \ + $$PWD/qmlbinding_p_p.h \ $$PWD/qmlmetaproperty.h \ $$PWD/qmlmoduleplugin.h \ $$PWD/qmlcomponent.h \ diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index feadd0f..9f93fee 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlbinding.h" #include "qmlbinding_p.h" +#include "qmlbinding_p_p.h" #include "qml.h" #include "qmlcontext.h" diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h deleted file mode 100644 index 151b71c..0000000 --- a/src/declarative/qml/qmlbinding.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLBINDING_H -#define QMLBINDING_H - -#include "qml.h" -#include "qmlpropertyvaluesource.h" -#include "qmlexpression.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QmlAbstractBinding -{ -public: - QmlAbstractBinding(); - virtual ~QmlAbstractBinding(); - - virtual void destroy(); - - virtual QString expression() const; - - void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); } - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0; - virtual int propertyIndex() = 0; - - void update() { update(QmlMetaProperty::DontRemoveBinding); } - virtual void update(QmlMetaProperty::WriteFlags) = 0; - - void addToObject(QObject *); - void removeFromObject(); - -protected: - void clear(); - -private: - friend class QmlDeclarativeData; - friend class QmlMetaProperty; - friend class QmlMetaPropertyPrivate; - friend class QmlVME; - - QObject *m_object; - QmlAbstractBinding **m_mePtr; - QmlAbstractBinding **m_prevBinding; - QmlAbstractBinding *m_nextBinding; -}; - -class QmlContext; -class QmlBindingPrivate; -class Q_DECLARATIVE_EXPORT QmlBinding : public QmlExpression, - public QmlAbstractBinding -{ -Q_OBJECT -public: - QmlBinding(const QString &, QObject *, QmlContext *, QObject *parent=0); - QmlBinding(void *, QmlRefCount *, QObject *, QmlContext *, const QString &, int, - QObject *parent); - ~QmlBinding(); - - void setTarget(const QmlMetaProperty &); - QmlMetaProperty property() const; - - bool enabled() const; - - // Inherited from QmlAbstractBinding - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); - virtual int propertyIndex(); - virtual void update(QmlMetaProperty::WriteFlags flags); - virtual QString expression() const; - -public Q_SLOTS: - void update() { update(QmlMetaProperty::DontRemoveBinding); } - -protected: - void emitValueChanged(); - -private: - Q_DECLARE_PRIVATE(QmlBinding) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlBinding); - -QT_END_HEADER - -#endif // QMLBINDING_H diff --git a/src/declarative/qml/qmlbinding_p.h b/src/declarative/qml/qmlbinding_p.h index b4f88b5..4594476 100644 --- a/src/declarative/qml/qmlbinding_p.h +++ b/src/declarative/qml/qmlbinding_p.h @@ -53,36 +53,82 @@ // We mean it. // -#include "qmlbinding.h" +#include "qml.h" +#include "qmlpropertyvaluesource.h" +#include "qmlexpression.h" -#include "qmlmetaproperty.h" -#include "qmlexpression_p.h" +#include +#include QT_BEGIN_NAMESPACE -class QmlBindingData : public QmlExpressionData +class Q_AUTOTEST_EXPORT QmlAbstractBinding { public: - QmlBindingData(); - virtual ~QmlBindingData(); + QmlAbstractBinding(); + virtual ~QmlAbstractBinding(); - bool updating:1; - bool enabled:1; + virtual void destroy(); - QmlMetaProperty property; + virtual QString expression() const; - virtual void refresh(); + void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); } + virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0; + virtual int propertyIndex() = 0; + + void update() { update(QmlMetaProperty::DontRemoveBinding); } + virtual void update(QmlMetaProperty::WriteFlags) = 0; + + void addToObject(QObject *); + void removeFromObject(); + +protected: + void clear(); + +private: + friend class QmlDeclarativeData; + friend class QmlMetaProperty; + friend class QmlMetaPropertyPrivate; + friend class QmlVME; + + QObject *m_object; + QmlAbstractBinding **m_mePtr; + QmlAbstractBinding **m_prevBinding; + QmlAbstractBinding *m_nextBinding; }; -class QmlBindingPrivate : public QmlExpressionPrivate +class QmlContext; +class QmlBindingPrivate; +class Q_AUTOTEST_EXPORT QmlBinding : public QmlExpression, public QmlAbstractBinding { - Q_DECLARE_PUBLIC(QmlBinding) +Q_OBJECT public: - QmlBindingPrivate(); + QmlBinding(const QString &, QObject *, QmlContext *, QObject *parent=0); + QmlBinding(void *, QmlRefCount *, QObject *, QmlContext *, const QString &, int, + QObject *parent); + ~QmlBinding(); + + void setTarget(const QmlMetaProperty &); + QmlMetaProperty property() const; + + bool enabled() const; + + // Inherited from QmlAbstractBinding + virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); + virtual int propertyIndex(); + virtual void update(QmlMetaProperty::WriteFlags flags); + virtual QString expression() const; + +public Q_SLOTS: + void update() { update(QmlMetaProperty::DontRemoveBinding); } + +protected: + void emitValueChanged(); - QmlBindingData *bindingData() { return static_cast(data); } - const QmlBindingData *bindingData() const { return static_cast(data); } +private: + Q_DECLARE_PRIVATE(QmlBinding) }; +Q_DECLARE_METATYPE(QmlBinding*); QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbinding_p_p.h b/src/declarative/qml/qmlbinding_p_p.h new file mode 100644 index 0000000..e5a06fc --- /dev/null +++ b/src/declarative/qml/qmlbinding_p_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLBINDING_P_P_H +#define QMLBINDING_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qmlbinding_p.h" + +#include "qmlmetaproperty.h" +#include "qmlexpression_p.h" + +QT_BEGIN_NAMESPACE + +class QmlBindingData : public QmlExpressionData +{ +public: + QmlBindingData(); + virtual ~QmlBindingData(); + + bool updating:1; + bool enabled:1; + + QmlMetaProperty property; + + virtual void refresh(); +}; + +class QmlBindingPrivate : public QmlExpressionPrivate +{ + Q_DECLARE_PUBLIC(QmlBinding) +public: + QmlBindingPrivate(); + + QmlBindingData *bindingData() { return static_cast(data); } + const QmlBindingData *bindingData() const { return static_cast(data); } +}; + +QT_END_NAMESPACE + +#endif // QMLBINDING_P_P_H diff --git a/src/declarative/qml/qmlcompiledbindings_p.h b/src/declarative/qml/qmlcompiledbindings_p.h index 38fb2a3..056cc21 100644 --- a/src/declarative/qml/qmlcompiledbindings_p.h +++ b/src/declarative/qml/qmlcompiledbindings_p.h @@ -54,7 +54,7 @@ // #include "qmlexpression_p.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index bbae201..10b6e4f 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -63,7 +63,7 @@ #include "qmlscriptstring.h" #include "qmlglobal_p.h" #include "qmlscriptparser_p.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" #include "qmlcompiledbindings_p.h" #include diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 87ecb8a..4ab4f70 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -49,8 +49,8 @@ #include "qmlvme_p.h" #include "qml.h" #include "qmlengine.h" -#include "qmlbinding.h" #include "qmlbinding_p.h" +#include "qmlbinding_p_p.h" #include "qmlglobal_p.h" #include "qmlscriptparser_p.h" diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 97d8250..2460f52 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -51,7 +51,7 @@ #include "qmlcomponent.h" #include "qmlmetaproperty_p.h" #include "qmlmoduleplugin.h" -#include "qmlbinding_p.h" +#include "qmlbinding_p_p.h" #include "qmlvme_p.h" #include "qmlenginedebug_p.h" #include "qmlstringconverters_p.h" diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 654157c..2ab709a 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -45,7 +45,7 @@ #include "qmlengine.h" #include "qmlmetatype.h" #include "qmlmetaproperty.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" #include "qmlcontext_p.h" #include "qmlwatcher_p.h" diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 1742c43..ac619ec 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -44,7 +44,7 @@ #include "qmlcompositetypedata_p.h" #include "qml.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" #include "qmlcontext.h" #include "qmlcontext_p.h" #include "qmlboundsignal_p.h" diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 15ece1d..155a7d6 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -46,7 +46,7 @@ #include "qmldeclarativedata_p.h" #include "qmltypenamescriptclass_p.h" #include "qmllistscriptclass_p.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" #include "qmlguard_p.h" #include "qmlvmemetaobject_p.h" diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index a3e655b..2d087b6 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -42,8 +42,8 @@ #include "qmlpropertycache_p.h" #include "qmlengine_p.h" -#include "qmlbinding.h" -#include "qdebug.h" +#include "qmlbinding_p.h" +#include Q_DECLARE_METATYPE(QScriptValue); diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 8655809..f8f1ff0 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -51,11 +51,11 @@ #include "qmlengine.h" #include "qmlcontext.h" #include "qmlcomponent.h" -#include "qmlbinding.h" +#include "qmlbinding_p.h" #include "qmlengine_p.h" #include "qmlcomponent_p.h" #include "qmlvmemetaobject_p.h" -#include "qmlbinding_p.h" +#include "qmlbinding_p_p.h" #include "qmlcontext_p.h" #include "qmlcompiledbindings_p.h" #include "qmlglobal_p.h" diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 068cb4d..0ce3604 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 4462b1f..ea99bd5 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -48,7 +48,7 @@ #include "qmlanimation_p.h" #include "qmlanimation_p_p.h" -#include +#include #include #include diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index 4ad77c8..7a5db1b 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -44,7 +44,7 @@ #include "qmltransition_p.h" #include "qmlstate_p_p.h" -#include +#include #include #include diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index f2a4d64..60d9a60 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -43,7 +43,7 @@ #include "qmlstate_p_p.h" -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp index ba07331..2f1a557 100644 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp @@ -51,8 +51,8 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index c289641..540d658 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include class MyQmlObject : public QObject -- cgit v0.12 From 287a8757e348f56e2ae918d1aa5bf329c985f620 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 16:18:33 +1000 Subject: QmlExpression API review --- .../graphicsitems/qmlgraphicsvisualitemmodel.cpp | 3 -- src/declarative/qml/qmlbinding.cpp | 10 ++-- src/declarative/qml/qmlbinding_p_p.h | 2 + src/declarative/qml/qmlboundsignal.cpp | 3 +- src/declarative/qml/qmlenginedebug.cpp | 5 +- src/declarative/qml/qmlexpression.cpp | 62 ++++++++-------------- src/declarative/qml/qmlexpression.h | 11 ++-- src/declarative/qml/qmlexpression_p.h | 2 + src/declarative/qml/qmlwatcher.cpp | 1 + src/declarative/util/qmlanimation.cpp | 1 - src/declarative/util/qmlpropertychanges.cpp | 2 - src/declarative/util/qmlstateoperations.cpp | 1 - tests/auto/declarative/qmlecmascript/testtypes.h | 10 ++-- .../tst_qmlgraphicslistview.cpp | 1 - .../tst_qmlgraphicspathview.cpp | 1 - 15 files changed, 45 insertions(+), 70 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index bfa9e9b..9c11f25 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -187,7 +187,6 @@ QVariant QmlGraphicsVisualItemModel::evaluate(int index, const QString &expressi QmlContext *ctxt = new QmlContext(ccontext); ctxt->addDefaultObject(d->children.at(index)); QmlExpression e(ctxt, expression, objectContext); - e.setTrackChange(false); QVariant value = e.value(); delete ctxt; return value; @@ -1057,7 +1056,6 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi QmlGraphicsItem *item = qobject_cast(nobj); if (item) { QmlExpression e(qmlContext(item), expression, objectContext); - e.setTrackChange(false); value = e.value(); } } else { @@ -1067,7 +1065,6 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this); ctxt->addDefaultObject(data); QmlExpression e(ctxt, expression, objectContext); - e.setTrackChange(false); value = e.value(); delete data; delete ctxt; diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 9f93fee..aeda28b 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -85,12 +85,14 @@ QmlBinding::QmlBinding(void *data, QmlRefCount *rc, QObject *obj, QmlContext *ct : QmlExpression(ctxt, data, rc, obj, url, lineNumber, *new QmlBindingPrivate) { setParent(parent); + setNotifyOnValueChanged(true); } QmlBinding::QmlBinding(const QString &str, QObject *obj, QmlContext *ctxt, QObject *parent) : QmlExpression(ctxt, str, obj, *new QmlBindingPrivate) { setParent(parent); + setNotifyOnValueChanged(true); } QmlBinding::~QmlBinding() @@ -198,17 +200,17 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) data->release(); } -void QmlBinding::emitValueChanged() +void QmlBindingPrivate::emitValueChanged() { - update(); - // don't bother calling valueChanged() + Q_Q(QmlBinding); + q->update(); } void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) { Q_D(QmlBinding); d->bindingData()->enabled = e; - setTrackChange(e); + setNotifyOnValueChanged(e); QmlAbstractBinding::setEnabled(e, flags); diff --git a/src/declarative/qml/qmlbinding_p_p.h b/src/declarative/qml/qmlbinding_p_p.h index e5a06fc..131bacc 100644 --- a/src/declarative/qml/qmlbinding_p_p.h +++ b/src/declarative/qml/qmlbinding_p_p.h @@ -82,6 +82,8 @@ public: QmlBindingData *bindingData() { return static_cast(data); } const QmlBindingData *bindingData() const { return static_cast(data); } + + virtual void emitValueChanged(); }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp index a075899..db5fd61 100644 --- a/src/declarative/qml/qmlboundsignal.cpp +++ b/src/declarative/qml/qmlboundsignal.cpp @@ -124,7 +124,6 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val, QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx); m_expression = new QmlExpression(ctxt, val, scope); - m_expression->setTrackChange(false); } QmlBoundSignal::~QmlBoundSignal() @@ -157,7 +156,7 @@ QmlExpression *QmlBoundSignal::setExpression(QmlExpression *e) { QmlExpression *rv = m_expression; m_expression = e; - if (m_expression) m_expression->setTrackChange(false); + if (m_expression) m_expression->setNotifyOnValueChanged(false); return rv; } diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 2ab709a..973e5e5 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -408,14 +408,13 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message) QmlContext *context = qmlContext(object); QVariant result; if (object && context) { - QmlExpression *exprObj = new QmlExpression(context, expr, object); + QmlExpression exprObj(context, expr, object); bool undefined = false; - QVariant value = exprObj->value(&undefined); + QVariant value = exprObj.value(&undefined); if (undefined) result = QLatin1String(""); else result = valueContents(value); - delete exprObj; } else { result = QLatin1String(""); } diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 8f0c945..64b2d7f 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -70,7 +70,7 @@ bool QmlDelayedError::addError(QmlEnginePrivate *e) QmlExpressionData::QmlExpressionData() : q(0), dataRef(0), expressionFunctionValid(false), expressionRewritten(false), me(0), - trackChange(true), isShared(false), line(-1), guardList(0), guardListLength(0) + trackChange(false), isShared(false), line(-1), guardList(0), guardListLength(0) { } @@ -273,14 +273,6 @@ QString QmlExpression::expression() const } /*! - Clear the expression. -*/ -void QmlExpression::clearExpression() -{ - setExpression(QString()); -} - -/*! Set the expression to \a expression. */ void QmlExpression::setExpression(const QString &expression) @@ -495,44 +487,34 @@ QVariant QmlExpression::value(bool *isUndefined) } /*! - Returns true if the expression results in a constant value. - QmlExpression::value() must have been invoked at least once before the - return from this method is valid. - */ -bool QmlExpression::isConstant() const -{ - Q_D(const QmlExpression); - return !d->data->guardList; -} - -/*! - Returns true if the changes are tracked in the expression's value. +Returns true if the valueChanged() signal is emitted when the expression's evaluated +value changes. */ -bool QmlExpression::trackChange() const +bool QmlExpression::notifyOnValueChanged() const { Q_D(const QmlExpression); return d->data->trackChange; } /*! - Set whether changes are tracked in the expression's value to \a trackChange. +Sets whether the valueChanged() signal is emitted when the expression's evaluated +value changes. - If true, the QmlExpression will monitor properties involved in the - expression's evaluation, and call QmlExpression::valueChanged() if they have - changed. This allows an application to ensure that any value associated - with the result of the expression remains up to date. +If true, the QmlExpression will monitor properties involved in the expression's +evaluation, and emit QmlExpression::valueChanged() if they have changed. This allows +an application to ensure that any value associated with the result of the expression +remains up to date. - If false, the QmlExpression will not montitor properties involved in the - expression's evaluation, and QmlExpression::valueChanged() will never be - called. This is more efficient if an application wants a "one off" - evaluation of the expression. +If false, the QmlExpression will not montitor properties involved in the expression's +evaluation, and QmlExpression::valueChanged() will never be emitted. This is more efficient +if an application wants a "one off" evaluation of the expression. - By default, trackChange is true. +By default, notifyOnChange is false. */ -void QmlExpression::setTrackChange(bool trackChange) +void QmlExpression::setNotifyOnValueChanged(bool notifyOnChange) { Q_D(QmlExpression); - d->data->trackChange = trackChange; + d->data->trackChange = notifyOnChange; } /*! @@ -618,7 +600,8 @@ QmlError QmlExpression::error() const /*! \internal */ void QmlExpression::__q_notify() { - emitValueChanged(); + Q_D(QmlExpression); + d->emitValueChanged(); } void QmlExpressionPrivate::clearGuards() @@ -765,13 +748,10 @@ void QmlExpressionPrivate::updateGuards(const QPODVectorvalueChanged(); } QmlAbstractExpression::QmlAbstractExpression() diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index 428eefa..61374f2 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -70,12 +70,10 @@ public: QmlContext *context() const; QString expression() const; - void clearExpression(); - virtual void setExpression(const QString &); - bool isConstant() const; + void setExpression(const QString &); - bool trackChange() const; - void setTrackChange(bool); + bool notifyOnValueChanged() const; + void setNotifyOnValueChanged(bool); QString sourceFile() const; int lineNumber() const; @@ -87,15 +85,12 @@ public: void clearError(); QmlError error() const; -public Q_SLOTS: QVariant value(bool *isUndefined = 0); Q_SIGNALS: void valueChanged(); protected: - virtual void emitValueChanged(); - QmlExpression(QmlContext *, const QString &, QObject *, QmlExpressionPrivate &dd); QmlExpression(QmlContext *, void *, QmlRefCount *rc, QObject *me, const QString &, diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index e52a199..e4bed05 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -177,6 +177,8 @@ public: return expr->q_func(); } + virtual void emitValueChanged(); + static void exceptionToError(QScriptEngine *, QmlError &); static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QString &); static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QScriptProgram &); diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp index 59503de..a8a94c5 100644 --- a/src/declarative/qml/qmlwatcher.cpp +++ b/src/declarative/qml/qmlwatcher.cpp @@ -154,6 +154,7 @@ bool QmlWatcher::addWatch(int id, quint32 objectId, const QString &expr) QmlContext *context = qmlContext(object); if (context) { QmlExpression *exprObj = new QmlExpression(context, expr, object); + exprObj->setNotifyOnValueChanged(true); QmlWatchProxy *proxy = new QmlWatchProxy(id, exprObj, objectId, this); exprObj->setParent(proxy); m_proxies[id].append(proxy); diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index c044f97..6dcce58 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -793,7 +793,6 @@ void QmlScriptActionPrivate::execute() const QString &str = scriptStr.script(); if (!str.isEmpty()) { QmlExpression expr(scriptStr.context(), str, scriptStr.scopeObject()); - expr.setTrackChange(false); expr.value(); } } diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 0ce3604..3abbadd 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -277,14 +277,12 @@ void QmlPropertyChangesPrivate::decode() QmlMetaProperty prop = property(name); //### better way to check for signal property? if (prop.type() & QmlMetaProperty::SignalProperty) { QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object); - expression->setTrackChange(false); QmlReplaceSignalHandler *handler = new QmlReplaceSignalHandler; handler->property = prop; handler->expression = expression; signalReplacements << handler; } else if (isScript) { QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object); - expression->setTrackChange(false); expressions << qMakePair(name, expression); } else { properties << qMakePair(name, data); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index bd1f5f0..fff8774 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -373,7 +373,6 @@ void QmlStateChangeScript::execute() const QString &script = d->script.script(); if (!script.isEmpty()) { QmlExpression expr(d->script.context(), script, d->script.scopeObject()); - expr.setTrackChange(false); expr.value(); } } diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h index 0af72cb..f511c29 100644 --- a/tests/auto/declarative/qmlecmascript/testtypes.h +++ b/tests/auto/declarative/qmlecmascript/testtypes.h @@ -173,17 +173,21 @@ QML_DECLARE_TYPE(MyQmlContainer); class MyExpression : public QmlExpression { + Q_OBJECT public: MyExpression(QmlContext *ctxt, const QString &expr) : QmlExpression(ctxt, expr, 0), changed(false) { + QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged())); + setNotifyOnValueChanged(true); } - void emitValueChanged() { + bool changed; + +public slots: + void expressionValueChanged() { changed = true; - QmlExpression::emitValueChanged(); } - bool changed; }; diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp index 13ed41d..0876520 100644 --- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp +++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp @@ -1322,7 +1322,6 @@ T *tst_QmlGraphicsListView::findItem(QGraphicsObject *parent, const QString &obj if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { if (index != -1) { QmlExpression e(qmlContext(item), "index", item); - e.setTrackChange(false); if (e.value().toInt() == index) return static_cast(item); } else { diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp index b986a64..62b3cfc 100644 --- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp +++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp @@ -452,7 +452,6 @@ T *tst_QmlGraphicsPathView::findItem(QGraphicsObject *parent, const QString &obj if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { if (index != -1) { QmlExpression e(qmlContext(item), "index", item); - e.setTrackChange(false); if (e.value().toInt() == index) return static_cast(item); } else { -- cgit v0.12 From c2988e5bc92c81e35e6b11092a2c4fa237cf9fdb Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 23 Feb 2010 16:39:30 +1000 Subject: Doc fix. Task-number: QT-2831 --- src/declarative/util/qmlxmllistmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp index 7e66576..6c9c03e 100644 --- a/src/declarative/util/qmlxmllistmodel.cpp +++ b/src/declarative/util/qmlxmllistmodel.cpp @@ -635,9 +635,9 @@ void QmlXmlListModel::setXml(const QString &xml) } /*! - \qmlproperty url XmlListModel::query + \qmlproperty string XmlListModel::query An absolute XPath query representing the base query for the model items. The query should start with - a '/' or '//'. + '/' or '//'. */ QString QmlXmlListModel::query() const { -- cgit v0.12 From c38be88e5314f43efd7cb6a2e8140d006e77afbe Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 23 Feb 2010 16:44:58 +1000 Subject: Make executable outside dir. --- .../qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp index b51266a..21c0efc 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp @@ -249,7 +249,7 @@ void tst_QmlGraphicsPositioners::test_vertical_animated() void tst_QmlGraphicsPositioners::test_grid() { - QmlView *canvas = createView("data/grid.qml"); + QmlView *canvas = createView(SRCDIR "/data/grid.qml"); canvas->execute(); @@ -278,7 +278,7 @@ void tst_QmlGraphicsPositioners::test_grid() void tst_QmlGraphicsPositioners::test_grid_spacing() { - QmlView *canvas = createView("data/grid-spacing.qml"); + QmlView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); canvas->execute(); @@ -381,7 +381,7 @@ void tst_QmlGraphicsPositioners::test_grid_animated() void tst_QmlGraphicsPositioners::test_repeater() { - QmlView *canvas = createView("data/repeater.qml"); + QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); canvas->execute(); -- cgit v0.12 From 5ffd6c0fba0ecc709551e414ed0649de15ac3754 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 23 Feb 2010 16:46:44 +1000 Subject: Remove QmlView::execute(). QmlView::setSource() does it all now. Task-number: QT-2538 --- demos/declarative/minehunt/main.cpp | 4 +- examples/declarative/imageprovider/main.cpp | 3 +- examples/declarative/objectlistmodel/main.cpp | 3 +- .../graphicsitems/qmlgraphicsvisualitemmodel.cpp | 3 +- src/declarative/util/qmlview.cpp | 60 ++++++++++++---------- src/declarative/util/qmlview.h | 3 +- tests/auto/declarative/layouts/tst_layouts.cpp | 1 - .../qmlanimations/tst_qmlanimations.cpp | 1 - .../qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp | 45 ++++++---------- .../tst_qmlgraphicsgridview.cpp | 35 ++++++------- .../qmlgraphicsitem/tst_qmlgraphicsitem.cpp | 5 +- .../tst_qmlgraphicslistview.cpp | 55 ++++++++++---------- .../tst_qmlgraphicsmousearea.cpp | 1 - .../tst_qmlgraphicsparticles.cpp | 1 - .../tst_qmlgraphicspathview.cpp | 18 +++---- .../tst_qmlgraphicspositioners.cpp | 19 ------- .../tst_qmlgraphicsrepeater.cpp | 26 +++++----- .../tst_qmlgraphicstextedit.cpp | 7 --- .../tst_qmlgraphicstextinput.cpp | 7 --- tools/qmlviewer/qmlviewer.cpp | 6 +-- 20 files changed, 123 insertions(+), 180 deletions(-) diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 0b862e3..a897919 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -167,13 +167,11 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags canvas->setFixedSize(width, height); vbox->addWidget(canvas); - canvas->setSource(QUrl::fromLocalFile(fileName)); - QmlContext *ctxt = canvas->rootContext(); ctxt->addDefaultObject(this); ctxt->setContextProperty("tiles", QVariant::fromValue*>(&_tiles));//QTBUG-5675 - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(fileName)); } MyWidget::~MyWidget() diff --git a/examples/declarative/imageprovider/main.cpp b/examples/declarative/imageprovider/main.cpp index 9526105..eaaded2 100644 --- a/examples/declarative/imageprovider/main.cpp +++ b/examples/declarative/imageprovider/main.cpp @@ -75,7 +75,6 @@ int main(int argc, char ** argv) QApplication app(argc, argv); QmlView view; - view.setSource(QUrl("qrc:view.qml")); view.engine()->addImageProvider("colors", new ColorImageProvider); @@ -91,7 +90,7 @@ int main(int argc, char ** argv) QmlContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); - view.execute(); + view.setSource(QUrl("qrc:view.qml")); view.show(); return app.exec(); diff --git a/examples/declarative/objectlistmodel/main.cpp b/examples/declarative/objectlistmodel/main.cpp index 9e38bea..7ea742b 100644 --- a/examples/declarative/objectlistmodel/main.cpp +++ b/examples/declarative/objectlistmodel/main.cpp @@ -59,7 +59,6 @@ int main(int argc, char ** argv) QApplication app(argc, argv); QmlView view; - view.setSource(QUrl("qrc:view.qml")); QList dataList; dataList.append(new DataObject("Item 1", "red")); @@ -70,7 +69,7 @@ int main(int argc, char ** argv) QmlContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); - view.execute(); + view.setSource(QUrl("qrc:view.qml")); view.show(); return app.exec(); diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index bfa9e9b..a9d67ab 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -802,11 +802,10 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) QApplication app(argc, argv); QmlView view; - view.setSource(QUrl("qrc:view.qml")); MyModel model(view.rootContext()); - view.execute(); + view.setSource(QUrl("qrc:view.qml")); view.show(); return app.exec(); diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 400ae52..05c6460 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -132,6 +132,8 @@ public: QmlViewPrivate(QmlView *view) : q(view), root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {} + void execute(); + QmlView *q; QGuard root; @@ -152,6 +154,20 @@ public: QGraphicsScene scene; }; +void QmlViewPrivate::execute() +{ + delete root; + delete component; + component = new QmlComponent(&engine, source, q); + + if (!component->isLoading()) { + q->continueExecute(); + } else { + QObject::connect(component, SIGNAL(statusChanged(QmlComponent::Status)), q, SLOT(continueExecute())); + } +} + + /*! \class QmlView \brief The QmlView class provides a widget for displaying a Qt Declarative user interface. @@ -188,9 +204,6 @@ public: QUrl url(fileName); view->setSource(url); - ... - view->execute(); - ... view->show(); \endcode @@ -220,6 +233,19 @@ QmlView::QmlView(QWidget *parent) d->init(); } +/*! + \fn QmlView::QmlView(const QUrl &source, QWidget *parent) + + Constructs a QmlView with the given QML \a source and \a parent. +*/ +QmlView::QmlView(const QUrl &source, QWidget *parent) +: QGraphicsView(parent), d(new QmlViewPrivate(this)) +{ + setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); + d->init(); + setSource(source); +} + void QmlViewPrivate::init() { #ifdef Q_ENABLE_PERFORMANCE_LOG @@ -254,15 +280,14 @@ QmlView::~QmlView() } /*! - Sets the source to the \a url. - - Call \l execute() to load the QML and instantiate the component. - - \sa execute() + Sets the source to the \a url, loads the QML component and instantiates it. */ void QmlView::setSource(const QUrl& url) { - d->source = url; + if (url != d->source) { + d->source = url; + d->execute(); + } } /*! @@ -296,23 +321,6 @@ QmlContext* QmlView::rootContext() return d->engine.rootContext(); } -/*! - Loads and instantiates the QML component set by the \l setSource() method. - - \sa setSource() -*/ -void QmlView::execute() -{ - delete d->root; - delete d->component; - d->component = new QmlComponent(&d->engine, d->source, this); - - if (!d->component->isLoading()) { - continueExecute(); - } else { - connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute())); - } -} /*! \enum QmlView::Status diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h index 1d6ef1c..5f72781 100644 --- a/src/declarative/util/qmlview.h +++ b/src/declarative/util/qmlview.h @@ -67,6 +67,7 @@ class Q_DECLARATIVE_EXPORT QmlView : public QGraphicsView public: explicit QmlView(QWidget *parent = 0); + QmlView(const QUrl &source, QWidget *parent = 0); virtual ~QmlView(); QUrl source() const; @@ -74,7 +75,6 @@ public: QmlEngine* engine(); QmlContext* rootContext(); - void execute(); QGraphicsObject *rootObject() const; @@ -102,6 +102,7 @@ protected: virtual void paintEvent(QPaintEvent *event); void timerEvent(QTimerEvent*); + friend class QmlViewPrivate; QmlViewPrivate *d; }; diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index ee05574..53c1ede 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -67,7 +67,6 @@ void tst_QmlGraphicsLayouts::test_qml() { QmlView *canvas = createView(SRCDIR "/data/layouts.qml"); - canvas->execute(); qApp->processEvents(); QmlGraphicsLayoutItem *left = static_cast(canvas->rootObject()->findChild("left")); QVERIFY(left != 0); diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index 9eae308..1f6347e 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -261,7 +261,6 @@ void tst_qmlanimations::badTypes() QmlView *view = new QmlView; view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); - view->execute(); qApp->processEvents(); delete view; diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp index aa6b56a..721608e 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp +++ b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp @@ -104,7 +104,6 @@ void tst_qmlgraphicsanchors::basicAnchors() QmlView *view = new QmlView; view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); - view->execute(); qApp->processEvents(); //sibling horizontal @@ -171,28 +170,28 @@ void tst_qmlgraphicsanchors::basicAnchors() void tst_qmlgraphicsanchors::loops() { { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); - QString expect = "QML Text (" + view->source().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML Text (" + source.toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); + + QmlView *view = new QmlView; + view->setSource(source); qApp->processEvents(); delete view; } { - QmlView *view = new QmlView; + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); - - QString expect = "QML Image (" + view->source().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML Image (" + source.toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); + + QmlView *view = new QmlView; + view->setSource(source); qApp->processEvents(); delete view; @@ -370,14 +369,13 @@ void tst_qmlgraphicsanchors::nullItem_data() void tst_qmlgraphicsanchors::crash1() { - QmlView *view = new QmlView; + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); - - QString expect = "QML Text (" + view->source().toString() + ":4:5" + ") Possible anchor loop detected on fill."; + QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message - view->execute(); + + QmlView *view = new QmlView(source); qApp->processEvents(); delete view; @@ -385,11 +383,8 @@ void tst_qmlgraphicsanchors::crash1() void tst_qmlgraphicsanchors::fill() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); QCOMPARE(rect->x(), 0.0 + 10.0); @@ -411,11 +406,8 @@ void tst_qmlgraphicsanchors::fill() void tst_qmlgraphicsanchors::centerIn() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); QCOMPARE(rect->x(), 75.0 + 10); @@ -431,11 +423,8 @@ void tst_qmlgraphicsanchors::centerIn() void tst_qmlgraphicsanchors::margins() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); QCOMPARE(rect->x(), 5.0); diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp index 2520d4a..7c8501c 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp +++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp @@ -68,7 +68,7 @@ private slots: void positionViewAtIndex(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); template @@ -142,7 +142,7 @@ tst_QmlGraphicsGridView::tst_QmlGraphicsGridView() void tst_QmlGraphicsGridView::items() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -157,7 +157,7 @@ void tst_QmlGraphicsGridView::items() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -190,7 +190,7 @@ void tst_QmlGraphicsGridView::items() void tst_QmlGraphicsGridView::changed() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -205,7 +205,7 @@ void tst_QmlGraphicsGridView::changed() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsFlickable *gridview = findItem(canvas->rootObject(), "grid"); @@ -227,7 +227,7 @@ void tst_QmlGraphicsGridView::changed() void tst_QmlGraphicsGridView::inserted() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -238,7 +238,7 @@ void tst_QmlGraphicsGridView::inserted() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -309,7 +309,7 @@ void tst_QmlGraphicsGridView::inserted() void tst_QmlGraphicsGridView::removed() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -319,7 +319,7 @@ void tst_QmlGraphicsGridView::removed() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -469,7 +469,7 @@ void tst_QmlGraphicsGridView::removed() void tst_QmlGraphicsGridView::moved() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -479,7 +479,7 @@ void tst_QmlGraphicsGridView::moved() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -580,7 +580,6 @@ void tst_QmlGraphicsGridView::currentIndex() QString filename(SRCDIR "/data/gridview-initCurrent.qml"); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -690,7 +689,7 @@ void tst_QmlGraphicsGridView::currentIndex() void tst_QmlGraphicsGridView::changeFlow() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -700,7 +699,7 @@ void tst_QmlGraphicsGridView::changeFlow() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -795,7 +794,7 @@ void tst_QmlGraphicsGridView::properties() void tst_QmlGraphicsGridView::positionViewAtIndex() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -805,7 +804,7 @@ void tst_QmlGraphicsGridView::positionViewAtIndex() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem(canvas->rootObject(), "grid"); @@ -883,13 +882,11 @@ void tst_QmlGraphicsGridView::positionViewAtIndex() delete canvas; } -QmlView *tst_QmlGraphicsGridView::createView(const QString &filename) +QmlView *tst_QmlGraphicsGridView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp index 820a6de..1bface4 100644 --- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp +++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp @@ -112,14 +112,12 @@ void tst_QmlGraphicsItem::keys() QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); - KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); canvas->show(); qApp->processEvents(); @@ -195,7 +193,6 @@ void tst_QmlGraphicsItem::keyNavigation() canvas->setFixedSize(240,320); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml")); - canvas->execute(); canvas->show(); qApp->processEvents(); diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp index 13ed41d..e535aaa 100644 --- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp +++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp @@ -88,7 +88,7 @@ private: template void removed(bool animated); template void moved(); template void clear(); - QmlView *createView(const QString &filename); + QmlView *createView(); template T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); template @@ -300,7 +300,7 @@ tst_QmlGraphicsListView::tst_QmlGraphicsListView() template void tst_QmlGraphicsListView::items() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -313,7 +313,7 @@ void tst_QmlGraphicsListView::items() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -380,7 +380,7 @@ void tst_QmlGraphicsListView::items() template void tst_QmlGraphicsListView::changed() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -393,7 +393,7 @@ void tst_QmlGraphicsListView::changed() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsFlickable *listview = findItem(canvas->rootObject(), "list"); @@ -416,7 +416,7 @@ void tst_QmlGraphicsListView::changed() template void tst_QmlGraphicsListView::inserted() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -429,7 +429,7 @@ void tst_QmlGraphicsListView::inserted() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -509,7 +509,7 @@ void tst_QmlGraphicsListView::inserted() template void tst_QmlGraphicsListView::removed(bool animated) { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -522,7 +522,7 @@ void tst_QmlGraphicsListView::removed(bool animated) testObject->setAnimate(animated); ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -652,7 +652,7 @@ void tst_QmlGraphicsListView::removed(bool animated) template void tst_QmlGraphicsListView::clear() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -664,7 +664,7 @@ void tst_QmlGraphicsListView::clear() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -689,7 +689,7 @@ void tst_QmlGraphicsListView::clear() template void tst_QmlGraphicsListView::moved() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -701,7 +701,7 @@ void tst_QmlGraphicsListView::moved() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -785,7 +785,7 @@ void tst_QmlGraphicsListView::moved() void tst_QmlGraphicsListView::enforceRange() { - QmlView *canvas = createView(SRCDIR "/data/listview-enforcerange.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -794,7 +794,7 @@ void tst_QmlGraphicsListView::enforceRange() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -830,7 +830,7 @@ void tst_QmlGraphicsListView::enforceRange() void tst_QmlGraphicsListView::spacing() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -842,7 +842,7 @@ void tst_QmlGraphicsListView::spacing() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -888,7 +888,7 @@ void tst_QmlGraphicsListView::spacing() void tst_QmlGraphicsListView::sections() { - QmlView *canvas = createView(SRCDIR "/data/listview-sections.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -897,7 +897,7 @@ void tst_QmlGraphicsListView::sections() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -975,7 +975,6 @@ void tst_QmlGraphicsListView::currentIndex() QString filename(SRCDIR "/data/listview-initCurrent.qml"); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -1055,9 +1054,9 @@ void tst_QmlGraphicsListView::currentIndex() void tst_QmlGraphicsListView::itemList() { - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); + QmlView *canvas = createView(); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "view"); @@ -1096,7 +1095,7 @@ void tst_QmlGraphicsListView::itemList() void tst_QmlGraphicsListView::cacheBuffer() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -1108,7 +1107,7 @@ void tst_QmlGraphicsListView::cacheBuffer() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -1148,7 +1147,7 @@ void tst_QmlGraphicsListView::cacheBuffer() void tst_QmlGraphicsListView::positionViewAtIndex() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -1160,7 +1159,7 @@ void tst_QmlGraphicsListView::positionViewAtIndex() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem(canvas->rootObject(), "list"); @@ -1295,13 +1294,11 @@ void tst_QmlGraphicsListView::qAbstractItemModel_clear() clear(); } -QmlView *tst_QmlGraphicsListView::createView(const QString &filename) +QmlView *tst_QmlGraphicsListView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp index 869a7bd..22a12a9 100644 --- a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp +++ b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp @@ -56,7 +56,6 @@ private: void tst_QmlGraphicsMouseArea::dragProperties() { QmlView *canvas = createView(SRCDIR "/data/dragproperties.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp index a5c0b78..195c367 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp @@ -113,7 +113,6 @@ QmlView *tst_QmlGraphicsParticles::createView(const QString &filename) canvas->setFixedSize(240,320); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); return canvas; } diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp index b986a64..bb1c1af 100644 --- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp +++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp @@ -69,7 +69,7 @@ private slots: void pathMoved(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1); template @@ -191,7 +191,7 @@ void tst_QmlGraphicsPathView::initValues() void tst_QmlGraphicsPathView::items() { - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -201,7 +201,7 @@ void tst_QmlGraphicsPathView::items() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = findItem(canvas->rootObject(), "view"); @@ -304,7 +304,7 @@ void tst_QmlGraphicsPathView::path() void tst_QmlGraphicsPathView::dataModel() { - QmlView *canvas = createView(SRCDIR "/data/datamodel.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; @@ -323,7 +323,7 @@ void tst_QmlGraphicsPathView::dataModel() ctxt->setContextProperty("testData", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = qobject_cast(canvas->rootObject()); @@ -384,7 +384,7 @@ void tst_QmlGraphicsPathView::dataModel() void tst_QmlGraphicsPathView::pathMoved() { - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Ben", "12345"); @@ -395,7 +395,7 @@ void tst_QmlGraphicsPathView::pathMoved() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = findItem(canvas->rootObject(), "view"); @@ -425,13 +425,11 @@ void tst_QmlGraphicsPathView::pathMoved() delete canvas; } -QmlView *tst_QmlGraphicsPathView::createView(const QString &filename) +QmlView *tst_QmlGraphicsPathView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp index b51266a..348f59b 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp @@ -75,8 +75,6 @@ void tst_QmlGraphicsPositioners::test_horizontal() { QmlView *canvas = createView(SRCDIR "/data/horizontal.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -98,8 +96,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_spacing() { QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -121,8 +117,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated() { QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -163,8 +157,6 @@ void tst_QmlGraphicsPositioners::test_vertical() { QmlView *canvas = createView(SRCDIR "/data/vertical.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -186,8 +178,6 @@ void tst_QmlGraphicsPositioners::test_vertical_spacing() { QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -209,8 +199,6 @@ void tst_QmlGraphicsPositioners::test_vertical_animated() { QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); - canvas->execute(); - //Note that they animate in QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -251,8 +239,6 @@ void tst_QmlGraphicsPositioners::test_grid() { QmlView *canvas = createView("data/grid.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); QmlGraphicsRectangle *two = canvas->rootObject()->findChild("two"); @@ -280,8 +266,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing() { QmlView *canvas = createView("data/grid-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); QmlGraphicsRectangle *two = canvas->rootObject()->findChild("two"); @@ -308,7 +292,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing() void tst_QmlGraphicsPositioners::test_grid_animated() { QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml"); - canvas->execute(); //Note that all animate in QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); @@ -383,8 +366,6 @@ void tst_QmlGraphicsPositioners::test_repeater() { QmlView *canvas = createView("data/repeater.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp index c971840..9f3ff45 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp +++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp @@ -68,7 +68,7 @@ private slots: void properties(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template T *findItem(QGraphicsObject *parent, const QString &id); }; @@ -164,14 +164,14 @@ tst_QmlGraphicsRepeater::tst_QmlGraphicsRepeater() void tst_QmlGraphicsRepeater::numberModel() { - QmlView *canvas = createView(SRCDIR "/data/intmodel.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", 5); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/intmodel.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem(canvas->rootObject(), "repeater"); @@ -186,7 +186,7 @@ void tst_QmlGraphicsRepeater::numberModel() void tst_QmlGraphicsRepeater::objectList() { - QmlView *canvas = createView(SRCDIR "/data/objlist.qml"); + QmlView *canvas = createView(); QObjectList data; for(int i=0; i<100; i++){ @@ -197,7 +197,7 @@ void tst_QmlGraphicsRepeater::objectList() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", QVariant::fromValue(data)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/objlist.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem(canvas->rootObject(), "repeater"); @@ -213,7 +213,7 @@ elements to test this. */ void tst_QmlGraphicsRepeater::stringList() { - QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); + QmlView *canvas = createView(); QStringList data; data << "One"; @@ -224,7 +224,7 @@ void tst_QmlGraphicsRepeater::stringList() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", data); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem(canvas->rootObject(), "repeater"); @@ -265,7 +265,7 @@ void tst_QmlGraphicsRepeater::stringList() void tst_QmlGraphicsRepeater::dataModel() { - QmlView *canvas = createView(SRCDIR "/data/repeater2.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); @@ -277,7 +277,7 @@ void tst_QmlGraphicsRepeater::dataModel() ctxt->setContextProperty("testData", &testModel); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem(canvas->rootObject(), "repeater"); @@ -297,12 +297,12 @@ void tst_QmlGraphicsRepeater::dataModel() void tst_QmlGraphicsRepeater::itemModel() { - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem(canvas->rootObject(), "repeater"); @@ -354,13 +354,11 @@ void tst_QmlGraphicsRepeater::properties() QCOMPARE(delegateSpy.count(),1); } -QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) +QmlView *tst_QmlGraphicsRepeater::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index cc2f929..0d6ac77 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -604,7 +604,6 @@ void tst_qmlgraphicstextedit::selection() void tst_qmlgraphicstextedit::inputMethodHints() { QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -619,7 +618,6 @@ void tst_qmlgraphicstextedit::inputMethodHints() void tst_qmlgraphicstextedit::cursorDelegate() { QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); view->show(); view->setFocus(); QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild("textEditObject"); @@ -651,7 +649,6 @@ void tst_qmlgraphicstextedit::delegateLoading() server.serveDirectory(SRCDIR "/data/http"); QmlView* view = new QmlView(0); view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(view->rootObject());//Wait for loading to finish. @@ -665,12 +662,10 @@ void tst_qmlgraphicstextedit::delegateLoading() delegate = view->rootObject()->findChild("delegateSlow"); QVERIFY(delegate); view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test @@ -688,7 +683,6 @@ the extent of the text, then they should ignore the keys. void tst_qmlgraphicstextedit::navigation() { QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -711,7 +705,6 @@ void tst_qmlgraphicstextedit::navigation() void tst_qmlgraphicstextedit::readOnly() { QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp index 8b45fc7..748cf5e 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp +++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp @@ -349,7 +349,6 @@ void tst_qmlgraphicstextinput::maxLength() { //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; QmlView *canvas = createView(SRCDIR "/data/maxLength.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -378,7 +377,6 @@ void tst_qmlgraphicstextinput::masks() //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; QmlView *canvas = createView(SRCDIR "/data/masks.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -403,7 +401,6 @@ void tst_qmlgraphicstextinput::validators() // here to ensure that their exposure to QML is working. QmlView *canvas = createView(SRCDIR "/data/validators.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -493,7 +490,6 @@ void tst_qmlgraphicstextinput::validators() void tst_qmlgraphicstextinput::inputMethodHints() { QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -513,7 +509,6 @@ the extent of the text, then they should ignore the keys. void tst_qmlgraphicstextinput::navigation() { QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -546,7 +541,6 @@ void tst_qmlgraphicstextinput::navigation() void tst_qmlgraphicstextinput::cursorDelegate() { QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); view->show(); view->setFocus(); QmlGraphicsTextInput *textInputObject = view->rootObject()->findChild("textInputObject"); @@ -574,7 +568,6 @@ void tst_qmlgraphicstextinput::cursorDelegate() void tst_qmlgraphicstextinput::readOnly() { QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 626e4c4..f881cd7 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -1063,11 +1063,11 @@ void QmlViewer::openQml(const QString& file_or_url) } } - canvas->setSource(url); - QTime t; t.start(); - canvas->execute(); + + canvas->setSource(url); + qWarning() << "Wall startup time:" << t.elapsed(); if (!skin) { -- cgit v0.12 From 23fb8f6e4f3f6fe4ae7611de84f09cc0095e240c Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 23 Feb 2010 15:41:25 +1000 Subject: Add missing NOTIFY signals to positioners, particles and webview Reviewed-by: Aaron Kennedy --- .../graphicsitems/qmlgraphicsparticles.cpp | 67 +++++++++++-- .../graphicsitems/qmlgraphicsparticles_p.h | 55 ++++++----- .../graphicsitems/qmlgraphicspositioners.cpp | 27 ++++- .../graphicsitems/qmlgraphicspositioners_p.h | 19 ++-- .../graphicsitems/qmlgraphicswebview.cpp | 20 +++- .../graphicsitems/qmlgraphicswebview_p.h | 15 ++- .../qmlgraphicsparticles/data/particlemotion.qml | 33 +++++++ .../tst_qmlgraphicsparticles.cpp | 88 +++++++++++++++++ .../data/propertychanges.qml | 39 ++++++++ .../tst_qmlgraphicspositioners.cpp | 59 ++++++++++- .../qmlgraphicswebview/data/propertychanges.qml | 33 +++++++ .../qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 109 +++++++++++++++++++++ 12 files changed, 521 insertions(+), 43 deletions(-) create mode 100644 tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml create mode 100644 tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp index 08fce74..e23f6f0 100644 --- a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp @@ -188,13 +188,13 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv */ /*! - \qmlproperty int ParticleMotionGravity::xattractor - \qmlproperty int ParticleMotionGravity::yattractor + \qmlproperty qreal ParticleMotionGravity::xattractor + \qmlproperty qreal ParticleMotionGravity::yattractor These properties hold the x and y coordinates of the point attracting the particles. */ /*! - \qmlproperty int ParticleMotionGravity::acceleration + \qmlproperty qreal ParticleMotionGravity::acceleration This property holds the acceleration to apply to the particles. */ @@ -213,6 +213,31 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv \brief the acceleration to apply to the particles. */ +void QmlGraphicsParticleMotionGravity::setXAttractor(qreal x) +{ + if (qFuzzyCompare(x, _xAttr)) + return; + _xAttr = x; + emit xattractorChanged(); +} + +void QmlGraphicsParticleMotionGravity::setYAttractor(qreal y) +{ + if (qFuzzyCompare(y, _yAttr)) + return; + _yAttr = y; + emit yattractorChanged(); +} + +void QmlGraphicsParticleMotionGravity::setAcceleration(qreal accel) +{ + qreal scaledAccel = accel/1000000.0; + if (qFuzzyCompare(scaledAccel, _accel)) + return; + _accel = scaledAccel; + emit accelerationChanged(); +} + void QmlGraphicsParticleMotionGravity::advance(QmlGraphicsParticle &p, int interval) { qreal xdiff = p.x - _xAttr; @@ -276,14 +301,14 @@ Rectangle { */ /*! - \qmlproperty int QmlGraphicsParticleMotionWander::xvariance - \qmlproperty int QmlGraphicsParticleMotionWander::yvariance + \qmlproperty qreal QmlGraphicsParticleMotionWander::xvariance + \qmlproperty qreal QmlGraphicsParticleMotionWander::yvariance These properties set the amount to wander in the x and y directions. */ /*! - \qmlproperty int QmlGraphicsParticleMotionWander::pace + \qmlproperty qreal QmlGraphicsParticleMotionWander::pace This property holds how quickly the paricles will move from side to side. */ @@ -335,6 +360,33 @@ void QmlGraphicsParticleMotionWander::destroy(QmlGraphicsParticle &p) delete (Data*)p.data; } +void QmlGraphicsParticleMotionWander::setXVariance(qreal var) +{ + qreal scaledVar = var / 1000.0; + if (qFuzzyCompare(scaledVar, _xvariance)) + return; + _xvariance = scaledVar; + emit xvarianceChanged(); +} + +void QmlGraphicsParticleMotionWander::setYVariance(qreal var) +{ + qreal scaledVar = var / 1000.0; + if (qFuzzyCompare(scaledVar, _yvariance)) + return; + _yvariance = scaledVar; + emit yvarianceChanged(); +} + +void QmlGraphicsParticleMotionWander::setPace(qreal pace) +{ + qreal scaledPace = pace / 1000.0; + if (qFuzzyCompare(scaledPace, _pace)) + return; + _pace = scaledPace; + emit paceChanged(); +} + //--------------------------------------------------------------------------- class QmlGraphicsParticlesPainter : public QmlGraphicsItem { @@ -1125,7 +1177,10 @@ QmlGraphicsParticleMotion *QmlGraphicsParticles::motion() const void QmlGraphicsParticles::setMotion(QmlGraphicsParticleMotion *motion) { Q_D(QmlGraphicsParticles); + if (motion == d->motion) + return; d->motion = motion; + emit motionChanged(); } /*! diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h index 7f0f9cd..8e66335 100644 --- a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h @@ -77,27 +77,32 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionGravity : public QmlGraphics { Q_OBJECT - Q_PROPERTY(int xattractor READ xAttractor WRITE setXAttractor) - Q_PROPERTY(int yattractor READ yAttractor WRITE setYAttractor) - Q_PROPERTY(int acceleration READ acceleration WRITE setAcceleration) + Q_PROPERTY(qreal xattractor READ xAttractor WRITE setXAttractor NOTIFY xattractorChanged) + Q_PROPERTY(qreal yattractor READ yAttractor WRITE setYAttractor NOTIFY yattractorChanged) + Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged) public: QmlGraphicsParticleMotionGravity(QObject *parent=0) - : QmlGraphicsParticleMotion(parent), _xAttr(0), _yAttr(0), _accel(0.00005) {} + : QmlGraphicsParticleMotion(parent), _xAttr(0.0), _yAttr(0.0), _accel(0.00005) {} - int xAttractor() const { return _xAttr; } - void setXAttractor(int x) { _xAttr = x; } + qreal xAttractor() const { return _xAttr; } + void setXAttractor(qreal x); - int yAttractor() const { return _yAttr; } - void setYAttractor(int y) { _yAttr = y; } + qreal yAttractor() const { return _yAttr; } + void setYAttractor(qreal y); - int acceleration() const { return int(_accel * 1000000); } - void setAcceleration(int accel) { _accel = qreal(accel)/1000000.0; } + qreal acceleration() const { return _accel * 1000000; } + void setAcceleration(qreal accel); virtual void advance(QmlGraphicsParticle &, int interval); +Q_SIGNALS: + void xattractorChanged(); + void yattractorChanged(); + void accelerationChanged(); + private: - int _xAttr; - int _yAttr; + qreal _xAttr; + qreal _yAttr; qreal _accel; }; @@ -121,18 +126,23 @@ public: qreal y_var; }; - Q_PROPERTY(int xvariance READ xVariance WRITE setXVariance) - int xVariance() const { return int(_xvariance * 1000); } - void setXVariance(int var) { _xvariance = var / 1000.0; } + Q_PROPERTY(qreal xvariance READ xVariance WRITE setXVariance NOTIFY xvarianceChanged) + qreal xVariance() const { return _xvariance * 1000.0; } + void setXVariance(qreal var); - Q_PROPERTY(int yvariance READ yVariance WRITE setYVariance) - int yVariance() const { return int(_yvariance * 1000); } - void setYVariance(int var) { _yvariance = var / 1000.0; } + Q_PROPERTY(qreal yvariance READ yVariance WRITE setYVariance NOTIFY yvarianceChanged) + qreal yVariance() const { return _yvariance * 1000.0; } + void setYVariance(qreal var); - Q_PROPERTY(int pace READ pace WRITE setPace) - int pace() const { return int(_pace * 1000); } - void setPace(int pace) { _pace = pace / 1000.0; } + Q_PROPERTY(qreal pace READ pace WRITE setPace NOTIFY paceChanged) + qreal pace() const { return _pace * 1000.0; } + void setPace(qreal pace); +Q_SIGNALS: + void xvarianceChanged(); + void yvarianceChanged(); + void paceChanged(); + private: QmlGraphicsParticles *particles; qreal _xvariance; @@ -157,7 +167,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticles : public QmlGraphicsItem Q_PROPERTY(qreal angleDeviation READ angleDeviation WRITE setAngleDeviation NOTIFY angleDeviationChanged) Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged) Q_PROPERTY(qreal velocityDeviation READ velocityDeviation WRITE setVelocityDeviation NOTIFY velocityDeviationChanged) - Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion) + Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion NOTIFY motionChanged) Q_CLASSINFO("DefaultProperty", "motion") public: @@ -225,6 +235,7 @@ Q_SIGNALS: void velocityChanged(); void velocityDeviationChanged(); void emittingChanged(); + void motionChanged(); private Q_SLOTS: void imageLoaded(); diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp index 8adf239..805c912 100644 --- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp @@ -138,7 +138,10 @@ QmlTransition *QmlGraphicsBasePositioner::move() const void QmlGraphicsBasePositioner::setMove(QmlTransition *mt) { Q_D(QmlGraphicsBasePositioner); + if (mt == d->moveTransition) + return; d->moveTransition = mt; + emit moveChanged(); } QmlTransition *QmlGraphicsBasePositioner::add() const @@ -150,7 +153,11 @@ QmlTransition *QmlGraphicsBasePositioner::add() const void QmlGraphicsBasePositioner::setAdd(QmlTransition *add) { Q_D(QmlGraphicsBasePositioner); + if (add == d->addTransition) + return; + d->addTransition = add; + emit addChanged(); } void QmlGraphicsBasePositioner::componentComplete() @@ -362,7 +369,7 @@ Column { move: Transition { NumberAnimation { properties: "y" - ease: "easeOutBounce" + easing: "easeOutBounce" } } } @@ -647,6 +654,24 @@ QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) : many rows some rows will be of zero width. */ +void QmlGraphicsGrid::setColumns(const int columns) +{ + if (columns == _columns) + return; + _columns = columns; + prePositioning(); + emit columnsChanged(); +} + +void QmlGraphicsGrid::setRows(const int rows) +{ + if (rows == _rows) + return; + _rows = rows; + prePositioning(); + emit rowsChanged(); +} + void QmlGraphicsGrid::doPositioning() { int c=_columns,r=_rows;//Actual number of rows/columns diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h index 1fb687a..2f905e5 100644 --- a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h +++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h @@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem Q_OBJECT Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) - Q_PROPERTY(QmlTransition *move READ move WRITE setMove) - Q_PROPERTY(QmlTransition *add READ add WRITE setAdd) + Q_PROPERTY(QmlTransition *move READ move WRITE setMove NOTIFY moveChanged) + Q_PROPERTY(QmlTransition *add READ add WRITE setAdd NOTIFY addChanged) public: enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; QmlGraphicsBasePositioner(PositionerType, QmlGraphicsItem *parent); @@ -86,6 +86,8 @@ protected: Q_SIGNALS: void spacingChanged(); + void moveChanged(); + void addChanged(); protected Q_SLOTS: virtual void doPositioning()=0; @@ -134,16 +136,21 @@ private: class Q_DECLARATIVE_EXPORT QmlGraphicsGrid : public QmlGraphicsBasePositioner { Q_OBJECT - Q_PROPERTY(int rows READ rows WRITE setRows) - Q_PROPERTY(int columns READ columns WRITE setcolumns) + Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowChanged) + Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) public: QmlGraphicsGrid(QmlGraphicsItem *parent=0); int rows() const {return _rows;} - void setRows(const int rows){_rows = rows;} + void setRows(const int rows); int columns() const {return _columns;} - void setcolumns(const int columns){_columns = columns;} + void setColumns(const int columns); + +Q_SIGNALS: + void rowsChanged(); + void columnsChanged(); + protected Q_SLOTS: virtual void doPositioning(); diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 0c21f75..f9bbb22 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -483,6 +483,8 @@ void QmlGraphicsWebView::setRenderingEnabled(bool enabled) if (d->rendering == enabled) return; d->rendering = enabled; + emit renderingEnabledChanged(); + setCacheFrozen(!enabled); if (enabled) clearCache(); @@ -596,7 +598,10 @@ int QmlGraphicsWebView::pressGrabTime() const void QmlGraphicsWebView::setPressGrabTime(int ms) { Q_D(QmlGraphicsWebView); + if (d->pressTime == ms) + return; d->pressTime = ms; + emit pressGrabTimeChanged(); } void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) @@ -1024,6 +1029,7 @@ void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl) d->pending_url = baseUrl; d->pending_string = html; } + emit htmlChanged(); } void QmlGraphicsWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) @@ -1116,8 +1122,10 @@ QmlComponent *QmlGraphicsWebView::newWindowComponent() const void QmlGraphicsWebView::setNewWindowComponent(QmlComponent *newWindow) { Q_D(QmlGraphicsWebView); - delete d->newWindowComponent; + if (newWindow == d->newWindowComponent) + return; d->newWindowComponent = newWindow; + emit newWindowComponentChanged(); } @@ -1137,8 +1145,16 @@ QmlGraphicsItem *QmlGraphicsWebView::newWindowParent() const void QmlGraphicsWebView::setNewWindowParent(QmlGraphicsItem *parent) { Q_D(QmlGraphicsWebView); - delete d->newWindowParent; + if (parent == d->newWindowParent) + return; + if (d->newWindowParent && parent) { + QList children = d->newWindowParent->childItems(); + for (int i = 0; i < children.count(); ++i) { + children.at(i)->setParentItem(parent); + } + } d->newWindowParent = parent; + emit newWindowParentChanged(); } /*! diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index 30ba0e4..ca63be9 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -97,9 +97,9 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - Q_PROPERTY(QString html READ html WRITE setHtml) + Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime) + 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) @@ -116,10 +116,10 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(QmlListProperty javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) - Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent) - Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent) + Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) + Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) - Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled) + Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) public: QmlGraphicsWebView(QmlGraphicsItem *parent=0); @@ -192,7 +192,12 @@ Q_SIGNALS: void titleChanged(const QString&); void iconChanged(); void statusTextChanged(); + void htmlChanged(); + void pressGrabTimeChanged(); void zoomFactorChanged(); + void newWindowComponentChanged(); + void newWindowParentChanged(); + void renderingEnabledChanged(); void loadStarted(); void loadFinished(); diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml new file mode 100644 index 0000000..ace61fe --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml @@ -0,0 +1,33 @@ +import Qt 4.6 +Rectangle { + width: 240 + height: 320 + color: "black" + Particles { + objectName: "particles" + anchors.fill: parent + width: 1 + height: 1 + source: "particle.png" + lifeSpan: 5000 + count: 200 + angle: 270 + angleDeviation: 45 + velocity: 50 + velocityDeviation: 30 + ParticleMotionGravity { + objectName: "motionGravity" + yattractor: 1000 + xattractor: 0 + acceleration: 25 + } + } + resources: [ + ParticleMotionWander { + objectName: "motionWander" + xvariance: 30 + yvariance: 30 + pace: 100 + } + ] +} \ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp index 195c367..9436772 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include #include @@ -50,6 +51,8 @@ public: private slots: void properties(); + void motionGravity(); + void motionWander(); void runs(); private: QmlView *createView(const QString &filename); @@ -98,6 +101,91 @@ void tst_QmlGraphicsParticles::properties() QCOMPARE(particles->emissionRate(), 12); } +void tst_QmlGraphicsParticles::motionGravity() +{ + QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QmlGraphicsParticles* particles = canvas->rootObject()->findChild("particles"); + QVERIFY(particles); + + QmlGraphicsParticleMotionGravity* motionGravity = canvas->rootObject()->findChild("motionGravity"); + QCOMPARE(particles->motion(), motionGravity); + + QSignalSpy xattractorSpy(motionGravity, SIGNAL(xattractorChanged())); + QSignalSpy yattractorSpy(motionGravity, SIGNAL(yattractorChanged())); + QSignalSpy accelerationSpy(motionGravity, SIGNAL(accelerationChanged())); + + QCOMPARE(motionGravity->xAttractor(), 0.0); + QCOMPARE(motionGravity->yAttractor(), 1000.0); + QCOMPARE(motionGravity->acceleration(), 25.0); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(motionGravity->xAttractor(), 20.0); + QCOMPARE(motionGravity->yAttractor(), 10.0); + QCOMPARE(motionGravity->acceleration(), 10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); +} + +void tst_QmlGraphicsParticles::motionWander() +{ + QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QmlGraphicsParticles* particles = canvas->rootObject()->findChild("particles"); + QVERIFY(particles); + + QSignalSpy motionSpy(particles, SIGNAL(motionChanged())); + QmlGraphicsParticleMotionWander* motionWander = canvas->rootObject()->findChild("motionWander"); + + particles->setMotion(motionWander); + QCOMPARE(particles->motion(),motionWander); + QCOMPARE(motionSpy.count(), 1); + + particles->setMotion(motionWander); + QCOMPARE(motionSpy.count(), 1); + + QSignalSpy xvarianceSpy(motionWander, SIGNAL(xvarianceChanged())); + QSignalSpy yvarianceSpy(motionWander, SIGNAL(yvarianceChanged())); + QSignalSpy paceSpy(motionWander, SIGNAL(paceChanged())); + + QCOMPARE(motionWander->xVariance(), 30.0); + QCOMPARE(motionWander->yVariance(), 30.0); + QCOMPARE(motionWander->pace(), 100.0); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(motionWander->xVariance(), 20.0); + QCOMPARE(motionWander->yVariance(), 10.0); + QCOMPARE(motionWander->pace(), 10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); +} + void tst_QmlGraphicsParticles::runs() { QmlView *canvas = createView(SRCDIR "/data/particles.qml"); diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml new file mode 100644 index 0000000..c3dc7bf --- /dev/null +++ b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Grid { + id: myGrid + + width: 270 + height: 270 + x: 3 + y: 3 + columns: 4 + spacing: 3 + + add: columnTransition + move: columnTransition + + Repeater { + model: 20 + Rectangle { color: "black"; width: 50; height: 50 } + } + + data: [ + Transition { + id: rowTransition + objectName: "rowTransition" + NumberAnimation { + properties: "x,y"; + easing: "easeOutInCubic" + } + }, + Transition { + id: columnTransition + objectName: "columnTransition" + NumberAnimation { + properties: "x,y"; + easing: "easeOutInCubic" + } + } + ] +} diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp index 348f59b..5089dc5 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include "../../../shared/util.h" @@ -61,7 +63,7 @@ private slots: void test_grid(); void test_grid_spacing(); void test_grid_animated(); - + void test_propertychanges(); void test_repeater(); private: QmlView *createView(const QString &filename); @@ -361,6 +363,61 @@ void tst_QmlGraphicsPositioners::test_grid_animated() QTRY_COMPARE(five->y(), 50.0); } +void tst_QmlGraphicsPositioners::test_propertychanges() +{ + QmlView *canvas = createView("data/propertychanges.qml"); + + QmlGraphicsGrid *grid = qobject_cast(canvas->rootObject()); + QmlTransition *rowTransition = canvas->rootObject()->findChild("rowTransition"); + QmlTransition *columnTransition = canvas->rootObject()->findChild("columnTransition"); + + QSignalSpy addSpy(grid, SIGNAL(addChanged())); + QSignalSpy moveSpy(grid, SIGNAL(moveChanged())); + QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged())); + QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged())); + + QVERIFY(grid); + QVERIFY(rowTransition); + QVERIFY(columnTransition); + QCOMPARE(grid->add(), columnTransition); + QCOMPARE(grid->move(), columnTransition); + QCOMPARE(grid->columns(), 4); + QCOMPARE(grid->rows(), -1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(grid->add(), rowTransition); + QCOMPARE(grid->move(), rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(0); + grid->setMove(0); + QCOMPARE(addSpy.count(),2); + QCOMPARE(moveSpy.count(),2); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(grid->columns(), -1); + QCOMPARE(grid->rows(), 3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(2); + grid->setRows(2); + QCOMPARE(columnsSpy.count(),2); + QCOMPARE(rowsSpy.count(),2); +} void tst_QmlGraphicsPositioners::test_repeater() { diff --git a/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml new file mode 100644 index 0000000..3dd4e51 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml @@ -0,0 +1,33 @@ +import Qt 4.6 + +Item { + width: 240 + height: 160 + Grid { + anchors.fill: parent + objectName: "newWindowParent" + id: newWindowParent + } + + Row { + anchors.fill: parent + id: oldWindowParent + objectName: "oldWindowParent" + } + + Loader { + sourceComponent: webViewComponent + } + Component { + id: webViewComponent + WebView { + id: webView + objectName: "webView" + newWindowComponent: webViewComponent + newWindowParent: oldWindowParent + url: "basic.html" + renderingEnabled: true + pressGrabTime: 200 + } + } +} \ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index f3c39f8..5815e22 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include "../../../shared/util.h" #include #include @@ -69,6 +70,10 @@ private slots: void javaScript(); void cleanupTestCase(); void pixelCache(); + void newWindowParent(); + void newWindowComponent(); + void renderingEnabled(); + void pressGrabTime(); private: void checkNoErrors(const QmlComponent& component); @@ -335,6 +340,10 @@ void tst_qmlgraphicswebview::setHtml() QmlGraphicsWebView *wv = qobject_cast(component.create()); QVERIFY(wv != 0); QCOMPARE(wv->html(),QString("

This is a string set on the WebView

")); + + QSignalSpy spy(wv, SIGNAL(htmlChanged())); + wv->setHtml(QString("Basic

text

")); + QCOMPARE(spy.count(),1); } void tst_qmlgraphicswebview::elementAreaAt() @@ -391,6 +400,106 @@ void tst_qmlgraphicswebview::pixelCache() QCOMPARE(wv->pixelsPainted(), expected*3); // repainted } +void tst_qmlgraphicswebview::newWindowParent() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QmlGraphicsItem* oldWindowParent = rootItem->findChild("oldWindowParent"); + QCOMPARE(wv->newWindowParent(), oldWindowParent); + QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged())); + + QmlGraphicsItem* newWindowParent = rootItem->findChild("newWindowParent"); + wv->setNewWindowParent(newWindowParent); + QVERIFY(oldWindowParent); + QVERIFY(oldWindowParent->childItems().count() == 0); + QCOMPARE(wv->newWindowParent(), newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(0); + QCOMPARE(newWindowParentSpy.count(),2); +} + +void tst_qmlgraphicswebview::newWindowComponent() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QmlComponent substituteComponent(&engine); + substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); + + wv->setNewWindowComponent(&substituteComponent); + QCOMPARE(wv->newWindowComponent(), &substituteComponent); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(&substituteComponent); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(0); + QCOMPARE(newWindowComponentSpy.count(),2); +} + +void tst_qmlgraphicswebview::renderingEnabled() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QVERIFY(wv->renderingEnabled()); + QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged())); + + wv->setRenderingEnabled(false); + QVERIFY(!wv->renderingEnabled()); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(false); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(true); + QCOMPARE(renderingEnabledSpy.count(),2); +} + +void tst_qmlgraphicswebview::pressGrabTime() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->pressGrabTime(), 200); + QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged())); + + wv->setPressGrabTime(100); + QCOMPARE(wv->pressGrabTime(), 100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(0); + QCOMPARE(pressGrabTimeSpy.count(),2); +} + QTEST_MAIN(tst_qmlgraphicswebview) #include "tst_qmlgraphicswebview.moc" -- cgit v0.12 From ac99b3e243b331d26815b80aab97cdaf0ed06b0f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 23 Feb 2010 09:03:48 +0100 Subject: Fix GL viewports under -graphicssystem raster. GL widgets and native controls have paintonscreen set and bypasses backingstore. They can thus not rely on the windowsurface flushing but must be repainted via normal means --- src/gui/kernel/qcocoaview_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index d5e7534..0714f73 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -461,8 +461,9 @@ extern "C" { if (QApplicationPrivate::graphicsSystem() != 0) { if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) { // Drawing is handled on the window level - // See qcocoasharedwindowmethods_mac_p. - return; + // See qcocoasharedwindowmethods_mac_p.h + if (!qwidget->testAttribute(Qt::WA_PaintOnScreen)) + return; } } CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; -- cgit v0.12 From ab2497c20116399e963748adf0ed2bf691d42cbf Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 22 Feb 2010 18:51:40 +1000 Subject: Add QEasingCurve as builtin metatype This is needed for qml, in order to be able to use easing as a valuetype. Task-number: QTBUG-8235 Reviewed-by: thierry Reviewed-by: janarve --- src/corelib/kernel/qmetatype.cpp | 26 ++++++ src/corelib/kernel/qmetatype.h | 8 +- src/corelib/kernel/qvariant.cpp | 55 ++++++++++++- src/corelib/kernel/qvariant.h | 12 ++- src/corelib/tools/qeasingcurve.cpp | 69 +++++++++++++++- src/corelib/tools/qeasingcurve.h | 11 +++ tests/auto/qeasingcurve/tst_qeasingcurve.cpp | 115 +++++++++++++++++++++++++++ 7 files changed, 285 insertions(+), 11 deletions(-) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 870baab..9e187d4 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -48,6 +48,7 @@ #include "qstringlist.h" #include "qvector.h" #include "qlocale.h" +#include "qeasingcurve.h" #ifdef QT_BOOTSTRAPPED # ifndef QT_NO_GEOM_VARIANT @@ -176,6 +177,7 @@ QT_BEGIN_NAMESPACE \value QVector3D QVector3D \value QVector4D QVector4D \value QQuaternion QQuaternion + \value QEasingCurve QEasingCurve \value User Base value for user types @@ -256,6 +258,7 @@ static const struct { const char * typeName; int type; } types[] = { {"QPointF", QMetaType::QPointF}, {"QRegExp", QMetaType::QRegExp}, {"QVariantHash", QMetaType::QVariantHash}, + {"QEasingCurve", QMetaType::QEasingCurve}, /* All GUI types */ {"QColorGroup", 63}, @@ -666,6 +669,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) stream << *static_cast(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + stream << *static_cast(data); + break; +#endif #ifdef QT3_SUPPORT case QMetaType::QColorGroup: #endif @@ -863,6 +871,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) stream >> *static_cast< NS(QRegExp)*>(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + stream >> *static_cast< NS(QEasingCurve)*>(data); + break; +#endif #ifdef QT3_SUPPORT case QMetaType::QColorGroup: #endif @@ -1007,6 +1020,10 @@ void *QMetaType::construct(int type, const void *copy) case QMetaType::QRegExp: return new NS(QRegExp)(*static_cast(copy)); #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + return new NS(QEasingCurve)(*static_cast(copy)); +#endif case QMetaType::Void: return 0; default: @@ -1098,6 +1115,10 @@ void *QMetaType::construct(int type, const void *copy) case QMetaType::QRegExp: return new NS(QRegExp); #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + return new NS(QEasingCurve); +#endif case QMetaType::Void: return 0; default: @@ -1253,6 +1274,11 @@ void QMetaType::destroy(int type, void *data) delete static_cast< NS(QRegExp)* >(data); break; #endif +#ifndef QT_BOOTSTRAPPED + case QMetaType::QEasingCurve: + delete static_cast< NS(QEasingCurve)* >(data); + break; +#endif case QMetaType::Void: break; default: { diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index c23caed..33126e8 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -69,7 +69,7 @@ public: QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17, QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22, QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, - QVariantHash = 28, LastCoreType = 28 /* QVariantHash */, + QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve, FirstGuiType = 63 /* QColorGroup */, #ifdef QT3_SUPPORT @@ -81,12 +81,12 @@ public: QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85, QQuaternion = 86, - LastGuiType = 86 /* QQuaternion */, + LastGuiType = QQuaternion, FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, - LastCoreExtType = 137 /* QWidgetStar */, + LastCoreExtType = QWidgetStar, // This logic must match the one in qglobal.h #if defined(QT_COORD_TYPE) @@ -290,6 +290,7 @@ class QPointF; #ifndef QT_NO_REGEXP class QRegExp; #endif +class QEasingCurve; class QWidget; class QObject; @@ -359,6 +360,7 @@ Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF) #ifndef QT_NO_REGEXP Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp) #endif +Q_DECLARE_BUILTIN_METATYPE(QEasingCurve, QEasingCurve) #ifdef QT3_SUPPORT Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index e1b5825..384a3cd 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -46,6 +46,7 @@ #include "qdebug.h" #include "qmap.h" #include "qdatetime.h" +#include "qeasingcurve.h" #include "qlist.h" #include "qstring.h" #include "qstringlist.h" @@ -146,6 +147,11 @@ static void construct(QVariant::Private *x, const void *copy) v_construct(x, copy); break; #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + v_construct(x, copy); + break; +#endif case QVariant::Int: x->data.i = copy ? *static_cast(copy) : 0; break; @@ -259,6 +265,11 @@ static void clear(QVariant::Private *d) v_clear(d); break; #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + v_clear(d); + break; +#endif case QVariant::LongLong: case QVariant::ULongLong: case QVariant::Double: @@ -317,6 +328,9 @@ static bool isNull(const QVariant::Private *d) case QVariant::PointF: return v_cast(d)->isNull(); #endif +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: +#endif case QVariant::Url: case QVariant::Locale: case QVariant::RegExp: @@ -435,6 +449,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return *v_cast(a) == *v_cast(b); case QVariant::DateTime: return *v_cast(a) == *v_cast(b); +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + return *v_cast(a) == *v_cast(b); +#endif case QVariant::ByteArray: return *v_cast(a) == *v_cast(b); case QVariant::BitArray: @@ -1097,6 +1115,11 @@ static void streamDebug(QDebug dbg, const QVariant &v) case QVariant::DateTime: dbg.nospace() << v.toDateTime(); break; +#ifndef QT_BOOTSTRAPPED + case QVariant::EasingCurve: + dbg.nospace() << v.toEasingCurve(); + break; +#endif case QVariant::ByteArray: dbg.nospace() << v.toByteArray(); break; @@ -1265,6 +1288,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler; \value Date a QDate \value DateTime a QDateTime \value Double a double + \value EasingCurve a QEasingCurve \value Font a QFont \value Hash a QVariantHash \value Icon a QIcon @@ -1483,6 +1507,12 @@ QVariant::QVariant(const char *val) */ /*! + \fn QVariant::QVariant(const QEasingCurve &val) + + Constructs a new variant with an easing curve value, \a val. +*/ + +/*! \fn QVariant::QVariant(const QByteArray &val) Constructs a new variant with a bytearray value, \a val. @@ -1681,6 +1711,10 @@ QVariant::QVariant(const QTime &val) { d.is_null = false; d.type = Time; v_construct(&d, val); } QVariant::QVariant(const QDateTime &val) { d.is_null = false; d.type = DateTime; v_construct(&d, val); } +#ifndef QT_BOOTSTRAPPED +QVariant::QVariant(const QEasingCurve &val) +{ d.is_null = false; d.type = EasingCurve; v_construct(&d, val); } +#endif QVariant::QVariant(const QList &list) { d.is_null = false; d.type = List; v_construct(&d, list); } QVariant::QVariant(const QMap &map) @@ -1870,7 +1904,7 @@ QVariant::Type QVariant::nameToType(const char *name) } #ifndef QT_NO_DATASTREAM -enum { MapFromThreeCount = 35 }; +enum { MapFromThreeCount = 36 }; static const ushort map_from_three[MapFromThreeCount] = { QVariant::Invalid, @@ -1902,6 +1936,7 @@ static const ushort map_from_three[MapFromThreeCount] = QVariant::Date, QVariant::Time, QVariant::DateTime, + QVariant::EasingCurve, QVariant::ByteArray, QVariant::BitArray, QVariant::KeySequence, @@ -2165,6 +2200,21 @@ QDateTime QVariant::toDateTime() const } /*! + \fn QEasingCurve QVariant::toEasingCurve() const + + Returns the variant as a QEasingCurve if the variant has type() \l + EasingCurve; otherwise returns a default easing curve. + + \sa canConvert(), convert() +*/ +#ifndef QT_BOOTSTRAPPED +QEasingCurve QVariant::toEasingCurve() const +{ + return qVariantToHelper(d, EasingCurve, handler); +} +#endif + +/*! \fn QByteArray QVariant::toByteArray() const Returns the variant as a QByteArray if the variant has type() \l @@ -2605,8 +2655,9 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] = /*QRegExp*/ 0, -/*QHash*/ 0 +/*QHash*/ 0, +/*QEasingCurve*/ 0 }; /*! diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 1a9e43a..9628dbf 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -60,6 +60,7 @@ class QBitArray; class QDataStream; class QDate; class QDateTime; +class QEasingCurve; class QLine; class QLineF; class QLocale; @@ -128,9 +129,10 @@ class Q_CORE_EXPORT QVariant LineF = 24, Point = 25, PointF = 26, - RegExp = 27, + RegExp = 27, Hash = 28, - LastCoreType = Hash, + EasingCurve = 29, + LastCoreType = EasingCurve, // value 62 is internally reserved #ifdef QT3_SUPPORT @@ -219,6 +221,9 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QVariant(const QRegExp ®Exp); #endif +#ifndef QT_BOOTSTRAPPED + QVariant(const QEasingCurve &easing); +#endif QVariant(Qt::GlobalColor color); QVariant& operator=(const QVariant &other); @@ -280,6 +285,9 @@ class Q_CORE_EXPORT QVariant #ifndef QT_NO_REGEXP QRegExp toRegExp() const; #endif +#ifndef QT_BOOTSTRAPPED + QEasingCurve toEasingCurve() const; +#endif #ifdef QT3_SUPPORT inline QT3_SUPPORT int &asInt(); diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index b6a2df4..6b26907 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -600,11 +600,11 @@ QEasingCurve::QEasingCurve(Type type) Construct a copy of \a other. */ QEasingCurve::QEasingCurve(const QEasingCurve &other) -: d_ptr(new QEasingCurvePrivate) + : d_ptr(new QEasingCurvePrivate) { // ### non-atomic, requires malloc on shallow copy *d_ptr = *other.d_ptr; - if(other.d_ptr->config) + if (other.d_ptr->config) d_ptr->config = other.d_ptr->config->copy(); } @@ -629,7 +629,7 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other) } *d_ptr = *other.d_ptr; - if(other.d_ptr->config) + if (other.d_ptr->config) d_ptr->config = other.d_ptr->config->copy(); return *this; @@ -845,6 +845,67 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) } return debug; } -#endif +#endif // QT_NO_DEBUG_STREAM + +#ifndef QT_NO_DATASTREAM +/*! + \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) + \relates QEasingCurve + + Writes the given \a easing curve to the given \a stream and returns a + reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) +{ + stream << easing.d_ptr->type; + stream << intptr_t(easing.d_ptr->func); + + bool hasConfig = easing.d_ptr->config; + stream << hasConfig; + if (hasConfig) { + stream << easing.d_ptr->config->_p; + stream << easing.d_ptr->config->_a; + stream << easing.d_ptr->config->_o; + } + return stream; +} + +/*! + \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) + \relates QQuaternion + + Reads an easing curve from the given \a stream into the given \a quaternion + and returns a reference to the stream. + + \sa {Format of the QDataStream Operators} +*/ + +QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) +{ + QEasingCurve::Type type; + int int_type; + stream >> int_type; + type = static_cast(int_type); + easing.setType(type); + + intptr_t ptr_func; + stream >> ptr_func; + easing.d_ptr->func = QEasingCurve::EasingFunction(ptr_func); + + bool hasConfig; + stream >> hasConfig; + if (hasConfig) { + QEasingCurveFunction *config = curveToFunctionObject(type); + stream >> config->_p; + stream >> config->_a; + stream >> config->_o; + easing.d_ptr->config = config; + } + return stream; +} +#endif // QT_NO_DATASTREAM QT_END_NAMESPACE diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index ae8822e..173fba4 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -100,13 +100,24 @@ public: qreal valueForProgress(qreal progress) const; private: QEasingCurvePrivate *d_ptr; +#ifndef QT_NO_DEBUG_STREAM friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); +#endif +#ifndef QT_NO_DATASTREAM + friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&); + friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif }; #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item); #endif +#ifndef QT_NO_DATASTREAM +Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&); +Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 12ddff1..abb4014 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -69,6 +69,10 @@ private slots: void valueForProgress(); void setCustomType(); void operators(); + void dataStreamOperators_data(); + void dataStreamOperators(); + void properties(); + void metaTypes(); protected: }; @@ -505,6 +509,117 @@ void tst_QEasingCurve::operators() QVERIFY(curve2 == curve); } +void tst_QEasingCurve::dataStreamOperators_data() +{ + QTest::addColumn("type"); + QTest::addColumn("amplitude"); + QTest::addColumn("overshoot"); + QTest::addColumn("period"); + QTest::addColumn("easingCurve"); + QTest::newRow("Linear") << int(QEasingCurve::Linear) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::Linear); + QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCubic); + QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::InOutSine); + QEasingCurve inOutElastic(QEasingCurve::InOutElastic); + inOutElastic.setPeriod(1.5); + inOutElastic.setAmplitude(2.0); + QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic) << 2.0 << -1.0 << 1.5 << inOutElastic; + QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutInBack); + QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCurve); + QEasingCurve inOutBack(QEasingCurve::InOutBack); + inOutBack.setOvershoot(0.5); + QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack) << -1.0 << 0.5 << -1.0 << inOutBack; +} + +void tst_QEasingCurve::dataStreamOperators() +{ + QFETCH(int, type); + QFETCH(qreal, amplitude); + QFETCH(qreal, overshoot); + QFETCH(qreal, period); + QFETCH(QEasingCurve, easingCurve); + + // operator << + QEasingCurve curve; + curve.setType(QEasingCurve::Type(type)); + if (amplitude != -1.0) + curve.setAmplitude(amplitude); + if (overshoot != -1.0) + curve.setOvershoot(overshoot); + if (period != -1.0) + curve.setPeriod(period); + + QVERIFY(easingCurve == curve); + + QByteArray array; + QDataStream out(&array, QIODevice::WriteOnly); + out << curve; + + QDataStream in(array); + QEasingCurve curve2; + in >> curve2; + + QVERIFY(curve2 == curve); +} + +class tst_QEasingProperties : public QObject +{ + Q_OBJECT + Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing) +public: + tst_QEasingProperties(QObject *parent = 0) : QObject(parent) {} + + QEasingCurve easing() const { return e; } + void setEasing(const QEasingCurve& value) { e = value; } + +private: + QEasingCurve e; +}; + +// Test getting and setting easing properties via the metaobject system. +void tst_QEasingCurve::properties() +{ + tst_QEasingProperties obj; + + QEasingCurve inOutBack(QEasingCurve::InOutBack); + qreal overshoot = 1.5f; + inOutBack.setOvershoot(overshoot); + qreal amplitude = inOutBack.amplitude(); + qreal period = inOutBack.period(); + + obj.setEasing(inOutBack); + + QEasingCurve easing = qVariantValue(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::InOutBack); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); + + QEasingCurve linear(QEasingCurve::Linear); + overshoot = linear.overshoot(); + amplitude = linear.amplitude(); + period = linear.period(); + + obj.setProperty("easing", + qVariantFromValue(QEasingCurve(QEasingCurve::Linear))); + + easing = qVariantValue(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::Linear); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); +} + +void tst_QEasingCurve::metaTypes() +{ + QVERIFY(QMetaType::type("QEasingCurve") == QMetaType::QEasingCurve); + + QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QEasingCurve)), + QByteArray("QEasingCurve")); + + QVERIFY(QMetaType::isRegistered(QMetaType::QEasingCurve)); + + QVERIFY(qMetaTypeId() == QMetaType::QEasingCurve); +} QTEST_MAIN(tst_QEasingCurve) #include "tst_qeasingcurve.moc" -- cgit v0.12 From 0a7ca8efdd292f317d4c95a80485d9d51f14a694 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 23 Feb 2010 13:29:04 +1000 Subject: Adds QmlEasingValueType to qml Now it's possible to use easing curve types directly in qml as value types, {easing.type: "OutBounce"; easing.amplitude: 3}, instead of the former ugly string format, like "easeOutBounce(amplitude:3.0)". Reviewed-by: akennedy --- doc/src/declarative/animation.qdoc | 12 +- src/declarative/qml/qmlvaluetype.cpp | 70 +++++++++ src/declarative/qml/qmlvaluetype_p.h | 57 +++++++ src/declarative/util/qmlanimation.cpp | 163 ++++++--------------- src/declarative/util/qmlanimation_p.h | 9 +- src/declarative/util/qmlanimation_p_p.h | 2 +- .../qmlanimations/tst_qmlanimations.cpp | 105 ++++++------- 7 files changed, 237 insertions(+), 181 deletions(-) diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index d80c3fa..892535e 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -72,9 +72,9 @@ Rectangle { y: 0 y: SequentialAnimation { repeat: true - NumberAnimation { to: 200-img.height; easing: "easeOutBounce"; duration: 2000 } + NumberAnimation { to: 200-img.height; easing.type: "OutBounce"; duration: 2000 } PauseAnimation { duration: 1000 } - NumberAnimation { to: 0; easing: "easeOutQuad"; duration: 1000 } + NumberAnimation { to: 0; easing.type: "OutQuad"; duration: 1000 } } } } @@ -135,7 +135,7 @@ transitions: [ Transition { NumberAnimation { properties: "x,y" - easing: "easeOutBounce" + easing.type: "OutBounce" duration: 200 } } @@ -156,7 +156,7 @@ Transition { SequentialAnimation { NumberAnimation { duration: 1000 - easing: "easeOutBounce" + easing.type: "OutBounce" // animate myItem's x and y if they have changed in the state target: myItem properties: "x,y" @@ -198,7 +198,7 @@ Transition { ParallelAnimation { NumberAnimation { duration: 1000 - easing: "easeOutBounce" + easing.type: "OutBounce" targets: box1 properties: "x,y" } @@ -226,7 +226,7 @@ Rectangle { id: redRect color: "red" width: 100; height: 100 - x: Behavior { NumberAnimation { duration: 300; easing: "InOutQuad" } } + x: Behavior { NumberAnimation { duration: 300; easing.type: "InOutQuad" } } } \endqml diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp index 33c3e76..e3b4219 100644 --- a/src/declarative/qml/qmlvaluetype.cpp +++ b/src/declarative/qml/qmlvaluetype.cpp @@ -75,6 +75,8 @@ QmlValueType *QmlValueTypeFactory::valueType(int t) return new QmlRectFValueType; case QVariant::Vector3D: return new QmlVector3DValueType; + case QVariant::EasingCurve: + return new QmlEasingValueType; case QVariant::Font: return new QmlFontValueType; default: @@ -473,6 +475,74 @@ void QmlVector3DValueType::setZ(qreal z) vector.setZ(z); } +QmlEasingValueType::QmlEasingValueType(QObject *parent) +: QmlValueType(parent) +{ +} + +void QmlEasingValueType::read(QObject *obj, int idx) +{ + void *a[] = { &easing, 0 }; + QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); +} + +void QmlEasingValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags) +{ + int status = -1; + void *a[] = { &easing, 0, &status, &flags }; + QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a); +} + +QVariant QmlEasingValueType::value() +{ + return QVariant(easing); +} + +void QmlEasingValueType::setValue(QVariant value) +{ + easing = qvariant_cast(value); +} + +QmlEasingValueType::Type QmlEasingValueType::type() const +{ + return (QmlEasingValueType::Type)easing.type(); +} + +qreal QmlEasingValueType::amplitude() const +{ + return easing.amplitude(); +} + +qreal QmlEasingValueType::overshoot() const +{ + return easing.overshoot(); +} + +qreal QmlEasingValueType::period() const +{ + return easing.period(); +} + +void QmlEasingValueType::setType(QmlEasingValueType::Type type) +{ + easing.setType((QEasingCurve::Type)type); +} + +void QmlEasingValueType::setAmplitude(qreal amplitude) +{ + easing.setAmplitude(amplitude); +} + +void QmlEasingValueType::setOvershoot(qreal overshoot) +{ + easing.setOvershoot(overshoot); +} + +void QmlEasingValueType::setPeriod(qreal period) +{ + easing.setPeriod(period); +} + QmlFontValueType::QmlFontValueType(QObject *parent) : QmlValueType(parent), hasPixelSize(false) { diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h index 0a152e8..6dd3703 100644 --- a/src/declarative/qml/qmlvaluetype_p.h +++ b/src/declarative/qml/qmlvaluetype_p.h @@ -57,6 +57,7 @@ #include #include +#include #include #include #include @@ -256,6 +257,62 @@ private: QVector3D vector; }; +class Q_AUTOTEST_EXPORT QmlEasingValueType : public QmlValueType +{ + Q_OBJECT + Q_ENUMS(Type) + + Q_PROPERTY(QmlEasingValueType::Type type READ type WRITE setType) + Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude) + Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot) + Q_PROPERTY(qreal period READ period WRITE setPeriod) +public: + enum Type { + Linear = QEasingCurve::Linear, + InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad, + InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad, + InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic, + InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic, + InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart, + InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart, + InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint, + InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint, + InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine, + InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine, + InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo, + InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo, + InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc, + InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc, + InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic, + InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic, + InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack, + InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack, + InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce, + InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce, + InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve, + SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve, + }; + + QmlEasingValueType(QObject *parent = 0); + + virtual void read(QObject *, int); + virtual void write(QObject *, int, QmlMetaProperty::WriteFlags); + virtual QVariant value(); + virtual void setValue(QVariant value); + + Type type() const; + qreal amplitude() const; + qreal overshoot() const; + qreal period() const; + void setType(Type); + void setAmplitude(qreal); + void setOvershoot(qreal); + void setPeriod(qreal); + +private: + QEasingCurve easing; +}; + class Q_AUTOTEST_EXPORT QmlFontValueType : public QmlValueType { Q_OBJECT diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 6dcce58..2f24167 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -66,79 +66,6 @@ QT_BEGIN_NAMESPACE -static QEasingCurve stringToCurve(const QString &curve, QObject *obj) -{ - QEasingCurve easingCurve; - - QString normalizedCurve = curve; - bool hasParams = curve.contains(QLatin1Char('(')); - QStringList props; - - if (hasParams) { - QString easeName = curve.trimmed(); - if (!easeName.endsWith(QLatin1Char(')'))) { - qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve); - return easingCurve; - } - - int idx = easeName.indexOf(QLatin1Char('(')); - QString prop_str = - easeName.mid(idx + 1, easeName.length() - 1 - idx - 1); - normalizedCurve = easeName.left(idx); - if (!normalizedCurve.startsWith(QLatin1String("ease"))) { - qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve); - return easingCurve; - } - - props = prop_str.split(QLatin1Char(',')); - } - - if (normalizedCurve.startsWith(QLatin1String("ease"))) - normalizedCurve = normalizedCurve.mid(4); - - static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type"); - static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index); - - int value = me.keyToValue(normalizedCurve.toUtf8().constData()); - if (value < 0) { - qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve); - return easingCurve; - } - easingCurve.setType((QEasingCurve::Type)value); - - if (hasParams) { - foreach(const QString &str, props) { - int sep = str.indexOf(QLatin1Char(':')); - - if (sep == -1) { - qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve); - continue; - } - - QString propName = str.left(sep).trimmed(); - bool isOk; - qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk); - - if (propName.isEmpty() || !isOk) { - qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve); - continue; - } - - if (propName == QLatin1String("amplitude")) { - easingCurve.setAmplitude(propValue); - } else if (propName == QLatin1String("period")) { - easingCurve.setPeriod(propValue); - } else if (propName == QLatin1String("overshoot")) { - easingCurve.setOvershoot(propValue); - } else { - qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName); - continue; - } - } - } - return easingCurve; -} - QML_DEFINE_NOCREATE_TYPE(QmlAbstractAnimation) /*! @@ -1927,195 +1854,195 @@ void QmlPropertyAnimation::setTo(const QVariant &t) } /*! - \qmlproperty string PropertyAnimation::easing + \qmlproperty QEasingCurve PropertyAnimation::easing \brief the easing curve used for the transition. Available values are: \table \row - \o \c easeLinear + \o \c Linear \o Easing curve for a linear (t) function: velocity is constant. \o \inlineimage qeasingcurve-linear.png \row - \o \c easeInQuad + \o \c InQuad \o Easing curve for a quadratic (t^2) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-inquad.png \row - \o \c easeOutQuad + \o \c OutQuad \o Easing curve for a quadratic (t^2) function: decelerating to zero velocity. \o \inlineimage qeasingcurve-outquad.png \row - \o \c easeInOutQuad + \o \c InOutQuad \o Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutquad.png \row - \o \c easeOutInQuad + \o \c OutInQuad \o Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinquad.png \row - \o \c easeInCubic + \o \c InCubic \o Easing curve for a cubic (t^3) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-incubic.png \row - \o \c easeOutCubic + \o \c OutCubic \o Easing curve for a cubic (t^3) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outcubic.png \row - \o \c easeInOutCubic + \o \c InOutCubic \o Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutcubic.png \row - \o \c easeOutInCubic + \o \c OutInCubic \o Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outincubic.png \row - \o \c easeInQuart + \o \c InQuart \o Easing curve for a quartic (t^4) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-inquart.png \row - \o \c easeOutQuart + \o \c OutQuart \o Easing curve for a cubic (t^4) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outquart.png \row - \o \c easeInOutQuart + \o \c InOutQuart \o Easing curve for a cubic (t^4) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutquart.png \row - \o \c easeOutInQuart + \o \c OutInQuart \o Easing curve for a cubic (t^4) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinquart.png \row - \o \c easeInQuint + \o \c InQuint \o Easing curve for a quintic (t^5) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-inquint.png \row - \o \c easeOutQuint + \o \c OutQuint \o Easing curve for a cubic (t^5) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outquint.png \row - \o \c easeInOutQuint + \o \c InOutQuint \o Easing curve for a cubic (t^5) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutquint.png \row - \o \c easeOutInQuint + \o \c OutInQuint \o Easing curve for a cubic (t^5) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinquint.png \row - \o \c easeInSine + \o \c InSine \o Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-insine.png \row - \o \c easeOutSine + \o \c OutSine \o Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outsine.png \row - \o \c easeInOutSine + \o \c InOutSine \o Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutsine.png \row - \o \c easeOutInSine + \o \c OutInSine \o Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinsine.png \row - \o \c easeInExpo + \o \c InExpo \o Easing curve for an exponential (2^t) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-inexpo.png \row - \o \c easeOutExpo + \o \c OutExpo \o Easing curve for an exponential (2^t) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outexpo.png \row - \o \c easeInOutExpo + \o \c InOutExpo \o Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutexpo.png \row - \o \c easeOutInExpo + \o \c OutInExpo \o Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinexpo.png \row - \o \c easeInCirc + \o \c InCirc \o Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-incirc.png \row - \o \c easeOutCirc + \o \c OutCirc \o Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outcirc.png \row - \o \c easeInOutCirc + \o \c InOutCirc \o Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutcirc.png \row - \o \c easeOutInCirc + \o \c OutInCirc \o Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outincirc.png \row - \o \c easeInElastic + \o \c InElastic \o Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity. \br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. \o \inlineimage qeasingcurve-inelastic.png \row - \o \c easeOutElastic + \o \c OutElastic \o Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity. \br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter. \o \inlineimage qeasingcurve-outelastic.png \row - \o \c easeInOutElastic + \o \c InOutElastic \o Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutelastic.png \row - \o \c easeOutInElastic + \o \c OutInElastic \o Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinelastic.png \row - \o \c easeInBack + \o \c InBack \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. \o \inlineimage qeasingcurve-inback.png \row - \o \c easeOutBack + \o \c OutBack \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity. \o \inlineimage qeasingcurve-outback.png \row - \o \c easeInOutBack + \o \c InOutBack \o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutback.png \row - \o \c easeOutInBack + \o \c OutInBack \o Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinback.png \row - \o \c easeInBounce + \o \c InBounce \o Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity. \o \inlineimage qeasingcurve-inbounce.png \row - \o \c easeOutBounce + \o \c OutBounce \o Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity. \o \inlineimage qeasingcurve-outbounce.png \row - \o \c easeInOutBounce + \o \c InOutBounce \o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration. \o \inlineimage qeasingcurve-inoutbounce.png \row - \o \c easeOutInBounce + \o \c OutInBounce \o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration. \o \inlineimage qeasingcurve-outinbounce.png \endtable */ -QString QmlPropertyAnimation::easing() const +QEasingCurve QmlPropertyAnimation::easing() const { Q_D(const QmlPropertyAnimation); return d->easing; } -void QmlPropertyAnimation::setEasing(const QString &e) +void QmlPropertyAnimation::setEasing(const QEasingCurve &e) { Q_D(QmlPropertyAnimation); if (d->easing == e) return; d->easing = e; - d->va->setEasingCurve(stringToCurve(d->easing, this)); + d->va->setEasingCurve(d->easing); emit easingChanged(e); } diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 623ad8d..fd868bc 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -51,6 +51,7 @@ #include #include +#include #include #include @@ -261,7 +262,7 @@ class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged) - Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) + Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) @@ -281,8 +282,8 @@ public: QVariant to() const; void setTo(const QVariant &); - QString easing() const; - void setEasing(const QString &); + QEasingCurve easing() const; + void setEasing(const QEasingCurve &); QObject *target() const; void setTarget(QObject *); @@ -307,7 +308,7 @@ Q_SIGNALS: void durationChanged(int); void fromChanged(QVariant); void toChanged(QVariant); - void easingChanged(const QString &); + void easingChanged(const QEasingCurve &); void propertiesChanged(const QString &); void targetChanged(QObject *, const QString &); }; diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 056ce82..8c88f14 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -327,7 +327,7 @@ public: QVariant from; QVariant to; - QString easing; + QEasingCurve easing; QObject *target; QString propertyName; diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index 1f6347e..00e099e 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -45,6 +45,7 @@ #include #include #include +#include class tst_qmlanimations : public QObject { @@ -67,11 +68,11 @@ private slots: void mixedTypes(); void properties(); void propertiesTransition(); - void easingStringConversion(); void invalidDuration(); void attached(); void propertyValueSourceDefaultStart(); void dontStart(); + void easingProperties(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -517,57 +518,6 @@ void tst_qmlanimations::propertiesTransition() }*/ } -void tst_qmlanimations::easingStringConversion() -{ - QmlNumberAnimation *animation = new QmlNumberAnimation; - animation->setEasing("easeInOutQuad"); - QCOMPARE(animation->easing(),QLatin1String("easeInOutQuad")); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutQuad)); - - animation->setEasing("OutQuad"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::OutQuad)); - - animation->setEasing("easeOutBounce(amplitude: 5)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutBounce); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - - animation->setEasing("easeOutElastic(amplitude: 5, period: 3)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutElastic); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().period(), qreal(3)); - - animation->setEasing("easeInOutBack(overshoot: 2)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutBack); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().overshoot(), qreal(2)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unmatched parenthesis in easing function \"easeInOutBack(overshoot: 2\""); - animation->setEasing("easeInOutBack(overshoot: 2"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Easing function \"InOutBack(overshoot: 2)\" must start with \"ease\""); - animation->setEasing("InOutBack(overshoot: 2)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing curve \"NonExistantEase\""); - animation->setEasing("NonExistantEase"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude 5)\""); - animation->setEasing("easeInOutElastic(amplitude 5)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude: yes)\""); - animation->setEasing("easeInOutElastic(amplitude: yes)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - QVERIFY(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistentproperty\""); - animation->setEasing("easeOutQuad(nonexistentproperty: 12)"); - QCOMPARE(static_cast(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad); - - delete animation; -} - void tst_qmlanimations::invalidDuration() { QmlPropertyAnimation *animation = new QmlPropertyAnimation; @@ -666,6 +616,57 @@ void tst_qmlanimations::dontStart() } } +void tst_qmlanimations::easingProperties() +{ + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce); + QCOMPARE(animObject->easing().amplitude(), 5.0); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic); + QCOMPARE(animObject->easing().amplitude(), 5.0); + QCOMPARE(animObject->easing().period(), 3.0); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack); + QCOMPARE(animObject->easing().overshoot(), 2.0); + } +} + QTEST_MAIN(tst_qmlanimations) #include "tst_qmlanimations.moc" -- cgit v0.12 From 9701facad44f8e435f0efe6417ffb7d17d5712e7 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 23 Feb 2010 17:25:10 +1000 Subject: Updates all qml examples/demos to use the easing curve value type syntax --- demos/declarative/calculator/calculator.qml | 4 +- demos/declarative/flickr/common/ImageDetails.qml | 2 +- demos/declarative/flickr/common/MediaLineEdit.qml | 2 +- demos/declarative/flickr/common/Star.qml | 2 +- demos/declarative/flickr/flickr-desktop.qml | 6 +- demos/declarative/flickr/flickr-mobile.qml | 4 +- demos/declarative/flickr/mobile/GridDelegate.qml | 6 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/TitleBar.qml | 2 +- demos/declarative/minehunt/minehunt.qml | 2 +- demos/declarative/twitter/content/HomeTitleBar.qml | 2 +- .../declarative/twitter/content/MultiTitleBar.qml | 2 +- demos/declarative/twitter/content/TitleBar.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- .../webbrowser/content/FlickableWebView.qml | 6 +- .../content/RetractingWebBrowserHeader.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 4 +- examples/declarative/animations/easing.qml | 86 +++++++++++----------- .../declarative/animations/property-animation.qml | 8 +- examples/declarative/behaviours/test.qml | 6 +- .../border-image/content/MyBorderImage.qml | 8 +- examples/declarative/connections/connections.qml | 2 +- examples/declarative/fonts/hello.qml | 2 +- examples/declarative/layouts/Button.qml | 2 +- examples/declarative/layouts/positioners.qml | 16 ++-- examples/declarative/parallax/qml/Smiley.qml | 8 +- .../declarative/slideswitch/content/Switch.qml | 2 +- examples/declarative/states/transitions.qml | 8 +- .../declarative/tutorials/helloworld/tutorial3.qml | 2 +- examples/declarative/xmldata/yahoonews.qml | 2 +- .../qmlgraphicslistview/data/listview.qml | 2 +- .../visual/Package_Views/packageviews.qml | 2 +- .../declarative/visual/animation/easing/easing.qml | 84 ++++++++++----------- .../animation/pauseAnimation/pauseAnimation.qml | 4 +- .../animation/propertyAction/propertyAction.qml | 2 +- .../visual/animation/scriptAction/scriptAction.qml | 4 +- .../content/MyBorderImage.qml | 8 +- .../visual/qmlgraphicsflipable/test-flipable.qml | 4 +- .../visual/qmlgraphicstextedit/cursorDelegate.qml | 4 +- .../visual/qmlgraphicstextinput/cursorDelegate.qml | 4 +- .../declarative/visual/qmlspringfollow/follow.qml | 4 +- 41 files changed, 164 insertions(+), 162 deletions(-) diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 54af7ad..66705e2 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -118,7 +118,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 } - NumberAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 } + NumberAnimation { properties: "x,y,width"; easing.type: "OutBounce"; duration: 500 } + NumberAnimation { properties: "opacity"; easing.type: "InOutQuad"; duration: 500 } } } diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index 19cad06..ab94d7a 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -149,7 +149,7 @@ Flipable { property: "smooth" value: false } - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 } PropertyAction { target: bigImage property: "smooth" diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index 3dfd1f3..9559f6a 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -42,7 +42,7 @@ Item { ] transitions: [ Transition { - NumberAnimation { properties: "x,width"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,width"; duration: 500; easing.type: "InOutQuad" } } ] diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index 8cd47b4..748a5ec 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -38,7 +38,7 @@ Item { Transition { NumberAnimation { properties: "opacity,scale,x,y" - easing: "easeOutBounce" + easing.type: "OutBounce" } } ] diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 1ca3cdc..3a86347 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -86,14 +86,14 @@ Item { from: "*"; to: "Details" SequentialAnimation { ParentAction { } - NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" } } }, Transition { from: "Details"; to: "*" SequentialAnimation { ParentAction { } - NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" } PropertyAction { targets: wrapper; properties: "z" } } } @@ -180,7 +180,7 @@ Item { transitions: [ Transition { from: "*"; to: "*" - NumberAnimation { properties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" } + NumberAnimation { properties: "y"; duration: 1000; easing.type: "OutBounce"; easing.amplitude: 0.5 } } ] } diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index 0a89c4f..77ccd08 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -38,7 +38,7 @@ Item { } transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } } } @@ -76,7 +76,7 @@ Item { } transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } } } } diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 0f5b69c..5722f10 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -23,7 +23,7 @@ Item { anchors.centerIn: parent scale: 0.0 - scale: Behavior { NumberAnimation { easing: "easeInOutQuad"} } + scale: Behavior { NumberAnimation { easing.type: "InOutQuad"} } id: scaleMe Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true } @@ -55,13 +55,13 @@ Transition { from: "Show"; to: "Details" ParentAction { } - NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } }, Transition { from: "Details"; to: "Show" SequentialAnimation { ParentAction { } - NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } PropertyAction { targets: wrapper; properties: "z" } } } diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 1963bf5..415764e 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -117,7 +117,7 @@ Flipable { transitions: Transition { SequentialAnimation { PropertyAction { target: bigImage; property: "smooth"; value: false } - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 } PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving } } } diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 07b9762..0a06771 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -71,6 +71,6 @@ Item { } transitions: Transition { - NumberAnimation { properties: "x"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } } } diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 92555c2..617a6ed 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -92,7 +92,7 @@ Item { } } NumberAnimation { - easing: "easeInOutQuad" + easing.type: "InOutQuad" properties: "angle" } ScriptAction{ diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index 8054f2e..a206c87 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -115,7 +115,7 @@ Item { transitions: [ Transition { from: "*"; to: "*" - NumberAnimation { properties: "x,y,width,height"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width,height"; easing.type: "InOutQuad" } } ] } diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml index ef7de65..e0205b8 100644 --- a/demos/declarative/twitter/content/MultiTitleBar.qml +++ b/demos/declarative/twitter/content/MultiTitleBar.qml @@ -18,7 +18,7 @@ Item { } ] transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } } + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } } ] } diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml index 42a6115..149aa82 100644 --- a/demos/declarative/twitter/content/TitleBar.qml +++ b/demos/declarative/twitter/content/TitleBar.qml @@ -72,6 +72,6 @@ Item { } transitions: Transition { - NumberAnimation { properties: "x"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } } } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index d2abf28..b091b03 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -89,7 +89,7 @@ Item { } ] transitions: [ - Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } } + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } } ] } } diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 7c46d4c..b60a95f 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -104,14 +104,14 @@ Flickable { property: "scale" from: 1 to: 0 // set before calling - easing: "easeLinear" + easing.type: "Linear" duration: 200 } NumberAnimation { id: flickVX target: flickable property: "viewportX" - easing: "easeLinear" + easing.type: "Linear" duration: 200 from: 0 // set before calling to: 0 // set before calling @@ -120,7 +120,7 @@ Flickable { id: flickVY target: flickable property: "viewportY" - easing: "easeLinear" + easing.type: "Linear" duration: 200 from: 0 // set before calling to: 0 // set before calling diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index e58ab0a..f905150 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -98,7 +98,7 @@ Image { NumberAnimation { targets: header properties: "progressOff" - easing: "easeInOutQuad" + easing.type: "InOutQuad" duration: 300 } } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 934593c..faafd5d 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -98,7 +98,7 @@ Item { Transition { NumberAnimation { properties: "opacity" - easing: "easeInOutQuad" + easing.type: "InOutQuad" duration: 300 } } @@ -154,7 +154,7 @@ Item { Transition { NumberAnimation { properties: "opacity" - easing: "easeInOutQuad" + easing.type: "InOutQuad" duration: 320 } } diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index 9b5bcc6..a7ba1c5 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -6,47 +6,47 @@ Rectangle { ListModel { id: easingTypes - ListElement { type: "easeLinear"; ballColor: "DarkRed" } - ListElement { type: "easeInQuad"; ballColor: "IndianRed" } - ListElement { type: "easeOutQuad"; ballColor: "Salmon" } - ListElement { type: "easeInOutQuad"; ballColor: "Tomato" } - ListElement { type: "easeOutInQuad"; ballColor: "DarkOrange" } - ListElement { type: "easeInCubic"; ballColor: "Gold" } - ListElement { type: "easeOutCubic"; ballColor: "Yellow" } - ListElement { type: "easeInOutCubic"; ballColor: "PeachPuff" } - ListElement { type: "easeOutInCubic"; ballColor: "Thistle" } - ListElement { type: "easeInQuart"; ballColor: "Orchid" } - ListElement { type: "easeOutQuart"; ballColor: "Purple" } - ListElement { type: "easeInOutQuart"; ballColor: "SlateBlue" } - ListElement { type: "easeOutInQuart"; ballColor: "Chartreuse" } - ListElement { type: "easeInQuint"; ballColor: "LimeGreen" } - ListElement { type: "easeOutQuint"; ballColor: "SeaGreen" } - ListElement { type: "easeInOutQuint"; ballColor: "DarkGreen" } - ListElement { type: "easeOutInQuint"; ballColor: "Olive" } - ListElement { type: "easeInSine"; ballColor: "DarkSeaGreen" } - ListElement { type: "easeOutSine"; ballColor: "Teal" } - ListElement { type: "easeInOutSine"; ballColor: "Turquoise" } - ListElement { type: "easeOutInSine"; ballColor: "SteelBlue" } - ListElement { type: "easeInExpo"; ballColor: "SkyBlue" } - ListElement { type: "easeOutExpo"; ballColor: "RoyalBlue" } - ListElement { type: "easeInOutExpo"; ballColor: "MediumBlue" } - ListElement { type: "easeOutInExpo"; ballColor: "MidnightBlue" } - ListElement { type: "easeInCirc"; ballColor: "CornSilk" } - ListElement { type: "easeOutCirc"; ballColor: "Bisque" } - ListElement { type: "easeInOutCirc"; ballColor: "RosyBrown" } - ListElement { type: "easeOutInCirc"; ballColor: "SandyBrown" } - ListElement { type: "easeInElastic"; ballColor: "DarkGoldenRod" } - ListElement { type: "easeOutElastic"; ballColor: "Chocolate" } - ListElement { type: "easeInOutElastic"; ballColor: "SaddleBrown" } - ListElement { type: "easeOutInElastic"; ballColor: "Brown" } - ListElement { type: "easeInBack"; ballColor: "Maroon" } - ListElement { type: "easeOutBack"; ballColor: "LavenderBlush" } - ListElement { type: "easeInOutBack"; ballColor: "MistyRose" } - ListElement { type: "easeOutInBack"; ballColor: "Gainsboro" } - ListElement { type: "easeOutBounce"; ballColor: "Silver" } - ListElement { type: "easeInBounce"; ballColor: "DimGray" } - ListElement { type: "easeInOutBounce"; ballColor: "SlateGray" } - ListElement { type: "easeOutInBounce"; ballColor: "DarkSlateGray" } + ListElement { type: "Linear"; ballColor: "DarkRed" } + ListElement { type: "InQuad"; ballColor: "IndianRed" } + ListElement { type: "OutQuad"; ballColor: "Salmon" } + ListElement { type: "InOutQuad"; ballColor: "Tomato" } + ListElement { type: "OutInQuad"; ballColor: "DarkOrange" } + ListElement { type: "InCubic"; ballColor: "Gold" } + ListElement { type: "OutCubic"; ballColor: "Yellow" } + ListElement { type: "InOutCubic"; ballColor: "PeachPuff" } + ListElement { type: "OutInCubic"; ballColor: "Thistle" } + ListElement { type: "InQuart"; ballColor: "Orchid" } + ListElement { type: "OutQuart"; ballColor: "Purple" } + ListElement { type: "InOutQuart"; ballColor: "SlateBlue" } + ListElement { type: "OutInQuart"; ballColor: "Chartreuse" } + ListElement { type: "InQuint"; ballColor: "LimeGreen" } + ListElement { type: "OutQuint"; ballColor: "SeaGreen" } + ListElement { type: "InOutQuint"; ballColor: "DarkGreen" } + ListElement { type: "OutInQuint"; ballColor: "Olive" } + ListElement { type: "InSine"; ballColor: "DarkSeaGreen" } + ListElement { type: "OutSine"; ballColor: "Teal" } + ListElement { type: "InOutSine"; ballColor: "Turquoise" } + ListElement { type: "OutInSine"; ballColor: "SteelBlue" } + ListElement { type: "InExpo"; ballColor: "SkyBlue" } + ListElement { type: "OutExpo"; ballColor: "RoyalBlue" } + ListElement { type: "InOutExpo"; ballColor: "MediumBlue" } + ListElement { type: "OutInExpo"; ballColor: "MidnightBlue" } + ListElement { type: "InCirc"; ballColor: "CornSilk" } + ListElement { type: "OutCirc"; ballColor: "Bisque" } + ListElement { type: "InOutCirc"; ballColor: "RosyBrown" } + ListElement { type: "OutInCirc"; ballColor: "SandyBrown" } + ListElement { type: "InElastic"; ballColor: "DarkGoldenRod" } + ListElement { type: "OutElastic"; ballColor: "Chocolate" } + ListElement { type: "InOutElastic"; ballColor: "SaddleBrown" } + ListElement { type: "OutInElastic"; ballColor: "Brown" } + ListElement { type: "InBack"; ballColor: "Maroon" } + ListElement { type: "OutBack"; ballColor: "LavenderBlush" } + ListElement { type: "InOutBack"; ballColor: "MistyRose" } + ListElement { type: "OutInBack"; ballColor: "Gainsboro" } + ListElement { type: "OutBounce"; ballColor: "Silver" } + ListElement { type: "InBounce"; ballColor: "DimGray" } + ListElement { type: "InOutBounce"; ballColor: "SlateGray" } + ListElement { type: "OutInBounce"; ballColor: "DarkSlateGray" } } Component { @@ -80,8 +80,8 @@ Rectangle { transitions: Transition { ParallelAnimation { - NumberAnimation { properties: "x"; easing: type; duration: 1000 } - ColorAnimation { properties: "color"; easing: type; duration: 1000 } + NumberAnimation { properties: "x"; easing.type: type; duration: 1000 } + ColorAnimation { properties: "color"; easing.type: type; duration: 1000 } } } } diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml index 9f76ee5..537ee26 100644 --- a/examples/declarative/animations/property-animation.qml +++ b/examples/declarative/animations/property-animation.qml @@ -45,16 +45,16 @@ Item { y: SequentialAnimation { repeat: true - // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function + // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function NumberAnimation { from: smiley.minHeight; to: smiley.maxHeight - easing: "easeOutExpo"; duration: 300 + easing.type: "OutExpo"; duration: 300 } - // Then move back to minHeight in 1 second, using the easeOutBounce easing function + // Then move back to minHeight in 1 second, using the OutBounce easing function NumberAnimation { from: smiley.maxHeight; to: smiley.minHeight - easing: "easeOutBounce"; duration: 1000 + easing.type: "OutBounce"; duration: 1000 } // Then pause for 500ms diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml index fc3f4bf..8fffd59 100644 --- a/examples/declarative/behaviours/test.qml +++ b/examples/declarative/behaviours/test.qml @@ -64,7 +64,8 @@ Rectangle { property: "y" from: 0 to: 10 - easing: "easeOutBounce(amplitude:30)" + easing.type: "OutBounce" + easing.amplitude: 30 duration: 250 } NumberAnimation { @@ -72,7 +73,8 @@ Rectangle { property: "y" from: 10 to: 0 - easing: "easeOutBounce(amplitude:30)" + easing.type: "OutBounce" + easing.amplitude: 30 duration: 250 } } diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml index a57acc7..ca886e9 100644 --- a/examples/declarative/border-image/content/MyBorderImage.qml +++ b/examples/declarative/border-image/content/MyBorderImage.qml @@ -19,14 +19,14 @@ Item { width: SequentialAnimation { repeat: true - NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } } height: SequentialAnimation { repeat: true - NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } } border.top: container.margin diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml index 07f71bb..ef2cb54 100644 --- a/examples/declarative/connections/connections.qml +++ b/examples/declarative/connections/connections.qml @@ -14,7 +14,7 @@ Rectangle { Image { id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center - rotation: Behavior { NumberAnimation { easing: "easeOutCubic"; duration: 300 } } + rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } } Button { diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml index c682477..fcc9580 100644 --- a/examples/declarative/fonts/hello.qml +++ b/examples/declarative/fonts/hello.qml @@ -11,7 +11,7 @@ Rectangle { font.letterSpacing: SequentialAnimation { repeat: true; - NumberAnimation { from: 100; to: 300; easing: "easeInQuad"; duration: 3000 } + NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 } ScriptAction { script: { container.y = (screen.height / 4) + (Math.random() * screen.height / 2) container.x = (screen.width / 4) + (Math.random() * screen.width / 2) diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 0bdb9fc..7cbf68a 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -17,6 +17,6 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid transitions: Transition{ - NumberAnimation { properties:"x,left"; easing:"easeInOutQuad"; duration:200 } + NumberAnimation { properties:"x,left"; easing.type:"InOutQuad"; duration:200 } } } diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index fefd964..7146702 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -11,12 +11,12 @@ Rectangle { y: 0 move: Transition { NumberAnimation { - properties: "y"; easing: "easeOutBounce" + properties: "y"; easing.type: "OutBounce" } } add: Transition { NumberAnimation { - properties: "y"; easing: "easeOutQuad" + properties: "y"; easing.type: "OutQuad" } } Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } @@ -35,12 +35,12 @@ Rectangle { y: 300 move: Transition { NumberAnimation { - properties: "x"; easing: "easeOutBounce" + properties: "x"; easing.type: "OutBounce" } } add: Transition { NumberAnimation { - properties: "x"; easing: "easeOutQuad" + properties: "x"; easing.type: "OutQuad" } } Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } @@ -101,13 +101,13 @@ Rectangle { move: Transition { NumberAnimation { - properties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing.type: "OutBounce" } } add: Transition { NumberAnimation { - properties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing.type: "OutBounce" } } @@ -136,13 +136,13 @@ Rectangle { move: Transition { NumberAnimation { - properties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing.type: "OutBounce" } } add: Transition { NumberAnimation { - properties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing.type: "OutBounce" } } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml index fc5b4fe..81eadda 100644 --- a/examples/declarative/parallax/qml/Smiley.qml +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -27,16 +27,16 @@ Item { y: SequentialAnimation { repeat: true - // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function + // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function NumberAnimation { from: smiley.minHeight; to: smiley.maxHeight - easing: "easeOutExpo"; duration: 300 + easing.type: "OutExpo"; duration: 300 } - // Then move back to minHeight in 1 second, using the easeOutBounce easing function + // Then move back to minHeight in 1 second, using the OutBounce easing function NumberAnimation { from: smiley.maxHeight; to: smiley.minHeight - easing: "easeOutBounce"; duration: 1000 + easing.type: "OutBounce"; duration: 1000 } // Then pause for 500ms diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index 930f471..758aee6 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -66,7 +66,7 @@ Item { //![7] transitions: Transition { - NumberAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 } + NumberAnimation { properties: "x"; easing.type: "InOutQuad"; duration: 200 } } //![7] } diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 48d5f60..8ad61ad 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -51,16 +51,16 @@ Rectangle { // transitions define how the properties change. transitions: [ // When transitioning to 'Position1' move x,y over a duration of 1 second, - // with easeOutBounce easing function. + // with OutBounce easing function. Transition { from: "*"; to: "Position1" - NumberAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 } + NumberAnimation { properties: "x,y"; easing.type: "OutBounce"; duration: 1000 } }, // When transitioning to 'Position2' move x,y over a duration of 2 seconds, - // with easeInOutQuad easing function. + // with InOutQuad easing function. Transition { from: "*"; to: "Position2" - NumberAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 } + NumberAnimation { properties: "x,y"; easing.type: "InOutQuad"; duration: 2000 } }, // For any other state changes move x,y linearly over duration of 200ms. Transition { diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index 9eaa009..b8a4f77 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -28,7 +28,7 @@ Rectangle { transitions: Transition { from: ""; to: "down"; reversible: true ParallelAnimation { - NumberAnimation { properties: "y,rotation"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "y,rotation"; duration: 500; easing.type: "InOutQuad" } ColorAnimation { duration: 500 } } } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index b80e29c..f7c269c 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -61,7 +61,7 @@ Rectangle { transitions: Transition { from: "*"; to: "Details"; reversible: true SequentialAnimation { - NumberAnimation { duration: 200; properties: "height"; easing: "easeOutQuad" } + NumberAnimation { duration: 200; properties: "height"; easing.type: "OutQuad" } NumberAnimation { duration: 200; properties: "opacity" } } } diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml index 99b3db6..1c1b3f8 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml +++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml @@ -88,7 +88,7 @@ Rectangle { ScriptAction { script: console.log("Fix PropertyAction with attached properties") } /* PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } - NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } */ } diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml index b577e45..cf3f9f7 100644 --- a/tests/auto/declarative/visual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -64,7 +64,7 @@ Rectangle { from: "*"; to: "*" SequentialAnimation { ParentAction{} - NumberAnimation { properties: "x,y,width"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width"; easing.type: "InOutQuad" } } } ] diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml index 9c814eb..4248d88 100644 --- a/tests/auto/declarative/visual/animation/easing/easing.qml +++ b/tests/auto/declarative/visual/animation/easing/easing.qml @@ -9,127 +9,127 @@ Rectangle { ListModel { id: easingtypes ListElement { - type: "easeLinear" + type: "Linear" } ListElement { - type: "easeInQuad" + type: "InQuad" } ListElement { - type: "easeOutQuad" + type: "OutQuad" } ListElement { - type: "easeInOutQuad" + type: "InOutQuad" } ListElement { - type: "easeOutInQuad" + type: "OutInQuad" } ListElement { - type: "easeInCubic" + type: "InCubic" } ListElement { - type: "easeOutCubic" + type: "OutCubic" } ListElement { - type: "easeInOutCubic" + type: "InOutCubic" } ListElement { - type: "easeOutInCubic" + type: "OutInCubic" } ListElement { - type: "easeInQuart" + type: "InQuart" } ListElement { - type: "easeOutQuart" + type: "OutQuart" } ListElement { - type: "easeInOutQuart" + type: "InOutQuart" } ListElement { - type: "easeOutInQuart" + type: "OutInQuart" } ListElement { - type: "easeInQuint" + type: "InQuint" } ListElement { - type: "easeOutQuint" + type: "OutQuint" } ListElement { - type: "easeInOutQuint" + type: "InOutQuint" } ListElement { - type: "easeOutInQuint" + type: "OutInQuint" } ListElement { - type: "easeInSine" + type: "InSine" } ListElement { - type: "easeOutSine" + type: "OutSine" } ListElement { - type: "easeInOutSine" + type: "InOutSine" } ListElement { - type: "easeOutInSine" + type: "OutInSine" } ListElement { - type: "easeInExpo" + type: "InExpo" } ListElement { - type: "easeOutExpo" + type: "OutExpo" } ListElement { - type: "easeInOutExpo" + type: "InOutExpo" } ListElement { - type: "easeOutInExpo" + type: "OutInExpo" } ListElement { - type: "easeInCirc" + type: "InCirc" } ListElement { - type: "easeOutCirc" + type: "OutCirc" } ListElement { - type: "easeInOutCirc" + type: "InOutCirc" } ListElement { - type: "easeOutInCirc" + type: "OutInCirc" } ListElement { - type: "easeInElastic" + type: "InElastic" } ListElement { - type: "easeOutElastic" + type: "OutElastic" } ListElement { - type: "easeInOutElastic" + type: "InOutElastic" } ListElement { - type: "easeOutInElastic" + type: "OutInElastic" } ListElement { - type: "easeInBack" + type: "InBack" } ListElement { - type: "easeOutBack" + type: "OutBack" } ListElement { - type: "easeInOutBack" + type: "InOutBack" } ListElement { - type: "easeOutInBack" + type: "OutInBack" } ListElement { - type: "easeOutBounce" + type: "OutBounce" } ListElement { - type: "easeInBounce" + type: "InBounce" } ListElement { - type: "easeInOutBounce" + type: "InOutBounce" } ListElement { - type: "easeOutInBounce" + type: "OutInBounce" } } ] @@ -177,7 +177,7 @@ Rectangle { reversible: true NumberAnimation { properties: "x" - easing: type + easing.type: type duration: 1000 } } diff --git a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml index f2e065d..24ca76b 100644 --- a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml +++ b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml @@ -14,11 +14,11 @@ Rectangle { repeat: true NumberAnimation { to: 0; duration: 500 - easing: "easeInOutQuad" + easing.type: "InOutQuad" } NumberAnimation { to: 200-img.height - easing: "easeOutBounce" + easing.type: "OutBounce" duration: 2000 } PauseAnimation { diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml index 593f495..e18e770 100644 --- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml +++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml @@ -28,7 +28,7 @@ Rectangle { SequentialAnimation { ColorAnimation {} PropertyAction { properties: "x" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml index 30d587a..ef4ed76 100644 --- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml +++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml @@ -27,9 +27,9 @@ Rectangle { transitions: Transition { SequentialAnimation { - NumberAnimation { properties: "x"; easing: "InOutQuad" } + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } ScriptAction { stateChangeScriptName: "setColor" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml index eb1ec00..e268ce7 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml +++ b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml @@ -20,14 +20,14 @@ Item { width: SequentialAnimation { repeat: true - NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } } height: SequentialAnimation { repeat: true - NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } } border.top: container.margin diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml index c33a319..a27aa6e 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml +++ b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml @@ -36,7 +36,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } } } @@ -64,7 +64,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } } } diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml index e0c5db4..176a5b8 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} } } width: 1; diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml index 0038664..6a4e7fa 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} } } width: 1; diff --git a/tests/auto/declarative/visual/qmlspringfollow/follow.qml b/tests/auto/declarative/visual/qmlspringfollow/follow.qml index a85a778..62503e4 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/follow.qml +++ b/tests/auto/declarative/visual/qmlspringfollow/follow.qml @@ -11,11 +11,11 @@ Rectangle { repeat: true NumberAnimation { to: 20; duration: 500 - easing: "easeInOutQuad" + easing.type: "InOutQuad" } NumberAnimation { to: 200; duration: 2000 - easing: "easeOutBounce" + easing.type: "OutBounce" } PauseAnimation { duration: 1000 } } -- cgit v0.12 From 48161233af2a6071bc0ba99e546da98f705b8281 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 23 Feb 2010 18:34:41 +1000 Subject: String to enum conversion in value types Assigning a string to a value type enum property from a binding was not working as QmlMetaProperty didn't realise the property was of enum type. --- src/declarative/qml/qmlcompiler.cpp | 8 +++++++- src/declarative/qml/qmlmetaproperty.cpp | 10 ++++++++-- src/declarative/qml/qmlmetaproperty_p.h | 3 ++- src/declarative/qml/qmlpropertycache.cpp | 22 ++++++++++++++++------ src/declarative/qml/qmlpropertycache_p.h | 7 +++++-- .../declarative/qmlvaluetypes/data/enums.1.qml | 6 ++++++ .../declarative/qmlvaluetypes/data/enums.2.qml | 6 ++++++ .../qmlvaluetypes/tst_qmlvaluetypes.cpp | 21 +++++++++++++++++++++ 8 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qmlvaluetypes/data/enums.1.qml create mode 100644 tests/auto/declarative/qmlvaluetypes/data/enums.2.qml diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 10b6e4f..4508964 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2609,7 +2609,13 @@ int QmlCompiler::genContextCache() int QmlCompiler::genValueTypeData(QmlParser::Property *valueTypeProp, QmlParser::Property *prop) { - return output->indexForByteArray(QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, valueTypeProp->index, valueTypeProp->type)); + QByteArray data = + QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, + QmlEnginePrivate::get(engine)->valueTypes[prop->type]->metaObject(), + valueTypeProp->index); +// valueTypeProp->index, valueTypeProp->type); + + return output->indexForByteArray(data); } int QmlCompiler::genPropertyData(QmlParser::Property *prop) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index ac619ec..d731393 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -777,6 +777,7 @@ bool QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value, writeBack->read(object, core.coreIndex); QmlPropertyCache::Data data = core; + data.flags = valueType.flags; data.coreIndex = valueType.valueTypeCoreIdx; data.propType = valueType.valueTypePropType; rv = write(writeBack, data, value, context, flags); @@ -1082,15 +1083,20 @@ struct ValueTypeSerializedData : public SerializedData { }; QByteArray QmlMetaPropertyPrivate::saveValueType(const QMetaObject *metaObject, int index, - int subIndex, int subType) + const QMetaObject *subObject, int subIndex) { + QMetaProperty prop = metaObject->property(index); + QMetaProperty subProp = subObject->property(subIndex); + ValueTypeSerializedData sd; sd.type = QmlMetaProperty::ValueTypeProperty; sd.core.load(metaObject->property(index)); + sd.valueType.flags = QmlPropertyCache::Data::flagsForProperty(subProp); sd.valueType.valueTypeCoreIdx = subIndex; - sd.valueType.valueTypePropType = subType; + sd.valueType.valueTypePropType = subProp.userType(); QByteArray rv((const char *)&sd, sizeof(sd)); + return rv; } diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index b99e5be..9236bd3 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -111,7 +111,8 @@ public: static QmlAbstractBinding *setBinding(QObject *, const QmlPropertyCache::Data &, QmlAbstractBinding *, QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding); - static QByteArray saveValueType(const QMetaObject *, int, int, int); + static QByteArray saveValueType(const QMetaObject *, int, + const QMetaObject *, int); static QByteArray saveProperty(const QMetaObject *, int); static QmlMetaProperty restore(const QByteArray &, QObject *, QmlContext * = 0); diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 2d087b6..81f8e51 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -49,13 +49,11 @@ Q_DECLARE_METATYPE(QScriptValue); QT_BEGIN_NAMESPACE -void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine) +QmlPropertyCache::Data::Flags QmlPropertyCache::Data::flagsForProperty(const QMetaProperty &p, QmlEngine *engine) { - propType = p.userType(); - if (QVariant::Type(propType) == QVariant::LastType) - propType = qMetaTypeId(); - coreIndex = p.propertyIndex(); - notifyIndex = p.notifySignalIndex(); + int propType = p.userType(); + + Flags flags; if (p.isConstant()) flags |= Data::IsConstant; @@ -78,6 +76,18 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine) else if (cat == QmlMetaType::List) flags |= Data::IsQList; } + + return flags; +} + +void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine) +{ + propType = p.userType(); + if (QVariant::Type(propType) == QVariant::LastType) + propType = qMetaTypeId(); + coreIndex = p.propertyIndex(); + notifyIndex = p.notifySignalIndex(); + flags = flagsForProperty(p, engine); } void QmlPropertyCache::Data::load(const QMetaMethod &m) diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index 18eea80..4a98b88 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -104,6 +104,7 @@ public: int coreIndex; int notifyIndex; + static Flags flagsForProperty(const QMetaProperty &, QmlEngine *engine = 0); void load(const QMetaProperty &, QmlEngine *engine = 0); void load(const QMetaMethod &); QString name(QObject *); @@ -113,6 +114,7 @@ public: struct ValueTypeData { inline ValueTypeData(); inline bool operator==(const ValueTypeData &); + Data::Flags flags; // flags on the value type wrapper int valueTypeCoreIdx; // The prop index of the access property on the value type wrapper int valueTypePropType; // The QVariant::Type of access property on the value type wrapper }; @@ -173,13 +175,14 @@ QmlPropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const } QmlPropertyCache::ValueTypeData::ValueTypeData() -: valueTypeCoreIdx(-1), valueTypePropType(0) +: flags(QmlPropertyCache::Data::NoFlags), valueTypeCoreIdx(-1), valueTypePropType(0) { } bool QmlPropertyCache::ValueTypeData::operator==(const ValueTypeData &o) { - return valueTypeCoreIdx == o.valueTypeCoreIdx && + return flags == o.flags && + valueTypeCoreIdx == o.valueTypeCoreIdx && valueTypePropType == o.valueTypePropType; } diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml new file mode 100644 index 0000000..0eadd50 --- /dev/null +++ b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: "MixedCase" +} + diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml new file mode 100644 index 0000000..81f1c92 --- /dev/null +++ b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: if (1) "MixedCase" +} + diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp index f99d3ce..4faa0bc 100644 --- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp +++ b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp @@ -74,6 +74,7 @@ private slots: void bindingVariantCopy(); void scriptVariantCopy(); void cppClasses(); + void enums(); private: QmlEngine engine; @@ -583,6 +584,26 @@ void tst_qmlvaluetypes::cppClasses() CPP_TEST(QmlFontValueType, QFont("Helvetica")); } + +void tst_qmlvaluetypes::enums() +{ + { + QmlComponent component(&engine, TEST_FILE("enums.1.qml")); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } + + { + QmlComponent component(&engine, TEST_FILE("enums.2.qml")); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } +} + QTEST_MAIN(tst_qmlvaluetypes) #include "tst_qmlvaluetypes.moc" -- cgit v0.12 From 2b7e46886d7a77257b64823e959bd8d8a007380d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 09:38:20 +0100 Subject: doc: Removed some erroneous text. Task: QTBUG-7965 --- src/gui/graphicsview/qgraphicsitem.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2f208b7..d19a102 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -414,12 +414,6 @@ /*! \enum QGraphicsItem::GraphicsItemChange - ItemVisibleHasChanged, - ItemEnabledHasChanged, - ItemSelectedHasChanged, - ItemParentHasChanged, - ItemSceneHasChanged - This enum describes the state changes that are notified by QGraphicsItem::itemChange(). The notifications are sent as the state changes, and in some cases, adjustments can be made (see the documentation -- cgit v0.12 From c02de9aaa2d27d43ec64b04b609af4f1233c620a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 22 Feb 2010 14:09:22 +0100 Subject: enable bytepair compression for S60 3.2 and newer Bytepair compression allows libraries to be paged properly and drastically reduces RAM consumption. Reviewed-By: Jason Barron --- mkspecs/common/symbian/symbian.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 7b2ee91..f3026ad 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -115,7 +115,7 @@ symbian-abld { } else { MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA = "OPTION_REPLACE ARMCC --export_all_vtbl // don't use --export_all_vtbl" } -MMP_RULES += PAGED +MMP_RULES += PAGED BYTEPAIRCOMPRESSTARGET MMP_RULES += $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA SYMBIAN_PLATFORMS = WINSCW GCCE ARMV5 ARMV6 @@ -145,7 +145,7 @@ exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/Series60v5.0.sis S60_VERSION = 3.2 } else { S60_VERSION = 3.1 - MMP_RULES -= PAGED + MMP_RULES -= PAGED BYTEPAIRCOMPRESSTARGET } } @@ -163,4 +163,4 @@ symbian { # [TODO] QMAKE_CXXFLAGS.GCCE += $${QMAKE_CXXFLAGS_FAST_VFP.GCCE} } } -} \ No newline at end of file +} -- cgit v0.12 From 1ef21425463204ff60defb9ca97813ff07db2149 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 09:53:22 +0100 Subject: doc: Added \since 4.6 to the properties. Task: QTBUG-8333 --- src/svg/qgraphicssvgitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index 7e80e50..69ff7a3 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -267,6 +267,7 @@ int QGraphicsSvgItem::type() const /*! \property QGraphicsSvgItem::maximumCacheSize + \since 4.6 This property holds the maximum size of the device coordinate cache for this item. @@ -312,7 +313,8 @@ QSize QGraphicsSvgItem::maximumCacheSize() const /*! \property QGraphicsSvgItem::elementId - + \since 4.6 + This property holds the element's XML ID. */ -- cgit v0.12 From b4d55d5288ddae325046f62f65cbf667283b3859 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 23 Feb 2010 19:00:12 +1000 Subject: Fix compile error in QEasingCurve Reviewed-by: akennedy --- src/corelib/tools/qeasingcurve.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 6b26907..89edb2d 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -861,7 +861,7 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) { stream << easing.d_ptr->type; - stream << intptr_t(easing.d_ptr->func); + stream << quint64(intptr_t(easing.d_ptr->func)); bool hasConfig = easing.d_ptr->config; stream << hasConfig; @@ -891,9 +891,9 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) type = static_cast(int_type); easing.setType(type); - intptr_t ptr_func; + quint64 ptr_func; stream >> ptr_func; - easing.d_ptr->func = QEasingCurve::EasingFunction(ptr_func); + easing.d_ptr->func = QEasingCurve::EasingFunction(intptr_t(ptr_func)); bool hasConfig; stream >> hasConfig; -- cgit v0.12 From 58533cbc7322c4f821f24043028e47925b537419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 23 Feb 2010 10:11:03 +0100 Subject: Made the qDrawPixmaps() API public (with modifications). QPainter has now gotten a drawPixmapFragments() function together with a Fragment class that describes how each pixmap fragment is supposed to be drawn. Reviewed-by: Gunnar Reviewed-by: Samuel --- .../graphicsitems/qmlgraphicsparticles.cpp | 12 +- src/gui/painting/qdrawutil.cpp | 210 +++++++++------------ src/gui/painting/qdrawutil.h | 25 --- src/gui/painting/qpaintengineex.cpp | 19 +- src/gui/painting/qpaintengineex_p.h | 2 +- src/gui/painting/qpainter.cpp | 154 +++++++++++++++ src/gui/painting/qpainter.h | 25 +++ .../gl2paintengineex/qpaintengineex_opengl2.cpp | 50 ++--- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 4 +- src/openvg/qpaintengine_vg.cpp | 24 +-- src/openvg/qpaintengine_vg_p.h | 2 +- tests/auto/qpainter/tst_qpainter.cpp | 48 ++++- 12 files changed, 376 insertions(+), 199 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp index 08fce74..b71b790 100644 --- a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp @@ -1196,7 +1196,7 @@ void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsI const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); - QVarLengthArray pixmapData; + QVarLengthArray pixmapData; pixmapData.resize(d->particles.count()); const QRectF sourceRect = d->image.rect(); @@ -1204,16 +1204,20 @@ void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsI qreal halfPHeight = sourceRect.height()/2.; for (int i = 0; i < d->particles.count(); ++i) { const QmlGraphicsParticle &particle = d->particles.at(i); - pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); + pixmapData[i].x = particle.x - myX + halfPWidth; + pixmapData[i].y = particle.y - myY + halfPHeight; pixmapData[i].opacity = particle.opacity; //these never change pixmapData[i].rotation = 0; pixmapData[i].scaleX = 1; pixmapData[i].scaleY = 1; - pixmapData[i].source = sourceRect; + pixmapData[i].sourceLeft = sourceRect.left(); + pixmapData[i].sourceTop = sourceRect.top(); + pixmapData[i].width = sourceRect.width(); + pixmapData[i].height = sourceRect.height(); } - qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); + p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image); } void QmlGraphicsParticles::componentComplete() diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 5619a2e..d76c709 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1081,7 +1081,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, according to the \a margins structure. */ -typedef QVarLengthArray QDrawPixmapsDataArray; +typedef QVarLengthArray QPixmapFragmentsArray; /*! \since 4.6 @@ -1102,12 +1102,12 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints) { - QDrawPixmaps::Data d; + QPainter::Fragment d; d.opacity = 1.0; d.rotation = 0.0; - QDrawPixmapsDataArray opaqueData; - QDrawPixmapsDataArray translucentData; + QPixmapFragmentsArray opaqueData; + QPixmapFragmentsArray translucentData; // source center const int sourceCenterTop = sourceRect.top() + sourceMargins.top(); @@ -1182,44 +1182,56 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin // corners if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) { // top left - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.source = QRectF(sourceRect.left(), sourceRect.top(), sourceMargins.left(), sourceMargins.top()); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceRect.top(); + d.width = sourceMargins.left(); + d.height = sourceMargins.top(); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; if (hints & QDrawBorderPixmap::OpaqueTopLeft) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) { // top right - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.source = QRectF(sourceCenterRight, sourceRect.top(), sourceMargins.right(), sourceMargins.top()); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceRect.top(); + d.width = sourceMargins.right(); + d.height = sourceMargins.top(); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; if (hints & QDrawBorderPixmap::OpaqueTopRight) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) { // bottom left - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.source = QRectF(sourceRect.left(), sourceCenterBottom, sourceMargins.left(), sourceMargins.bottom()); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceCenterBottom; + d.width = sourceMargins.left(); + d.height = sourceMargins.bottom(); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; if (hints & QDrawBorderPixmap::OpaqueBottomLeft) opaqueData.append(d); else translucentData.append(d); } if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) { // bottom right - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.source = QRectF(sourceCenterRight, sourceCenterBottom, sourceMargins.right(), sourceMargins.bottom()); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceCenterBottom; + d.width = sourceMargins.right(); + d.height = sourceMargins.bottom(); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; if (hints & QDrawBorderPixmap::OpaqueBottomRight) opaqueData.append(d); else @@ -1229,151 +1241,107 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin // horizontal edges if (targetCenterWidth > 0 && sourceCenterWidth > 0) { if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceRect.top(), sourceCenterWidth, sourceMargins.top()); - d.point.setY(0.5 * (yTarget[1] + yTarget[0])); - d.scaleX = dx / d.source.width(); - d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceRect.top(); + d.width = sourceCenterWidth; + d.height = sourceMargins.top(); + d.y = (0.5 * (yTarget[1] + yTarget[0])); + d.scaleX = dx / d.width; + d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); + data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());; - d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1])); - d.scaleX = dx / d.source.width(); - d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceCenterBottom; + d.width = sourceCenterWidth; + d.height = sourceMargins.bottom(); + d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); + d.scaleX = dx / d.width; + d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); + data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX); } } // vertical edges if (targetCenterHeight > 0 && sourceCenterHeight > 0) { if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData; - d.source = QRectF(sourceRect.left(), sourceCenterTop, sourceMargins.left(), sourceCenterHeight); - d.point.setX(0.5 * (xTarget[1] + xTarget[0])); - d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData; + d.sourceLeft = sourceRect.left(); + d.sourceTop = sourceCenterTop; + d.width = sourceMargins.left(); + d.height = sourceCenterHeight; + d.x = (0.5 * (xTarget[1] + xTarget[0])); + d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; + d.scaleY = dy / d.height; for (int i = 1; i < rows - 1; ++i) { - d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i])); + d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); data.append(d); } if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); + data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData; - d.source = QRectF(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight); - d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1])); - d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData; + d.sourceLeft = sourceCenterRight; + d.sourceTop = sourceCenterTop; + d.width = sourceMargins.right(); + d.height = sourceCenterHeight; + d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); + d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; + d.scaleY = dy / d.height; for (int i = 1; i < rows - 1; ++i) { - d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i])); + d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); data.append(d); } if (rules.vertical == Qt::RepeatTile) - data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); + data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY); } } // center if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) { - QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData; - d.source = QRectF(sourceCenterLeft, sourceCenterTop, sourceCenterWidth, sourceCenterHeight); - d.scaleX = dx / d.source.width(); - d.scaleY = dy / d.source.height(); + QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData; + d.sourceLeft = sourceCenterLeft; + d.sourceTop = sourceCenterTop; + d.width = sourceCenterWidth; + d.height = sourceCenterHeight; + d.scaleX = dx / d.width; + d.scaleY = dy / d.height; qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX; qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY; for (int j = 1; j < rows - 1; ++j) { - d.point.setY(0.5 * (yTarget[j + 1] + yTarget[j])); + d.y = (0.5 * (yTarget[j + 1] + yTarget[j])); for (int i = 1; i < columns - 1; ++i) { - d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i])); + d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); data.append(d); } if (rules.horizontal == Qt::RepeatTile) - data[data.size() - 1].source.setWidth(repeatWidth); + data[data.size() - 1].width = repeatWidth; } if (rules.vertical == Qt::RepeatTile) { for (int i = 1; i < columns - 1; ++i) - data[data.size() - i].source.setHeight(repeatHeight); + data[data.size() - i].height = repeatHeight; } } if (opaqueData.size()) - qDrawPixmaps(painter, opaqueData.data(), opaqueData.size(), pixmap, QDrawPixmaps::OpaqueHint); + painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint); if (translucentData.size()) - qDrawPixmaps(painter, translucentData.data(), translucentData.size(), pixmap); -} - -/*! - \class QDrawPixmaps::Data - \since 4.6 - \internal - - This structure is used with the qDrawPixmaps() function. - - QPointF point: Specifies the center of the target rectangle. - QRectF source: Specifies the source rectangle in the pixmap passed into the qDrawPixmaps() call. - qreal scaleX: Specifies the horizontal scale of the target rectangle. - qreal scaleY: Specifies the vertical scale of the target rectangle. - qreal rotation: Specifies the rotation of the target rectangle in degrees. - The target rectangle is rotated after scaling. - qreal opacity: Specifies the opacity of the rectangle. -*/ - -/*! - \enum QDrawPixmaps::DrawingHint - \internal -*/ - -/*! - \internal - \since 4.6 - - This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap, at multiple positions - with different scale, rotation and opacity on \a painter. \a drawingData is an array of \a - dataCount elements specifying the parameters used to draw each pixmap instance. - This can be used for example to implement a particle system. -*/ -void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) -{ - QPaintEngine *engine = painter->paintEngine(); - if (!engine) - return; - - if (engine->isExtended()) { - static_cast(engine)->drawPixmaps(drawingData, dataCount, pixmap, hints); - } else { - qreal oldOpacity = painter->opacity(); - QTransform oldTransform = painter->transform(); - - for (int i = 0; i < dataCount; ++i) { - QTransform transform = oldTransform; - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); - transform.rotate(drawingData[i].rotation); - painter->setOpacity(oldOpacity * drawingData[i].opacity); - painter->setTransform(transform); - - qreal w = drawingData[i].scaleX * drawingData[i].source.width(); - qreal h = drawingData[i].scaleY * drawingData[i].source.height(); - painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); - } - - painter->setOpacity(oldOpacity); - painter->setTransform(oldTransform); - } + painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap); } QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index 2801b2f..31e352f 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -188,31 +188,6 @@ inline void qDrawBorderPixmap(QPainter *painter, qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins); } -// For internal use only. -namespace QDrawPixmaps -{ - struct Data - { - QPointF point; - QRectF source; - qreal scaleX; - qreal scaleY; - qreal rotation; - qreal opacity; - }; - - enum DrawingHint - { - OpaqueHint = 0x01 - }; - - Q_DECLARE_FLAGS(DrawingHints, DrawingHint) -} - -// This function is private and may change without notice. Do not use outside Qt!!! -Q_GUI_EXPORT void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, - int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints = 0); - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 4f2fffa..ad486ba 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -970,23 +970,26 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con fill(path, brush); } -void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/) +void QPaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, QPainter::FragmentHints /*hints*/) { qreal oldOpacity = state()->opacity; QTransform oldTransform = state()->matrix; - for (int i = 0; i < dataCount; ++i) { + for (int i = 0; i < fragmentCount; ++i) { QTransform transform = oldTransform; - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); - transform.rotate(drawingData[i].rotation); - state()->opacity = oldOpacity * drawingData[i].opacity; + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + state()->opacity = oldOpacity * fragments[i].opacity; state()->matrix = transform; opacityChanged(); transformChanged(); - qreal w = drawingData[i].scaleX * drawingData[i].source.width(); - qreal h = drawingData[i].scaleY * drawingData[i].source.height(); - drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); + qreal w = fragments[i].scaleX * fragments[i].width; + qreal h = fragments[i].scaleY * fragments[i].height; + QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, + fragments[i].width, fragments[i].height); + drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); } state()->opacity = oldOpacity; diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 90c4f9f..2401b94 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -197,7 +197,7 @@ public: virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags hints); + virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags hints); virtual void updateState(const QPaintEngineState &state); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index e69512d..6f5c732 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -8846,6 +8846,160 @@ QTransform QPainter::combinedTransform() const return d->state->worldMatrix * d->viewTransform(); } +/*! + \since 4.7 + + This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap, + at multiple positions with different scale, rotation and opacity. \a + fragments is an array of \a fragmentCount elements specifying the + parameters used to draw each pixmap fragment. The \a hints + parameter can be used to pass in drawing hints. + + This function is potentially faster than multiple calls to drawPixmap(), + since the backend can optimize state changes. + + \sa QPainter::Fragment, QPainter::FragmentHint +*/ + +void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, FragmentHints hints) +{ + Q_D(QPainter); + + if (!d->engine) + return; + + if (d->engine->isExtended()) { + d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + } else { + qreal oldOpacity = opacity(); + QTransform oldTransform = transform(); + + for (int i = 0; i < fragmentCount; ++i) { + QTransform transform = oldTransform; + transform.translate(fragments[i].x, fragments[i].y); + transform.rotate(fragments[i].rotation); + setOpacity(oldOpacity * fragments[i].opacity); + setTransform(transform); + + qreal w = fragments[i].scaleX * fragments[i].width; + qreal h = fragments[i].scaleY * fragments[i].height; + QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, + fragments[i].width, fragments[i].height); + drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); + } + + setOpacity(oldOpacity); + setTransform(oldTransform); + } +} + +/*! + \since 4.7 + \class QPainter::Fragment + + \brief This class is used in conjunction with the + QPainter::drawPixmapFragments() function to specify how a pixmap, or + sub-rect of a pixmap, is drawn. + + The \a sourceLeft, \a sourceTop, \a width and \a height variables are used + as a source rectangle within the pixmap passed into the + QPainter::drawPixmapFragments() function. The variables \a x, \a y, \a + width and \a height are used to calculate the target rectangle that is + drawn. \a x and \a y denotes the center of the target rectangle. The \a + width and \a heigth in the target rectangle is scaled by the \a scaleX and + \a scaleY values. The resulting target rectangle is then rotated \a + rotation degrees around the \a x, \a y center point. + + \sa QPainter::drawPixmapFragments() +*/ + +/*! + \since 4.7 + + This is a convenience function that returns a QPainter::Fragment that is + initialized with the \a pos, \a sourceRect, \a scaleX, \a scaleY, \a + rotation, \a opacity parameters. +*/ + +QPainter::Fragment QPainter::Fragment::create(const QPointF &pos, const QRectF &sourceRect, + qreal scaleX, qreal scaleY, qreal rotation, + qreal opacity) +{ + Fragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), + sourceRect.height(), scaleX, scaleY, rotation, opacity}; + return fragment; +} + +/*! + \variable QPainter::Fragment::x + \brief the x coordinate of center point in the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::y + \brief the y coordinate of the center point in the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::sourceLeft + \brief the left coordinate of the source rectangle. +*/ + +/*! + \variable QPainter::Fragment::sourceTop + \brief the top coordinate of the source rectangle. +*/ + +/*! + \variable QPainter::Fragment::width + + \brief the width of the source rectangle and is used to calculate the width + of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::height + + \brief the height of the source rectangle and is used to calculate the + height of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::scaleX + \brief the horizontal scale of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::scaleY + \brief the vertical scale of the target rectangle. +*/ + +/*! + \variable QPainter::Fragment::rotation + + \brief the rotation of the target rectangle in degrees. The target + rectangle is rotated after it has been scaled. +*/ + +/*! + \variable QPainter::Fragment::opacity + + \brief the opacity of the target rectangle, where 0.0 is fully transparent + and 1.0 is fully opaque. +*/ + +/*! + \since 4.7 + + \enum QPainter::FragmentHint + + \value OpaqueHint Indicates that the pixmap fragments to be drawn are + opaque. Opaque fragments are potentially faster to draw. + + \sa QPainter::drawPixmapFragments(), QPainter::Fragment +*/ + void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation) { p->draw_helper(path, operation); diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index e9fd532..4d52c5d 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -99,6 +99,28 @@ public: Q_DECLARE_FLAGS(RenderHints, RenderHint) + class Fragment { + public: + qreal x; + qreal y; + qreal sourceLeft; + qreal sourceTop; + qreal width; + qreal height; + qreal scaleX; + qreal scaleY; + qreal rotation; + qreal opacity; + static Fragment create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, + qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1); + }; + + enum FragmentHint { + OpaqueHint = 0x01 + }; + + Q_DECLARE_FLAGS(FragmentHints, FragmentHint) + QPainter(); explicit QPainter(QPaintDevice *); ~QPainter(); @@ -352,6 +374,9 @@ public: inline void drawPixmap(const QRect &r, const QPixmap &pm); inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); + void drawPixmapFragments(const Fragment *fragments, int fragmentCount, + const QPixmap &pixmap, FragmentHints hints = 0); + void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ea464d5..a967e96 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1642,21 +1642,23 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp s->matrix = old; } -void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints) { Q_D(QGL2PaintEngineEx); // Use fallback for extended composition modes. if (state()->composition_mode > QPainter::CompositionMode_Plus) { - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); return; } ensureActive(); - d->drawPixmaps(drawingData, dataCount, pixmap, hints); + d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); } -void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::Fragment *fragments, + int fragmentCount, const QPixmap &pixmap, + QPainter::FragmentHints hints) { GLfloat dx = 1.0f / pixmap.size().width(); GLfloat dy = 1.0f / pixmap.size().height(); @@ -1677,28 +1679,29 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData bool allOpaque = true; - for (int i = 0; i < dataCount; ++i) { + for (int i = 0; i < fragmentCount; ++i) { qreal s = 0; qreal c = 1; - if (drawingData[i].rotation != 0) { - s = qFastSin(drawingData[i].rotation * Q_PI / 180); - c = qFastCos(drawingData[i].rotation * Q_PI / 180); + if (fragments[i].rotation != 0) { + s = qFastSin(fragments[i].rotation * Q_PI / 180); + c = qFastCos(fragments[i].rotation * Q_PI / 180); } - qreal right = 0.5 * drawingData[i].scaleX * drawingData[i].source.width(); - qreal bottom = 0.5 * drawingData[i].scaleY * drawingData[i].source.height(); + qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; + qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); - vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomLeft.x + drawingData[i].point.x(), -bottomLeft.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(bottomLeft.x + drawingData[i].point.x(), bottomLeft.y + drawingData[i].point.y()); - vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y()); + vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.lineToArray(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); + vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); - QGLRect src(drawingData[i].source.left() * dx, drawingData[i].source.top() * dy, - drawingData[i].source.right() * dx, drawingData[i].source.bottom() * dy); + QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, + (fragments[i].sourceLeft + fragments[i].width) * dx, + (fragments[i].sourceTop + fragments[i].height) * dy); textureCoordinateArray.lineToArray(src.right, src.bottom); textureCoordinateArray.lineToArray(src.right, src.top); @@ -1707,7 +1710,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData textureCoordinateArray.lineToArray(src.left, src.bottom); textureCoordinateArray.lineToArray(src.right, src.bottom); - qreal opacity = drawingData[i].opacity * q->state()->opacity; + qreal opacity = fragments[i].opacity * q->state()->opacity; opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; allOpaque &= (opacity >= 0.99f); } @@ -1720,21 +1723,22 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData if (texture->options & QGLContext::InvertedYBindOption) { // Flip texture y-coordinate. QGLPoint *data = textureCoordinateArray.data(); - for (int i = 0; i < 6 * dataCount; ++i) + for (int i = 0; i < 6 * fragmentCount; ++i) data[i].y = 1 - data[i].y; } transferMode(ImageArrayDrawingMode); bool isBitmap = pixmap.isQBitmap(); - bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QDrawPixmaps::OpaqueHint)) && allOpaque; + bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QPainter::OpaqueHint)) && allOpaque; updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id); // Setup for texture drawing currentBrush = noBrush; - shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); + shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc + : QGLEngineShaderManager::ImageSrc); if (prepareForDraw(isOpaque)) shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); @@ -1743,7 +1747,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - glDrawArrays(GL_TRIANGLES, 0, 6 * dataCount); + glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); } bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index d4932be..5d3608b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -125,7 +125,7 @@ public: virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr); virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); + virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); @@ -196,7 +196,7 @@ public: void fill(const QVectorPath &path); void stroke(const QVectorPath &path, const QPen &pen); void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); - void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); + void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints); void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem, bool includeMatrixInCache); diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 62f0293..24f678b 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -93,7 +93,7 @@ public: VGFont font; VGfloat scaleX; VGfloat scaleY; - + uint cachedGlyphsMask[256 / 32]; QSet cachedGlyphs; }; @@ -3035,9 +3035,8 @@ void QVGPaintEngine::drawTiledPixmap // (i.e. no opacity), no rotation or scaling, and drawing the full // pixmap rather than parts of the pixmap. Even having just one of // these conditions will improve performance. -void QVGPaintEngine::drawPixmaps - (const QDrawPixmaps::Data *drawingData, int dataCount, - const QPixmap &pixmap, QFlags hints) +void QVGPaintEngine::drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, + const QPixmap &pixmap, QFlags hints) { #if !defined(QT_SHIVAVG) Q_D(QVGPaintEngine); @@ -3048,7 +3047,7 @@ void QVGPaintEngine::drawPixmaps if (!pd) return; // null QPixmap if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); return; } @@ -3072,7 +3071,7 @@ void QVGPaintEngine::drawPixmaps QVarLengthArray cachedSources; // Select the opacity paint object. - if ((hints & QDrawPixmaps::OpaqueHint) != 0 && d->opacity == 1.0f) { + if ((hints & QPainter::OpaqueHint) != 0 && d->opacity == 1.0f) { d->setImageMode(VG_DRAW_IMAGE_NORMAL); } else { hints = 0; @@ -3089,7 +3088,8 @@ void QVGPaintEngine::drawPixmaps VGImage child; QSize imageSize = vgpd->size(); - QRectF sr = drawingData[i].source; + QRectF sr(drawingData[i].sourceLeft, drawingData[i].sourceTop, + drawingData[i].width, drawingData[i].height); if (sr.topLeft().isNull() && sr.size() == imageSize) { child = vgImg; } else { @@ -3118,7 +3118,7 @@ void QVGPaintEngine::drawPixmaps transform.scale(scaleX, scaleY); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - if ((hints & QDrawPixmaps::OpaqueHint) == 0) { + if ((hints & QPainter::OpaqueHint) == 0) { qreal opacity = d->opacity * drawingData[i].opacity; if (opacity != 1.0f) { if (d->paintOpacity != opacity) { @@ -3144,7 +3144,7 @@ void QVGPaintEngine::drawPixmaps for (int i = 0; i < cachedImages.size(); ++i) vgDestroyImage(cachedImages[i]); #else - QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints); + QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); #endif } @@ -3274,7 +3274,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) QPaintEngineEx::drawTextItem(p, textItem); return; } - + // Get the glyphs and positions associated with the text item. QVarLengthArray positions; QVarLengthArray glyphs; @@ -3284,7 +3284,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) (ti.glyphs, matrix, ti.flags, glyphs, positions); if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p)) - QPaintEngineEx::drawTextItem(p, textItem); + QPaintEngineEx::drawTextItem(p, textItem); #else // OpenGL 1.0 does not have support for VGFont and glyphs, // so fall back to the default Qt path stroking algorithm. @@ -3312,7 +3312,7 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) glyphCache = new QVGFontGlyphCache(); if (glyphCache->font == VG_INVALID_HANDLE) { qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine"); - delete glyphCache; + delete glyphCache; return false; } glyphCache->setScaleFromText(font, fontEngine); diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 3f73fed..1203af5 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -137,7 +137,7 @@ public: void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags hints); + void drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, const QPixmap &pixmap, QFlags hints); void drawTextItem(const QPointF &p, const QTextItem &textItem); void drawStaticTextItem(QStaticTextItem *staticTextItem); diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index beb83a1..a03b2c7 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -107,6 +107,7 @@ private slots: void saveAndRestore(); void drawBorderPixmap(); + void drawPixmapFragments(); void drawLine_data(); void drawLine(); @@ -994,6 +995,49 @@ void tst_QPainter::drawBorderPixmap() QTileRules(Qt::StretchTile,Qt::StretchTile), 0); } +void tst_QPainter::drawPixmapFragments() +{ + QPixmap origPixmap(20, 20); + QPixmap resPixmap(20, 20); + QPainter::Fragment fragments[4] = { {15, 15, 0, 0, 10, 10, 1, 1, 0, 1}, + { 5, 15, 10, 0, 10, 10, 1, 1, 0, 1}, + {15, 5, 0, 10, 10, 10, 1, 1, 0, 1}, + { 5, 5, 10, 10, 10, 10, 1, 1, 0, 1} }; + { + QPainter p(&origPixmap); + p.fillRect(0, 0, 10, 10, Qt::red); + p.fillRect(10, 0, 10, 10, Qt::green); + p.fillRect(0, 10, 10, 10, Qt::blue); + p.fillRect(10, 10, 10, 10, Qt::yellow); + } + { + QPainter p(&resPixmap); + p.drawPixmapFragments(fragments, 4, origPixmap); + } + + QImage origImage = origPixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage resImage = resPixmap.toImage().convertToFormat(QImage::Format_ARGB32); + + QVERIFY(resImage.size() == resPixmap.size()); + QVERIFY(resImage.pixel(5, 5) == origImage.pixel(15, 15)); + QVERIFY(resImage.pixel(5, 15) == origImage.pixel(15, 5)); + QVERIFY(resImage.pixel(15, 5) == origImage.pixel(5, 15)); + QVERIFY(resImage.pixel(15, 15) == origImage.pixel(5, 5)); + + + QPainter::Fragment fragment = QPainter::Fragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2)); + QVERIFY(fragment.x == 20); + QVERIFY(fragment.y == 20); + QVERIFY(fragment.sourceLeft == 30); + QVERIFY(fragment.sourceTop == 30); + QVERIFY(fragment.width == 2); + QVERIFY(fragment.height == 2); + QVERIFY(fragment.scaleX == 1); + QVERIFY(fragment.scaleY == 1); + QVERIFY(fragment.rotation == 0); + QVERIFY(fragment.opacity == 1); +} + void tst_QPainter::drawLine_data() { QTest::addColumn("line"); @@ -3443,8 +3487,8 @@ bool verifyOutlineFillConsistency(const QImage &img, QRgb outside, QRgb inside, if ((dx == 0) == (dy == 0)) continue; QRgb neighbor = img.pixel(p.x() + dx, p.y() + dy); - if (pixel == inside && neighbor == outside || - pixel == outside && neighbor == inside) + if ((pixel == inside && neighbor == outside) || + (pixel == outside && neighbor == inside)) return false; } } -- cgit v0.12 From 7d6f139c0bad17c84aa05b84450abb567a5b5458 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 23 Feb 2010 10:27:02 +0100 Subject: improve 64 bit support on windows --- tools/assistant/lib/qhelp_global.cpp | 2 +- tools/qdoc3/codemarker.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index d8a94d3..c2c916b 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -56,7 +56,7 @@ QString QHelpGlobal::uniquifyConnectionName(const QString &name, void *pointer) counter = 0; return QString::fromLatin1("%1-%2-%3"). - arg(name).arg(long(pointer)).arg(counter); + arg(name).arg(quintptr(pointer)).arg(counter); } QString QHelpGlobal::documentTitle(const QString &content) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index ee93080..15f2c2d 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -177,7 +177,7 @@ const Node *CodeMarker::nodeForString(const QString& string) QString CodeMarker::stringForNode(const Node *node) { if (sizeof(const Node *) == sizeof(ulong)) { - return QString::number(reinterpret_cast(node)); + return QString::number(reinterpret_cast(node)); } else { return QString::number(reinterpret_cast(node)); -- cgit v0.12 From 0a1a01ea6e6496d79a59cd9b5f845d56fa1e53d6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 10:28:39 +0100 Subject: doc: Added \obsolete. Task: QTBUG-8083 --- src/corelib/io/qdir.cpp | 8 ++++---- src/corelib/io/qresource.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index dc7f17e..69b3af4 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -993,15 +993,15 @@ void QDir::setNameFilters(const QStringList &nameFilters) /*! \obsolete + + Use QDir::addSearchPath() with a prefix instead. + Adds \a path to the search paths searched in to find resources that are not specified with an absolute path. The default search path is to search only in the root (\c{:/}). - Use QDir::addSearchPath() with a prefix instead. - - \sa {The Qt Resource System}, QResource::addSearchPath() + \sa {The Qt Resource System} */ - void QDir::addResourceSearchPath(const QString &path) { #ifdef QT_BUILD_CORE_LIB diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index adfbb15..6d33c8b 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -555,16 +555,15 @@ QStringList QResource::children() const /*! \obsolete + Use QDir::addSearchPath() with a prefix instead. + Adds \a path to the search paths searched in to find resources that are not specified with an absolute path. The \a path must be an absolute path (start with \c{/}). The default search path is to search only in the root (\c{:/}). The last path added will be consulted first upon next QResource creation. - - Use QDir::addSearchPath() with a prefix instead. */ - void QResource::addSearchPath(const QString &path) { @@ -578,6 +577,10 @@ QResource::addSearchPath(const QString &path) } /*! + \obsolete + + Use QDir::searchPaths() instead. + Returns the current search path list. This list is consulted when creating a relative resource. -- cgit v0.12 From 48a1b43743481a646ad0ebef116f249f891e4e10 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 10:40:12 +0100 Subject: doc: Removed bad grammar. Task: QTBUG-8033 --- doc/src/examples/scribble.qdoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/src/examples/scribble.qdoc b/doc/src/examples/scribble.qdoc index 3c6d136..5c66410 100644 --- a/doc/src/examples/scribble.qdoc +++ b/doc/src/examples/scribble.qdoc @@ -74,9 +74,8 @@ \o \c MainWindow provides a menu above the \c ScribbleArea. \endlist - We will start by reviewing the \c ScribbleArea class, which - contains the interesting, then we will take a look at the \c - MainWindow class that uses it. + We will start by reviewing the \c ScribbleArea class. Then we will + review the \c MainWindow class, which uses \c ScribbleArea. \section1 ScribbleArea Class Definition -- cgit v0.12 From 283b6815586a87e458732534bc3c9c76b38ba49f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 23 Feb 2010 10:54:23 +0100 Subject: improve sql support for mingw64 --- src/sql/drivers/oci/qsql_oci.cpp | 6 ++++++ src/sql/drivers/odbc/qsql_odbc.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index b5c85e6..de2be89 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -56,6 +56,12 @@ #include #include +// This is needed for oracle oci when compiling with mingw-w64 headers +#if defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64) +#define _int64 __int64 +#endif + + #include #ifdef max #undef max diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index fab3ab3..9f7d267 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE #define ODBC_CHECK_DRIVER // newer platform SDKs use SQLLEN instead of SQLINTEGER -#if defined(WIN32) && (_MSC_VER < 1300) +#if defined(WIN32) && (_MSC_VER < 1300) && !defined(__MINGW64_VERSION_MAJOR) # define QSQLLEN SQLINTEGER # define QSQLULEN SQLUINTEGER #else -- cgit v0.12 From 53aaca8bc08150db3b446fbb70de3271fe5ea398 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 22 Feb 2010 19:33:13 +0100 Subject: Fixed cosmetic glitch in QTabBar label's rendering This seems to have appeared after commit 3baf7b981a8f40ed. Reviewed-by: Olivier --- src/gui/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 40ee31d..116b03e 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3760,7 +3760,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QPalette np = tab->palette; np.setColor(QPalette::WindowText, QColor(255, 255, 255, 75)); QRect nr = subElementRect(SE_TabBarTabText, opt, w); - nr.moveTop(+1); + nr.moveTop(-1); int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText); -- cgit v0.12 From bbb996e6cbe4a19ceb72650dd82a8b3cf60553db Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 22 Feb 2010 12:41:23 +0100 Subject: Use the SYMBIAN_BUILD_GCE macro to check if the GCE variant can be used The correct macro for determing when we can enable the NGA specific functions in Symbian is SYMBIAN_BUILD_GCE. Reviewed-by: Iain --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 9edf929..4b1232d 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2409,7 +2409,7 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #if defined(Q_OS_SYMBIAN) -#ifdef SYMBIAN_GRAPHICS_USE_GCE +#ifdef SYMBIAN_BUILD_GCE //RWsPointerCursor is fixed, so don't use low performance sprites #define Q_SYMBIAN_FIXED_POINTER_CURSORS #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE -- cgit v0.12 From 925dac20184820222765385b391a78d776ee61bb Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 22 Feb 2010 13:54:20 +0100 Subject: Enable window size caching on Symbian NGA variants. Enabling this flag saves us the round-trip to WSERV whenever RWindow::Size() is called because the size is cached on the client side. This can improve performance because functions like eglSwapBuffers() call Size() to see if the window size has changed and without the cache this introduces an extra IPC call for every frame. Task-number: QT-2849 Reviewed-by: Iain --- src/corelib/global/qglobal.h | 1 + src/gui/kernel/qapplication_s60.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 4b1232d..04aac12 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2413,6 +2413,7 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); //RWsPointerCursor is fixed, so don't use low performance sprites #define Q_SYMBIAN_FIXED_POINTER_CURSORS #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE +#define Q_SYMBIAN_WINDOW_SIZE_CACHE //enabling new graphics resources #define QT_SYMBIAN_SUPPORTS_SGIMAGE #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index bf3ad71..fdbbeb2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1146,6 +1146,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) #endif S60->wsSession().SetAutoFlush(ETrue); +#ifdef Q_SYMBIAN_WINDOW_SIZE_CACHE + TRAP_IGNORE(S60->wsSession().EnableWindowSizeCacheL()); +#endif + S60->updateScreenSize(); -- cgit v0.12 From 9be36306cd19626344cdedf5d99f5b142c2356d0 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 23 Feb 2010 09:57:35 +0100 Subject: Always define Q_WS_S60 on Symbian unless configured with -no-s60. Previously we were relying on the toolchain to define the S60 version for us and were enabling Q_WS_S60 based on this. Since the S60 macros are no longer defined for us, let's assume we always want S60 support unless Qt is configured with -no-s60. Reviewed-by: axis --- src/corelib/global/qglobal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 04aac12..82210f3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -813,7 +813,7 @@ namespace QT_NAMESPACE {} # define Q_WS_MAC32 # endif # elif defined(Q_OS_SYMBIAN) -# if (defined(__SERIES60_31__) || defined(__S60_32__) || defined(__S60_50__)) && !defined(QT_NO_S60) +# if !defined(QT_NO_S60) # define Q_WS_S60 # endif # elif !defined(Q_WS_QWS) -- cgit v0.12 From 9629681e7b3d69456bd6c5905c267b3d08b6243f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 11:38:23 +0100 Subject: doc: Corrected typo. Task: QTBUG-8450 --- src/corelib/io/qiodevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 4e14ba8..662100a 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1003,8 +1003,8 @@ QByteArray QIODevice::readAll() to a maximum of \a maxSize - 1 bytes, stores the characters in \a data, and returns the number of bytes read. If a line could not be read but no error ocurred, this function returns 0. If an error - occurs, this function returns what it could the length of what - could be read, or -1 if nothing was read. + occurs, this function returns the length of what could be read, or + -1 if nothing was read. A terminating '\0' byte is always appended to \a data, so \a maxSize must be larger than 1. -- cgit v0.12 From 2724520fd551512138731058467c9acea0aa3951 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 10:12:34 +0100 Subject: Add a configure test for XVideo support Reviewed-By: TrustMe --- config.tests/x11/xvideo/xvideo.cpp | 10 +++++++++ config.tests/x11/xvideo/xvideo.pro | 3 +++ configure | 43 +++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 config.tests/x11/xvideo/xvideo.cpp create mode 100644 config.tests/x11/xvideo/xvideo.pro diff --git a/config.tests/x11/xvideo/xvideo.cpp b/config.tests/x11/xvideo/xvideo.cpp new file mode 100644 index 0000000..9d0eef6 --- /dev/null +++ b/config.tests/x11/xvideo/xvideo.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, char** argv) +{ + unsigned int count = 0; + XvAdaptorInfo *adaptors = 0; + XvQueryAdaptors(0, 0, &count, &adaptors); + return 0; +} diff --git a/config.tests/x11/xvideo/xvideo.pro b/config.tests/x11/xvideo/xvideo.pro new file mode 100644 index 0000000..114cbd3 --- /dev/null +++ b/config.tests/x11/xvideo/xvideo.pro @@ -0,0 +1,3 @@ +CONFIG += x11 +CONFIG -= qt +SOURCES = xvideo.cpp diff --git a/configure b/configure index cd29e95..cfff066 100755 --- a/configure +++ b/configure @@ -640,6 +640,7 @@ CFG_SHARED=yes CFG_SM=auto CFG_XSHAPE=auto CFG_XSYNC=auto +CFG_XVIDEO=auto CFG_XINERAMA=runtime CFG_XFIXES=runtime CFG_ZLIB=auto @@ -921,7 +922,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xvideo|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1533,6 +1534,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + xvideo) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XVIDEO="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; xsync) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_XSYNC="$VAL" @@ -3624,6 +3632,13 @@ if [ "$PLATFORM_X11" = "yes" ]; then SHY="*" SHN=" " fi + if [ "$CFG_XVIDEO" = "no" ]; then + XVY=" " + XVN="*" + else + XVY="*" + XVN=" " + fi if [ "$CFG_XINERAMA" = "no" ]; then XAY=" " XAN="*" @@ -3727,6 +3742,10 @@ Qt/X11 only: $SHY -xshape ............ Compile XShape support. Requires X11/extensions/shape.h. + $XVN -no-xvideo ......... Do not compile XVideo support. + $XVY -xvideo ............ Compile XVideo support. + Requires X11/extensions/Xv.h & Xvlib.h. + $SHN -no-xsync .......... Do not compile XSync support. $SHY -xsync ............. Compile XSync support. Requires X11/extensions/sync.h. @@ -5304,6 +5323,23 @@ if [ "$PLATFORM_X11" = "yes" ]; then fi fi + # auto-detect XVideo support + if [ "$CFG_XVIDEO" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xvideo "XVideo" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_XVIDEO=yes + else + if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "XVideo support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_XVIDEO=no + fi + fi + fi + # auto-detect XSync support if [ "$CFG_XSYNC" != "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then @@ -6245,6 +6281,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then if [ "$CFG_XSHAPE" = "yes" ]; then QT_CONFIG="$QT_CONFIG xshape" fi + if [ "$CFG_XVIDEO" = "yes" ]; then + QT_CONFIG="$QT_CONFIG xvideo" + fi if [ "$CFG_XSYNC" = "yes" ]; then QT_CONFIG="$QT_CONFIG xsync" fi @@ -7038,6 +7077,7 @@ fi [ "$CFG_XRENDER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XRENDER" [ "$CFG_MITSHM" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM" [ "$CFG_XSHAPE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE" +[ "$CFG_XVIDEO" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XVIDEO" [ "$CFG_XSYNC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC" [ "$CFG_XINPUT" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET" @@ -7516,6 +7556,7 @@ fi if [ "$PLATFORM_X11" = "yes" ]; then echo "NAS sound support ... $CFG_NAS" echo "XShape support ...... $CFG_XSHAPE" + echo "XVideo support ...... $CFG_XVIDEO" echo "XSync support ....... $CFG_XSYNC" echo "Xinerama support .... $CFG_XINERAMA" echo "Xcursor support ..... $CFG_XCURSOR" -- cgit v0.12 From 84365594ec624f3c341f443503a7e83fe627d427 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 12:10:21 +0100 Subject: Make the XVideo configure test actually pass if XV is present Reviewed-By: TrustMe --- config.tests/x11/xvideo/xvideo.cpp | 1 + config.tests/x11/xvideo/xvideo.pro | 1 + 2 files changed, 2 insertions(+) diff --git a/config.tests/x11/xvideo/xvideo.cpp b/config.tests/x11/xvideo/xvideo.cpp index 9d0eef6..e9de2a8 100644 --- a/config.tests/x11/xvideo/xvideo.cpp +++ b/config.tests/x11/xvideo/xvideo.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/config.tests/x11/xvideo/xvideo.pro b/config.tests/x11/xvideo/xvideo.pro index 114cbd3..d4c63a0 100644 --- a/config.tests/x11/xvideo/xvideo.pro +++ b/config.tests/x11/xvideo/xvideo.pro @@ -1,3 +1,4 @@ CONFIG += x11 CONFIG -= qt SOURCES = xvideo.cpp +LIBS += -lXv -- cgit v0.12 From db817f85def9dcfd335bca46029b7eed168edb32 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 23 Feb 2010 19:00:12 +1000 Subject: Fix compile error in QEasingCurve Reviewed-by: akennedy --- src/corelib/tools/qeasingcurve.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 6b26907..89edb2d 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -861,7 +861,7 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item) QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing) { stream << easing.d_ptr->type; - stream << intptr_t(easing.d_ptr->func); + stream << quint64(intptr_t(easing.d_ptr->func)); bool hasConfig = easing.d_ptr->config; stream << hasConfig; @@ -891,9 +891,9 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) type = static_cast(int_type); easing.setType(type); - intptr_t ptr_func; + quint64 ptr_func; stream >> ptr_func; - easing.d_ptr->func = QEasingCurve::EasingFunction(ptr_func); + easing.d_ptr->func = QEasingCurve::EasingFunction(intptr_t(ptr_func)); bool hasConfig; stream >> hasConfig; -- cgit v0.12 From d9a390c6d5f18f335fa0a4766180ffa62f28c363 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 23 Feb 2010 12:09:52 +0100 Subject: Added QmlEnginePrivate::resolvePlugin. resolvePlugin returns the merge of the plugin's base name with the platform suffix (e.g. .dylib) and prefix (e.g. lib). --- src/declarative/qml/qmlengine.cpp | 89 +++++++++++++++++++++++++++++++++++++-- src/declarative/qml/qmlengine_p.h | 6 +++ 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 67d8c7d..98e16aa 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1359,9 +1359,11 @@ public: qmldirParser.parse(); foreach (const QmlDirParser::Plugin &plugin, qmldirParser.plugins()) { - const QFileInfo pluginFileInfo(dir + QDir::separator() + plugin.path, plugin.name); - const QString pluginFilePath = pluginFileInfo.absoluteFilePath(); - engine->importExtension(pluginFilePath, uri); + QString resolvedFilePath = QmlEnginePrivate::get(engine)->resolvePlugin(dir + QDir::separator() + plugin.path, + plugin.name); + + if (!resolvedFilePath.isEmpty()) + engine->importExtension(resolvedFilePath, uri); } } @@ -1609,6 +1611,87 @@ QString QmlEngine::offlineStoragePath() const return d->scriptEngine.offlineStoragePath; } +/*! + \internal + + Returns the result of the merge of \a baseName with \a dir, \a suffixes, and \a prefix. + */ +QString QmlEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName, + const QStringList &suffixes, + const QString &prefix) +{ + foreach (const QString &suffix, suffixes) { + QString pluginFileName = prefix; + + pluginFileName += baseName; + pluginFileName += QLatin1Char('.'); + pluginFileName += suffix; + + QFileInfo fileInfo(dir, pluginFileName); + + if (fileInfo.exists()) + return fileInfo.absoluteFilePath(); + } + + return QString(); +} + +/*! + \internal + + Returns the result of the merge of \a baseName with \a dir and the platform suffix. + + \table + \header \i Platform \i Valid suffixes + \row \i Windows \i \c .dll + \row \i Unix/Linux \i \c .so + \row \i AIX \i \c .a + \row \i HP-UX \i \c .sl, \c .so (HP-UXi) + \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so + \row \i Symbian \i \c .dll + \endtable + + Version number on unix are ignored. +*/ +QString QmlEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName) +{ +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + return resolvePlugin(dir, baseName, QStringList(QLatin1String("dll"))); +#elif defined(Q_OS_SYMBIAN) + return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dll") << QLatin1String("qtplugin")); +#else + +# if defined(Q_OS_DARWIN) + + return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dylib") << QLatin1String("so") << QLatin1String("bundle"), + QLatin1String("lib")); +# else // Generic Unix + QStringList validSuffixList; + +# if defined(Q_OS_HPUX) +/* + See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF": + "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit), + the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix." + */ + validSuffixList << QLatin1String("sl"); +# if defined __ia64 + validSuffixList << QLatin1String("so"); +# endif +# elif defined(Q_OS_AIX) + validSuffixList << QLatin1String("a") << QLatin1String("so"); +# elif defined(Q_OS_UNIX) + validSuffixList << QLatin1String("so"); +# endif + + // Examples of valid library names: + // libfoo.so + + return resolvePlugin(dir, baseName, validSuffixList, QLatin1String("lib")); +# endif + +#endif +} /*! \internal diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index d916286..53a88b1 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -104,6 +104,7 @@ class QmlCleanup; class QmlDelayedError; class QmlWorkerScriptEngine; class QmlGlobalScriptClass; +class QDir; class QmlScriptEngine : public QScriptEngine { @@ -263,6 +264,11 @@ public: QmlImportsPrivate *d; }; + QString resolvePlugin(const QDir &dir, const QString &baseName, + const QStringList &suffixes, + const QString &prefix = QString()); + QString resolvePlugin(const QDir &dir, const QString &baseName); + bool addToImport(Imports*, const QString& qmlDirContent,const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const; bool resolveType(const Imports&, const QByteArray& type, -- cgit v0.12 From 12b1dbb1a0911d421d9e19129291dcd8151c3f50 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Tue, 23 Feb 2010 12:28:17 +0100 Subject: QColorDialog::open() freezes the app the *second* time it is used on Mac The problem here is caused by a boolean flag used to prevent recursion. The flag was set and never reset. This patch resets the flag the moment open is called. Task-number: QTBUG-7825 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qcolordialog_mac.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index bdcb872..8af0d2b 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -96,6 +96,7 @@ QT_USE_NAMESPACE - (void)finishOffWithCode:(NSInteger)result; - (void)showColorPanel; - (void)exec; +- (void)setResultSet:(BOOL)result; @end @implementation QCocoaColorPanelDelegate @@ -158,6 +159,11 @@ QT_USE_NAMESPACE [super dealloc]; } +- (void)setResultSet:(BOOL)result +{ + mResultSet = result; +} + - (BOOL)windowShouldClose:(id)window { Q_UNUSED(window); @@ -320,7 +326,7 @@ QT_USE_NAMESPACE } else { mPriv->colorDialog()->accept(); } - } + } } } @@ -433,7 +439,7 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial, priv:this]; [colorPanel setDelegate:static_cast(delegate)]; } - + [delegate setResultSet:false]; setCocoaPanelColor(initial); [static_cast(delegate) showColorPanel]; } -- cgit v0.12 From 57f716aab87ad517ccd6a36bdd5ca8178c561572 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 23 Feb 2010 12:31:10 +0100 Subject: Improve test coverage of QScriptString::toArrayIndex() Test decimals and scientific notation. "0.0" is not a valid array index even though it can be converted to a whole integer, because the number converted back to a string again is "0", which is different from "0.0". (See ECMA 15.4) --- tests/auto/qscriptstring/tst_qscriptstring.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qscriptstring/tst_qscriptstring.cpp b/tests/auto/qscriptstring/tst_qscriptstring.cpp index 808b643..ea4a92b 100644 --- a/tests/auto/qscriptstring/tst_qscriptstring.cpp +++ b/tests/auto/qscriptstring/tst_qscriptstring.cpp @@ -177,6 +177,12 @@ void tst_QScriptString::toArrayIndex_data() 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("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() -- cgit v0.12 From 4c2300f8f63b9abda08c015bcc8541520f1c82ba Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 12:29:52 +0100 Subject: Fix build on systems without XVideo headers This change uses the new xvideo configure test and disables the gstreamer mediaservices backend if XVideo isn't configured. Reviewed-By: Thiago --- src/plugins/mediaservices/mediaservices.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro index 55e6aba..d90ce4b 100644 --- a/src/plugins/mediaservices/mediaservices.pro +++ b/src/plugins/mediaservices/mediaservices.pro @@ -4,7 +4,7 @@ win32:!wince: SUBDIRS += directshow mac: SUBDIRS += qt7 -unix:!mac:!symbian { +unix:!mac:!symbian:contains(QT_CONFIG, xvideo): { TMP_GST_LIBS = \ gstreamer-0.10 >= 0.10.19 \ gstreamer-base-0.10 >= 0.10.19 \ -- cgit v0.12 From d43ec1bdb12649c32f0f0067492857a70bef05b4 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 23 Feb 2010 12:45:38 +0100 Subject: More precise compiler errors People were having trouble figureing what was wrong based off the previous error message. This should now be rectified - at least for users who read the docs. Reviewed-by: mae --- src/declarative/qml/qmlcompiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 4508964..4365b17 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1132,10 +1132,10 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj, Property *idProp = 0; if (obj->properties.count() > 1 || (obj->properties.count() == 1 && obj->properties.begin().key() != "id")) - COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Invalid component specification")); + COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Component elements may not contain properties other than id")); if (!obj->scriptBlockObjects.isEmpty()) - COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Invalid component specification")); + COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Component elements may not contain script blocks")); if (obj->properties.count()) idProp = *obj->properties.begin(); -- cgit v0.12 From 5eb3c2fc8f90509cb368ab56f14364d6e17844f1 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 23 Feb 2010 12:48:16 +0100 Subject: Look for QML plugins in the paths specified in QML_PLUGIN_PATH env var. --- src/declarative/qml/qmlengine.cpp | 30 +++++++++++++++++++++++++---- src/declarative/qml/qmlengine_p.h | 3 +++ src/declarative/qml/qmlextensioninterface.h | 2 +- src/declarative/qml/qmlextensionplugin.h | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 98e16aa..a7c3d08 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -158,6 +158,21 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) } globalClass = new QmlGlobalScriptClass(&scriptEngine); fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml")); + + // env import paths + QByteArray envImportPath = qgetenv("QML_IMPORT_PATH"); + if (!envImportPath.isEmpty()) { +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + QLatin1Char pathSep(';'); +#else + QLatin1Char pathSep(':'); +#endif + foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) { + QString canonicalPath = QDir(path).canonicalPath(); + if (!canonicalPath.isEmpty() && !environmentImportPath.contains(canonicalPath)) + environmentImportPath.append(canonicalPath); + } + } } QUrl QmlScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) @@ -1334,9 +1349,16 @@ public: url.replace(QLatin1Char('.'), QLatin1Char('/')); bool found = false; QString content; - QString dir; - QStringList paths = importPath; - paths.prepend(QFileInfo(base.toLocalFile()).path()); + QString dir; + + // user import paths + QStringList paths; + + // base.. + paths += QFileInfo(base.toLocalFile()).path(); + paths += importPath; + paths += QmlEnginePrivate::get(engine)->environmentImportPath; + foreach (const QString &p, paths) { dir = p+QLatin1Char('/')+url; QFileInfo fi(dir+QLatin1String("/qmldir")); @@ -1575,7 +1597,7 @@ bool QmlEngine::importExtension(const QString &fileName, const QString &uri) QPluginLoader loader(fileName); if (QmlExtensionInterface *iface = qobject_cast(loader.instance())) { - iface->initialize(this, uri); + iface->initialize(this, uri.toUtf8().constData()); return true; } diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 53a88b1..85c5fbe 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -264,6 +264,9 @@ public: QmlImportsPrivate *d; }; + + QStringList environmentImportPath; + QString resolvePlugin(const QDir &dir, const QString &baseName, const QStringList &suffixes, const QString &prefix = QString()); diff --git a/src/declarative/qml/qmlextensioninterface.h b/src/declarative/qml/qmlextensioninterface.h index cbdd34c..b993e82 100644 --- a/src/declarative/qml/qmlextensioninterface.h +++ b/src/declarative/qml/qmlextensioninterface.h @@ -54,7 +54,7 @@ class QmlEngine; struct Q_DECLARATIVE_EXPORT QmlExtensionInterface { - virtual void initialize(QmlEngine *engine, const QString &uri) = 0; + virtual void initialize(QmlEngine *engine, const char *uri) = 0; }; Q_DECLARE_INTERFACE(QmlExtensionInterface, "com.trolltech.Qt.QmlExtensionInterface/1.0") diff --git a/src/declarative/qml/qmlextensionplugin.h b/src/declarative/qml/qmlextensionplugin.h index 82553e7..8cc64ad 100644 --- a/src/declarative/qml/qmlextensionplugin.h +++ b/src/declarative/qml/qmlextensionplugin.h @@ -62,7 +62,7 @@ public: explicit QmlExtensionPlugin(QObject *parent = 0); ~QmlExtensionPlugin(); - virtual void initialize(QmlEngine *engine, const QString &uri) = 0; + virtual void initialize(QmlEngine *engine, const char *uri) = 0; }; QT_END_NAMESPACE -- cgit v0.12 From 743720c2d391f73bc376c337002c15cfa119139b Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 13:16:52 +0100 Subject: Fixing deployment on Symbian Reviewed-by: TrustMe --- tests/benchmarks/declarative/binding/binding.pro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index e25f186..aa4cc41 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -7,3 +7,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT = data +} + -- cgit v0.12 From fcd4c0dce69e22487d9141f3bf5de6d4c56a3432 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 13:32:48 +0100 Subject: Fixing deployment on Symbian platform Reviewed-by: TrustMe --- tests/benchmarks/declarative/creation/creation.pro | 9 +++++++-- tests/benchmarks/declarative/creation/tst_creation.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index fcc2987..3e0caf6 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -6,5 +6,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += addFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} \ No newline at end of file diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 23c820c..b99031a 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -49,6 +49,12 @@ #include #include +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_creation : public QObject { Q_OBJECT -- cgit v0.12 From 8ad76444ad4589e0b69056cca283253070dae350 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 23 Feb 2010 13:36:36 +0100 Subject: Doc fix Remove stray '>' --- src/declarative/graphicsitems/qmlgraphicsgridview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index bf370ae..ab87c03 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -977,7 +977,7 @@ void QmlGraphicsGridView::setHighlight(QmlComponent *highlight) Component { id: myHighlight Rectangle { - id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 > + id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 y: SpringFollow { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 } x: SpringFollow { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 } } -- cgit v0.12 From 526c6fd4686a8e87e5087ebcac941405f742304a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 15 Feb 2010 13:33:07 +0100 Subject: Prevent stale QWidget pointers in QCocoaView QCocoaView has two "back" pointers ot its owning QWidget and the corresponding QWidgetPrivate. The lifetime of the QCocoaView might be longer and that of the QWidget if Cocoa itself holds references to it. In addition accessing a QWidget that is being destroyed is not safe. Set both pack pointers to NULL in ~QWidget. This prevents following stale pointers in the QCocoaView callbacks. This also means that we'll see the NULL pointers, add gurads for that. --- src/gui/kernel/qcocoaview_mac.mm | 52 ++++++++++++++++++++++++++++++++-- src/gui/kernel/qcocoaview_mac_p.h | 1 + src/gui/kernel/qt_cocoa_helpers_mac.mm | 10 +++++++ src/gui/kernel/qwidget.cpp | 9 ++++++ 4 files changed, 69 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 455176e..4977042 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -419,6 +419,8 @@ extern "C" { - (BOOL)isOpaque; { + if (!qwidgetprivate) + return [super isOpaque]; return qwidgetprivate->isOpaque; } @@ -450,7 +452,7 @@ extern "C" { } // Make sure the opengl context is updated on resize. - if (qwidgetprivate->isGLWidget) { + if (qwidgetprivate && qwidgetprivate->isGLWidget) { qwidgetprivate->needWindowChange = true; QEvent event(QEvent::MacGLWindowChange); qApp->sendEvent(qwidget, &event); @@ -459,6 +461,9 @@ extern "C" { - (void)drawRect:(NSRect)aRect { + if (!qwidget) + return; + if (QApplicationPrivate::graphicsSystem() != 0) { if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) { // Drawing is handled on the window level @@ -551,12 +556,18 @@ extern "C" { - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { + if (!qwidget) + return NO; + Q_UNUSED(theEvent); return !qwidget->testAttribute(Qt::WA_MacNoClickThrough); } - (NSView *)hitTest:(NSPoint)aPoint { + if (!qwidget) + return [super hitTest:aPoint]; + if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) return nil; // You cannot hit a transparent for mouse event widget. return [super hitTest:aPoint]; @@ -564,6 +575,9 @@ extern "C" { - (void)updateTrackingAreas { + if (!qwidget) + return; + // [NSView addTrackingArea] is slow, so bail out early if we can: if (NSIsEmptyRect([self visibleRect])) return; @@ -597,6 +611,9 @@ extern "C" { - (void)mouseEntered:(NSEvent *)event { + if (!qwidget) + return; + if (qwidgetprivate->data.in_destructor) return; QEvent enterEvent(QEvent::Enter); @@ -619,6 +636,9 @@ extern "C" { - (void)mouseExited:(NSEvent *)event { + if (!qwidget) + return; + QEvent leaveEvent(QEvent::Leave); NSPoint globalPoint = [[event window] convertBaseToScreen:[event locationInWindow]]; if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) { @@ -637,6 +657,9 @@ extern "C" { - (void)flagsChanged:(NSEvent *)theEvent { + if (!qwidget) + return; + QWidget *widgetToGetKey = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); @@ -648,6 +671,9 @@ extern "C" { - (void)mouseMoved:(NSEvent *)theEvent { + if (!qwidget) + return; + // We always enable mouse tracking for all QCocoaView-s. In cases where we have // child views, we will receive mouseMoved for both parent & the child (if // mouse is over the child). We need to ignore the parent mouseMoved in such @@ -938,6 +964,8 @@ extern "C" { - (void)frameDidChange:(NSNotification *)note { Q_UNUSED(note); + if (!qwidget) + return; if (qwidget->isWindow()) return; NSRect newFrame = [self frame]; @@ -961,7 +989,7 @@ extern "C" { { QMacCocoaAutoReleasePool pool; [super setEnabled:flag]; - if (qwidget->isEnabled() != flag) + if (qwidget && qwidget->isEnabled() != flag) qwidget->setEnabled(flag); } @@ -972,6 +1000,8 @@ extern "C" { - (BOOL)acceptsFirstResponder { + if (!qwidget) + return NO; if (qwidget->isWindow()) return YES; // Always do it, so that windows can accept key press events. return qwidget->focusPolicy() != Qt::NoFocus; @@ -979,6 +1009,8 @@ extern "C" { - (BOOL)resignFirstResponder { + if (!qwidget) + return NO; // Seems like the following test only triggers if this // view is inside a QMacNativeWidget: if (qwidget == QApplication::focusWidget()) @@ -1014,6 +1046,12 @@ extern "C" { return qwidget; } +- (void) qt_clearQWidget +{ + qwidget = 0; + qwidgetprivate = 0; +} + - (BOOL)qt_leftButtonIsRightButton { return leftButtonIsRightButton; @@ -1067,9 +1105,11 @@ extern "C" { - (void)viewWillMoveToWindow:(NSWindow *)window { + if (qwidget == 0) + return; + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && (window != [self window])) { // OpenGL Widget - // Create a stupid ClearDrawable Event QEvent event(QEvent::MacGLClearDrawable); qApp->sendEvent(qwidget, &event); } @@ -1077,6 +1117,9 @@ extern "C" { - (void)viewDidMoveToWindow { + if (qwidget == 0) + return; + if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) { // call update paint event qwidgetprivate->needWindowChange = true; @@ -1272,6 +1315,9 @@ extern "C" { - (NSArray*) validAttributesForMarkedText { + if (qwidget == 0) + return nil; + if (!qwidget->testAttribute(Qt::WA_InputMethodEnabled)) return nil; // Not sure if that's correct, but it's saves a malloc. diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 4bb10c5..33aaa24 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -103,6 +103,7 @@ Q_GUI_EXPORT - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; - (BOOL)isComposing; - (QWidget *)qt_qwidget; +- (void) qt_clearQWidget; - (BOOL)qt_leftButtonIsRightButton; - (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped; + (DnDParams*)currentMouseEvent; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index e9fdbda..9560952 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -369,6 +369,16 @@ QMacTabletHash *qt_mac_tablet_hash() } #ifdef QT_MAC_USE_COCOA + +// Clears the QWidget pointer that each QCocoaView holds. +void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget) +{ + QCocoaView *cocoaView = reinterpret_cast(qt_mac_nativeview_for(widget)); + if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) { + [cocoaView qt_clearQWidget]; + } +} + void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent) { NSEvent *proximityEvent = static_cast(tabletEvent); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index d433048..1e9b1d9 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1468,6 +1468,15 @@ QWidget::~QWidget() d->declarativeData = 0; // don't activate again in ~QObject } +#ifdef QT_MAC_USE_COCOA + // QCocoaView holds a pointer back to this widget. Clear it now + // to make sure it's not followed later on. The lifetime of the + // QCocoaView might exceed the lifetime of this widget in cases + // where Cocoa itself holds references to it. + extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *); + qt_mac_clearCocoaViewQWidgetPointers(this); +#endif + if (!d->children.isEmpty()) d->deleteChildren(); -- cgit v0.12 From 3fad8ee60949d45bbb78c92cc4cad6cfbded1aae Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 13:10:45 +0100 Subject: Detect GStreamer even when we're not building phonon Reviewed-By: Thiago --- configure | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/configure b/configure index cfff066..f1fe686 100755 --- a/configure +++ b/configure @@ -5024,32 +5024,33 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then fi fi - if [ "$CFG_PHONON" != "no" ]; then - if [ "$CFG_PHONON_BACKEND" != "no" ]; then - if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then - if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` - QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` - fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER $X11TESTS_FLAGS; then - CFG_GSTREAMER=yes - QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER" - QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER" - else - if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - echo "Gstreamer support cannot be enabled due to functionality tests!" - echo " Turn on verbose messaging (-v) to $0 to see the final report." - echo " If you believe this message is in error you may use the continue" - echo " switch (-continue) to $0 to continue." - exit 101 - else - CFG_GSTREAMER=no - fi - fi - elif [ "$CFG_GLIB" = "no" ]; then + # Auto-detect GStreamer support (needed for both Phonon & QtMultimedia) + if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then + if [ -n "$PKG_CONFIG" ]; then + QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` + QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` + fi + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER $X11TESTS_FLAGS; then + CFG_GSTREAMER=yes + QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER" + QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER" + else + if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "Gstreamer support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else CFG_GSTREAMER=no fi + fi + elif [ "$CFG_GLIB" = "no" ]; then + CFG_GSTREAMER=no + fi + if [ "$CFG_PHONON" != "no" ]; then + if [ "$CFG_PHONON_BACKEND" != "no" ]; then if [ "$CFG_GSTREAMER" = "yes" ]; then CFG_PHONON=yes else -- cgit v0.12 From 28e3d3516ebe88f7353fde44194aba5b7d1d8710 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 23 Feb 2010 13:43:50 +0100 Subject: doc: Added QScopedArrayPointer and corrected QScopedPointer snippet. Task: QTBUG-7766 --- .../code/src_corelib_tools_qscopedpointer.cpp | 2 +- src/corelib/tools/qscopedpointer.cpp | 55 ++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp index c068ba9..4158388 100644 --- a/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp +++ b/doc/src/snippets/code/src_corelib_tools_qscopedpointer.cpp @@ -128,7 +128,7 @@ private: QScopedPointer > arrayPointer(new int[42]); // this QScopedPointer frees its data using free(): -QScopedPointer > podPointer(reinterpret_cast(malloc(42))); +QScopedPointer podPointer(reinterpret_cast(malloc(42))); // this struct calls "myCustomDeallocator" to delete the pointer struct ScopedPointerCustomDeleter diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 12badf0..e7dd769 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -225,4 +225,59 @@ QT_BEGIN_NAMESPACE Swap this pointer with \a other. */ +/*! + \class QScopedArrayPointer + + \brief The QScopedArrayPointer class stores a pointer to a + dynamically allocated array of objects, and deletes it upon + destruction. + + \since 4.6 + \reentrant + \ingroup misc + + A QScopedArrayPointer is a QScopedPointer that defaults to + deleting the object it is pointing to with the delete[] operator. It + also features operator[] for convenience, so we can write: + + \code + void foo() + { + QScopedArrayPointer i(new int[10]); + i[2] = 42; + ... + return; // our integer array is now deleted using delete[] + } + \endcode +*/ + +/*! + \fn QScopedArrayPointer::QScopedArrayPointer(T *p = 0) + + Constructs this QScopedArrayPointer instance and sets its pointer + to \a p. +*/ + +/*! + \fn T *QScopedArrayPointer::operator[](int i) + + Provides access to entry \a i of the scoped pointer's array of + objects. + + If the contained pointer is \c null, behavior is undefined. + + \sa isNull() +*/ + +/*! + \fn T *QScopedArrayPointer::operator[](int i) const + + Provides access to entry \a i of the scoped pointer's array of + objects. + + If the contained pointer is \c null, behavior is undefined. + + \sa isNull() +*/ + QT_END_NAMESPACE -- cgit v0.12 From b7dde7fc5df285c919df91daba7f07aef00c11bd Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 13:46:47 +0100 Subject: Fixing deployment on Symbian Reviewed-by: TrustMe --- tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro index 6a86f58..a77eebb 100644 --- a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro +++ b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro @@ -7,3 +7,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlcomponent.cpp testtypes.cpp HEADERS += testtypes.h +symbian* { + data.sources = data/* + data.path = data + samegame.sources = data/samegame/* + samegame.path = data/samegame + samegame_pics.sources = data/samegame/pics/* + samegame_pics.path = data/samegame/pics + DEPLOYMENT += data samegame samegame_pics +} + -- cgit v0.12 From 9cf177099bfff8a00297f868b912723ca7b9551f Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 13:58:30 +0100 Subject: Fixing deployment on Symbian Reviewed-by: TrustMe --- .../benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro | 9 +++++++-- .../declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro index 449d874..f14931c 100644 --- a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro +++ b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro @@ -7,5 +7,10 @@ CONFIG += release SOURCES += tst_qmlgraphicsimage.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - +symbian* { + data.sources = image.png + data.path = . + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp index 7d7d24e..6d1aa0e 100644 --- a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp @@ -44,6 +44,12 @@ #include #include +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_qmlgraphicsimage : public QObject { Q_OBJECT -- cgit v0.12 From 7f3896f6c0cff6c6ddac1fba480dedbbf78c2df1 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 14:07:40 +0100 Subject: Fixing deplyment on Symbian platform Reviewed-by: TrustMe --- tests/benchmarks/declarative/script/script.pro | 11 ++++++++++- tests/benchmarks/declarative/script/tst_script.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 48fea81..6255acc 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -7,5 +7,14 @@ CONFIG += release SOURCES += tst_script.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + + + diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index dd21997..15902e4 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -48,6 +48,12 @@ #include #include +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "." +#endif + class tst_script : public QObject { Q_OBJECT -- cgit v0.12 From 62fc581eb84504d05bca7b70ac3dc912982133d1 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 14:12:14 +0100 Subject: Fixing deployment and default values for Symbian Reviewed-by: TrustMe --- tests/benchmarks/declarative/qmltime/qmltime.cpp | 11 +++++++++++ tests/benchmarks/declarative/qmltime/qmltime.pro | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp index 2cc5d0d..8e312be 100644 --- a/tests/benchmarks/declarative/qmltime/qmltime.cpp +++ b/tests/benchmarks/declarative/qmltime/qmltime.cpp @@ -183,7 +183,11 @@ int main(int argc, char ** argv) } if (filename.isEmpty()) +#ifdef Q_OS_SYMBIAN + filename = QLatin1String("./tests/item_creation/data.qml"); +#else usage(argv[0]); +#endif QmlEngine engine; QmlComponent component(&engine, filename); @@ -204,6 +208,9 @@ int main(int argc, char ** argv) return -1; } +#ifdef Q_OS_SYMBIAN + willParent = true; +#endif timer->setWillParent(willParent); if (!timer->component()) { @@ -211,6 +218,10 @@ int main(int argc, char ** argv) return -1; } +#ifdef Q_OS_SYMBIAN + iterations = 1024; +#endif + timer->run(iterations); return 0; diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro index b077d1a..9352f3b 100644 --- a/tests/benchmarks/declarative/qmltime/qmltime.pro +++ b/tests/benchmarks/declarative/qmltime/qmltime.pro @@ -6,3 +6,18 @@ macx:CONFIG -= app_bundle SOURCES += qmltime.cpp +symbian* { + TARGET.CAPABILITY = "All -TCB" + example.sources = example.qml + esample.path = . + tests.sources = tests/* + tests.path = tests + anshors.sources = tests/anchors/* + anchors.path = tests/anchors + item_creation.sources = tests/item_creation/* + item_creation.path = tests/item_creation + positioner_creation.sources = tests/positioner_creation/* + positioner_creation.path = tests/positioner_creation + DEPLOYMENT += example tests anchors item_creation positioner_creation +} + -- cgit v0.12 From bf5bf41d03d553421e87d01dadda95f4561247a9 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 23 Feb 2010 13:28:25 +0100 Subject: Make mediaservices use existing GStreamer qmake vars This should also allow building when pkg-config isn't present or doesn't work, E.g. when cross-compiling on toolchains lacking pkg-config support. Apparently this also fixes warnings on Solaris too. Reviewed-By: Thiago --- src/plugins/mediaservices/gstreamer/gstreamer.pro | 12 ++---------- src/plugins/mediaservices/mediaservices.pro | 13 ++----------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/plugins/mediaservices/gstreamer/gstreamer.pro b/src/plugins/mediaservices/gstreamer/gstreamer.pro index db0ee4e..22e3c16 100644 --- a/src/plugins/mediaservices/gstreamer/gstreamer.pro +++ b/src/plugins/mediaservices/gstreamer/gstreamer.pro @@ -8,16 +8,8 @@ unix:contains(QT_CONFIG, alsa) { LIBS += -lasound } -LIBS += -lXv - -CONFIG += link_pkgconfig - -PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ - gstreamer-interfaces-0.10 \ - gstreamer-audio-0.10 \ - gstreamer-video-0.10 +QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER +LIBS += -lXv $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstaudio-0.10 # Input HEADERS += \ diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro index d90ce4b..a8ac39c 100644 --- a/src/plugins/mediaservices/mediaservices.pro +++ b/src/plugins/mediaservices/mediaservices.pro @@ -4,15 +4,6 @@ win32:!wince: SUBDIRS += directshow mac: SUBDIRS += qt7 -unix:!mac:!symbian:contains(QT_CONFIG, xvideo): { - TMP_GST_LIBS = \ - gstreamer-0.10 >= 0.10.19 \ - gstreamer-base-0.10 >= 0.10.19 \ - gstreamer-interfaces-0.10 >= 0.10.19 \ - gstreamer-audio-0.10 >= 0.10.19 \ - gstreamer-video-0.10 >= 0.10.19 - - system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): { - SUBDIRS += gstreamer - } +unix:!mac:!symbian:contains(QT_CONFIG, xvideo):contains(QT_CONFIG, gstreamer) { + SUBDIRS += gstreamer } -- cgit v0.12 From 466a3fc2f883344fc383be771e2de9975c98b194 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 23 Feb 2010 14:15:54 +0100 Subject: Fix build on solaris --- src/declarative/qml/qmlworkerscript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp index a2e8c7a..9a48c4f 100644 --- a/src/declarative/qml/qmlworkerscript.cpp +++ b/src/declarative/qml/qmlworkerscript.cpp @@ -169,7 +169,7 @@ private: class QmlWorkerListModelAgent : public QObject { Q_OBJECT - Q_PROPERTY(int count READ count); + Q_PROPERTY(int count READ count) public: QmlWorkerListModelAgent(QmlWorkerListModel *); -- cgit v0.12 From 742befdd5077b27de79ca5ee6f9182540d0d5863 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 23 Feb 2010 14:24:44 +0100 Subject: Avoiding PlatSec warnings for Symbian devices Reviewed-by: TrustMe --- tools/qmlviewer/qmlviewer.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro index aba3cf5..2da244c 100644 --- a/tools/qmlviewer/qmlviewer.pro +++ b/tools/qmlviewer/qmlviewer.pro @@ -54,5 +54,5 @@ symbian { TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h LIBS += -lesock -lconnmon -linsock - TARGET.CAPABILITY = NetworkServices + TARGET.CAPABILITY = "All -TCB" } -- cgit v0.12 From 06db13cca01cac1ed65cb2e8cd7938ce58146fe9 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 23 Feb 2010 14:21:15 +0100 Subject: Adjust the mkdist-webkit script before the importation of WebKit. Reviewed-by: TrustMe --- util/webkit/mkdist-webkit | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index ddf74bb..e8426b1 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -20,7 +20,7 @@ if [ -z "$repository" ]; then die "error: cannot locate webkit git repository. please run git config --global qtwebkit.url /path-or-url/to/webkit/repo" fi -excluded_directories="LayoutTests JavaScriptGlue WebKitLibraries WebKitSite WebKitTools WebCore/platform/cf WebCore/platform/gtk WebCore/platform/chromium" +excluded_directories="LayoutTests JavaScriptGlue WebKitLibraries WebKitSite WebKitTools WebCore/platform/gtk WebCore/platform/chromium" excluded_directories="$excluded_directories PageLoadTests" excluded_directories="$excluded_directories BugsSite" excluded_directories="$excluded_directories PlanetWebKit" @@ -49,6 +49,8 @@ excluded_directories="$excluded_directories JavaScriptCore/wtf/mac" excluded_directories="$excluded_directories JavaScriptCore/wtf/win" excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium" excluded_directories="$excluded_directories JavaScriptCore/wtf/haiku" +excluded_directories="$excluded_directories JavaScriptCore/wtf/android" +excluded_directories="$excluded_directories JavaScriptCore/wtf/brew" excluded_directories="$excluded_directories WebCore/WebCore.vcproj" excluded_directories="$excluded_directories WebCore/WebCore.gyp" @@ -81,41 +83,52 @@ excluded_directories="$excluded_directories WebCore/page/wx" excluded_directories="$excluded_directories WebCore/page/chromium" excluded_directories="$excluded_directories WebCore/page/haiku" excluded_directories="$excluded_directories WebCore/page/wince" +excluded_directories="$excluded_directories WebCore/page/android" +excluded_directories="$excluded_directories WebCore/page/brew" excluded_directories="$excluded_directories WebCore/history/mac" +excluded_directories="$excluded_directories WebCore/history/android" excluded_directories="$excluded_directories WebCore/editing/mac" excluded_directories="$excluded_directories WebCore/editing/wx" excluded_directories="$excluded_directories WebCore/editing/haiku" +excluded_directories="$excluded_directories WebCore/editing/android" +excluded_directories="$excluded_directories WebCore/editing/chromium" +excluded_directories="$excluded_directories WebCore/editing/gtk" excluded_directories="$excluded_directories WebCore/platform/haiku" +excluded_directories="$excluded_directories WebCore/platform/android" +excluded_directories="$excluded_directories WebCore/platform/brew" excluded_directories="$excluded_directories WebCore/platform/text/wx" excluded_directories="$excluded_directories WebCore/platform/text/gtk" excluded_directories="$excluded_directories WebCore/platform/text/chromium" excluded_directories="$excluded_directories WebCore/platform/text/haiku" +excluded_directories="$excluded_directories WebCore/platform/text/android" +excluded_directories="$excluded_directories WebCore/platform/text/brew" excluded_directories="$excluded_directories WebCore/platform/sql/chromium" excluded_directories="$excluded_directories WebCore/manual-tests" -excluded_directories="$excluded_directories WebCore/platform/network/cf" excluded_directories="$excluded_directories WebCore/platform/network/curl" excluded_directories="$excluded_directories WebCore/platform/network/mac" excluded_directories="$excluded_directories WebCore/platform/network/win" excluded_directories="$excluded_directories WebCore/platform/network/soup" excluded_directories="$excluded_directories WebCore/platform/network/chromium" +excluded_directories="$excluded_directories WebCore/platform/network/android" +excluded_directories="$excluded_directories WebCore/platform/network/brew" excluded_directories="$excluded_directories WebCore/platform/graphics/cg" excluded_directories="$excluded_directories WebCore/platform/graphics/cairo" excluded_directories="$excluded_directories WebCore/platform/graphics/gtk" excluded_directories="$excluded_directories WebCore/platform/graphics/wx" excluded_directories="$excluded_directories WebCore/platform/graphics/mac" -excluded_directories="$excluded_directories WebCore/platform/graphics/win" excluded_directories="$excluded_directories WebCore/platform/graphics/skia" excluded_directories="$excluded_directories WebCore/platform/graphics/chromium" excluded_directories="$excluded_directories WebCore/platform/graphics/wince" excluded_directories="$excluded_directories WebCore/platform/graphics/haiku" +excluded_directories="$excluded_directories WebCore/platform/graphics/brew" excluded_directories="$excluded_directories WebCore/platform/image-decoders/bmp" excluded_directories="$excluded_directories WebCore/platform/image-decoders/gif" @@ -126,11 +139,13 @@ excluded_directories="$excluded_directories WebCore/platform/image-decoders/jpeg excluded_directories="$excluded_directories WebCore/platform/image-decoders/xbm" excluded_directories="$excluded_directories WebCore/platform/image-decoders/skia" excluded_directories="$excluded_directories WebCore/platform/image-decoders/haiku" +excluded_directories="$excluded_directories WebCore/platform/image-decoders/wx" excluded_directories="$excluded_directories WebCore/platform/image-encoders/skia" excluded_directories="$excluded_directories WebCore/plugins/gtk" excluded_directories="$excluded_directories WebCore/plugins/chromium" +excluded_directories="$excluded_directories WebCore/plugins/wx" excluded_directories="$excluded_directories WebCore/accessibility/chromium" excluded_directories="$excluded_directories WebCore/accessibility/gtk" @@ -139,6 +154,7 @@ excluded_directories="$excluded_directories WebCore/accessibility/win" excluded_directories="$excluded_directories WebCore/accessibility/wx" excluded_directories="$excluded_directories WebCore/storage/wince" +excluded_directories="$excluded_directories WebCore/storage/chromium" excluded_directories="$excluded_directories WebCore/platform/wx" excluded_directories="$excluded_directories WebCore/platform/wince" @@ -196,6 +212,7 @@ files_to_remove="$files_to_remove autogen.sh" files_to_remove="$files_to_remove configure.ac" files_to_remove="$files_to_remove WebKit.pro" +files_to_remove="$files_to_remove DerivedSources.pro" files_to_remove="$files_to_remove WebKit/qt/QtLauncher/QtLauncher.pro" files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp" @@ -311,16 +328,11 @@ echo "generating extra sources" ( for proj in JavaScriptCore WebCore; do cd $absSrcDir/$proj && - rm -rf tmp && - mkdir tmp && - cd tmp && - mkdir -p ../generated && - qmake -o Makefile CONFIG-=QTDIR_build QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro && + qmake -o Makefile DerivedSources.pro && make generated_files && - perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h && - git add ../generated && - cd .. && - rm -rf tmp && + perl -pi -e "s,$absSrcDir/,,g" generated/*.cpp generated/*.h && + git add generated && + rm DerivedSources.pro Makefile && cd .. done ) -- cgit v0.12 From f3be69195ebe94c003755a652a9ef9e8a3a898fe Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 23 Feb 2010 14:41:16 +0100 Subject: Updated WebKit from /home/jturcott/dev/webkit to qtwebkit-4.7-merged ( 5381ceeb37d97365cfb2f037650dbb4e495bca4e ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-10-30 Tor Arne Vestbø Reviewed by NOBODY (OOPS!). [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() This ensures that long-running JavaScript (for example due to a modal alert() dialog), will not trigger a deferred load after only 500ms (the default tokenizer delay) while still giving a reasonable timeout (10 seconds) to prevent deadlock. https://bugs.webkit.org/show_bug.cgi?id=29381 * Api/qwebframe.cpp: Document the behaviour * WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads * tests/qwebframe/tst_qwebframe.cpp: Add test 2010-02-18 Noam Rosenthal Reviewed by Kenneth Rohde Christiansen. [Qt] Minor improvement to hybrid QPixmap https://bugs.webkit.org/show_bug.cgi?id=34507 * tests/hybridPixmap/test.html: use assignToHTMLImageElement on an existing element instead of toHTMLImageElement which creates a new one 2010-02-17 Dmitry Titov Reviewed by David Levin, Darin Fisher, Simon Hausmann. When a live iframe element is moved between pages, it still depends on the old page. https://bugs.webkit.org/show_bug.cgi?id=34382 * Api/qwebframe_p.h: (QWebFramePrivate::setPage): Added. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::didTransferChildFrameToNewDocument): The QWebFrame caches a QWebPage which should be replaced when Frame is re-parented. Also, the QWebFrame is a child (in QT terms) of QWebPage - so update that relationship as well. Emit a signal that QWebFrame moved to a different QWebPage. * WebCoreSupport/FrameLoaderClientQt.h: 2010-02-17 Kent Tamura Reviewed by Eric Seidel. Introduces new Icon loading interface in order to support asynchronous loading. https://bugs.webkit.org/show_bug.cgi?id=32054 Add an empty implementation of ChromeClient::iconForFiles(). * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::iconForFiles): * WebCoreSupport/ChromeClientQt.h: 2010-02-17 Diego Gonzalez Reviewed by Ariya Hidayat. Make possible Qt DRT to get total number of pages to be printed LayoutTests: printing/numberOfPages.html [Qt] DRT: Get total number of pages to be printed https://bugs.webkit.org/show_bug.cgi?id=34955 * Api/qwebframe.cpp: (qt_drt_numberOfPages): (qt_drt_evaluateScriptInIsolatedWorld): 2010-02-16 Ariya Hidayat [Qt] Allow scrolling to an anchor programmatically. https://bugs.webkit.org/show_bug.cgi?id=29856 * Api/qwebframe.cpp: (QWebFrame::scrollToAnchor): New API function. * Api/qwebframe.h: * tests/qwebframe/tst_qwebframe.cpp: New tests for scrollToAnchor(). 2010-02-16 Ariya Hidayat Reviewed by Laszlo Gombos. Fix building with Qt < 4.6. https://bugs.webkit.org/show_bug.cgi?id=34885 * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::updateResizesToContentsForPage): 2010-02-16 Simon Hausmann Unreviewed Symbian build fix. Updated the def file with two new exports used by QtLauncher. * symbian/eabi/QtWebKitu.def: 2010-02-16 Ismail Donmez Reviewed by Pavel Feldman. Fix compilation with inspector disabled. https://bugs.webkit.org/show_bug.cgi?id=32724 * Api/qwebpage.cpp: (qt_drt_webinspector_executeScript): (qt_drt_webinspector_close): (qt_drt_webinspector_show): (qt_drt_setTimelineProfilingEnabled): 2010-02-16 Jocelyn Turcotte Reviewed by Simon Hausman. [Qt] Fix include paths for forwarding headers in standalone builds. * Api/DerivedSources.pro: Use relative paths for package builds and added some documentation. 2010-02-15 Noam Rosenthal Reviewed by Simon Hausmann. [Qt] QtWebkit bridge: enable passing a QWebElement to a signal/slot/property Add Q_DECLARE_METATYPE to QWebElement, add relevant tests to tst_qwebframe https://bugs.webkit.org/show_bug.cgi?id=34901 * Api/qwebelement.h: declare metatype * tests/qwebframe/tst_qwebframe.cpp: (MyQObject::webElementProperty): new test for QWebElement (MyQObject::setWebElementProperty): new test for QWebElement (MyQObject::myOverloadedSlot): new test for QWebElement 2010-02-15 Robert Hogan , Jocelyn Turcotte Reviewed by Simon Hausmann. [Qt] DRT: Support evaluateInWebInspector(), setTimelineProfilingEnabled(). Support LayoutTestController.evaluateInWebInspector(), setTimelineProfilingEnabled() in Qt DRT. https://bugs.webkit.org/show_bug.cgi?id=33096 This allows the following tests to pass: inspector/console-format-collections.html inspector/styles-iframe.html inspector/syntax-highlight-css.html inspector/syntax-highlight-javascript.html inspector/timeline-enum-stability.html inspector/timeline-layout.html inspector/timeline-mark-timeline.html inspector/timeline-paint.html inspector/timeline-parse-html.html inspector/timeline-recalculate-styles.html inspector/timeline-script-tag-1.html inspector/timeline-script-tag-2.html inspector/timeline-trivial.html inspector/cookie-resource-match.html inspector/elements-img-tooltip.html inspector/elements-panel-selection-on-refresh.html inspector/inspected-objects-not-overriden.html inspector/timeline-event-dispatch.html inspector/timeline-network-resource.html inspector/elements-panel-rewrite-href.html inspector/console-dir.html inspector/console-dirxml.html inspector/console-format.html inspector/console-tests.html inspector/elements-panel-structure.html inspector/evaluate-in-frontend.html inspector/console-clear.html * Api/qwebpage.cpp: (qt_drt_webinspector_executeScript): (qt_drt_webinspector_close): (qt_drt_webinspector_show): (qt_drt_setTimelineProfilingEnabled): * WebCoreSupport/InspectorClientQt.cpp: (InspectorClientQt::createPage) 2010-02-12 Antti Koivisto Reviewed by Kenneth Rohde Christiansen and Simon Hausmann. https://bugs.webkit.org/show_bug.cgi?id=34885 Add a QGraphicsWebView mode that makes it automatically resize itself to the size of the content. This is useful for cases where the client wants to implement page panning and zooming by manipulating the graphics item. Add a option to QGVLauncher to test this mode. * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): (QGraphicsWebViewPrivate::updateResizesToContentsForPage): (QGraphicsWebViewPrivate::_q_contentsSizeChanged): (QGraphicsWebView::setPage): (QGraphicsWebView::setResizesToContents): (QGraphicsWebView::resizesToContents): * Api/qgraphicswebview.h: * QGVLauncher/main.cpp: (WebView::WebView): (MainView::MainView): (MainView::setMainWidget): (MainView::resizeEvent): (main): 2010-02-12 Diego Gonzalez Reviewed by Kenneth Rohde Christiansen. Qt DRT now dump the frame loader callbacks when LayoutTestController() method is called. LayoutTests: http/tests/security/mixedContent/data-url-script-in-iframe.html http/tests/security/mixedContent/empty-url-plugin-in-frame.html http/tests/security/mixedContent/insecure-css-in-iframe.html http/tests/security/mixedContent/insecure-iframe-in-iframe.html http/tests/security/mixedContent/insecure-image-in-iframe.html http/tests/security/mixedContent/insecure-plugin-in-iframe.html http/tests/security/mixedContent/insecure-script-in-iframe.html http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe.html http/tests/security/mixedContent/redirect-https-to-http-script-in-iframe.html [Qt] Make possible Qt DRT dump frame load callbacks https://bugs.webkit.org/show_bug.cgi?id=34702 * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::didDisplayInsecureContent): (WebCore::FrameLoaderClientQt::didRunInsecureContent): 2010-02-10 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Make qtlauncher and qgvlauncher use the generated headers path to make sure they are correctly generated. * tests/tests.pri: 2010-02-10 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Ensure relative paths in generated .pri files to ensure that a source package with pre-generated derived sources can be compiled. - Re-add a separate headers.pri file for WEBKIT_API_HEADERS - Rename the generated headers.pri to classheaders.pri to avoid confusion with the one generated by synqt since they don't have the same content. - Remove private headers list variable from classheaders.pri - Use $$PWD in classheaders.pri - Remove classheaders.pri from the installed files * Api/DerivedSources.pro: 2010-02-10 Jocelyn Turcotte Reviewed by Tor Arne Vestbø. [Qt] Minor fixes on QtWebKit headers generation. - Adds QtWebKit to the generated headers destination path - Improve compatibility with MinGW * Api/DerivedSources.pro: 2010-02-09 Jocelyn Turcotte Reviewed by nobody, build fix. [Qt] Fix standalone build with MinGW. * tests/qwebelement/tst_qwebelement.cpp: * tests/tests.pri: 2010-02-10 Diego Gonzalez Reviewed by Kenneth Rohde Christiansen. Implement pageNumberForElementById() method in Qt DRT LayoutTestController, to make Qt DRT able to get page number. LayoutTests: printing/page-break-always.html printing/pageNumerForElementById.html printing/css2.1/page-break-before-000.html printing/css2.1/page-break-after-000.html printing/css2.1/page-break-after-004.html printing/css2.1/page-break-before-001.html printing/css2.1/page-break-after-001.html printing/css2.1/page-break-after-002.html printing/css2.1/page-break-before-002.html printing/css2.1/page-break-inside-000.html [Qt] Make possible Qt DRT get a page number for element by ID https://bugs.webkit.org/show_bug.cgi?id=34777 * Api/qwebframe.cpp: (qt_drt_pageNumberForElementById): 2010-02-09 Yael Aharon Reviewed by Adam Barth. [Qt] Unit test for window.runModalDialog https://bugs.webkit.org/show_bug.cgi?id=34755 * tests/qwebpage/tst_qwebpage.cpp: (TestModalPage::TestModalPage): (TestModalPage::createWindow): (tst_QWebPage::showModalDialog): 2010-02-09 Andreas Kling Reviewed by Kenneth Rohde Christiansen. [Qt] Sync with API changes in Maemo 5 kinetic scrolling https://bugs.webkit.org/show_bug.cgi?id=34747 This is a forward-port of http://qt.gitorious.org/+qt-developers/qt/x11-maemo/commit/08497561 * Api/qwebview.cpp: (qt_sendSpontaneousEvent): (QWebViewKineticScroller::QWebViewKineticScroller): (QWebViewKineticScroller::setWidget): (QWebViewKineticScroller::eventFilter): (QWebViewKineticScroller::cancelLeftMouseButtonPress): (QWebViewKineticScroller::currentFrame): (QWebViewKineticScroller::scrollingFrameAt): (QWebViewKineticScroller::maximumScrollPosition): (QWebViewKineticScroller::scrollPosition): (QWebViewKineticScroller::viewportSize): (QWebViewKineticScroller::setScrollPosition): (QWebViewKineticScroller::sendEvent): (QWebView::QWebView): 2010-02-09 Yael Aharon Reviewed by Kenneth Rohde Christiansen. [Qt] Webkit in Qt does not have window.showModalDialog https://bugs.webkit.org/show_bug.cgi?id=25585 Create a new eventloop when runModal() is called. Added comemnt in QWebPage::createWindow that the application is responsible for setting the modality of the appropriate window. * Api/qwebpage.cpp: * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::ChromeClientQt): (WebCore::ChromeClientQt::~ChromeClientQt): (WebCore::ChromeClientQt::canRunModal): (WebCore::ChromeClientQt::runModal): * WebCoreSupport/ChromeClientQt.h: 2010-01-19 Kenneth Rohde Christiansen Reviewed by Dave Hyatt. Implement flattening of framesets https://bugs.webkit.org/show_bug.cgi?id=32717 Privately export the setFrameSetFlatteningEnabled setting for use with the Qt DRT. * Api/qwebpage.cpp: (qt_drt_setFrameSetFlatteningEnabled): (QWebPagePrivate::core): * Api/qwebpage_p.h: 2010-02-05 Tor Arne Vestbø [Qt] Fix build on Windows Reviewed by Kenneth Rohde Christiansen. DerivedSources for our API headers failed on Windows, due to Windows not accepting ; as a command separator, not needing quotes for echo, and needing < and > escaped. We now detect Windows and set these quote markers and escape markers accordingly, as well as use && for separating individual commands. * Api/DerivedSources.pro: 2010-02-05 Yury Semikhatsky Reviewed by Pavel Feldman. Remove unused inmport of ScriptFunctionCall.h https://bugs.webkit.org/show_bug.cgi?id=33592 * Api/qwebelement.cpp: 2010-02-05 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Generate convenience headers (QWebView, etc) using qmake In Qt this is done using syncqt, but we use a pro-file instead that generates makefile-rules for each of the extra headers. These extra headers are installed alongside the normal headers. * Api/DerivedSources.pro: Added. List of headers + pro file magic * Api/headers.pri: Removed, list of headers is now in the above file 2010-02-04 No'am Rosenthal Reviewed by Ariya Hidayat. [Qt] Tuning and optimizations to GraphicsLayerQt. Mainly reduced usage of QTimer::singleShot, and moved syncLayers() from paint() to update() https://bugs.webkit.org/show_bug.cgi?id=34062 * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::update): Moved the sync operation to update (QGraphicsWebView::paint): Moved the sync operation to update 2010-02-03 Andras Becsi Unreviewed build fix. [Qt] Roll-out r54281 because it broke the build on the Qt Release bot. * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): (QGraphicsWebViewPrivate::markForSync): (QGraphicsWebViewPrivate::update): (QGraphicsWebView::paint): 2010-02-02 Kenneth Rohde Christiansen Reviewed by Ariya Hidayat. Do not use a proxy widget for the QComboBox on Maemo 5, as it is not working properly and it is not needed at all, as the comboboxes comes up in their full width on the screen and do not depend on view. (WebCore::QtFallbackWebPopup::show): 2010-02-02 Jessie B. Rubber Stamped by Holger Freyther. [Qt] Fix style issue identified in bug: https://bugs.webkit.org/show_bug.cgi?id=34329 * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientWebPage::InspectorClientWebPage): Fix indentation. 2010-02-01 Jessie B. Reviewed by Holger Freyther. [Qt] Enable inspecting the Web Inspector in QtLauncher https://bugs.webkit.org/show_bug.cgi?id=34329 * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientWebPage::InspectorClientWebPage): Allow the DeveloperExtrasEnabled setting to default to true for the page containing the Web Inspector. 2010-02-02 Andreas Kling Reviewed by Kenneth Rohde Christiansen. [Qt] Display HTML tags verbatim in JS alert/confirm/prompt boxes https://bugs.webkit.org/show_bug.cgi?id=34429 * Api/qwebpage.cpp: (QWebPage::javaScriptAlert): (QWebPage::javaScriptConfirm): (QWebPage::javaScriptPrompt): 2010-02-02 Noam Rosenthal Reviewed by Kenneth Rohde Christiansen. [Qt] Enable a way to measure FPS in QGVLauncher run QGVLauncher with --show-fps to see ongoing fps measurements This is not meant as accurate FPS, but rather as a way to find improvements/regressions https://bugs.webkit.org/show_bug.cgi?id=34450 * QGVLauncher/main.cpp: (MainView::MainView): initialize FPS values (MainView::paintEvent): count a painted frame here (MainView::printFps): we print the fps with qDebug every 5 seconds. 2010-01-29 Ben Murdoch Reviewed by Dimitri Glazkov. [Android] Android needs functionality in the ChromeClient to be informed when touch events are and are not needed by the webpage. https://bugs.webkit.org/show_bug.cgi?id=34215 Add needTouchEvents() to the ChromeClient which is called when the page decides it needs or no longer needs to be informed of touch events. * WebCoreSupport/ChromeClientQt.h: (WebCore::ChromeClientQt::needTouchEvents): Add an empty implementation. 2010-01-29 Kenneth Rohde Christiansen Reviewed by Simon Hausmann Disable auto-uppercase and predictive text on Maemo5, just like the build-in MicroB Browser. * WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::setInputMethodState): 2010-01-28 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Do not set the combobox font on Maemo5 and S60; use the default instead. * WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopup::populate): 2010-01-27 Diego Gonzalez Reviewed by Kenneth Rohde Christiansen. [Qt] DRT Provide worker thread ability to track counters https://bugs.webkit.org/show_bug.cgi?id=34221 Implement workerThreadCount() in LayoutTestController of Qt DRT Tests: fast/workers/dedicated-worker-lifecycle.html fast/workers/shared-worker-frame-lifecycle.html fast/workers/shared-worker-lifecycle.html fast/workers/worker-lifecycle.html * Api/qwebpage.cpp: (qt_drt_workerThreadCount): 2010-01-27 Simon Hausmann Reviewed by Laszlo Gombos. [Qt] Update the .def files with exported symbols * symbian/eabi/QtWebKitu.def: Add two mangled missing new symbols for arm eabi. 2010-01-27 Kent Hansen Reviewed by Simon Hausmann. [Qt] Meta-methods can't be introspected using ES5 API https://bugs.webkit.org/show_bug.cgi?id=34087 Test that Object.getOwnPropertyDescriptor and Object.getOwnPropertyNames work with meta-methods. * tests/qwebframe/tst_qwebframe.cpp: 2010-01-26 Jedrzej Nowacki Reviewed by Simon Hausmann. First steps of the QtScript API. Two new classes were created; QScriptEngine and QScriptValue. The first should encapsulate a javascript context and the second a script value. This API is still in development, so it isn't compiled by default. To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to build-webkit. https://bugs.webkit.org/show_bug.cgi?id=32565 * docs/qtwebkit.qdocconf: 2010-01-25 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] In RenderThemeQt determine the QStyle from the page client instead of the page's view https://bugs.webkit.org/show_bug.cgi?id=34053 * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::style): Implement QWebPageClient::style() and return the graphics widget's style. * Api/qwebpage.cpp: (QWebPageWidgetClient::style): Implement QWebPageClient::style() and return the widget's style. 2010-01-23 Girish Ramakrishnan [Qt] Fix positioning of ComboBox popup in QGraphicsWebView. Wrap the popup in a QGraphicsProxyWidget, so that the popup transforms with the item. https://bugs.webkit.org/show_bug.cgi?id=33887 * WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopupCombo::hidePopup): (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::show): * WebCoreSupport/QtFallbackWebPopup.h: 2010-01-22 Peter Kasting Not reviewed, backout. Back out r52673, which caused several regressions. https://bugs.webkit.org/show_bug.cgi?id=32533 * WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopupCombo::hidePopup): 2010-01-22 Girish Ramakrishnan Reviewed by Simon Hausmann. [Qt] Save the QWebPageClient instead of the ownerWidget in QtAbstractWebPopup The QWebPageClient is required for the QtFallbackWebPopup. QtFallbackWebPopup will need it to create a QGraphicsProxyWidget (in a future commit) for the QGraphicsWebView's web popup. * WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopup::show): 2010-01-22 Girish Ramakrishnan Reviewed by Kenneth Rohde Christiansen. QState::polished() was renamed to QState::propertiesAssigned() when Qt 4.6.0 was released. * QGVLauncher/main.cpp: (MainWindow::init): 2010-01-21 Diego Gonzalez Reviewed by Kenneth Rohde Christiansen. [Qt] add setDomainRelaxationForbiddenForURLScheme in Qt DRT https://bugs.webkit.org/show_bug.cgi?id=33945 * Api/qwebsecurityorigin.cpp: (qt_drt_setDomainRelaxationForbiddenForURLScheme): 2010-01-21 No'am Rosenthal Reviewed by Antti Koivisto. [Qt] Implement GraphicsLayer for accelerated layer compositing https://bugs.webkit.org/show_bug.cgi?id=33514 Here we have the QGraphicsWebView support for accelerated compositing * Api/qgraphicswebview.cpp: (QGraphicsWebViewOverlay::q): access to container object (QGraphicsWebViewOverlay::boundingRect): overlay has same rect as the webview (QGraphicsWebViewOverlay::paint): paint everything but the contents (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): some vars needed for accelerated compositing (QGraphicsWebViewPrivate::): (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate): (QGraphicsWebViewPrivate::setRootGraphicsLayer): make sure we have a scrollbar overlay, and that the new graphics layer is parented by the web-view (QGraphicsWebViewPrivate::markForSync): flush changes at earliest convenience or during the next draw (QGraphicsWebViewPrivate::updateCompositingScrollPosition): sync the position of the compositing layer with the scroll position (QGraphicsWebViewPrivate::syncLayers): flush changes now (QGraphicsWebViewPrivate::scroll): make sure we also move the compositing layer (QGraphicsWebViewPrivate::update): also update the overlay if needed (QGraphicsWebView::QGraphicsWebView): initialize overlay with 0 (QGraphicsWebView::paint): paint only contents if we have an overlay, sync the compositing layers now if needed (QGraphicsWebView::setPage): also clean up the compositing (QGraphicsWebView::updateGeometry): also update overlay geo (QGraphicsWebView::setGeometry): also update overlay geo * Api/qgraphicswebview.h: reimp compositing stuff from QWebPageClient * Api/qwebsettings.cpp: init new settings flag for compositing as false (QWebSettingsPrivate::apply): apply new settings flag for compositing (QWebSettings::QWebSettings): * Api/qwebsettings.h: new settings flag for compositing * Api/qwebview.cpp: (QWebView::setPage): qwebview doesn't support compositing: always false * QGVLauncher/main.cpp: (WebView::WebView): some more cmdline arguments + compositing (MainWindow::init): some more cmdline arguments (main): ditto * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::attachRootGraphicsLayer): reimp for accel-compositing (WebCore::ChromeClientQt::setNeedsOneShotDrawingSynchronization): reimp for accel compositing (WebCore::ChromeClientQt::scheduleCompositingLayerSync): reimp for accel compositing * WebCoreSupport/ChromeClientQt.h: reimps for accel compositing 2010-01-21 Benjamin Poulain Reviewed by Simon Hausmann. [Qt] Improve the autotests of QtWebkit https://bugs.webkit.org/show_bug.cgi?id=32216 Remove qWait() of the test when possible. * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::loadFinished): (tst_QWebPage::database): (tst_QWebPage::testEnablePersistentStorage): (tst_QWebPage::errorPageExtension): (tst_QWebPage::screenshot): 2010-01-21 Simon Hausmann Prospective build fix for the Qt build. Fix compilation against Qt without WebKit support by not including QtWebKit/QWebView but widget.h instead and instantiating QWebView through a typedef, to ensure we're using our locally built WebKit. * tests/hybridPixmap/widget.h: * tests/hybridPixmap/widget.ui: 2010-01-21 No'am Rosenthal Reviewed by Simon Hausmann. [Qt] Adding QPixmap/QImage support for the Qt hybrid layer https://bugs.webkit.org/show_bug.cgi?id=32461 * tests/hybridPixmap: Added. * tests/hybridPixmap/hybridPixmap.pro: Added. * tests/hybridPixmap/resources.qrc: Added. * tests/hybridPixmap/test.html: Added. * tests/hybridPixmap/tst_hybridPixmap.cpp: Added. (tst_hybridPixmap::tst_hybridPixmap): tests most of the use cases for hybrid pixmap/image manipulation (tst_hybridPixmap::init): QTestLib initialization (tst_hybridPixmap::cleanup): QTestLib cleanup (tst_hybridPixmap::hybridPixmap): run the html file * tests/hybridPixmap/widget.cpp: Added. (Widget::Widget): (Widget::refreshJS): (Widget::start): (Widget::completeTest): (Widget::setPixmap): (Widget::pixmap): (Widget::setImage): (Widget::image): (Widget::~Widget): (Widget::changeEvent): (Widget::compare): (Widget::imageSlot): (Widget::pixmapSlot): (Widget::randomSlot): * tests/hybridPixmap/widget.h: Added. * tests/hybridPixmap/widget.ui: Added. * tests/tests.pro: 2010-01-21 Luiz Agostini Reviewed by Kenneth Rohde Christiansen. [Qt] Custom select popups. https://bugs.webkit.org/show_bug.cgi?id=33418 Adjusting QtFallbackWebPopupCombo to the changes in WebCore layer. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::createSelectPopup): * WebCoreSupport/ChromeClientQt.h: * WebCoreSupport/QtFallbackWebPopup.cpp: (WebCore::QtFallbackWebPopupCombo::QtFallbackWebPopupCombo): (WebCore::QtFallbackWebPopupCombo::showPopup): (WebCore::QtFallbackWebPopupCombo::hidePopup): (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::~QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::show): (WebCore::QtFallbackWebPopup::hide): (WebCore::QtFallbackWebPopup::populate): * WebCoreSupport/QtFallbackWebPopup.h: 2010-01-19 Steve Block Reviewed by Adam Barth. Renames WebCore/bridge/runtime.[cpp|h] to WebCore/bridge/Bridge.[cpp|h] https://bugs.webkit.org/show_bug.cgi?id=33801 * Api/qwebframe.cpp: 2010-01-14 Brian Weinstein Reviewed by Adam Roben. Drag and Drop source/destination code needs cleanup. . Update to new way of calling sourceOperation. * WebCoreSupport/DragClientQt.cpp: (WebCore::DragClientQt::startDrag): 2010-01-14 Simon Hausmann Reviewed by Tor Arne Vestbø. [Qt] Symbian build fixes. * tests/qwebpage/tst_qwebpage.cpp: Include util.h * tests/tests.pri: Don't define TESTS_SOURCE_DIR, it doesn't work. * tests/util.h: Define TESTS_SOURCE_DIR here, just like it's done in Qt. 2010-01-13 Darin Adler Reviewed by Dan Bernstein. Move more of the selection and caret painting code from Frame to SelectionController. https://bugs.webkit.org/show_bug.cgi?id=33619 * Api/qwebpage.cpp: (QWebPagePrivate::inputMethodEvent): Seems possibly wrong to be directly invoking this setCaretVisible here, but I updated it to call it in its new location. 2010-01-11 Simon Hausmann Reviewed by Holger Freyther. [Qt] Add private API for QWebFrame scrolling, to maintain binary compatibility with Qt 4.6. This is just a temporary addition until we have introduced #ifdefs to allow safely removing the private API again. (qtwebkit_webframe_scrollRecursively): 2010-01-10 Robert Hogan Reviewed by Adam Barth. [Qt] Add enableXSSAuditor support to QWebSettings and DRT. https://bugs.webkit.org/show_bug.cgi?id=33419 * Api/qwebsettings.cpp: (QWebSettingsPrivate::apply): * Api/qwebsettings.h: 2010-01-09 Daniel Bates No review, rolling out r53044. http://trac.webkit.org/changeset/53044 https://bugs.webkit.org/show_bug.cgi?id=33419 We need to look into this some more because the Qt bot is failing the XSSAuditor tests. See bug #33419 for more details. * Api/qwebsettings.cpp: * Api/qwebsettings.h: 2010-01-09 Daniel Bates Reviewed by Adam Barth. https://bugs.webkit.org/show_bug.cgi?id=33419 Adds support for the XSSAuditor to the Qt DRT. * Api/qwebsettings.cpp: Updated comment to reflect added key XSSAuditorEnabled. * Api/qwebsettings.h: Adds settings key XSSAuditorEnabled. 2010-01-08 Luiz Agostini Reviewed by Kenneth Rohde Christiansen. [Qt] Delegation client https://bugs.webkit.org/show_bug.cgi?id=32826 Added method createPopup to ChromeClientQt used to create popups. QtFallbackWebPopup moved from WebCore/platform/qt to WebKit/qt/WebCoreSupport. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::createPopup): * WebCoreSupport/ChromeClientQt.h: * WebCoreSupport/QtFallbackWebPopup.cpp: Added. (WebCore::QtFallbackWebPopup::QtFallbackWebPopup): (WebCore::QtFallbackWebPopup::show): (WebCore::QtFallbackWebPopup::populate): (WebCore::QtFallbackWebPopup::showPopup): (WebCore::QtFallbackWebPopup::hidePopup): (WebCore::QtFallbackWebPopup::activeChanged): (WebCore::QtFallbackWebPopup::setParent): * WebCoreSupport/QtFallbackWebPopup.h: Added. (WebCore::QtFallbackWebPopup::hide): 2010-01-06 Andreas Kling Reviewed by Simon Hausmann. [Qt] Return an invalid Qt::ImMicroFocus if queried while the view needs to layout. https://bugs.webkit.org/show_bug.cgi?id=33204 * Api/qwebpage.cpp: (QWebPage::inputMethodQuery): 2010-01-05 Yael Aharon Reviewed by Kenneth Rohde Christiansen. Drag & drop layout tests fail even when run manually https://bugs.webkit.org/show_bug.cgi?id=33055 No new tests. Fix 3 layout tests when run manually. fast/events/drag-and-drop.html fast/events/drag-and-drop-dataTransfer-types-nocrash.html fast/events/drag-and-drop-fire-drag-dragover.html Running these tests in DRT will be fixed in 31332. * Api/qwebpage.cpp: (dropActionToDragOp): (dragOpToDropAction): (QWebPagePrivate::dragEnterEvent): (QWebPagePrivate::dragMoveEvent): (QWebPagePrivate::dropEvent): Accept drag events even if they are not over a drop target. This is to ensure that drag events will continue to be delivered. * Api/qwebpage_p.h: * WebCoreSupport/DragClientQt.cpp: (WebCore::dragOperationToDropActions): (WebCore::dropActionToDragOperation): (WebCore::DragClientQt::startDrag): Send dragEnd event. 2010-01-04 Daniel Bates Reviewed by Eric Seidel. https://bugs.webkit.org/show_bug.cgi?id=33097 Cleans up the File menu to better conform to the File menu in Safari both in terms of options and keyboard shortcuts. Adds a "Quit" menu options to close all open windows. * QGVLauncher/main.cpp: (MainWindow::buildUI): 2009-12-31 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Enable all HTML5 persistent features for QGVLauncher https://bugs.webkit.org/show_bug.cgi?id=33086 * QGVLauncher/main.cpp: Call enablePersistentStorage() (main): 2009-12-30 Laszlo Gombos Reviewed by Simon Hausmann. [Qt] It should be possible to disable inspector https://bugs.webkit.org/show_bug.cgi?id=32724 This change fixes the build break. Some QtWebKit interfaces will not be fully functional (most notable QWebInspector) if INSPECTOR is disabled. * Api/qwebinspector.cpp: (QWebInspector::showEvent): (QWebInspector::closeEvent): * Api/qwebpage.cpp: (webActionForContextMenuAction): (QWebPagePrivate::getOrCreateInspector): (QWebPagePrivate::inspectorController): (QWebPage::triggerAction): (QWebPage::updatePositionDependentActions): * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::showWindow): (WebCore::InspectorClientQt::closeWindow): 2009-12-29 Daniel Bates Reviewed by Ariya Hidayat. https://bugs.webkit.org/show_bug.cgi?id=32925 Adds an Open File dialog to make it convenient to open a file to view in the browser. * QGVLauncher/main.cpp: (MainWindow::load): Modified to call loadURL. (MainWindow::openFile): Added. (MainWindow::loadURL): Added. (MainWindow::buildUI): Added menu item Open File. 2009-12-29 Robert Hogan Reviewed by Eric Seidel. [Qt] Fix crash on LayoutTests/fast/loader/empty-embed-src-attribute.html Related to https://bugs.webkit.org/show_bug.cgi?id=23806 If an embedded document is loaded within a page and it has an empty URL, use a blank URL for the load request. https://bugs.webkit.org/show_bug.cgi?id=33017 * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createFrame): 2009-12-29 Laszlo Gombos Rubber-stamped by Simon Hausmann and Holger Freyther. [Qt] Remove WebKit/qt/WebKitPart empty directory The content of the directory has been removed by r34888. * WebKitPart: Removed. 2009-12-29 Jakub Wieczorek Reviewed by Eric Seidel. [Qt] DRT: Frame loader callbacks differ from the Mac port https://bugs.webkit.org/show_bug.cgi?id=32989 Remove messages from the callbacks that should not dump them to match the expected results for the http/loading tests. Unskip some http/loading tests which succeed now. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::dispatchDidPopStateWithinPage): (WebCore::FrameLoaderClientQt::dispatchWillClose): (WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon): (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld): 2009-12-29 Robert Hogan Reviewed by Eric Seidel. [Qt] fix fast/dom/Window/window-onFocus.html Add support for layouttestcontroller.windowIsKey to Qt DRT and fix issue where window.onblur was getting dispatched twice from QtWebKit. https://bugs.webkit.org/show_bug.cgi?id=32990 * Api/qwebpage.cpp: (QWebPagePrivate::focusOutEvent): 2009-12-24 Girish Ramakrishnan Reviewed by Gustavo Noronha. Doc : QGraphicsWebView::zoomFactor was introduced in 4.6. * Api/qgraphicswebview.cpp: 2009-12-22 Simon Hausmann Rubber-stamped by Holger Freyther. Moved QtLauncher to WebKitTools/ * QtLauncher: Removed. * QtLauncher/QtLauncher.pro: Removed. * QtLauncher/main.cpp: Removed. 2009-12-21 David Boddie Reviewed by Simon Hausmann. Doc: Minor fixes to language. * Api/qwebpage.cpp: 2009-12-21 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Clean up the WebKit layer unit-tests - Use tests.pri for common options - Standardize file naming - Move all resources to 'resources' subdir - Standardize how TESTS_SOURCE_DIR is used - Get rid of UID3 for symbian (autogenerated) - Don't build app bundles on Mac OS X * tests/benchmarks/loading/loading.pro: Added. * tests/benchmarks/loading/tst_loading.pro: Removed. * tests/benchmarks/painting/painting.pro: Added. * tests/benchmarks/painting/tst_painting.pro: Removed. * tests/qgraphicswebview/qgraphicswebview.pro: * tests/qwebelement/qwebelement.pro: * tests/qwebelement/qwebelement.qrc: Removed. * tests/qwebelement/resources/image.png: Renamed from WebKit/qt/tests/qwebelement/image.png. * tests/qwebelement/resources/style.css: Renamed from WebKit/qt/tests/qwebelement/style.css. * tests/qwebelement/resources/style2.css: Renamed from WebKit/qt/tests/qwebelement/style2.css. * tests/qwebelement/tst_qwebelement.qrc: Added. * tests/qwebframe/qwebframe.pro: * tests/qwebframe/qwebframe.qrc: Removed. * tests/qwebframe/resources/image.png: Renamed from WebKit/qt/tests/qwebframe/image.png. * tests/qwebframe/resources/style.css: Renamed from WebKit/qt/tests/qwebframe/style.css. * tests/qwebframe/resources/test1.html: Renamed from WebKit/qt/tests/qwebframe/test1.html. * tests/qwebframe/resources/test2.html: Renamed from WebKit/qt/tests/qwebframe/test2.html. * tests/qwebframe/resources/testiframe.html: Renamed from WebKit/qt/tests/qwebframe/testiframe.html. * tests/qwebframe/resources/testiframe2.html: Renamed from WebKit/qt/tests/qwebframe/testiframe2.html. * tests/qwebframe/tst_qwebframe.cpp: * tests/qwebframe/tst_qwebframe.qrc: Added. * tests/qwebhistory/qwebhistory.pro: * tests/qwebhistory/resources/page1.html: Renamed from WebKit/qt/tests/qwebhistory/data/page1.html. * tests/qwebhistory/resources/page2.html: Renamed from WebKit/qt/tests/qwebhistory/data/page2.html. * tests/qwebhistory/resources/page3.html: Renamed from WebKit/qt/tests/qwebhistory/data/page3.html. * tests/qwebhistory/resources/page4.html: Renamed from WebKit/qt/tests/qwebhistory/data/page4.html. * tests/qwebhistory/resources/page5.html: Renamed from WebKit/qt/tests/qwebhistory/data/page5.html. * tests/qwebhistory/resources/page6.html: Renamed from WebKit/qt/tests/qwebhistory/data/page6.html. * tests/qwebhistory/tst_qwebhistory.cpp: (tst_QWebHistory::): * tests/qwebhistory/tst_qwebhistory.qrc: * tests/qwebhistoryinterface/qwebhistoryinterface.pro: * tests/qwebinspector/qwebinspector.pro: * tests/qwebpage/qwebpage.pro: * tests/qwebpage/resources/frame_a.html: Renamed from WebKit/qt/tests/qwebpage/frametest/frame_a.html. * tests/qwebpage/resources/iframe.html: Renamed from WebKit/qt/tests/qwebpage/frametest/iframe.html. * tests/qwebpage/resources/iframe2.html: Renamed from WebKit/qt/tests/qwebpage/frametest/iframe2.html. * tests/qwebpage/resources/iframe3.html: Renamed from WebKit/qt/tests/qwebpage/frametest/iframe3.html. * tests/qwebpage/resources/index.html: Renamed from WebKit/qt/tests/qwebpage/frametest/index.html. * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::backActionUpdate): (tst_QWebPage::frameAt): (tst_QWebPage::errorPageExtensionInFrameset): (tst_QWebPage::screenshot): * tests/qwebpage/tst_qwebpage.qrc: * tests/qwebplugindatabase/qwebplugindatabase.pro: * tests/qwebview/qwebview.pro: * tests/qwebview/resources/frame_a.html: Renamed from WebKit/qt/tests/qwebview/data/frame_a.html. * tests/qwebview/resources/index.html: Renamed from WebKit/qt/tests/qwebview/data/index.html. * tests/qwebview/tst_qwebview.cpp: (tst_QWebView::reusePage): (tst_QWebView::crashTests): * tests/qwebview/tst_qwebview.qrc: * tests/resources/image2.png: Renamed from WebKit/qt/tests/qwebframe/resources/image2.png. * tests/tests.pri: Added. * tests/tests.pro: 2009-12-18 Ariya Hidayat Build fix, not reviewed. * QtLauncher/main.cpp: (MainWindow::setTouchMocking): Leave setTouchMocking as an empty function for Qt < 4.6 so that moc still creates a slot for that. Otherwise, it would have generated a linker error. 2009-12-18 Adam Roben Qt build fix * Api/qwebpage.cpp: Added #include. 2009-12-18 Adam Roben Qt build fix * Api/qwebpage.cpp: Added #includes. 2009-12-18 Joe Ligman Reviewed by Kenneth Rohde Christiansen. [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow then checking current frame and then ancestors https://bugs.webkit.org/show_bug.cgi?id=32668 * Api/qwebframe.cpp: (QWebFramePrivate::scrollOverflow): (QWebFrame::scrollRecursively): * Api/qwebframe.h: * Api/qwebframe_p.h: * tests/qwebframe/qwebframe.qrc: * tests/qwebframe/testiframe.html: Added. * tests/qwebframe/testiframe2.html: Added. * tests/qwebframe/tst_qwebframe.cpp: 2009-12-18 Simon Hausmann Reviewed by Tor Arne Vestbø. [Qt] Fix infinite recursion in touch mocking. Don't send the fake touch events to the view, as that'll trigger the event filter again. * QtLauncher/main.cpp: (MainWindow::sendTouchEvent): 2009-12-17 Benjamin Poulain Reviewed by Simon Hausmann. [Qt] Add support for mocking touch events with Q(GV)Launcher https://bugs.webkit.org/show_bug.cgi?id=32434 The event delivery should go through QCoreApplication::sendEvent() * QtLauncher/main.cpp: (MainWindow::sendTouchEvent): 2009-12-17 Kim Grönholm Reviewed by Simon Hausmann. [Qt] Add support for touch events in QWebView and QGraphicsWebView https://bugs.webkit.org/show_bug.cgi?id=32432 * Api/qgraphicswebview.cpp: (QGraphicsWebView::QGraphicsWebView): (QGraphicsWebView::sceneEvent): * Api/qwebview.cpp: (QWebView::QWebView): (QWebView::event): 2009-12-17 Kim Grönholm Reviewed by Simon Hausmann. [Qt] Add support for mocking touch events with QtLauncher https://bugs.webkit.org/show_bug.cgi?id=32434 * QtLauncher/main.cpp: (MainWindow::MainWindow): (MainWindow::sendTouchEvent): (MainWindow::eventFilter): (MainWindow::setTouchMocking): (MainWindow::setupUI): 2009-11-24 Holger Hans Peter Freyther (QWebInspector::closeEvent): * Api/qwebinspector.h: 2009-12-14 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. [Qt] Improve the autotests of QtWebkit https://bugs.webkit.org/show_bug.cgi?id=32216 Refactor tst_qwebelement to remove the qWait() * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::style): 2009-12-14 Andreas Kling Reviewed by Simon Hausmann. Fix the QWebPage inputMethods() autotest after r51758 to compare the Qt::ImFont property's family against an explicitly previously configured family. https://bugs.webkit.org/show_bug.cgi?id=32491 * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): 2009-12-13 Sam Weinig Reviewed by Dan Bernstein. Fix for https://bugs.webkit.org/show_bug.cgi?id=32499 Add client based Geolocation provider Add first cut of a client based Geolocation provider. This is guarded by ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a GeolocationControllerClient interface that no-one currently implements, but will in a subsequent patch. * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): 2009-12-13 Benjamin Poulain Reviewed by Simon Hausmann. Add a test in Qt for https://bugs.webkit.org/show_bug.cgi?id=29005 https://bugs.webkit.org/show_bug.cgi?id=29008 * tests/qwebframe/tst_qwebframe.cpp: 2009-12-11 Yael Aharon Unreviewed build fix for Qt versions < 4.6. * tests/qwebframe/tst_qwebframe.cpp: * tests/qwebview/tst_qwebview.cpp: (tst_QWebView::reusePage): 2009-12-11 Girish Ramakrishnan Reviewed by Tor Arne Vestbø. [Qt] Updated QWebElement documentation findAll() returns a QWebElementCollection, not QList. * docs/webkitsnippets/webelement/main.cpp: (findAll): 2009-12-11 Simon Hausmann , Kim Grönholm Reviewed by Antti Koivisto. Forward Qt touch events to the event handler as platform touch events. https://bugs.webkit.org/show_bug.cgi?id=32114 * Api/qwebpage.cpp: (QWebPagePrivate::touchEvent): (QWebPage::event): * Api/qwebpage_p.h: 2009-12-07 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. [Qt] Improve the autotests of QtWebkit https://bugs.webkit.org/show_bug.cgi?id=32216 Remove the calls to qWait() of the autotest of QWebView * tests/qwebview/tst_qwebview.cpp: (tst_QWebView::reusePage): 2009-12-07 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. [Qt] Improve the autotests of QtWebkit https://bugs.webkit.org/show_bug.cgi?id=32216 Refactor tst_qwebframe to remove qWait() and use the function waitForSignal() from util.h * tests/qwebframe/tst_qwebframe.cpp: 2009-12-07 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. [Qt] Improve the autotests of QtWebkit https://bugs.webkit.org/show_bug.cgi?id=32216 Refactor the test of QGraphicsWebView: -make waitForSignal() available to all the tests. -remove QTest::qWait() * tests/qgraphicswebview/tst_qgraphicswebview.cpp: (tst_QGraphicsWebView::crashOnViewlessWebPages): * tests/util.h: (waitForSignal): 2009-12-07 Girish Ramakrishnan Reviewed by Simon Hausmann. [Qt] Plugins: Force windowless mode when there is no native window handle Inject wmode=opaque while instantiating the plugin for the case when the webpage is not backed by a native window handle. https://bugs.webkit.org/show_bug.cgi?id=32059 * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createPlugin): 2009-12-04 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Corrects QtLauncher style * QtLauncher/main.cpp: (WebPage::acceptNavigationRequest): (MainWindow::MainWindow): (MainWindow::webPage): (MainWindow::webView): (MainWindow::changeLocation): (MainWindow::loadFinished): (MainWindow::showLinkHover): (MainWindow::zoomIn): (MainWindow::zoomOut): (MainWindow::print): (MainWindow::setEditable): (MainWindow::dumpHtml): (MainWindow::selectElements): (MainWindow::newWindow): (MainWindow::setupUI): (WebPage::createWindow): (WebPage::createPlugin): (main): 2009-12-04 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] QtLauncher: add a menu to show or hide the web inspector. https://bugs.webkit.org/show_bug.cgi?id=32149 * QtLauncher/main.cpp: (WebInspector::WebInspector): (WebInspector::showEvent): (WebInspector::hideEvent): (MainWindow::MainWindow): (MainWindow::setupUI): 2009-12-04 Kenneth Rohde Christiansen Reviewed by Antti Koivisto. Split out the renderPrivate in two methods, one for working on relative coordinates (relative to the viewport) and one for working on absolute coordinates. The latter is more effecient for implementing tiling, as you don't need translate the coords, and because it avoid clipping to the viewport. No behaviour changes, so no new tests. * Api/qwebframe.cpp: (QWebFramePrivate::renderContentsLayerAbsoluteCoords): (QWebFramePrivate::renderRelativeCoords): (QWebFrame::render): * Api/qwebframe_p.h: 2009-12-04 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Allow removing 'qrc' as a local security origin scheme * tests/qwebpage/tst_qwebpage.cpp: 2009-12-04 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Clean up argument parsing in the QtLauncher * QtLauncher/main.cpp: 2009-12-04 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Prevent the inspector from closing its wrapping widget. This is not necessary anymore since we now hide the embedded close button. https://bugs.webkit.org/show_bug.cgi?id=32149 * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::showWindow): (WebCore::InspectorClientQt::closeWindow): 2009-12-03 İsmail Dönmez Reviewed by Eric Seidel. Fix compilation when SVG is disabled. * Api/qwebframe.cpp: (qt_drt_pauseSVGAnimation): 2009-12-03 Brady Eidson Reviewed by Sam Weinig. and http://webkit.org/b/32052 - Implement HTML5 state object history API * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::dispatchDidPushStateWithinPage): (WebCore::FrameLoaderClientQt::dispatchDidReplaceStateWithinPage): (WebCore::FrameLoaderClientQt::dispatchDidPopStateWithinPage): * WebCoreSupport/FrameLoaderClientQt.h: 2009-12-03 Pavel Feldman Reviewed by Timothy Hatcher. Web Inspector: Simplify the settings support in inspector controller. https://bugs.webkit.org/show_bug.cgi?id=32076 * WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::populateSetting): (WebCore::InspectorClientQt::storeSetting): (WebCore::variantToSetting): (WebCore::settingToVariant): * WebCoreSupport/InspectorClientQt.h: 2009-12-03 Ben Murdoch Reviewed by Brady Eidson. [Android] The FrameLoaderClient is unaware of BackForwardList changes. https://bugs.webkit.org/show_bug.cgi?id=31914 * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::dispatchDidAddBackForwardItem): Add an empty implementation. Method added to FrameLoaderClient by Android (see bug). (WebCore::FrameLoaderClientQt::dispatchDidRemoveBackForwardItem): ditto. (WebCore::FrameLoaderClientQt::dispatchDidChangeBackForwardIndex): ditto. * WebCoreSupport/FrameLoaderClientQt.h: 2009-12-01 Nikolas Zimmermann Not reviewed. Try to fix Qt build. * Api/qwebframe.cpp: (qt_drt_pauseSVGAnimation): 2009-12-01 Nikolas Zimmermann Reviewed by Simon Fraser. Add SVG animation test framework with 'snapshot' functionality https://bugs.webkit.org/show_bug.cgi?id=31897 Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method, forwarding the call to SVGDocumentExtensions, if SVG is enabled. Implemented just like the existing pauseAnimation* methods for CSS animations. * Api/qwebframe.cpp: (qt_drt_pauseSVGAnimation): 2009-12-01 Daniel Bates Reviewed by Kenneth Rohde Christiansen. https://bugs.webkit.org/show_bug.cgi?id=31898 Makes QtLauncher default to the http scheme for URLs. * QtLauncher/main.cpp: (MainWindow::MainWindow): (MainWindow::changeLocation): (main): 2009-11-30 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Fix minor waning in QtWebKit https://bugs.webkit.org/show_bug.cgi?id=31963 * tests/qwebpage/tst_qwebpage.cpp: (ErrorPage::extension): Remove info wariable as it is not used. 2009-11-26 Simon Hausmann Rubber-stamped by Holger Freyther. Removed unused ICO image plugin handler. * Plugins/ICOHandler.cpp: Removed. * Plugins/ICOHandler.h: Removed. * Plugins/Plugins.pro: Removed. 2009-11-12 Holger Hans Peter Freyther Reviewed by Kenneth Rohde Christiansen. [Qt] Do not show the QWidget when the WebCore::Widget is hidden https://bugs.webkit.org/show_bug.cgi?id=31203 The clipping code was making a QWidget visible even if the WebCore::Widget was hidden. Fix the bug by calling setVisible only if the WebCore::Widget Widget::isSelfVisible. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::QtPluginWidget::show): Override WebCore::Widget::show to call handleVisibility (WebCore::QtPluginWidget::handleVisibility): New method to call setVisible when we are visible (FrameLoaderClientQt::createPlugin): Hide the QWidget by default 2009-11-19 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Add instantiation tests for QWebInspector. * tests/qwebinspector/qwebinspector.pro: Added. * tests/qwebinspector/tst_qwebinspector.cpp: Added. (tst_QWebInspector::attachAndDestroy): * tests/tests.pro: 2009-11-19 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Fix QWebInspector destruction problem. https://bugs.webkit.org/show_bug.cgi?id=31664 * Api/qwebpage.cpp: (QWebPage::~QWebPage): 2009-11-18 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Remove support for Qt v4.3 or older versions https://bugs.webkit.org/show_bug.cgi?id=29469 * Api/qcookiejar.cpp: Removed. * Api/qcookiejar.h: Removed. * Api/qgraphicswebview.cpp: (QGraphicsWebView::event): * Api/qwebframe.cpp: (QWebFrame::load): * Api/qwebframe.h: * Api/qwebkitglobal.h: * Api/qwebnetworkinterface.cpp: Removed. * Api/qwebnetworkinterface.h: Removed. * Api/qwebnetworkinterface_p.h: Removed. * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): (QWebPagePrivate::acceptNavigationRequest): (QWebPage::acceptNavigationRequest): (QWebPage::action): (QWebPage::userAgentForUrl): * Api/qwebpage.h: * Api/qwebpage_p.h: * Api/qwebview.cpp: (QWebView::load): (QWebView::event): * Api/qwebview.h: * QtLauncher/main.cpp: (MainWindow::print): (MainWindow::setupUI): (main): * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::download): (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): (WebCore::FrameLoaderClientQt::startDownload): (WebCore::FrameLoaderClientQt::createPlugin): 2009-11-18 Shu Chang Reviewed by Eric Seidel. [Qt] Add support for displaying deleteButton. https://bugs.webkit.org/show_bug.cgi?id=31560 Test: LayoutTests/editing/deleting/5408255.html * Api/qwebsettings.cpp: (graphics): * Api/qwebsettings.h: 2009-11-18 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Add QtLauncher support for opening links in the default browser This can be triggered by either the context menu or by clicking a link while holding down the Alt key. Opening a link in a new windows is triggered by holding down Shift. * QtLauncher/main.cpp: 2009-11-17 Yael Aharon Reviewed by Kenneth Rohde Christiansen. [Qt] QGLLauncher does not support drag&drop of local files https://bugs.webkit.org/show_bug.cgi?id=31057 Enable accepting files in QGraphicsWebView. * Api/qgraphicswebview.cpp: (QGraphicsWebView::QGraphicsWebView): (QGraphicsWebView::dragEnterEvent): 2009-11-17 Antonio Gomes Reviewed by Kenneth Christiansen. [Qt] better test coverage for ErrorPageExtension https://bugs.webkit.org/show_bug.cgi?id=31583 Improved the coverage of current ErrorPageExtension tests by adding autotests involving frameset and iframes. (ErrorPage::extension): Make the ErrorPageExtension to work for all frames, not only the main frame. (tst_QWebPage::errorPageExtension): Stop using the 'frameset.html' resouce in this method since an autotest specific for frameset's is being added. (tst_QWebPage::errorPageExtensionInIFrames): Added. (tst_QWebPage::errorPageExtensionInFrameset): Added. 2009-11-13 Adam Roben Update for changes to FrameLoaderClient Fixes Tell the WebFrameLoadDelegate when window objects in isolated worlds are cleared Reviewed by Dave Hyatt. (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld): * WebCoreSupport/FrameLoaderClientQt.h: Replaced windowObjectCleared with this function. Does nothing if the passed-in world is not the mainThreadNormalWorld(). 2009-11-13 Jocelyn Turcotte Reviewed by Kenneth Rohde Christiansen. [Qt] Fix initial QWebView focus behavior. focusController->setFocused(true) was not always called. https://bugs.webkit.org/show_bug.cgi?id=31466 * Api/qwebpage.cpp: (QWebPagePrivate::focusInEvent): 2009-11-12 Shinichiro Hamaji Reviewed by Darin Adler. externalRepresentation should take Frame as the argument https://bugs.webkit.org/show_bug.cgi?id=31393 No new tests as this is just a refactoring. * Api/qwebframe.cpp: (QWebFrame::renderTreeDump): 2009-11-12 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. Custom printing shrink factors https://bugs.webkit.org/show_bug.cgi?id=29042 This reverts commit r49769. The public API for this needs to be reviewed before its inclusion in Qt. * Api/qwebsettings.cpp: (QWebSettingsPrivate::apply): (QWebSettings::QWebSettings): * Api/qwebsettings.h: 2009-11-11 Kenneth Rohde Christiansen Unreviewed buildbot fix. Export a method to the DRT to know if the document has a document element. (qt_drt_hasDocumentElement): 2009-11-11 Liang QI 2009-11-11 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. https://bugs.webkit.org/show_bug.cgi?id=31323 Fix a few compiler warnings * tests/qwebframe/tst_qwebframe.cpp: Add extra brackets to make it explicit where the else case belongs 2009-11-11 Simon Hausmann Reviewed by Tor Arne Vestbø. Fix enabling of software input panel when activating editable elements in QGraphicsWebView. * Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::inputMethodEnabled): Implement method to query for input method support. * Api/qwebpage.cpp: (QWebPageWidgetClient::inputMethodEnabled): Ditto for QWidget. (QWebPagePrivate::handleSoftwareInputPanel): Don't use view() to test for input method support. Instead query using QWebPageClient and send the SIPR event to the ownerWidget() instead of the view(). The latter is null for QGraphicsWebView. * tests/qwebpage/tst_qwebpage.cpp: (EventSpy::EventSpy): (EventSpy::eventFilter): (tst_QWebPage::inputMethods): Modify the test to verify that SIPR events are dispatched when activating focusable content. 2009-11-09 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. [Qt] Few classes have virtual functions but non-virtual destructor https://bugs.webkit.org/show_bug.cgi?id=31269 (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate): Add virtual destructor. 2009-11-09 Benjamin Poulain Reviewed by Kenneth Rohde Christiansen. https://bugs.webkit.org/show_bug.cgi?id=30628 Add an API to get all the attributes from a QWebElement. * Api/qwebelement.cpp: (QWebElement::attributesName): * Api/qwebelement.h: * tests/qwebelement/tst_qwebelement.cpp: (tst_QWebElement::listAttributes): 2009-11-09 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. Use explicit parentheses to silence gcc 4.4 -Wparentheses warnings https://bugs.webkit.org/show_bug.cgi?id=31040 (QWebPagePrivate::handleScrolling): 2009-11-09 Mark Mentovai Reviewed by Dan Bernstein. Track "can have scrollbar" state within FrameView independently of the individual scrollbar states in ScrollView. rdar://problem/7215132, https://bugs.webkit.org/show_bug.cgi?id=29167 REGRESSION (r48064): mint.com loses scrollbars after coming out of edit mode. rdar://problem/7314421, https://bugs.webkit.org/show_bug.cgi?id=30517 REGRESSION (r48064): Extra scroll bars in GarageBand Lesson Store. Test: fast/overflow/scrollbar-restored.html * Api/qwebframe.cpp: (QWebFrame::setScrollBarPolicy): 2009-11-05 Shu Chang Reviewed by Tor Arne Vestbø. Add support for Shift-PageUp and Shift-PageDown key events. https://bugs.webkit.org/show_bug.cgi?id=31166 Test: LayoutTests/editing/selection/shrink-selection-after-shift-pagedown.html * WebCoreSupport/EditorClientQt.cpp: (WebCore::EditorClientQt::handleKeyboardEvent): 2009-11-01 Laszlo Gombos Reviewed by Eric Seidel. Turn on warnings for QtWebKit for gcc https://bugs.webkit.org/show_bug.cgi?id=30958 * Api/qwebpage.cpp: (QWebPagePrivate::QWebPagePrivate): Reorder initialization list to fix compiler warnings. * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::FrameLoaderClientQt): Ditto. 2009-10-30 Evan Stade Reviewed by David Levin. Notify the chrome when the focused node has changed. https://bugs.webkit.org/show_bug.cgi?id=30832 Added stub implementation for new ChromeClient function. * WebCoreSupport/ChromeClientQt.cpp: (WebCore::ChromeClientQt::focusedNodeChanged): * WebCoreSupport/ChromeClientQt.h: --- src/3rdparty/webkit/.gitattributes | 273 + src/3rdparty/webkit/.gitignore | 18 + src/3rdparty/webkit/ChangeLog | 708 + src/3rdparty/webkit/JavaScriptCore/API/APICast.h | 20 +- src/3rdparty/webkit/JavaScriptCore/API/APIShims.h | 97 + src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp | 18 +- src/3rdparty/webkit/JavaScriptCore/API/JSBase.h | 20 +- .../JavaScriptCore/API/JSCallbackConstructor.cpp | 3 +- .../JavaScriptCore/API/JSCallbackConstructor.h | 2 +- .../JavaScriptCore/API/JSCallbackFunction.cpp | 3 +- .../webkit/JavaScriptCore/API/JSCallbackFunction.h | 2 +- .../webkit/JavaScriptCore/API/JSCallbackObject.h | 5 +- .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 106 +- .../webkit/JavaScriptCore/API/JSClassRef.cpp | 95 +- .../webkit/JavaScriptCore/API/JSClassRef.h | 3 +- .../webkit/JavaScriptCore/API/JSContextRef.cpp | 32 +- .../webkit/JavaScriptCore/API/JSObjectRef.cpp | 64 +- .../webkit/JavaScriptCore/API/JSStringRef.h | 3 +- .../webkit/JavaScriptCore/API/JSValueRef.cpp | 83 +- .../webkit/JavaScriptCore/API/OpaqueJSString.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 8027 +- src/3rdparty/webkit/JavaScriptCore/Info.plist | 4 +- .../webkit/JavaScriptCore/JavaScriptCore.gypi | 19 +- .../webkit/JavaScriptCore/JavaScriptCore.order | 2 - .../webkit/JavaScriptCore/JavaScriptCore.pri | 223 +- .../webkit/JavaScriptCore/JavaScriptCore.pro | 6 - .../JavaScriptCore/assembler/ARMAssembler.cpp | 92 +- .../webkit/JavaScriptCore/assembler/ARMAssembler.h | 91 +- .../JavaScriptCore/assembler/ARMv7Assembler.h | 17 +- .../assembler/AbstractMacroAssembler.h | 8 +- .../JavaScriptCore/assembler/MacroAssembler.h | 23 +- .../JavaScriptCore/assembler/MacroAssemblerARM.cpp | 11 +- .../JavaScriptCore/assembler/MacroAssemblerARM.h | 139 +- .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 49 +- .../assembler/MacroAssemblerCodeRef.h | 6 +- .../JavaScriptCore/assembler/MacroAssemblerX86.h | 2 +- .../assembler/MacroAssemblerX86Common.h | 89 +- .../assembler/MacroAssemblerX86_64.h | 29 +- .../webkit/JavaScriptCore/assembler/X86Assembler.h | 64 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 336 +- .../webkit/JavaScriptCore/bytecode/CodeBlock.h | 34 +- .../webkit/JavaScriptCore/bytecode/EvalCodeCache.h | 2 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 11 + .../JavaScriptCore/bytecode/SamplingTool.cpp | 4 +- .../bytecompiler/BytecodeGenerator.cpp | 22 +- .../bytecompiler/BytecodeGenerator.h | 13 + .../JavaScriptCore/bytecompiler/NodesCodegen.cpp | 1999 + src/3rdparty/webkit/JavaScriptCore/config.h | 23 +- .../webkit/JavaScriptCore/create_jit_stubs | 69 + .../webkit/JavaScriptCore/debugger/Debugger.cpp | 7 +- .../webkit/JavaScriptCore/debugger/Debugger.h | 2 +- .../JavaScriptCore/debugger/DebuggerActivation.cpp | 8 +- .../JavaScriptCore/debugger/DebuggerActivation.h | 6 +- .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 8 +- .../JavaScriptCore/generated/ArrayPrototype.lut.h | 2 +- .../JavaScriptCore/generated/DatePrototype.lut.h | 2 +- .../generated/GeneratedJITStubs_RVCT.h | 1177 + .../webkit/JavaScriptCore/generated/Grammar.cpp | 1542 +- .../webkit/JavaScriptCore/generated/Grammar.h | 109 +- .../JavaScriptCore/generated/JSONObject.lut.h | 2 +- .../webkit/JavaScriptCore/generated/Lexer.lut.h | 2 +- .../JavaScriptCore/generated/MathObject.lut.h | 2 +- .../generated/NumberConstructor.lut.h | 2 +- .../generated/RegExpConstructor.lut.h | 2 +- .../JavaScriptCore/generated/RegExpObject.lut.h | 2 +- .../JavaScriptCore/generated/StringPrototype.lut.h | 2 +- .../webkit/JavaScriptCore/interpreter/CachedCall.h | 11 +- .../webkit/JavaScriptCore/interpreter/CallFrame.h | 23 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 278 +- .../webkit/JavaScriptCore/interpreter/Register.h | 65 +- .../JavaScriptCore/interpreter/RegisterFile.cpp | 2 +- .../JavaScriptCore/interpreter/RegisterFile.h | 8 +- .../JavaScriptCore/jit/ExecutableAllocator.h | 28 +- .../jit/ExecutableAllocatorFixedVMPool.cpp | 2 +- .../jit/ExecutableAllocatorPosix.cpp | 6 +- .../jit/ExecutableAllocatorSymbian.cpp | 4 +- .../JavaScriptCore/jit/ExecutableAllocatorWin.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 14 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.h | 116 +- .../webkit/JavaScriptCore/jit/JITArithmetic.cpp | 399 +- src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp | 6 + .../webkit/JavaScriptCore/jit/JITInlineMethods.h | 34 +- .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 377 +- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 1026 +- .../JavaScriptCore/jit/JITPropertyAccess32_64.cpp | 1026 + .../webkit/JavaScriptCore/jit/JITStubCall.h | 17 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 348 +- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 40 +- src/3rdparty/webkit/JavaScriptCore/jsc.cpp | 69 +- .../webkit/JavaScriptCore/os-win32/WinMain.cpp | 81 + .../webkit/JavaScriptCore/parser/Grammar.y | 10 +- .../webkit/JavaScriptCore/parser/Lexer.cpp | 5 +- .../JavaScriptCore/parser/NodeConstructors.h | 6 +- .../webkit/JavaScriptCore/parser/Nodes.cpp | 1891 +- src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h | 10 + .../webkit/JavaScriptCore/parser/Parser.cpp | 2 +- src/3rdparty/webkit/JavaScriptCore/pcre/dftables | 1 + src/3rdparty/webkit/JavaScriptCore/pcre/pcre.pri | 23 - .../webkit/JavaScriptCore/pcre/pcre_exec.cpp | 4 +- .../JavaScriptCore/profiler/HeavyProfile.cpp | 0 .../webkit/JavaScriptCore/profiler/HeavyProfile.h | 0 .../webkit/JavaScriptCore/profiler/Profile.cpp | 2 +- .../JavaScriptCore/profiler/ProfileGenerator.cpp | 4 +- .../webkit/JavaScriptCore/profiler/ProfileNode.cpp | 8 +- .../webkit/JavaScriptCore/profiler/Profiler.cpp | 22 +- .../webkit/JavaScriptCore/profiler/Profiler.h | 2 +- .../webkit/JavaScriptCore/profiler/TreeProfile.cpp | 0 .../webkit/JavaScriptCore/profiler/TreeProfile.h | 0 .../webkit/JavaScriptCore/qt/api/QtScript.pro | 36 + .../JavaScriptCore/qt/api/qscriptconverter_p.h | 50 + .../webkit/JavaScriptCore/qt/api/qscriptengine.cpp | 108 + .../webkit/JavaScriptCore/qt/api/qscriptengine.h | 49 + .../JavaScriptCore/qt/api/qscriptengine_p.cpp | 54 + .../webkit/JavaScriptCore/qt/api/qscriptengine_p.h | 98 + .../webkit/JavaScriptCore/qt/api/qscriptvalue.cpp | 556 + .../webkit/JavaScriptCore/qt/api/qscriptvalue.h | 99 + .../webkit/JavaScriptCore/qt/api/qscriptvalue_p.h | 744 + .../webkit/JavaScriptCore/qt/api/qtscriptglobal.h | 44 + .../qt/tests/qscriptengine/qscriptengine.pro | 7 + .../qt/tests/qscriptengine/tst_qscriptengine.cpp | 77 + .../qt/tests/qscriptvalue/qscriptvalue.pro | 11 + .../qt/tests/qscriptvalue/tst_qscriptvalue.cpp | 435 + .../qt/tests/qscriptvalue/tst_qscriptvalue.h | 189 + .../qscriptvalue/tst_qscriptvalue_generated.cpp | 1450 + .../webkit/JavaScriptCore/qt/tests/tests.pri | 28 + .../webkit/JavaScriptCore/qt/tests/tests.pro | 3 + .../webkit/JavaScriptCore/runtime/ArgList.h | 10 +- .../webkit/JavaScriptCore/runtime/Arguments.cpp | 13 + .../webkit/JavaScriptCore/runtime/Arguments.h | 3 +- .../JavaScriptCore/runtime/ArrayPrototype.cpp | 98 +- .../runtime/BatchedTransitionOptimizer.h | 2 +- .../webkit/JavaScriptCore/runtime/BooleanObject.h | 2 +- .../webkit/JavaScriptCore/runtime/Collector.cpp | 768 +- .../webkit/JavaScriptCore/runtime/Collector.h | 144 +- .../JavaScriptCore/runtime/CollectorHeapIterator.h | 126 +- .../JavaScriptCore/runtime/CommonIdentifiers.cpp | 3 +- .../JavaScriptCore/runtime/CommonIdentifiers.h | 2 +- .../webkit/JavaScriptCore/runtime/Completion.cpp | 2 + .../JavaScriptCore/runtime/DateConstructor.cpp | 23 +- .../JavaScriptCore/runtime/DateConversion.cpp | 59 +- .../webkit/JavaScriptCore/runtime/DateConversion.h | 19 +- .../webkit/JavaScriptCore/runtime/DateInstance.cpp | 42 +- .../webkit/JavaScriptCore/runtime/DateInstance.h | 19 +- .../JavaScriptCore/runtime/DateInstanceCache.h | 11 +- .../JavaScriptCore/runtime/DatePrototype.cpp | 259 +- .../webkit/JavaScriptCore/runtime/DatePrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/Error.cpp | 8 +- .../JavaScriptCore/runtime/ErrorPrototype.cpp | 23 +- .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 76 +- .../JavaScriptCore/runtime/ExceptionHelpers.h | 1 + .../webkit/JavaScriptCore/runtime/Executable.cpp | 12 +- .../JavaScriptCore/runtime/FunctionConstructor.cpp | 22 +- .../JavaScriptCore/runtime/FunctionPrototype.cpp | 9 +- .../JavaScriptCore/runtime/FunctionPrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/GetterSetter.h | 2 +- .../JavaScriptCore/runtime/GlobalEvalFunction.h | 2 +- .../webkit/JavaScriptCore/runtime/Identifier.cpp | 82 +- .../webkit/JavaScriptCore/runtime/Identifier.h | 68 +- .../JavaScriptCore/runtime/InitializeThreading.cpp | 7 +- .../JavaScriptCore/runtime/InternalFunction.cpp | 18 +- .../JavaScriptCore/runtime/InternalFunction.h | 8 +- .../JavaScriptCore/runtime/JSAPIValueWrapper.h | 2 +- .../webkit/JavaScriptCore/runtime/JSActivation.h | 2 +- .../webkit/JavaScriptCore/runtime/JSArray.cpp | 36 +- .../webkit/JavaScriptCore/runtime/JSArray.h | 5 +- .../webkit/JavaScriptCore/runtime/JSByteArray.cpp | 16 +- .../webkit/JavaScriptCore/runtime/JSByteArray.h | 8 +- .../webkit/JavaScriptCore/runtime/JSCell.cpp | 17 +- .../webkit/JavaScriptCore/runtime/JSCell.h | 48 +- .../webkit/JavaScriptCore/runtime/JSFunction.cpp | 13 + .../webkit/JavaScriptCore/runtime/JSFunction.h | 5 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.cpp | 67 +- .../webkit/JavaScriptCore/runtime/JSGlobalData.h | 49 +- .../JavaScriptCore/runtime/JSGlobalObject.cpp | 2 + .../webkit/JavaScriptCore/runtime/JSGlobalObject.h | 20 +- .../runtime/JSGlobalObjectFunctions.cpp | 48 +- .../JavaScriptCore/runtime/JSNotAnObject.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSNotAnObject.h | 4 +- .../webkit/JavaScriptCore/runtime/JSNumberCell.h | 12 +- .../webkit/JavaScriptCore/runtime/JSONObject.cpp | 23 +- .../webkit/JavaScriptCore/runtime/JSONObject.h | 2 +- .../webkit/JavaScriptCore/runtime/JSObject.cpp | 61 +- .../webkit/JavaScriptCore/runtime/JSObject.h | 34 +- .../runtime/JSPropertyNameIterator.cpp | 23 +- .../runtime/JSPropertyNameIterator.h | 36 +- .../JavaScriptCore/runtime/JSStaticScopeObject.h | 2 +- .../webkit/JavaScriptCore/runtime/JSString.cpp | 93 +- .../webkit/JavaScriptCore/runtime/JSString.h | 324 +- .../JavaScriptCore/runtime/JSStringBuilder.h | 105 + .../webkit/JavaScriptCore/runtime/JSValue.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSValue.h | 44 +- .../JavaScriptCore/runtime/JSVariableObject.cpp | 16 +- .../JavaScriptCore/runtime/JSVariableObject.h | 6 +- .../JavaScriptCore/runtime/JSWrapperObject.h | 6 +- .../webkit/JavaScriptCore/runtime/JSZombie.cpp | 48 + .../webkit/JavaScriptCore/runtime/JSZombie.h | 78 + .../JavaScriptCore/runtime/LiteralParser.cpp | 24 +- .../webkit/JavaScriptCore/runtime/Lookup.cpp | 2 +- .../webkit/JavaScriptCore/runtime/Lookup.h | 2 +- .../webkit/JavaScriptCore/runtime/MarkStack.h | 2 +- .../JavaScriptCore/runtime/MarkStackNone.cpp | 49 + .../JavaScriptCore/runtime/MarkStackPosix.cpp | 6 +- .../JavaScriptCore/runtime/MarkStackSymbian.cpp | 4 + .../webkit/JavaScriptCore/runtime/MarkStackWin.cpp | 6 +- .../webkit/JavaScriptCore/runtime/MathObject.cpp | 26 +- .../webkit/JavaScriptCore/runtime/MathObject.h | 2 +- .../runtime/NativeErrorConstructor.cpp | 2 +- .../JavaScriptCore/runtime/NumberConstructor.h | 2 +- .../webkit/JavaScriptCore/runtime/NumberObject.h | 2 +- .../JavaScriptCore/runtime/NumberPrototype.cpp | 59 +- .../JavaScriptCore/runtime/ObjectConstructor.cpp | 28 +- .../JavaScriptCore/runtime/ObjectPrototype.cpp | 3 +- .../webkit/JavaScriptCore/runtime/Operations.cpp | 26 +- .../webkit/JavaScriptCore/runtime/Operations.h | 271 +- .../JavaScriptCore/runtime/PropertyDescriptor.cpp | 8 +- .../JavaScriptCore/runtime/PropertyDescriptor.h | 2 +- .../JavaScriptCore/runtime/PropertyMapHashTable.h | 1 - .../JavaScriptCore/runtime/PropertyNameArray.cpp | 2 +- .../webkit/JavaScriptCore/runtime/PropertySlot.cpp | 4 +- .../webkit/JavaScriptCore/runtime/PropertySlot.h | 32 +- .../webkit/JavaScriptCore/runtime/RegExp.cpp | 11 +- .../webkit/JavaScriptCore/runtime/RegExp.h | 2 - .../JavaScriptCore/runtime/RegExpConstructor.cpp | 4 +- .../JavaScriptCore/runtime/RegExpConstructor.h | 2 +- .../JavaScriptCore/runtime/RegExpMatchesArray.h | 4 +- .../webkit/JavaScriptCore/runtime/RegExpObject.cpp | 2 +- .../webkit/JavaScriptCore/runtime/RegExpObject.h | 2 +- .../JavaScriptCore/runtime/RegExpPrototype.cpp | 17 +- .../webkit/JavaScriptCore/runtime/SmallStrings.cpp | 59 +- .../webkit/JavaScriptCore/runtime/SmallStrings.h | 1 + .../webkit/JavaScriptCore/runtime/StringBuilder.h | 83 + .../JavaScriptCore/runtime/StringConstructor.cpp | 12 +- .../webkit/JavaScriptCore/runtime/StringObject.cpp | 12 +- .../webkit/JavaScriptCore/runtime/StringObject.h | 4 +- .../StringObjectThatMasqueradesAsUndefined.h | 2 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 231 +- .../webkit/JavaScriptCore/runtime/Structure.cpp | 350 +- .../webkit/JavaScriptCore/runtime/Structure.h | 119 +- .../runtime/StructureTransitionTable.h | 145 +- .../JavaScriptCore/runtime/TimeoutChecker.cpp | 17 +- .../webkit/JavaScriptCore/runtime/Tracing.h | 2 +- .../webkit/JavaScriptCore/runtime/UString.cpp | 1185 +- .../webkit/JavaScriptCore/runtime/UString.h | 710 +- .../webkit/JavaScriptCore/runtime/UStringImpl.cpp | 172 + .../webkit/JavaScriptCore/runtime/UStringImpl.h | 364 + .../webkit/JavaScriptCore/runtime/WeakGCMap.h | 122 + .../webkit/JavaScriptCore/runtime/WeakGCPtr.h | 132 + .../webkit/JavaScriptCore/runtime/WeakRandom.h | 86 + src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h | 2 +- .../webkit/JavaScriptCore/wrec/WRECGenerator.cpp | 6 +- .../webkit/JavaScriptCore/wrec/WRECGenerator.h | 4 +- src/3rdparty/webkit/JavaScriptCore/wscript | 9 +- .../webkit/JavaScriptCore/wtf/AlwaysInline.h | 6 +- .../webkit/JavaScriptCore/wtf/Assertions.cpp | 10 +- .../webkit/JavaScriptCore/wtf/Assertions.h | 102 +- src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h | 46 + .../webkit/JavaScriptCore/wtf/CurrentTime.cpp | 24 +- .../webkit/JavaScriptCore/wtf/CurrentTime.h | 24 +- .../webkit/JavaScriptCore/wtf/DateMath.cpp | 361 +- src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h | 65 +- .../webkit/JavaScriptCore/wtf/FastMalloc.cpp | 193 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 35 +- src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp | 65 - src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h | 98 - .../webkit/JavaScriptCore/wtf/HashFunctions.h | 3 - src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h | 77 +- src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h | 4 +- src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h | 39 +- .../webkit/JavaScriptCore/wtf/ListHashSet.h | 2 +- .../webkit/JavaScriptCore/wtf/MainThread.cpp | 24 +- .../webkit/JavaScriptCore/wtf/MainThread.h | 4 + .../webkit/JavaScriptCore/wtf/MathExtras.h | 54 +- .../webkit/JavaScriptCore/wtf/MessageQueue.h | 90 +- .../webkit/JavaScriptCore/wtf/PassRefPtr.h | 25 +- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 824 +- .../webkit/JavaScriptCore/wtf/PtrAndFlags.h | 79 - .../webkit/JavaScriptCore/wtf/RandomNumber.cpp | 30 +- .../webkit/JavaScriptCore/wtf/RandomNumberSeed.h | 10 +- src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h | 19 +- .../webkit/JavaScriptCore/wtf/RefPtrHashMap.h | 2 +- .../webkit/JavaScriptCore/wtf/StdLibExtras.h | 12 + .../webkit/JavaScriptCore/wtf/StringExtras.cpp | 62 + .../webkit/JavaScriptCore/wtf/StringExtras.h | 15 +- .../JavaScriptCore/wtf/StringHashFunctions.h | 157 + .../webkit/JavaScriptCore/wtf/TCSpinLock.h | 14 +- .../webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp | 2 +- .../wtf/ThreadIdentifierDataPthreads.cpp | 97 + .../wtf/ThreadIdentifierDataPthreads.h | 77 + .../webkit/JavaScriptCore/wtf/ThreadSpecific.h | 57 +- .../webkit/JavaScriptCore/wtf/Threading.cpp | 9 +- src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h | 27 +- .../webkit/JavaScriptCore/wtf/ThreadingNone.cpp | 6 +- .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 47 +- .../webkit/JavaScriptCore/wtf/ThreadingWin.cpp | 14 +- .../webkit/JavaScriptCore/wtf/TypeTraits.cpp | 16 +- .../webkit/JavaScriptCore/wtf/TypeTraits.h | 36 +- src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h | 6 +- .../webkit/JavaScriptCore/wtf/ValueCheck.h | 64 + src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h | 33 +- src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h | 138 + .../webkit/JavaScriptCore/wtf/VectorTraits.h | 2 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp | 103 +- src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h | 12 +- .../webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp | 30 +- .../webkit/JavaScriptCore/wtf/unicode/UTF8.cpp | 1 + .../wtf/unicode/glib/UnicodeGLib.cpp | 1 + .../JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h | 7 +- .../JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp | 6 +- .../JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h | 5 + .../JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 138 +- .../wtf/unicode/wince/UnicodeWince.cpp | 1 + .../JavaScriptCore/wtf/wince/FastMallocWince.h | 1 - .../JavaScriptCore/wtf/wince/MemoryManager.cpp | 8 +- .../webkit/JavaScriptCore/yarr/RegexCompiler.cpp | 2 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 18 +- src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h | 2 +- .../webkit/JavaScriptCore/yarr/RegexPattern.h | 2 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 65277 ++---------- src/3rdparty/webkit/WebCore/ChangeLog-2010-01-29 | 98486 +++++++++++++++++++ src/3rdparty/webkit/WebCore/DerivedSources.cpp | 9 +- .../ForwardingHeaders/runtime/StringBuilder.h | 4 + .../ForwardingHeaders/runtime/UStringImpl.h | 4 + .../WebCore/ForwardingHeaders/runtime/WeakGCMap.h | 4 + .../WebCore/ForwardingHeaders/runtime/WeakGCPtr.h | 4 + .../WebCore/ForwardingHeaders/wtf/PtrAndFlags.h | 5 - .../ForwardingHeaders/wtf/StringHashFunctions.h | 4 + .../WebCore/ForwardingHeaders/wtf/ValueCheck.h | 4 + src/3rdparty/webkit/WebCore/Info.plist | 4 +- .../WebCore/WebCore.ClientBasedGeolocation.exp | 2 + src/3rdparty/webkit/WebCore/WebCore.Video.exp | 23 +- src/3rdparty/webkit/WebCore/WebCore.gypi | 419 +- src/3rdparty/webkit/WebCore/WebCore.order | 2 - src/3rdparty/webkit/WebCore/WebCore.pri | 698 + src/3rdparty/webkit/WebCore/WebCore.pro | 1059 +- src/3rdparty/webkit/WebCore/WebCore.qrc | 1 + src/3rdparty/webkit/WebCore/WebCorePrefix.cpp | 3 +- src/3rdparty/webkit/WebCore/WebCorePrefix.h | 20 +- .../webkit/WebCore/accessibility/AXObjectCache.cpp | 157 +- .../webkit/WebCore/accessibility/AXObjectCache.h | 203 +- .../accessibility/AccessibilityARIAGrid.cpp | 4 +- .../WebCore/accessibility/AccessibilityARIAGrid.h | 3 + .../accessibility/AccessibilityARIAGridRow.cpp | 66 + .../accessibility/AccessibilityARIAGridRow.h | 6 + .../accessibility/AccessibilityAllInOne.cpp | 89 +- .../accessibility/AccessibilityImageMapLink.cpp | 26 +- .../accessibility/AccessibilityImageMapLink.h | 16 +- .../WebCore/accessibility/AccessibilityList.cpp | 10 +- .../WebCore/accessibility/AccessibilityList.h | 2 +- .../WebCore/accessibility/AccessibilityListBox.cpp | 6 +- .../WebCore/accessibility/AccessibilityListBox.h | 2 +- .../accessibility/AccessibilityListBoxOption.cpp | 4 +- .../accessibility/AccessibilityListBoxOption.h | 2 +- .../accessibility/AccessibilityMediaControls.cpp | 8 + .../accessibility/AccessibilityMediaControls.h | 98 +- .../accessibility/AccessibilityMenuList.cpp | 86 + .../WebCore/accessibility/AccessibilityMenuList.h | 59 + .../accessibility/AccessibilityMenuListOption.cpp | 113 + .../accessibility/AccessibilityMenuListOption.h | 69 + .../accessibility/AccessibilityMenuListPopup.cpp | 126 + .../accessibility/AccessibilityMenuListPopup.h | 68 + .../WebCore/accessibility/AccessibilityObject.cpp | 210 +- .../WebCore/accessibility/AccessibilityObject.h | 182 +- .../accessibility/AccessibilityRenderObject.cpp | 1015 +- .../accessibility/AccessibilityRenderObject.h | 63 +- .../accessibility/AccessibilityScrollbar.cpp | 53 + .../WebCore/accessibility/AccessibilityScrollbar.h | 64 + .../WebCore/accessibility/AccessibilitySlider.cpp | 22 +- .../WebCore/accessibility/AccessibilitySlider.h | 76 +- .../WebCore/accessibility/AccessibilityTable.cpp | 16 +- .../WebCore/accessibility/AccessibilityTable.h | 1 + .../accessibility/AccessibilityTableColumn.cpp | 4 +- .../AccessibilityTableHeaderContainer.cpp | 5 +- .../accessibility/AccessibilityTableRow.cpp | 2 +- .../accessibility/qt/AccessibilityObjectQt.cpp | 7 +- .../WebCore/bindings/ScriptControllerBase.cpp | 20 +- .../WebCore/bindings/generic/BindingDOMWindow.h | 126 + .../WebCore/bindings/generic/BindingElement.h | 102 + .../WebCore/bindings/generic/BindingSecurity.h | 132 + .../bindings/generic/BindingSecurityBase.cpp | 108 + .../WebCore/bindings/generic/BindingSecurityBase.h | 52 + .../WebCore/bindings/generic/GenericBinding.h | 52 + .../bindings/generic/RuntimeEnabledFeatures.cpp | 98 + .../bindings/generic/RuntimeEnabledFeatures.h | 94 + .../WebCore/bindings/js/DOMObjectWithSVGContext.h | 57 - .../webkit/WebCore/bindings/js/GCController.cpp | 12 +- .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSAttrCustom.cpp | 6 +- .../WebCore/bindings/js/JSAudioConstructor.cpp | 35 +- .../WebCore/bindings/js/JSBindingsAllInOne.cpp | 9 +- .../webkit/WebCore/bindings/js/JSCSSRuleCustom.cpp | 2 +- .../WebCore/bindings/js/JSCSSValueCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSCallbackData.cpp | 11 +- .../webkit/WebCore/bindings/js/JSCallbackData.h | 2 - .../bindings/js/JSCanvasArrayBufferConstructor.cpp | 70 - .../bindings/js/JSCanvasArrayBufferConstructor.h | 97 - .../WebCore/bindings/js/JSCanvasArrayCustom.cpp | 67 - .../bindings/js/JSCanvasByteArrayConstructor.cpp | 67 - .../bindings/js/JSCanvasByteArrayConstructor.h | 46 - .../bindings/js/JSCanvasByteArrayCustom.cpp | 50 - .../bindings/js/JSCanvasFloatArrayConstructor.cpp | 67 - .../bindings/js/JSCanvasFloatArrayConstructor.h | 46 - .../bindings/js/JSCanvasFloatArrayCustom.cpp | 50 - .../bindings/js/JSCanvasIntArrayConstructor.cpp | 67 - .../bindings/js/JSCanvasIntArrayConstructor.h | 46 - .../WebCore/bindings/js/JSCanvasIntArrayCustom.cpp | 50 - .../js/JSCanvasRenderingContext2DCustom.cpp | 16 +- .../js/JSCanvasRenderingContext3DCustom.cpp | 443 - .../bindings/js/JSCanvasRenderingContextCustom.cpp | 6 +- .../bindings/js/JSCanvasShortArrayConstructor.cpp | 68 - .../bindings/js/JSCanvasShortArrayConstructor.h | 46 - .../bindings/js/JSCanvasShortArrayCustom.cpp | 50 - .../js/JSCanvasUnsignedByteArrayConstructor.cpp | 67 - .../js/JSCanvasUnsignedByteArrayConstructor.h | 46 - .../js/JSCanvasUnsignedByteArrayCustom.cpp | 50 - .../js/JSCanvasUnsignedIntArrayConstructor.cpp | 67 - .../js/JSCanvasUnsignedIntArrayConstructor.h | 46 - .../bindings/js/JSCanvasUnsignedIntArrayCustom.cpp | 50 - .../js/JSCanvasUnsignedShortArrayConstructor.cpp | 67 - .../js/JSCanvasUnsignedShortArrayConstructor.h | 46 - .../js/JSCanvasUnsignedShortArrayCustom.cpp | 50 - .../webkit/WebCore/bindings/js/JSConsoleCustom.cpp | 6 +- .../js/JSCustomSQLStatementErrorCallback.cpp | 2 +- .../bindings/js/JSCustomXPathNSResolver.cpp | 2 +- .../bindings/js/JSDOMApplicationCacheCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 342 +- .../webkit/WebCore/bindings/js/JSDOMBinding.h | 163 +- .../WebCore/bindings/js/JSDOMGlobalObject.cpp | 21 +- .../webkit/WebCore/bindings/js/JSDOMGlobalObject.h | 24 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 17 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.h | 11 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 202 +- .../WebCore/bindings/js/JSDOMWindowShell.cpp | 16 +- .../webkit/WebCore/bindings/js/JSDOMWindowShell.h | 12 +- .../WebCore/bindings/js/JSDocumentCustom.cpp | 16 +- .../webkit/WebCore/bindings/js/JSElementCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSEventCustom.cpp | 19 +- .../webkit/WebCore/bindings/js/JSEventListener.cpp | 23 +- .../webkit/WebCore/bindings/js/JSEventListener.h | 53 +- .../WebCore/bindings/js/JSEventSourceCustom.cpp | 4 +- .../webkit/WebCore/bindings/js/JSExceptionBase.cpp | 128 +- .../webkit/WebCore/bindings/js/JSExceptionBase.h | 86 +- .../bindings/js/JSHTMLCanvasElementCustom.cpp | 36 +- .../WebCore/bindings/js/JSHTMLCollectionCustom.cpp | 2 +- .../WebCore/bindings/js/JSHTMLDocumentCustom.cpp | 2 +- .../bindings/js/JSHTMLFormElementCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSHistoryCustom.cpp | 73 +- .../WebCore/bindings/js/JSImageConstructor.cpp | 40 +- .../WebCore/bindings/js/JSImageDataCustom.cpp | 2 +- .../bindings/js/JSInjectedScriptHostCustom.cpp | 237 + .../bindings/js/JSInspectedObjectWrapper.cpp | 131 - .../WebCore/bindings/js/JSInspectedObjectWrapper.h | 59 - .../bindings/js/JSInspectorBackendCustom.cpp | 346 - .../bindings/js/JSInspectorCallbackWrapper.cpp | 111 - .../bindings/js/JSInspectorCallbackWrapper.h | 53 - .../bindings/js/JSInspectorFrontendHostCustom.cpp | 80 + .../bindings/js/JSJavaScriptCallFrameCustom.cpp | 4 +- .../WebCore/bindings/js/JSLazyEventListener.cpp | 75 +- .../WebCore/bindings/js/JSLazyEventListener.h | 11 +- .../WebCore/bindings/js/JSLocationCustom.cpp | 29 +- .../WebCore/bindings/js/JSMessagePortCustom.cpp | 6 +- .../WebCore/bindings/js/JSNamedNodeMapCustom.cpp | 6 +- .../webkit/WebCore/bindings/js/JSNodeCustom.cpp | 41 +- .../WebCore/bindings/js/JSNodeFilterCondition.cpp | 2 +- .../WebCore/bindings/js/JSOptionConstructor.cpp | 23 +- .../bindings/js/JSPluginElementFunctions.cpp | 2 +- .../WebCore/bindings/js/JSPopStateEventCustom.cpp | 48 + .../bindings/js/JSQuarantinedObjectWrapper.cpp | 336 - .../bindings/js/JSQuarantinedObjectWrapper.h | 106 - .../webkit/WebCore/bindings/js/JSSVGContextCache.h | 97 + .../bindings/js/JSSVGElementInstanceCustom.cpp | 8 +- .../WebCore/bindings/js/JSSVGLengthCustom.cpp | 16 +- .../WebCore/bindings/js/JSSVGMatrixCustom.cpp | 32 +- .../WebCore/bindings/js/JSSVGPODListCustom.h | 199 + .../WebCore/bindings/js/JSSVGPODTypeWrapper.h | 108 +- .../WebCore/bindings/js/JSSVGPathSegCustom.cpp | 11 +- .../WebCore/bindings/js/JSSVGPathSegListCustom.cpp | 53 +- .../WebCore/bindings/js/JSSVGPointListCustom.cpp | 153 - .../bindings/js/JSSVGTransformListCustom.cpp | 153 - .../webkit/WebCore/bindings/js/JSStorageCustom.cpp | 4 +- .../WebCore/bindings/js/JSStyleSheetCustom.cpp | 8 +- .../bindings/js/JSWebGLArrayBufferConstructor.cpp | 70 + .../bindings/js/JSWebGLArrayBufferConstructor.h | 97 + .../WebCore/bindings/js/JSWebGLArrayCustom.cpp | 72 + .../WebCore/bindings/js/JSWebGLArrayHelper.h | 69 + .../bindings/js/JSWebGLByteArrayConstructor.cpp | 67 + .../bindings/js/JSWebGLByteArrayConstructor.h | 46 + .../WebCore/bindings/js/JSWebGLByteArrayCustom.cpp | 80 + .../bindings/js/JSWebGLFloatArrayConstructor.cpp | 67 + .../bindings/js/JSWebGLFloatArrayConstructor.h | 46 + .../bindings/js/JSWebGLFloatArrayCustom.cpp | 78 + .../bindings/js/JSWebGLIntArrayConstructor.cpp | 67 + .../bindings/js/JSWebGLIntArrayConstructor.h | 46 + .../WebCore/bindings/js/JSWebGLIntArrayCustom.cpp | 78 + .../bindings/js/JSWebGLRenderingContextCustom.cpp | 835 + .../bindings/js/JSWebGLShortArrayConstructor.cpp | 68 + .../bindings/js/JSWebGLShortArrayConstructor.h | 46 + .../bindings/js/JSWebGLShortArrayCustom.cpp | 78 + .../js/JSWebGLUnsignedByteArrayConstructor.cpp | 67 + .../js/JSWebGLUnsignedByteArrayConstructor.h | 46 + .../bindings/js/JSWebGLUnsignedByteArrayCustom.cpp | 78 + .../js/JSWebGLUnsignedIntArrayConstructor.cpp | 67 + .../js/JSWebGLUnsignedIntArrayConstructor.h | 46 + .../bindings/js/JSWebGLUnsignedIntArrayCustom.cpp | 78 + .../js/JSWebGLUnsignedShortArrayConstructor.cpp | 67 + .../js/JSWebGLUnsignedShortArrayConstructor.h | 46 + .../js/JSWebGLUnsignedShortArrayCustom.cpp | 78 + .../WebCore/bindings/js/JSWebSocketConstructor.h | 8 +- .../WebCore/bindings/js/JSWebSocketCustom.cpp | 5 +- .../WebCore/bindings/js/JSWorkerContextBase.cpp | 4 +- .../WebCore/bindings/js/JSWorkerContextCustom.cpp | 27 +- .../WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 14 +- .../bindings/js/JSXMLHttpRequestUploadCustom.cpp | 6 +- .../WebCore/bindings/js/JavaScriptProfile.cpp | 183 + .../webkit/WebCore/bindings/js/JavaScriptProfile.h | 46 + .../WebCore/bindings/js/JavaScriptProfileNode.cpp | 236 + .../WebCore/bindings/js/JavaScriptProfileNode.h | 48 + .../webkit/WebCore/bindings/js/ScheduledAction.cpp | 8 +- .../webkit/WebCore/bindings/js/ScheduledAction.h | 7 +- .../webkit/WebCore/bindings/js/ScriptArray.cpp | 4 + .../WebCore/bindings/js/ScriptCachedFrameData.cpp | 51 +- .../WebCore/bindings/js/ScriptCachedFrameData.h | 8 +- .../webkit/WebCore/bindings/js/ScriptCallStack.cpp | 9 +- .../webkit/WebCore/bindings/js/ScriptCallStack.h | 1 + .../WebCore/bindings/js/ScriptController.cpp | 172 +- .../webkit/WebCore/bindings/js/ScriptController.h | 26 +- .../WebCore/bindings/js/ScriptControllerGtk.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerHaiku.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerMac.mm | 11 +- .../WebCore/bindings/js/ScriptControllerQt.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerWin.cpp | 2 +- .../WebCore/bindings/js/ScriptControllerWx.cpp | 2 +- .../WebCore/bindings/js/ScriptDebugServer.cpp | 49 + .../webkit/WebCore/bindings/js/ScriptDebugServer.h | 46 + .../WebCore/bindings/js/ScriptEventListener.cpp | 31 +- .../WebCore/bindings/js/ScriptFunctionCall.cpp | 33 +- .../WebCore/bindings/js/ScriptFunctionCall.h | 11 +- .../webkit/WebCore/bindings/js/ScriptInstance.h | 2 +- .../webkit/WebCore/bindings/js/ScriptObject.cpp | 43 +- .../webkit/WebCore/bindings/js/ScriptObject.h | 7 + .../WebCore/bindings/js/ScriptObjectQuarantine.cpp | 131 - .../WebCore/bindings/js/ScriptObjectQuarantine.h | 58 - .../webkit/WebCore/bindings/js/ScriptProfile.h | 41 + .../webkit/WebCore/bindings/js/ScriptProfiler.cpp | 49 + .../webkit/WebCore/bindings/js/ScriptProfiler.h | 48 + .../webkit/WebCore/bindings/js/ScriptState.cpp | 16 +- .../webkit/WebCore/bindings/js/ScriptState.h | 7 +- .../webkit/WebCore/bindings/js/ScriptString.h | 6 +- .../webkit/WebCore/bindings/js/ScriptValue.cpp | 16 +- .../webkit/WebCore/bindings/js/ScriptValue.h | 7 +- .../webkit/WebCore/bindings/js/ScriptWrappable.h | 43 + .../WebCore/bindings/js/SerializedScriptValue.cpp | 192 +- .../WebCore/bindings/js/SerializedScriptValue.h | 48 +- .../WebCore/bindings/js/WorkerScriptController.cpp | 5 +- .../WebCore/bindings/scripts/CodeGenerator.pm | 28 +- .../WebCore/bindings/scripts/CodeGeneratorCOM.pm | 1319 - .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 293 +- .../WebCore/bindings/scripts/CodeGeneratorObjC.pm | 16 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 1425 +- .../webkit/WebCore/bindings/scripts/IDLParser.pm | 7 +- .../WebCore/bindings/scripts/IDLStructure.pm | 2 - .../WebCore/bindings/scripts/generate-bindings.pl | 1 - src/3rdparty/webkit/WebCore/bridge/Bridge.h | 48 + src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h | 3 +- src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp | 87 +- src/3rdparty/webkit/WebCore/bridge/c/c_class.h | 2 +- .../webkit/WebCore/bridge/c/c_instance.cpp | 6 +- src/3rdparty/webkit/WebCore/bridge/c/c_instance.h | 6 +- src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp | 2 + src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h | 2 +- .../webkit/WebCore/bridge/jni/JNIBridge.cpp | 181 + src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h | 123 + .../webkit/WebCore/bridge/jni/JNIUtility.cpp | 343 + .../webkit/WebCore/bridge/jni/JNIUtility.h | 275 + .../webkit/WebCore/bridge/jni/jni_class.cpp | 141 - src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h | 62 - .../webkit/WebCore/bridge/jni/jni_instance.cpp | 330 - .../webkit/WebCore/bridge/jni/jni_instance.h | 108 - .../webkit/WebCore/bridge/jni/jni_jsobject.mm | 104 +- src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm | 3 +- .../webkit/WebCore/bridge/jni/jni_runtime.cpp | 547 - .../webkit/WebCore/bridge/jni/jni_runtime.h | 191 - .../webkit/WebCore/bridge/jni/jni_utility.cpp | 584 - .../webkit/WebCore/bridge/jni/jni_utility.h | 288 - .../webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 442 + .../webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h | 89 + .../WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp | 291 + .../WebCore/bridge/jni/jsc/JNIUtilityPrivate.h | 51 + .../webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp | 150 + .../webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h | 62 + .../WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp | 335 + .../WebCore/bridge/jni/jsc/JavaInstanceJSC.h | 108 + .../webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h | 84 + .../webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp | 44 + .../webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h | 56 + .../WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp | 255 + .../WebCore/bridge/jni/v8/JNIUtilityPrivate.h | 43 + .../webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp | 111 + .../webkit/WebCore/bridge/jni/v8/JavaClassV8.h | 61 + .../WebCore/bridge/jni/v8/JavaInstanceV8.cpp | 169 + .../webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h | 100 + .../WebCore/bridge/jni/v8/JavaNPObjectV8.cpp | 168 + .../webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h | 56 + .../webkit/WebCore/bridge/jni/v8/JavaStringV8.h | 61 + .../webkit/WebCore/bridge/jsc/BridgeJSC.cpp | 126 + src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h | 151 + src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h | 3 +- .../webkit/WebCore/bridge/qt/qt_instance.cpp | 8 + .../webkit/WebCore/bridge/qt/qt_instance.h | 6 +- .../webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp | 353 + .../webkit/WebCore/bridge/qt/qt_pixmapruntime.h | 52 + .../webkit/WebCore/bridge/qt/qt_runtime.cpp | 114 +- src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h | 10 +- src/3rdparty/webkit/WebCore/bridge/runtime.cpp | 121 - src/3rdparty/webkit/WebCore/bridge/runtime.h | 153 - .../webkit/WebCore/bridge/runtime_array.cpp | 13 + src/3rdparty/webkit/WebCore/bridge/runtime_array.h | 7 +- .../webkit/WebCore/bridge/runtime_method.h | 4 +- .../webkit/WebCore/bridge/runtime_object.cpp | 7 +- .../webkit/WebCore/bridge/runtime_object.h | 7 +- .../webkit/WebCore/bridge/runtime_root.cpp | 14 +- src/3rdparty/webkit/WebCore/bridge/runtime_root.h | 11 +- .../webkit/WebCore/bridge/testbindings.cpp | 14 +- src/3rdparty/webkit/WebCore/bridge/testbindings.mm | 14 +- .../webkit/WebCore/bridge/testqtbindings.cpp | 17 +- src/3rdparty/webkit/WebCore/config.h | 43 +- src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl | 6 +- .../WebCore/css/CSSComputedStyleDeclaration.cpp | 16 +- .../webkit/WebCore/css/CSSCursorImageValue.cpp | 1 - src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp | 22 +- src/3rdparty/webkit/WebCore/css/CSSFontFace.h | 2 + .../webkit/WebCore/css/CSSFontFaceRule.idl | 6 +- .../webkit/WebCore/css/CSSFontFaceSource.cpp | 8 +- .../webkit/WebCore/css/CSSFontSelector.cpp | 3 +- .../webkit/WebCore/css/CSSGradientValue.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 119 +- src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp | 1 - src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp | 38 +- src/3rdparty/webkit/WebCore/css/CSSImportRule.h | 2 +- src/3rdparty/webkit/WebCore/css/CSSImportRule.idl | 6 +- .../webkit/WebCore/css/CSSInheritedValue.cpp | 2 - .../webkit/WebCore/css/CSSInitialValue.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl | 6 +- .../WebCore/css/CSSMutableStyleDeclaration.cpp | 37 +- src/3rdparty/webkit/WebCore/css/CSSNamespace.h | 4 +- src/3rdparty/webkit/WebCore/css/CSSPageRule.idl | 6 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 371 +- src/3rdparty/webkit/WebCore/css/CSSParser.h | 14 +- .../webkit/WebCore/css/CSSPrimitiveValue.cpp | 105 +- .../webkit/WebCore/css/CSSPrimitiveValue.idl | 9 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 334 +- src/3rdparty/webkit/WebCore/css/CSSProperty.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSProperty.h | 2 - .../webkit/WebCore/css/CSSPropertyNames.in | 1 + src/3rdparty/webkit/WebCore/css/CSSRule.cpp | 1 - src/3rdparty/webkit/WebCore/css/CSSRule.idl | 5 +- src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSRuleList.h | 2 - src/3rdparty/webkit/WebCore/css/CSSRuleList.idl | 5 +- src/3rdparty/webkit/WebCore/css/CSSSelector.cpp | 16 +- src/3rdparty/webkit/WebCore/css/CSSSelector.h | 9 +- .../webkit/WebCore/css/CSSStyleDeclaration.idl | 7 +- src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl | 6 +- .../webkit/WebCore/css/CSSStyleSelector.cpp | 175 +- src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h | 16 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp | 36 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h | 35 +- src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl | 6 +- src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl | 3 +- src/3rdparty/webkit/WebCore/css/CSSValue.idl | 5 +- .../webkit/WebCore/css/CSSValueKeywords.in | 63 + src/3rdparty/webkit/WebCore/css/CSSValueList.cpp | 2 - src/3rdparty/webkit/WebCore/css/CSSValueList.idl | 5 +- .../webkit/WebCore/css/CSSVariablesDeclaration.idl | 1 - .../webkit/WebCore/css/CSSVariablesRule.idl | 4 +- src/3rdparty/webkit/WebCore/css/Counter.idl | 6 +- src/3rdparty/webkit/WebCore/css/FontValue.cpp | 2 - src/3rdparty/webkit/WebCore/css/Media.cpp | 23 +- src/3rdparty/webkit/WebCore/css/Media.h | 12 +- src/3rdparty/webkit/WebCore/css/Media.idl | 4 +- .../webkit/WebCore/css/MediaFeatureNames.cpp | 2 - .../webkit/WebCore/css/MediaFeatureNames.h | 2 - src/3rdparty/webkit/WebCore/css/MediaList.idl | 5 +- src/3rdparty/webkit/WebCore/css/MediaQuery.h | 2 +- .../webkit/WebCore/css/MediaQueryEvaluator.h | 2 +- src/3rdparty/webkit/WebCore/css/MediaQueryExp.h | 2 +- src/3rdparty/webkit/WebCore/css/Pair.h | 2 - src/3rdparty/webkit/WebCore/css/RGBColor.idl | 6 +- src/3rdparty/webkit/WebCore/css/Rect.idl | 6 +- .../WebCore/css/SVGCSSComputedStyleDeclaration.cpp | 2 +- src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp | 2 +- .../webkit/WebCore/css/SVGCSSPropertyNames.in | 2 +- .../webkit/WebCore/css/SVGCSSStyleSelector.cpp | 17 +- .../webkit/WebCore/css/SVGCSSValueKeywords.in | 2 +- src/3rdparty/webkit/WebCore/css/ShadowValue.cpp | 2 - src/3rdparty/webkit/WebCore/css/StyleBase.cpp | 6 +- src/3rdparty/webkit/WebCore/css/StyleSheet.cpp | 18 +- src/3rdparty/webkit/WebCore/css/StyleSheet.h | 20 +- src/3rdparty/webkit/WebCore/css/StyleSheet.idl | 5 +- src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp | 2 - src/3rdparty/webkit/WebCore/css/StyleSheetList.idl | 5 +- .../webkit/WebCore/css/WebKitCSSKeyframeRule.idl | 6 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.cpp | 10 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.h | 2 +- .../webkit/WebCore/css/WebKitCSSKeyframesRule.idl | 5 +- .../webkit/WebCore/css/WebKitCSSMatrix.idl | 2 +- .../webkit/WebCore/css/WebKitCSSTransformValue.idl | 3 - src/3rdparty/webkit/WebCore/css/html.css | 30 +- src/3rdparty/webkit/WebCore/css/maketokenizer | 2 - src/3rdparty/webkit/WebCore/css/mathml.css | 100 +- src/3rdparty/webkit/WebCore/css/mediaControls.css | 7 + .../webkit/WebCore/css/mediaControlsGtk.css | 65 + .../webkit/WebCore/css/mediaControlsQuickTime.css | 12 +- src/3rdparty/webkit/WebCore/css/svg.css | 17 +- src/3rdparty/webkit/WebCore/css/view-source.css | 2 +- src/3rdparty/webkit/WebCore/dom/Attr.cpp | 16 +- src/3rdparty/webkit/WebCore/dom/Attr.h | 2 + src/3rdparty/webkit/WebCore/dom/Attr.idl | 13 +- .../webkit/WebCore/dom/BeforeLoadEvent.idl | 4 +- .../webkit/WebCore/dom/BeforeUnloadEvent.cpp | 2 - .../webkit/WebCore/dom/BeforeUnloadEvent.h | 2 - src/3rdparty/webkit/WebCore/dom/CDATASection.idl | 6 +- .../WebCore/dom/CSSMappedAttributeDeclaration.cpp | 2 - src/3rdparty/webkit/WebCore/dom/CharacterData.idl | 6 +- .../webkit/WebCore/dom/CheckedRadioButtons.cpp | 4 + src/3rdparty/webkit/WebCore/dom/ClassNames.cpp | 92 - src/3rdparty/webkit/WebCore/dom/ClassNames.h | 89 - src/3rdparty/webkit/WebCore/dom/ClassNodeList.h | 4 +- src/3rdparty/webkit/WebCore/dom/ClientRect.idl | 4 +- src/3rdparty/webkit/WebCore/dom/ClientRectList.idl | 1 - src/3rdparty/webkit/WebCore/dom/Clipboard.cpp | 43 +- src/3rdparty/webkit/WebCore/dom/Clipboard.h | 5 +- src/3rdparty/webkit/WebCore/dom/Clipboard.idl | 4 +- src/3rdparty/webkit/WebCore/dom/Comment.idl | 6 +- .../webkit/WebCore/dom/CompositionEvent.cpp | 63 + src/3rdparty/webkit/WebCore/dom/CompositionEvent.h | 61 + .../webkit/WebCore/dom/CompositionEvent.idl | 41 + src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 15 + .../webkit/WebCore/dom/DOMCoreException.idl | 4 +- .../webkit/WebCore/dom/DOMImplementation.cpp | 3 +- .../webkit/WebCore/dom/DOMImplementation.idl | 8 +- src/3rdparty/webkit/WebCore/dom/Document.cpp | 543 +- src/3rdparty/webkit/WebCore/dom/Document.h | 142 +- src/3rdparty/webkit/WebCore/dom/Document.idl | 30 +- .../webkit/WebCore/dom/DocumentFragment.idl | 6 +- src/3rdparty/webkit/WebCore/dom/DocumentType.idl | 5 +- .../webkit/WebCore/dom/DynamicNodeList.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/Element.cpp | 192 +- src/3rdparty/webkit/WebCore/dom/Element.h | 59 +- src/3rdparty/webkit/WebCore/dom/Element.idl | 15 +- src/3rdparty/webkit/WebCore/dom/ElementRareData.h | 4 + src/3rdparty/webkit/WebCore/dom/Entity.idl | 6 +- .../webkit/WebCore/dom/EntityReference.idl | 6 +- src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl | 1 - src/3rdparty/webkit/WebCore/dom/Event.cpp | 43 +- src/3rdparty/webkit/WebCore/dom/Event.h | 6 + src/3rdparty/webkit/WebCore/dom/Event.idl | 8 +- src/3rdparty/webkit/WebCore/dom/EventException.idl | 1 - src/3rdparty/webkit/WebCore/dom/EventListener.h | 2 +- src/3rdparty/webkit/WebCore/dom/EventListener.idl | 2 +- src/3rdparty/webkit/WebCore/dom/EventNames.cpp | 2 - src/3rdparty/webkit/WebCore/dom/EventNames.h | 21 +- src/3rdparty/webkit/WebCore/dom/EventTarget.cpp | 35 +- src/3rdparty/webkit/WebCore/dom/EventTarget.h | 24 +- src/3rdparty/webkit/WebCore/dom/EventTarget.idl | 2 +- src/3rdparty/webkit/WebCore/dom/InputElement.cpp | 1 + src/3rdparty/webkit/WebCore/dom/InputElement.h | 8 +- src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp | 1 - src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h | 4 +- src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl | 4 +- .../webkit/WebCore/dom/MappedAttributeEntry.h | 6 +- src/3rdparty/webkit/WebCore/dom/MessageChannel.idl | 2 +- src/3rdparty/webkit/WebCore/dom/MessageEvent.idl | 3 +- src/3rdparty/webkit/WebCore/dom/MessagePort.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/MessagePort.h | 6 +- src/3rdparty/webkit/WebCore/dom/MessagePort.idl | 1 - .../webkit/WebCore/dom/MessagePortChannel.h | 4 +- src/3rdparty/webkit/WebCore/dom/MouseEvent.idl | 4 +- .../webkit/WebCore/dom/MouseRelatedEvent.cpp | 2 +- .../webkit/WebCore/dom/MouseRelatedEvent.h | 2 - src/3rdparty/webkit/WebCore/dom/MutationEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp | 39 +- src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h | 33 + .../webkit/WebCore/dom/NamedMappedAttrMap.h | 6 +- src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl | 5 +- src/3rdparty/webkit/WebCore/dom/Node.cpp | 319 +- src/3rdparty/webkit/WebCore/dom/Node.h | 27 +- src/3rdparty/webkit/WebCore/dom/Node.idl | 7 +- src/3rdparty/webkit/WebCore/dom/NodeFilter.h | 5 +- src/3rdparty/webkit/WebCore/dom/NodeFilter.idl | 2 +- src/3rdparty/webkit/WebCore/dom/NodeIterator.h | 7 +- src/3rdparty/webkit/WebCore/dom/NodeIterator.idl | 3 +- src/3rdparty/webkit/WebCore/dom/NodeList.idl | 5 +- src/3rdparty/webkit/WebCore/dom/NodeRareData.h | 4 +- src/3rdparty/webkit/WebCore/dom/Notation.idl | 6 +- src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl | 4 +- .../webkit/WebCore/dom/PageTransitionEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp | 50 + src/3rdparty/webkit/WebCore/dom/PopStateEvent.h | 57 + src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl | 38 + src/3rdparty/webkit/WebCore/dom/Position.cpp | 102 +- src/3rdparty/webkit/WebCore/dom/Position.h | 12 +- .../webkit/WebCore/dom/PositionIterator.cpp | 12 +- .../webkit/WebCore/dom/ProcessingInstruction.cpp | 17 +- .../webkit/WebCore/dom/ProcessingInstruction.h | 4 +- .../webkit/WebCore/dom/ProcessingInstruction.idl | 9 +- src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp | 12 +- src/3rdparty/webkit/WebCore/dom/QualifiedName.h | 6 +- src/3rdparty/webkit/WebCore/dom/Range.cpp | 44 +- src/3rdparty/webkit/WebCore/dom/Range.h | 8 + src/3rdparty/webkit/WebCore/dom/Range.idl | 2 +- src/3rdparty/webkit/WebCore/dom/RangeException.h | 2 - src/3rdparty/webkit/WebCore/dom/RangeException.idl | 4 +- src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp | 16 +- .../webkit/WebCore/dom/ScriptExecutionContext.cpp | 72 +- .../webkit/WebCore/dom/ScriptExecutionContext.h | 33 +- src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 35 +- src/3rdparty/webkit/WebCore/dom/SelectElement.h | 2 +- .../webkit/WebCore/dom/SelectorNodeList.cpp | 1 - .../webkit/WebCore/dom/SpaceSplitString.cpp | 92 + src/3rdparty/webkit/WebCore/dom/SpaceSplitString.h | 89 + src/3rdparty/webkit/WebCore/dom/StyleElement.cpp | 2 +- src/3rdparty/webkit/WebCore/dom/StyleElement.h | 2 - src/3rdparty/webkit/WebCore/dom/StyledElement.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/StyledElement.h | 2 +- src/3rdparty/webkit/WebCore/dom/Text.idl | 6 +- src/3rdparty/webkit/WebCore/dom/TextEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/Tokenizer.h | 4 +- src/3rdparty/webkit/WebCore/dom/Touch.cpp | 72 + src/3rdparty/webkit/WebCore/dom/Touch.h | 75 + src/3rdparty/webkit/WebCore/dom/Touch.idl | 40 + src/3rdparty/webkit/WebCore/dom/TouchEvent.cpp | 67 + src/3rdparty/webkit/WebCore/dom/TouchEvent.h | 82 + src/3rdparty/webkit/WebCore/dom/TouchEvent.idl | 53 + src/3rdparty/webkit/WebCore/dom/TouchList.cpp | 43 + src/3rdparty/webkit/WebCore/dom/TouchList.h | 60 + src/3rdparty/webkit/WebCore/dom/TouchList.idl | 36 + .../webkit/WebCore/dom/TransformSourceLibxslt.cpp | 4 + src/3rdparty/webkit/WebCore/dom/TreeWalker.h | 17 +- src/3rdparty/webkit/WebCore/dom/TreeWalker.idl | 3 +- src/3rdparty/webkit/WebCore/dom/UIEvent.idl | 4 +- .../webkit/WebCore/dom/WebKitAnimationEvent.idl | 4 +- .../webkit/WebCore/dom/WebKitTransitionEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/WheelEvent.idl | 4 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp | 7 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.h | 28 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 113 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 145 +- .../dom/default/PlatformMessagePortChannel.cpp | 3 +- .../dom/default/PlatformMessagePortChannel.h | 21 +- src/3rdparty/webkit/WebCore/dom/make_names.pl | 197 +- .../webkit/WebCore/editing/AppendNodeCommand.cpp | 6 + .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 12 +- .../WebCore/editing/CompositeEditCommand.cpp | 24 +- .../WebCore/editing/DeleteButtonController.cpp | 8 +- .../WebCore/editing/DeleteButtonController.h | 2 +- .../WebCore/editing/DeleteFromTextNodeCommand.cpp | 6 + .../WebCore/editing/DeleteSelectionCommand.cpp | 17 +- src/3rdparty/webkit/WebCore/editing/Editor.cpp | 89 +- .../webkit/WebCore/editing/EditorCommand.cpp | 5 +- .../WebCore/editing/IndentOutdentCommand.cpp | 82 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 4 +- .../WebCore/editing/InsertIntoTextNodeCommand.cpp | 6 + .../WebCore/editing/InsertNodeBeforeCommand.cpp | 5 +- .../editing/InsertParagraphSeparatorCommand.cpp | 24 +- .../WebCore/editing/JoinTextNodesCommand.cpp | 6 +- .../editing/MergeIdenticalElementsCommand.cpp | 4 +- .../webkit/WebCore/editing/RemoveNodeCommand.cpp | 4 +- .../WebCore/editing/ReplaceSelectionCommand.cpp | 114 +- .../WebCore/editing/ReplaceSelectionCommand.h | 2 + .../webkit/WebCore/editing/SelectionController.cpp | 347 +- .../webkit/WebCore/editing/SelectionController.h | 86 +- .../webkit/WebCore/editing/SplitElementCommand.cpp | 35 +- .../webkit/WebCore/editing/SplitElementCommand.h | 2 + .../WebCore/editing/SplitTextNodeCommand.cpp | 9 +- .../webkit/WebCore/editing/TextIterator.cpp | 319 +- .../webkit/WebCore/editing/TypingCommand.cpp | 8 +- .../webkit/WebCore/editing/VisibleSelection.cpp | 4 +- .../webkit/WebCore/editing/VisibleSelection.h | 6 +- .../editing/WrapContentsInDummySpanCommand.cpp | 40 +- .../editing/WrapContentsInDummySpanCommand.h | 2 + .../WebCore/editing/android/EditorAndroid.cpp | 39 - .../WebCore/editing/chromium/EditorChromium.cpp | 44 - .../WebCore/editing/gtk/SelectionControllerGtk.cpp | 45 - .../webkit/WebCore/editing/htmlediting.cpp | 43 +- src/3rdparty/webkit/WebCore/editing/htmlediting.h | 5 +- src/3rdparty/webkit/WebCore/editing/markup.cpp | 31 +- src/3rdparty/webkit/WebCore/editing/markup.h | 5 +- .../webkit/WebCore/editing/visible_units.cpp | 11 +- .../webkit/WebCore/generated/ArrayPrototype.lut.h | 34 - .../webkit/WebCore/generated/CSSGrammar.cpp | 3043 +- src/3rdparty/webkit/WebCore/generated/CSSGrammar.h | 110 +- .../webkit/WebCore/generated/CSSPropertyNames.cpp | 1216 +- .../webkit/WebCore/generated/CSSPropertyNames.h | 224 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 2854 +- .../webkit/WebCore/generated/CSSValueKeywords.h | 847 +- src/3rdparty/webkit/WebCore/generated/ColorData.c | 5 +- .../webkit/WebCore/generated/DatePrototype.lut.h | 59 - .../webkit/WebCore/generated/DocTypeStrings.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 5607 -- src/3rdparty/webkit/WebCore/generated/Grammar.h | 173 - .../webkit/WebCore/generated/HTMLEntityNames.c | 5 +- .../webkit/WebCore/generated/HTMLNames.cpp | 1181 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 29 +- .../webkit/WebCore/generated/JSAbstractWorker.cpp | 19 +- .../webkit/WebCore/generated/JSAbstractWorker.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSAttr.cpp | 29 +- src/3rdparty/webkit/WebCore/generated/JSAttr.h | 5 +- .../webkit/WebCore/generated/JSBarInfo.cpp | 3 +- src/3rdparty/webkit/WebCore/generated/JSBarInfo.h | 5 +- .../webkit/WebCore/generated/JSBeforeLoadEvent.cpp | 5 +- .../webkit/WebCore/generated/JSBeforeLoadEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSBlob.cpp | 174 + src/3rdparty/webkit/WebCore/generated/JSBlob.h | 82 + .../webkit/WebCore/generated/JSCDATASection.cpp | 2 +- .../webkit/WebCore/generated/JSCDATASection.h | 4 +- .../webkit/WebCore/generated/JSCSSCharsetRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSCharsetRule.h | 4 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.h | 4 +- .../webkit/WebCore/generated/JSCSSImportRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSImportRule.h | 4 +- .../webkit/WebCore/generated/JSCSSMediaRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSMediaRule.h | 4 +- .../webkit/WebCore/generated/JSCSSPageRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSPageRule.h | 4 +- .../WebCore/generated/JSCSSPrimitiveValue.cpp | 5 +- .../webkit/WebCore/generated/JSCSSPrimitiveValue.h | 4 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 17 +- src/3rdparty/webkit/WebCore/generated/JSCSSRule.h | 5 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 9 +- .../webkit/WebCore/generated/JSCSSRuleList.h | 7 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 23 +- .../WebCore/generated/JSCSSStyleDeclaration.h | 7 +- .../webkit/WebCore/generated/JSCSSStyleRule.cpp | 11 +- .../webkit/WebCore/generated/JSCSSStyleRule.h | 4 +- .../webkit/WebCore/generated/JSCSSStyleSheet.cpp | 11 +- .../webkit/WebCore/generated/JSCSSStyleSheet.h | 4 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSCSSValue.h | 5 +- .../webkit/WebCore/generated/JSCSSValueList.cpp | 9 +- .../webkit/WebCore/generated/JSCSSValueList.h | 6 +- .../generated/JSCSSVariablesDeclaration.cpp | 20 +- .../WebCore/generated/JSCSSVariablesDeclaration.h | 7 +- .../WebCore/generated/JSCSSVariablesRule.cpp | 8 +- .../webkit/WebCore/generated/JSCSSVariablesRule.h | 4 +- .../webkit/WebCore/generated/JSCanvasArray.cpp | 155 - .../webkit/WebCore/generated/JSCanvasArray.h | 91 - .../WebCore/generated/JSCanvasArrayBuffer.cpp | 120 - .../webkit/WebCore/generated/JSCanvasArrayBuffer.h | 85 - .../webkit/WebCore/generated/JSCanvasByteArray.cpp | 137 - .../webkit/WebCore/generated/JSCanvasByteArray.h | 85 - .../WebCore/generated/JSCanvasFloatArray.cpp | 137 - .../webkit/WebCore/generated/JSCanvasFloatArray.h | 85 - .../webkit/WebCore/generated/JSCanvasGradient.h | 5 +- .../webkit/WebCore/generated/JSCanvasIntArray.cpp | 137 - .../webkit/WebCore/generated/JSCanvasIntArray.h | 85 - .../webkit/WebCore/generated/JSCanvasPattern.h | 5 +- .../WebCore/generated/JSCanvasRenderingContext.cpp | 5 +- .../WebCore/generated/JSCanvasRenderingContext.h | 5 +- .../generated/JSCanvasRenderingContext2D.cpp | 80 +- .../WebCore/generated/JSCanvasRenderingContext2D.h | 4 +- .../generated/JSCanvasRenderingContext3D.cpp | 4528 - .../WebCore/generated/JSCanvasRenderingContext3D.h | 555 - .../WebCore/generated/JSCanvasShortArray.cpp | 137 - .../webkit/WebCore/generated/JSCanvasShortArray.h | 85 - .../generated/JSCanvasUnsignedByteArray.cpp | 137 - .../WebCore/generated/JSCanvasUnsignedByteArray.h | 85 - .../WebCore/generated/JSCanvasUnsignedIntArray.cpp | 137 - .../WebCore/generated/JSCanvasUnsignedIntArray.h | 85 - .../generated/JSCanvasUnsignedShortArray.cpp | 137 - .../WebCore/generated/JSCanvasUnsignedShortArray.h | 85 - .../webkit/WebCore/generated/JSCharacterData.cpp | 11 +- .../webkit/WebCore/generated/JSCharacterData.h | 4 +- .../webkit/WebCore/generated/JSClientRect.cpp | 20 +- .../webkit/WebCore/generated/JSClientRect.h | 5 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 9 +- .../webkit/WebCore/generated/JSClientRectList.h | 7 +- .../webkit/WebCore/generated/JSClipboard.cpp | 17 +- .../webkit/WebCore/generated/JSClipboard.h | 5 +- .../webkit/WebCore/generated/JSComment.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSComment.h | 4 +- .../WebCore/generated/JSCompositionEvent.cpp | 191 + .../webkit/WebCore/generated/JSCompositionEvent.h | 78 + .../webkit/WebCore/generated/JSConsole.cpp | 18 +- src/3rdparty/webkit/WebCore/generated/JSConsole.h | 6 +- .../webkit/WebCore/generated/JSCoordinates.cpp | 9 +- .../webkit/WebCore/generated/JSCoordinates.h | 5 +- .../webkit/WebCore/generated/JSCounter.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSCounter.h | 5 +- .../WebCore/generated/JSDOMApplicationCache.cpp | 97 +- .../WebCore/generated/JSDOMApplicationCache.h | 5 +- .../WebCore/generated/JSDOMCoreException.cpp | 11 +- .../webkit/WebCore/generated/JSDOMCoreException.h | 5 +- .../WebCore/generated/JSDOMImplementation.cpp | 2 +- .../webkit/WebCore/generated/JSDOMImplementation.h | 5 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 2 +- .../webkit/WebCore/generated/JSDOMParser.h | 5 +- .../webkit/WebCore/generated/JSDOMSelection.cpp | 33 +- .../webkit/WebCore/generated/JSDOMSelection.h | 5 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 4283 +- .../webkit/WebCore/generated/JSDOMWindow.h | 286 +- .../webkit/WebCore/generated/JSDOMWindowBase.lut.h | 0 .../webkit/WebCore/generated/JSDataGridColumn.cpp | 38 +- .../webkit/WebCore/generated/JSDataGridColumn.h | 5 +- .../WebCore/generated/JSDataGridColumnList.cpp | 15 +- .../WebCore/generated/JSDataGridColumnList.h | 7 +- .../webkit/WebCore/generated/JSDatabase.cpp | 3 +- src/3rdparty/webkit/WebCore/generated/JSDatabase.h | 5 +- .../WebCore/generated/JSDedicatedWorkerContext.cpp | 9 +- .../WebCore/generated/JSDedicatedWorkerContext.h | 4 +- .../webkit/WebCore/generated/JSDocument.cpp | 653 +- src/3rdparty/webkit/WebCore/generated/JSDocument.h | 13 +- .../WebCore/generated/JSDocumentFragment.cpp | 2 +- .../webkit/WebCore/generated/JSDocumentFragment.h | 4 +- .../webkit/WebCore/generated/JSDocumentType.cpp | 20 +- .../webkit/WebCore/generated/JSDocumentType.h | 4 +- .../webkit/WebCore/generated/JSElement.cpp | 591 +- src/3rdparty/webkit/WebCore/generated/JSElement.h | 12 +- src/3rdparty/webkit/WebCore/generated/JSEntity.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSEntity.h | 4 +- .../webkit/WebCore/generated/JSEntityReference.cpp | 2 +- .../webkit/WebCore/generated/JSEntityReference.h | 4 +- .../webkit/WebCore/generated/JSErrorEvent.cpp | 11 +- .../webkit/WebCore/generated/JSErrorEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 38 +- src/3rdparty/webkit/WebCore/generated/JSEvent.h | 5 +- .../webkit/WebCore/generated/JSEventException.cpp | 11 +- .../webkit/WebCore/generated/JSEventException.h | 5 +- .../webkit/WebCore/generated/JSEventSource.cpp | 45 +- .../webkit/WebCore/generated/JSEventSource.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 36 +- src/3rdparty/webkit/WebCore/generated/JSFile.h | 24 +- .../webkit/WebCore/generated/JSFileList.cpp | 9 +- src/3rdparty/webkit/WebCore/generated/JSFileList.h | 7 +- .../webkit/WebCore/generated/JSGeolocation.cpp | 3 +- .../webkit/WebCore/generated/JSGeolocation.h | 5 +- .../webkit/WebCore/generated/JSGeoposition.cpp | 6 +- .../webkit/WebCore/generated/JSGeoposition.h | 5 +- .../WebCore/generated/JSHTMLAllCollection.cpp | 9 +- .../webkit/WebCore/generated/JSHTMLAllCollection.h | 7 +- .../WebCore/generated/JSHTMLAnchorElement.cpp | 155 +- .../webkit/WebCore/generated/JSHTMLAnchorElement.h | 11 +- .../WebCore/generated/JSHTMLAppletElement.cpp | 68 +- .../webkit/WebCore/generated/JSHTMLAppletElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLAreaElement.cpp | 65 +- .../webkit/WebCore/generated/JSHTMLAreaElement.h | 4 +- .../WebCore/generated/JSHTMLAudioElement.cpp | 2 +- .../webkit/WebCore/generated/JSHTMLAudioElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBRElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLBRElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBaseElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLBaseElement.h | 4 +- .../WebCore/generated/JSHTMLBaseFontElement.cpp | 20 +- .../WebCore/generated/JSHTMLBaseFontElement.h | 4 +- .../WebCore/generated/JSHTMLBlockquoteElement.cpp | 8 +- .../WebCore/generated/JSHTMLBlockquoteElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 152 +- .../webkit/WebCore/generated/JSHTMLBodyElement.h | 6 +- .../WebCore/generated/JSHTMLButtonElement.cpp | 62 +- .../webkit/WebCore/generated/JSHTMLButtonElement.h | 5 +- .../WebCore/generated/JSHTMLCanvasElement.cpp | 22 +- .../webkit/WebCore/generated/JSHTMLCanvasElement.h | 7 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 9 +- .../webkit/WebCore/generated/JSHTMLCollection.h | 7 +- .../WebCore/generated/JSHTMLDListElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLDListElement.h | 4 +- .../generated/JSHTMLDataGridCellElement.cpp | 32 +- .../WebCore/generated/JSHTMLDataGridCellElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridColElement.cpp | 32 +- .../WebCore/generated/JSHTMLDataGridColElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridElement.cpp | 23 +- .../WebCore/generated/JSHTMLDataGridElement.h | 4 +- .../WebCore/generated/JSHTMLDataGridRowElement.cpp | 20 +- .../WebCore/generated/JSHTMLDataGridRowElement.h | 4 +- .../WebCore/generated/JSHTMLDataListElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataListElement.h | 4 +- .../WebCore/generated/JSHTMLDirectoryElement.cpp | 8 +- .../WebCore/generated/JSHTMLDirectoryElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLDivElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLDivElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLDocument.cpp | 65 +- .../webkit/WebCore/generated/JSHTMLDocument.h | 4 +- .../webkit/WebCore/generated/JSHTMLElement.cpp | 80 +- .../webkit/WebCore/generated/JSHTMLElement.h | 4 +- .../generated/JSHTMLElementWrapperFactory.cpp | 2 +- .../WebCore/generated/JSHTMLEmbedElement.cpp | 38 +- .../webkit/WebCore/generated/JSHTMLEmbedElement.h | 4 +- .../WebCore/generated/JSHTMLFieldSetElement.cpp | 27 +- .../WebCore/generated/JSHTMLFieldSetElement.h | 5 +- .../webkit/WebCore/generated/JSHTMLFontElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLFontElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLFormElement.cpp | 60 +- .../webkit/WebCore/generated/JSHTMLFormElement.h | 6 +- .../WebCore/generated/JSHTMLFrameElement.cpp | 59 +- .../webkit/WebCore/generated/JSHTMLFrameElement.h | 4 +- .../WebCore/generated/JSHTMLFrameSetElement.cpp | 128 +- .../WebCore/generated/JSHTMLFrameSetElement.h | 6 +- .../webkit/WebCore/generated/JSHTMLHRElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLHRElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLHeadElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLHeadElement.h | 4 +- .../WebCore/generated/JSHTMLHeadingElement.cpp | 8 +- .../WebCore/generated/JSHTMLHeadingElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.h | 4 +- .../WebCore/generated/JSHTMLIFrameElement.cpp | 81 +- .../webkit/WebCore/generated/JSHTMLIFrameElement.h | 6 +- .../WebCore/generated/JSHTMLImageElement.cpp | 95 +- .../webkit/WebCore/generated/JSHTMLImageElement.h | 4 +- .../WebCore/generated/JSHTMLInputElement.cpp | 290 +- .../webkit/WebCore/generated/JSHTMLInputElement.h | 13 +- .../WebCore/generated/JSHTMLIsIndexElement.cpp | 11 +- .../WebCore/generated/JSHTMLIsIndexElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLLIElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLLIElement.h | 4 +- .../WebCore/generated/JSHTMLLabelElement.cpp | 17 +- .../webkit/WebCore/generated/JSHTMLLabelElement.h | 4 +- .../WebCore/generated/JSHTMLLegendElement.cpp | 17 +- .../webkit/WebCore/generated/JSHTMLLegendElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLLinkElement.cpp | 59 +- .../webkit/WebCore/generated/JSHTMLLinkElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLMapElement.cpp | 11 +- .../webkit/WebCore/generated/JSHTMLMapElement.h | 4 +- .../WebCore/generated/JSHTMLMarqueeElement.cpp | 2 +- .../WebCore/generated/JSHTMLMarqueeElement.h | 4 +- .../WebCore/generated/JSHTMLMediaElement.cpp | 141 +- .../webkit/WebCore/generated/JSHTMLMediaElement.h | 7 +- .../webkit/WebCore/generated/JSHTMLMenuElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLMenuElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLMetaElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLMetaElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLModElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLModElement.h | 4 +- .../WebCore/generated/JSHTMLOListElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLOListElement.h | 4 +- .../WebCore/generated/JSHTMLObjectElement.cpp | 104 +- .../webkit/WebCore/generated/JSHTMLObjectElement.h | 4 +- .../WebCore/generated/JSHTMLOptGroupElement.cpp | 14 +- .../WebCore/generated/JSHTMLOptGroupElement.h | 4 +- .../WebCore/generated/JSHTMLOptionElement.cpp | 44 +- .../webkit/WebCore/generated/JSHTMLOptionElement.h | 4 +- .../WebCore/generated/JSHTMLOptionsCollection.cpp | 70 +- .../WebCore/generated/JSHTMLOptionsCollection.h | 6 +- .../WebCore/generated/JSHTMLParagraphElement.cpp | 8 +- .../WebCore/generated/JSHTMLParagraphElement.h | 4 +- .../WebCore/generated/JSHTMLParamElement.cpp | 26 +- .../webkit/WebCore/generated/JSHTMLParamElement.h | 4 +- .../webkit/WebCore/generated/JSHTMLPreElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLPreElement.h | 4 +- .../WebCore/generated/JSHTMLQuoteElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLQuoteElement.h | 4 +- .../WebCore/generated/JSHTMLScriptElement.cpp | 44 +- .../webkit/WebCore/generated/JSHTMLScriptElement.h | 4 +- .../WebCore/generated/JSHTMLSelectElement.cpp | 81 +- .../webkit/WebCore/generated/JSHTMLSelectElement.h | 7 +- .../WebCore/generated/JSHTMLSourceElement.cpp | 20 +- .../webkit/WebCore/generated/JSHTMLSourceElement.h | 4 +- .../WebCore/generated/JSHTMLStyleElement.cpp | 23 +- .../webkit/WebCore/generated/JSHTMLStyleElement.h | 4 +- .../generated/JSHTMLTableCaptionElement.cpp | 8 +- .../WebCore/generated/JSHTMLTableCaptionElement.h | 4 +- .../WebCore/generated/JSHTMLTableCellElement.cpp | 89 +- .../WebCore/generated/JSHTMLTableCellElement.h | 4 +- .../WebCore/generated/JSHTMLTableColElement.cpp | 38 +- .../WebCore/generated/JSHTMLTableColElement.h | 4 +- .../WebCore/generated/JSHTMLTableElement.cpp | 80 +- .../webkit/WebCore/generated/JSHTMLTableElement.h | 4 +- .../WebCore/generated/JSHTMLTableRowElement.cpp | 41 +- .../WebCore/generated/JSHTMLTableRowElement.h | 4 +- .../generated/JSHTMLTableSectionElement.cpp | 29 +- .../WebCore/generated/JSHTMLTableSectionElement.h | 4 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 117 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 5 +- .../WebCore/generated/JSHTMLTitleElement.cpp | 8 +- .../webkit/WebCore/generated/JSHTMLTitleElement.h | 4 +- .../WebCore/generated/JSHTMLUListElement.cpp | 14 +- .../webkit/WebCore/generated/JSHTMLUListElement.h | 4 +- .../WebCore/generated/JSHTMLVideoElement.cpp | 95 +- .../webkit/WebCore/generated/JSHTMLVideoElement.h | 14 +- .../webkit/WebCore/generated/JSHistory.cpp | 27 +- src/3rdparty/webkit/WebCore/generated/JSHistory.h | 13 +- .../webkit/WebCore/generated/JSImageData.cpp | 8 +- .../webkit/WebCore/generated/JSImageData.h | 5 +- .../WebCore/generated/JSInjectedScriptHost.cpp | 316 + .../WebCore/generated/JSInjectedScriptHost.h | 111 + .../WebCore/generated/JSInspectorBackend.cpp | 528 +- .../webkit/WebCore/generated/JSInspectorBackend.h | 77 +- .../WebCore/generated/JSInspectorFrontendHost.cpp | 355 + .../WebCore/generated/JSInspectorFrontendHost.h | 105 + .../WebCore/generated/JSJavaScriptCallFrame.cpp | 12 +- .../WebCore/generated/JSJavaScriptCallFrame.h | 5 +- .../webkit/WebCore/generated/JSKeyboardEvent.cpp | 23 +- .../webkit/WebCore/generated/JSKeyboardEvent.h | 4 +- .../webkit/WebCore/generated/JSLocation.cpp | 24 +- src/3rdparty/webkit/WebCore/generated/JSLocation.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSMedia.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSMedia.h | 5 +- .../webkit/WebCore/generated/JSMediaError.cpp | 5 +- .../webkit/WebCore/generated/JSMediaError.h | 5 +- .../webkit/WebCore/generated/JSMediaList.cpp | 17 +- .../webkit/WebCore/generated/JSMediaList.h | 7 +- .../webkit/WebCore/generated/JSMessageChannel.cpp | 6 +- .../webkit/WebCore/generated/JSMessageChannel.h | 5 +- .../webkit/WebCore/generated/JSMessageEvent.cpp | 19 +- .../webkit/WebCore/generated/JSMessageEvent.h | 9 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 17 +- .../webkit/WebCore/generated/JSMessagePort.h | 5 +- .../webkit/WebCore/generated/JSMimeType.cpp | 14 +- src/3rdparty/webkit/WebCore/generated/JSMimeType.h | 5 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 9 +- .../webkit/WebCore/generated/JSMimeTypeArray.h | 7 +- .../webkit/WebCore/generated/JSMouseEvent.cpp | 53 +- .../webkit/WebCore/generated/JSMouseEvent.h | 4 +- .../webkit/WebCore/generated/JSMutationEvent.cpp | 17 +- .../webkit/WebCore/generated/JSMutationEvent.h | 4 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 9 +- .../webkit/WebCore/generated/JSNamedNodeMap.h | 7 +- .../webkit/WebCore/generated/JSNavigator.cpp | 84 +- .../webkit/WebCore/generated/JSNavigator.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 64 +- src/3rdparty/webkit/WebCore/generated/JSNode.h | 5 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 2 +- .../webkit/WebCore/generated/JSNodeFilter.h | 5 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 20 +- .../webkit/WebCore/generated/JSNodeIterator.h | 5 +- .../webkit/WebCore/generated/JSNodeList.cpp | 9 +- src/3rdparty/webkit/WebCore/generated/JSNodeList.h | 7 +- .../webkit/WebCore/generated/JSNotation.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSNotation.h | 4 +- .../webkit/WebCore/generated/JSONObject.lut.h | 15 - .../webkit/WebCore/generated/JSOverflowEvent.cpp | 11 +- .../webkit/WebCore/generated/JSOverflowEvent.h | 4 +- .../WebCore/generated/JSPageTransitionEvent.cpp | 5 +- .../WebCore/generated/JSPageTransitionEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 18 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.h | 7 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 9 +- .../webkit/WebCore/generated/JSPluginArray.h | 7 +- .../webkit/WebCore/generated/JSPopStateEvent.cpp | 181 + .../webkit/WebCore/generated/JSPopStateEvent.h | 81 + .../webkit/WebCore/generated/JSPositionError.cpp | 23 +- .../webkit/WebCore/generated/JSPositionError.h | 6 +- .../WebCore/generated/JSProcessingInstruction.cpp | 14 +- .../WebCore/generated/JSProcessingInstruction.h | 4 +- .../webkit/WebCore/generated/JSProgressEvent.cpp | 11 +- .../webkit/WebCore/generated/JSProgressEvent.h | 4 +- .../webkit/WebCore/generated/JSRGBColor.cpp | 11 +- src/3rdparty/webkit/WebCore/generated/JSRGBColor.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 2 +- src/3rdparty/webkit/WebCore/generated/JSRange.h | 5 +- .../webkit/WebCore/generated/JSRangeException.cpp | 11 +- .../webkit/WebCore/generated/JSRangeException.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 14 +- src/3rdparty/webkit/WebCore/generated/JSRect.h | 5 +- .../webkit/WebCore/generated/JSSQLError.cpp | 6 +- src/3rdparty/webkit/WebCore/generated/JSSQLError.h | 5 +- .../webkit/WebCore/generated/JSSQLResultSet.cpp | 6 +- .../webkit/WebCore/generated/JSSQLResultSet.h | 5 +- .../WebCore/generated/JSSQLResultSetRowList.cpp | 3 +- .../WebCore/generated/JSSQLResultSetRowList.h | 5 +- .../webkit/WebCore/generated/JSSQLTransaction.h | 5 +- .../webkit/WebCore/generated/JSSVGAElement.cpp | 115 +- .../webkit/WebCore/generated/JSSVGAElement.h | 6 +- .../WebCore/generated/JSSVGAltGlyphElement.cpp | 77 +- .../WebCore/generated/JSSVGAltGlyphElement.h | 6 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 78 +- src/3rdparty/webkit/WebCore/generated/JSSVGAngle.h | 23 +- .../WebCore/generated/JSSVGAnimateColorElement.cpp | 84 +- .../WebCore/generated/JSSVGAnimateColorElement.h | 12 +- .../WebCore/generated/JSSVGAnimateElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGAnimateElement.h | 12 +- .../generated/JSSVGAnimateTransformElement.cpp | 84 +- .../generated/JSSVGAnimateTransformElement.h | 12 +- .../WebCore/generated/JSSVGAnimatedAngle.cpp | 76 +- .../webkit/WebCore/generated/JSSVGAnimatedAngle.h | 13 +- .../WebCore/generated/JSSVGAnimatedBoolean.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedBoolean.h | 13 +- .../WebCore/generated/JSSVGAnimatedEnumeration.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedEnumeration.h | 13 +- .../WebCore/generated/JSSVGAnimatedInteger.cpp | 81 +- .../WebCore/generated/JSSVGAnimatedInteger.h | 13 +- .../WebCore/generated/JSSVGAnimatedLength.cpp | 75 +- .../webkit/WebCore/generated/JSSVGAnimatedLength.h | 13 +- .../WebCore/generated/JSSVGAnimatedLengthList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedLengthList.h | 13 +- .../WebCore/generated/JSSVGAnimatedNumber.cpp | 81 +- .../webkit/WebCore/generated/JSSVGAnimatedNumber.h | 13 +- .../WebCore/generated/JSSVGAnimatedNumberList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedNumberList.h | 13 +- .../generated/JSSVGAnimatedPreserveAspectRatio.cpp | 76 +- .../generated/JSSVGAnimatedPreserveAspectRatio.h | 13 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.cpp | 75 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.h | 13 +- .../WebCore/generated/JSSVGAnimatedString.cpp | 81 +- .../webkit/WebCore/generated/JSSVGAnimatedString.h | 13 +- .../generated/JSSVGAnimatedTransformList.cpp | 75 +- .../WebCore/generated/JSSVGAnimatedTransformList.h | 13 +- .../WebCore/generated/JSSVGAnimationElement.cpp | 15 +- .../WebCore/generated/JSSVGAnimationElement.h | 4 +- .../WebCore/generated/JSSVGCircleElement.cpp | 118 +- .../webkit/WebCore/generated/JSSVGCircleElement.h | 6 +- .../WebCore/generated/JSSVGClipPathElement.cpp | 112 +- .../WebCore/generated/JSSVGClipPathElement.h | 6 +- .../webkit/WebCore/generated/JSSVGColor.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSSVGColor.h | 4 +- .../JSSVGComponentTransferFunctionElement.cpp | 23 +- .../JSSVGComponentTransferFunctionElement.h | 4 +- .../WebCore/generated/JSSVGCursorElement.cpp | 85 +- .../webkit/WebCore/generated/JSSVGCursorElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDefsElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGDefsElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDescElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGDescElement.h | 6 +- .../webkit/WebCore/generated/JSSVGDocument.cpp | 67 +- .../webkit/WebCore/generated/JSSVGDocument.h | 6 +- .../webkit/WebCore/generated/JSSVGElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGElement.h | 6 +- .../WebCore/generated/JSSVGElementInstance.cpp | 526 +- .../WebCore/generated/JSSVGElementInstance.h | 7 +- .../WebCore/generated/JSSVGElementInstanceList.cpp | 67 +- .../WebCore/generated/JSSVGElementInstanceList.h | 7 +- .../generated/JSSVGElementWrapperFactory.cpp | 194 +- .../WebCore/generated/JSSVGEllipseElement.cpp | 121 +- .../webkit/WebCore/generated/JSSVGEllipseElement.h | 6 +- .../webkit/WebCore/generated/JSSVGException.cpp | 20 +- .../webkit/WebCore/generated/JSSVGException.h | 11 +- .../WebCore/generated/JSSVGFEBlendElement.cpp | 32 +- .../webkit/WebCore/generated/JSSVGFEBlendElement.h | 4 +- .../generated/JSSVGFEColorMatrixElement.cpp | 32 +- .../WebCore/generated/JSSVGFEColorMatrixElement.h | 4 +- .../generated/JSSVGFEComponentTransferElement.cpp | 86 +- .../generated/JSSVGFEComponentTransferElement.h | 6 +- .../WebCore/generated/JSSVGFECompositeElement.cpp | 44 +- .../WebCore/generated/JSSVGFECompositeElement.h | 4 +- .../generated/JSSVGFEDiffuseLightingElement.cpp | 98 +- .../generated/JSSVGFEDiffuseLightingElement.h | 6 +- .../generated/JSSVGFEDisplacementMapElement.cpp | 38 +- .../generated/JSSVGFEDisplacementMapElement.h | 4 +- .../generated/JSSVGFEDistantLightElement.cpp | 68 +- .../WebCore/generated/JSSVGFEDistantLightElement.h | 6 +- .../WebCore/generated/JSSVGFEFloodElement.cpp | 23 +- .../webkit/WebCore/generated/JSSVGFEFloodElement.h | 4 +- .../WebCore/generated/JSSVGFEFuncAElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncAElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncBElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncBElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncGElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncGElement.h | 12 +- .../WebCore/generated/JSSVGFEFuncRElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFEFuncRElement.h | 12 +- .../generated/JSSVGFEGaussianBlurElement.cpp | 90 +- .../WebCore/generated/JSSVGFEGaussianBlurElement.h | 6 +- .../WebCore/generated/JSSVGFEImageElement.cpp | 111 +- .../webkit/WebCore/generated/JSSVGFEImageElement.h | 7 +- .../WebCore/generated/JSSVGFEMergeElement.cpp | 83 +- .../webkit/WebCore/generated/JSSVGFEMergeElement.h | 6 +- .../WebCore/generated/JSSVGFEMergeNodeElement.cpp | 67 +- .../WebCore/generated/JSSVGFEMergeNodeElement.h | 6 +- .../WebCore/generated/JSSVGFEMorphologyElement.cpp | 35 +- .../WebCore/generated/JSSVGFEMorphologyElement.h | 4 +- .../WebCore/generated/JSSVGFEOffsetElement.cpp | 90 +- .../WebCore/generated/JSSVGFEOffsetElement.h | 6 +- .../WebCore/generated/JSSVGFEPointLightElement.cpp | 73 +- .../WebCore/generated/JSSVGFEPointLightElement.h | 6 +- .../generated/JSSVGFESpecularLightingElement.cpp | 93 +- .../generated/JSSVGFESpecularLightingElement.h | 6 +- .../WebCore/generated/JSSVGFESpotLightElement.cpp | 86 +- .../WebCore/generated/JSSVGFESpotLightElement.h | 6 +- .../WebCore/generated/JSSVGFETileElement.cpp | 86 +- .../webkit/WebCore/generated/JSSVGFETileElement.h | 6 +- .../WebCore/generated/JSSVGFETurbulenceElement.cpp | 41 +- .../WebCore/generated/JSSVGFETurbulenceElement.h | 4 +- .../WebCore/generated/JSSVGFilterElement.cpp | 108 +- .../webkit/WebCore/generated/JSSVGFilterElement.h | 6 +- .../webkit/WebCore/generated/JSSVGFontElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGFontElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceElement.h | 12 +- .../generated/JSSVGFontFaceFormatElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceFormatElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceNameElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceNameElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceSrcElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceSrcElement.h | 12 +- .../WebCore/generated/JSSVGFontFaceUriElement.cpp | 84 +- .../WebCore/generated/JSSVGFontFaceUriElement.h | 12 +- .../generated/JSSVGForeignObjectElement.cpp | 121 +- .../WebCore/generated/JSSVGForeignObjectElement.h | 6 +- .../webkit/WebCore/generated/JSSVGGElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGGElement.h | 6 +- .../webkit/WebCore/generated/JSSVGGlyphElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGGlyphElement.h | 12 +- .../WebCore/generated/JSSVGGradientElement.cpp | 23 +- .../WebCore/generated/JSSVGGradientElement.h | 4 +- .../webkit/WebCore/generated/JSSVGHKernElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGHKernElement.h | 12 +- .../webkit/WebCore/generated/JSSVGImageElement.cpp | 125 +- .../webkit/WebCore/generated/JSSVGImageElement.h | 6 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 53 +- .../webkit/WebCore/generated/JSSVGLength.h | 13 +- .../webkit/WebCore/generated/JSSVGLengthList.cpp | 136 +- .../webkit/WebCore/generated/JSSVGLengthList.h | 13 +- .../webkit/WebCore/generated/JSSVGLineElement.cpp | 121 +- .../webkit/WebCore/generated/JSSVGLineElement.h | 6 +- .../generated/JSSVGLinearGradientElement.cpp | 74 +- .../WebCore/generated/JSSVGLinearGradientElement.h | 6 +- .../WebCore/generated/JSSVGMarkerElement.cpp | 52 +- .../webkit/WebCore/generated/JSSVGMarkerElement.h | 4 +- .../webkit/WebCore/generated/JSSVGMaskElement.cpp | 110 +- .../webkit/WebCore/generated/JSSVGMaskElement.h | 6 +- .../webkit/WebCore/generated/JSSVGMatrix.cpp | 211 +- .../webkit/WebCore/generated/JSSVGMatrix.h | 24 +- .../WebCore/generated/JSSVGMetadataElement.cpp | 84 +- .../WebCore/generated/JSSVGMetadataElement.h | 12 +- .../WebCore/generated/JSSVGMissingGlyphElement.cpp | 84 +- .../WebCore/generated/JSSVGMissingGlyphElement.h | 12 +- .../webkit/WebCore/generated/JSSVGNumber.cpp | 80 +- .../webkit/WebCore/generated/JSSVGNumber.h | 15 +- .../webkit/WebCore/generated/JSSVGNumberList.cpp | 136 +- .../webkit/WebCore/generated/JSSVGNumberList.h | 13 +- .../webkit/WebCore/generated/JSSVGPaint.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/JSSVGPaint.h | 4 +- .../webkit/WebCore/generated/JSSVGPathElement.cpp | 130 +- .../webkit/WebCore/generated/JSSVGPathElement.h | 6 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 17 +- .../webkit/WebCore/generated/JSSVGPathSeg.h | 11 +- .../WebCore/generated/JSSVGPathSegArcAbs.cpp | 131 +- .../webkit/WebCore/generated/JSSVGPathSegArcAbs.h | 8 +- .../WebCore/generated/JSSVGPathSegArcRel.cpp | 131 +- .../webkit/WebCore/generated/JSSVGPathSegArcRel.h | 8 +- .../WebCore/generated/JSSVGPathSegClosePath.cpp | 88 +- .../WebCore/generated/JSSVGPathSegClosePath.h | 14 +- .../generated/JSSVGPathSegCurvetoCubicAbs.cpp | 120 +- .../generated/JSSVGPathSegCurvetoCubicAbs.h | 8 +- .../generated/JSSVGPathSegCurvetoCubicRel.cpp | 120 +- .../generated/JSSVGPathSegCurvetoCubicRel.h | 8 +- .../JSSVGPathSegCurvetoCubicSmoothAbs.cpp | 104 +- .../generated/JSSVGPathSegCurvetoCubicSmoothAbs.h | 8 +- .../JSSVGPathSegCurvetoCubicSmoothRel.cpp | 104 +- .../generated/JSSVGPathSegCurvetoCubicSmoothRel.h | 8 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.cpp | 104 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.h | 8 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.cpp | 104 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.h | 8 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp | 86 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.h | 8 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.cpp | 86 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.h | 8 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.cpp | 86 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.h | 8 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.cpp | 77 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.h | 8 +- .../generated/JSSVGPathSegLinetoHorizontalRel.cpp | 77 +- .../generated/JSSVGPathSegLinetoHorizontalRel.h | 8 +- .../WebCore/generated/JSSVGPathSegLinetoRel.cpp | 86 +- .../WebCore/generated/JSSVGPathSegLinetoRel.h | 8 +- .../generated/JSSVGPathSegLinetoVerticalAbs.cpp | 77 +- .../generated/JSSVGPathSegLinetoVerticalAbs.h | 8 +- .../generated/JSSVGPathSegLinetoVerticalRel.cpp | 77 +- .../generated/JSSVGPathSegLinetoVerticalRel.h | 8 +- .../webkit/WebCore/generated/JSSVGPathSegList.cpp | 72 +- .../webkit/WebCore/generated/JSSVGPathSegList.h | 13 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.cpp | 86 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.h | 8 +- .../WebCore/generated/JSSVGPathSegMovetoRel.cpp | 86 +- .../WebCore/generated/JSSVGPathSegMovetoRel.h | 8 +- .../WebCore/generated/JSSVGPatternElement.cpp | 120 +- .../webkit/WebCore/generated/JSSVGPatternElement.h | 6 +- .../webkit/WebCore/generated/JSSVGPoint.cpp | 101 +- src/3rdparty/webkit/WebCore/generated/JSSVGPoint.h | 15 +- .../webkit/WebCore/generated/JSSVGPointList.cpp | 88 +- .../webkit/WebCore/generated/JSSVGPointList.h | 22 +- .../WebCore/generated/JSSVGPolygonElement.cpp | 115 +- .../webkit/WebCore/generated/JSSVGPolygonElement.h | 6 +- .../WebCore/generated/JSSVGPolylineElement.cpp | 115 +- .../WebCore/generated/JSSVGPolylineElement.h | 6 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 47 +- .../WebCore/generated/JSSVGPreserveAspectRatio.h | 23 +- .../generated/JSSVGRadialGradientElement.cpp | 75 +- .../WebCore/generated/JSSVGRadialGradientElement.h | 6 +- .../webkit/WebCore/generated/JSSVGRect.cpp | 114 +- src/3rdparty/webkit/WebCore/generated/JSSVGRect.h | 15 +- .../webkit/WebCore/generated/JSSVGRectElement.cpp | 125 +- .../webkit/WebCore/generated/JSSVGRectElement.h | 6 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 11 +- .../WebCore/generated/JSSVGRenderingIntent.h | 11 +- .../webkit/WebCore/generated/JSSVGSVGElement.cpp | 191 +- .../webkit/WebCore/generated/JSSVGSVGElement.h | 6 +- .../WebCore/generated/JSSVGScriptElement.cpp | 76 +- .../webkit/WebCore/generated/JSSVGScriptElement.h | 6 +- .../webkit/WebCore/generated/JSSVGSetElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGSetElement.h | 12 +- .../webkit/WebCore/generated/JSSVGStopElement.cpp | 69 +- .../webkit/WebCore/generated/JSSVGStopElement.h | 6 +- .../webkit/WebCore/generated/JSSVGStringList.cpp | 72 +- .../webkit/WebCore/generated/JSSVGStringList.h | 13 +- .../webkit/WebCore/generated/JSSVGStyleElement.cpp | 90 +- .../webkit/WebCore/generated/JSSVGStyleElement.h | 6 +- .../WebCore/generated/JSSVGSwitchElement.cpp | 109 +- .../webkit/WebCore/generated/JSSVGSwitchElement.h | 6 +- .../WebCore/generated/JSSVGSymbolElement.cpp | 87 +- .../webkit/WebCore/generated/JSSVGSymbolElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTRefElement.cpp | 67 +- .../webkit/WebCore/generated/JSSVGTRefElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTSpanElement.cpp | 84 +- .../webkit/WebCore/generated/JSSVGTSpanElement.h | 12 +- .../WebCore/generated/JSSVGTextContentElement.cpp | 44 +- .../WebCore/generated/JSSVGTextContentElement.h | 4 +- .../webkit/WebCore/generated/JSSVGTextElement.cpp | 81 +- .../webkit/WebCore/generated/JSSVGTextElement.h | 6 +- .../WebCore/generated/JSSVGTextPathElement.cpp | 14 +- .../WebCore/generated/JSSVGTextPathElement.h | 4 +- .../generated/JSSVGTextPositioningElement.cpp | 79 +- .../generated/JSSVGTextPositioningElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTitleElement.cpp | 80 +- .../webkit/WebCore/generated/JSSVGTitleElement.h | 6 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 70 +- .../webkit/WebCore/generated/JSSVGTransform.h | 13 +- .../WebCore/generated/JSSVGTransformList.cpp | 93 +- .../webkit/WebCore/generated/JSSVGTransformList.h | 22 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 11 +- .../webkit/WebCore/generated/JSSVGUnitTypes.h | 11 +- .../webkit/WebCore/generated/JSSVGUseElement.cpp | 128 +- .../webkit/WebCore/generated/JSSVGUseElement.h | 6 +- .../webkit/WebCore/generated/JSSVGViewElement.cpp | 81 +- .../webkit/WebCore/generated/JSSVGViewElement.h | 6 +- .../webkit/WebCore/generated/JSSVGZoomEvent.cpp | 75 +- .../webkit/WebCore/generated/JSSVGZoomEvent.h | 6 +- src/3rdparty/webkit/WebCore/generated/JSScreen.cpp | 24 +- src/3rdparty/webkit/WebCore/generated/JSScreen.h | 5 +- .../webkit/WebCore/generated/JSSharedWorker.cpp | 3 +- .../webkit/WebCore/generated/JSSharedWorker.h | 4 +- .../WebCore/generated/JSSharedWorkerContext.cpp | 12 +- .../WebCore/generated/JSSharedWorkerContext.h | 4 +- .../webkit/WebCore/generated/JSStorage.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSStorage.h | 7 +- .../webkit/WebCore/generated/JSStorageEvent.cpp | 17 +- .../webkit/WebCore/generated/JSStorageEvent.h | 4 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 26 +- .../webkit/WebCore/generated/JSStyleSheet.h | 5 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 9 +- .../webkit/WebCore/generated/JSStyleSheetList.h | 7 +- src/3rdparty/webkit/WebCore/generated/JSText.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSText.h | 4 +- .../webkit/WebCore/generated/JSTextEvent.cpp | 5 +- .../webkit/WebCore/generated/JSTextEvent.h | 4 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 5 +- .../webkit/WebCore/generated/JSTextMetrics.h | 5 +- .../webkit/WebCore/generated/JSTimeRanges.cpp | 3 +- .../webkit/WebCore/generated/JSTimeRanges.h | 5 +- src/3rdparty/webkit/WebCore/generated/JSTouch.cpp | 251 + src/3rdparty/webkit/WebCore/generated/JSTouch.h | 93 + .../webkit/WebCore/generated/JSTouchEvent.cpp | 264 + .../webkit/WebCore/generated/JSTouchEvent.h | 88 + .../webkit/WebCore/generated/JSTouchList.cpp | 256 + .../webkit/WebCore/generated/JSTouchList.h | 94 + .../webkit/WebCore/generated/JSTreeWalker.cpp | 20 +- .../webkit/WebCore/generated/JSTreeWalker.h | 5 +- .../webkit/WebCore/generated/JSUIEvent.cpp | 29 +- src/3rdparty/webkit/WebCore/generated/JSUIEvent.h | 4 +- .../webkit/WebCore/generated/JSValidityState.cpp | 27 +- .../webkit/WebCore/generated/JSValidityState.h | 5 +- .../webkit/WebCore/generated/JSVoidCallback.h | 5 +- .../webkit/WebCore/generated/JSWebGLArray.cpp | 177 + .../webkit/WebCore/generated/JSWebGLArray.h | 92 + .../WebCore/generated/JSWebGLArrayBuffer.cpp | 121 + .../webkit/WebCore/generated/JSWebGLArrayBuffer.h | 84 + .../webkit/WebCore/generated/JSWebGLByteArray.cpp | 174 + .../webkit/WebCore/generated/JSWebGLByteArray.h | 94 + .../webkit/WebCore/generated/JSWebGLFloatArray.cpp | 174 + .../webkit/WebCore/generated/JSWebGLFloatArray.h | 94 + .../webkit/WebCore/generated/JSWebGLIntArray.cpp | 174 + .../webkit/WebCore/generated/JSWebGLIntArray.h | 94 + .../WebCore/generated/JSWebGLRenderingContext.cpp | 4252 + .../WebCore/generated/JSWebGLRenderingContext.h | 546 + .../webkit/WebCore/generated/JSWebGLShortArray.cpp | 174 + .../webkit/WebCore/generated/JSWebGLShortArray.h | 94 + .../WebCore/generated/JSWebGLUnsignedByteArray.cpp | 174 + .../WebCore/generated/JSWebGLUnsignedByteArray.h | 94 + .../WebCore/generated/JSWebGLUnsignedIntArray.cpp | 174 + .../WebCore/generated/JSWebGLUnsignedIntArray.h | 94 + .../generated/JSWebGLUnsignedShortArray.cpp | 174 + .../WebCore/generated/JSWebGLUnsignedShortArray.h | 94 + .../WebCore/generated/JSWebKitAnimationEvent.cpp | 8 +- .../WebCore/generated/JSWebKitAnimationEvent.h | 4 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.cpp | 11 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.h | 4 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.cpp | 15 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.h | 6 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.cpp | 132 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.h | 5 +- .../generated/JSWebKitCSSTransformValue.cpp | 54 +- .../WebCore/generated/JSWebKitCSSTransformValue.h | 9 +- .../webkit/WebCore/generated/JSWebKitPoint.cpp | 12 +- .../webkit/WebCore/generated/JSWebKitPoint.h | 5 +- .../WebCore/generated/JSWebKitTransitionEvent.cpp | 8 +- .../WebCore/generated/JSWebKitTransitionEvent.h | 4 +- .../webkit/WebCore/generated/JSWebSocket.cpp | 48 +- .../webkit/WebCore/generated/JSWebSocket.h | 5 +- .../webkit/WebCore/generated/JSWheelEvent.cpp | 47 +- .../webkit/WebCore/generated/JSWheelEvent.h | 4 +- src/3rdparty/webkit/WebCore/generated/JSWorker.cpp | 13 +- src/3rdparty/webkit/WebCore/generated/JSWorker.h | 4 +- .../webkit/WebCore/generated/JSWorkerContext.cpp | 36 +- .../webkit/WebCore/generated/JSWorkerContext.h | 7 +- .../WebCore/generated/JSWorkerContextBase.lut.h | 0 .../webkit/WebCore/generated/JSWorkerLocation.cpp | 26 +- .../webkit/WebCore/generated/JSWorkerLocation.h | 5 +- .../webkit/WebCore/generated/JSWorkerNavigator.cpp | 15 +- .../webkit/WebCore/generated/JSWorkerNavigator.h | 5 +- .../webkit/WebCore/generated/JSXMLHttpRequest.cpp | 85 +- .../webkit/WebCore/generated/JSXMLHttpRequest.h | 5 +- .../generated/JSXMLHttpRequestException.cpp | 11 +- .../WebCore/generated/JSXMLHttpRequestException.h | 5 +- .../generated/JSXMLHttpRequestProgressEvent.cpp | 8 +- .../generated/JSXMLHttpRequestProgressEvent.h | 4 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 61 +- .../WebCore/generated/JSXMLHttpRequestUpload.h | 5 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 2 +- .../webkit/WebCore/generated/JSXMLSerializer.h | 5 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 2 +- .../webkit/WebCore/generated/JSXPathEvaluator.h | 5 +- .../webkit/WebCore/generated/JSXPathException.cpp | 11 +- .../webkit/WebCore/generated/JSXPathException.h | 5 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 2 +- .../webkit/WebCore/generated/JSXPathExpression.h | 5 +- .../webkit/WebCore/generated/JSXPathNSResolver.h | 5 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 8 +- .../webkit/WebCore/generated/JSXPathResult.h | 5 +- .../webkit/WebCore/generated/JSXSLTProcessor.h | 5 +- src/3rdparty/webkit/WebCore/generated/Lexer.lut.h | 49 - .../webkit/WebCore/generated/MathObject.lut.h | 31 - .../WebCore/generated/NumberConstructor.lut.h | 18 - .../WebCore/generated/RegExpConstructor.lut.h | 34 - .../webkit/WebCore/generated/RegExpObject.lut.h | 18 - .../webkit/WebCore/generated/SVGElementFactory.cpp | 168 + src/3rdparty/webkit/WebCore/generated/SVGNames.cpp | 969 +- src/3rdparty/webkit/WebCore/generated/SVGNames.h | 321 +- .../webkit/WebCore/generated/StringPrototype.lut.h | 48 - .../WebCore/generated/UserAgentStyleSheets.h | 8 +- .../WebCore/generated/UserAgentStyleSheetsData.cpp | 1144 +- .../webkit/WebCore/generated/WebKitVersion.h | 4 +- .../webkit/WebCore/generated/XLinkNames.cpp | 23 +- src/3rdparty/webkit/WebCore/generated/XLinkNames.h | 7 - .../webkit/WebCore/generated/XMLNSNames.cpp | 81 + src/3rdparty/webkit/WebCore/generated/XMLNSNames.h | 54 + src/3rdparty/webkit/WebCore/generated/XMLNames.cpp | 11 +- .../webkit/WebCore/generated/XPathGrammar.cpp | 514 +- .../webkit/WebCore/generated/XPathGrammar.h | 64 +- src/3rdparty/webkit/WebCore/generated/chartables.c | 96 - .../webkit/WebCore/generated/tokenizer.cpp | 4 +- .../webkit/WebCore/history/BackForwardList.cpp | 44 +- .../webkit/WebCore/history/BackForwardList.h | 7 +- .../WebCore/history/BackForwardListChromium.cpp | 10 + .../webkit/WebCore/history/CachedFrame.cpp | 23 +- src/3rdparty/webkit/WebCore/history/CachedFrame.h | 16 +- src/3rdparty/webkit/WebCore/history/CachedPage.cpp | 1 + src/3rdparty/webkit/WebCore/history/CachedPage.h | 11 +- .../webkit/WebCore/history/HistoryItem.cpp | 56 +- src/3rdparty/webkit/WebCore/history/HistoryItem.h | 29 +- src/3rdparty/webkit/WebCore/html/Blob.cpp | 53 + src/3rdparty/webkit/WebCore/html/Blob.h | 62 + src/3rdparty/webkit/WebCore/html/Blob.idl | 37 + .../webkit/WebCore/html/CollectionCache.cpp | 8 + src/3rdparty/webkit/WebCore/html/CollectionCache.h | 8 +- .../webkit/WebCore/html/DataGridColumn.idl | 1 - .../webkit/WebCore/html/DataGridColumnList.idl | 1 - .../webkit/WebCore/html/DateComponents.cpp | 681 + src/3rdparty/webkit/WebCore/html/DateComponents.h | 190 + src/3rdparty/webkit/WebCore/html/File.cpp | 16 +- src/3rdparty/webkit/WebCore/html/File.h | 30 +- src/3rdparty/webkit/WebCore/html/File.idl | 8 +- src/3rdparty/webkit/WebCore/html/FileList.idl | 1 - .../webkit/WebCore/html/HTMLAllCollection.idl | 1 - .../webkit/WebCore/html/HTMLAnchorElement.cpp | 132 +- .../webkit/WebCore/html/HTMLAnchorElement.h | 14 + .../webkit/WebCore/html/HTMLAnchorElement.idl | 18 +- .../webkit/WebCore/html/HTMLAppletElement.cpp | 21 +- .../webkit/WebCore/html/HTMLAppletElement.h | 1 + .../webkit/WebCore/html/HTMLAppletElement.idl | 5 +- .../webkit/WebCore/html/HTMLAreaElement.cpp | 73 +- src/3rdparty/webkit/WebCore/html/HTMLAreaElement.h | 13 +- .../webkit/WebCore/html/HTMLAreaElement.idl | 6 +- .../webkit/WebCore/html/HTMLAttributeNames.in | 25 +- .../webkit/WebCore/html/HTMLAudioElement.cpp | 20 +- .../webkit/WebCore/html/HTMLAudioElement.h | 10 +- .../webkit/WebCore/html/HTMLAudioElement.idl | 2 +- src/3rdparty/webkit/WebCore/html/HTMLBRElement.idl | 6 +- .../webkit/WebCore/html/HTMLBaseElement.idl | 6 +- .../webkit/WebCore/html/HTMLBaseFontElement.idl | 6 +- .../webkit/WebCore/html/HTMLBlockquoteElement.idl | 6 +- .../webkit/WebCore/html/HTMLBodyElement.cpp | 2 + src/3rdparty/webkit/WebCore/html/HTMLBodyElement.h | 4 +- .../webkit/WebCore/html/HTMLBodyElement.idl | 10 +- .../webkit/WebCore/html/HTMLButtonElement.idl | 9 +- .../webkit/WebCore/html/HTMLCanvasElement.cpp | 39 +- .../webkit/WebCore/html/HTMLCanvasElement.h | 7 +- .../webkit/WebCore/html/HTMLCanvasElement.idl | 8 +- .../webkit/WebCore/html/HTMLCollection.cpp | 10 +- .../webkit/WebCore/html/HTMLCollection.idl | 5 +- .../webkit/WebCore/html/HTMLDListElement.idl | 6 +- .../WebCore/html/HTMLDataGridCellElement.idl | 1 - .../webkit/WebCore/html/HTMLDataGridColElement.cpp | 6 +- .../webkit/WebCore/html/HTMLDataGridColElement.idl | 1 - .../webkit/WebCore/html/HTMLDataGridElement.idl | 1 - .../webkit/WebCore/html/HTMLDataGridRowElement.idl | 1 - .../webkit/WebCore/html/HTMLDataListElement.idl | 1 - .../webkit/WebCore/html/HTMLDirectoryElement.idl | 6 +- .../webkit/WebCore/html/HTMLDivElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.cpp | 7 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.h | 1 - src/3rdparty/webkit/WebCore/html/HTMLDocument.idl | 5 +- src/3rdparty/webkit/WebCore/html/HTMLElement.cpp | 79 +- src/3rdparty/webkit/WebCore/html/HTMLElement.h | 3 +- src/3rdparty/webkit/WebCore/html/HTMLElement.idl | 5 +- .../webkit/WebCore/html/HTMLEmbedElement.cpp | 14 +- .../webkit/WebCore/html/HTMLEmbedElement.idl | 7 +- .../webkit/WebCore/html/HTMLFieldSetElement.idl | 9 +- .../webkit/WebCore/html/HTMLFontElement.idl | 6 +- .../webkit/WebCore/html/HTMLFormCollection.cpp | 14 +- .../webkit/WebCore/html/HTMLFormControlElement.cpp | 56 +- .../webkit/WebCore/html/HTMLFormControlElement.h | 15 +- .../webkit/WebCore/html/HTMLFormElement.cpp | 17 +- src/3rdparty/webkit/WebCore/html/HTMLFormElement.h | 5 +- .../webkit/WebCore/html/HTMLFormElement.idl | 5 +- .../webkit/WebCore/html/HTMLFrameElement.idl | 8 +- .../webkit/WebCore/html/HTMLFrameElementBase.cpp | 59 +- .../webkit/WebCore/html/HTMLFrameElementBase.h | 12 + .../webkit/WebCore/html/HTMLFrameOwnerElement.cpp | 12 + .../webkit/WebCore/html/HTMLFrameOwnerElement.h | 11 +- .../webkit/WebCore/html/HTMLFrameSetElement.cpp | 2 + .../webkit/WebCore/html/HTMLFrameSetElement.h | 1 + .../webkit/WebCore/html/HTMLFrameSetElement.idl | 9 +- src/3rdparty/webkit/WebCore/html/HTMLHRElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLHeadElement.h | 2 - .../webkit/WebCore/html/HTMLHeadElement.idl | 6 +- .../webkit/WebCore/html/HTMLHeadingElement.cpp | 2 - .../webkit/WebCore/html/HTMLHeadingElement.h | 2 - .../webkit/WebCore/html/HTMLHeadingElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLHtmlElement.h | 2 - .../webkit/WebCore/html/HTMLHtmlElement.idl | 6 +- .../webkit/WebCore/html/HTMLIFrameElement.cpp | 52 +- .../webkit/WebCore/html/HTMLIFrameElement.h | 2 - .../webkit/WebCore/html/HTMLIFrameElement.idl | 9 +- .../webkit/WebCore/html/HTMLImageElement.cpp | 53 +- .../webkit/WebCore/html/HTMLImageElement.h | 14 +- .../webkit/WebCore/html/HTMLImageElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLImageLoader.h | 2 - .../webkit/WebCore/html/HTMLInputElement.cpp | 1303 +- .../webkit/WebCore/html/HTMLInputElement.h | 78 +- .../webkit/WebCore/html/HTMLInputElement.idl | 36 +- .../webkit/WebCore/html/HTMLIsIndexElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLLIElement.idl | 6 +- .../webkit/WebCore/html/HTMLLabelElement.idl | 6 +- .../webkit/WebCore/html/HTMLLegendElement.idl | 6 +- .../webkit/WebCore/html/HTMLLinkElement.cpp | 35 +- src/3rdparty/webkit/WebCore/html/HTMLLinkElement.h | 2 +- .../webkit/WebCore/html/HTMLLinkElement.idl | 8 +- .../webkit/WebCore/html/HTMLMapElement.cpp | 24 +- src/3rdparty/webkit/WebCore/html/HTMLMapElement.h | 6 +- .../webkit/WebCore/html/HTMLMapElement.idl | 6 +- .../webkit/WebCore/html/HTMLMarqueeElement.cpp | 25 +- .../webkit/WebCore/html/HTMLMarqueeElement.h | 4 + .../webkit/WebCore/html/HTMLMarqueeElement.idl | 6 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 338 +- .../webkit/WebCore/html/HTMLMediaElement.h | 43 +- .../webkit/WebCore/html/HTMLMediaElement.idl | 13 +- .../webkit/WebCore/html/HTMLMenuElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLMetaElement.h | 2 - .../webkit/WebCore/html/HTMLMetaElement.idl | 6 +- .../webkit/WebCore/html/HTMLModElement.cpp | 2 - src/3rdparty/webkit/WebCore/html/HTMLModElement.h | 2 - .../webkit/WebCore/html/HTMLModElement.idl | 6 +- .../webkit/WebCore/html/HTMLNameCollection.cpp | 8 +- .../webkit/WebCore/html/HTMLOListElement.idl | 6 +- .../webkit/WebCore/html/HTMLObjectElement.cpp | 18 +- .../webkit/WebCore/html/HTMLObjectElement.idl | 7 +- .../webkit/WebCore/html/HTMLOptGroupElement.idl | 6 +- .../webkit/WebCore/html/HTMLOptionElement.cpp | 46 +- .../webkit/WebCore/html/HTMLOptionElement.h | 11 +- .../webkit/WebCore/html/HTMLOptionElement.idl | 5 +- .../webkit/WebCore/html/HTMLOptionsCollection.cpp | 2 - .../webkit/WebCore/html/HTMLOptionsCollection.idl | 4 +- .../webkit/WebCore/html/HTMLParagraphElement.idl | 6 +- .../webkit/WebCore/html/HTMLParamElement.cpp | 2 +- .../webkit/WebCore/html/HTMLParamElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLParser.cpp | 77 +- src/3rdparty/webkit/WebCore/html/HTMLParser.h | 10 +- .../webkit/WebCore/html/HTMLPlugInElement.cpp | 9 +- .../webkit/WebCore/html/HTMLPreElement.cpp | 2 - src/3rdparty/webkit/WebCore/html/HTMLPreElement.h | 2 - .../webkit/WebCore/html/HTMLPreElement.idl | 6 +- .../webkit/WebCore/html/HTMLQuoteElement.idl | 6 +- .../webkit/WebCore/html/HTMLScriptElement.idl | 6 +- .../webkit/WebCore/html/HTMLSelectElement.cpp | 8 +- .../webkit/WebCore/html/HTMLSelectElement.h | 4 +- .../webkit/WebCore/html/HTMLSelectElement.idl | 8 +- .../webkit/WebCore/html/HTMLSourceElement.idl | 2 +- .../webkit/WebCore/html/HTMLStyleElement.idl | 8 +- .../WebCore/html/HTMLTableCaptionElement.idl | 5 +- .../webkit/WebCore/html/HTMLTableCellElement.cpp | 2 - .../webkit/WebCore/html/HTMLTableCellElement.h | 2 - .../webkit/WebCore/html/HTMLTableCellElement.idl | 6 +- .../webkit/WebCore/html/HTMLTableColElement.cpp | 2 - .../webkit/WebCore/html/HTMLTableColElement.h | 2 - .../webkit/WebCore/html/HTMLTableColElement.idl | 6 +- .../webkit/WebCore/html/HTMLTableElement.idl | 6 +- .../webkit/WebCore/html/HTMLTablePartElement.cpp | 2 - .../webkit/WebCore/html/HTMLTablePartElement.h | 2 - .../webkit/WebCore/html/HTMLTableRowElement.idl | 6 +- .../WebCore/html/HTMLTableSectionElement.idl | 5 +- src/3rdparty/webkit/WebCore/html/HTMLTagNames.in | 11 +- .../webkit/WebCore/html/HTMLTextAreaElement.cpp | 26 +- .../webkit/WebCore/html/HTMLTextAreaElement.h | 1 + .../webkit/WebCore/html/HTMLTextAreaElement.idl | 9 +- .../webkit/WebCore/html/HTMLTitleElement.h | 2 - .../webkit/WebCore/html/HTMLTitleElement.idl | 6 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 86 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.h | 13 +- .../webkit/WebCore/html/HTMLUListElement.idl | 6 +- .../webkit/WebCore/html/HTMLVideoElement.cpp | 85 +- .../webkit/WebCore/html/HTMLVideoElement.h | 20 +- .../webkit/WebCore/html/HTMLVideoElement.idl | 10 +- src/3rdparty/webkit/WebCore/html/ImageData.idl | 3 +- src/3rdparty/webkit/WebCore/html/MediaError.idl | 2 +- src/3rdparty/webkit/WebCore/html/TextMetrics.idl | 4 +- src/3rdparty/webkit/WebCore/html/TimeRanges.idl | 2 +- src/3rdparty/webkit/WebCore/html/ValidityState.cpp | 122 +- src/3rdparty/webkit/WebCore/html/ValidityState.h | 56 +- src/3rdparty/webkit/WebCore/html/ValidityState.idl | 2 +- src/3rdparty/webkit/WebCore/html/VoidCallback.idl | 2 +- .../webkit/WebCore/html/canvas/CanvasActiveInfo.h | 62 - .../WebCore/html/canvas/CanvasActiveInfo.idl | 36 - .../webkit/WebCore/html/canvas/CanvasArray.cpp | 52 - .../webkit/WebCore/html/canvas/CanvasArray.h | 75 - .../webkit/WebCore/html/canvas/CanvasArray.idl | 32 - .../WebCore/html/canvas/CanvasArrayBuffer.cpp | 57 - .../webkit/WebCore/html/canvas/CanvasArrayBuffer.h | 51 - .../WebCore/html/canvas/CanvasArrayBuffer.idl | 30 - .../webkit/WebCore/html/canvas/CanvasBuffer.cpp | 53 - .../webkit/WebCore/html/canvas/CanvasBuffer.h | 50 - .../webkit/WebCore/html/canvas/CanvasBuffer.idl | 29 - .../webkit/WebCore/html/canvas/CanvasByteArray.cpp | 77 - .../webkit/WebCore/html/canvas/CanvasByteArray.h | 90 - .../webkit/WebCore/html/canvas/CanvasByteArray.idl | 36 - .../html/canvas/CanvasContextAttributes.cpp | 41 + .../WebCore/html/canvas/CanvasContextAttributes.h | 48 + .../WebCore/html/canvas/CanvasFloatArray.cpp | 78 - .../webkit/WebCore/html/canvas/CanvasFloatArray.h | 86 - .../WebCore/html/canvas/CanvasFloatArray.idl | 36 - .../WebCore/html/canvas/CanvasFramebuffer.cpp | 53 - .../webkit/WebCore/html/canvas/CanvasFramebuffer.h | 50 - .../WebCore/html/canvas/CanvasFramebuffer.idl | 29 - .../webkit/WebCore/html/canvas/CanvasGradient.idl | 3 +- .../webkit/WebCore/html/canvas/CanvasIntArray.cpp | 82 - .../webkit/WebCore/html/canvas/CanvasIntArray.h | 88 - .../webkit/WebCore/html/canvas/CanvasIntArray.idl | 36 - .../WebCore/html/canvas/CanvasNumberArray.idl | 1 - .../webkit/WebCore/html/canvas/CanvasObject.cpp | 18 +- .../webkit/WebCore/html/canvas/CanvasObject.h | 17 +- .../webkit/WebCore/html/canvas/CanvasPattern.idl | 3 +- .../webkit/WebCore/html/canvas/CanvasPixelArray.h | 1 + .../WebCore/html/canvas/CanvasPixelArray.idl | 1 + .../webkit/WebCore/html/canvas/CanvasProgram.cpp | 53 - .../webkit/WebCore/html/canvas/CanvasProgram.h | 50 - .../webkit/WebCore/html/canvas/CanvasProgram.idl | 29 - .../WebCore/html/canvas/CanvasRenderbuffer.cpp | 53 - .../WebCore/html/canvas/CanvasRenderbuffer.h | 50 - .../WebCore/html/canvas/CanvasRenderbuffer.idl | 29 - .../WebCore/html/canvas/CanvasRenderingContext.idl | 1 - .../html/canvas/CanvasRenderingContext2D.cpp | 59 +- .../WebCore/html/canvas/CanvasRenderingContext2D.h | 4 +- .../html/canvas/CanvasRenderingContext2D.idl | 1 - .../html/canvas/CanvasRenderingContext3D.cpp | 1441 - .../WebCore/html/canvas/CanvasRenderingContext3D.h | 327 - .../html/canvas/CanvasRenderingContext3D.idl | 689 - .../webkit/WebCore/html/canvas/CanvasShader.cpp | 53 - .../webkit/WebCore/html/canvas/CanvasShader.h | 50 - .../webkit/WebCore/html/canvas/CanvasShader.idl | 29 - .../WebCore/html/canvas/CanvasShortArray.cpp | 82 - .../webkit/WebCore/html/canvas/CanvasShortArray.h | 86 - .../WebCore/html/canvas/CanvasShortArray.idl | 36 - .../webkit/WebCore/html/canvas/CanvasStyle.cpp | 28 +- .../webkit/WebCore/html/canvas/CanvasTexture.cpp | 54 - .../webkit/WebCore/html/canvas/CanvasTexture.h | 61 - .../webkit/WebCore/html/canvas/CanvasTexture.idl | 29 - .../html/canvas/CanvasUnsignedByteArray.cpp | 78 - .../WebCore/html/canvas/CanvasUnsignedByteArray.h | 86 - .../html/canvas/CanvasUnsignedByteArray.idl | 36 - .../WebCore/html/canvas/CanvasUnsignedIntArray.cpp | 83 - .../WebCore/html/canvas/CanvasUnsignedIntArray.h | 86 - .../WebCore/html/canvas/CanvasUnsignedIntArray.idl | 36 - .../html/canvas/CanvasUnsignedShortArray.cpp | 85 - .../WebCore/html/canvas/CanvasUnsignedShortArray.h | 87 - .../html/canvas/CanvasUnsignedShortArray.idl | 36 - .../webkit/WebCore/html/canvas/WebGLActiveInfo.h | 62 + .../webkit/WebCore/html/canvas/WebGLActiveInfo.idl | 37 + .../webkit/WebCore/html/canvas/WebGLArray.cpp | 60 + .../webkit/WebCore/html/canvas/WebGLArray.h | 81 + .../webkit/WebCore/html/canvas/WebGLArray.idl | 35 + .../WebCore/html/canvas/WebGLArrayBuffer.cpp | 71 + .../webkit/WebCore/html/canvas/WebGLArrayBuffer.h | 53 + .../WebCore/html/canvas/WebGLArrayBuffer.idl | 30 + .../webkit/WebCore/html/canvas/WebGLBuffer.cpp | 166 + .../webkit/WebCore/html/canvas/WebGLBuffer.h | 94 + .../webkit/WebCore/html/canvas/WebGLBuffer.idl | 29 + .../webkit/WebCore/html/canvas/WebGLByteArray.cpp | 93 + .../webkit/WebCore/html/canvas/WebGLByteArray.h | 100 + .../webkit/WebCore/html/canvas/WebGLByteArray.idl | 42 + .../WebCore/html/canvas/WebGLContextAttributes.cpp | 117 + .../WebCore/html/canvas/WebGLContextAttributes.h | 82 + .../WebCore/html/canvas/WebGLContextAttributes.idl | 38 + .../webkit/WebCore/html/canvas/WebGLFloatArray.cpp | 95 + .../webkit/WebCore/html/canvas/WebGLFloatArray.h | 95 + .../webkit/WebCore/html/canvas/WebGLFloatArray.idl | 42 + .../WebCore/html/canvas/WebGLFramebuffer.cpp | 53 + .../webkit/WebCore/html/canvas/WebGLFramebuffer.h | 50 + .../WebCore/html/canvas/WebGLFramebuffer.idl | 29 + .../webkit/WebCore/html/canvas/WebGLGetInfo.cpp | 215 + .../webkit/WebCore/html/canvas/WebGLGetInfo.h | 131 + .../webkit/WebCore/html/canvas/WebGLIntArray.cpp | 99 + .../webkit/WebCore/html/canvas/WebGLIntArray.h | 97 + .../webkit/WebCore/html/canvas/WebGLIntArray.idl | 42 + .../webkit/WebCore/html/canvas/WebGLProgram.cpp | 53 + .../webkit/WebCore/html/canvas/WebGLProgram.h | 50 + .../webkit/WebCore/html/canvas/WebGLProgram.idl | 29 + .../WebCore/html/canvas/WebGLRenderbuffer.cpp | 64 + .../webkit/WebCore/html/canvas/WebGLRenderbuffer.h | 55 + .../WebCore/html/canvas/WebGLRenderbuffer.idl | 29 + .../WebCore/html/canvas/WebGLRenderingContext.cpp | 2531 + .../WebCore/html/canvas/WebGLRenderingContext.h | 360 + .../WebCore/html/canvas/WebGLRenderingContext.idl | 676 + .../webkit/WebCore/html/canvas/WebGLShader.cpp | 53 + .../webkit/WebCore/html/canvas/WebGLShader.h | 50 + .../webkit/WebCore/html/canvas/WebGLShader.idl | 29 + .../webkit/WebCore/html/canvas/WebGLShortArray.cpp | 98 + .../webkit/WebCore/html/canvas/WebGLShortArray.h | 94 + .../webkit/WebCore/html/canvas/WebGLShortArray.idl | 41 + .../webkit/WebCore/html/canvas/WebGLTexture.cpp | 66 + .../webkit/WebCore/html/canvas/WebGLTexture.h | 66 + .../webkit/WebCore/html/canvas/WebGLTexture.idl | 29 + .../WebCore/html/canvas/WebGLUniformLocation.cpp | 48 + .../WebCore/html/canvas/WebGLUniformLocation.h | 58 + .../WebCore/html/canvas/WebGLUniformLocation.idl | 30 + .../WebCore/html/canvas/WebGLUnsignedByteArray.cpp | 95 + .../WebCore/html/canvas/WebGLUnsignedByteArray.h | 95 + .../WebCore/html/canvas/WebGLUnsignedByteArray.idl | 42 + .../WebCore/html/canvas/WebGLUnsignedIntArray.cpp | 100 + .../WebCore/html/canvas/WebGLUnsignedIntArray.h | 95 + .../WebCore/html/canvas/WebGLUnsignedIntArray.idl | 42 + .../html/canvas/WebGLUnsignedShortArray.cpp | 102 + .../WebCore/html/canvas/WebGLUnsignedShortArray.h | 96 + .../html/canvas/WebGLUnsignedShortArray.idl | 42 + .../webkit/WebCore/inspector/ConsoleMessage.cpp | 18 +- .../webkit/WebCore/inspector/ConsoleMessage.h | 5 +- .../webkit/WebCore/inspector/InjectedScript.cpp | 91 + .../webkit/WebCore/inspector/InjectedScript.h | 66 + .../WebCore/inspector/InjectedScriptHost.cpp | 208 + .../webkit/WebCore/inspector/InjectedScriptHost.h | 107 + .../WebCore/inspector/InjectedScriptHost.idl | 60 + .../webkit/WebCore/inspector/InspectorBackend.cpp | 419 +- .../webkit/WebCore/inspector/InspectorBackend.h | 101 +- .../webkit/WebCore/inspector/InspectorBackend.idl | 81 +- .../webkit/WebCore/inspector/InspectorClient.h | 5 +- .../WebCore/inspector/InspectorController.cpp | 569 +- .../webkit/WebCore/inspector/InspectorController.h | 177 +- .../webkit/WebCore/inspector/InspectorDOMAgent.cpp | 218 +- .../webkit/WebCore/inspector/InspectorDOMAgent.h | 14 +- .../inspector/InspectorDatabaseResource.cpp | 4 - .../webkit/WebCore/inspector/InspectorFrontend.cpp | 472 +- .../webkit/WebCore/inspector/InspectorFrontend.h | 47 +- .../WebCore/inspector/InspectorFrontendHost.cpp | 185 + .../WebCore/inspector/InspectorFrontendHost.h | 139 + .../WebCore/inspector/InspectorFrontendHost.idl | 53 + .../webkit/WebCore/inspector/InspectorResource.cpp | 121 +- .../webkit/WebCore/inspector/InspectorResource.h | 33 +- .../WebCore/inspector/InspectorTimelineAgent.cpp | 112 +- .../WebCore/inspector/InspectorTimelineAgent.h | 43 +- .../WebCore/inspector/JavaScriptCallFrame.cpp | 4 +- .../webkit/WebCore/inspector/JavaScriptCallFrame.h | 2 +- .../WebCore/inspector/JavaScriptCallFrame.idl | 2 +- .../WebCore/inspector/JavaScriptDebugListener.h | 2 +- .../WebCore/inspector/JavaScriptDebugServer.cpp | 14 +- .../WebCore/inspector/JavaScriptDebugServer.h | 17 +- .../webkit/WebCore/inspector/JavaScriptProfile.cpp | 183 - .../webkit/WebCore/inspector/JavaScriptProfile.h | 46 - .../WebCore/inspector/JavaScriptProfileNode.cpp | 236 - .../WebCore/inspector/JavaScriptProfileNode.h | 48 - .../WebCore/inspector/TimelineRecordFactory.cpp | 101 +- .../WebCore/inspector/TimelineRecordFactory.h | 29 +- .../inspector/front-end/AbstractTimelinePanel.js | 152 +- .../WebCore/inspector/front-end/AuditCategories.js | 70 + .../inspector/front-end/AuditLauncherView.js | 224 + .../WebCore/inspector/front-end/AuditResultView.js | 138 + .../WebCore/inspector/front-end/AuditRules.js | 1213 + .../WebCore/inspector/front-end/AuditsPanel.js | 480 + .../front-end/BottomUpProfileDataGridTree.js | 22 +- .../WebCore/inspector/front-end/Breakpoint.js | 2 +- .../inspector/front-end/BreakpointsSidebarPane.js | 28 +- .../inspector/front-end/CallStackSidebarPane.js | 3 +- .../WebCore/inspector/front-end/ConsolePanel.js | 88 + .../WebCore/inspector/front-end/ConsoleView.js | 341 +- .../WebCore/inspector/front-end/ContextMenu.js | 83 + .../WebCore/inspector/front-end/CookieItemsView.js | 318 +- .../webkit/WebCore/inspector/front-end/DOMAgent.js | 83 +- .../WebCore/inspector/front-end/DOMStorage.js | 6 +- .../inspector/front-end/DOMStorageDataGrid.js | 161 - .../inspector/front-end/DOMStorageItemsView.js | 76 +- .../inspector/front-end/DOMSyntaxHighlighter.js | 79 + .../webkit/WebCore/inspector/front-end/DataGrid.js | 283 +- .../webkit/WebCore/inspector/front-end/Database.js | 5 +- .../inspector/front-end/DatabaseQueryView.js | 6 +- .../inspector/front-end/DatabaseTableView.js | 1 + .../webkit/WebCore/inspector/front-end/Drawer.js | 144 +- .../WebCore/inspector/front-end/ElementsPanel.js | 189 +- .../inspector/front-end/ElementsTreeOutline.js | 519 +- .../front-end/EventListenersSidebarPane.js | 22 +- .../webkit/WebCore/inspector/front-end/FontView.js | 2 +- .../inspector/front-end/Images/consoleIcon.png | Bin 0 -> 2930 bytes .../inspector/front-end/Images/gearButtonGlyph.png | Bin 0 -> 323 bytes .../inspector/front-end/Images/popoverArrows.png | Bin 0 -> 784 bytes .../front-end/Images/popoverBackground.png | Bin 0 -> 2233 bytes .../front-end/Images/thumbActiveHoriz.png | Bin 0 -> 647 bytes .../inspector/front-end/Images/thumbActiveVert.png | Bin 0 -> 599 bytes .../inspector/front-end/Images/thumbHoriz.png | Bin 0 -> 657 bytes .../inspector/front-end/Images/thumbHoverHoriz.png | Bin 0 -> 667 bytes .../inspector/front-end/Images/thumbHoverVert.png | Bin 0 -> 583 bytes .../inspector/front-end/Images/thumbVert.png | Bin 0 -> 568 bytes .../inspector/front-end/Images/tipBalloon.png | Bin 3689 -> 0 bytes .../front-end/Images/tipBalloonBottom.png | Bin 3139 -> 0 bytes .../WebCore/inspector/front-end/Images/tipIcon.png | Bin 1212 -> 0 bytes .../inspector/front-end/Images/tipIconPressed.png | Bin 1224 -> 0 bytes .../inspector/front-end/Images/trackHoriz.png | Bin 0 -> 520 bytes .../inspector/front-end/Images/trackVert.png | Bin 0 -> 523 bytes .../WebCore/inspector/front-end/InjectedScript.js | 467 +- .../inspector/front-end/InjectedScriptAccess.js | 30 +- .../inspector/front-end/InspectorBackendStub.js | 266 + .../inspector/front-end/InspectorControllerStub.js | 296 - .../front-end/InspectorFrontendHostStub.js | 101 + .../inspector/front-end/KeyboardShortcut.js | 16 +- .../inspector/front-end/MetricsSidebarPane.js | 26 +- .../inspector/front-end/ObjectPropertiesSection.js | 21 +- .../WebCore/inspector/front-end/ObjectProxy.js | 22 +- .../webkit/WebCore/inspector/front-end/Panel.js | 68 +- .../inspector/front-end/PanelEnablerView.js | 11 +- .../webkit/WebCore/inspector/front-end/Popover.js | 147 + .../webkit/WebCore/inspector/front-end/Popup.js | 168 - .../inspector/front-end/ProfileDataGridTree.js | 1 + .../WebCore/inspector/front-end/ProfileView.js | 40 +- .../WebCore/inspector/front-end/ProfilesPanel.js | 78 +- .../inspector/front-end/PropertiesSection.js | 112 +- .../inspector/front-end/PropertiesSidebarPane.js | 15 +- .../webkit/WebCore/inspector/front-end/Resource.js | 145 +- .../WebCore/inspector/front-end/ResourceView.js | 164 +- .../WebCore/inspector/front-end/ResourcesPanel.js | 129 +- .../WebCore/inspector/front-end/ScriptView.js | 25 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 201 +- .../webkit/WebCore/inspector/front-end/Section.js | 140 + .../webkit/WebCore/inspector/front-end/Settings.js | 99 + .../WebCore/inspector/front-end/SidebarPane.js | 8 + .../inspector/front-end/SourceCSSTokenizer.js | 1473 + .../inspector/front-end/SourceCSSTokenizer.re2js | 318 + .../WebCore/inspector/front-end/SourceFrame.js | 1578 +- .../inspector/front-end/SourceHTMLTokenizer.js | 658 + .../inspector/front-end/SourceHTMLTokenizer.re2js | 274 + .../front-end/SourceJavaScriptTokenizer.js | 2416 + .../front-end/SourceJavaScriptTokenizer.re2js | 177 + .../WebCore/inspector/front-end/SourceTokenizer.js | 105 + .../WebCore/inspector/front-end/SourceView.js | 132 +- .../WebCore/inspector/front-end/StatusBarButton.js | 54 +- .../WebCore/inspector/front-end/StoragePanel.js | 70 +- .../inspector/front-end/StylesSidebarPane.js | 78 +- .../WebCore/inspector/front-end/TestController.js | 29 +- .../inspector/front-end/TextEditorHighlighter.js | 169 + .../WebCore/inspector/front-end/TextEditorModel.js | 309 + .../WebCore/inspector/front-end/TextPrompt.js | 138 +- .../WebCore/inspector/front-end/TextViewer.js | 688 + .../WebCore/inspector/front-end/TimelineAgent.js | 24 +- .../WebCore/inspector/front-end/TimelineGrid.js | 144 + .../inspector/front-end/TimelineOverviewPane.js | 388 + .../WebCore/inspector/front-end/TimelinePanel.js | 561 +- .../front-end/TopDownProfileDataGridTree.js | 11 + .../front-end/WatchExpressionsSidebarPane.js | 98 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 45 +- .../WebCore/inspector/front-end/WelcomeView.js | 73 + .../webkit/WebCore/inspector/front-end/audits.css | 272 + .../WebCore/inspector/front-end/inspector.css | 596 +- .../WebCore/inspector/front-end/inspector.html | 35 +- .../WebCore/inspector/front-end/inspector.js | 755 +- .../front-end/inspectorSyntaxHighlight.css | 58 +- .../webkit/WebCore/inspector/front-end/popover.css | 200 + .../WebCore/inspector/front-end/textViewer.css | 148 + .../WebCore/inspector/front-end/treeoutline.js | 28 +- .../WebCore/inspector/front-end/utilities.js | 135 +- src/3rdparty/webkit/WebCore/loader/Cache.cpp | 27 +- src/3rdparty/webkit/WebCore/loader/Cache.h | 2 +- src/3rdparty/webkit/WebCore/loader/CachePolicy.h | 3 +- .../webkit/WebCore/loader/CachedCSSStyleSheet.cpp | 21 +- .../webkit/WebCore/loader/CachedCSSStyleSheet.h | 4 +- src/3rdparty/webkit/WebCore/loader/CachedFont.cpp | 4 +- src/3rdparty/webkit/WebCore/loader/CachedImage.cpp | 3 +- .../webkit/WebCore/loader/CachedResource.cpp | 6 +- .../webkit/WebCore/loader/CachedResource.h | 9 +- .../webkit/WebCore/loader/CachedResourceClient.h | 5 +- .../webkit/WebCore/loader/CachedResourceHandle.h | 2 +- .../webkit/WebCore/loader/CachedXSLStyleSheet.cpp | 5 +- .../WebCore/loader/CrossOriginAccessControl.cpp | 3 + .../loader/CrossOriginPreflightResultCache.h | 2 + src/3rdparty/webkit/WebCore/loader/DocLoader.cpp | 10 +- src/3rdparty/webkit/WebCore/loader/DocLoader.h | 2 +- .../webkit/WebCore/loader/DocumentLoader.cpp | 69 +- .../webkit/WebCore/loader/DocumentLoader.h | 4 +- .../WebCore/loader/DocumentThreadableLoader.cpp | 17 +- .../WebCore/loader/DocumentThreadableLoader.h | 5 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 38 +- .../webkit/WebCore/loader/FTPDirectoryDocument.cpp | 53 +- .../webkit/WebCore/loader/FTPDirectoryParser.cpp | 29 +- src/3rdparty/webkit/WebCore/loader/FormState.cpp | 7 +- src/3rdparty/webkit/WebCore/loader/FormState.h | 11 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 519 +- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 23 +- .../webkit/WebCore/loader/FrameLoaderClient.h | 18 +- .../webkit/WebCore/loader/FrameLoaderTypes.h | 17 + .../webkit/WebCore/loader/HistoryController.cpp | 45 +- .../webkit/WebCore/loader/HistoryController.h | 6 +- .../webkit/WebCore/loader/ImageDocument.cpp | 8 +- src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp | 76 +- src/3rdparty/webkit/WebCore/loader/ImageLoader.h | 7 +- .../webkit/WebCore/loader/MainResourceLoader.cpp | 31 + .../webkit/WebCore/loader/MainResourceLoader.h | 6 +- .../webkit/WebCore/loader/MediaDocument.cpp | 8 +- .../webkit/WebCore/loader/PlaceholderDocument.cpp | 5 - .../webkit/WebCore/loader/PlaceholderDocument.h | 2 +- .../webkit/WebCore/loader/ProgressTracker.cpp | 14 +- .../webkit/WebCore/loader/RedirectScheduler.cpp | 38 +- src/3rdparty/webkit/WebCore/loader/Request.cpp | 4 +- src/3rdparty/webkit/WebCore/loader/Request.h | 9 +- .../webkit/WebCore/loader/ResourceLoadNotifier.cpp | 13 +- .../webkit/WebCore/loader/ResourceLoadNotifier.h | 2 +- .../webkit/WebCore/loader/ResourceLoader.cpp | 2 +- .../webkit/WebCore/loader/SubresourceLoader.cpp | 6 +- .../webkit/WebCore/loader/SubresourceLoader.h | 7 +- .../WebCore/loader/SubresourceLoaderClient.h | 2 +- .../webkit/WebCore/loader/ThreadableLoader.h | 2 +- .../webkit/WebCore/loader/ThreadableLoaderClient.h | 2 +- .../WebCore/loader/WorkerThreadableLoader.cpp | 6 +- .../webkit/WebCore/loader/WorkerThreadableLoader.h | 8 +- .../WebCore/loader/appcache/ApplicationCache.h | 2 +- .../loader/appcache/ApplicationCacheGroup.cpp | 7 +- .../loader/appcache/ApplicationCacheHost.cpp | 21 + .../WebCore/loader/appcache/ApplicationCacheHost.h | 9 +- .../loader/appcache/ApplicationCacheStorage.cpp | 2 +- .../loader/appcache/ApplicationCacheStorage.h | 2 +- .../loader/appcache/DOMApplicationCache.cpp | 6 +- .../loader/appcache/DOMApplicationCache.idl | 3 +- .../WebCore/loader/archive/ArchiveFactory.cpp | 15 +- .../WebCore/loader/icon/IconDatabaseClient.h | 4 +- src/3rdparty/webkit/WebCore/loader/loader.cpp | 38 +- src/3rdparty/webkit/WebCore/loader/loader.h | 3 +- .../webkit/WebCore/mathml/MathMLElement.cpp | 39 +- src/3rdparty/webkit/WebCore/mathml/MathMLElement.h | 39 +- .../mathml/MathMLInlineContainerElement.cpp | 47 +- .../WebCore/mathml/MathMLInlineContainerElement.h | 39 +- .../webkit/WebCore/mathml/MathMLMathElement.cpp | 39 +- .../webkit/WebCore/mathml/MathMLMathElement.h | 39 +- .../webkit/WebCore/mathml/MathMLTextElement.cpp | 58 + .../webkit/WebCore/mathml/MathMLTextElement.h | 48 + .../webkit/WebCore/mathml/RenderMathMLBlock.cpp | 113 + .../webkit/WebCore/mathml/RenderMathMLBlock.h | 75 + src/3rdparty/webkit/WebCore/mathml/mathattrs.in | 13 + src/3rdparty/webkit/WebCore/mathml/mathtags.in | 1 - .../webkit/WebCore/notifications/Notification.cpp | 12 +- .../webkit/WebCore/notifications/Notification.idl | 3 +- .../WebCore/notifications/NotificationCenter.cpp | 26 +- .../WebCore/notifications/NotificationCenter.h | 14 +- .../WebCore/notifications/NotificationCenter.idl | 3 +- .../WebCore/notifications/NotificationPresenter.h | 30 +- src/3rdparty/webkit/WebCore/page/AbstractView.idl | 3 +- src/3rdparty/webkit/WebCore/page/BarInfo.cpp | 22 +- src/3rdparty/webkit/WebCore/page/BarInfo.idl | 2 +- src/3rdparty/webkit/WebCore/page/Chrome.cpp | 25 +- src/3rdparty/webkit/WebCore/page/Chrome.h | 7 + src/3rdparty/webkit/WebCore/page/ChromeClient.h | 12 + src/3rdparty/webkit/WebCore/page/Console.cpp | 41 +- src/3rdparty/webkit/WebCore/page/Console.h | 145 +- src/3rdparty/webkit/WebCore/page/Console.idl | 6 +- .../webkit/WebCore/page/ContextMenuController.cpp | 46 +- .../webkit/WebCore/page/ContextMenuController.h | 9 + .../webkit/WebCore/page/ContextMenuProvider.h | 52 + src/3rdparty/webkit/WebCore/page/Coordinates.idl | 2 +- src/3rdparty/webkit/WebCore/page/DOMSelection.idl | 2 +- src/3rdparty/webkit/WebCore/page/DOMTimer.cpp | 11 +- src/3rdparty/webkit/WebCore/page/DOMTimer.h | 7 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 104 +- src/3rdparty/webkit/WebCore/page/DOMWindow.h | 69 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 175 +- .../webkit/WebCore/page/DragController.cpp | 46 +- src/3rdparty/webkit/WebCore/page/DragController.h | 2 +- src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 311 +- src/3rdparty/webkit/WebCore/page/EventHandler.h | 28 +- src/3rdparty/webkit/WebCore/page/EventSource.cpp | 18 +- src/3rdparty/webkit/WebCore/page/EventSource.h | 2 +- src/3rdparty/webkit/WebCore/page/EventSource.idl | 1 + .../webkit/WebCore/page/FocusController.cpp | 9 +- src/3rdparty/webkit/WebCore/page/FocusController.h | 48 +- src/3rdparty/webkit/WebCore/page/Frame.cpp | 356 +- src/3rdparty/webkit/WebCore/page/Frame.h | 49 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 192 +- src/3rdparty/webkit/WebCore/page/FrameView.h | 25 +- src/3rdparty/webkit/WebCore/page/Geolocation.cpp | 213 +- src/3rdparty/webkit/WebCore/page/Geolocation.h | 41 +- src/3rdparty/webkit/WebCore/page/Geolocation.idl | 2 +- .../webkit/WebCore/page/GeolocationController.cpp | 93 + .../webkit/WebCore/page/GeolocationController.h | 67 + .../WebCore/page/GeolocationControllerClient.h | 47 + .../webkit/WebCore/page/GeolocationError.h | 65 + .../webkit/WebCore/page/GeolocationPosition.h | 111 + src/3rdparty/webkit/WebCore/page/Geoposition.h | 7 +- src/3rdparty/webkit/WebCore/page/Geoposition.idl | 2 +- src/3rdparty/webkit/WebCore/page/HaltablePlugin.h | 2 + src/3rdparty/webkit/WebCore/page/History.cpp | 45 + src/3rdparty/webkit/WebCore/page/History.h | 42 +- src/3rdparty/webkit/WebCore/page/History.idl | 8 +- src/3rdparty/webkit/WebCore/page/Location.idl | 3 +- .../webkit/WebCore/page/MediaCanStartListener.h | 40 + .../WebCore/page/MouseEventWithHitTestResults.h | 2 +- src/3rdparty/webkit/WebCore/page/Navigator.cpp | 92 + src/3rdparty/webkit/WebCore/page/Navigator.h | 5 + src/3rdparty/webkit/WebCore/page/Navigator.idl | 10 +- src/3rdparty/webkit/WebCore/page/NavigatorBase.cpp | 12 +- src/3rdparty/webkit/WebCore/page/Page.cpp | 104 +- src/3rdparty/webkit/WebCore/page/Page.h | 58 +- src/3rdparty/webkit/WebCore/page/PageGroup.cpp | 47 +- src/3rdparty/webkit/WebCore/page/PageGroup.h | 12 +- src/3rdparty/webkit/WebCore/page/PluginHalter.cpp | 3 +- src/3rdparty/webkit/WebCore/page/PluginHalter.h | 2 +- .../webkit/WebCore/page/PluginHalterClient.h | 3 +- src/3rdparty/webkit/WebCore/page/PositionError.h | 1 - src/3rdparty/webkit/WebCore/page/PositionError.idl | 5 +- src/3rdparty/webkit/WebCore/page/PrintContext.cpp | 84 +- src/3rdparty/webkit/WebCore/page/PrintContext.h | 10 + src/3rdparty/webkit/WebCore/page/Screen.idl | 2 +- .../webkit/WebCore/page/SecurityOrigin.cpp | 122 +- src/3rdparty/webkit/WebCore/page/SecurityOrigin.h | 305 +- src/3rdparty/webkit/WebCore/page/Settings.cpp | 63 +- src/3rdparty/webkit/WebCore/page/Settings.h | 42 +- src/3rdparty/webkit/WebCore/page/UserScript.h | 7 +- src/3rdparty/webkit/WebCore/page/UserScriptTypes.h | 3 +- src/3rdparty/webkit/WebCore/page/UserStyleSheet.h | 8 +- .../webkit/WebCore/page/UserStyleSheetTypes.h | 3 +- src/3rdparty/webkit/WebCore/page/WebKitPoint.idl | 2 +- .../webkit/WebCore/page/WorkerNavigator.idl | 3 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 156 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.h | 45 +- .../WebCore/page/android/DragControllerAndroid.cpp | 58 - .../WebCore/page/android/EventHandlerAndroid.cpp | 128 - .../page/android/InspectorControllerAndroid.cpp | 106 - .../WebCore/page/animation/AnimationBase.cpp | 50 +- .../webkit/WebCore/page/animation/AnimationBase.h | 9 +- .../WebCore/page/animation/AnimationController.cpp | 2 +- .../page/animation/AnimationControllerPrivate.h | 2 +- .../WebCore/page/animation/CompositeAnimation.cpp | 15 + .../WebCore/page/animation/ImplicitAnimation.cpp | 14 +- .../WebCore/page/animation/ImplicitAnimation.h | 5 +- .../WebCore/page/animation/KeyframeAnimation.cpp | 57 +- .../WebCore/page/animation/KeyframeAnimation.h | 8 +- .../webkit/WebCore/page/qt/DragControllerQt.cpp | 1 + .../webkit/WebCore/page/win/EventHandlerWin.cpp | 2 +- .../webkit/WebCore/page/win/FrameCGWin.cpp | 11 +- .../webkit/WebCore/page/win/FrameCairoWin.cpp | 1 + src/3rdparty/webkit/WebCore/page/win/FrameWin.cpp | 64 +- src/3rdparty/webkit/WebCore/page/win/FrameWin.h | 7 +- src/3rdparty/webkit/WebCore/page/win/PageWin.cpp | 31 +- .../webkit/WebCore/platform/ContextMenu.cpp | 25 +- src/3rdparty/webkit/WebCore/platform/ContextMenu.h | 2 + .../webkit/WebCore/platform/ContextMenuItem.h | 19 +- src/3rdparty/webkit/WebCore/platform/CookieJar.h | 2 + .../webkit/WebCore/platform/CrossThreadCopier.cpp | 14 +- .../webkit/WebCore/platform/CrossThreadCopier.h | 43 +- src/3rdparty/webkit/WebCore/platform/Cursor.h | 7 +- .../webkit/WebCore/platform/DeprecatedPtrList.h | 3 +- .../WebCore/platform/DeprecatedPtrListImpl.cpp | 3 +- src/3rdparty/webkit/WebCore/platform/DragImage.h | 4 + .../webkit/WebCore/platform/FileChooser.cpp | 39 +- src/3rdparty/webkit/WebCore/platform/FileChooser.h | 16 +- src/3rdparty/webkit/WebCore/platform/FileSystem.h | 15 +- .../webkit/WebCore/platform/GeolocationService.cpp | 7 +- .../webkit/WebCore/platform/GeolocationService.h | 7 +- src/3rdparty/webkit/WebCore/platform/KURL.cpp | 198 +- src/3rdparty/webkit/WebCore/platform/KURL.h | 24 +- .../webkit/WebCore/platform/KURLGoogle.cpp | 179 +- .../webkit/WebCore/platform/KeyboardCodes.h | 18 +- src/3rdparty/webkit/WebCore/platform/Length.h | 3 +- src/3rdparty/webkit/WebCore/platform/LinkHash.cpp | 6 +- .../webkit/WebCore/platform/LocalizedStrings.h | 11 + src/3rdparty/webkit/WebCore/platform/Logging.cpp | 10 +- src/3rdparty/webkit/WebCore/platform/Logging.h | 3 +- .../webkit/WebCore/platform/MIMETypeRegistry.cpp | 2 +- src/3rdparty/webkit/WebCore/platform/Pasteboard.h | 1 + .../WebCore/platform/PlatformKeyboardEvent.h | 13 +- .../webkit/WebCore/platform/PlatformMouseEvent.h | 17 +- .../webkit/WebCore/platform/PlatformTouchEvent.h | 83 + .../webkit/WebCore/platform/PlatformTouchPoint.h | 69 + .../webkit/WebCore/platform/PlatformWheelEvent.h | 14 + src/3rdparty/webkit/WebCore/platform/PopupMenu.h | 13 +- .../webkit/WebCore/platform/PurgeableBuffer.h | 2 +- .../webkit/WebCore/platform/ScrollView.cpp | 35 +- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 11 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.cpp | 23 +- src/3rdparty/webkit/WebCore/platform/Scrollbar.h | 15 +- .../webkit/WebCore/platform/ScrollbarTheme.h | 8 +- .../WebCore/platform/ScrollbarThemeComposite.cpp | 3 +- .../webkit/WebCore/platform/SharedBuffer.cpp | 139 +- .../webkit/WebCore/platform/SharedBuffer.h | 37 +- src/3rdparty/webkit/WebCore/platform/SharedTimer.h | 4 +- .../webkit/WebCore/platform/StaticConstructors.h | 2 - src/3rdparty/webkit/WebCore/platform/ThemeTypes.h | 7 +- .../webkit/WebCore/platform/ThreadGlobalData.cpp | 24 +- .../webkit/WebCore/platform/ThreadGlobalData.h | 34 +- src/3rdparty/webkit/WebCore/platform/Timer.cpp | 7 - src/3rdparty/webkit/WebCore/platform/Timer.h | 6 + src/3rdparty/webkit/WebCore/platform/TreeShared.h | 22 +- src/3rdparty/webkit/WebCore/platform/Widget.h | 4 +- .../WebCore/platform/android/ClipboardAndroid.cpp | 105 - .../WebCore/platform/android/ClipboardAndroid.h | 64 - .../WebCore/platform/android/CursorAndroid.cpp | 298 - .../WebCore/platform/android/DragDataAndroid.cpp | 96 - .../WebCore/platform/android/EventLoopAndroid.cpp | 38 - .../platform/android/FileChooserAndroid.cpp | 60 - .../WebCore/platform/android/FileSystemAndroid.cpp | 131 - .../WebCore/platform/android/KeyEventAndroid.cpp | 273 - .../WebCore/platform/android/KeyboardCodes.h | 545 - .../platform/android/LocalizedStringsAndroid.cpp | 54 - .../WebCore/platform/android/PopupMenuAndroid.cpp | 57 - .../platform/android/RenderThemeAndroid.cpp | 334 - .../WebCore/platform/android/RenderThemeAndroid.h | 109 - .../WebCore/platform/android/ScreenAndroid.cpp | 107 - .../WebCore/platform/android/ScrollViewAndroid.cpp | 105 - .../platform/android/SearchPopupMenuAndroid.cpp | 52 - .../WebCore/platform/android/SystemTimeAndroid.cpp | 37 - .../platform/android/TemporaryLinkStubs.cpp | 677 - .../WebCore/platform/android/WidgetAndroid.cpp | 128 - .../WebCore/platform/animation/AnimationList.h | 2 +- .../WebCore/platform/cf/BinaryPropertyList.cpp | 832 + .../WebCore/platform/cf/BinaryPropertyList.h | 110 + .../webkit/WebCore/platform/cf/FileSystemCF.cpp | 57 + .../webkit/WebCore/platform/cf/KURLCFNet.cpp | 95 + .../webkit/WebCore/platform/cf/RunLoopTimerCF.cpp | 84 + .../webkit/WebCore/platform/cf/SchedulePair.cpp | 52 + .../webkit/WebCore/platform/cf/SchedulePair.h | 88 + .../webkit/WebCore/platform/cf/SharedBufferCF.cpp | 92 + .../WebCore/platform/graphics/BitmapImage.cpp | 34 +- .../webkit/WebCore/platform/graphics/BitmapImage.h | 12 +- .../webkit/WebCore/platform/graphics/Color.h | 3 +- .../webkit/WebCore/platform/graphics/ColorSpace.h | 35 + .../WebCore/platform/graphics/FloatPoint.cpp | 7 + .../webkit/WebCore/platform/graphics/FloatPoint.h | 6 +- .../webkit/WebCore/platform/graphics/FloatQuad.cpp | 6 + .../webkit/WebCore/platform/graphics/FloatQuad.h | 6 + .../webkit/WebCore/platform/graphics/FloatRect.cpp | 10 +- .../webkit/WebCore/platform/graphics/FloatRect.h | 17 +- .../webkit/WebCore/platform/graphics/FloatSize.h | 11 +- .../webkit/WebCore/platform/graphics/Font.cpp | 17 +- .../webkit/WebCore/platform/graphics/Font.h | 22 + .../webkit/WebCore/platform/graphics/FontCache.cpp | 23 +- .../webkit/WebCore/platform/graphics/FontCache.h | 19 +- .../WebCore/platform/graphics/FontFastPath.cpp | 15 +- .../WebCore/platform/graphics/GeneratedImage.cpp | 47 +- .../WebCore/platform/graphics/GeneratedImage.h | 6 +- .../webkit/WebCore/platform/graphics/Generator.h | 1 + .../webkit/WebCore/platform/graphics/GlyphBuffer.h | 10 +- .../webkit/WebCore/platform/graphics/Gradient.cpp | 40 +- .../webkit/WebCore/platform/graphics/Gradient.h | 29 +- .../WebCore/platform/graphics/GraphicsContext.cpp | 182 +- .../WebCore/platform/graphics/GraphicsContext.h | 98 +- .../platform/graphics/GraphicsContext3D.cpp | 130 + .../WebCore/platform/graphics/GraphicsContext3D.h | 601 +- .../platform/graphics/GraphicsContextPrivate.h | 37 +- .../WebCore/platform/graphics/GraphicsLayer.cpp | 52 +- .../WebCore/platform/graphics/GraphicsLayer.h | 45 +- .../platform/graphics/GraphicsLayerClient.h | 3 + .../webkit/WebCore/platform/graphics/Icon.h | 3 +- .../webkit/WebCore/platform/graphics/Image.cpp | 24 +- .../webkit/WebCore/platform/graphics/Image.h | 19 +- .../webkit/WebCore/platform/graphics/ImageBuffer.h | 6 +- .../WebCore/platform/graphics/ImageSource.cpp | 9 +- .../webkit/WebCore/platform/graphics/ImageSource.h | 4 +- .../webkit/WebCore/platform/graphics/IntPoint.h | 9 + .../webkit/WebCore/platform/graphics/IntRect.cpp | 35 +- .../webkit/WebCore/platform/graphics/IntRect.h | 33 +- .../webkit/WebCore/platform/graphics/IntSize.h | 12 +- .../WebCore/platform/graphics/MediaPlayer.cpp | 92 +- .../webkit/WebCore/platform/graphics/MediaPlayer.h | 51 +- .../WebCore/platform/graphics/MediaPlayerPrivate.h | 21 +- .../webkit/WebCore/platform/graphics/Path.h | 25 +- .../webkit/WebCore/platform/graphics/Pattern.cpp | 20 + .../webkit/WebCore/platform/graphics/Pattern.h | 54 +- .../WebCore/platform/graphics/SimpleFontData.h | 29 +- .../platform/graphics/TypesettingFeatures.h | 38 + .../WebCore/platform/graphics/filters/FEBlend.cpp | 4 +- .../platform/graphics/filters/FEColorMatrix.cpp | 3 +- .../graphics/filters/FEComponentTransfer.cpp | 6 +- .../graphics/filters/FEComponentTransfer.h | 1 - .../platform/graphics/filters/FEComposite.cpp | 28 +- .../platform/graphics/filters/FEGaussianBlur.cpp | 10 +- .../WebCore/platform/graphics/filters/Filter.h | 15 +- .../platform/graphics/filters/FilterEffect.cpp | 8 +- .../platform/graphics/filters/FilterEffect.h | 8 + .../graphics/filters/ImageBufferFilter.cpp | 43 + .../platform/graphics/filters/ImageBufferFilter.h | 57 + .../platform/graphics/filters/SourceAlpha.cpp | 4 +- .../platform/graphics/filters/SourceGraphic.cpp | 4 +- .../graphics/opentype/OpenTypeSanitizer.cpp | 68 + .../platform/graphics/opentype/OpenTypeSanitizer.h | 57 + .../graphics/opentype/OpenTypeUtilities.cpp | 4 +- .../platform/graphics/opentype/OpenTypeUtilities.h | 2 +- .../platform/graphics/openvg/EGLDisplayOpenVG.cpp | 431 + .../platform/graphics/openvg/EGLDisplayOpenVG.h | 89 + .../WebCore/platform/graphics/openvg/EGLUtils.h | 71 + .../graphics/openvg/GraphicsContextOpenVG.cpp | 566 + .../platform/graphics/openvg/PainterOpenVG.cpp | 957 + .../platform/graphics/openvg/PainterOpenVG.h | 121 + .../platform/graphics/openvg/SurfaceOpenVG.cpp | 243 + .../platform/graphics/openvg/SurfaceOpenVG.h | 137 + .../WebCore/platform/graphics/openvg/VGUtils.cpp | 100 + .../WebCore/platform/graphics/openvg/VGUtils.h | 87 + .../WebCore/platform/graphics/qt/FontCacheQt.cpp | 250 +- .../graphics/qt/FontCustomPlatformData.cpp | 65 - .../graphics/qt/FontCustomPlatformDataQt.cpp | 65 + .../platform/graphics/qt/FontFallbackListQt.cpp | 138 - .../platform/graphics/qt/FontPlatformData.h | 120 +- .../platform/graphics/qt/FontPlatformDataQt.cpp | 111 +- .../webkit/WebCore/platform/graphics/qt/FontQt.cpp | 48 +- .../WebCore/platform/graphics/qt/FontQt43.cpp | 354 - .../platform/graphics/qt/GraphicsContextQt.cpp | 290 +- .../platform/graphics/qt/GraphicsLayerQt.cpp | 1240 + .../WebCore/platform/graphics/qt/GraphicsLayerQt.h | 85 + .../webkit/WebCore/platform/graphics/qt/IconQt.cpp | 17 +- .../WebCore/platform/graphics/qt/ImageBufferQt.cpp | 2 +- .../platform/graphics/qt/ImageDecoderQt.cpp | 39 +- .../WebCore/platform/graphics/qt/ImageDecoderQt.h | 5 +- .../WebCore/platform/graphics/qt/ImageQt.cpp | 16 +- .../graphics/qt/MediaPlayerPrivatePhonon.cpp | 25 +- .../graphics/qt/MediaPlayerPrivatePhonon.h | 4 - .../webkit/WebCore/platform/graphics/qt/PathQt.cpp | 97 +- .../WebCore/platform/graphics/qt/PatternQt.cpp | 4 +- .../WebCore/platform/graphics/qt/StillImageQt.cpp | 2 +- .../WebCore/platform/graphics/qt/StillImageQt.h | 2 +- .../graphics/qt/TransformationMatrixQt.cpp | 6 + .../graphics/transforms/AffineTransform.cpp | 364 + .../platform/graphics/transforms/AffineTransform.h | 177 + .../graphics/transforms/TransformOperations.h | 2 +- .../graphics/transforms/TransformationMatrix.cpp | 6 + .../graphics/transforms/TransformationMatrix.h | 43 +- .../WebCore/platform/graphics/win/FontCGWin.cpp | 389 + .../WebCore/platform/graphics/win/FontCacheWin.cpp | 562 + .../graphics/win/FontCustomPlatformData.cpp | 242 + .../platform/graphics/win/FontCustomPlatformData.h | 56 + .../graphics/win/FontCustomPlatformDataCairo.cpp | 61 + .../graphics/win/FontCustomPlatformDataCairo.h | 49 + .../WebCore/platform/graphics/win/FontDatabase.cpp | 217 + .../WebCore/platform/graphics/win/FontDatabase.h | 38 + .../platform/graphics/win/FontPlatformData.h | 155 + .../graphics/win/FontPlatformDataCGWin.cpp | 151 + .../graphics/win/FontPlatformDataCairoWin.cpp | 133 + .../platform/graphics/win/FontPlatformDataWin.cpp | 95 + .../WebCore/platform/graphics/win/FontWin.cpp | 105 + .../graphics/win/GlyphPageTreeNodeCGWin.cpp | 59 + .../graphics/win/GlyphPageTreeNodeCairoWin.cpp | 72 + .../platform/graphics/win/GraphicsContextCGWin.cpp | 253 + .../graphics/win/GraphicsContextCairoWin.cpp | 147 + .../platform/graphics/win/GraphicsContextWin.cpp | 211 + .../platform/graphics/win/GraphicsLayerCACF.cpp | 722 + .../platform/graphics/win/GraphicsLayerCACF.h | 144 + .../WebCore/platform/graphics/win/IconWin.cpp | 101 + .../WebCore/platform/graphics/win/ImageCGWin.cpp | 110 + .../platform/graphics/win/ImageCairoWin.cpp | 114 + .../WebCore/platform/graphics/win/ImageWin.cpp | 58 + .../WebCore/platform/graphics/win/IntPointWin.cpp | 57 + .../WebCore/platform/graphics/win/IntRectWin.cpp | 45 + .../WebCore/platform/graphics/win/IntSizeWin.cpp | 45 + .../win/MediaPlayerPrivateQuickTimeWin.cpp | 877 + .../graphics/win/MediaPlayerPrivateQuickTimeWin.h | 188 + .../WebCore/platform/graphics/win/QTMovieWin.cpp | 1178 + .../WebCore/platform/graphics/win/QTMovieWin.h | 127 + .../platform/graphics/win/QTMovieWinTimer.cpp | 137 + .../platform/graphics/win/QTMovieWinTimer.h | 39 + .../platform/graphics/win/SimpleFontDataCGWin.cpp | 146 + .../graphics/win/SimpleFontDataCairoWin.cpp | 122 + .../platform/graphics/win/SimpleFontDataWin.cpp | 213 + .../graphics/win/TransformationMatrixWin.cpp | 46 + .../platform/graphics/win/UniscribeController.cpp | 441 + .../platform/graphics/win/UniscribeController.h | 83 + .../platform/graphics/win/WKCACFContextFlusher.cpp | 88 + .../platform/graphics/win/WKCACFContextFlusher.h | 60 + .../WebCore/platform/graphics/win/WKCACFLayer.cpp | 644 + .../WebCore/platform/graphics/win/WKCACFLayer.h | 265 + .../platform/graphics/win/WKCACFLayerRenderer.cpp | 456 + .../platform/graphics/win/WKCACFLayerRenderer.h | 110 + .../platform/image-decoders/ImageDecoder.cpp | 132 +- .../WebCore/platform/image-decoders/ImageDecoder.h | 143 +- .../platform/image-decoders/qt/RGBA32BufferQt.cpp | 39 +- .../platform/image-decoders/wx/ImageDecoderWx.cpp | 83 - .../webkit/WebCore/platform/mac/ClipboardMac.h | 1 + .../webkit/WebCore/platform/mac/ClipboardMac.mm | 7 +- .../webkit/WebCore/platform/mac/CookieJar.mm | 12 + .../WebCore/platform/mac/GeolocationServiceMac.mm | 2 +- .../webkit/WebCore/platform/mac/KeyEventMac.mm | 16 + .../WebCore/platform/mac/LocalizedStringsMac.mm | 72 + .../webkit/WebCore/platform/mac/LoggingMac.mm | 2 +- .../webkit/WebCore/platform/mac/PasteboardMac.mm | 20 +- .../WebCore/platform/mac/PlatformMouseEventMac.mm | 18 + .../webkit/WebCore/platform/mac/PopupMenuMac.mm | 21 +- .../platform/mac/RuntimeApplicationChecks.h | 1 + .../platform/mac/RuntimeApplicationChecks.mm | 6 + .../webkit/WebCore/platform/mac/ScrollViewMac.mm | 15 +- .../WebCore/platform/mac/ScrollbarThemeMac.h | 2 + .../WebCore/platform/mac/ScrollbarThemeMac.mm | 4 +- .../webkit/WebCore/platform/mac/ThemeMac.mm | 46 +- .../WebCore/platform/mac/WebCoreObjCExtras.mm | 5 + .../WebCore/platform/mac/WebCoreSystemInterface.h | 15 + .../WebCore/platform/mac/WebCoreSystemInterface.mm | 13 + .../webkit/WebCore/platform/mac/WheelEventMac.mm | 8 +- .../webkit/WebCore/platform/mac/WidgetMac.mm | 11 +- .../platform/network/AuthenticationClient.h | 53 + .../webkit/WebCore/platform/network/Credential.cpp | 80 +- .../webkit/WebCore/platform/network/Credential.h | 31 +- .../WebCore/platform/network/CredentialStorage.cpp | 21 +- .../WebCore/platform/network/CredentialStorage.h | 4 + .../WebCore/platform/network/FormDataBuilder.cpp | 21 +- .../WebCore/platform/network/HTTPHeaderMap.cpp | 36 + .../WebCore/platform/network/HTTPHeaderMap.h | 16 + .../platform/network/NetworkStateNotifier.h | 8 +- .../WebCore/platform/network/ProtectionSpace.cpp | 3 +- .../WebCore/platform/network/ProtectionSpaceHash.h | 11 +- .../WebCore/platform/network/ResourceHandle.cpp | 95 +- .../WebCore/platform/network/ResourceHandle.h | 26 +- .../platform/network/ResourceHandleClient.h | 2 +- .../platform/network/ResourceHandleInternal.h | 17 +- .../platform/network/ResourceRequestBase.cpp | 14 +- .../WebCore/platform/network/ResourceRequestBase.h | 28 +- .../platform/network/ResourceResponseBase.cpp | 7 + .../platform/network/ResourceResponseBase.h | 5 +- .../platform/network/SocketStreamHandleBase.cpp | 5 +- .../platform/network/SocketStreamHandleClient.h | 5 +- .../platform/network/cf/AuthenticationCF.cpp | 266 + .../WebCore/platform/network/cf/AuthenticationCF.h | 48 + .../platform/network/cf/AuthenticationChallenge.h | 57 + .../platform/network/cf/CredentialStorageCFNet.cpp | 44 + .../WebCore/platform/network/cf/DNSCFNet.cpp | 155 + .../platform/network/cf/FormDataStreamCFNet.cpp | 384 + .../platform/network/cf/FormDataStreamCFNet.h | 44 + .../platform/network/cf/LoaderRunLoopCF.cpp | 66 + .../WebCore/platform/network/cf/LoaderRunLoopCF.h | 39 + .../WebCore/platform/network/cf/ResourceError.h | 73 + .../platform/network/cf/ResourceErrorCF.cpp | 164 + .../platform/network/cf/ResourceHandleCFNet.cpp | 783 + .../WebCore/platform/network/cf/ResourceRequest.h | 77 + .../platform/network/cf/ResourceRequestCFNet.cpp | 191 + .../platform/network/cf/ResourceRequestCFNet.h | 39 + .../WebCore/platform/network/cf/ResourceResponse.h | 81 + .../platform/network/cf/ResourceResponseCFNet.cpp | 117 + .../platform/network/cf/SocketStreamError.h | 50 + .../platform/network/cf/SocketStreamHandle.h | 112 + .../network/cf/SocketStreamHandleCFNet.cpp | 639 + .../platform/network/qt/QNetworkReplyHandler.cpp | 53 +- .../platform/network/qt/QNetworkReplyHandler.h | 5 +- .../platform/network/qt/ResourceHandleQt.cpp | 22 - .../WebCore/platform/network/qt/ResourceRequest.h | 6 +- .../platform/network/qt/ResourceRequestQt.cpp | 18 +- .../platform/network/qt/SocketStreamHandle.h | 4 + .../network/qt/SocketStreamHandlePrivate.h | 72 + .../platform/network/qt/SocketStreamHandleQt.cpp | 208 + .../platform/network/qt/SocketStreamHandleSoup.cpp | 88 - .../webkit/WebCore/platform/qt/ClipboardQt.cpp | 27 +- .../webkit/WebCore/platform/qt/ClipboardQt.h | 1 + .../webkit/WebCore/platform/qt/CookieJarQt.cpp | 42 +- .../webkit/WebCore/platform/qt/CursorQt.cpp | 2 +- .../webkit/WebCore/platform/qt/DragDataQt.cpp | 2 +- src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp | 3 +- .../webkit/WebCore/platform/qt/Localizations.cpp | 54 + .../webkit/WebCore/platform/qt/PasteboardQt.cpp | 5 +- .../platform/qt/PlatformKeyboardEventQt.cpp | 20 +- .../WebCore/platform/qt/PlatformTouchEventQt.cpp | 49 + .../WebCore/platform/qt/PlatformTouchPointQt.cpp | 45 + .../webkit/WebCore/platform/qt/PopupMenuQt.cpp | 96 +- .../webkit/WebCore/platform/qt/QWebPageClient.h | 21 + .../webkit/WebCore/platform/qt/QWebPopup.cpp | 101 - .../webkit/WebCore/platform/qt/QWebPopup.h | 49 - .../WebCore/platform/qt/QtAbstractWebPopup.cpp | 60 + .../WebCore/platform/qt/QtAbstractWebPopup.h | 69 + .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 184 +- .../webkit/WebCore/platform/qt/RenderThemeQt.h | 13 +- .../WebCore/platform/qt/ScrollbarThemeQt.cpp | 4 +- .../webkit/WebCore/platform/qt/SharedBufferQt.cpp | 2 + .../webkit/WebCore/platform/qt/WheelEventQt.cpp | 2 + .../webkit/WebCore/platform/qt/WidgetQt.cpp | 8 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.cpp | 7 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.h | 1 + .../WebCore/platform/sql/SQLiteTransaction.cpp | 28 +- .../WebCore/platform/sql/SQLiteTransaction.h | 1 + .../webkit/WebCore/platform/text/AtomicString.cpp | 18 +- .../webkit/WebCore/platform/text/AtomicString.h | 16 +- .../WebCore/platform/text/AtomicStringImpl.h | 2 - .../webkit/WebCore/platform/text/Base64.cpp | 11 +- src/3rdparty/webkit/WebCore/platform/text/Base64.h | 1 + .../webkit/WebCore/platform/text/BidiContext.cpp | 2 +- .../webkit/WebCore/platform/text/CharacterNames.h | 3 + .../webkit/WebCore/platform/text/PlatformString.h | 26 +- .../WebCore/platform/text/RegularExpression.h | 2 +- .../webkit/WebCore/platform/text/String.cpp | 11 +- .../webkit/WebCore/platform/text/StringBuilder.cpp | 13 + .../webkit/WebCore/platform/text/StringBuilder.h | 3 + .../webkit/WebCore/platform/text/StringHash.h | 20 +- .../webkit/WebCore/platform/text/StringImpl.cpp | 118 +- .../webkit/WebCore/platform/text/StringImpl.h | 162 +- .../WebCore/platform/text/TextBoundaries.cpp | 79 + .../WebCore/platform/text/TextBoundariesICU.cpp | 77 - .../WebCore/platform/text/TextBreakIterator.h | 2 + .../WebCore/platform/text/TextBreakIteratorICU.cpp | 10 + .../webkit/WebCore/platform/text/TextCodecICU.cpp | 2 +- .../webkit/WebCore/platform/text/TextEncoding.cpp | 21 +- .../platform/text/TextEncodingDetectorICU.cpp | 2 +- .../WebCore/platform/text/TextEncodingRegistry.cpp | 25 +- .../webkit/WebCore/platform/text/TextStream.cpp | 9 +- .../webkit/WebCore/platform/text/TextStream.h | 3 +- .../text/android/TextBreakIteratorInternalICU.cpp | 43 - .../webkit/WebCore/platform/text/cf/StringCF.cpp | 4 +- .../WebCore/platform/text/cf/StringImplCF.cpp | 4 +- .../WebCore/platform/text/qt/TextBoundaries.cpp | 123 - .../WebCore/platform/text/qt/TextBoundariesQt.cpp | 77 + .../platform/text/qt/TextBreakIteratorQt.cpp | 183 - .../WebCore/platform/text/qt/TextCodecQt.cpp | 2 +- .../platform/text/wince/TextBoundariesWince.cpp | 75 + .../platform/text/wince/TextBreakIteratorWince.cpp | 312 + .../webkit/WebCore/platform/win/SystemTimeWin.cpp | 2 +- src/3rdparty/webkit/WebCore/plugins/MimeType.idl | 4 +- .../webkit/WebCore/plugins/MimeTypeArray.idl | 1 - src/3rdparty/webkit/WebCore/plugins/Plugin.idl | 1 - .../webkit/WebCore/plugins/PluginArray.idl | 1 - src/3rdparty/webkit/WebCore/plugins/PluginData.h | 4 +- .../webkit/WebCore/plugins/PluginDatabase.cpp | 9 +- .../webkit/WebCore/plugins/PluginDatabase.h | 6 +- .../webkit/WebCore/plugins/PluginInfoStore.cpp | 7 +- .../WebCore/plugins/PluginMainThreadScheduler.h | 2 +- .../webkit/WebCore/plugins/PluginPackage.cpp | 10 +- .../webkit/WebCore/plugins/PluginPackage.h | 11 +- .../webkit/WebCore/plugins/PluginStream.cpp | 10 +- src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 129 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 60 +- .../webkit/WebCore/plugins/PluginViewNone.cpp | 6 +- src/3rdparty/webkit/WebCore/plugins/PluginWidget.h | 55 + .../WebCore/plugins/mac/PluginPackageMac.cpp | 6 +- .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 190 +- .../webkit/WebCore/plugins/mac/PluginWidgetMac.mm | 49 + .../webkit/WebCore/plugins/qt/PluginDataQt.cpp | 5 +- .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 4 + .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 40 +- .../plugins/symbian/PluginPackageSymbian.cpp | 5 + .../WebCore/plugins/symbian/PluginViewSymbian.cpp | 11 +- .../WebCore/plugins/win/PluginDatabaseWin.cpp | 6 +- .../WebCore/plugins/win/PluginPackageWin.cpp | 8 +- .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 80 +- .../webkit/WebCore/rendering/AutoTableLayout.cpp | 6 +- .../webkit/WebCore/rendering/AutoTableLayout.h | 2 - src/3rdparty/webkit/WebCore/rendering/BidiRun.cpp | 74 + src/3rdparty/webkit/WebCore/rendering/BidiRun.h | 65 + .../webkit/WebCore/rendering/CounterNode.cpp | 221 +- .../webkit/WebCore/rendering/CounterNode.h | 27 +- .../webkit/WebCore/rendering/EllipsisBox.cpp | 49 +- .../webkit/WebCore/rendering/EllipsisBox.h | 8 +- .../webkit/WebCore/rendering/FixedTableLayout.cpp | 2 - .../webkit/WebCore/rendering/FixedTableLayout.h | 2 - .../webkit/WebCore/rendering/HitTestRequest.h | 2 - .../webkit/WebCore/rendering/HitTestResult.h | 2 - .../webkit/WebCore/rendering/InlineFlowBox.cpp | 52 +- .../webkit/WebCore/rendering/InlineIterator.h | 266 + .../webkit/WebCore/rendering/InlineRunBox.h | 2 - .../webkit/WebCore/rendering/InlineTextBox.cpp | 115 +- .../webkit/WebCore/rendering/InlineTextBox.h | 10 +- .../WebCore/rendering/MediaControlElements.cpp | 55 +- .../WebCore/rendering/MediaControlElements.h | 13 +- .../WebCore/rendering/PointerEventsHitRules.cpp | 2 - .../WebCore/rendering/PointerEventsHitRules.h | 2 - .../webkit/WebCore/rendering/RenderArena.cpp | 2 +- .../webkit/WebCore/rendering/RenderArena.h | 3 +- src/3rdparty/webkit/WebCore/rendering/RenderBR.cpp | 4 +- src/3rdparty/webkit/WebCore/rendering/RenderBR.h | 2 - .../webkit/WebCore/rendering/RenderBlock.cpp | 283 +- .../webkit/WebCore/rendering/RenderBlock.h | 26 +- .../WebCore/rendering/RenderBlockLineLayout.cpp | 365 +- .../webkit/WebCore/rendering/RenderBox.cpp | 113 +- src/3rdparty/webkit/WebCore/rendering/RenderBox.h | 10 +- .../WebCore/rendering/RenderBoxModelObject.cpp | 210 +- .../WebCore/rendering/RenderBoxModelObject.h | 4 +- .../webkit/WebCore/rendering/RenderButton.cpp | 2 - .../webkit/WebCore/rendering/RenderButton.h | 2 - .../webkit/WebCore/rendering/RenderCounter.cpp | 378 +- .../webkit/WebCore/rendering/RenderCounter.h | 9 +- .../WebCore/rendering/RenderEmbeddedObject.cpp | 352 + .../WebCore/rendering/RenderEmbeddedObject.h | 64 + .../webkit/WebCore/rendering/RenderFieldset.cpp | 5 +- .../WebCore/rendering/RenderFileUploadControl.cpp | 37 +- .../WebCore/rendering/RenderFileUploadControl.h | 25 +- .../webkit/WebCore/rendering/RenderFlexibleBox.cpp | 50 +- .../WebCore/rendering/RenderForeignObject.cpp | 89 +- .../webkit/WebCore/rendering/RenderForeignObject.h | 32 +- .../webkit/WebCore/rendering/RenderFrame.cpp | 53 + .../webkit/WebCore/rendering/RenderFrame.h | 1 + .../webkit/WebCore/rendering/RenderFrameSet.cpp | 138 +- .../webkit/WebCore/rendering/RenderFrameSet.h | 3 + .../webkit/WebCore/rendering/RenderImage.cpp | 84 +- .../webkit/WebCore/rendering/RenderImage.h | 18 +- .../webkit/WebCore/rendering/RenderInline.cpp | 36 +- .../webkit/WebCore/rendering/RenderInline.h | 4 +- .../webkit/WebCore/rendering/RenderLayer.cpp | 337 +- .../webkit/WebCore/rendering/RenderLayer.h | 34 +- .../WebCore/rendering/RenderLayerBacking.cpp | 250 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 22 +- .../WebCore/rendering/RenderLayerCompositor.cpp | 238 +- .../WebCore/rendering/RenderLayerCompositor.h | 26 +- .../webkit/WebCore/rendering/RenderLineBoxList.cpp | 1 + .../webkit/WebCore/rendering/RenderListBox.cpp | 6 +- .../webkit/WebCore/rendering/RenderListItem.cpp | 51 +- .../webkit/WebCore/rendering/RenderListMarker.cpp | 884 +- .../webkit/WebCore/rendering/RenderListMarker.h | 1 + .../webkit/WebCore/rendering/RenderMarquee.h | 2 +- .../webkit/WebCore/rendering/RenderMedia.cpp | 51 +- .../webkit/WebCore/rendering/RenderMedia.h | 12 +- .../WebCore/rendering/RenderMediaControls.cpp | 9 + .../rendering/RenderMediaControlsChromium.cpp | 18 +- .../webkit/WebCore/rendering/RenderMenuList.cpp | 76 +- .../webkit/WebCore/rendering/RenderMenuList.h | 6 +- .../webkit/WebCore/rendering/RenderObject.cpp | 285 +- .../webkit/WebCore/rendering/RenderObject.h | 65 +- .../WebCore/rendering/RenderObjectChildList.cpp | 23 +- .../WebCore/rendering/RenderObjectChildList.h | 3 +- .../webkit/WebCore/rendering/RenderOverflow.h | 2 +- .../webkit/WebCore/rendering/RenderPart.cpp | 1 + src/3rdparty/webkit/WebCore/rendering/RenderPart.h | 4 + .../webkit/WebCore/rendering/RenderPartObject.cpp | 268 - .../webkit/WebCore/rendering/RenderPartObject.h | 4 +- .../webkit/WebCore/rendering/RenderPath.cpp | 278 +- src/3rdparty/webkit/WebCore/rendering/RenderPath.h | 24 +- .../webkit/WebCore/rendering/RenderReplaced.cpp | 2 +- .../webkit/WebCore/rendering/RenderReplaced.h | 2 +- .../webkit/WebCore/rendering/RenderReplica.cpp | 2 +- .../webkit/WebCore/rendering/RenderReplica.h | 4 + .../webkit/WebCore/rendering/RenderRuby.cpp | 197 + src/3rdparty/webkit/WebCore/rendering/RenderRuby.h | 91 + .../webkit/WebCore/rendering/RenderRubyBase.cpp | 190 + .../webkit/WebCore/rendering/RenderRubyBase.h | 67 + .../webkit/WebCore/rendering/RenderRubyRun.cpp | 228 + .../webkit/WebCore/rendering/RenderRubyRun.h | 85 + .../webkit/WebCore/rendering/RenderRubyText.cpp | 54 + .../webkit/WebCore/rendering/RenderRubyText.h | 56 + .../webkit/WebCore/rendering/RenderSVGBlock.cpp | 32 +- .../webkit/WebCore/rendering/RenderSVGBlock.h | 11 +- .../WebCore/rendering/RenderSVGContainer.cpp | 59 +- .../webkit/WebCore/rendering/RenderSVGContainer.h | 11 +- .../WebCore/rendering/RenderSVGGradientStop.cpp | 2 +- .../WebCore/rendering/RenderSVGHiddenContainer.cpp | 12 +- .../WebCore/rendering/RenderSVGHiddenContainer.h | 3 - .../webkit/WebCore/rendering/RenderSVGImage.cpp | 132 +- .../webkit/WebCore/rendering/RenderSVGImage.h | 65 +- .../webkit/WebCore/rendering/RenderSVGInline.h | 5 + .../webkit/WebCore/rendering/RenderSVGInlineText.h | 4 + .../WebCore/rendering/RenderSVGModelObject.cpp | 10 +- .../WebCore/rendering/RenderSVGModelObject.h | 4 + .../webkit/WebCore/rendering/RenderSVGResource.h | 84 + .../WebCore/rendering/RenderSVGResourceMasker.cpp | 196 + .../WebCore/rendering/RenderSVGResourceMasker.h | 79 + .../webkit/WebCore/rendering/RenderSVGRoot.cpp | 145 +- .../webkit/WebCore/rendering/RenderSVGRoot.h | 23 +- .../rendering/RenderSVGShadowTreeRootContainer.cpp | 101 + .../rendering/RenderSVGShadowTreeRootContainer.h | 50 + .../webkit/WebCore/rendering/RenderSVGText.cpp | 38 +- .../webkit/WebCore/rendering/RenderSVGText.h | 13 +- .../rendering/RenderSVGTransformableContainer.cpp | 18 +- .../rendering/RenderSVGTransformableContainer.h | 6 +- .../rendering/RenderSVGViewportContainer.cpp | 63 +- .../WebCore/rendering/RenderSVGViewportContainer.h | 18 +- .../WebCore/rendering/RenderScrollbarTheme.cpp | 2 +- .../webkit/WebCore/rendering/RenderSelectionInfo.h | 2 +- .../webkit/WebCore/rendering/RenderSlider.cpp | 37 +- .../webkit/WebCore/rendering/RenderTable.cpp | 3 + .../webkit/WebCore/rendering/RenderTableCell.cpp | 48 +- .../webkit/WebCore/rendering/RenderTableCell.h | 6 +- .../webkit/WebCore/rendering/RenderTableRow.cpp | 2 - .../WebCore/rendering/RenderTableSection.cpp | 21 +- .../webkit/WebCore/rendering/RenderText.cpp | 71 +- src/3rdparty/webkit/WebCore/rendering/RenderText.h | 3 +- .../webkit/WebCore/rendering/RenderTextControl.cpp | 99 +- .../webkit/WebCore/rendering/RenderTextControl.h | 18 +- .../rendering/RenderTextControlMultiLine.cpp | 17 +- .../WebCore/rendering/RenderTextControlMultiLine.h | 1 + .../rendering/RenderTextControlSingleLine.cpp | 38 +- .../rendering/RenderTextControlSingleLine.h | 1 + .../webkit/WebCore/rendering/RenderTheme.cpp | 61 +- .../webkit/WebCore/rendering/RenderTheme.h | 11 + .../WebCore/rendering/RenderThemeChromiumLinux.cpp | 56 +- .../WebCore/rendering/RenderThemeChromiumLinux.h | 30 +- .../WebCore/rendering/RenderThemeChromiumMac.h | 1 - .../WebCore/rendering/RenderThemeChromiumMac.mm | 103 +- .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 43 +- .../WebCore/rendering/RenderThemeChromiumSkia.h | 2 + .../WebCore/rendering/RenderThemeChromiumWin.cpp | 2 +- .../WebCore/rendering/RenderThemeChromiumWin.h | 2 +- .../webkit/WebCore/rendering/RenderThemeMac.h | 1 + .../webkit/WebCore/rendering/RenderThemeSafari.cpp | 8 +- .../webkit/WebCore/rendering/RenderThemeWin.cpp | 29 +- .../webkit/WebCore/rendering/RenderThemeWin.h | 2 + .../webkit/WebCore/rendering/RenderThemeWince.cpp | 23 +- .../webkit/WebCore/rendering/RenderTreeAsText.cpp | 123 +- .../webkit/WebCore/rendering/RenderTreeAsText.h | 11 +- .../webkit/WebCore/rendering/RenderVideo.cpp | 166 +- .../webkit/WebCore/rendering/RenderVideo.h | 21 +- .../webkit/WebCore/rendering/RenderView.cpp | 29 +- src/3rdparty/webkit/WebCore/rendering/RenderView.h | 11 +- .../webkit/WebCore/rendering/RenderWidget.cpp | 181 +- .../webkit/WebCore/rendering/RenderWidget.h | 5 +- .../webkit/WebCore/rendering/RootInlineBox.cpp | 1 + .../webkit/WebCore/rendering/RootInlineBox.h | 2 - .../WebCore/rendering/SVGCharacterLayoutInfo.cpp | 4 +- .../WebCore/rendering/SVGCharacterLayoutInfo.h | 54 +- .../webkit/WebCore/rendering/SVGInlineTextBox.cpp | 105 +- .../webkit/WebCore/rendering/SVGInlineTextBox.h | 21 +- .../webkit/WebCore/rendering/SVGMarkerData.h | 134 + .../WebCore/rendering/SVGMarkerLayoutInfo.cpp | 124 + .../webkit/WebCore/rendering/SVGMarkerLayoutInfo.h | 74 + .../webkit/WebCore/rendering/SVGRenderSupport.cpp | 133 +- .../webkit/WebCore/rendering/SVGRenderSupport.h | 77 +- .../WebCore/rendering/SVGRenderTreeAsText.cpp | 78 +- .../webkit/WebCore/rendering/SVGRenderTreeAsText.h | 7 +- .../webkit/WebCore/rendering/SVGRootInlineBox.cpp | 178 +- .../webkit/WebCore/rendering/SVGRootInlineBox.h | 7 +- .../WebCore/rendering/SVGShadowTreeElements.cpp | 80 + .../WebCore/rendering/SVGShadowTreeElements.h | 67 + .../webkit/WebCore/rendering/TableLayout.h | 6 +- .../rendering/TrailingFloatsRootInlineBox.h | 48 + .../webkit/WebCore/rendering/TransformState.cpp | 8 +- .../webkit/WebCore/rendering/TransformState.h | 2 + .../webkit/WebCore/rendering/break_lines.cpp | 62 +- .../webkit/WebCore/rendering/break_lines.h | 2 - .../webkit/WebCore/rendering/style/ContentData.h | 6 +- .../WebCore/rendering/style/CounterContent.h | 2 +- .../webkit/WebCore/rendering/style/FillLayer.cpp | 11 + .../webkit/WebCore/rendering/style/FillLayer.h | 3 +- .../WebCore/rendering/style/LineClampValue.h | 69 + .../webkit/WebCore/rendering/style/RenderStyle.cpp | 11 +- .../webkit/WebCore/rendering/style/RenderStyle.h | 68 +- .../WebCore/rendering/style/RenderStyleConstants.h | 99 +- .../WebCore/rendering/style/SVGRenderStyle.cpp | 55 +- .../WebCore/rendering/style/SVGRenderStyle.h | 342 +- .../WebCore/rendering/style/SVGRenderStyleDefs.cpp | 2 - .../WebCore/rendering/style/SVGRenderStyleDefs.h | 2 - .../webkit/WebCore/rendering/style/ShadowData.h | 3 +- .../WebCore/rendering/style/StyleInheritedData.cpp | 5 +- .../WebCore/rendering/style/StyleInheritedData.h | 1 - .../rendering/style/StyleRareInheritedData.cpp | 5 +- .../rendering/style/StyleRareInheritedData.h | 1 + .../rendering/style/StyleRareNonInheritedData.h | 3 +- src/3rdparty/webkit/WebCore/storage/Database.cpp | 301 +- src/3rdparty/webkit/WebCore/storage/Database.h | 20 +- src/3rdparty/webkit/WebCore/storage/Database.idl | 3 +- .../webkit/WebCore/storage/DatabaseAuthorizer.cpp | 88 +- .../webkit/WebCore/storage/DatabaseAuthorizer.h | 5 + .../webkit/WebCore/storage/DatabaseTask.cpp | 76 +- src/3rdparty/webkit/WebCore/storage/DatabaseTask.h | 78 +- .../webkit/WebCore/storage/DatabaseThread.cpp | 25 +- .../webkit/WebCore/storage/DatabaseThread.h | 11 +- .../webkit/WebCore/storage/DatabaseTracker.cpp | 34 +- .../webkit/WebCore/storage/DatabaseTracker.h | 65 +- .../webkit/WebCore/storage/IDBDatabaseError.h | 64 + .../webkit/WebCore/storage/IDBDatabaseError.idl | 37 + .../webkit/WebCore/storage/IDBDatabaseException.h | 64 + .../WebCore/storage/IDBDatabaseException.idl | 48 + src/3rdparty/webkit/WebCore/storage/IDBRequest.cpp | 64 + src/3rdparty/webkit/WebCore/storage/IDBRequest.h | 88 + src/3rdparty/webkit/WebCore/storage/IDBRequest.idl | 45 + .../WebCore/storage/IndexedDatabaseRequest.cpp | 53 + .../WebCore/storage/IndexedDatabaseRequest.h | 65 + .../WebCore/storage/IndexedDatabaseRequest.idl | 38 + .../webkit/WebCore/storage/LocalStorageTask.h | 11 +- .../webkit/WebCore/storage/LocalStorageThread.cpp | 74 +- .../webkit/WebCore/storage/LocalStorageThread.h | 28 +- .../webkit/WebCore/storage/OriginUsageRecord.cpp | 6 +- .../webkit/WebCore/storage/OriginUsageRecord.h | 2 +- src/3rdparty/webkit/WebCore/storage/SQLError.idl | 3 +- .../webkit/WebCore/storage/SQLResultSet.idl | 3 +- .../webkit/WebCore/storage/SQLResultSetRowList.idl | 3 +- .../webkit/WebCore/storage/SQLTransaction.cpp | 24 +- .../webkit/WebCore/storage/SQLTransaction.h | 1 + .../webkit/WebCore/storage/SQLTransaction.idl | 3 +- .../WebCore/storage/SQLTransactionClient.cpp | 15 +- .../webkit/WebCore/storage/SQLTransactionClient.h | 8 +- .../WebCore/storage/SQLTransactionCoordinator.cpp | 20 +- .../WebCore/storage/SQLTransactionCoordinator.h | 6 +- src/3rdparty/webkit/WebCore/storage/Storage.idl | 1 - src/3rdparty/webkit/WebCore/storage/StorageArea.h | 6 +- .../webkit/WebCore/storage/StorageAreaImpl.cpp | 58 +- .../webkit/WebCore/storage/StorageAreaImpl.h | 9 +- .../webkit/WebCore/storage/StorageAreaSync.cpp | 32 +- .../webkit/WebCore/storage/StorageAreaSync.h | 8 +- .../webkit/WebCore/storage/StorageEvent.cpp | 2 +- .../webkit/WebCore/storage/StorageEvent.idl | 3 +- .../WebCore/storage/StorageEventDispatcher.cpp | 8 +- src/3rdparty/webkit/WebCore/storage/StorageMap.cpp | 34 +- .../webkit/WebCore/storage/StorageNamespace.cpp | 3 +- .../webkit/WebCore/storage/StorageNamespace.h | 31 +- .../webkit/WebCore/storage/StorageSyncManager.cpp | 20 +- .../webkit/WebCore/storage/StorageSyncManager.h | 6 +- .../webkit/WebCore/svg/ElementTimeControl.idl | 2 +- .../webkit/WebCore/svg/GradientAttributes.h | 8 +- .../webkit/WebCore/svg/LinearGradientAttributes.h | 2 - .../webkit/WebCore/svg/PatternAttributes.h | 8 +- .../webkit/WebCore/svg/RadialGradientAttributes.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGAElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp | 13 +- .../webkit/WebCore/svg/SVGAltGlyphElement.cpp | 9 +- .../webkit/WebCore/svg/SVGAltGlyphElement.h | 6 +- src/3rdparty/webkit/WebCore/svg/SVGAngle.h | 16 +- src/3rdparty/webkit/WebCore/svg/SVGAngle.idl | 4 +- .../webkit/WebCore/svg/SVGAnimateColorElement.cpp | 2 - .../webkit/WebCore/svg/SVGAnimateColorElement.h | 2 - .../webkit/WebCore/svg/SVGAnimateElement.cpp | 4 +- .../webkit/WebCore/svg/SVGAnimateElement.h | 2 - .../webkit/WebCore/svg/SVGAnimateMotionElement.cpp | 14 +- .../webkit/WebCore/svg/SVGAnimateMotionElement.h | 5 +- .../WebCore/svg/SVGAnimateTransformElement.cpp | 12 +- .../WebCore/svg/SVGAnimateTransformElement.h | 48 +- .../webkit/WebCore/svg/SVGAnimatedPathData.cpp | 2 - .../webkit/WebCore/svg/SVGAnimatedPathData.h | 2 - .../webkit/WebCore/svg/SVGAnimatedPathData.idl | 2 +- .../webkit/WebCore/svg/SVGAnimatedPoints.cpp | 2 - .../webkit/WebCore/svg/SVGAnimatedPoints.h | 2 - .../webkit/WebCore/svg/SVGAnimatedPoints.idl | 2 +- .../webkit/WebCore/svg/SVGAnimatedProperty.h | 597 +- .../WebCore/svg/SVGAnimatedPropertySynchronizer.h | 96 + .../webkit/WebCore/svg/SVGAnimatedPropertyTraits.h | 186 + .../webkit/WebCore/svg/SVGAnimatedTemplate.h | 133 +- .../webkit/WebCore/svg/SVGAnimationElement.cpp | 23 +- .../webkit/WebCore/svg/SVGAnimationElement.h | 7 +- .../webkit/WebCore/svg/SVGAnimationElement.idl | 2 +- .../webkit/WebCore/svg/SVGCircleElement.cpp | 31 +- src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h | 11 +- .../webkit/WebCore/svg/SVGClipPathElement.cpp | 51 +- .../webkit/WebCore/svg/SVGClipPathElement.h | 12 +- src/3rdparty/webkit/WebCore/svg/SVGColor.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGColor.idl | 4 +- .../svg/SVGComponentTransferFunctionElement.cpp | 52 +- .../svg/SVGComponentTransferFunctionElement.h | 21 +- .../svg/SVGComponentTransferFunctionElement.idl | 2 +- .../webkit/WebCore/svg/SVGCursorElement.cpp | 30 +- src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h | 5 +- src/3rdparty/webkit/WebCore/svg/SVGDescElement.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGDescElement.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGDocument.cpp | 2 +- src/3rdparty/webkit/WebCore/svg/SVGDocument.idl | 2 - .../webkit/WebCore/svg/SVGDocumentExtensions.cpp | 12 + .../webkit/WebCore/svg/SVGDocumentExtensions.h | 60 +- src/3rdparty/webkit/WebCore/svg/SVGElement.cpp | 100 +- src/3rdparty/webkit/WebCore/svg/SVGElement.h | 50 +- src/3rdparty/webkit/WebCore/svg/SVGElement.idl | 2 - .../webkit/WebCore/svg/SVGElementInstance.cpp | 79 +- .../webkit/WebCore/svg/SVGElementInstance.h | 6 - .../webkit/WebCore/svg/SVGElementInstanceList.cpp | 2 - .../webkit/WebCore/svg/SVGElementInstanceList.h | 2 - .../webkit/WebCore/svg/SVGElementRareData.h | 78 + .../webkit/WebCore/svg/SVGEllipseElement.cpp | 36 +- .../webkit/WebCore/svg/SVGEllipseElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGException.idl | 3 +- .../WebCore/svg/SVGExternalResourcesRequired.cpp | 4 - .../WebCore/svg/SVGExternalResourcesRequired.h | 3 +- .../WebCore/svg/SVGExternalResourcesRequired.idl | 2 +- .../webkit/WebCore/svg/SVGFEBlendElement.cpp | 25 +- .../webkit/WebCore/svg/SVGFEBlendElement.h | 9 +- .../webkit/WebCore/svg/SVGFEBlendElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.cpp | 26 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.h | 9 +- .../webkit/WebCore/svg/SVGFEColorMatrixElement.idl | 2 +- .../WebCore/svg/SVGFEComponentTransferElement.cpp | 11 +- .../WebCore/svg/SVGFEComponentTransferElement.h | 5 +- .../webkit/WebCore/svg/SVGFECompositeElement.cpp | 44 +- .../webkit/WebCore/svg/SVGFECompositeElement.h | 17 +- .../webkit/WebCore/svg/SVGFECompositeElement.idl | 2 +- .../WebCore/svg/SVGFEDiffuseLightingElement.cpp | 40 +- .../WebCore/svg/SVGFEDiffuseLightingElement.h | 13 +- .../WebCore/svg/SVGFEDisplacementMapElement.cpp | 32 +- .../WebCore/svg/SVGFEDisplacementMapElement.h | 11 +- .../WebCore/svg/SVGFEDisplacementMapElement.idl | 2 +- .../WebCore/svg/SVGFEDistantLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEDistantLightElement.h | 2 +- .../webkit/WebCore/svg/SVGFEFloodElement.cpp | 2 - .../webkit/WebCore/svg/SVGFEFloodElement.h | 2 - .../webkit/WebCore/svg/SVGFEFloodElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEFuncAElement.cpp | 2 - .../webkit/WebCore/svg/SVGFEFuncAElement.h | 2 - .../webkit/WebCore/svg/SVGFEFuncBElement.cpp | 2 - .../webkit/WebCore/svg/SVGFEFuncBElement.h | 2 - .../webkit/WebCore/svg/SVGFEFuncGElement.cpp | 2 - .../webkit/WebCore/svg/SVGFEFuncGElement.h | 2 - .../webkit/WebCore/svg/SVGFEFuncRElement.cpp | 2 - .../webkit/WebCore/svg/SVGFEFuncRElement.h | 2 - .../WebCore/svg/SVGFEGaussianBlurElement.cpp | 23 +- .../webkit/WebCore/svg/SVGFEGaussianBlurElement.h | 9 +- .../webkit/WebCore/svg/SVGFEImageElement.cpp | 79 +- .../webkit/WebCore/svg/SVGFEImageElement.h | 19 +- .../webkit/WebCore/svg/SVGFEImageElement.idl | 9 +- .../webkit/WebCore/svg/SVGFELightElement.cpp | 55 +- .../webkit/WebCore/svg/SVGFELightElement.h | 25 +- .../webkit/WebCore/svg/SVGFEMergeElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEMergeElement.h | 2 - .../webkit/WebCore/svg/SVGFEMergeNodeElement.cpp | 11 +- .../webkit/WebCore/svg/SVGFEMergeNodeElement.h | 3 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.cpp | 27 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.h | 9 +- .../webkit/WebCore/svg/SVGFEMorphologyElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEOffsetElement.cpp | 24 +- .../webkit/WebCore/svg/SVGFEOffsetElement.h | 9 +- .../webkit/WebCore/svg/SVGFEPointLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFEPointLightElement.h | 2 +- .../WebCore/svg/SVGFESpecularLightingElement.cpp | 45 +- .../WebCore/svg/SVGFESpecularLightingElement.h | 19 +- .../webkit/WebCore/svg/SVGFESpotLightElement.cpp | 4 +- .../webkit/WebCore/svg/SVGFESpotLightElement.h | 2 +- .../webkit/WebCore/svg/SVGFETileElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGFETileElement.h | 5 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.cpp | 38 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.h | 15 +- .../webkit/WebCore/svg/SVGFETurbulenceElement.idl | 2 +- .../webkit/WebCore/svg/SVGFilterElement.cpp | 93 +- src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h | 29 +- .../svg/SVGFilterPrimitiveStandardAttributes.cpp | 38 +- .../svg/SVGFilterPrimitiveStandardAttributes.h | 13 +- .../webkit/WebCore/svg/SVGFitToViewBox.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h | 29 +- .../webkit/WebCore/svg/SVGFitToViewBox.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGFont.cpp | 9 +- src/3rdparty/webkit/WebCore/svg/SVGFontData.h | 2 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp | 9 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.h | 5 +- .../webkit/WebCore/svg/SVGFontFaceElement.cpp | 9 +- .../webkit/WebCore/svg/SVGFontFaceUriElement.cpp | 8 +- .../webkit/WebCore/svg/SVGForeignObjectElement.cpp | 115 +- .../webkit/WebCore/svg/SVGForeignObjectElement.h | 15 +- src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGGElement.h | 9 +- .../webkit/WebCore/svg/SVGGlyphElement.cpp | 4 +- .../webkit/WebCore/svg/SVGGradientElement.cpp | 38 +- .../webkit/WebCore/svg/SVGGradientElement.h | 18 +- .../webkit/WebCore/svg/SVGGradientElement.idl | 2 +- .../webkit/WebCore/svg/SVGHKernElement.cpp | 4 +- .../webkit/WebCore/svg/SVGHKernElement.idl | 2 - .../webkit/WebCore/svg/SVGImageElement.cpp | 50 +- src/3rdparty/webkit/WebCore/svg/SVGImageElement.h | 17 +- src/3rdparty/webkit/WebCore/svg/SVGLangSpace.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGLangSpace.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGLangSpace.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGLength.cpp | 18 +- src/3rdparty/webkit/WebCore/svg/SVGLength.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGLength.idl | 4 +- src/3rdparty/webkit/WebCore/svg/SVGLengthList.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGLengthList.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp | 36 +- src/3rdparty/webkit/WebCore/svg/SVGLineElement.h | 13 +- .../WebCore/svg/SVGLinearGradientElement.cpp | 30 +- .../webkit/WebCore/svg/SVGLinearGradientElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGList.h | 31 +- src/3rdparty/webkit/WebCore/svg/SVGListTraits.h | 28 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.cpp | 20 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.h | 44 +- src/3rdparty/webkit/WebCore/svg/SVGLocatable.idl | 2 +- .../webkit/WebCore/svg/SVGMPathElement.cpp | 18 +- src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h | 7 +- .../webkit/WebCore/svg/SVGMarkerElement.cpp | 91 +- src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h | 32 +- .../webkit/WebCore/svg/SVGMarkerElement.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp | 155 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h | 32 +- src/3rdparty/webkit/WebCore/svg/SVGMatrix.idl | 8 +- .../webkit/WebCore/svg/SVGMetadataElement.cpp | 2 - .../webkit/WebCore/svg/SVGMetadataElement.h | 2 - .../webkit/WebCore/svg/SVGMetadataElement.idl | 2 - src/3rdparty/webkit/WebCore/svg/SVGNumber.idl | 2 - src/3rdparty/webkit/WebCore/svg/SVGNumberList.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGNumberList.h | 4 +- src/3rdparty/webkit/WebCore/svg/SVGPaint.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGPaint.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.idl | 3 +- src/3rdparty/webkit/WebCore/svg/SVGPathSeg.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGPathSeg.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGPathSegArc.h | 2 - .../webkit/WebCore/svg/SVGPathSegClosePath.cpp | 2 - .../webkit/WebCore/svg/SVGPathSegClosePath.h | 2 - .../webkit/WebCore/svg/SVGPathSegCurvetoCubic.cpp | 2 - .../webkit/WebCore/svg/SVGPathSegCurvetoCubic.h | 2 - .../WebCore/svg/SVGPathSegCurvetoCubicSmooth.cpp | 2 - .../WebCore/svg/SVGPathSegCurvetoCubicSmooth.h | 2 - .../WebCore/svg/SVGPathSegCurvetoQuadratic.cpp | 2 - .../WebCore/svg/SVGPathSegCurvetoQuadratic.h | 2 - .../svg/SVGPathSegCurvetoQuadraticSmooth.cpp | 2 - .../WebCore/svg/SVGPathSegCurvetoQuadraticSmooth.h | 2 - .../webkit/WebCore/svg/SVGPathSegLineto.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGPathSegLineto.h | 2 - .../WebCore/svg/SVGPathSegLinetoHorizontal.cpp | 2 - .../WebCore/svg/SVGPathSegLinetoHorizontal.h | 2 - .../WebCore/svg/SVGPathSegLinetoVertical.cpp | 2 - .../webkit/WebCore/svg/SVGPathSegLinetoVertical.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGPathSegList.cpp | 17 +- src/3rdparty/webkit/WebCore/svg/SVGPathSegList.h | 2 +- .../webkit/WebCore/svg/SVGPathSegMoveto.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGPathSegMoveto.h | 2 - .../webkit/WebCore/svg/SVGPatternElement.cpp | 75 +- .../webkit/WebCore/svg/SVGPatternElement.h | 28 +- src/3rdparty/webkit/WebCore/svg/SVGPoint.idl | 2 - src/3rdparty/webkit/WebCore/svg/SVGPointList.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGPointList.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGPointList.idl | 14 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp | 46 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h | 7 +- .../webkit/WebCore/svg/SVGPolygonElement.cpp | 2 - .../webkit/WebCore/svg/SVGPolygonElement.h | 2 - .../webkit/WebCore/svg/SVGPolylineElement.cpp | 2 - .../webkit/WebCore/svg/SVGPolylineElement.h | 2 - .../webkit/WebCore/svg/SVGPreserveAspectRatio.cpp | 131 +- .../webkit/WebCore/svg/SVGPreserveAspectRatio.h | 39 +- .../webkit/WebCore/svg/SVGPreserveAspectRatio.idl | 2 +- .../WebCore/svg/SVGRadialGradientElement.cpp | 57 +- .../webkit/WebCore/svg/SVGRadialGradientElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGRect.idl | 2 - src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp | 46 +- src/3rdparty/webkit/WebCore/svg/SVGRectElement.h | 17 +- .../webkit/WebCore/svg/SVGRenderingIntent.h | 2 - .../webkit/WebCore/svg/SVGRenderingIntent.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp | 114 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h | 37 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.idl | 2 - .../webkit/WebCore/svg/SVGScriptElement.cpp | 20 +- src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h | 7 +- src/3rdparty/webkit/WebCore/svg/SVGSetElement.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGSetElement.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGStopElement.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGStopElement.h | 4 +- src/3rdparty/webkit/WebCore/svg/SVGStringList.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGStringList.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGStylable.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGStylable.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGStylable.idl | 2 +- .../webkit/WebCore/svg/SVGStyleElement.cpp | 16 +- src/3rdparty/webkit/WebCore/svg/SVGStyleElement.h | 2 - .../webkit/WebCore/svg/SVGStyledElement.cpp | 109 +- src/3rdparty/webkit/WebCore/svg/SVGStyledElement.h | 31 +- .../WebCore/svg/SVGStyledLocatableElement.cpp | 8 +- .../webkit/WebCore/svg/SVGStyledLocatableElement.h | 6 +- .../WebCore/svg/SVGStyledTransformableElement.cpp | 40 +- .../WebCore/svg/SVGStyledTransformableElement.h | 76 +- .../webkit/WebCore/svg/SVGSwitchElement.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h | 5 +- .../webkit/WebCore/svg/SVGSymbolElement.cpp | 34 +- src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp | 27 +- src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h | 4 +- .../webkit/WebCore/svg/SVGTSpanElement.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGTSpanElement.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGTests.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGTests.idl | 2 +- .../webkit/WebCore/svg/SVGTextContentElement.cpp | 28 +- .../webkit/WebCore/svg/SVGTextContentElement.h | 11 +- .../webkit/WebCore/svg/SVGTextContentElement.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGTextElement.cpp | 49 +- src/3rdparty/webkit/WebCore/svg/SVGTextElement.h | 16 +- .../webkit/WebCore/svg/SVGTextPathElement.cpp | 35 +- .../webkit/WebCore/svg/SVGTextPathElement.h | 9 +- .../webkit/WebCore/svg/SVGTextPathElement.idl | 2 +- .../WebCore/svg/SVGTextPositioningElement.cpp | 51 +- .../webkit/WebCore/svg/SVGTextPositioningElement.h | 16 +- .../webkit/WebCore/svg/SVGTitleElement.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGTitleElement.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGTransform.cpp | 11 +- src/3rdparty/webkit/WebCore/svg/SVGTransform.h | 18 +- src/3rdparty/webkit/WebCore/svg/SVGTransform.idl | 4 +- .../webkit/WebCore/svg/SVGTransformDistance.cpp | 12 +- .../webkit/WebCore/svg/SVGTransformDistance.h | 48 +- .../webkit/WebCore/svg/SVGTransformList.cpp | 15 +- src/3rdparty/webkit/WebCore/svg/SVGTransformList.h | 4 +- .../webkit/WebCore/svg/SVGTransformList.idl | 14 +- .../webkit/WebCore/svg/SVGTransformable.cpp | 28 +- src/3rdparty/webkit/WebCore/svg/SVGTransformable.h | 47 +- .../webkit/WebCore/svg/SVGTransformable.idl | 2 +- .../webkit/WebCore/svg/SVGURIReference.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGURIReference.h | 5 +- .../webkit/WebCore/svg/SVGURIReference.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.h | 10 +- src/3rdparty/webkit/WebCore/svg/SVGUnitTypes.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp | 514 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.h | 50 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp | 24 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp | 12 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.cpp | 2 - src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.h | 2 - src/3rdparty/webkit/WebCore/svg/SVGZoomAndPan.idl | 2 +- src/3rdparty/webkit/WebCore/svg/SVGZoomEvent.cpp | 2 - .../svg/SynchronizablePropertyController.cpp | 145 - .../WebCore/svg/SynchronizablePropertyController.h | 84 - .../webkit/WebCore/svg/SynchronizableTypeWrapper.h | 180 - .../WebCore/svg/animation/SMILTimeContainer.cpp | 36 +- .../WebCore/svg/animation/SMILTimeContainer.h | 8 +- .../webkit/WebCore/svg/graphics/SVGImage.cpp | 11 +- .../webkit/WebCore/svg/graphics/SVGImage.h | 2 +- .../webkit/WebCore/svg/graphics/SVGPaintServer.cpp | 15 +- .../webkit/WebCore/svg/graphics/SVGPaintServer.h | 9 +- .../svg/graphics/SVGPaintServerGradient.cpp | 96 +- .../WebCore/svg/graphics/SVGPaintServerGradient.h | 10 +- .../WebCore/svg/graphics/SVGPaintServerPattern.cpp | 28 +- .../WebCore/svg/graphics/SVGPaintServerPattern.h | 10 +- .../WebCore/svg/graphics/SVGPaintServerSolid.cpp | 8 +- .../WebCore/svg/graphics/SVGPaintServerSolid.h | 2 +- .../webkit/WebCore/svg/graphics/SVGResource.cpp | 93 +- .../webkit/WebCore/svg/graphics/SVGResource.h | 7 +- .../WebCore/svg/graphics/SVGResourceClipper.cpp | 39 +- .../WebCore/svg/graphics/SVGResourceClipper.h | 13 +- .../WebCore/svg/graphics/SVGResourceFilter.cpp | 96 +- .../WebCore/svg/graphics/SVGResourceFilter.h | 18 +- .../WebCore/svg/graphics/SVGResourceMarker.cpp | 73 +- .../WebCore/svg/graphics/SVGResourceMarker.h | 27 +- .../WebCore/svg/graphics/SVGResourceMasker.cpp | 118 - .../WebCore/svg/graphics/SVGResourceMasker.h | 73 - .../svg/graphics/filters/SVGDistantLightSource.h | 16 +- .../svg/graphics/filters/SVGFEDiffuseLighting.cpp | 6 +- .../svg/graphics/filters/SVGFEDiffuseLighting.h | 6 +- .../svg/graphics/filters/SVGFEDisplacementMap.cpp | 54 +- .../WebCore/svg/graphics/filters/SVGFEFlood.cpp | 2 +- .../WebCore/svg/graphics/filters/SVGFEImage.cpp | 47 +- .../WebCore/svg/graphics/filters/SVGFEImage.h | 22 +- .../WebCore/svg/graphics/filters/SVGFEMerge.cpp | 12 +- .../WebCore/svg/graphics/filters/SVGFEMerge.h | 10 +- .../svg/graphics/filters/SVGFEMorphology.cpp | 80 +- .../WebCore/svg/graphics/filters/SVGFEOffset.cpp | 21 +- .../svg/graphics/filters/SVGFESpecularLighting.cpp | 6 +- .../svg/graphics/filters/SVGFESpecularLighting.h | 6 +- .../WebCore/svg/graphics/filters/SVGFETile.cpp | 21 +- .../WebCore/svg/graphics/filters/SVGFilter.cpp | 5 +- .../WebCore/svg/graphics/filters/SVGFilter.h | 12 +- .../svg/graphics/filters/SVGFilterBuilder.cpp | 4 +- .../WebCore/svg/graphics/filters/SVGLightSource.h | 1 + .../svg/graphics/filters/SVGPointLightSource.h | 14 +- .../svg/graphics/filters/SVGSpotLightSource.h | 22 +- src/3rdparty/webkit/WebCore/svg/svgattrs.in | 1 - src/3rdparty/webkit/WebCore/svg/svgtags.in | 3 +- src/3rdparty/webkit/WebCore/svg/xlinkattrs.in | 1 - .../websockets/ThreadableWebSocketChannel.cpp | 74 + .../websockets/ThreadableWebSocketChannel.h | 69 + .../ThreadableWebSocketChannelClientWrapper.h | 127 + .../webkit/WebCore/websockets/WebSocket.cpp | 118 +- src/3rdparty/webkit/WebCore/websockets/WebSocket.h | 25 +- .../webkit/WebCore/websockets/WebSocket.idl | 1 + .../webkit/WebCore/websockets/WebSocketChannel.cpp | 74 +- .../webkit/WebCore/websockets/WebSocketChannel.h | 30 +- .../WebCore/websockets/WebSocketChannelClient.h | 8 +- .../WebCore/websockets/WebSocketHandshake.cpp | 76 +- .../webkit/WebCore/websockets/WebSocketHandshake.h | 6 +- .../WorkerThreadableWebSocketChannel.cpp | 362 + .../websockets/WorkerThreadableWebSocketChannel.h | 155 + src/3rdparty/webkit/WebCore/wml/WMLAElement.cpp | 4 +- src/3rdparty/webkit/WebCore/wml/WMLCardElement.cpp | 2 +- src/3rdparty/webkit/WebCore/wml/WMLDocument.cpp | 3 +- src/3rdparty/webkit/WebCore/wml/WMLElement.cpp | 2 +- .../webkit/WebCore/wml/WMLInputElement.cpp | 20 +- src/3rdparty/webkit/WebCore/wml/WMLInputElement.h | 4 +- src/3rdparty/webkit/WebCore/wml/WMLPageState.cpp | 1 + src/3rdparty/webkit/WebCore/wml/WMLPageState.h | 1 + .../webkit/WebCore/wml/WMLSelectElement.cpp | 1 - .../webkit/WebCore/workers/AbstractWorker.idl | 3 +- .../WebCore/workers/DedicatedWorkerContext.idl | 3 +- .../workers/DefaultSharedWorkerRepository.cpp | 31 +- .../webkit/WebCore/workers/GenericWorkerTask.h | 48 +- .../webkit/WebCore/workers/SharedWorker.idl | 1 + .../webkit/WebCore/workers/SharedWorkerContext.idl | 3 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 1 + .../webkit/WebCore/workers/WorkerContext.cpp | 24 +- .../webkit/WebCore/workers/WorkerContext.h | 20 +- .../webkit/WebCore/workers/WorkerContext.idl | 6 +- .../webkit/WebCore/workers/WorkerLoaderProxy.h | 6 +- .../webkit/WebCore/workers/WorkerLocation.idl | 1 - .../WebCore/workers/WorkerMessagingProxy.cpp | 30 +- .../webkit/WebCore/workers/WorkerMessagingProxy.h | 6 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 59 +- .../webkit/WebCore/workers/WorkerRunLoop.h | 24 +- .../WebCore/workers/WorkerScriptLoaderClient.h | 4 +- .../webkit/WebCore/workers/WorkerThread.cpp | 65 +- src/3rdparty/webkit/WebCore/xml/DOMParser.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp | 22 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h | 6 +- src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.idl | 1 + .../webkit/WebCore/xml/XMLHttpRequestException.idl | 1 - .../WebCore/xml/XMLHttpRequestProgressEvent.idl | 1 - .../webkit/WebCore/xml/XMLHttpRequestUpload.idl | 1 - src/3rdparty/webkit/WebCore/xml/XMLSerializer.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathEvaluator.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathException.idl | 1 - .../webkit/WebCore/xml/XPathExpression.idl | 3 +- .../webkit/WebCore/xml/XPathExpressionNode.h | 2 +- .../webkit/WebCore/xml/XPathNSResolver.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathNodeSet.h | 2 +- src/3rdparty/webkit/WebCore/xml/XPathResult.idl | 2 +- src/3rdparty/webkit/WebCore/xml/XPathStep.cpp | 15 +- src/3rdparty/webkit/WebCore/xml/XPathStep.h | 2 +- src/3rdparty/webkit/WebCore/xml/XSLImportRule.cpp | 14 +- src/3rdparty/webkit/WebCore/xml/XSLImportRule.h | 2 +- src/3rdparty/webkit/WebCore/xml/XSLStyleSheet.h | 16 +- .../webkit/WebCore/xml/XSLStyleSheetLibxslt.cpp | 12 +- .../webkit/WebCore/xml/XSLStyleSheetQt.cpp | 4 +- src/3rdparty/webkit/WebCore/xml/XSLTProcessor.idl | 3 +- .../webkit/WebCore/xml/XSLTProcessorLibxslt.cpp | 11 +- .../webkit/WebCore/xml/XSLTProcessorQt.cpp | 4 +- src/3rdparty/webkit/WebCore/xml/xmlnsattrs.in | 4 + src/3rdparty/webkit/WebKit.pri | 96 +- src/3rdparty/webkit/WebKit/ChangeLog | 214 + .../webkit/WebKit/StringsNotToBeLocalized.txt | 45 +- .../webkit/WebKit/mac/ChangeLog-2010-01-29 | 23230 +++++ .../WebKit/mac/Configurations/Version.xcconfig | 4 +- .../webkit/WebKit/qt/Api/DerivedSources.pro | 108 + .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 267 +- .../webkit/WebKit/qt/Api/qgraphicswebview.h | 8 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 1 - src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 9 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 237 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h | 11 +- src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h | 5 +- .../webkit/WebKit/qt/Api/qwebinspector.cpp | 14 +- src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h | 11 - src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 219 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 18 - src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h | 18 +- .../webkit/WebKit/qt/Api/qwebsecurityorigin.cpp | 5 + src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 20 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 8 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 169 +- src/3rdparty/webkit/WebKit/qt/Api/qwebview.h | 6 - src/3rdparty/webkit/WebKit/qt/ChangeLog | 2227 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 68 +- .../WebKit/qt/WebCoreSupport/ChromeClientQt.h | 21 + .../WebKit/qt/WebCoreSupport/DragClientQt.cpp | 39 +- .../WebKit/qt/WebCoreSupport/EditorClientQt.cpp | 22 +- .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 143 +- .../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 10 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 101 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.h | 5 +- .../qt/WebCoreSupport/QtFallbackWebPopup.cpp | 169 + .../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h | 65 + .../webkit/WebKit/qt/docs/qtwebkit.qdocconf | 2 +- .../qt/docs/webkitsnippets/webelement/main.cpp | 4 +- .../webkit/WebKit/qt/symbian/eabi/QtWebKitu.def | 4 + .../WebKit/qt/tests/benchmarks/loading/loading.pro | 1 + .../qt/tests/benchmarks/loading/tst_loading.pro | 11 - .../qt/tests/benchmarks/painting/painting.pro | 1 + .../qt/tests/benchmarks/painting/tst_painting.pro | 11 - .../WebKit/qt/tests/hybridPixmap/hybridPixmap.pro | 10 + .../WebKit/qt/tests/hybridPixmap/resources.qrc | 5 + .../webkit/WebKit/qt/tests/hybridPixmap/test.html | 65 + .../qt/tests/hybridPixmap/tst_hybridPixmap.cpp | 52 + .../webkit/WebKit/qt/tests/hybridPixmap/widget.cpp | 119 + .../webkit/WebKit/qt/tests/hybridPixmap/widget.h | 70 + .../webkit/WebKit/qt/tests/hybridPixmap/widget.ui | 95 + .../qt/tests/qgraphicswebview/qgraphicswebview.pro | 11 +- .../qgraphicswebview/tst_qgraphicswebview.cpp | 29 +- .../webkit/WebKit/qt/tests/qwebelement/image.png | Bin 14743 -> 0 bytes .../WebKit/qt/tests/qwebelement/qwebelement.pro | 13 +- .../WebKit/qt/tests/qwebelement/qwebelement.qrc | 7 - .../qt/tests/qwebelement/resources/image.png | Bin 0 -> 14743 bytes .../qt/tests/qwebelement/resources/style.css | 1 + .../qt/tests/qwebelement/resources/style2.css | 1 + .../webkit/WebKit/qt/tests/qwebelement/style.css | 1 - .../webkit/WebKit/qt/tests/qwebelement/style2.css | 1 - .../qt/tests/qwebelement/tst_qwebelement.cpp | 30 +- .../qt/tests/qwebelement/tst_qwebelement.qrc | 7 + .../webkit/WebKit/qt/tests/qwebframe/image.png | Bin 14743 -> 0 bytes .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 14 +- .../webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc | 10 - .../WebKit/qt/tests/qwebframe/resources/image.png | Bin 0 -> 14743 bytes .../WebKit/qt/tests/qwebframe/resources/image2.png | Bin 14743 -> 0 bytes .../WebKit/qt/tests/qwebframe/resources/style.css | 1 + .../WebKit/qt/tests/qwebframe/resources/test1.html | 1 + .../WebKit/qt/tests/qwebframe/resources/test2.html | 1 + .../qt/tests/qwebframe/resources/testiframe.html | 54 + .../qt/tests/qwebframe/resources/testiframe2.html | 21 + .../webkit/WebKit/qt/tests/qwebframe/style.css | 1 - .../webkit/WebKit/qt/tests/qwebframe/test1.html | 1 - .../webkit/WebKit/qt/tests/qwebframe/test2.html | 1 - .../WebKit/qt/tests/qwebframe/testiframe.html | 54 - .../WebKit/qt/tests/qwebframe/testiframe2.html | 21 - .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 216 +- .../WebKit/qt/tests/qwebframe/tst_qwebframe.qrc | 10 + .../WebKit/qt/tests/qwebhistory/data/page1.html | 1 - .../WebKit/qt/tests/qwebhistory/data/page2.html | 1 - .../WebKit/qt/tests/qwebhistory/data/page3.html | 1 - .../WebKit/qt/tests/qwebhistory/data/page4.html | 1 - .../WebKit/qt/tests/qwebhistory/data/page5.html | 1 - .../WebKit/qt/tests/qwebhistory/data/page6.html | 1 - .../WebKit/qt/tests/qwebhistory/qwebhistory.pro | 13 +- .../qt/tests/qwebhistory/resources/page1.html | 1 + .../qt/tests/qwebhistory/resources/page2.html | 1 + .../qt/tests/qwebhistory/resources/page3.html | 1 + .../qt/tests/qwebhistory/resources/page4.html | 1 + .../qt/tests/qwebhistory/resources/page5.html | 1 + .../qt/tests/qwebhistory/resources/page6.html | 1 + .../qt/tests/qwebhistory/tst_qwebhistory.cpp | 2 +- .../qt/tests/qwebhistory/tst_qwebhistory.qrc | 12 +- .../qwebhistoryinterface/qwebhistoryinterface.pro | 12 +- .../qt/tests/qwebinspector/qwebinspector.pro | 1 + .../qt/tests/qwebinspector/tst_qwebinspector.cpp | 68 + .../qt/tests/qwebpage/frametest/frame_a.html | 2 - .../WebKit/qt/tests/qwebpage/frametest/iframe.html | 6 - .../qt/tests/qwebpage/frametest/iframe2.html | 7 - .../qt/tests/qwebpage/frametest/iframe3.html | 5 - .../WebKit/qt/tests/qwebpage/frametest/index.html | 4 - .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 14 +- .../qt/tests/qwebpage/resources/frame_a.html | 2 + .../WebKit/qt/tests/qwebpage/resources/iframe.html | 6 + .../qt/tests/qwebpage/resources/iframe2.html | 7 + .../qt/tests/qwebpage/resources/iframe3.html | 5 + .../WebKit/qt/tests/qwebpage/resources/index.html | 4 + .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 196 +- .../WebKit/qt/tests/qwebpage/tst_qwebpage.qrc | 10 +- .../qwebplugindatabase/qwebplugindatabase.pro | 12 +- .../WebKit/qt/tests/qwebview/data/frame_a.html | 2 - .../WebKit/qt/tests/qwebview/data/index.html | 4 - .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 14 +- .../qt/tests/qwebview/resources/frame_a.html | 2 + .../WebKit/qt/tests/qwebview/resources/index.html | 4 + .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 25 +- .../WebKit/qt/tests/qwebview/tst_qwebview.qrc | 4 +- .../webkit/WebKit/qt/tests/resources/image2.png | Bin 0 -> 14743 bytes src/3rdparty/webkit/WebKit/qt/tests/tests.pri | 23 + src/3rdparty/webkit/WebKit/qt/tests/tests.pro | 4 +- src/3rdparty/webkit/WebKit/qt/tests/util.h | 32 +- 3449 files changed, 290823 insertions(+), 137835 deletions(-) create mode 100644 src/3rdparty/webkit/.gitattributes create mode 100644 src/3rdparty/webkit/JavaScriptCore/API/APIShims.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/bytecompiler/NodesCodegen.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/create_jit_stubs create mode 100644 src/3rdparty/webkit/JavaScriptCore/generated/GeneratedJITStubs_RVCT.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/jit/JITPropertyAccess32_64.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/os-win32/WinMain.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/HeavyProfile.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/HeavyProfile.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/TreeProfile.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/profiler/TreeProfile.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptconverter_p.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptengine_p.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qscriptvalue_p.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/api/qtscriptglobal.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/qscriptengine.pro create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptengine/tst_qscriptengine.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/qscriptvalue.pro create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pri create mode 100644 src/3rdparty/webkit/JavaScriptCore/qt/tests/tests.pro create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSStringBuilder.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/JSZombie.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/MarkStackNone.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/StringBuilder.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h delete mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h create mode 100644 src/3rdparty/webkit/WebCore/ChangeLog-2010-01-29 create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StringBuilder.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/UStringImpl.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCMap.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/WeakGCPtr.h delete mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/PtrAndFlags.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/StringHashFunctions.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/wtf/ValueCheck.h create mode 100644 src/3rdparty/webkit/WebCore/WebCore.ClientBasedGeolocation.exp create mode 100644 src/3rdparty/webkit/WebCore/WebCore.pri create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.cpp create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuList.h create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.cpp create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListOption.h create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.cpp create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityMenuListPopup.h create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.cpp create mode 100644 src/3rdparty/webkit/WebCore/accessibility/AccessibilityScrollbar.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingDOMWindow.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingElement.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurity.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/BindingSecurityBase.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/GenericBinding.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/generic/RuntimeEnabledFeatures.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/DOMObjectWithSVGContext.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayBufferConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayBufferConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasByteArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasFloatArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasIntArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasRenderingContext3DCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasShortArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedByteArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedIntArrayCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayConstructor.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayConstructor.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCanvasUnsignedShortArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectedObjectWrapper.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorBackendCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorCallbackWrapper.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSPopStateEventCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSQuarantinedObjectWrapper.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGContextCache.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGPODListCustom.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGPointListCustom.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSSVGTransformListCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayBufferConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLArrayHelper.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayConstructor.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfile.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JavaScriptProfileNode.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h delete mode 100644 src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm create mode 100644 src/3rdparty/webkit/WebCore/bridge/Bridge.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaStringV8.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h create mode 100644 src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp create mode 100644 src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h delete mode 100644 src/3rdparty/webkit/WebCore/bridge/runtime.cpp delete mode 100644 src/3rdparty/webkit/WebCore/bridge/runtime.h create mode 100644 src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css delete mode 100644 src/3rdparty/webkit/WebCore/dom/ClassNames.cpp delete mode 100644 src/3rdparty/webkit/WebCore/dom/ClassNames.h create mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.h create mode 100644 src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl create mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.h create mode 100644 src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl create mode 100644 src/3rdparty/webkit/WebCore/dom/SpaceSplitString.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/SpaceSplitString.h create mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.h create mode 100644 src/3rdparty/webkit/WebCore/dom/Touch.idl create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.h create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchEvent.idl create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.cpp create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.h create mode 100644 src/3rdparty/webkit/WebCore/dom/TouchList.idl delete mode 100644 src/3rdparty/webkit/WebCore/editing/android/EditorAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/editing/chromium/EditorChromium.cpp delete mode 100644 src/3rdparty/webkit/WebCore/editing/gtk/SelectionControllerGtk.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/ArrayPrototype.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/DatePrototype.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/Grammar.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/Grammar.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSBlob.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSBlob.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasArrayBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasFloatArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasFloatArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext3D.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasRenderingContext3D.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSCanvasUnsignedShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSCompositionEvent.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSDOMWindowBase.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSInjectedScriptHost.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSInspectorFrontendHost.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSONObject.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSPopStateEvent.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouch.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouch.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchEvent.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchList.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSTouchList.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLArrayBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLFloatArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLRenderingContext.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSWebGLUnsignedShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/JSWorkerContextBase.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/Lexer.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/MathObject.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/NumberConstructor.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/RegExpConstructor.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/RegExpObject.lut.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/StringPrototype.lut.h create mode 100644 src/3rdparty/webkit/WebCore/generated/XMLNSNames.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/XMLNSNames.h delete mode 100644 src/3rdparty/webkit/WebCore/generated/chartables.c create mode 100644 src/3rdparty/webkit/WebCore/html/Blob.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/Blob.h create mode 100644 src/3rdparty/webkit/WebCore/html/Blob.idl create mode 100644 src/3rdparty/webkit/WebCore/html/DateComponents.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/DateComponents.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.idl delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.cpp delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.h delete mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl create mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScript.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl mode change 100644 => 100755 src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp create mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl delete mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.h delete mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp delete mode 100644 src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.h create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/consoleIcon.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/gearButtonGlyph.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverArrows.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/popoverBackground.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveHoriz.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbActiveVert.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoriz.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverHoriz.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbHoverVert.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/thumbVert.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipBalloon.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipBalloonBottom.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipIcon.png delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/tipIconPressed.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackHoriz.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Images/trackVert.png create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorBackendStub.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorControllerStub.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/InspectorFrontendHostStub.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Popover.js delete mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Popup.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Section.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/Settings.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceCSSTokenizer.re2js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/SourceTokenizer.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorHighlighter.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextEditorModel.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TextViewer.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TimelineGrid.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TimelineOverviewPane.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/WelcomeView.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/audits.css create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/popover.css create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h create mode 100644 src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp create mode 100644 src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h create mode 100644 src/3rdparty/webkit/WebCore/mathml/mathattrs.in create mode 100644 src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h create mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationController.cpp create mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationController.h create mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationControllerClient.h create mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationError.h create mode 100644 src/3rdparty/webkit/WebCore/page/GeolocationPosition.h create mode 100644 src/3rdparty/webkit/WebCore/page/MediaCanStartListener.h delete mode 100644 src/3rdparty/webkit/WebCore/page/android/DragControllerAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/page/android/EventHandlerAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/page/android/InspectorControllerAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/PlatformTouchEvent.h create mode 100644 src/3rdparty/webkit/WebCore/platform/PlatformTouchPoint.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/ClipboardAndroid.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/CursorAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/DragDataAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/EventLoopAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/FileChooserAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/FileSystemAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/KeyEventAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/KeyboardCodes.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/LocalizedStringsAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/PopupMenuAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/RenderThemeAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/RenderThemeAndroid.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/ScreenAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/ScrollViewAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/SearchPopupMenuAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/SystemTimeAndroid.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/TemporaryLinkStubs.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/android/WidgetAndroid.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/BinaryPropertyList.h create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/FileSystemCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/KURLCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/RunLoopTimerCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SchedulePair.h create mode 100644 src/3rdparty/webkit/WebCore/platform/cf/SharedBufferCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/ColorSpace.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/GraphicsContext3D.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/TypesettingFeatures.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/ImageBufferFilter.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/opentype/OpenTypeSanitizer.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLDisplayOpenVG.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/EGLUtils.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/PainterOpenVG.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/SurfaceOpenVG.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/openvg/VGUtils.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformData.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontFallbackListQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/FontQt43.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/transforms/AffineTransform.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCacheWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformData.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontDatabase.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontDatabase.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformData.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontPlatformDataWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/FontWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsContextWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/GraphicsLayerCACF.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IconWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageCairoWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/ImageWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntPointWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntRectWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/IntSizeWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWin.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/QTMovieWinTimer.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/SimpleFontDataWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/TransformationMatrixWin.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/UniscribeController.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFContextFlusher.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayer.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/win/WKCACFLayerRenderer.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/image-decoders/wx/ImageDecoderWx.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/AuthenticationClient.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationCF.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/AuthenticationChallenge.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/CredentialStorageCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/DNSCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/FormDataStreamCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/FormDataStreamCFNet.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/LoaderRunLoopCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/LoaderRunLoopCF.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceError.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceErrorCF.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceHandleCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequest.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequestCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceRequestCFNet.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceResponse.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/ResourceResponseCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamError.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamHandle.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandlePrivate.h create mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/network/qt/SocketStreamHandleSoup.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchEventQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/PlatformTouchPointQt.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.h create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/qt/QtAbstractWebPopup.h create mode 100644 src/3rdparty/webkit/WebCore/platform/text/TextBoundaries.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/TextBoundariesICU.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/android/TextBreakIteratorInternalICU.cpp delete mode 100644 src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundaries.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/qt/TextBoundariesQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/wince/TextBoundariesWince.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/text/wince/TextBreakIteratorWince.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/PluginWidget.h create mode 100644 src/3rdparty/webkit/WebCore/plugins/mac/PluginWidgetMac.mm create mode 100644 src/3rdparty/webkit/WebCore/rendering/BidiRun.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/BidiRun.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/InlineIterator.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderEmbeddedObject.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRuby.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRuby.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyBase.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyRun.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyText.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderRubyText.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResource.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGResourceMasker.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderSVGShadowTreeRootContainer.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerData.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGMarkerLayoutInfo.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/SVGShadowTreeElements.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/TrailingFloatsRootInlineBox.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/style/LineClampValue.h create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.h create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseError.idl create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.h create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBDatabaseException.idl create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.h create mode 100644 src/3rdparty/webkit/WebCore/storage/IDBRequest.idl create mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.cpp create mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.h create mode 100644 src/3rdparty/webkit/WebCore/storage/IndexedDatabaseRequest.idl create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertySynchronizer.h create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGAnimatedPropertyTraits.h create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGElementRareData.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp delete mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizableTypeWrapper.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMasker.cpp delete mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/SVGResourceMasker.h create mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.cpp create mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannel.h create mode 100644 src/3rdparty/webkit/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h create mode 100644 src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp create mode 100644 src/3rdparty/webkit/WebCore/websockets/WorkerThreadableWebSocketChannel.h create mode 100644 src/3rdparty/webkit/WebCore/xml/xmlnsattrs.in create mode 100644 src/3rdparty/webkit/WebKit/mac/ChangeLog-2010-01-29 create mode 100644 src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp create mode 100644 src/3rdparty/webkit/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/loading.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/painting.pro delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/hybridPixmap.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/resources.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/test.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/tst_hybridPixmap.cpp create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.cpp create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.h create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/image.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/resources/style2.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.qrc delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/image.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image.png delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/image2.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/style.css create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test1.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/test2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test1.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page1.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page3.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page4.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page5.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page6.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe2.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe2.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html delete mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/tests.pri diff --git a/src/3rdparty/webkit/.gitattributes b/src/3rdparty/webkit/.gitattributes new file mode 100644 index 0000000..80386ae --- /dev/null +++ b/src/3rdparty/webkit/.gitattributes @@ -0,0 +1,273 @@ +# To enable automatic merging of ChangeLog files, use the following command: +# git config merge.changelog.driver "resolve-ChangeLogs --merge-driver %O %A %B" +ChangeLog* merge=changelog + +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore.sln -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj -crlf +JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln -crlf +JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj -crlf +JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops -crlf +JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj -crlf +JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops -crlf +JavaScriptCore/JavaScriptCore.vcproj/testapi/testapi.vcproj -crlf +LayoutTests/dom/svg/level3/xpath/Attribute_Nodes.svg -crlf +LayoutTests/dom/svg/level3/xpath/Attribute_Nodes_xmlns.svg -crlf +LayoutTests/dom/svg/level3/xpath/Comment_Nodes.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_Expressions.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_ID.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_3.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_empty.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_hasFeature_null.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_3.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_empty.svg -crlf +LayoutTests/dom/svg/level3/xpath/Conformance_isSupported_null.svg -crlf +LayoutTests/dom/svg/level3/xpath/Element_Nodes.svg -crlf +LayoutTests/dom/svg/level3/xpath/Processing_Instruction_Nodes.svg -crlf +LayoutTests/dom/svg/level3/xpath/Text_Nodes.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluatorCast01.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_INVALID_EXPRESSION_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_01.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NAMESPACE_ERR_02.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_NS.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createExpression_no_NS.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_all.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_document.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_createNSResolver_documentElement.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_INVALID_EXPRESSION_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NAMESPACE_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_NOT_SUPPORTED_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_TYPE_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_document.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_documentElement.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_NOT_SUPPORTED_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_WRONG_DOCUMENT_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_document.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathExpression_evaluate_documentElement.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_nist_dmstc.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_null.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_prefix.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathNSResolver_lookupNamespaceURI_xml.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_TYPE_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_false.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_booleanValue_true.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ANY_UNORDERED_NODE_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_BOOLEAN_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_FIRST_ORDERED_NODE_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_NUMBER_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_ITERATOR_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_STRING_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_ITERATOR_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_invalidIteratorState_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_iterateNext_INVALID_STATE_ERR.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_iteratorNext_ORDERED_NODE_ITERATOR_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_numberValue.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_resultType.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_ANY_UNORDERED_NODE_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_singleNodeValue_FIRST_ORDERED_NODE_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_count.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_UNORDERED_NODE_SNAPSHOT_TYPE_null.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_ORDERED_NODE_SNAPSHOT_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotLength_UNORDERED_NODE_SNAPSHOT_TYPE.svg -crlf +LayoutTests/dom/svg/level3/xpath/XPathResult_stringValue.svg -crlf +LayoutTests/editing/execCommand/align-in-span.html -crlf +LayoutTests/editing/selection/drag-start-event-client-x-y.html -crlf +LayoutTests/fast/backgrounds/background-position-rounding.html -crlf +LayoutTests/fast/backgrounds/repeat/resources/background-repeat-shorthand.js -crlf +LayoutTests/fast/backgrounds/repeat/resources/margin-shorthand.js -crlf +LayoutTests/fast/block/float/clamped-right-float.html -crlf +LayoutTests/fast/block/positioning/absolute-with-html-border-quirks.html -crlf +LayoutTests/fast/block/positioning/absolute-with-html-border-strict.html -crlf +LayoutTests/fast/canvas/script-tests/canvas-gradient-without-path.js -crlf +LayoutTests/fast/css/color-quirk.html -crlf +LayoutTests/fast/css/color-strict.html -crlf +LayoutTests/fast/css/css1_forward_compatible_parsing.html -crlf +LayoutTests/fast/css/empty-pseudo-class.html -crlf +LayoutTests/fast/css/first-child-pseudo-class.html -crlf +LayoutTests/fast/css/first-of-type-pseudo-class.html -crlf +LayoutTests/fast/css/last-child-pseudo-class.html -crlf +LayoutTests/fast/css/last-of-type-pseudo-class.html -crlf +LayoutTests/fast/css/only-child-pseudo-class.html -crlf +LayoutTests/fast/css/only-of-type-pseudo-class.html -crlf +LayoutTests/fast/css/text-input-with-webkit-border-radius.html -crlf +LayoutTests/fast/dom/Document/open-with-pending-load.html -crlf +LayoutTests/fast/dom/Element/hostname-host.html -crlf +LayoutTests/fast/dom/StyleSheet/ownerNode-lifetime-2.html -crlf +LayoutTests/fast/dom/Window/window-property-clearing-expected.txt -crlf +LayoutTests/fast/dom/everything-to-string.html -crlf +LayoutTests/fast/dom/insert-span-into-long-text-bug-28245.html -crlf +LayoutTests/fast/dom/resources/TestApplet.java -crlf +LayoutTests/fast/dom/simultaneouslyRegsiteredTimerFireOrder-expected.txt -crlf +LayoutTests/fast/dom/timer-clear-interval-in-handler-and-generate-error.html -crlf +LayoutTests/fast/events/keydown-keypress-focus-change.html -crlf +LayoutTests/fast/events/node-event-anchor-lock.html -crlf +LayoutTests/fast/events/onload-fires-twice.html -crlf +LayoutTests/fast/events/set-event-in-another-frame.html -crlf +LayoutTests/fast/events/set-event-to-null.html -crlf +LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-main.html -crlf +LayoutTests/fast/forms/resources/form-and-frame-interaction-retains-values-submit.html -crlf +LayoutTests/fast/forms/select-remove-option.html -crlf +LayoutTests/fast/forms/select-reset-multiple-selections-4-single-selection.html -crlf +LayoutTests/fast/forms/textfield-onchange-deletion.html -crlf +LayoutTests/fast/frames/frame-src-attribute.html -crlf +LayoutTests/fast/frames/iframe-scroll-page-up-down.html-disabled -crlf +LayoutTests/fast/frames/javascript-url-as-framesrc-crash.html -crlf +LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-1.html -crlf +LayoutTests/fast/frames/resources/iframe-scroll-page-up-down-2.html -crlf +LayoutTests/fast/frames/viewsource-attribute.html -crlf +LayoutTests/fast/inline/inline-padding-disables-text-quirk.html -crlf +LayoutTests/fast/loader/submit-form-while-parsing-1.xhtml -crlf +LayoutTests/fast/overflow/dynamic-hidden.html -crlf +LayoutTests/fast/parser/external-entities-in-xslt.xml -crlf +LayoutTests/fast/parser/external-entities.xml -crlf +LayoutTests/fast/parser/resources/external-entities.xsl -crlf +LayoutTests/fast/replaced/replaced-breaking.html -crlf +LayoutTests/fast/table/dynamic-cellpadding.html -crlf +LayoutTests/fast/table/fixed-table-with-percent-inside-percent-table.html -crlf +LayoutTests/fast/table/fixed-table-with-percent-width-inside-auto-table.html -crlf +LayoutTests/fast/table/fixed-table-with-percent-width-inside-extra-large-div.html -crlf +LayoutTests/fast/table/fixed-table-with-small-percent-width.html -crlf +LayoutTests/fast/table/rules-attr-dynchange1.html -crlf +LayoutTests/fast/table/rules-attr-dynchange2.html -crlf +LayoutTests/fast/text/international/thai-baht-space.html -crlf +LayoutTests/fast/text/resources/line-breaks-crlf.txt -crlf +LayoutTests/fast/text/text-large-negative-letter-spacing-with-opacity.html -crlf +LayoutTests/fast/text/text-letter-spacing.html -crlf +LayoutTests/http/tests/appcache/max-size.html -crlf +LayoutTests/http/tests/misc/location-test-xsl-style-sheet.xml -crlf +LayoutTests/http/tests/misc/resources/location-test-xsl-style-sheet.xsl -crlf +LayoutTests/http/tests/misc/single-character-pi-stylesheet.xhtml -crlf +LayoutTests/http/tests/misc/will-send-request-returns-null-on-redirect.html -crlf +LayoutTests/http/tests/navigation/no-referrer-reset.html -crlf +LayoutTests/http/tests/navigation/no-referrer-same-window.html -crlf +LayoutTests/http/tests/navigation/no-referrer-subframe.html -crlf +LayoutTests/http/tests/navigation/no-referrer-target-blank.html -crlf +LayoutTests/http/tests/navigation/resources/no-referrer-same-window-helper.php -crlf +LayoutTests/http/tests/security/isolatedWorld/events.html -crlf +LayoutTests/http/tests/security/isolatedWorld/resources/iframe.html -crlf +LayoutTests/http/tests/security/isolatedWorld/resources/userGestureEvents-second-window.html -crlf +LayoutTests/http/tests/security/isolatedWorld/userGestureEvents.html -crlf +LayoutTests/http/tests/security/resources/empty-svg.php -crlf +LayoutTests/platform/win/fast/events/panScroll-event-fired.html -crlf +LayoutTests/platform/win/fast/events/panScroll-image-no-scroll.html -crlf +LayoutTests/platform/win/fast/events/panScroll-imageMap-href-no-scroll.html -crlf +LayoutTests/platform/win/fast/events/panScroll-imageMap-noHref-scroll.html -crlf +LayoutTests/platform/win/fast/events/panScroll-nested-divs.html -crlf +LayoutTests/platform/win/fast/events/panScroll-no-iframe-jump.html -crlf +LayoutTests/platform/win/fast/events/panScroll-preventDefault.html -crlf +LayoutTests/svg/custom/marker-opacity.svg -crlf +LayoutTests/svg/custom/resources/graffiti.svg -crlf +LayoutTests/svg/custom/struct-use-09-b.svg -crlf +LayoutTests/svg/custom/svg-fonts-in-html.html -crlf +LayoutTests/svg/custom/use-events-crash.svg -crlf +LayoutTests/svg/custom/use-on-symbol-inside-pattern.svg -crlf +LayoutTests/svg/custom/use-setAttribute-crash.svg -crlf +LayoutTests/svg/custom/xml-stylesheet.svg -crlf +LayoutTests/tables/mozilla/bugs/bug119786.html -crlf +LayoutTests/tables/mozilla/bugs/bug222846.html -crlf +LayoutTests/tables/mozilla/bugs/bug275625.html -crlf +LayoutTests/tables/mozilla/images/aboutHeader.gif -crlf +LayoutTests/tables/mozilla/images/main-horizontal-scroll.gif -crlf +LayoutTests/tables/mozilla_expected_failures/bugs/bug101759.html -crlf +LayoutTests/tables/mozilla_expected_failures/bugs/bug14489.html -crlf +LayoutTests/tables/mozilla_expected_failures/images/aboutHeader.gif -crlf +LayoutTests/tables/mozilla_expected_failures/images/main-horizontal-scroll.gif -crlf +LayoutTests/wml/resources/enter-card-with-events.wml -crlf +LayoutTests/wml/resources/enter-first-card-with-events.wml -crlf +PageLoadTests/svg/files/Harvey_Rayner.svg -crlf +PageLoadTests/svg/files/cacuts_01.svg -crlf +PageLoadTests/svg/files/crawfish2_ganson.svg -crlf +PageLoadTests/svg/files/france.svg -crlf +PageLoadTests/svg/files/mtsthelens.svg -crlf +PageLoadTests/svg/files/worldcup.svg -crlf +PlanetWebKit/planet/LICENCE -crlf +SunSpider/tests/parse-only/jquery-1.3.2.js -crlf +WebCore/WebCore.vcproj/QTMovieWin.vcproj -crlf +WebCore/WebCore.vcproj/WebCore.sln -crlf +WebCore/WebCore.vcproj/WebCore.submit.sln -crlf +WebCore/WebCore.vcproj/WebCore.vcproj -crlf +WebCore/WebCore.vcproj/WebCoreCFNetwork.vsprops -crlf +WebCore/WebCore.vcproj/WebCoreCG.vsprops -crlf +WebCore/WebCore.vcproj/WebCoreCURL.vsprops -crlf +WebCore/WebCore.vcproj/WebCoreCairo.vsprops -crlf +WebCore/WebCore.vcproj/WebCoreGenerated.vcproj -crlf +WebCore/WebCore.vcproj/WebCoreMediaQT.vsprops -crlf +WebCore/WebCore.vcproj/WebCorePthreads.vsprops -crlf +WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops -crlf +WebCore/accessibility/AccessibilityAllInOne.cpp -crlf +WebCore/bindings/js/JSExceptionBase.cpp -crlf +WebCore/bindings/js/JSExceptionBase.h -crlf +WebCore/manual-tests/DOMContextMenuEvent.html -crlf +WebCore/manual-tests/cursor-max-size.html -crlf +WebCore/manual-tests/drag-with-div-or-image-as-data-image.html -crlf +WebCore/manual-tests/empty-script-crash.html -crlf +WebCore/manual-tests/remove-form-node-with-radio-buttons-crash.html -crlf +WebCore/manual-tests/select-delete-item.html -crlf +WebCore/manual-tests/textarea-caret-position-after-auto-spell-correct.html -crlf +WebCore/platform/chromium/SuddenTerminationChromium.cpp -crlf +WebCore/platform/network/win/NetworkStateNotifierWin.cpp -crlf +WebCore/platform/wx/wxcode/non-kerned-drawing.h -crlf +WebCore/rendering/RenderThemeChromiumWin.h -crlf +WebKit/chromium/src/EventListenerWrapper.cpp -crlf +WebKit/chromium/src/EventListenerWrapper.h -crlf +WebKit/chromium/src/WebEventListener.cpp -crlf +WebKit/chromium/src/WebEventListenerPrivate.cpp -crlf +WebKit/chromium/src/WebEventListenerPrivate.h -crlf +WebKit/gtk/po/sr.po -crlf +WebKit/gtk/po/sr@latin.po -crlf +WebKit/qt/tests/qwebframe/resources/testiframe.html -crlf +WebKit/qt/tests/qwebframe/resources/testiframe2.html -crlf +WebKit/win/COMPropertyBag.h -crlf +WebKit/win/COMVariantSetter.h -crlf +WebKit/win/Interfaces/IWebEmbeddedView.idl -crlf +WebKit/win/Interfaces/JavaScriptCoreAPITypes.idl -crlf +WebKit/win/WebCoreSupport/EmbeddedWidget.cpp -crlf +WebKit/win/WebCoreSupport/EmbeddedWidget.h -crlf +WebKit/win/WebCoreSupport/WebInspectorDelegate.h -crlf +WebKit/win/WebIconFetcher.cpp -crlf +WebKit/win/WebIconFetcher.h -crlf +WebKit/win/WebKit.vcproj/Interfaces.vcproj -crlf +WebKit/win/WebKit.vcproj/WebKit.sln -crlf +WebKit/win/WebKit.vcproj/WebKit.submit.sln -crlf +WebKit/win/WebKit.vcproj/WebKit.vcproj -crlf +WebKit/win/WebKit.vcproj/WebKitGUID.vcproj -crlf +WebKitLibraries/win/tools/vsprops/WinCairo.vsprops -crlf +WebKitLibraries/win/tools/vsprops/cURL.vsprops -crlf +WebKitLibraries/win/tools/vsprops/debug_wincairo.vsprops -crlf +WebKitSite/blog/license.txt -crlf +WebKitSite/blog/wp-config-sample.php -crlf +WebKitSite/blog/wp-config.php -crlf +WebKitSite/blog/wp-includes/images/crystal/license.txt -crlf +WebKitSite/blog/wp-includes/js/scriptaculous/MIT-LICENSE -crlf +WebKitSite/blog/wp-includes/js/swfupload/plugins/swfupload.speed.js -crlf +WebKitSite/blog/wp-includes/js/tinymce/license.txt -crlf +WebKitSite/perf/slickspeed/frameworks/DomQuery.js -crlf +WebKitTools/CLWrapper/CLWrapper.sln -crlf +WebKitTools/CLWrapper/CLWrapper.vcproj -crlf +WebKitTools/DumpRenderTree/DumpRenderTree.sln -crlf +WebKitTools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp -crlf +WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj -crlf +WebKitTools/DumpRenderTree/win/ImageDiff.vcproj -crlf +WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def -crlf +WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.rc -crlf +WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj -crlf +WebKitTools/FindSafari/FindSafari.vcproj -crlf +WebKitTools/FindSafari/Safari.exe.manifest -crlf +WebKitTools/MIDLWrapper/MIDLWrapper.sln -crlf +WebKitTools/MIDLWrapper/MIDLWrapper.vcproj -crlf +WebKitTools/Scripts/webkitpy/mock.py -crlf +WebKitTools/WebKitAPITest/WebKitAPITest.vcproj -crlf +WebKitTools/WebKitAPITest/WebKitAPITestCommon.vsprops -crlf +WebKitTools/WebKitLauncherWin/WebKitLauncherWin.vcproj -crlf +WebKitTools/WinLauncher/WinLauncher.h -crlf +WebKitTools/WinLauncher/WinLauncher.vcproj -crlf +WebKitTools/record-memory-win/main.cpp -crlf +WebKitTools/record-memory-win/record-memory-win.vcproj -crlf diff --git a/src/3rdparty/webkit/.gitignore b/src/3rdparty/webkit/.gitignore index b9595b3..607a22e 100644 --- a/src/3rdparty/webkit/.gitignore +++ b/src/3rdparty/webkit/.gitignore @@ -4,3 +4,21 @@ *.pyc build/ /WebKitBuild/ +autoinstall.cache.d + +# Ignore Chromium projects auto-generated from .gyp files: +JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.xcodeproj +WebCore/WebCore.gyp/WebCore.xcodeproj +WebKit/chromium/WebKit.xcodeproj + +# Though the GTK build builds in a subdirectory, autogen.sh still deposits +# a few files into the source tree. +/aclocal.m4 +/autom4te.cache +/autotools +/autotoolsconfig.h.in +/configure +/GNUmakefile.in +/gtk-doc.make +/INSTALL +/README diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 1e89d1e..7bcf76e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,594 @@ +2010-02-20 Noam Rosenthal + + Reviewed by Laszlo Gombos. + + [Qt] ENABLE_3D_RENDERING should be optional + https://bugs.webkit.org/show_bug.cgi?id=35100 + + * WebKit.pri: ENABLE_3D_RENDERING moved to a proper feature test + +2010-02-19 Maciej Stachowiak + + Reviewed by David Levin. + + Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases + https://bugs.webkit.org/show_bug.cgi?id=35147 + + * configure.ac: + +2010-02-18 Tor Arne Vestbø + + Reviewed by Eric Seidel. + + Add .gitattributes file for custom ChangeLog merge-driver + + * .gitattributes: Added. + +2010-02-17 Noam Rosenthal + + Reviewed by Ariya Hidayat. + + [Qt] GraphicsLayer: support perspective and 3D transforms + https://bugs.webkit.org/show_bug.cgi?id=34960 + + * WebKit.pri: added appropriate define: ENABLED_3D_RENDERING + +2010-02-15 Philippe Normand + + Reviewed by Gustavo Noronha Silva. + + [GStreamer] Should handle BUFFERING messages + https://bugs.webkit.org/show_bug.cgi?id=30004 + + * configure.ac: Bump gstreamer -core/-plugins-base requirements to + 0.10.25 which is the minimum required version for on-disk buffering. + +2010-02-16 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump version to 1.1.22 so we can depend on it in applications. + + * configure.ac: + +2010-02-12 Simon Hausmann + + Reviewed by Holger Freyther. + + Removed WMLInputElement.* from .gitattributes as the file is + now CRLF clean. + + * .gitattributes: + +2010-02-10 Jocelyn Turcotte + + Reviewed by Tor Arne Vestbø. + + [Qt] Make qtlauncher and qgvlauncher use the generated headers + path to make sure they are correctly generated. + + * WebKit.pri: + +2010-02-10 Jocelyn Turcotte + + Reviewed by Tor Arne Vestbø. + + [Qt] Manually add support for the install target on Symbian. + + This is required to copy the headers over the ones in Qt. + + * WebKit.pro: + +2010-02-11 Fridrich Strba + + Reviewed by Gustavo Noronha Silva. + + Detect properly different versions of libpng out there. + + * configure.ac: + +2010-02-11 Xan Lopez + + Try to fix GTK+ build. + + * configure.ac: + +2010-02-11 Antonio Gomes + + Reviewed by Xan Lopez. + + Adjust gstreamer-plugins-base minimum version check (from 0.10 to 0.10.23). + + * configure.ac: + +2010-02-08 Maciej Stachowiak + + Reviewed by Cameron Zwarich. + + Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose. + https://bugs.webkit.org/show_bug.cgi?id=34698 + + * configure.ac: + +2010-02-08 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + Bump version to 1.1.21, and adjust library versioning accordingly. + + * configure.ac: + +2010-02-05 Sebastian Dröge + + Reviewed by Gustavo Noronha. + + Add gstreamer-app-0.10 to configure.ac + https://bugs.webkit.org/show_bug.cgi?id=34317 + + * configure.ac: + +2010-02-05 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + Add .gitattributes file to tell git about files with Windows linefeeds + https://bugs.webkit.org/show_bug.cgi?id=34645 + + On Windows git defaults to "true" for core.autocrlf, meaning all text + files in the working directory are converted from CRLF to LF on checkin + time. Some files present in the repository have been checked in with + CRLF linefeeds and git should not try to convert them. The added + .gitattributes file tells git to not do any CRLF conversion. + + * .gitattributes: Added. + +2010-02-05 Tor Arne Vestbø + + Reviewed by Simon Hausmann. + + [Qt] Generate convenience headers (QWebView, etc) using qmake + + In Qt this is done using syncqt, but we use a pro-file instead + that generates makefile-rules for each of the extra headers. + + These extra headers are installed alongside the normal headers. + + * DerivedSources.pro: Include API-DerivedSources + +2010-02-04 Tor Arne Vestbø + + Reviewed by Lars Knoll. + + [Qt] Make 'make -f Makefile.DerivedSources qmake' work + + Previously this target ended up generating a file named + Makefile.DerivedSources.DerivedSources, and so on. + + * DerivedSources.pro: + +2010-02-04 Christian Dywan + + Reviewed by Xan Lopez. + + Require either libsoup 2.28.2 or 2.29.90. + + * configure.ac: + +2010-02-04 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump minimum libsoup requirement to 2.29.90 + + * configure.ac: + +2010-02-02 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + Bump version, and adjust library versioning for 1.1.20. + + * configure.ac: + +2010-01-29 Jeremy Orlow + + Reviewed by Dimitri Glazkov. + + A first step towards the Indexed Database API + https://bugs.webkit.org/show_bug.cgi?id=34342 + + Add Indexed Database API + + * configure.ac: + +2010-01-27 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Don't build the tests in packages, only the launcher(s) + + * WebKit.pro: + +2010-01-27 Jocelyn Turcotte + + Reviewed by Tor Arne Vestbø. + + [Qt] Add the "d" suffix to QtWebKit's dll on Windows. + + * WebKit.pri: + +2010-01-27 Jocelyn Turcotte + + Unreviewed build fix + + [Qt] Build fix for windows when QTDIR contains release libraries. + + * WebKit.pri: Use the .lib syntax for linking instead of qmake's -l emulation + +2010-01-26 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + First steps of the QtScript API. + + Two new classes were created; QScriptEngine and QScriptValue. + The first should encapsulate a javascript context and the second a script + value. + + This API is still in development, so it isn't compiled by default. + To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to + build-webkit. + + https://bugs.webkit.org/show_bug.cgi?id=32565 + + * WebKit.pro: + +2010-01-25 Simon Hausmann + + Reviewed by Laszlo Gombos. + + [Qt] Fix the build on Maemo5. + + https://bugs.webkit.org/show_bug.cgi?id=34051 + + * WebKit.pri: Disable the use of uitools, just like it's done for Symbian. + +2010-01-21 No'am Rosenthal + + Reviewed by Antti Koivisto. + + [Qt] Implement GraphicsLayer for accelerated layer compositing + https://bugs.webkit.org/show_bug.cgi?id=33514 + + * WebKit.pri: Addded compile flags to enable accelerated compositing + on versions higher than 4.5 + +2010-01-20 Tor Arne Vestbø + + Reviewed by Simon Hausmann. + + [Qt] Make DumpRenderTree build on Windows + + * WebKit.pro: + +2010-01-20 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Fix the recursive generated_files target to work with qmake -r -o + + * DerivedSources.pro: + +2010-01-20 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Make it possible (on *nix at least) to recursively call "make generated_files" + + * DerivedSources.pro: + +2010-01-19 Gustavo Noronha Silva + + Unreviewed. Shared library versioning update for 1.1.19. + + * configure.ac: + +2010-01-15 Gustavo Noronha Silva + + Rubber-stamped by Xan Lopez. + + Bump version to 1.1.19. + + * configure.ac: + +2010-01-14 Csaba Osztrogonác + + Reviewed by Eric Seidel. + + [Qt] Defective dependencies caused build failing on QtBuildBot. + https://bugs.webkit.org/show_bug.cgi?id=33693 + + * WebKit.pri: CONFIG += depend_includepath added. + +2010-01-14 Steve Block + + Reviewed by David Levin. + + Moves general includes before bindings includes in Android build system. + https://bugs.webkit.org/show_bug.cgi?id=33623 + + This avoids problems with collisions between WebCore/platform/text/StringBuilder.h + and the new JavaScriptCore/runtime/StringBuilder.h. This change puts + JavaScriptCore/runtime and other bindings includes after the WebCore and other + general includes, so that the WebCore StringBuilder.h is picked up when building + WebCore. + + * Android.mk: Modified. + +2010-01-13 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Split the build process in two different .pro files. + This allows qmake to be run once all source files are available. + + * DerivedSources.pro: Added. + * WebKit.pri: + +2010-01-07 Daniel Bates + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=32987 + + Added ENABLE_XHTMLMP flag. Disabled by default. + + * configure.ac: + +2010-01-05 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + Based on idea and original patch by Evan Martin. + + Remove libWebCore intermediate library, to improve link time. + + [GTK] Build time must be reduced + https://bugs.webkit.org/show_bug.cgi?id=32921 + + * GNUmakefile.am: + +2010-01-05 Xan Lopez + + Bump for 1.1.18 release. + + * configure.ac: + +2010-01-04 Gustavo Noronha Silva + + Fix JSCore-1.0.gir path to fix make distcheck. + + * GNUmakefile.am: + +2010-01-04 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix standalone package builds. + + * WebKit.pri: Add logic for detecting standalone builds. Set OUTPUT_DIR to the top-level dir in that case. + * WebKit.pro: Don't build JSC and DRT for package builds. + +2010-01-04 Eric Seidel + + Reviewed by Adam Barth. + + bugzilla-tool should not require users to install mechanize + https://bugs.webkit.org/show_bug.cgi?id=32635 + + * .gitignore: Ignore autoinstall.cache.d directory created by autoinstall.py + +2009-12-28 Estêvão Samuel Procópio + + Reviewed by Gustavo Noronha Silva. + + Bug 32940: [GTK] Changing the download throttle conditions. + https://bugs.webkit.org/show_bug.cgi?id=32716 + + The WebKitDownload progress notification was taking long to + update. This fix makes notification happens each 0.7 secs + or when the progress ups in 1%. + + * WebKit/gtk/webkit/webkitdownload.cpp: + +2009-12-22 Simon Hausmann + + Rubber-stamped by Holger Freyther. + + Adjusted path to QtLauncher. + + * WebKit.pro: + +2009-12-19 Evan Martin + + Reviewed by Gustavo Noronha Silva. + + Add a couple of WebKitGtk files to .gitignore. + + * .gitignore: + +2009-12-18 Benjamin Otte + + Reviewed by Xan Lopez. + + [GTK] RemoveDashboard support. It's useless. + + * configure.ac: + +2009-12-18 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Clean up the qmake build system to distinguish between trunk builds and package builds + + https://bugs.webkit.org/show_bug.cgi?id=32716 + + * WebKit.pri: Use standalone_package instead of QTDIR_build + +2009-12-17 Gustavo Noronha Silva + + Unreviewed. Build fixes for make distcheck. + + * GNUmakefile.am: + +2009-12-16 Dan Winship + + Reviewed by Gustavo Noronha Silva. + + [Gtk] Content-Encoding support + + https://bugs.webkit.org/show_bug.cgi?id=522772 + + * configure.ac: require libsoup 2.28.2 for SoupContentDecoder + +2009-12-13 Eric Seidel + + Reviewed by Gavin Barraclough. + + string-base64 test does not compute a valid base64 string + http://bugs.webkit.org/show_bug.cgi?id=16806 + + * tests/string-base64.js: change str[i] to str.charCodeAt(i) + +2009-12-10 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + [GTK] Should provide an API to control the IconDatabase + https://bugs.webkit.org/show_bug.cgi?id=32334 + + Add test to make sure favicon reporting works. + + * GNUmakefile.am: + +2009-12-09 Steve Block + + Reviewed by Adam Barth. + + Adds Android Makefiles for building with V8. + https://bugs.webkit.org/show_bug.cgi?id=32278 + + * Android.mk: Modified. Includes Makefiles for V8. + +2009-12-08 Steve Block + + Reviewed by Adam Barth. + + [Android] Adds Makefiles for Android port. + https://bugs.webkit.org/show_bug.cgi?id=31325 + + * Android.mk: Added. + +2009-12-08 Christian Dywan + + Reviewed by Xan Lopez. + + * configure.ac: Require only libSoup 2.27.91 but check for 2.29.3 + and define HAVE_LIBSOUP_2_29_3 in that case. + +2009-12-08 Gustavo Noronha Silva + + Rubber-stamped by Xan Lopez. + + Late post-release version bump. + + * configure.ac: + +2009-12-08 Dominik Röttsches + + Reviewed by Gustavo Noronha Silva. + + [Gtk] Create a TextBreakIterator implementation based on GLib (without ICU) + https://bugs.webkit.org/show_bug.cgi?id=31469 + + Removing hybrid configuration for --with-unicode-backend=glib + ICU not required anymore. + + * autotools/webkit.m4: + +2009-12-08 Nikolas Zimmermann + + Rubber-stamped by Maciej Stachowiak. + + Turn on (SVG) Filters for Gtk. + https://bugs.webkit.org/show_bug.cgi?id=32224 + + * configure.ac: + +2009-12-07 Dmitry Titov + + Rubber-stamped by Darin Adler. + + Remove ENABLE_SHARED_SCRIPT flags + https://bugs.webkit.org/show_bug.cgi?id=32245 + This patch was obtained by "git revert" command and then un-reverting of ChangeLog files. + + * configure.ac: + +2009-12-06 Gustavo Noronha Silva + + Reviewed by Xan Lopez. + + Build the new API test. + + [GTK] REGRESSION: webkit thinks it can render PDFs + https://bugs.webkit.org/show_bug.cgi?id=32183 + + * GNUmakefile.am: + +2009-12-05 Vincent Untz + + Reviewed by Gustavo Noronha. + + Fixes race for builds with introspection enabled, and parallel + make. + + * GNUmakefile.am: + +2009-12-04 Xan Lopez + + Reviewed by Gustavo Noronha. + + [GTK]Enable DNS prefetching + https://bugs.webkit.org/show_bug.cgi?id=23846 + + Bump libsoup required version to 2.29.3 for DNS prefetching. + + * configure.ac: + +2009-11-30 Gustavo Noronha Silva + + Rubber-stamped by Xan Lopez. + + Make sure we distribute and install GObject Introspection files. + + * GNUmakefile.am: + +2009-11-30 Gustavo Noronha Silva + + Build fix. Make sure JSCore-1.0.gir is added to the distributed + tarball. + + * GNUmakefile.am: + +2009-11-30 Xan Lopez + + Reviewed by Gustavo Noronha. + + Bump versions for 1.1.17 release. + + * configure.ac: + 2009-11-30 Jan-Arve Sæther Reviewed by Simon Hausmann. @@ -8,6 +599,110 @@ * WebKit.pri: +2009-11-26 Laszlo Gombos + + Reviewed by Oliver Hunt. + + Move GOwnPtr* from wtf to wtf/gtk + https://bugs.webkit.org/show_bug.cgi?id=31793 + + * GNUmakefile.am: Add JavaScriptCore/wtf/gtk to + the include path. + +2009-11-24 Dmitry Titov + + Reviewed by Eric Seidel. + + Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit + https://bugs.webkit.org/show_bug.cgi?id=31444 + + * configure.ac: + +2009-11-24 Jason Smith + + Reviewed by Alexey Proskuryakov. + + RegExp#exec's returned Array-like object behaves differently from + regular Arrays + https://bugs.webkit.org/show_bug.cgi?id=31689 + + * LayoutTests/fast/js/regexp-in-and-foreach-handling.html: Added. + * LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js: Added. + * LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt: Added. + +2009-11-24 Jens Alfke + + Reviewed by David Levin. + + Ignore Chromium's Xcode projects that are auto-generated from .gyp files. + https://bugs.webkit.org/show_bug.cgi?id=31847 + + * .gitignore: Add three .xcodeproj files. + +2009-11-09 Priit Laes + + Reviewed by Oliver Hunt. + + [Gtk] Build from tarball fails with --enable-introspection + https://bugs.webkit.org/show_bug.cgi?id=31261 + + We need to enable gobject-introspection during distcheck otherwise + some of the required files are missing in tarball. + + * GNUmakefile.am: + +2009-11-05 Priit Laes + + Reviewed by Jan Alonzo. + + [Gtk] Build failure with --enable-introspection + https://bugs.webkit.org/show_bug.cgi?id=31102 + + Add search and include paths for JSCore-1.0.gir required by + gobject-introspection tools. + + * GNUmakefile.am: + +2009-11-04 Benjamin Otte + + Reviewed by Gustavo Noronha. + + Update Cairo requirement to 1.6. + + https://bugs.webkit.org/show_bug.cgi?id=19266 + + * configure.ac: + +2009-11-02 Estêvão Samuel Procópio + + Reviewed by Gustavo Noronha. + + [Build] make install ignores --prefix option for gobject-introspection. + https://bugs.webkit.org/show_bug.cgi?id=31025 + + Make the build system use the --prefix path also when installing + gobject-introspection files. + + * configure.ac: use --prefix path in GITDIR and GIRTYPELIBDIR + +2009-11-02 Xan Lopez + + Bump version before release (or post-release, depending on your + point of view) so that we can make applications depending on + unreleased APIs in WebKit svn fail at configure time when the + requirements are not met. + + * configure.ac: + +2009-11-01 Laszlo Gombos + + Reviewed by Eric Seidel. + + Turn on warnings for QtWebKit for gcc + https://bugs.webkit.org/show_bug.cgi?id=30958 + + * WebKit.pri: Turn on warnings for the GCC compiler + 2009-10-30 Adam Barth Reviewed by Mark Rowe. @@ -22,6 +717,19 @@ * .gitignore: Added. +2009-10-30 Roland Steiner + + Reviewed by Eric Seidel. + + Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. + + Bug 28420 - Implement HTML5 rendering + (https://bugs.webkit.org/show_bug.cgi?id=28420) + + No new tests (no functional change). + + * configure.ac: + 2009-10-26 Holger Hans Peter Freyther Rubber-stamped by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h index b9167a8..4284c44 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h @@ -51,16 +51,20 @@ typedef struct OpaqueJSValue* JSObjectRef; inline JSC::ExecState* toJS(JSContextRef c) { + ASSERT(c); return reinterpret_cast(const_cast(c)); } inline JSC::ExecState* toJS(JSGlobalContextRef c) { + ASSERT(c); return reinterpret_cast(c); } -inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v) +inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) { + ASSERT_UNUSED(exec, exec); + ASSERT(v); #if USE(JSVALUE32_64) JSC::JSCell* jsCell = reinterpret_cast(const_cast(v)); if (!jsCell) @@ -73,6 +77,20 @@ inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v) #endif } +inline JSC::JSValue toJSForGC(JSC::ExecState* exec, JSValueRef v) +{ + ASSERT_UNUSED(exec, exec); + ASSERT(v); +#if USE(JSVALUE32_64) + JSC::JSCell* jsCell = reinterpret_cast(const_cast(v)); + if (!jsCell) + return JSC::JSValue(); + return jsCell; +#else + return JSC::JSValue::decode(reinterpret_cast(const_cast(v))); +#endif +} + inline JSC::JSObject* toJS(JSObjectRef o) { return reinterpret_cast(o); diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h b/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h new file mode 100644 index 0000000..9a6cacb --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/API/APIShims.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef APIShims_h +#define APIShims_h + +#include "CallFrame.h" +#include "JSLock.h" + +namespace JSC { + +class APIEntryShimWithoutLock { +protected: + APIEntryShimWithoutLock(JSGlobalData* globalData, bool registerThread) + : m_globalData(globalData) + , m_entryIdentifierTable(setCurrentIdentifierTable(globalData->identifierTable)) + { + if (registerThread) + globalData->heap.registerThread(); + m_globalData->timeoutChecker.start(); + } + + ~APIEntryShimWithoutLock() + { + m_globalData->timeoutChecker.stop(); + setCurrentIdentifierTable(m_entryIdentifierTable); + } + +private: + JSGlobalData* m_globalData; + IdentifierTable* m_entryIdentifierTable; +}; + +class APIEntryShim : public APIEntryShimWithoutLock { +public: + // Normal API entry + APIEntryShim(ExecState* exec, bool registerThread = true) + : APIEntryShimWithoutLock(&exec->globalData(), registerThread) + , m_lock(exec) + { + } + + // JSPropertyNameAccumulator only has a globalData. + APIEntryShim(JSGlobalData* globalData, bool registerThread = true) + : APIEntryShimWithoutLock(globalData, registerThread) + , m_lock(globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly) + { + } + +private: + JSLock m_lock; +}; + +class APICallbackShim { +public: + APICallbackShim(ExecState* exec) + : m_dropAllLocks(exec) + , m_globalData(&exec->globalData()) + { + resetCurrentIdentifierTable(); + } + + ~APICallbackShim() + { + setCurrentIdentifierTable(m_globalData->identifierTable); + } + +private: + JSLock::DropAllLocks m_dropAllLocks; + JSGlobalData* m_globalData; +}; + +} + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp index 4a32d35..ebfeafa 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.cpp @@ -28,6 +28,7 @@ #include "JSBasePrivate.h" #include "APICast.h" +#include "APIShims.h" #include "Completion.h" #include "OpaqueJSString.h" #include "SourceCode.h" @@ -43,8 +44,7 @@ using namespace JSC; JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsThisObject = toJS(thisObject); @@ -69,8 +69,7 @@ JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef th bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber); Completion completion = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source); @@ -94,12 +93,11 @@ void JSGarbageCollect(JSContextRef ctx) return; ExecState* exec = toJS(ctx); - JSGlobalData& globalData = exec->globalData(); - - JSLock lock(globalData.isSharedInstance ? LockForReal : SilenceAssertionsOnly); + APIEntryShim entryShim(exec, false); + JSGlobalData& globalData = exec->globalData(); if (!globalData.heap.isBusy()) - globalData.heap.collect(); + globalData.heap.collectAllGarbage(); // FIXME: Perhaps we should trigger a second mark and sweep // once the garbage collector is done if this is called when @@ -109,8 +107,6 @@ void JSGarbageCollect(JSContextRef ctx) void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); - + APIEntryShim entryShim(exec); exec->globalData().heap.reportExtraMemoryCost(size); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h index d1ce9b3..2e16720 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSBase.h @@ -65,27 +65,15 @@ typedef struct OpaqueJSValue* JSObjectRef; /* JavaScript symbol exports */ #undef JS_EXPORT -#if defined(BUILDING_WX__) +#if defined(JS_NO_EXPORT) #define JS_EXPORT #elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__) #define JS_EXPORT __attribute__((visibility("default"))) -#elif defined(_WIN32_WCE) - #if defined(JS_BUILDING_JS) - #define JS_EXPORT __declspec(dllexport) - #elif defined(JS_IMPORT_JS) - #define JS_EXPORT __declspec(dllimport) - #else - #define JS_EXPORT - #endif -#elif defined(WIN32) || defined(_WIN32) - /* - * TODO: Export symbols with JS_EXPORT when using MSVC. - * See http://bugs.webkit.org/show_bug.cgi?id=16227 - */ +#elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE) #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) - #define JS_EXPORT __declspec(dllexport) + #define JS_EXPORT __declspec(dllexport) #else - #define JS_EXPORT __declspec(dllimport) + #define JS_EXPORT __declspec(dllimport) #endif #else #define JS_EXPORT diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp index 1c33962..9c5f6d7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "JSCallbackConstructor.h" +#include "APIShims.h" #include "APICast.h" #include #include @@ -66,7 +67,7 @@ static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, con JSValueRef exception = 0; JSObjectRef result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception); } if (exception) diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h index c4bd7ad..e529947 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h @@ -41,7 +41,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } protected: diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp index b7dd768..0e434d9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.cpp @@ -27,6 +27,7 @@ #include #include "JSCallbackFunction.h" +#include "APIShims.h" #include "APICast.h" #include "CodeBlock.h" #include "JSFunction.h" @@ -61,7 +62,7 @@ JSValue JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSVa JSValueRef exception = 0; JSValueRef result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = static_cast(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); } if (exception) diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h index 0cf25c4..10dae6b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h @@ -41,7 +41,7 @@ public: // refactor the code so this override isn't necessary static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } private: diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h index d19890a..adb5b60 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h @@ -50,7 +50,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount); } protected: @@ -61,6 +61,7 @@ private: virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); @@ -69,7 +70,7 @@ private: virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); - virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); virtual double toNumber(ExecState*) const; virtual UString toString(ExecState*) const; diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h index 9b726e8..4b28a99 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "APIShims.h" #include "APICast.h" #include "Error.h" #include "JSCallbackFunction.h" @@ -79,7 +80,7 @@ void JSCallbackObject::init(ExecState* exec) // initialize from base to derived for (int i = static_cast(initRoutines.size()) - 1; i >= 0; i--) { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); JSObjectInitializeCallback initialize = initRoutines[i]; initialize(toRef(exec), toRef(this)); } @@ -117,7 +118,7 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifie if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { if (!propertyNameRef) propertyNameRef = OpaqueJSString::create(propertyName.ustring()); - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); if (hasProperty(ctx, thisRef, propertyNameRef.get())) { slot.setCustom(this, callbackGetter); return true; @@ -128,18 +129,18 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifie JSValueRef exception = 0; JSValueRef value; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); } - exec->setException(toJS(exec, exception)); - if (value) { - slot.setValue(toJS(exec, value)); - return true; - } if (exception) { + exec->setException(toJS(exec, exception)); slot.setValue(jsUndefined()); return true; } + if (value) { + slot.setValue(toJS(exec, value)); + return true; + } } if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { @@ -167,6 +168,25 @@ bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, unsigned proper } template +bool JSCallbackObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + PropertySlot slot; + if (getOwnPropertySlot(exec, propertyName, slot)) { + // Ideally we should return an access descriptor, but returning a value descriptor is better than nothing. + JSValue value = slot.getValue(exec, propertyName); + if (!exec->hadException()) + descriptor.setValue(value); + // We don't know whether the property is configurable, but assume it is. + descriptor.setConfigurable(true); + // We don't know whether the property is enumerable (we could call getOwnPropertyNames() to find out), but assume it isn't. + descriptor.setEnumerable(false); + return true; + } + + return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor); +} + +template void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { JSContextRef ctx = toRef(exec); @@ -181,10 +201,11 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName JSValueRef exception = 0; bool result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); if (result || exception) return; } @@ -199,10 +220,11 @@ void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName JSValueRef exception = 0; bool result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); if (result || exception) return; } else @@ -237,10 +259,11 @@ bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& p JSValueRef exception = 0; bool result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); if (result || exception) return true; } @@ -298,10 +321,11 @@ JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* construct JSValueRef exception = 0; JSObject* result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); return result; } } @@ -322,10 +346,11 @@ bool JSCallbackObject::hasInstance(ExecState* exec, JSValue value, JSValue JSValueRef exception = 0; bool result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = hasInstance(execRef, thisRef, valueRef, &exception); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); return result; } } @@ -360,10 +385,11 @@ JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, JSValueRef exception = 0; JSValue result; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); } - exec->setException(toJS(exec, exception)); + if (exception) + exec->setException(toJS(exec, exception)); return result; } } @@ -373,14 +399,14 @@ JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, } template -void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { JSContextRef execRef = toRef(exec); JSObjectRef thisRef = toRef(this); for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { if (JSObjectGetPropertyNamesCallback getPropertyNames = jsClass->getPropertyNames) { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); getPropertyNames(execRef, thisRef, toRef(&propertyNames)); } @@ -390,7 +416,7 @@ void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameAr for (iterator it = staticValues->begin(); it != end; ++it) { UString::Rep* name = it->first.get(); StaticValueEntry* entry = it->second; - if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum)) + if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties))) propertyNames.add(Identifier(exec, name)); } } @@ -401,13 +427,13 @@ void JSCallbackObject::getOwnPropertyNames(ExecState* exec, PropertyNameAr for (iterator it = staticFunctions->begin(); it != end; ++it) { UString::Rep* name = it->first.get(); StaticFunctionEntry* entry = it->second; - if (!(entry->attributes & kJSPropertyAttributeDontEnum)) + if (!(entry->attributes & kJSPropertyAttributeDontEnum) || (mode == IncludeDontEnumProperties)) propertyNames.add(Identifier(exec, name)); } } } - Base::getOwnPropertyNames(exec, propertyNames); + Base::getOwnPropertyNames(exec, propertyNames, mode); } template @@ -426,7 +452,7 @@ double JSCallbackObject::toNumber(ExecState* exec) const JSValueRef exception = 0; JSValueRef value; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); } if (exception) { @@ -435,7 +461,8 @@ double JSCallbackObject::toNumber(ExecState* exec) const } double dValue; - return toJS(exec, value).getNumber(dValue) ? dValue : NaN; + if (value) + return toJS(exec, value).getNumber(dValue) ? dValue : NaN; } return Base::toNumber(exec); @@ -452,14 +479,15 @@ UString JSCallbackObject::toString(ExecState* exec) const JSValueRef exception = 0; JSValueRef value; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); value = convertToType(ctx, thisRef, kJSTypeString, &exception); } if (exception) { exec->setException(toJS(exec, exception)); return ""; } - return toJS(exec, value).getString(); + if (value) + return toJS(exec, value).getString(exec); } return Base::toString(exec); @@ -504,16 +532,17 @@ JSValue JSCallbackObject::staticValueGetter(ExecState* exec, const Identif JSValueRef exception = 0; JSValueRef value; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } - exec->setException(toJS(exec, exception)); + if (exception) { + exec->setException(toJS(exec, exception)); + return jsUndefined(); + } if (value) return toJS(exec, value); - if (exception) - return jsUndefined(); } - + return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); } @@ -557,14 +586,15 @@ JSValue JSCallbackObject::callbackGetter(ExecState* exec, const Identifier JSValueRef exception = 0; JSValueRef value; { - JSLock::DropAllLocks dropAllLocks(exec); + APICallbackShim callbackShim(exec); value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); } - exec->setException(toJS(exec, exception)); + if (exception) { + exec->setException(toJS(exec, exception)); + return jsUndefined(); + } if (value) return toJS(exec, value); - if (exception) - return jsUndefined(); } return throwError(exec, ReferenceError, "hasProperty callback returned true for a property that doesn't exist."); diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp index 3785bab..717488f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.cpp @@ -33,11 +33,28 @@ #include #include #include +#include +using namespace std; using namespace JSC; +using namespace WTF::Unicode; const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +static inline UString tryCreateStringFromUTF8(const char* string) +{ + if (!string) + return UString::null(); + + size_t length = strlen(string); + Vector buffer(length); + UChar* p = buffer.data(); + if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length)) + return UString::null(); + + return UString(buffer.data(), p - buffer.data()); +} + OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass) : parentClass(definition->parentClass) , prototypeClass(0) @@ -52,7 +69,7 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* , callAsConstructor(definition->callAsConstructor) , hasInstance(definition->hasInstance) , convertToType(definition->convertToType) - , m_className(UString::Rep::createFromUTF8(definition->className)) + , m_className(tryCreateStringFromUTF8(definition->className)) , m_staticValues(0) , m_staticFunctions(0) { @@ -61,8 +78,14 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* if (const JSStaticValue* staticValue = definition->staticValues) { m_staticValues = new OpaqueJSClassStaticValuesTable(); while (staticValue->name) { - StaticValueEntry* e = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes); - m_staticValues->add(UString::Rep::createFromUTF8(staticValue->name), e); + UString valueName = tryCreateStringFromUTF8(staticValue->name); + if (!valueName.isNull()) { + // Use a local variable here to sidestep an RVCT compiler bug. + StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes); + UStringImpl* impl = valueName.rep(); + impl->ref(); + m_staticValues->add(impl, entry); + } ++staticValue; } } @@ -70,8 +93,14 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* if (const JSStaticFunction* staticFunction = definition->staticFunctions) { m_staticFunctions = new OpaqueJSClassStaticFunctionsTable(); while (staticFunction->name) { - StaticFunctionEntry* e = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes); - m_staticFunctions->add(UString::Rep::createFromUTF8(staticFunction->name), e); + UString functionName = tryCreateStringFromUTF8(staticFunction->name); + if (!functionName.isNull()) { + // Use a local variable here to sidestep an RVCT compiler bug. + StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes); + UStringImpl* impl = functionName.rep(); + impl->ref(); + m_staticFunctions->add(impl, entry); + } ++staticFunction; } } @@ -82,12 +111,12 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* OpaqueJSClass::~OpaqueJSClass() { - ASSERT(!m_className.rep()->identifierTable()); + ASSERT(!m_className.rep()->isIdentifier()); if (m_staticValues) { OpaqueJSClassStaticValuesTable::const_iterator end = m_staticValues->end(); for (OpaqueJSClassStaticValuesTable::const_iterator it = m_staticValues->begin(); it != end; ++it) { - ASSERT(!it->first->identifierTable()); + ASSERT(!it->first->isIdentifier()); delete it->second; } delete m_staticValues; @@ -96,7 +125,7 @@ OpaqueJSClass::~OpaqueJSClass() if (m_staticFunctions) { OpaqueJSClassStaticFunctionsTable::const_iterator end = m_staticFunctions->end(); for (OpaqueJSClassStaticFunctionsTable::const_iterator it = m_staticFunctions->begin(); it != end; ++it) { - ASSERT(!it->first->identifierTable()); + ASSERT(!it->first->isIdentifier()); delete it->second; } delete m_staticFunctions; @@ -115,56 +144,46 @@ static void clearReferenceToPrototype(JSObjectRef prototype) { OpaqueJSClassContextData* jsClassData = static_cast(JSObjectGetPrivate(prototype)); ASSERT(jsClassData); - jsClassData->cachedPrototype = 0; + jsClassData->cachedPrototype.clear(toJS(prototype)); } -PassRefPtr OpaqueJSClass::create(const JSClassDefinition* definition) +PassRefPtr OpaqueJSClass::create(const JSClassDefinition* clientDefinition) { - if (const JSStaticFunction* staticFunctions = definition->staticFunctions) { - // copy functions into a prototype class - JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; - protoDefinition.staticFunctions = staticFunctions; - protoDefinition.finalize = clearReferenceToPrototype; - - // We are supposed to use JSClassRetain/Release but since we know that we currently have - // the only reference to this class object we cheat and use a RefPtr instead. - RefPtr protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0)); - - // remove functions from the original class - JSClassDefinition objectDefinition = *definition; - objectDefinition.staticFunctions = 0; + JSClassDefinition definition = *clientDefinition; // Avoid modifying client copy. - return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass.get())); - } - - return adoptRef(new OpaqueJSClass(definition, 0)); + JSClassDefinition protoDefinition = kJSClassDefinitionEmpty; + protoDefinition.finalize = clearReferenceToPrototype; + swap(definition.staticFunctions, protoDefinition.staticFunctions); // Move static functions to the prototype. + + // We are supposed to use JSClassRetain/Release but since we know that we currently have + // the only reference to this class object we cheat and use a RefPtr instead. + RefPtr protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0)); + return adoptRef(new OpaqueJSClass(&definition, protoClass.get())); } OpaqueJSClassContextData::OpaqueJSClassContextData(OpaqueJSClass* jsClass) : m_class(jsClass) - , cachedPrototype(0) { if (jsClass->m_staticValues) { staticValues = new OpaqueJSClassStaticValuesTable; OpaqueJSClassStaticValuesTable::const_iterator end = jsClass->m_staticValues->end(); for (OpaqueJSClassStaticValuesTable::const_iterator it = jsClass->m_staticValues->begin(); it != end; ++it) { - ASSERT(!it->first->identifierTable()); - StaticValueEntry* e = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes); - staticValues->add(UString::Rep::createCopying(it->first->data(), it->first->size()), e); - + ASSERT(!it->first->isIdentifier()); + // Use a local variable here to sidestep an RVCT compiler bug. + StaticValueEntry* entry = new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes); + staticValues->add(UString::Rep::create(it->first->data(), it->first->length()), entry); } - } else staticValues = 0; - if (jsClass->m_staticFunctions) { staticFunctions = new OpaqueJSClassStaticFunctionsTable; OpaqueJSClassStaticFunctionsTable::const_iterator end = jsClass->m_staticFunctions->end(); for (OpaqueJSClassStaticFunctionsTable::const_iterator it = jsClass->m_staticFunctions->begin(); it != end; ++it) { - ASSERT(!it->first->identifierTable()); - StaticFunctionEntry* e = new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes); - staticFunctions->add(UString::Rep::createCopying(it->first->data(), it->first->size()), e); + ASSERT(!it->first->isIdentifier()); + // Use a local variable here to sidestep an RVCT compiler bug. + StaticFunctionEntry* entry = new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes); + staticFunctions->add(UString::Rep::create(it->first->data(), it->first->length()), entry); } } else @@ -241,5 +260,5 @@ JSObject* OpaqueJSClass::prototype(ExecState* exec) jsClassData.cachedPrototype->setPrototype(prototype); } } - return jsClassData.cachedPrototype; + return jsClassData.cachedPrototype.get(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h index c4777dd..ae60aad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSClassRef.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -76,7 +77,7 @@ struct OpaqueJSClassContextData : Noncopyable { OpaqueJSClassStaticValuesTable* staticValues; OpaqueJSClassStaticFunctionsTable* staticFunctions; - JSC::JSObject* cachedPrototype; + JSC::WeakGCPtr cachedPrototype; }; struct OpaqueJSClass : public ThreadSafeShared { diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp index e6626b7..2c76338 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp @@ -35,7 +35,7 @@ #include "JSObject.h" #include -#if PLATFORM(DARWIN) +#if OS(DARWIN) #include static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 @@ -46,7 +46,7 @@ using namespace JSC; JSContextGroupRef JSContextGroupCreate() { initializeThreading(); - return toRef(JSGlobalData::create().releaseRef()); + return toRef(JSGlobalData::createNonDefault().releaseRef()); } JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) @@ -63,7 +63,7 @@ void JSContextGroupRelease(JSContextGroupRef group) JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) { initializeThreading(); -#if PLATFORM(DARWIN) +#if OS(DARWIN) // When running on Tiger or Leopard, or if the application was linked before JSGlobalContextCreate was changed // to use a unique JSGlobalData, we use a shared one for compatibility. #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) @@ -74,7 +74,7 @@ JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) JSLock lock(LockForReal); return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); } -#endif // PLATFORM(DARWIN) +#endif // OS(DARWIN) return JSGlobalContextCreateInGroup(0, globalObjectClass); } @@ -84,8 +84,9 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass initializeThreading(); JSLock lock(LockForReal); + RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::createNonDefault(); - RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::create(); + APIEntryShim entryShim(globalData.get(), false); #if ENABLE(JSC_MULTIPLE_THREADS) globalData->makeUsableFromMultipleThreads(); @@ -108,12 +109,9 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx) { ExecState* exec = toJS(ctx); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSGlobalData& globalData = exec->globalData(); - - globalData.heap.registerThread(); - gcProtect(exec->dynamicGlobalObject()); globalData.ref(); return ctx; @@ -124,25 +122,26 @@ void JSGlobalContextRelease(JSGlobalContextRef ctx) ExecState* exec = toJS(ctx); JSLock lock(exec); + JSGlobalData& globalData = exec->globalData(); + IdentifierTable* savedIdentifierTable = setCurrentIdentifierTable(globalData.identifierTable); + gcUnprotect(exec->dynamicGlobalObject()); - JSGlobalData& globalData = exec->globalData(); if (globalData.refCount() == 2) { // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain(). // The last reference was released, this is our last chance to collect. - ASSERT(!globalData.heap.protectedObjectCount()); - ASSERT(!globalData.heap.isBusy()); globalData.heap.destroy(); } else - globalData.heap.collect(); + globalData.heap.collectAllGarbage(); globalData.deref(); + + setCurrentIdentifierTable(savedIdentifierTable); } JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); // It is necessary to call toThisObject to get the wrapper object when used with WebCore. return toRef(exec->lexicalGlobalObject()->toThisObject(exec)); @@ -157,8 +156,7 @@ JSContextGroupRef JSContextGetGroup(JSContextRef ctx) JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toGlobalRef(exec->lexicalGlobalObject()->globalExec()); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp index 06ef578..faaa4eb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSObjectRef.cpp @@ -76,8 +76,7 @@ void JSClassRelease(JSClassRef jsClass) JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); if (!jsClass) return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient @@ -92,8 +91,7 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); @@ -103,8 +101,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0; if (!jsPrototype) @@ -118,8 +115,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); @@ -141,8 +137,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* result; if (argumentCount) { @@ -167,8 +162,7 @@ JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -188,8 +182,7 @@ JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSVal JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -209,8 +202,7 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; ++i) @@ -230,8 +222,7 @@ JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSV JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); return toRef(exec, jsObject->prototype()); @@ -240,8 +231,7 @@ JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); @@ -252,8 +242,7 @@ void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -263,8 +252,7 @@ bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -280,8 +268,7 @@ JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); Identifier name(propertyName->identifier(&exec->globalData())); @@ -304,8 +291,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -322,8 +308,7 @@ JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsi void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSValue jsValue = toJS(exec, value); @@ -339,8 +324,7 @@ void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned p bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -389,8 +373,7 @@ bool JSObjectIsFunction(JSContextRef, JSObjectRef object) JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); @@ -427,8 +410,7 @@ bool JSObjectIsConstructor(JSContextRef, JSObjectRef object) JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); @@ -466,8 +448,7 @@ JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef o { JSObject* jsObject = toJS(object); ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSGlobalData* globalData = &exec->globalData(); @@ -492,7 +473,7 @@ JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) { if (--array->refCount == 0) { - JSLock lock(array->globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + APIEntryShim entryShim(array->globalData, false); delete array; } } @@ -510,9 +491,6 @@ JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) { PropertyNameArray* propertyNames = toJS(array); - - propertyNames->globalData()->heap.registerThread(); - JSLock lock(propertyNames->globalData()->isSharedInstance ? LockForReal : SilenceAssertionsOnly); - + APIEntryShim entryShim(propertyNames->globalData()); propertyNames->add(propertyName->identifier(propertyNames->globalData())); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h index c58b958..92135b1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSStringRef.h @@ -37,7 +37,8 @@ extern "C" { #endif -#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) +#if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \ + && !(defined(__CC_ARM) || defined(__ARMCC__)) /* RVCT */ /*! @typedef JSChar @abstract A Unicode character. diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp index 2207181..a12cc34 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSValueRef.cpp @@ -28,6 +28,7 @@ #include #include "APICast.h" +#include "APIShims.h" #include "JSCallbackObject.h" #include @@ -41,13 +42,14 @@ #include // for std::min -JSType JSValueGetType(JSContextRef ctx, JSValueRef value) +using namespace JSC; + +::JSType JSValueGetType(JSContextRef ctx, JSValueRef value) { - JSC::ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSC::JSLock lock(exec); + ExecState* exec = toJS(ctx); + APIEntryShim entryShim(exec); - JSC::JSValue jsValue = toJS(exec, value); + JSValue jsValue = toJS(exec, value); if (jsValue.isUndefined()) return kJSTypeUndefined; @@ -63,13 +65,10 @@ JSType JSValueGetType(JSContextRef ctx, JSValueRef value) return kJSTypeObject; } -using namespace JSC; // placed here to avoid conflict between JSC::JSType and JSType, above. - bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isUndefined(); @@ -78,8 +77,7 @@ bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) bool JSValueIsNull(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isNull(); @@ -88,8 +86,7 @@ bool JSValueIsNull(JSContextRef ctx, JSValueRef value) bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isBoolean(); @@ -98,8 +95,7 @@ bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isNumber(); @@ -108,8 +104,7 @@ bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) bool JSValueIsString(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isString(); @@ -118,8 +113,7 @@ bool JSValueIsString(JSContextRef ctx, JSValueRef value) bool JSValueIsObject(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.isObject(); @@ -128,8 +122,7 @@ bool JSValueIsObject(JSContextRef ctx, JSValueRef value) bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); @@ -145,8 +138,7 @@ bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsCla bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsA = toJS(exec, a); JSValue jsB = toJS(exec, b); @@ -163,20 +155,18 @@ bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* ex bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsA = toJS(exec, a); JSValue jsB = toJS(exec, b); - return JSValue::strictEqual(jsA, jsB); + return JSValue::strictEqual(exec, jsA, jsB); } bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); @@ -195,8 +185,7 @@ bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObject JSValueRef JSValueMakeUndefined(JSContextRef ctx) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toRef(exec, jsUndefined()); } @@ -204,8 +193,7 @@ JSValueRef JSValueMakeUndefined(JSContextRef ctx) JSValueRef JSValueMakeNull(JSContextRef ctx) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toRef(exec, jsNull()); } @@ -213,8 +201,7 @@ JSValueRef JSValueMakeNull(JSContextRef ctx) JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toRef(exec, jsBoolean(value)); } @@ -222,8 +209,7 @@ JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toRef(exec, jsNumber(exec, value)); } @@ -231,8 +217,7 @@ JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); return toRef(exec, jsString(exec, string->ustring())); } @@ -240,8 +225,7 @@ JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); return jsValue.toBoolean(exec); @@ -250,8 +234,7 @@ bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); @@ -268,8 +251,7 @@ double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); @@ -286,8 +268,7 @@ JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); JSValue jsValue = toJS(exec, value); @@ -304,19 +285,17 @@ JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exce void JSValueProtect(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); - JSValue jsValue = toJS(exec, value); + JSValue jsValue = toJSForGC(exec, value); gcProtect(jsValue); } void JSValueUnprotect(JSContextRef ctx, JSValueRef value) { ExecState* exec = toJS(ctx); - exec->globalData().heap.registerThread(); - JSLock lock(exec); + APIEntryShim entryShim(exec); - JSValue jsValue = toJS(exec, value); + JSValue jsValue = toJSForGC(exec, value); gcUnprotect(jsValue); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp index 7c7b1af..f740abe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/OpaqueJSString.cpp @@ -42,7 +42,7 @@ PassRefPtr OpaqueJSString::create(const UString& ustring) UString OpaqueJSString::ustring() const { if (this && m_characters) - return UString(m_characters, m_length, true); + return UString(m_characters, m_length); return UString::null(); } diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 6446773..ccad6b3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,164 +1,7839 @@ +2009-10-30 Tor Arne Vestbø + + Reviewed by NOBODY (OOPS!). + + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. + + https://bugs.webkit.org/show_bug.cgi?id=29381 + + * runtime/TimeoutChecker.h: Add getter for the timeout interval + +2010-02-19 Maciej Stachowiak + + Reviewed by David Levin. + + Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases + https://bugs.webkit.org/show_bug.cgi?id=35147 + + * Configurations/FeatureDefines.xcconfig: + +2010-02-19 Gavin Barraclough + + Reviewed by Oliver Hunt. + + JSString::getIndex() calls value() to resolve the string value (is a rope) + to a UString, then passes the result to jsSingleCharacterSubstring without + checking for an exception. In case of out-of-memory the returned UString + is null(), which may result in an out-of-buounds substring being created. + This is bad. + + Simple fix is to be able to get an index from a rope without resolving to + UString. This may be a useful optimization in some test cases. + + The same bug exists in some other methods is JSString, these can be fixed + by changing them to call getIndex(). + + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSC::jsSingleCharacterSubstring): + (JSC::JSString::getIndex): + (JSC::jsSingleCharacterString): + (JSC::JSString::getStringPropertySlot): + * runtime/UStringImpl.cpp: + (JSC::singleCharacterSubstring): + * runtime/UStringImpl.h: + (JSC::UStringImpl::singleCharacterSubstring): + +2010-02-19 Oliver Hunt + + RS = Gavin Barraclough. + + Split the 32/64 version of JITPropertyAccess into a separate file. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * jit/JITPropertyAccess.cpp: + * jit/JITPropertyAccess32_64.cpp: Added. + (JSC::JIT::emit_op_put_by_index): + (JSC::JIT::emit_op_put_getter): + (JSC::JIT::emit_op_put_setter): + (JSC::JIT::emit_op_del_by_id): + (JSC::JIT::emit_op_method_check): + (JSC::JIT::emitSlow_op_method_check): + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + (JSC::JIT::emit_op_get_by_id): + (JSC::JIT::emitSlow_op_get_by_id): + (JSC::JIT::emit_op_put_by_id): + (JSC::JIT::emitSlow_op_put_by_id): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::compilePutDirectOffset): + (JSC::JIT::compileGetDirectOffset): + (JSC::JIT::testPrototype): + (JSC::JIT::privateCompilePutByIdTransition): + (JSC::JIT::patchGetByIdSelf): + (JSC::JIT::patchMethodCallProto): + (JSC::JIT::patchPutByIdReplace): + (JSC::JIT::privateCompilePatchGetArrayLength): + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdSelfList): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + (JSC::JIT::emit_op_get_by_pname): + (JSC::JIT::emitSlow_op_get_by_pname): + +2010-02-19 Patrick Gansterer + + Reviewed by Laszlo Gombos. + + Added additional parameter to create_rvct_stubs + for setting the regularexpression prefix. + Renamed it because it now works for other platforms too. + https://bugs.webkit.org/show_bug.cgi?id=34951 + + * DerivedSources.pro: + * create_jit_stubs: Copied from JavaScriptCore/create_rvct_stubs. + * create_rvct_stubs: Removed. + +2010-02-18 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Improve interpreter getter performance + https://bugs.webkit.org/show_bug.cgi?id=35138 + + Improve the performance of getter dispatch by making it possible + for the interpreter to cache the GetterSetter object lookup. + + To do this we simply need to make PropertySlot aware of getters + as a potentially cacheable property, and record the base and this + objects for a getter access. This allows us to use more-or-less + identical code to that used by the normal get_by_id caching, with + the dispatch being the only actual difference. + + I'm holding off of implementing this in the JIT until I do some + cleanup to try and making coding in the JIT not be as horrible + as it is currently. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + (JSC::CodeBlock::derefStructures): + (JSC::CodeBlock::refStructures): + * bytecode/Opcode.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::tryCacheGetByID): + (JSC::Interpreter::privateExecute): + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSObject.cpp: + (JSC::JSObject::fillGetterPropertySlot): + * runtime/PropertySlot.cpp: + (JSC::PropertySlot::functionGetter): + * runtime/PropertySlot.h: + (JSC::PropertySlot::isGetter): + (JSC::PropertySlot::isCacheable): + (JSC::PropertySlot::isCacheableValue): + (JSC::PropertySlot::setValueSlot): + (JSC::PropertySlot::setGetterSlot): + (JSC::PropertySlot::setCacheableGetterSlot): + (JSC::PropertySlot::clearOffset): + (JSC::PropertySlot::thisValue): + +2010-02-17 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed a portion of: + | https://bugs.webkit.org/show_bug.cgi?id=28676 + Safari 4 does not release memory back to the operating system fast enough (28676) + + This patch fixes a surprisingly common edge case in which the page heap + would have only one free span, but that span would be larger than the + minimum free size, so we would decide not to free it, even though it + could be as large as 100MB or more! + + SunSpider reports no change on Mac or Windows. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::scavenge): Call shouldContinueScavenging() instead + of doing the math ourselves. Don't keep a local value for pagesDecommitted + because that lets free_committed_pages_ be wrong temporarily. Instead, + update free_committed_pages_ as we go. ASSERT that we aren't releasing + a span that has already been released, because we think this is impossible. + Finally, don't be afraid to release all free memory in the page heap when + scavenging. We only scavenge after 5 seconds of the application's working + set not growing, and we keep both thread caches and a central cache on + top of the page heap, so the extra free pages in the page heap were just + overkill. + +2010-02-17 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=35070 + Addition of 2 strings of length 2^31 may result in a string of length 0. + + Check for overflow when creating a new JSString as a result of an addition + or concatenation, throw an out of memory exception. + + * runtime/JSString.h: + (JSC::): + * runtime/Operations.h: + (JSC::jsString): + +2010-02-17 Xan Lopez + + Reviewed by Gustavo Noronha. + + [Linux] Webkit incompatible with Java plugins + https://bugs.webkit.org/show_bug.cgi?id=24912 + + Add support for GFile to GOwnPtr. + + Based on original work by Gustavo Noronha. + + * wtf/gtk/GOwnPtr.cpp: + (WTF::GFile): + * wtf/gtk/GOwnPtr.h: + +2010-02-16 Gavin Barraclough + + Reviewed by Mark Rowe. + + Fix a handful of other leaks seen on the buildbot. + + * runtime/UStringImpl.h: + (JSC::UStringOrRopeImpl::deref): Delegate through to the subclass version of deref to ensure that + the correct cleanup takes place. This function previously featured some code that attempted to + skip deletion of static UStringImpl's. Closer inspection revealed that it was in fact equivalent + to "if (false)", meaning that UStringImpl's which had their final deref performed via this function + were leaked. + +2010-02-16 Mark Rowe + + Reviewed by Gavin Barraclough. + + Fix a handful of leaks seen on the buildbot. + + * runtime/UStringImpl.h: + (JSC::UStringOrRopeImpl::deref): Call URopeImpl::destructNonRecursive rather than delete + to ensure that the rope's fibers are also destroyed. + +2010-02-16 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=34964 + Leaks tool reports false memory leaks due to Rope implementation. + + A rope is a recursive data structure where each node in the rope holds a set of + pointers, each of which may reference either a string (in UStringImpl form) or + another rope node. A low bit in each pointer is used to distinguish between + rope & string elements, in a fashion similar to the recently-removed + PtrAndFlags class (see https://bugs.webkit.org/show_bug.cgi?id=33731 ). Again, + this causes a problem for Leaks – refactor to remove the magic pointer + mangling. + + Move Rope out from JSString.h and rename to URopeImpl, to match UStringImpl. + Give UStringImpl and URopeImpl a common parent class, UStringOrRopeImpl. + Repurpose an otherwise invalid permutation to flags (static & should report + memory cost) to identify ropes. + + This allows us to change the rope's fibers to interrogate the object rather + than storing a bool within the low bits of the pointer (or in some cases the + use of a common parent class removes the need to determine the type at all - + there is a common interface to ref or get the length of either ropes or strings). + + * API/JSClassRef.cpp: + (OpaqueJSClass::OpaqueJSClass): + (OpaqueJSClassContextData::OpaqueJSClassContextData): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::keyForCharacterSwitch): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + * runtime/Identifier.cpp: + (JSC::Identifier::equal): + (JSC::Identifier::addSlowCase): + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + * runtime/JSString.h: + (JSC::): + (JSC::RopeBuilder::JSString): + (JSC::RopeBuilder::~JSString): + (JSC::RopeBuilder::appendStringInConstruct): + (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): + (JSC::RopeBuilder::JSStringFinalizerStruct::JSStringFinalizerStruct): + (JSC::RopeBuilder::JSStringFinalizerStruct::): + * runtime/UString.cpp: + (JSC::UString::toStrictUInt32): + (JSC::equal): + * runtime/UString.h: + (JSC::UString::isEmpty): + (JSC::UString::size): + * runtime/UStringImpl.cpp: + (JSC::URopeImpl::derefFibersNonRecursive): + (JSC::URopeImpl::destructNonRecursive): + * runtime/UStringImpl.h: + (JSC::UStringOrRopeImpl::isRope): + (JSC::UStringOrRopeImpl::length): + (JSC::UStringOrRopeImpl::ref): + (JSC::UStringOrRopeImpl::): + (JSC::UStringOrRopeImpl::operator new): + (JSC::UStringOrRopeImpl::UStringOrRopeImpl): + (JSC::UStringImpl::adopt): + (JSC::UStringImpl::createUninitialized): + (JSC::UStringImpl::tryCreateUninitialized): + (JSC::UStringImpl::data): + (JSC::UStringImpl::cost): + (JSC::UStringImpl::deref): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::): + (JSC::URopeImpl::tryCreateUninitialized): + (JSC::URopeImpl::initializeFiber): + (JSC::URopeImpl::fiberCount): + (JSC::URopeImpl::fibers): + (JSC::URopeImpl::deref): + (JSC::URopeImpl::URopeImpl): + (JSC::URopeImpl::hasOneRef): + (JSC::UStringOrRopeImpl::deref): + +2010-02-15 Gabor Loki + + Reviewed by Gavin Barraclough. + + Fix the SP at ctiOpThrowNotCaught on Thumb2 (JSVALUE32) + https://bugs.webkit.org/show_bug.cgi?id=34939 + + * jit/JITStubs.cpp: + +2010-02-15 Gavin Barraclough + + Reviewed by NOBODY (Build Fix!). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-02-15 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Some general Rope related refactoring. + + Rename Rope::m_ropeLength to m_fiberCount, to be more descriptive. + Rename Rope::m_stringLength to simply m_length (since this is the + more conventional name for the length of a string). Move append + behaviour out into a new RopeBuilder class, so that Rope no longer + needs any knowledge of the JSString or UString implementation. + + Make Rope no longer be nested within JSString. + (Rope now no-longer need reside within JSString.h, but leaving + the change of moving this out to a different header as a separate + change from these renames). + + * JavaScriptCore.exp: + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * runtime/JSString.cpp: + (JSC::Rope::destructNonRecursive): + (JSC::Rope::~Rope): + (JSC::JSString::resolveRope): + (JSC::JSString::toBoolean): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSC::Rope::Fiber::Fiber): + (JSC::Rope::Fiber::deref): + (JSC::Rope::Fiber::ref): + (JSC::Rope::Fiber::refAndGetLength): + (JSC::Rope::Fiber::isRope): + (JSC::Rope::Fiber::rope): + (JSC::Rope::Fiber::isString): + (JSC::Rope::Fiber::string): + (JSC::Rope::Fiber::nonFiber): + (JSC::Rope::tryCreateUninitialized): + (JSC::Rope::append): + (JSC::Rope::fiberCount): + (JSC::Rope::length): + (JSC::Rope::fibers): + (JSC::Rope::Rope): + (JSC::Rope::operator new): + (JSC::): + (JSC::RopeBuilder::JSString): + (JSC::RopeBuilder::~JSString): + (JSC::RopeBuilder::length): + (JSC::RopeBuilder::canGetIndex): + (JSC::RopeBuilder::appendStringInConstruct): + (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): + (JSC::RopeBuilder::isRope): + (JSC::RopeBuilder::fiberCount): + (JSC::JSString::getStringPropertySlot): + * runtime/Operations.h: + (JSC::jsString): + +2010-02-15 Gavin Barraclough + + Reviewed by NOBODY (Build fix). + + Add missing cast for !YARR (PPC) builds. + + * runtime/RegExp.cpp: + (JSC::RegExp::match): + +2010-02-14 Gavin Barraclough + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Many false leaks in release builds due to PtrAndFlags + + StructureTransitionTable was effectively a smart pointer type, + one machine word in size and wholly contained as a member of + of Structure. It either pointed to an actual table, or could + be used to describe a single transtion entry without use of a + table. + + This, however, worked by using a PtrAndFlags, which is not + compatible with the leaks tool. Since there is no clear way to + obtain another bit for 'free' here, and since there are bits + available up in Structure, merge this functionality back up into + Structure. Having this in a separate class was quite clean + from an enacapsulation perspective, but this solution doesn't + seem to bad - all table access is now intermediated through the + Structure::structureTransitionTableFoo methods, keeping the + optimization fairly well contained. + + This was the last use of PtrAndFlags, so removing the file too. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.h: + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::~Structure): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::hasTransition): + * runtime/Structure.h: + (JSC::Structure::): + (JSC::Structure::structureTransitionTableContains): + (JSC::Structure::structureTransitionTableGet): + (JSC::Structure::structureTransitionTableHasTransition): + (JSC::Structure::structureTransitionTableRemove): + (JSC::Structure::structureTransitionTableAdd): + (JSC::Structure::structureTransitionTable): + (JSC::Structure::setStructureTransitionTable): + (JSC::Structure::singleTransition): + (JSC::Structure::setSingleTransition): + * runtime/StructureTransitionTable.h: + * wtf/PtrAndFlags.h: Removed. + +2010-02-15 Gavin Barraclough + + Rubber Stamped by Geoff Garen. + + Bug 34948 - tryMakeString should fail on error in length calculation + + Ooops! - "bool overflow" argument should have been "bool& overflow". + + * runtime/UString.h: + (JSC::sumWithOverflow): + (JSC::tryMakeString): + +2010-02-15 Gavin Barraclough + + Reviewed by NOBODY (Build Fix (pt 2!)). + + Some symbol names have changed, remove, will readd if required. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-02-15 Gavin Barraclough + + Reviewed by NOBODY (Build Fix (pt 1?)). + + Some symbol names have changed, remove, will readd if required. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-02-15 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Removed some mistaken code added in http://trac.webkit.org/changeset/53860. + + * API/APIShims.h: + (JSC::APICallbackShim::APICallbackShim): + (JSC::APICallbackShim::~APICallbackShim): No need to start/stop the + timeout checker when calling out from the API to the client; we want to + monitor the VM for timeouts, not the client. This mistake was harmless / + undetectable, since it's totally redundant with the APIEntryShim, which + also starts / stops the timeout checker. + +2010-02-15 Gavin Barraclough + + Reviewed by Geoff Garen. + + Bug 34952 - String lengths in UString should be unsigned. + This matches WebCore::StringImpl, and better unifies behaviour throughout JSC. + + * JavaScriptCore.exp: + * bytecode/EvalCodeCache.h: + * runtime/Identifier.cpp: + (JSC::Identifier::equal): + * runtime/Identifier.h: + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEscape): + * runtime/JSONObject.cpp: + (JSC::gap): + (JSC::Stringifier::indent): + * runtime/NumberPrototype.cpp: + (JSC::numberProtoFuncToFixed): + (JSC::numberProtoFuncToPrecision): + * runtime/RegExp.cpp: + (JSC::RegExp::match): + * runtime/StringPrototype.cpp: + (JSC::substituteBackreferencesSlow): + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncSplit): + (JSC::trimString): + * runtime/UString.cpp: + (JSC::UString::UString): + (JSC::UString::from): + (JSC::UString::getCString): + (JSC::UString::ascii): + (JSC::UString::operator[]): + (JSC::UString::toStrictUInt32): + (JSC::UString::find): + (JSC::UString::rfind): + (JSC::UString::substr): + (JSC::operator<): + (JSC::operator>): + (JSC::compare): + (JSC::equal): + (JSC::UString::UTF8String): + * runtime/UString.h: + (JSC::UString::size): + (JSC::operator==): + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::create): + * runtime/UStringImpl.h: + (JSC::UStringImpl::create): + (JSC::UStringImpl::size): + (JSC::UStringImpl::computeHash): + (JSC::UStringImpl::UStringImpl): + +2010-02-15 Gavin Barraclough + + Reviewed by Geoff Garen. + + Bug 34948 - tryMakeString should fail on error in length calculation + + The sum of the length of substrings could overflow. + + * runtime/UString.h: + (JSC::sumWithOverflow): + (JSC::tryMakeString): + +2010-02-15 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed Crash beneath JSGlobalContextRelease when + typing in Google search field with GuardMalloc/full page heap enabled + + * API/JSContextRef.cpp: Don't use APIEntryShim, since that requires + a JSGlobalData, which this function destroys. Do use setCurrentIdentifierTable + and JSLock instead, since those are the two features of APIEntryShim we + require. + +2010-02-15 Patrick Gansterer + + Reviewed by Laszlo Gombos. + + Added additional parameter to create_rvct_stubs + for setting the offset of thunkReturnAddress. + https://bugs.webkit.org/show_bug.cgi?id=34657 + + * create_rvct_stubs: + * jit/JITStubs.cpp: + +2010-02-15 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Fix QScriptValue::toIntXX methods. + + More ECMA Script compliance. + + [Qt] QScriptValue::toIntXX returns incorrect values + https://bugs.webkit.org/show_bug.cgi?id=34847 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::toInteger): + (QScriptValuePrivate::toInt32): + (QScriptValuePrivate::toUInt32): + (QScriptValuePrivate::toUInt16): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: + (tst_QScriptValue::toInteger_initData): + (tst_QScriptValue::toInteger_makeData): + (tst_QScriptValue::toInteger_test): + (tst_QScriptValue::toInt32_initData): + (tst_QScriptValue::toInt32_makeData): + (tst_QScriptValue::toInt32_test): + (tst_QScriptValue::toUInt32_initData): + (tst_QScriptValue::toUInt32_makeData): + (tst_QScriptValue::toUInt32_test): + (tst_QScriptValue::toUInt16_initData): + (tst_QScriptValue::toUInt16_makeData): + (tst_QScriptValue::toUInt16_test): + +2010-02-14 Laszlo Gombos + + Reviewed by Adam Barth. + + Implement NEVER_INLINE and NO_RETURN for RVCT + https://bugs.webkit.org/show_bug.cgi?id=34740 + + * wtf/AlwaysInline.h: + +2010-02-12 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Remove uses of PtrAndFlags from JIT data stuctures. + + These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid + permutation of pointer states in MethodCallLinkInfo to represent the removed bits. + + * bytecode/CodeBlock.h: + (JSC::CallLinkInfo::seenOnce): + (JSC::CallLinkInfo::setSeen): + (JSC::MethodCallLinkInfo::MethodCallLinkInfo): + (JSC::MethodCallLinkInfo::seenOnce): + (JSC::MethodCallLinkInfo::setSeen): + * jit/JIT.cpp: + (JSC::JIT::unlinkCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::patchMethodCallProto): + * runtime/UString.h: + +2010-02-12 Gavin Barraclough + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Many false leaks in release builds due to PtrAndFlags + + Remove UntypedPtrAndBitfield (similar to PtrAndFlags) in UStringImpl, + and steal bits from the refCount instead. + + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::baseSharedBuffer): + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UStringImpl::cost): + (JSC::UStringImpl::isIdentifier): + (JSC::UStringImpl::setIsIdentifier): + (JSC::UStringImpl::ref): + (JSC::UStringImpl::deref): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::bufferOwnership): + (JSC::UStringImpl::isStatic): + (JSC::UStringImpl::): + +2010-02-12 Geoffrey Garen + + Reviewed by Darin Adler. + + Removed an unnecessary data dependency from my last patch. + + * runtime/SmallStrings.cpp: + (JSC::SmallStrings::markChildren): Since isAnyStringMarked being false + is a condition of entering the loop, we can just use '=' instead of '|='. + +2010-02-12 Janne Koskinen + + Reviewed by Tor Arne Vestbø. + + Additional refptr/passrefptr workarounds for WINSCW compiler + https://bugs.webkit.org/show_bug.cgi?id=28054 + + * wtf/PassRefPtr.h: + (WTF::refIfNotNull): + (WTF::PassRefPtr::PassRefPtr): + (WTF::PassRefPtr::~PassRefPtr): + (WTF::PassRefPtr::clear): + (WTF::::operator): + * wtf/RefPtr.h: + (WTF::RefPtr::RefPtr): + (WTF::::operator): + +2010-02-12 Janne Koskinen + + Reviewed by Simon Hausmann. + + Don't import the cmath functions from std:: for WINSCW. + + * wtf/MathExtras.h: + +2010-02-12 Kwang Yul Seo + + Reviewed by Adam Barth. + + Typedef both JSChar and UChar to wchar_t in RVCT. + https://bugs.webkit.org/show_bug.cgi?id=34560 + + Define both JSChar and UChar to wchar_t as the size + of wchar_t is 2 bytes in RVCT. + + * API/JSStringRef.h: + * wtf/unicode/qt4/UnicodeQt4.h: + +2010-02-11 Geoffrey Garen + + Reviewed by Oliver Hunt and Darin Adler. + + The rest of the fix for + https://bugs.webkit.org/show_bug.cgi?id=34864 | + Many objects left uncollected after visiting mail.google.com and closing + window + + Don't unconditionally hang onto small strings. Instead, hang onto all + small strings as long as any small string is still referenced. + + SunSpider reports no change. + + * runtime/Collector.cpp: + (JSC::Heap::markRoots): Mark the small strings cache last, so it can + check if anything else has kept any strings alive. + + * runtime/SmallStrings.cpp: + (JSC::isMarked): + (JSC::SmallStrings::markChildren): Only keep our strings alive if some + other reference to at least one of them exists, too. + +2010-02-11 Geoffrey Garen + + Reviewed by Gavin Barraclough. + + Some progress toward fixing + https://bugs.webkit.org/show_bug.cgi?id=34864 | + Many objects left uncollected after visiting mail.google.com and closing + window + + SunSpider reports no change. + + Keep weak references, rather than protected references, to cached for-in + property name enumerators. + + One problem with protected references is that a chain like + [ gc object 1 ] => [ non-gc object ] => [ gc object 2 ] + takes two GC passes to break, since the first pass collects [ gc object 1 ], + releasing [ non-gc object ] and unprotecting [ gc object 2 ], and only + then can a second pass collect [ gc object 2 ]. + + Another problem with protected references is that they can keep a bunch + of strings alive long after they're useful. In SunSpider and a few popular + websites, the size-speed tradeoff seems to favor weak references. + + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Moved this constructor + into the .cpp file, since it's not used elsewhere. + + (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): Added a destructor + to support our weak reference. + + * runtime/JSPropertyNameIterator.h: + (JSC::Structure::setEnumerationCache): + (JSC::Structure::clearEnumerationCache): + (JSC::Structure::enumerationCache): Added a function for clearing a + Structure's enumeration cache, used by our new destructor. Also fixed + indentation to match the rest of the file. + + * runtime/Structure.h: Changed from protected pointer to weak pointer. + +2010-02-11 Chris Rogers + + Reviewed by David Levin. + + audio engine: add Complex number class + https://bugs.webkit.org/show_bug.cgi?id=34538 + + * wtf/Complex.h: Added. + (WebCore::complexFromMagnitudePhase): + +2010-02-10 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Added an SPI for asking about all the different live objects on the heap. + Useful for memory debugging. + + * JavaScriptCore.exp: Export the new SPI. + + * runtime/Collector.cpp: + (JSC::typeName): Use a little capitalization. Don't crash in the case of + a non-object cell, since it might just be an uninitialized cell. + + (JSC::Heap::objectTypeCounts): The new SPI. + + * runtime/Collector.h: + * runtime/CollectorHeapIterator.h: + (JSC::CollectorHeapIterator::advance): + (JSC::LiveObjectIterator::operator++): + (JSC::DeadObjectIterator::operator++): + (JSC::ObjectIterator::operator++): Made 2 tweaks to these iterators: + (1) Skip the last cell in the block, since it's a dummy sentinel, and + we don't want it to confuse the object count; (2) Fixed a logic error + in LiveObjectIterator that could cause it to iterate dead objects if + m_block were equal to m_heap.nextBlock and m_cell were less than + m_heap.nextCell. No test for this since I can't think of a way that this + could make WebKit behave badly. + +2010-02-11 Steve Block + + Reviewed by Darin Adler. + + Guard cmath using declarations in MathExtras.h on Android + https://bugs.webkit.org/show_bug.cgi?id=34840 + + Android does not provide these functions. + + * wtf/MathExtras.h: + +2010-02-08 Maciej Stachowiak + + Reviewed by Cameron Zwarich. + + Restore ENABLE_RUBY flag so vendors can ship with Ruby disabled if they choose. + https://bugs.webkit.org/show_bug.cgi?id=34698 + + * Configurations/FeatureDefines.xcconfig: + +2010-02-10 Kevin Watters + + Reviewed by Kevin Ollivier. + + [wx] Add Windows complex text support and Mac support for containsCharacters. + + https://bugs.webkit.org/show_bug.cgi?id=34759 + + * wscript: + +2010-02-10 Alexey Proskuryakov + + Addressing issues found by style bot. + + * wtf/ValueCheck.h: Renamed header guard to match final file name. + + * wtf/Vector.h: (WTF::::checkConsistency): Remove braces around a one-line clause. + +2010-02-09 Alexey Proskuryakov + + Reviewed by Geoffrey Garen. + + https://bugs.webkit.org/show_bug.cgi?id=34490 + WebCore::ImageEventSender::dispatchPendingEvents() crashes in certain conditions + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + Added ValueCheck.h. + + * wtf/ValueCheck.h: Added. Moved code out of HashTraits, since it would be awkward to + include that from Vector.h. + (WTF::ValueCheck::checkConsistency): Allow null pointers, those are pretty consistent. + + * wtf/HashTraits.h: Moved value checking code out of here. + + * wtf/HashTable.h: (WTF::::checkTableConsistencyExceptSize): Updated for the above changes. + + * wtf/Vector.h: + (WTF::::checkConsistency): Check all vector elements. + (WTF::ValueCheck): Support checking a Vector as an element in other containers. Currently + unused. + +2010-02-10 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Fix QScriptValue::toBool. + + Fix ECMA compliance in the QScriptValue for values like 0, NaN and + empty strings. + + [Qt] QScriptValue::toBool problem + https://bugs.webkit.org/show_bug.cgi?id=34793 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::toBool): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: + (tst_QScriptValue::toBool_initData): + (tst_QScriptValue::toBool_makeData): + (tst_QScriptValue::toBool_test): + (tst_QScriptValue::toBoolean_initData): + (tst_QScriptValue::toBoolean_makeData): + (tst_QScriptValue::toBoolean_test): + +2009-10-06 Yongjun Zhang + + Reviewed by Simon Hausmann. + + Use derefIfNotNull() to work around WINSCW compiler forward declaration bug + + The compiler bug is reported at + https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812. + + The change should be reverted when the above bug is fixed in WINSCW compiler. + + https://bugs.webkit.org/show_bug.cgi?id=28054 + +2009-10-06 Yongjun Zhang + + Reviewed by Simon Hausmann. + + Get rid of WINSCW hack for UnSpecifiedBoolType + + Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make the WINSCW + compiler work with the default UnSpecifiedBoolType() operator. + + https://bugs.webkit.org/show_bug.cgi?id=28054 + + * wtf/RefPtr.h: + +2010-02-09 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + New functions nullValue() and undefinedValue(). + + [Qt] QScriptEngine should contain nullValue and undefinedValue methods + https://bugs.webkit.org/show_bug.cgi?id=34749 + + * qt/api/qscriptengine.cpp: + (QScriptEngine::nullValue): + (QScriptEngine::undefinedValue): + * qt/api/qscriptengine.h: + * qt/tests/qscriptengine/tst_qscriptengine.cpp: + (tst_QScriptEngine::nullValue): + (tst_QScriptEngine::undefinedValue): + +2010-02-09 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Fixes for QScriptValue::toNumber(). + + Fix ECMA compliance in QScriptValue for values unbound + to a QScriptEngine. + + [Qt] QScriptValue::toNumber() is broken + https://bugs.webkit.org/show_bug.cgi?id=34592 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::toNumber): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: + (tst_QScriptValue::toNumber_initData): + (tst_QScriptValue::toNumber_makeData): + (tst_QScriptValue::toNumber_test): + +2010-02-09 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Fix QScriptValue::isNumber(). + + The isNumber() should return 'true' if the value is in the CNumber + state. + + [Qt] QScriptValue::isNumber() returns an incorrect value + https://bugs.webkit.org/show_bug.cgi?id=34575 + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::isNumber): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: + * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: + (tst_QScriptValue::isNumber_initData): + (tst_QScriptValue::isNumber_makeData): + (tst_QScriptValue::isNumber_test): + +2010-02-09 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Small refactoring to the small strings cache to allow it to be cleared + dynamically. + + * runtime/SmallStrings.cpp: + (JSC::SmallStrings::SmallStrings): + (JSC::SmallStrings::clear): + * runtime/SmallStrings.h: Moved initialization code into a shared function, + and changed the constructor to call it. + +2010-02-09 Gavin Barraclough + + Rubber Stamped by Geoff Garen. + + Rename StringBuilder::release && JSStringBuilder::releaseJSString + to 'build()'. + + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncJoin): + * runtime/Executable.cpp: + (JSC::FunctionExecutable::paramString): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::decode): + (JSC::globalFuncEscape): + (JSC::globalFuncUnescape): + * runtime/JSONObject.cpp: + (JSC::Stringifier::stringify): + * runtime/JSStringBuilder.h: + (JSC::JSStringBuilder::build): + * runtime/LiteralParser.cpp: + (JSC::LiteralParser::Lexer::lexString): + * runtime/NumberPrototype.cpp: + (JSC::integerPartNoExp): + (JSC::numberProtoFuncToFixed): + * runtime/StringBuilder.h: + (JSC::StringBuilder::build): + +2010-02-09 John Sullivan + + https://bugs.webkit.org/show_bug.cgi?id=34772 + Overzealous new assertion in URStringImpl::adopt() + + Reviewed by Adam Barth. + + * runtime/UStringImpl.h: + (JSC::UStringImpl::adopt): + Only assert that vector.data() is non-zero if vector.size() is non-zero. + +2010-02-09 Nikolas Zimmermann + + Not reviewed. Try to fix build problem on SnowLeopard slaves to bring them back. + + * API/JSClassRef.cpp: + (tryCreateStringFromUTF8): Mark method as 'static inline' to suppress "warning: no previous prototype for ..." + +2010-02-09 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Three small string fixes: + (1) StringBuilder::release should CRASH if the buffer allocation failed. + (2) Remove weird, dead code from JSString::tryGetValue, replace with an ASSERT. + (3) Move UString::createFromUTF8 out to the API, as tryCreateStringFromUTF8. + This is only used from the API, and (now) unlike other UString::create + methods may return UString::null() to indicate failure cases. Better + handle these in the API. + + * API/JSClassRef.cpp: + (tryCreateStringFromUTF8): + (OpaqueJSClass::OpaqueJSClass): + (OpaqueJSClassContextData::OpaqueJSClassContextData): + * runtime/JSString.h: + (JSC::Fiber::tryGetValue): + * runtime/StringBuilder.h: + (JSC::StringBuilder::release): + * runtime/UString.cpp: + (JSC::UString::UString): + (JSC::UString::from): + (JSC::UString::find): + * runtime/UString.h: + 2010-02-09 Janne Koskinen - Reviewed by Laszlo Gombos. + Reviewed by Laszlo Gombos. + + [Qt] use nanval() for Symbian as nonInlineNaN + https://bugs.webkit.org/show_bug.cgi?id=34170 + + numeric_limits::quiet_NaN is broken in Symbian + causing NaN to be evaluated as a number. + + * runtime/JSValue.cpp: + (JSC::nonInlineNaN): + +2010-02-09 Tamas Szirbucz + + Reviewed by Gavin Barraclough. + + Add a soft modulo operation to ARM JIT using a trampoline function. + The performance progression is about ~1.8% on ARMv7 + https://bugs.webkit.org/show_bug.cgi?id=34424 + + Developed in cooperation with Gabor Loki. + + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_mod): + (JSC::JIT::emitSlow_op_mod): + * jit/JITOpcodes.cpp: + (JSC::JIT::softModulo): + * jit/JITStubs.h: + (JSC::JITThunks::ctiSoftModulo): + * wtf/Platform.h: + +2010-02-08 Gavin Barraclough + + Reviewed by NOBODY (SL/win build fixes). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * runtime/StringPrototype.cpp: + +2010-02-08 Gavin Barraclough + + Reviewed by Oliver Hunt + + Make String.replace throw an exception on out-of-memory, rather than + returning a null (err, empty-ish) string. Move String::replaceRange + and String::spliceSubstringsWithSeparators out to StringPrototype - + these were fairly specific use anyway, and we can better integrate + throwing the JS expcetion this way. + + Also removes redundant assignment operator from UString. + + * JavaScriptCore.exp: + * runtime/StringPrototype.cpp: + (JSC::StringRange::StringRange): + (JSC::jsSpliceSubstringsWithSeparators): + (JSC::jsReplaceRange): + (JSC::stringProtoFuncReplace): + * runtime/UString.cpp: + * runtime/UString.h: + +2010-02-08 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Undefine WTF_OS_WINDOWS and WTF_PLATFORM_WIN + https://bugs.webkit.org/show_bug.cgi?id=34561 + + As the binary for simulator is built with MSVC 2005, + WTF_OS_WINDOWS and WTF_PLATFORM_WIN are defined. + Undefine them as we don't target Windows. + + * wtf/Platform.h: + +2010-02-08 Chris Rogers + + Reviewed by Darin Adler. + + audio engine: add Vector3 class + https://bugs.webkit.org/show_bug.cgi?id=34548 + + * wtf/Vector3.h: Added. + (WebCore::Vector3::Vector3): + (WebCore::Vector3::abs): + (WebCore::Vector3::isZero): + (WebCore::Vector3::normalize): + (WebCore::Vector3::x): + (WebCore::Vector3::y): + (WebCore::Vector3::z): + (WebCore::operator+): + (WebCore::operator-): + (WebCore::operator*): + (WebCore::dot): + (WebCore::cross): + (WebCore::distance): + +2010-02-08 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Fix warning in clang++ + + * runtime/Structure.h: + (JSC::Structure::propertyStorageSize): + +2010-02-08 Gavin Barraclough + + Reviewed by Geoff Garen. + + Make makeString CRASH if we fail to allocate a string. + + (tryMakeString or jsMakeNontrivialString can be used where we + expect allocation may fail and want to handle the error). + + * runtime/JSStringBuilder.h: + (JSC::jsMakeNontrivialString): + * runtime/UString.h: + (JSC::tryMakeString): + (JSC::makeString): + +2010-02-08 Gavin Barraclough + + Rubber Stamped by Oliver Hunt. + + Remove a couple of unnecesary C-style casts spotted by Darin. + + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::globalFuncEscape): + +2010-02-08 Gavin Barraclough + + Reviewed by Geoff Garen. + + Switch some more StringBuilder/jsNontrivialString code to use + JSStringBuilder/jsMakeNontrivialString - these methods will + throw an exception if we hit out-of-memory, rather than just + CRASHing. + + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::decode): + (JSC::globalFuncEscape): + +2010-02-08 Gavin Barraclough + + Reviewed by Sam Weinig. + + Use an empty identifier instead of a null identifier for parse + tokens without an identifier. + + This helps encapsulate the null UStringImpl within UString. + + * parser/Grammar.y: + * parser/NodeConstructors.h: + (JSC::ContinueNode::ContinueNode): + (JSC::BreakNode::BreakNode): + (JSC::ForInNode::ForInNode): + * runtime/CommonIdentifiers.cpp: + (JSC::CommonIdentifiers::CommonIdentifiers): + * runtime/CommonIdentifiers.h: + * runtime/FunctionPrototype.cpp: + (JSC::FunctionPrototype::FunctionPrototype): + +2010-02-08 Gustavo Noronha Silva + + Build fix for make distcheck. + + * GNUmakefile.am: + +2010-02-08 Simon Hausmann + + Unreviewed RVCT build fix. + + Similar to r54391, don't import the cmath functions from std:: for RVCT. + + * wtf/MathExtras.h: + +2010-02-05 Gavin Barraclough + + Reviewed by Geoff Garen. + + Change UStringImpl::create to CRASH if the string cannot be allocated, + rather than returning a null string (which will behave like a zero-length + string if used). + + Also move createRep function from UString to become new overloaded + UStringImpl::create methods. In doing so, bring their behaviour closer to + being in line with WebCore::StringImpl, in removing the behaviour that they + can be used to produce null UStrings (ASSERT the char* provided is non-null). + This behaviour of converting null C-strings to null UStrings is inefficient + (cmompared to just using UString::null()), incompatible with WebCore::StringImpl's + behaviour, and may generate unexpected behaviour, since in many cases a null + UString can be used like an empty string. + + With these changes UStringImpl need not have a concept of null impls, we can + start transitioning this to become an implementation detail of UString, that + internally it chooses to use a null-object rather than an actually zero impl + pointer. + + * JavaScriptCore.exp: + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::calculatedFunctionName): + * parser/Parser.cpp: + (JSC::Parser::parse): + * profiler/Profile.cpp: + (JSC::Profile::Profile): + * profiler/ProfileGenerator.cpp: + (JSC::ProfileGenerator::stopProfiling): + * runtime/Error.cpp: + (JSC::Error::create): + (JSC::throwError): + * runtime/ExceptionHelpers.cpp: + (JSC::createError): + * runtime/Identifier.cpp: + (JSC::Identifier::add): + * runtime/PropertyNameArray.cpp: + (JSC::PropertyNameArray::add): + * runtime/UString.cpp: + (JSC::initializeUString): + (JSC::UString::UString): + (JSC::UString::operator=): + * runtime/UString.h: + (JSC::UString::isNull): + (JSC::UString::null): + (JSC::UString::rep): + (JSC::UString::UString): + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::create): + * runtime/UStringImpl.h: + +2010-02-05 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Define SYSTEM_MALLOC 1 + https://bugs.webkit.org/show_bug.cgi?id=34640 + + Make BREWMP use system malloc because FastMalloc is not ported. + + * wtf/Platform.h: + +2010-02-05 Kwang Yul Seo + + Reviewed by Alexey Proskuryakov. + + Don't call CRASH() in fastMalloc and fastCalloc when the requested memory size is 0 + https://bugs.webkit.org/show_bug.cgi?id=34569 + + With USE_SYSTEM_MALLOC=1, fastMalloc and fastCalloc call CRASH() + if the return value of malloc and calloc is 0. + + However, these functions can return 0 when the request size is 0. + Libc manual says, "If size is 0, then malloc() returns either NULL, + or a unique pointer value that can later be successfully passed to free()." + Though malloc returns a unique pointer in most systems, + 0 can be returned in some systems. For instance, BREW's MALLOC returns 0 + when size is 0. + + If malloc or calloc returns 0 due to allocation size, increase the size + to 1 and try again. + + * wtf/FastMalloc.cpp: + (WTF::fastMalloc): + (WTF::fastCalloc): + +2010-02-04 Mark Rowe + + Reviewed by Timothy Hatcher. + + Build fix. Remove a symbol corresponding to an inline function from the linker export + file to prevent a weak external failure. + + * JavaScriptCore.xcodeproj/project.pbxproj: Accommodate rename of script. + +2010-02-04 Daniel Bates + + [Qt] Unreviewed, build fix for Qt bot. + + * runtime/JSStringBuilder.h: Changed #include notation #include "X.h". + +2010-02-04 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Clearing a WeakGCPtr is weird + https://bugs.webkit.org/show_bug.cgi?id=34627 + + Added a WeakGCPtr::clear interface. + + As discussed in https://bugs.webkit.org/show_bug.cgi?id=33383, the old + interface made it pretty weird for a client to conditionally clear a + WeakGCPtr, which is exactly what clients want to do when objects are + finalized. + + * API/JSClassRef.cpp: + (clearReferenceToPrototype): Use the new WeakGCPtr::clear() interface. + + * runtime/WeakGCPtr.h: + (JSC::WeakGCPtr::clear): Added an interface for clearing a WeakGCPtr, + iff its current value is the value passed in. It's cumbersome for the + client to do this test, since WeakGCPtr sometimes pretends to be null. + +2010-02-04 Geoffrey Garen + + Build fix: export a header. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2010-02-04 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Add a JSStringBuilder class (similar-to, and derived-from StringBuilder) to + construct JSStrings, throwing a JS exception should we run out of memory whilst + allocating storage for the string. + + Similarly, add jsMakeNontrivialString methods to use in cases where previously + we were calling makeString & passing the result to jsNontrivialString. Again, + these new methods throw if we hit an out of memory condition. + + Move throwOutOfMemoryError into ExceptionHelpers, to make it more widely available. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncJoin): + * runtime/DateConstructor.cpp: + (JSC::callDate): + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToGMTString): + * runtime/ErrorPrototype.cpp: + (JSC::errorProtoFuncToString): + * runtime/ExceptionHelpers.cpp: + (JSC::throwOutOfMemoryError): + * runtime/ExceptionHelpers.h: + * runtime/JSStringBuilder.h: Added. + (JSC::JSStringBuilder::releaseJSString): + (JSC::jsMakeNontrivialString): + * runtime/NumberPrototype.cpp: + (JSC::numberProtoFuncToPrecision): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncToString): + * runtime/Operations.cpp: + * runtime/Operations.h: + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncToString): + * runtime/StringBuilder.h: + (JSC::StringBuilder::append): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncBig): + (JSC::stringProtoFuncSmall): + (JSC::stringProtoFuncBlink): + (JSC::stringProtoFuncBold): + (JSC::stringProtoFuncFixed): + (JSC::stringProtoFuncItalics): + (JSC::stringProtoFuncStrike): + (JSC::stringProtoFuncSub): + (JSC::stringProtoFuncSup): + (JSC::stringProtoFuncFontcolor): + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncAnchor): + +2010-02-04 Steve Falkenburg + + Windows build fix. + + * wtf/MathExtras.h: + +2010-02-04 Darin Adler + + Reviewed by David Levin. + + Make MathExtras.h compatible with + https://bugs.webkit.org/show_bug.cgi?id=34618 + + * wtf/MathExtras.h: Include instead of . + Use "using" as we do elsewhere in WTF for the four functions from + we want to use without the prefix. Later we could consider making the std + explicit at call sites instead. + +2010-02-04 Tamas Szirbucz + + Reviewed by Gavin Barraclough. + + Use an easily appendable structure for trampolines instead of pointer parameters. + https://bugs.webkit.org/show_bug.cgi?id=34424 + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::executableCopy): + * jit/JIT.h: + (JSC::JIT::compileCTIMachineTrampolines): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + (JSC::JITThunks::ctiStringLengthTrampoline): + (JSC::JITThunks::ctiVirtualCallLink): + (JSC::JITThunks::ctiVirtualCall): + (JSC::JITThunks::ctiNativeCallThunk): + +2010-02-04 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + Increase test coverage for the QScriptValue. + + https://bugs.webkit.org/show_bug.cgi?id=34533 + + * qt/tests/qscriptvalue/qscriptvalue.pro: + * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: + (tst_QScriptValue::tst_QScriptValue): + (tst_QScriptValue::~tst_QScriptValue): + (tst_QScriptValue::dataHelper): + (tst_QScriptValue::newRow): + (tst_QScriptValue::testHelper): + (tst_QScriptValue::ctor): + * qt/tests/qscriptvalue/tst_qscriptvalue.h: Added. + * qt/tests/qscriptvalue/tst_qscriptvalue_generated.cpp: Added. + (tst_QScriptValue::initScriptValues): + (tst_QScriptValue::isValid_initData): + (tst_QScriptValue::isValid_makeData): + (tst_QScriptValue::isValid_test): + (tst_QScriptValue::isBool_initData): + (tst_QScriptValue::isBool_makeData): + (tst_QScriptValue::isBool_test): + (tst_QScriptValue::isBoolean_initData): + (tst_QScriptValue::isBoolean_makeData): + (tst_QScriptValue::isBoolean_test): + (tst_QScriptValue::isFunction_initData): + (tst_QScriptValue::isFunction_makeData): + (tst_QScriptValue::isFunction_test): + (tst_QScriptValue::isNull_initData): + (tst_QScriptValue::isNull_makeData): + (tst_QScriptValue::isNull_test): + (tst_QScriptValue::isString_initData): + (tst_QScriptValue::isString_makeData): + (tst_QScriptValue::isString_test): + (tst_QScriptValue::isUndefined_initData): + (tst_QScriptValue::isUndefined_makeData): + (tst_QScriptValue::isUndefined_test): + (tst_QScriptValue::isObject_initData): + (tst_QScriptValue::isObject_makeData): + (tst_QScriptValue::isObject_test): + +2010-02-03 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Define WTF_PLATFORM_BREWMP_SIMULATOR when AEE_SIMULATOR is defined + https://bugs.webkit.org/show_bug.cgi?id=34514 + + PLATFORM(BREWMP_SIMULATOR) guard is needed to make distinction between BREWMP + and BREWMP simulator. + + * wtf/Platform.h: + +2010-02-03 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Remove COMPILE_ASSERT conflict with the underlying PLATFORM + https://bugs.webkit.org/show_bug.cgi?id=34190 + + COMPILE_ASSERT conflicts with the underlying PLATFORM because it is defined + both in WTF's Assertions.h and BREWMP's AEEClassIDs.h. Include AEEClassIDs.h + in Assertions.h and undef COMPILE_ASSERT to avoid redefining COMPILE_ASSERT. + + * wtf/Assertions.h: + +2010-02-03 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Implement OwnPtrBrew to make sure BREW instances are freed. + https://bugs.webkit.org/show_bug.cgi?id=34518 + + Add OwnPtrBrew to release IFile, IFileMgr and IBitmap instances. + + * wtf/brew/OwnPtrBrew.cpp: Added. + (WTF::IFileMgr): + (WTF::IFile): + (WTF::IBitmap): + (WTF::freeOwnedPtrBrew): + * wtf/brew/OwnPtrBrew.h: Added. + (WTF::OwnPtrBrew::OwnPtrBrew): + (WTF::OwnPtrBrew::~OwnPtrBrew): + (WTF::OwnPtrBrew::get): + (WTF::OwnPtrBrew::release): + (WTF::OwnPtrBrew::outPtr): + (WTF::OwnPtrBrew::set): + (WTF::OwnPtrBrew::clear): + (WTF::OwnPtrBrew::operator*): + (WTF::OwnPtrBrew::operator->): + (WTF::OwnPtrBrew::operator!): + (WTF::OwnPtrBrew::operator UnspecifiedBoolType): + (WTF::OwnPtrBrew::swap): + (WTF::swap): + (WTF::operator==): + (WTF::operator!=): + (WTF::getPtr): + +2010-02-03 Kwang Yul Seo + + Reviewed by Darin Adler. + + Export WTF::fastStrDup symbol + https://bugs.webkit.org/show_bug.cgi?id=34526 + + * JavaScriptCore.exp: + +2010-02-03 Kevin Watters + + Reviewed by Kevin Ollivier. + + [wx] Enable JIT compilation for wx. + + https://bugs.webkit.org/show_bug.cgi?id=34536 + + * wtf/Platform.h: + +2010-02-02 Oliver Hunt + + Reviewed by Geoffrey Garen. + + Crash in CollectorBitmap::get at nbcolympics.com + https://bugs.webkit.org/show_bug.cgi?id=34504 + + This was caused by the use of m_offset to determine the offset of + a new property into the property storage. This patch corrects + the effected cases by incorporating the anonymous slot count. It + also removes the duplicate copy of anonymous slot count from the + property table as keeping this up to date merely increased the + chance of a mismatch. Finally I've added a large number of + assertions in an attempt to prevent such a bug from happening + again. + + With the new assertions in place the existing anonymous slot tests + all fail without the m_offset fixes. + + * runtime/PropertyMapHashTable.h: + * runtime/Structure.cpp: + (JSC::Structure::materializePropertyMap): + (JSC::Structure::addPropertyTransitionToExistingStructure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::removePropertyTransition): + (JSC::Structure::flattenDictionaryStructure): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::removePropertyWithoutTransition): + (JSC::Structure::copyPropertyTable): + (JSC::Structure::get): + (JSC::Structure::put): + (JSC::Structure::remove): + (JSC::Structure::insertIntoPropertyMapHashTable): + (JSC::Structure::createPropertyMapHashTable): + (JSC::Structure::rehashPropertyMapHashTable): + (JSC::Structure::checkConsistency): + +2010-02-02 Steve Falkenburg + + Reviewed by Darin Adler. + + Copyright year updating for Windows version resources should be automatic + https://bugs.webkit.org/show_bug.cgi?id=34503 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: + +2010-02-02 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Add dummy main thread functions + https://bugs.webkit.org/show_bug.cgi?id=33569 + + Add dummy initializeMainThreadPlatform and + scheduleDispatchFunctionsOnMainThread. + + * wtf/brew/MainThreadBrew.cpp: Added. + (WTF::initializeMainThreadPlatform): + (WTF::scheduleDispatchFunctionsOnMainThread): + +2010-02-02 Kwang Yul Seo + + Reviewed by Darin Adler. + + Add using WTF::getLocalTime to CurrentTime.h + https://bugs.webkit.org/show_bug.cgi?id=34493 + + * wtf/CurrentTime.h: + +2010-02-02 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Add HAVE_XXX definitions + https://bugs.webkit.org/show_bug.cgi?id=34414 + + Add HAVE_ERRNO_H=1 + + * wtf/Platform.h: + +2010-02-02 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Don't define HAVE_TM_GMTOFF, HAVE_TM_ZONE and HAVE_TIMEGM + https://bugs.webkit.org/show_bug.cgi?id=34388 + + BREWMP does not have these features. + + * wtf/Platform.h: + +2010-02-02 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Define WTF_PLATFORM_BREWMP=1 when BUILDING_BREWMP is defined + https://bugs.webkit.org/show_bug.cgi?id=34386 + + Define WTF_PLATFORM_BREWMP=1 so that PLATFORM(BREWMP) guard can be used. + + * wtf/Platform.h: + +2010-02-01 Kent Tamura + + Reviewed by Darin Adler. + + Date.UTC() should apply TimeClip operation. + https://bugs.webkit.org/show_bug.cgi?id=34461 + + ECMAScript 5 15.9.4.3: + > 9 Return TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))). + + * runtime/DateConstructor.cpp: + (JSC::dateUTC): Calls WTF::timeClip(). + +2010-02-01 Kent Tamura + + Reviewed by Darin Adler. + + Fix a bug that Math.round() retunrs incorrect results for huge integers + https://bugs.webkit.org/show_bug.cgi?id=34462 + + * runtime/MathObject.cpp: + (JSC::mathProtoFuncRound): Avoid "arg + 0.5". + +2010-02-01 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Port WTF's currentTime + https://bugs.webkit.org/show_bug.cgi?id=33567 + + Combine GETUTCSECONDS and GETTIMEMS to calculate the number + of milliseconds since 1970/01/01 00:00:00 UTC. + + * wtf/CurrentTime.cpp: + (WTF::currentTime): + +2010-02-01 Patrick Gansterer + + Reviewed by Darin Adler. + + [Qt] WinCE buildfix after r52729 and fix for Q_BIG_ENDIAN typo. + https://bugs.webkit.org/show_bug.cgi?id=34378 + + * wtf/Platform.h: + +2010-02-01 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Structure not accounting for anonymous slots when computing property storage size + https://bugs.webkit.org/show_bug.cgi?id=34441 + + Previously any Structure with anonymous storage would have a property map, so we + were only including anonymous slot size if there was a property map. Given this + is no longer the case we should always include the anonymous slot count in the + property storage size. + + * runtime/Structure.h: + (JSC::Structure::propertyStorageSize): + +2010-02-01 Oliver Hunt + + Windows build fix, update exports file (again) + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-02-01 Oliver Hunt + + Windows build fix, update exports file + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-31 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + JSC is failing to propagate anonymous slot count on some transitions + https://bugs.webkit.org/show_bug.cgi?id=34321 + + Remove secondary Structure constructor, and make Structure store a copy + of the number of anonymous slots directly so saving an immediate allocation + of a property map for all structures with anonymous storage, which also + avoids the leaked property map on new property transition in the original + version of this patch. + + We need to propagate the the anonymous slot count otherwise we can end up + with a structure recording incorrect information about the available and + needed space for property storage, or alternatively incorrectly reusing + some slots. + + * JavaScriptCore.exp: + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::materializePropertyMap): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::flattenDictionaryStructure): + (JSC::Structure::copyPropertyTable): + (JSC::Structure::put): + (JSC::Structure::remove): + (JSC::Structure::insertIntoPropertyMapHashTable): + (JSC::Structure::createPropertyMapHashTable): + * runtime/Structure.h: + (JSC::Structure::create): + (JSC::Structure::hasAnonymousSlots): + (JSC::Structure::anonymousSlotCount): + +2010-01-31 Patrick Gansterer + + Reviewed by Darin Adler. + + Buildfix for WinCE + style fixes (TLS_OUT_OF_INDEXES is not defined). + https://bugs.webkit.org/show_bug.cgi?id=34380 + + * wtf/ThreadSpecific.h: + +2010-01-31 Kent Tamura + + Reviewed by Darin Adler. + + [Windows] Fix a bug of round() with huge integral numbers + https://bugs.webkit.org/show_bug.cgi?id=34297 + + Fix a bug that round() for huge integral numbers returns incorrect + results. For example, round(8639999913600001) returns + 8639999913600002 without this change though the double type can + represent 8639999913600001 precisely. + + Math.round() of JavaScript has a similar problem. But this change + doesn't fix it because Math.round() doesn't use round() of + MathExtra.h. + + * wtf/MathExtras.h: + (round): Avoid to do "num + 0.5" or "num - 0.5". + (roundf): Fixed similarly. + (llround): Calls round(). + (llroundf): Calls roundf(). + (lround): Calls round(). + (lroundf): Calls roundf(). + +2010-01-29 Mark Rowe + + Sort Xcode projects. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2010-01-29 Mark Rowe + + Fix the Mac build. + + Disable ENABLE_INDEXED_DATABASE since it is "completely non-functional". + + As the comment in FeatureDefines.xcconfig notes, the list of feature defines + needs to be kept in sync across the various files. The default values also + need to be kept in sync between these files and build-webkit. + + * Configurations/FeatureDefines.xcconfig: + +2010-01-29 Simon Hausmann + + Rubber-stamped by Maciej Stachowiak. + + Fix the ARM build. + + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::createStructure): Call the right Structure::create overload. + +2010-01-28 Kevin Ollivier + + [wx] Build fix for MSW, use ThreadingWin.cpp as the Windows pthreads implementation + implements pthread_t in a way that makes it impossible to check its validity, + which is needed by ThreadingPthreads.cpp. + + * wscript: + +2010-01-28 Oliver Hunt + + Reviewed by Gavin Barraclough. + + DOM Objects shouldn't all require custom mark functions + https://bugs.webkit.org/show_bug.cgi?id=34291 + + Make getAnonymousValue const-friendly + + * runtime/JSObject.h: + (JSC::JSObject::getAnonymousValue): + +2010-01-28 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Simplify anonymous slot implementation + https://bugs.webkit.org/show_bug.cgi?id=34282 + + A class must now specify the number of slots it needs at construction time + rather than later on with a transition. This makes many things simpler, + we no longer need to need an additional transition on object creation to + add the anonymous slots, and we remove the need for a number of transition + type checks. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * JavaScriptCore.exp: + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DateInstance.h: + (JSC::DateInstance::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GetterSetter.h: + (JSC::GetterSetter::createStructure): + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::createStructure): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSCell.h: + (JSC::JSCell::createDummyStructure): + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::createStructure): + * runtime/JSNotAnObject.h: + (JSC::JSNotAnObject::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + (JSC::JSObject::putAnonymousValue): + (JSC::JSObject::getAnonymousValue): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::createStructure): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSString.h: + (JSC::Fiber::createStructure): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + (JSC::JSWrapperObject::JSWrapperObject): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + * runtime/Structure.cpp: + (JSC::Structure::~Structure): + (JSC::Structure::materializePropertyMap): + * runtime/Structure.h: + (JSC::Structure::create): + (JSC::Structure::anonymousSlotCount): + * runtime/StructureTransitionTable.h: + +2010-01-27 Oliver Hunt + + Windows build fix. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-27 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + MessageEvent.data should deserialize in the context of the MessageEvent's global object + https://bugs.webkit.org/show_bug.cgi?id=34227 + + Add logic to allow us to create an Object, Array, or Date instance + so we can create them in the context of a specific global object, + rather than just using the current lexical global object. + + * JavaScriptCore.exp: + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + * runtime/DateInstance.h: + * runtime/JSGlobalObject.h: + (JSC::constructEmptyObject): + (JSC::constructEmptyArray): + +2010-01-27 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=34150 + WebKit needs a mechanism to catch stale HashMap entries + + It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash + is just its value, it is very unlikely that any observable problem is reproducible. + + This extends hash table consistency checks to check that pointers are referencing allocated + memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible + to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much). + + * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can + add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems + with those yet. + + * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by + CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency(). + + * wtf/HashTable.h: + (WTF::HashTable::internalCheckTableConsistency): + (WTF::HashTable::internalCheckTableConsistencyExceptSize): + (WTF::HashTable::checkTableConsistencyExceptSize): + Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off. + (WTF::::add): Updated for checkTableConsistency renaming. + (WTF::::addPassingHashCode): Ditto. + (WTF::::removeAndInvalidate): Ditto. + (WTF::::remove): Ditto. + (WTF::::rehash): Ditto. + (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this + function returns true for tables with m_table == 0. + (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially, + we could do the same for values. + + * wtf/HashTraits.h: + (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden + to add checks. Currently, the only override is for pointer hashes. + + * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming. + +2010-01-27 Anton Muhin + + Reviewed by Darin Adler. + + Remove trailing \ from inline function code + https://bugs.webkit.org/show_bug.cgi?id=34223 + + * assembler/ARMv7Assembler.h: + (JSC::ARMThumbImmediate::countLeadingZerosPartial): + +2010-01-27 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Port WTF's randomNumber + https://bugs.webkit.org/show_bug.cgi?id=33566 + + Use GETRAND to generate 4 byte random byte sequence to implement + weakRandomNumber. Create a secure random number generator with + AEECLSID_RANDOM to implement randomNumber. + + * wtf/RandomNumber.cpp: + (WTF::weakRandomNumber): + (WTF::randomNumber): + +2010-01-27 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Port getCPUTime + https://bugs.webkit.org/show_bug.cgi?id=33572 + + Use GETUPTIMEMS which returns a continuously and + linearly increasing millisecond timer from the time the device + was powered on. This function is enough to implement getCPUTime. + + * runtime/TimeoutChecker.cpp: + (JSC::getCPUTime): + +2010-01-27 Kwang Yul Seo + + Reviewed by Oliver Hunt. + + [BREWMP] Add MarkStack fastMalloc implementation for platforms without VirtualAlloc or mmap. + https://bugs.webkit.org/show_bug.cgi?id=33582 + + Use fastMalloc and fastFree to implement MarkStack::allocateStack and + MarkStack::releaseStack for platforms without page level allocation. + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackNone.cpp: Added. + (JSC::MarkStack::initializePagesize): + (JSC::MarkStack::allocateStack): + (JSC::MarkStack::releaseStack): + +2010-01-27 Kwang Yul Seo + + Reviewed by Eric Seidel. + + [BREWMP] Don't use time function + https://bugs.webkit.org/show_bug.cgi?id=33577 + + Calling time(0) in BREW devices causes a crash because time + is not properly ported in most devices. Cast currentTime() to + time_t to get the same result as time(0). + + * wtf/DateMath.cpp: + (WTF::calculateUTCOffset): + +2010-01-27 Alexey Proskuryakov + + Revert r53899 (HashMap key checks) and subsequent build fixes, + because they make SVG tests crash in release builds. + + * wtf/HashMap.h: + (WTF::::remove): + * wtf/HashSet.h: + (WTF::::remove): + * wtf/HashTable.h: + (WTF::::add): + (WTF::::addPassingHashCode): + (WTF::::removeAndInvalidate): + (WTF::::remove): + (WTF::::rehash): + (WTF::::checkTableConsistency): + (WTF::::checkTableConsistencyExceptSize): + * wtf/HashTraits.h: + (WTF::GenericHashTraits::emptyValue): + (WTF::): + * wtf/RefPtrHashMap.h: + (WTF::::remove): + +2010-01-26 Alexey Proskuryakov + + More Windows build fixing. + + * wtf/HashTraits.h: _msize takes void*, remove const qualifier from type. + +2010-01-26 Alexey Proskuryakov + + Windows build fix. + + * wtf/HashTraits.h: Include malloc.h for _msize(). + +2010-01-26 Alexey Proskuryakov + + Build fix. + + * wtf/HashTable.h: (WTF::HashTable::checkTableConsistencyExceptSize): Remove const from a + static (empty) version of this function. + +2010-01-26 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=34150 + WebKit needs a mechanism to catch stale HashMap entries + + It is very difficult to catch stale pointers that are HashMap keys - since a pointer's hash + is just its value, it is very unlikely that any observable problem is reproducible. + + This extends hash table consistency checks to check that pointers are referencing allocated + memory blocks, and makes it possible to invoke the checks explicitly (it is not feasible + to enable CHECK_HASHTABLE_CONSISTENCY by default, because that affects performance too much). + + * wtf/HashMap.h: (WTF::::checkConsistency): Call through to HashTable implementation. We can + add similar calls to HashSet and HashCountedSet, but I haven't seen hard to debug problems + with those yet. + + * wtf/HashSet.h: (WTF::::remove): The version of checkTableConsistency that's guarded by + CHECK_HASHTABLE_CONSISTENCY is now called internalCheckTableConsistency(). + + * wtf/HashTable.h: + (WTF::HashTable::internalCheckTableConsistency): + (WTF::HashTable::internalCheckTableConsistencyExceptSize): + (WTF::HashTable::checkTableConsistencyExceptSize): + Expose checkTableConsistency() even if CHECK_HASHTABLE_CONSISTENCY is off. + (WTF::::add): Updated for checkTableConsistency renaming. + (WTF::::addPassingHashCode): Ditto. + (WTF::::removeAndInvalidate): Ditto. + (WTF::::remove): Ditto. + (WTF::::rehash): Ditto. + (WTF::::checkTableConsistency): The assertion for !shouldExpand() was not correct - this + function returns true for tables with m_table == 0. + (WTF::::checkTableConsistencyExceptSize): Call checkValueConsistency for key. Potentially, + we could do the same for values. + + * wtf/HashTraits.h: + (WTF::GenericHashTraits::checkValueConsistency): An empty function that can be overridden + to add checks. Currently, the only override is for pointer hashes. + + * wtf/RefPtrHashMap.h: (WTF::::remove): Updated for checkTableConsistency renaming. + +2010-01-26 Lyon Chen + + Reviewed by Maciej Stachowiak. + + Opcode.h use const void* for Opcode cause error #1211 for RVCT compiler + https://bugs.webkit.org/show_bug.cgi?id=33902 + + * bytecode/Opcode.h: + +2010-01-26 Steve Falkenburg + + Reviewed by Oliver Hunt. + + Windows build references non-existent include paths + https://bugs.webkit.org/show_bug.cgi?id=34175 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.vcproj/testapi/testapi.vcproj: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2010-01-26 Oliver Hunt + + Reviewed by Geoffrey Garen. + + Using JavaScriptCore API with a webkit vended context can result in slow script dialog + https://bugs.webkit.org/show_bug.cgi?id=34172 + + Make the APIShim correctly increment and decrement the timeout + entry counter. + + * API/APIShims.h: + (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): + (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): + (JSC::APICallbackShim::APICallbackShim): + (JSC::APICallbackShim::~APICallbackShim): + +2010-01-26 Simon Hausmann + + [Qt] Fix compilation of QtScript with non-gcc compilers + + Variable length stack arrays are a gcc extension. Use QVarLengthArray + as a more portable solution that still tries to allocate on the stack + first. + + * qt/api/qscriptvalue_p.h: + (QScriptValuePrivate::call): + +2010-01-26 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Fix the build on platforms without JIT support. + + The JIT support should be determined at compile-time via wtf/Platform.h + + * qt/api/QtScript.pro: + +2010-01-26 Jedrzej Nowacki + + Reviewed by Simon Hausmann. + + First steps of the QtScript API. + + Two new classes were created; QScriptEngine and QScriptValue. + The first should encapsulate a javascript context and the second a script + value. + + This API is still in development, so it isn't compiled by default. + To trigger compilation, pass --qmakearg="CONFIG+=build-qtscript" to + build-webkit. + + https://bugs.webkit.org/show_bug.cgi?id=32565 + + * qt/api/QtScript.pro: Added. + * qt/api/qscriptconverter_p.h: Added. + (QScriptConverter::toString): + * qt/api/qscriptengine.cpp: Added. + (QScriptEngine::QScriptEngine): + (QScriptEngine::~QScriptEngine): + (QScriptEngine::evaluate): + (QScriptEngine::collectGarbage): + * qt/api/qscriptengine.h: Added. + * qt/api/qscriptengine_p.cpp: Added. + (QScriptEnginePrivate::QScriptEnginePrivate): + (QScriptEnginePrivate::~QScriptEnginePrivate): + (QScriptEnginePrivate::evaluate): + * qt/api/qscriptengine_p.h: Added. + (QScriptEnginePrivate::get): + (QScriptEnginePrivate::collectGarbage): + (QScriptEnginePrivate::makeJSValue): + (QScriptEnginePrivate::context): + * qt/api/qscriptvalue.cpp: Added. + (QScriptValue::QScriptValue): + (QScriptValue::~QScriptValue): + (QScriptValue::isValid): + (QScriptValue::isBool): + (QScriptValue::isBoolean): + (QScriptValue::isNumber): + (QScriptValue::isNull): + (QScriptValue::isString): + (QScriptValue::isUndefined): + (QScriptValue::isError): + (QScriptValue::isObject): + (QScriptValue::isFunction): + (QScriptValue::toString): + (QScriptValue::toNumber): + (QScriptValue::toBool): + (QScriptValue::toBoolean): + (QScriptValue::toInteger): + (QScriptValue::toInt32): + (QScriptValue::toUInt32): + (QScriptValue::toUInt16): + (QScriptValue::call): + (QScriptValue::engine): + (QScriptValue::operator=): + (QScriptValue::equals): + (QScriptValue::strictlyEquals): + * qt/api/qscriptvalue.h: Added. + (QScriptValue::): + * qt/api/qscriptvalue_p.h: Added. + (QScriptValuePrivate::): + (QScriptValuePrivate::get): + (QScriptValuePrivate::QScriptValuePrivate): + (QScriptValuePrivate::isValid): + (QScriptValuePrivate::isBool): + (QScriptValuePrivate::isNumber): + (QScriptValuePrivate::isNull): + (QScriptValuePrivate::isString): + (QScriptValuePrivate::isUndefined): + (QScriptValuePrivate::isError): + (QScriptValuePrivate::isObject): + (QScriptValuePrivate::isFunction): + (QScriptValuePrivate::toString): + (QScriptValuePrivate::toNumber): + (QScriptValuePrivate::toBool): + (QScriptValuePrivate::toInteger): + (QScriptValuePrivate::toInt32): + (QScriptValuePrivate::toUInt32): + (QScriptValuePrivate::toUInt16): + (QScriptValuePrivate::equals): + (QScriptValuePrivate::strictlyEquals): + (QScriptValuePrivate::assignEngine): + (QScriptValuePrivate::call): + (QScriptValuePrivate::engine): + (QScriptValuePrivate::context): + (QScriptValuePrivate::value): + (QScriptValuePrivate::object): + (QScriptValuePrivate::inherits): + (QScriptValuePrivate::isJSBased): + (QScriptValuePrivate::isNumberBased): + (QScriptValuePrivate::isStringBased): + * qt/api/qtscriptglobal.h: Added. + * qt/tests/qscriptengine/qscriptengine.pro: Added. + * qt/tests/qscriptengine/tst_qscriptengine.cpp: Added. + (tst_QScriptEngine::tst_QScriptEngine): + (tst_QScriptEngine::~tst_QScriptEngine): + (tst_QScriptEngine::init): + (tst_QScriptEngine::cleanup): + (tst_QScriptEngine::collectGarbage): + (tst_QScriptEngine::evaluate): + * qt/tests/qscriptvalue/qscriptvalue.pro: Added. + * qt/tests/qscriptvalue/tst_qscriptvalue.cpp: Added. + (tst_QScriptValue::tst_QScriptValue): + (tst_QScriptValue::~tst_QScriptValue): + (tst_QScriptValue::init): + (tst_QScriptValue::cleanup): + (tst_QScriptValue::ctor): + (tst_QScriptValue::toString_data): + (tst_QScriptValue::toString): + (tst_QScriptValue::copyConstructor_data): + (tst_QScriptValue::copyConstructor): + (tst_QScriptValue::assignOperator_data): + (tst_QScriptValue::assignOperator): + (tst_QScriptValue::dataSharing): + (tst_QScriptValue::constructors_data): + (tst_QScriptValue::constructors): + (tst_QScriptValue::call): + * qt/tests/tests.pri: Added. + * qt/tests/tests.pro: Added. + +2010-01-25 Dmitry Titov + + Reviewed by David Levin. + + Fix Chromium Linux tests: the pthread functions on Linux produce segfault if they receive 0 thread handle. + After r53714, we can have 0 thread handles passed to pthread_join and pthread_detach if corresponding threads + were already terminated and their threadMap entries cleared. + Add a 0 check. + + * wtf/ThreadingPthreads.cpp: + (WTF::waitForThreadCompletion): + (WTF::detachThread): + +2010-01-24 Laszlo Gombos + + Reviewed by Maciej Stachowiak. + + Refactor JITStubs.cpp so that DEFINE_STUB_FUNCTION is only used once for each function + https://bugs.webkit.org/show_bug.cgi?id=33866 + + Place the guard USE(JSVALUE32_64) inside the body of the DEFINE_STUB_FUNCTION + macro for those functions that are always present. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + +2010-01-22 Kevin Watters + + Reviewed by Kevin Ollivier. + + [wx] Remove the Bakefile build system, which is no longer being used. + + https://bugs.webkit.org/show_bug.cgi?id=34022 + + * JavaScriptCoreSources.bkl: Removed. + * jscore.bkl: Removed. + +2010-01-22 Steve Falkenburg + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=34025 + Enable client-based Geolocation abstraction for Mac, Windows AppleWebKit targets. + + * Configurations/FeatureDefines.xcconfig: + +2010-01-22 Dmitry Titov + + Not reviewed, attempted Snow Leopard build fix. + + * wtf/ThreadingPthreads.cpp: Add a forward declaration of a function which is not 'static'. + +2009-01-22 Dmitry Titov + + Reviewed by Maciej Stachowiak. + + Fix the leak of ThreadIdentifiers in threadMap across threads. + https://bugs.webkit.org/show_bug.cgi?id=32689 + + Test is added to DumpRenderTree.mm. + + * Android.mk: Added file ThreadIdentifierDataPthreads.(h|cpp) to build. + * Android.v8.wtf.mk: Ditto. + * GNUmakefile.am: Ditto. + * JavaScriptCore.gyp/JavaScriptCore.gyp: Ditto. + * JavaScriptCore.gypi: Ditto. + * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. + + * wtf/ThreadIdentifierDataPthreads.cpp: Added. Contains custom implementation of thread-specific data that uses custom destructor. + (WTF::ThreadIdentifierData::~ThreadIdentifierData): Removes the ThreadIdentifier from the threadMap. + (WTF::ThreadIdentifierData::identifier): + (WTF::ThreadIdentifierData::initialize): + (WTF::ThreadIdentifierData::destruct): Custom thread-specific destructor. Resets the value for the key again to cause second invoke. + (WTF::ThreadIdentifierData::initializeKeyOnceHelper): + (WTF::ThreadIdentifierData::initializeKeyOnce): Need to use pthread_once since initialization may come on any thread(s). + * wtf/ThreadIdentifierDataPthreads.h: Added. + (WTF::ThreadIdentifierData::ThreadIdentifierData): + + * wtf/Threading.cpp: + (WTF::threadEntryPoint): Move initializeCurrentThreadInternal to after the lock to make + sure it is invoked when ThreadIdentifier is already established. + + * wtf/Threading.h: Rename setThreadNameInternal -> initializeCurrentThreadInternal since it does more then only set the name now. + * wtf/ThreadingNone.cpp: + (WTF::initializeCurrentThreadInternal): Ditto. + * wtf/ThreadingWin.cpp: + (WTF::initializeCurrentThreadInternal): Ditto. + (WTF::initializeThreading): Ditto. + * wtf/gtk/ThreadingGtk.cpp: + (WTF::initializeCurrentThreadInternal): Ditto. + * wtf/qt/ThreadingQt.cpp: + (WTF::initializeCurrentThreadInternal): Ditto. + + * wtf/ThreadingPthreads.cpp: + (WTF::establishIdentifierForPthreadHandle): + (WTF::clearPthreadHandleForIdentifier): Make it not 'static' so the ~ThreadIdentifierData() in another file can call it. + (WTF::initializeCurrentThreadInternal): Set the thread-specific data. The ThreadIdentifier is already established by creating thread. + (WTF::waitForThreadCompletion): Remove call to clearPthreadHandleForIdentifier(threadID) since it is now done in ~ThreadIdentifierData(). + (WTF::detachThread): Ditto. + (WTF::currentThread): Use the thread-specific data to get the ThreadIdentifier. It's many times faster then Mutex-protected iteration through the map. + Also, set the thread-specific data if called first time on the thread. + +2010-01-21 Kwang Yul Seo + + Reviewed by Alexey Proskuryakov. + + Add ThreadSpecific for ENABLE(SINGLE_THREADED) + https://bugs.webkit.org/show_bug.cgi?id=33878 + + Implement ThreadSpecific with a simple getter/setter + when ENABLE(SINGLE_THREADED) is true. + + Due to the change in https://bugs.webkit.org/show_bug.cgi?id=33236, + an implementation of ThreadSpecific must be available to build WebKit. + This causes a build failure for platforms without a proper + ThreadSpecific implementation. + + * wtf/ThreadSpecific.h: + (WTF::::ThreadSpecific): + (WTF::::~ThreadSpecific): + (WTF::::get): + (WTF::::set): + (WTF::::destroy): + +2010-01-21 Kwang Yul Seo + + Reviewed by Maciej Stachowiak. + + Add fastStrDup to FastMalloc + https://bugs.webkit.org/show_bug.cgi?id=33937 + + The new string returned by fastStrDup is obtained with fastMalloc, + and can be freed with fastFree. This makes the memory management + more consistent because we don't need to keep strdup allocated pointers + and free them with free(). Instead we can use fastFree everywhere. + + * wtf/FastMalloc.cpp: + (WTF::fastStrDup): + * wtf/FastMalloc.h: + +2010-01-21 Brady Eidson + + Reviewed by Maciej Stachowiak. + + history.back() for same-document history traversals isn't synchronous as the specification states. + and https://bugs.webkit.org/show_bug.cgi?id=33538 + + * wtf/Platform.h: Add a "HISTORY_ALWAYS_ASYNC" enable and turn it on for Chromium. + +2010-01-21 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Always create a prototype for automatically managed classes. + + This fixes some errors where prototype chains were not correctly hooked + up, and also ensures that API classes work correctly with features like + instanceof. + + * API/JSClassRef.cpp: + (OpaqueJSClass::create): Cleaned up some of this code. Also changed it + to always create a prototype class. + + * API/tests/testapi.c: + (Derived2_class): + (main): Fixed a null value crash in the exception checking code. + * API/tests/testapi.js: Added some tests for the case where a prototype + chain would not be hooked up correctly. + +2010-01-21 Oliver Hunt + + Reviewed by Geoff Garen. + + Force JSC to create a prototype chain for API classes with a + parent class but no static functions. + + * API/JSClassRef.cpp: + (OpaqueJSClass::create): + +2010-01-21 Kent Hansen + + Reviewed by Geoffrey Garen. + + Object.getOwnPropertyDescriptor always returns undefined for JS API objects + https://bugs.webkit.org/show_bug.cgi?id=33946 + + Ideally the getOwnPropertyDescriptor() reimplementation should return an + access descriptor that wraps the property getter and setter callbacks, but + that approach is much more involved than returning a value descriptor. + Keep it simple for now. + + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertyDescriptor): + * API/tests/testapi.js: + +2010-01-20 Mark Rowe + + Build fix. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::initializeScavenger): Remove unnecessary function call. + +2010-01-20 Mark Rowe + + Reviewed by Oliver Hunt. + + Use the inline i386 assembly for x86_64 as well rather than falling back to using pthread mutexes. + + * wtf/TCSpinLock.h: + (TCMalloc_SpinLock::Lock): + (TCMalloc_SpinLock::Unlock): + (TCMalloc_SlowLock): + +2010-01-20 Mark Rowe + + Reviewed by Oliver Hunt. + + Use GCD instead of an extra thread for FastMalloc scavenging on platforms where it is supported + + Abstract the background scavenging slightly so that an alternate implementation that uses GCD can be used on platforms + where it is supported. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::init): + (WTF::TCMalloc_PageHeap::initializeScavenger): + (WTF::TCMalloc_PageHeap::signalScavenger): + (WTF::TCMalloc_PageHeap::shouldContinueScavenging): + (WTF::TCMalloc_PageHeap::Delete): + (WTF::TCMalloc_PageHeap::periodicScavenge): + * wtf/Platform.h: + +2010-01-20 Geoffrey Garen + + Reviewed by Oliver Hunt. + + REGRESSION(53460): Heap::destroy may not run + all destructors + + * runtime/Collector.cpp: + (JSC::Heap::freeBlocks): Instead of fully marking protected objects, + just set their mark bits. This prevents protected objects from keeping + unprotected objects alive. Destructor order is not guaranteed, so it's + OK to destroy objects pointed to by protected objects before destroying + protected objects. + +2010-01-19 David Levin + + Reviewed by Oliver Hunt. + + CrossThreadCopier needs to support ThreadSafeShared better. + https://bugs.webkit.org/show_bug.cgi?id=33698 + + * wtf/TypeTraits.cpp: Added tests for the new type traits. + * wtf/TypeTraits.h: + (WTF::IsSubclass): Determines if a class is a derived from another class. + (WTF::IsSubclassOfTemplate): Determines if a class is a derived from a + template class (with one parameter that is unknown). + (WTF::RemoveTemplate): Reveals the type for a template parameter. + +2010-01-20 Steve Falkenburg + + Reviewed by Darin Adler and Adam Roben. + + Feature defines are difficult to maintain on Windows builds + https://bugs.webkit.org/show_bug.cgi?id=33883 + + FeatureDefines.vsprops are now maintained in a way similar to + Configurations/FeatureDefines.xcconfig, with the added advantage + of having a single FeatureDefines file across all projects. + + * Configurations/FeatureDefines.xcconfig: Add comments about keeping feature definitions in sync. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add FeatureDefines.vsprops inherited property sheet. + * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add FeatureDefines.vsprops inherited property sheet. + +2010-01-20 Csaba Osztrogonác + + [Qt] Unreviewed buildfix for r53547. + + * DerivedSources.pro: + +2010-01-20 Tor Arne Vestbø + + Reviewed by Simon Hausmann. + + [Qt] Make extraCompilers for generated sources depend on their scripts + + * DerivedSources.pro: + +2010-01-19 Brian Weinstein + + Reviewed by Tim Hatcher. + + When JavaScriptCore calls Debugger::Exception, have it pass a + hasHandler variable that represents if exception is being handled + in the same function (not in a parent on the call stack). + + This just adds a new parameter, no behavior is changed. + + * debugger/Debugger.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::throwException): + +2010-01-18 Maciej Stachowiak + + Reviewed by Adam Barth. + + Inline functions that are hot in DOM manipulation + https://bugs.webkit.org/show_bug.cgi?id=33820 + + (3% speedup on Dromaeo DOM Core tests) + + * runtime/WeakGCMap.h: + (JSC::::get): inline + +2010-01-19 Laszlo Gombos + + Unreviewed build fix for JIT with RVCT. + + Remove IMPORT statement; cti_vm_throw is already defined in JITStubs.h. + Remove extra ')'. + + * jit/JITStubs.cpp: + (JSC::ctiVMThrowTrampoline): + +2010-01-19 Geoffrey Garen + + Reviewed by Oliver Hunt. + + REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/ + https://bugs.webkit.org/show_bug.cgi?id=33826 + + This bug was caused by a GC-protected object being destroyed early by + Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers + to GC-protected memory to be valid. + + The solution is to do two passes of tear-down in Heap::destroy. The first + pass tears down all unprotected objects. The second pass ASSERTs that all + previously protected objects are now unprotected, and then tears down + all perviously protected objects. These two passes simulate the two passes + that would have been required to free a protected object during normal GC. + + * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap. + + * runtime/Collector.cpp: + (JSC::Heap::destroy): Moved ASSERTs to here. + (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its + setter to the function that does the shrinking. + (JSC::Heap::freeBlocks): Implemented above algorithm. + (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink. + +2010-01-19 Gavin Barraclough + + Reviewed by NOBODY (build fix). + + Reverting r53455, breaks 2 javascriptcore tests. + + * API/JSContextRef.cpp: + * runtime/Collector.cpp: + (JSC::Heap::destroy): + (JSC::Heap::freeBlock): + (JSC::Heap::freeBlocks): + (JSC::Heap::shrinkBlocks): + +2010-01-18 Gavin Barraclough + + Reviewed by NOBODY (build fix). + + Revert r53454, since it causes much sadness in this world. + + * runtime/UString.cpp: + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::baseSharedBuffer): + (JSC::UStringImpl::sharedBuffer): + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): + (JSC::UntypedPtrAndBitfield::asPtr): + (JSC::UntypedPtrAndBitfield::operator&=): + (JSC::UntypedPtrAndBitfield::operator|=): + (JSC::UntypedPtrAndBitfield::operator&): + (JSC::UStringImpl::create): + (JSC::UStringImpl::cost): + (JSC::UStringImpl::isIdentifier): + (JSC::UStringImpl::setIsIdentifier): + (JSC::UStringImpl::ref): + (JSC::UStringImpl::deref): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::bufferOwnership): + (JSC::UStringImpl::isStatic): + * wtf/StringHashFunctions.h: + (WTF::stringHash): + +2010-01-18 Geoffrey Garen + + Reviewed by Oliver Hunt. + + REGRESSION (52082): Crash on worker thread when reloading http://radnan.public.iastate.edu/procedural/ + https://bugs.webkit.org/show_bug.cgi?id=33826 + + This bug was caused by a GC-protected object being destroyed early by + Heap::destroy. Clients of the GC protect APIs (reasonably) expect pointers + to GC-protected memory to be valid. + + The solution is to do two passes of tear-down in Heap::destroy. The first + pass tears down all unprotected objects. The second pass ASSERTs that all + previously protected objects are now unprotected, and then tears down + all perviously protected objects. These two passes simulate the two passes + that would have been required to free a protected object during normal GC. + + * API/JSContextRef.cpp: Removed some ASSERTs that have moved into Heap. + + * runtime/Collector.cpp: + (JSC::Heap::destroy): Moved ASSERTs to here. + (JSC::Heap::freeBlock): Tidied up the use of didShrink by moving its + setter to the function that does the shrinking. + (JSC::Heap::freeBlocks): Implemented above algorithm. + (JSC::Heap::shrinkBlocks): Tidied up the use of didShrink. + +2010-01-18 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags). + + This break the OS X Leaks tool. Instead, free up some more bits from the refCount. + + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::sharedBuffer): + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UStringImpl::cost): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::): + * wtf/StringHashFunctions.h: + (WTF::stringHash): + +2010-01-18 Kent Tamura + + Reviewed by Darin Adler. + + HTMLInputElement::valueAsDate setter support for type=month. + https://bugs.webkit.org/show_bug.cgi?id=33021 + + Expose the following functions to be used by WebCore: + - WTF::msToyear() + - WTF::dayInYear() + - WTF::monthFromDayInYear() + - WTF::dayInMonthFromDayInYear() + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/DateMath.cpp: + (WTF::msToYear): Remove "static inline". + (WTF::dayInYear): Remove "static inline". + (WTF::monthFromDayInYear): Remove "static inline". + (WTF::dayInMonthFromDayInYear): Remove "static inline". + * wtf/DateMath.h: Declare the above functions. + +2010-01-18 Darin Adler + + Fix build by reverting the previous change. + + * runtime/UString.h: Rolled out the FastAllocBase base class. + It was making UString larger, and therefore JSString larger, + and too big for a garbage collection cell. + + This raises the unpleasant possibility that many classes became + larger because we added the FastAllocBase base class. I am + worried about this, and it needs to be investigated. + +2010-01-18 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for UString class + https://bugs.webkit.org/show_bug.cgi?id=27831 + + Inherits the following class from FastAllocBase because it is + instantiated by 'new' and no need to be copyable: + + class name - instantiated at: + classs UString - JavaScriptCore/runtime/UString.cpp:160 + + * runtime/UString.h: + +2010-01-18 Evan Cheng + + Reviewed by Darin Adler. + + Add some ALWAYS_INLINE for key functions not inlined by some versions of GCC. + rdar://problem/7553780 + + * runtime/JSObject.h: + (JSC::JSObject::getPropertySlot): ALWAYS_INLINE both overloads. + * runtime/JSString.h: + (JSC::JSString::JSString): ALWAYS_INLINE the version that takes a UString. + * runtime/UString.h: + (JSC::operator==): ALWAYS_INLINE the version that compares two UString objects. + +2010-01-18 Csaba Osztrogonác + + Reviewed by Darin Adler. + + Delete dftables-xxxxxxxx.in files automatically. + https://bugs.webkit.org/show_bug.cgi?id=33796 + + * pcre/dftables: unlink unnecessary temporary file. + +2010-01-18 Tor Arne Vestbø + + Reviewed by Simon Hausmann. + + [Qt] Force qmake to generate a single makefile for DerivedSources.pro + + * DerivedSources.pro: + +2010-01-18 Csaba Osztrogonác + + Rubber-stamped by Gustavo Noronha Silva. + + Rolling out r53391 and r53392 because of random crashes on buildbots. + https://bugs.webkit.org/show_bug.cgi?id=33731 + + * bytecode/CodeBlock.h: + (JSC::CallLinkInfo::seenOnce): + (JSC::CallLinkInfo::setSeen): + (JSC::MethodCallLinkInfo::MethodCallLinkInfo): + (JSC::MethodCallLinkInfo::seenOnce): + (JSC::MethodCallLinkInfo::setSeen): + * jit/JIT.cpp: + (JSC::JIT::unlinkCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::patchMethodCallProto): + * runtime/UString.cpp: + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + * runtime/UString.h: + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::baseSharedBuffer): + (JSC::UStringImpl::sharedBuffer): + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): + (JSC::UntypedPtrAndBitfield::asPtr): + (JSC::UntypedPtrAndBitfield::operator&=): + (JSC::UntypedPtrAndBitfield::operator|=): + (JSC::UntypedPtrAndBitfield::operator&): + (JSC::UStringImpl::create): + (JSC::UStringImpl::cost): + (JSC::UStringImpl::isIdentifier): + (JSC::UStringImpl::setIsIdentifier): + (JSC::UStringImpl::ref): + (JSC::UStringImpl::deref): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::bufferOwnership): + (JSC::UStringImpl::isStatic): + * wtf/StringHashFunctions.h: + (WTF::stringHash): + +2010-01-18 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + Fix the build with strict gcc and RVCT versions: It's not legal to cast a + pointer to a function to a void* without an intermediate cast to a non-pointer + type. A cast to a ptrdiff_t inbetween fixes it. + + * runtime/JSString.h: + (JSC::Fiber::JSString): + +2010-01-15 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Remove UntypedPtrAndBitfield from UStringImpl (akin to PtrAndFlags). + + This break the OS X Leaks tool. Instead, free up some more bits from the refCount. + + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::sharedBuffer): + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UStringImpl::cost): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::): + * wtf/StringHashFunctions.h: + (WTF::stringHash): + +2010-01-15 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=33731 + Remove uses of PtrAndFlags from JIT data stuctures. + + These break the OS X Leaks tool. Free up a bit in CallLinkInfo, and invalid + permutation of pointer states in MethodCallLinkInfo to represent the removed bits. + + * bytecode/CodeBlock.h: + (JSC::CallLinkInfo::seenOnce): + (JSC::CallLinkInfo::setSeen): + (JSC::MethodCallLinkInfo::MethodCallLinkInfo): + (JSC::MethodCallLinkInfo::seenOnce): + (JSC::MethodCallLinkInfo::setSeen): + * jit/JIT.cpp: + (JSC::JIT::unlinkCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::patchMethodCallProto): + * runtime/UString.h: + +2010-01-16 Maciej Stachowiak + + Reviewed by Oliver Hunt. + + Cache JS string values made from DOM strings (Dromaeo speedup) + https://bugs.webkit.org/show_bug.cgi?id=33768 + + + * runtime/JSString.h: + (JSC::jsStringWithFinalizer): Added new mechanism for a string to have an optional + finalizer callback, for the benefit of weak-referencing caches. + (JSC::): + (JSC::Fiber::JSString): + (JSC::Fiber::~JSString): + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): Clear fibers so this doesn't look like a string with a finalizer. + * runtime/WeakGCMap.h: Include "Collector.h" to make this header includable by itself. + +2010-01-15 Sam Weinig + + Reviewed by Maciej Stachowiak. + + Fix for + Add ALWAYS_INLINE to jsLess for a 1% speedup on llvm-gcc. + + * runtime/Operations.h: + (JSC::jsLess): + +2010-01-14 Geoffrey Garen + + Reviewed by Oliver Hunt. + + REGRESISON: Google maps buttons not working properly + https://bugs.webkit.org/show_bug.cgi?id=31871 + + REGRESSION(r52948): JavaScript exceptions thrown on Google Maps when + getting directions for a second time + https://bugs.webkit.org/show_bug.cgi?id=33446 + + SunSpider and v8 report no change. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCacheGetByID): Update our cached offset in case + flattening the dictionary changed any of its offsets. + + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/Operations.h: + (JSC::normalizePrototypeChain): ditto + +2010-01-14 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=33705 + UStringImpl::create() should use internal storage + + When creating a UStringImpl copying of a UChar*, we can use an internal buffer, + by calling UStringImpl::tryCreateUninitialized(). + + Also, remove duplicate of copyChars from JSString, call UStringImpl's version. + + Small (max 0.5%) progression on Sunspidey. + + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + * runtime/UStringImpl.h: + (JSC::UStringImpl::create): + +2010-01-14 Gavin Barraclough + + Reviewed by Sam Weinig. + + Make naming & behaviour of UString[Impl] methods more consistent. + https://bugs.webkit.org/show_bug.cgi?id=33702 + + UString::create() creates a copy of the UChar* passed, but UStringImpl::create() assumes + that it should assume ownership of the provided buffer (with UString::createNonCopying() + and UStringImpl::createCopying() providing the alternate behaviours). Unify on create() + taking a copy of the provided buffer. For non-copying cases, use the name 'adopt', and + make this method take a Vector&. For cases where non-copying construction was being + used, other than from a Vector, change the code to allocate the storage along with + the UStringImpl using UStringImpl::createUninitialized(). (The adopt() method also more + closely matches that of WebCore::StringImpl). + + Also, UString::createUninitialized() and UStringImpl::createUninitialized() have incompatible + behaviours, in that the UString form sets the provided UChar* to a null or non-null value to + indicate success or failure, but UStringImpl uses the returned PassRefPtr to + indicate when allocation has failed (potentially leaving the output Char* uninitialized). + This is also incompatible with WebCore::StringImpl's behaviour, in that + StringImpl::createUninitialized() will CRASH() if unable to allocate. Some uses of + createUninitialized() in JSC are unsafe, since they do not test the result for null. + UStringImpl's indication is preferable, since we may want a successful call to set the result + buffer to 0 (specifically, StringImpl returns 0 for the buffer where createUninitialized() + returns the empty string, which seems reasonable to catch bugs early). UString's method + cannot support UStringImpl's behaviour directly, since it returns an object rather than a + pointer. + - remove UString::createUninitialized(), replace with calls to UStringImpl::createUninitialized() + - create a UStringImpl::tryCreateUninitialized() form UStringImpl::createUninitialized(), + with current behaviour, make createUninitialized() crash on failure to allocate. + - make cases in JSC that do not check the result call createUninitialized(), and cases that do + check call tryCreateUninitialized(). + + Rename computedHash() to existingHash(), to bring this in line wih WebCore::StringImpl. + + * API/JSClassRef.cpp: + (OpaqueJSClassContextData::OpaqueJSClassContextData): + * JavaScriptCore.exp: + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + * runtime/Identifier.cpp: + (JSC::CStringTranslator::translate): + (JSC::UCharBufferTranslator::translate): + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + * runtime/Lookup.cpp: + (JSC::HashTable::createTable): + * runtime/Lookup.h: + (JSC::HashTable::entry): + * runtime/StringBuilder.h: + (JSC::StringBuilder::release): + * runtime/StringConstructor.cpp: + (JSC::stringFromCharCodeSlowCase): + * runtime/StringPrototype.cpp: + (JSC::substituteBackreferencesSlow): + (JSC::stringProtoFuncToLowerCase): + (JSC::stringProtoFuncToUpperCase): + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncLink): + * runtime/Structure.cpp: + (JSC::Structure::despecifyDictionaryFunction): + (JSC::Structure::get): + (JSC::Structure::despecifyFunction): + (JSC::Structure::put): + (JSC::Structure::remove): + (JSC::Structure::insertIntoPropertyMapHashTable): + (JSC::Structure::checkConsistency): + * runtime/Structure.h: + (JSC::Structure::get): + * runtime/StructureTransitionTable.h: + (JSC::StructureTransitionTableHash::hash): + * runtime/UString.cpp: + (JSC::createRep): + (JSC::UString::UString): + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + (JSC::UString::operator=): + * runtime/UString.h: + (JSC::UString::adopt): + (JSC::IdentifierRepHash::hash): + (JSC::makeString): + * runtime/UStringImpl.h: + (JSC::UStringImpl::adopt): + (JSC::UStringImpl::create): + (JSC::UStringImpl::createUninitialized): + (JSC::UStringImpl::tryCreateUninitialized): + (JSC::UStringImpl::existingHash): + +2010-01-13 Kent Hansen + + Reviewed by Oliver Hunt. + + JSON.stringify and JSON.parse needlessly process properties in the prototype chain + https://bugs.webkit.org/show_bug.cgi?id=33053 + + * runtime/JSONObject.cpp: + (JSC::Stringifier::Holder::appendNextProperty): + (JSC::Walker::walk): + +2010-01-13 Gavin Barraclough + + Reviewed by NOBODY (buildfix). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-13 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=33641 + Assertion failure in Lexer.cpp if input stream ends while in string escape + + Test: fast/js/end-in-string-escape.html + + * parser/Lexer.cpp: (JSC::Lexer::lex): Bail out quickly on end of stream, not giving the + assertion a chance to fire. + +2010-01-13 Gavin Barraclough + + Reviewed by NOBODY (buildfix). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-13 Gavin Barraclough + + Rubber stamped by Sam Weinig & Darin Adler. + + Three quick fixes to UStringImpl. + - The destroy() method can be switched back to a normal destructor; since we've switched + the way we protect static strings to be using an odd ref-count the destroy() won't abort. + - The cost() calculation logic was wrong. If you have multiple JSStrings wrapping substrings + of a base string, they would each report the full cost of the base string to the heap. + Instead we should only be reporting once for the base string. + - Remove the overloaded new operator calling fastMalloc, replace this with a 'using' to pick + up the implementation from the parent class. + + * JavaScriptCore.exp: + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::~UStringImpl): + * runtime/UStringImpl.h: + (JSC::UStringImpl::cost): + (JSC::UStringImpl::deref): + +2010-01-13 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Split the build process in two different .pro files. + This allows qmake to be run once all source files are available. + + * DerivedSources.pro: Added. + * JavaScriptCore.pri: Moved source generation to DerivedSources.pro + * pcre/pcre.pri: Moved source generation to DerivedSources.pro + +2010-01-12 Kent Hansen + + Reviewed by Geoffrey Garen. + + [ES5] Implement Object.getOwnPropertyNames + https://bugs.webkit.org/show_bug.cgi?id=32242 + + Add an extra argument to getPropertyNames() and getOwnPropertyNames() + (and all reimplementations thereof) that indicates whether non-enumerable + properties should be added. + + * API/JSCallbackObject.h: + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertyNames): + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::getOwnPropertyNames): + * debugger/DebuggerActivation.h: + * runtime/Arguments.cpp: + (JSC::Arguments::getOwnPropertyNames): + * runtime/Arguments.h: + * runtime/CommonIdentifiers.h: + * runtime/JSArray.cpp: + (JSC::JSArray::getOwnPropertyNames): + * runtime/JSArray.h: + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::getOwnPropertyNames): + * runtime/JSByteArray.h: + * runtime/JSFunction.cpp: + (JSC::JSFunction::getOwnPropertyNames): + * runtime/JSFunction.h: + * runtime/JSNotAnObject.cpp: + (JSC::JSNotAnObject::getOwnPropertyNames): + * runtime/JSNotAnObject.h: + * runtime/JSObject.cpp: + (JSC::getClassPropertyNames): + (JSC::JSObject::getPropertyNames): + (JSC::JSObject::getOwnPropertyNames): + * runtime/JSObject.h: + * runtime/JSVariableObject.cpp: + (JSC::JSVariableObject::getOwnPropertyNames): + * runtime/JSVariableObject.h: + * runtime/ObjectConstructor.cpp: + (JSC::ObjectConstructor::ObjectConstructor): + (JSC::objectConstructorGetOwnPropertyNames): + * runtime/RegExpMatchesArray.h: + (JSC::RegExpMatchesArray::getOwnPropertyNames): + * runtime/StringObject.cpp: + (JSC::StringObject::getOwnPropertyNames): + * runtime/StringObject.h: + * runtime/Structure.cpp: Rename getEnumerablePropertyNames() to getPropertyNames(), which takes an extra argument. + (JSC::Structure::getPropertyNames): + * runtime/Structure.h: + (JSC::): + +2010-01-12 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=33540 + Make it possible to build in debug mode with assertions disabled + + * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): + * runtime/Identifier.cpp: (JSC::Identifier::checkSameIdentifierTable): + * wtf/FastMalloc.cpp: + * wtf/HashTable.h: (WTF::HashTableConstIterator::checkValidity): + * yarr/RegexCompiler.cpp: (JSC::Yarr::compileRegex): + +2009-11-23 Yong Li + + Reviewed by Adam Treat. + + Make GIF decoder support down-sampling + https://bugs.webkit.org/show_bug.cgi?id=31806 + + * platform/image-decoders/ImageDecoder.cpp: + (WebCore::ImageDecoder::upperBoundScaledY): + (WebCore::ImageDecoder::lowerBoundScaledY): + * platform/image-decoders/ImageDecoder.h: + (WebCore::RGBA32Buffer::scaledRect): + (WebCore::RGBA32Buffer::setScaledRect): + (WebCore::ImageDecoder::scaledSize): + * platform/image-decoders/gif/GIFImageDecoder.cpp: + (WebCore::GIFImageDecoder::sizeNowAvailable): + (WebCore::GIFImageDecoder::initFrameBuffer): + (WebCore::copyOnePixel): + (WebCore::GIFImageDecoder::haveDecodedRow): + (WebCore::GIFImageDecoder::frameComplete): + +2010-01-12 Adam Barth + + Reviewed by Eric Seidel. + + ecma/Date/15.9.5.12-1.js fails every night at midnight + https://bugs.webkit.org/show_bug.cgi?id=28041 + + Change the test to use a concrete time instead of "now". + + * tests/mozilla/ecma/Date/15.9.5.10-1.js: + * tests/mozilla/ecma/Date/15.9.5.12-1.js: + +2010-01-11 Csaba Osztrogonác + + Reviewed by Ariya Hidayat. + + [Qt] Enable JIT and YARR_JIT if (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) + + * wtf/Platform.h: + +2010-01-11 Geoffrey Garen + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=33481 + Uninitialized data members in ArrayStorage + + SunSpider reports no change. + + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): Initialize missing data members in the two cases + where we don't use fastZeroedMalloc, so it doesn't happen automatically. + +2010-01-11 Steve Falkenburg + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=33480 + + Improve debugging reliability for WTF on Windows. + Store WTF static library's PDB file into a better location. + + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + +2010-01-11 Steve Falkenburg + + Windows build fix. + Remove extraneous entries from def file causing build warning. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-10 Kent Hansen + + Reviewed by Darin Adler. + + RegExp.prototype.toString returns "//" for empty regular expressions + https://bugs.webkit.org/show_bug.cgi?id=33319 + + "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA. + + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncToString): + + * tests/mozilla/ecma_2/RegExp/properties-001.js: + (AddRegExpCases): + * tests/mozilla/js1_2/regexp/toString.js: + Update relevant Mozilla tests (Mozilla has had this behavior since November 2003). + +2010-01-10 Darin Adler + + * tests/mozilla/ecma/Array/15.4.1.1.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.1.2.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.2.1-1.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.2.2-1.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.2.2-2.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.2.3.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.3.2.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.3.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.4.1.js: Added property allow-tabs. + * tests/mozilla/ecma/Array/15.4.4.js: Added property allow-tabs. + * tests/mozilla/ecma/LexicalConventions/7.7.4.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.13.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.16.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.18.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.2.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.4.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.5.js: Added property allow-tabs. + * tests/mozilla/ecma/Math/15.8.2.7.js: Added property allow-tabs. + * tests/mozilla/ecma/String/15.5.1.js: Added property allow-tabs. + * tests/mozilla/ecma/String/15.5.2.js: Added property allow-tabs. + * tests/mozilla/ecma/String/15.5.3.1-3.js: Added property allow-tabs. + * tests/mozilla/ecma/String/15.5.3.1-4.js: Added property allow-tabs. + * tests/mozilla/ecma/String/15.5.3.js: Added property allow-tabs. + * tests/mozilla/ecma/TypeConversion/9.5-2.js: Added property allow-tabs. + * tests/mozilla/ecma/jsref.js: Modified property allow-tabs. + * tests/mozilla/ecma/shell.js: Modified property allow-tabs. + * tests/mozilla/ecma_2/LexicalConventions/keywords-001.js: Added property allow-tabs. + * tests/mozilla/ecma_2/RegExp/exec-001.js: Added property allow-tabs. + * tests/mozilla/ecma_2/String/match-004.js: Added property allow-tabs. + * tests/mozilla/ecma_2/String/replace-001.js: Added property allow-tabs. + * tests/mozilla/ecma_2/String/split-002.js: Added property allow-tabs. + * tests/mozilla/ecma_2/jsref.js: Modified property allow-tabs. + * tests/mozilla/ecma_2/shell.js: Added property allow-tabs. + * tests/mozilla/ecma_3/Date/shell.js: Modified property allow-tabs. + * tests/mozilla/ecma_3/Exceptions/regress-181654.js: Added property allow-tabs. + * tests/mozilla/ecma_3/RegExp/regress-209067.js: Added property allow-tabs. + * tests/mozilla/ecma_3/RegExp/regress-85721.js: Added property allow-tabs. + * tests/mozilla/importList.html: Added property allow-tabs. + * tests/mozilla/js1_1/shell.js: Added property allow-tabs. + * tests/mozilla/js1_2/Array/general1.js: Added property allow-tabs. + * tests/mozilla/js1_2/Array/general2.js: Added property allow-tabs. + * tests/mozilla/js1_2/Array/slice.js: Added property allow-tabs. + * tests/mozilla/js1_2/Array/splice1.js: Added property allow-tabs. + * tests/mozilla/js1_2/Array/splice2.js: Added property allow-tabs. + * tests/mozilla/js1_2/Objects/toString-001.js: Added property allow-tabs. + * tests/mozilla/js1_2/String/charCodeAt.js: Added property allow-tabs. + * tests/mozilla/js1_2/String/concat.js: Modified property allow-tabs. + * tests/mozilla/js1_2/String/match.js: Added property allow-tabs. + * tests/mozilla/js1_2/String/slice.js: Added property allow-tabs. + * tests/mozilla/js1_2/function/Function_object.js: Added property allow-tabs. + * tests/mozilla/js1_2/function/Number.js: Modified property allow-tabs. + * tests/mozilla/js1_2/function/String.js: Modified property allow-tabs. + * tests/mozilla/js1_2/function/nesting.js: Added property allow-tabs. + * tests/mozilla/js1_2/function/regexparg-1.js: Added property allow-tabs. + * tests/mozilla/js1_2/function/regexparg-2-n.js: Added property allow-tabs. + * tests/mozilla/js1_2/jsref.js: Added property allow-tabs. + * tests/mozilla/js1_2/operator/equality.js: Added property allow-tabs. + * tests/mozilla/js1_2/operator/strictEquality.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_dollar_number.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_input.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_input_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_lastIndex.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_lastMatch.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_lastMatch_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_lastParen.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_lastParen_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_leftContext.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_leftContext_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_multiline.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_multiline_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_object.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_rightContext.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/RegExp_rightContext_as_array.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/alphanumeric.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/asterisk.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/backslash.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/backspace.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/beginLine.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/character_class.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/compile.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/control_characters.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/digit.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/dot.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/endLine.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/everything.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/exec.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/flags.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/global.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/hexadecimal.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/ignoreCase.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/interval.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/octal.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/parentheses.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/plus.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/question_mark.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/simple_form.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/source.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/special_characters.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/string_replace.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/string_search.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/string_split.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/test.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/toString.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/vertical_bar.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/whitespace.js: Added property allow-tabs. + * tests/mozilla/js1_2/regexp/word_boundary.js: Added property allow-tabs. + * tests/mozilla/js1_2/shell.js: Added property allow-tabs. + * tests/mozilla/js1_2/statements/break.js: Added property allow-tabs. + * tests/mozilla/js1_2/statements/continue.js: Added property allow-tabs. + * tests/mozilla/js1_2/statements/do_while.js: Added property allow-tabs. + * tests/mozilla/js1_2/statements/switch.js: Added property allow-tabs. + * tests/mozilla/js1_2/statements/switch2.js: Added property allow-tabs. + * tests/mozilla/js1_3/shell.js: Added property allow-tabs. + * tests/mozilla/js1_4/shell.js: Added property allow-tabs. + * tests/mozilla/js1_5/Regress/regress-111557.js: Added property allow-tabs. + * tests/mozilla/js1_5/Regress/regress-216320.js: Added property allow-tabs. + * tests/mozilla/menuhead.html: Added property allow-tabs. + * tests/mozilla/mklistpage.pl: Added property allow-tabs. + * tests/mozilla/runtests.pl: Added property allow-tabs. + +2010-01-08 Daniel Bates + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=33417 + + Cleans up style errors exposed by the patch for bug #33198. + Moreover, fixes all "Weird number of spaces at line-start. Are you using a 4-space indent?" + errors reported by check-webkit-style. + + No functionality was changed. So, no new tests. + + * wtf/Platform.h: + +2010-01-08 Kent Hansen + + Reviewed by Eric Seidel. + + Don't store RegExp flags string representation + https://bugs.webkit.org/show_bug.cgi?id=33321 + + It's unused; the string representation is reconstructed from flags. + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + * runtime/RegExp.h: + +2010-01-08 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Memory use grows grows possibly unbounded in this JavaScript Array test case + https://bugs.webkit.org/show_bug.cgi?id=31675 + + This fixes one observed bug in this test case, which is that + arrays don't report extra cost for the sparse value maps. + + SunSpider reports a small speedup. + + * runtime/JSArray.cpp: + (JSC::JSArray::putSlowCase): Report extra memory cost for + the sparse value map. + * runtime/JSArray.h: + +2010-01-08 Yong Li + + Reviewed by Darin Adler. + + Remove unnecessary #include from FastMalloc.cpp + https://bugs.webkit.org/show_bug.cgi?id=33393 + + * wtf/FastMalloc.cpp: + +2010-01-08 Eric Seidel + + No review, rolling out r52983. + http://trac.webkit.org/changeset/52983 + https://bugs.webkit.org/show_bug.cgi?id=33321 + + Broke 59 JavaScriptCore tests. I don't think Kent knew about + run-javascriptcore-tests. Sadly neither does the commit-bot, + yet. + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + * runtime/RegExp.h: + (JSC::RegExp::flags): + +2010-01-08 Eric Seidel + + No review, rolling out r52981. + http://trac.webkit.org/changeset/52981 + https://bugs.webkit.org/show_bug.cgi?id=33319 + + Caused two JS tests to start failing: + ecma_2/RegExp/properties-001.js and js1_2/regexp/toString.js + + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncToString): + +2010-01-08 Kent Hansen + + Reviewed by Darin Adler. + + Don't store RegExp flags string representation + https://bugs.webkit.org/show_bug.cgi?id=33321 + + It's unused; the string representation is reconstructed from flags. + + * runtime/RegExp.cpp: + (JSC::RegExp::RegExp): + * runtime/RegExp.h: + +2010-01-08 Kent Hansen + + Reviewed by Darin Adler. + + RegExp.prototype.toString returns "//" for empty regular expressions + https://bugs.webkit.org/show_bug.cgi?id=33319 + + "//" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA. + + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncToString): + +2010-01-08 Norbert Leser + + Reviewed by Darin Adler. + + RVCT compiler with "-Otime -O3" optimization tries to optimize out + inline new'ed pointers that are passed as arguments. + Proposed patch assigns new'ed pointer explicitly outside function call. + + https://bugs.webkit.org/show_bug.cgi?id=33084 + + * API/JSClassRef.cpp: + (OpaqueJSClass::OpaqueJSClass): + (OpaqueJSClassContextData::OpaqueJSClassContextData): + +2010-01-08 Gabor Loki + + Reviewed by Gavin Barraclough. + + Remove an unnecessary cacheFlush from ARM_TRADITIONAL JIT + https://bugs.webkit.org/show_bug.cgi?id=33203 + + * assembler/ARMAssembler.cpp: Remove obsolete linkBranch function. + (JSC::ARMAssembler::executableCopy): Inline a clean linkBranch code. + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::getLdrImmAddress): Use inline function. + (JSC::ARMAssembler::getLdrImmAddressOnPool): Ditto. + (JSC::ARMAssembler::patchPointerInternal): Remove an unnecessary cacheFlush. + (JSC::ARMAssembler::linkJump): Use patchPointerInternal instead of linkBranch. + (JSC::ARMAssembler::linkCall): Ditto. + (JSC::ARMAssembler::relinkCall): Ditto. + +2010-01-07 Gabor Loki + + Reviewed by Gavin Barraclough. + + Build fix for JSVALUE32 when ENABLE_JIT_OPTIMIZE* are disabled + https://bugs.webkit.org/show_bug.cgi?id=33311 + + Move compileGetDirectOffset function to common part of JSVALUE32 + + * jit/JITPropertyAccess.cpp: + (JSC::JIT::compileGetDirectOffset): + +2010-01-07 Laszlo Gombos + + Reviewed by Maciej Stachowiak. + + Allow call sites to determine if ASSERT_* and LOG_* macros are operational + https://bugs.webkit.org/show_bug.cgi?id=33020 + + * wtf/Assertions.h: Set ASSERT_MSG_DISABLED, FATAL_DISABLED, + ERROR_DISABLED, LOG_DISABLED to 1 if the compiler does not support + variadic macros. Refactor for better readibility. + +2010-01-07 Daniel Bates + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=32987 + + Added ENABLE_XHTMLMP flag. Disabled by default. + + * Configurations/FeatureDefines.xcconfig: + +2010-01-07 Laszlo Gombos + + Reviewed by Gavin Barraclough. + + [Symbian] Port ARM traditional JIT Trampolines to RVCT + https://bugs.webkit.org/show_bug.cgi?id=30552 + + Take the GCC implementation and mechanically convert + it to RVCT syntax. + + Use 'bx rX' instead of 'mov pc, rX' when it is available. + + Developed in cooperation with Iain Campbell and Gabor Loki. + + * JavaScriptCore.pri: Extra step to generate RVCT stubs. The + script generation intentionally executed all the time not just + for RVCT targets. + + * create_rvct_stubs: Added. Perl script to expand precompiler macros + for RVCT assembler - the template is defined in JITStubs.cpp. + + * jit/JITStubs.cpp: + (JSC::ctiTrampoline): + (JSC::ctiVMThrowTrampoline): + (JSC::ctiOpThrowNotCaught): + +2010-01-07 Geoffrey Garen + + Reviewed by Sam Weinig. + + Fix a crash seen on the buildbots. + + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::init): Disable specific function tracking here, + instead of in WebCore, to ensure that the disabling happens before a + specific function can be registered. + +2010-01-07 Alexey Proskuryakov + + Mac build fix. + + * JavaScriptCore.exp: Export new JSGlobalData static data members. + +2010-01-07 Alexey Proskuryakov + + Reviewed by Geoffrey Garen. + + https://bugs.webkit.org/show_bug.cgi?id=33057 + REGRESSION(r49365): typeof(xhr.responseText) != "string" in Windows + + REGRESSION: WebKit fails to start PeaceKeeper benchmark + + Test: fast/js/webcore-string-comparison.html + + In r49365, some code was moved from JSString.cpp to JSString.h, and as a result, WebCore + got a way to directly instantiate JSStrings over DLL borders. Since vftable for JSString was + not exported, objects created from WebCore got a different vptr, and JavaScriptCore + optimizations that relied on vptr of all JSString objects being equal failed. + + * config.h: Added a JS_EXPORTCLASS macro for exporting classes. It's currently the same as + JS_EXPORTDATA, but it clearly needed a new name. + + * runtime/InitializeThreading.cpp: + (JSC::initializeThreadingOnce): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::storeVPtrs): + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::createNonDefault): + (JSC::JSGlobalData::create): + (JSC::JSGlobalData::sharedInstance): + * runtime/JSGlobalData.h: + Store vptrs just once, no need to repeatedly pick and copy them. This makes it possible to + assert vptr correctness in object destructors (which don't have access to JSGlobalData, + and even Heap::heap(this) will fail for fake objects created from storeVPtrs()). + + * runtime/JSArray.cpp: (JSC::JSArray::~JSArray): Assert that vptr is what we expect it to be. + It's important to assert in destructor, because MSVC changes the vptr after constructor + is invoked. + * runtime/JSByteArray.cpp: (JSC::JSByteArray::~JSByteArray): Ditto. + * runtime/JSByteArray.h: Ditto. + * runtime/JSFunction.h: Ditto. + * runtime/JSFunction.cpp: (JSC::JSFunction::~JSFunction): Ditto. + + * runtime/JSCell.h: (JSC::JSCell::setVPtr): Added a method to substitute vptr for another + one. + + * runtime/JSString.h: Export JSString class together with its vftable, and tell other + libraries tp import it. This is needed on platforms that have a separate JavaScriptCore + dynamic library - and on Mac, we already did the export via JavaScriptCore.exp. + (JSC::JSString::~JSString): Assert tha vptr is what we expect it to be. + (JSC::fixupVPtr): Store a previously saved primary vftable pointer (do nothing if building + JavaScriptCore itself). + (JSC::jsSingleCharacterString): Call fixupVPtr in case this is call across DLL boundary. + (JSC::jsSingleCharacterSubstring): Ditto. + (JSC::jsNontrivialString): Ditto. + (JSC::jsString): Ditto. + (JSC::jsSubstring): Ditto. + (JSC::jsOwnedString): Ditto. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export the new static + JSGlobalData members that are used in WebCore via inline functions. + +2010-01-07 Geoffrey Garen + + Reviewed by Sam Weinig. + + Safari memory usage skyrockets using new Google AdWords interface + https://bugs.webkit.org/show_bug.cgi?id=33343 + + The memory use was caused by the global object creating too many structures + as it thrashed between different specific functions. + + * runtime/Structure.cpp: + (JSC::Structure::Structure): + (JSC::Structure::addPropertyTransition): + (JSC::Structure::changePrototypeTransition): + (JSC::Structure::despecifyFunctionTransition): + (JSC::Structure::addAnonymousSlotsTransition): + (JSC::Structure::getterSetterTransition): + (JSC::Structure::toDictionaryTransition): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::despecifyAllFunctions): + * runtime/Structure.h: + (JSC::Structure::disableSpecificFunctionTracking): Track a thrash count + for specific functions. Disable specific function tracking once the + thrash count has been hit. + +2010-01-07 Csaba Osztrogonác + + Reviewed by Simon Hausmann. + + [Qt] Enable JIT in debug mode on win32 after r51141 fixed the crashes. + + * JavaScriptCore.pri: + +2010-01-07 Zoltan Horvath + + Reviewed by Holger Freyther. + + [Mac] Build fix when FAST_MALLOC_MATCH_VALIDATION=1 + https://bugs.webkit.org/show_bug.cgi?id=33312 + + Using of operator += cause compile error on Mac, so it is changed to + "= static_cast(old_ptr) + 1". + + * wtf/FastMalloc.cpp: + (WTF::TCMallocStats::realloc): + +2010-01-07 Zoltan Horvath + + Reviewed by Holger Freyther. + + [Qt] Build fix when FAST_MALLOC_MATCH_VALIDATION=1 + https://bugs.webkit.org/show_bug.cgi?id=33312 + + Remove pByte (committed in r42344 from #20422), because pByte doesn't + exist and it is unnecessary. + + * wtf/FastMalloc.cpp: + (WTF::TCMallocStats::realloc): + +2010-01-06 Gavin Barraclough + + QT build fix. + + * runtime/Identifier.cpp: + (JSC::createIdentifierTableSpecific): + +2010-01-06 Gavin Barraclough + + Windows build fix part I. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2010-01-06 Dan Bernstein + + Build fix + + * runtime/Identifier.cpp: + (JSC::createIdentifierTableSpecificCallback): + +2010-01-05 Gavin Barraclough + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=33236 + Remove m_identifierTable pointer from UString + + Currently every string holds a pointer so that during destruction, + if a string has been used as an identifier, it can remove itself + from the table. By instead accessing the identifierTable via a + thread specific tracking the table associated with the current + globaldata, we can save the memory cost of this pointer. + + * API/APIShims.h: + (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): + (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): + (JSC::APICallbackShim::APICallbackShim): + (JSC::APICallbackShim::~APICallbackShim): + + - change the API shims to track the identifierTable of the current JSGlobalData. + + * API/JSContextRef.cpp: + (JSContextGroupCreate): + + - update creation of JSGlobalData for API usage to use new create method. + - fix shim instanciation bug in JSGlobalContextCreateInGroup. + + * JavaScriptCore.exp: + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + + - add asserts to check the identifierTable is being tracked correctly. + + * runtime/Identifier.cpp: + (JSC::IdentifierTable::~IdentifierTable): + (JSC::IdentifierTable::add): + (JSC::Identifier::remove): + (JSC::Identifier::checkSameIdentifierTable): + (JSC::createIdentifierTableSpecificCallback): + (JSC::createIdentifierTableSpecific): + (JSC::createDefaultDataSpecific): + + - Use currentIdentifierTable() instead of UStringImpl::m_identifierTable. + - Define methods to access the thread specific identifier tables. + + * runtime/Identifier.h: + (JSC::ThreadIdentifierTableData::ThreadIdentifierTableData): + (JSC::defaultIdentifierTable): + (JSC::setDefaultIdentifierTable): + (JSC::currentIdentifierTable): + (JSC::setCurrentIdentifierTable): + (JSC::resetCurrentIdentifierTable): + + - Declare methods to access the thread specific identifier tables. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::createNonDefault): + (JSC::JSGlobalData::create): + (JSC::JSGlobalData::sharedInstance): + + - creation of JSGlobalData objects, other than for API usage, associate themselves with the current thread. + + * runtime/JSGlobalData.h: + * runtime/UStringImpl.cpp: + (JSC::UStringImpl::destroy): + + - destroy() method should be using isIdentifier(). + + * runtime/UStringImpl.h: + (JSC::UStringImpl::isIdentifier): + (JSC::UStringImpl::setIsIdentifier): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::UStringImpl): + + - replace m_identifierTable with a single m_isIdentifier bit. + + * wtf/StringHashFunctions.h: + (WTF::stringHash): + + - change string hash result from 32-bit to 31-bit, to free a bit in UStringImpl for m_isIdentifier. + +2009-12-25 Patrick Gansterer + + Reviewed by Eric Seidel. + + Buildfix for WinCE + style fixes. + https://bugs.webkit.org/show_bug.cgi?id=32939 + + * jsc.cpp: + (functionPrint): + (functionQuit): + (parseArguments): + (fillBufferWithContentsOfFile): + +2010-01-05 Patrick Gansterer + + Reviewed by Eric Seidel. + + WinCE buildfix after r52791 (renamed PLATFORM(WINCE) to OS(WINCE)). + https://bugs.webkit.org/show_bug.cgi?id=33205 + + * jit/ExecutableAllocator.h: + +2010-01-05 Patrick Gansterer + + Reviewed by Darin Adler. + + Added compiler error for unsupported platforms. + https://bugs.webkit.org/show_bug.cgi?id=33112 + + * jit/JITStubs.cpp: + +2010-01-05 Gabor Loki + + Reviewed by Maciej Stachowiak. + + Follow r52729 in ARMAssembler. + https://bugs.webkit.org/show_bug.cgi?id=33208 + + Use WTF_ARM_ARCH_AT_LEAST instead of ARM_ARCH_VERSION + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::encodeComplexImm): Move tmp declaration to ARMv7 + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::): + (JSC::ARMAssembler::bkpt): + +2010-01-05 Maciej Stachowiak + + Unreviewed build fix for Gtk+ + + Don't use // comments in Platform.h, at least some of them seem to make the version of GCC + used on the Gtk buildbot unhappy. + + * wtf/Platform.h: + +2010-01-04 Maciej Stachowiak + + Reviewed by Darin Fisher. + + Reorganize, document and rename OS() platform macros. + https://bugs.webkit.org/show_bug.cgi?id=33198 + + * wtf/Platform.h: Rename, reorganize and document OS() macros. + + Adapt to name changes. Also fixed a few incorrect OS checks. + + * API/JSContextRef.cpp: + * assembler/MacroAssemblerARM.cpp: + (JSC::isVFPPresent): + * assembler/MacroAssemblerX86Common.h: + * bytecode/SamplingTool.cpp: + * config.h: + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + * interpreter/RegisterFile.h: + (JSC::RegisterFile::RegisterFile): + (JSC::RegisterFile::grow): + * jit/ExecutableAllocator.h: + * jit/ExecutableAllocatorFixedVMPool.cpp: + * jit/ExecutableAllocatorPosix.cpp: + * jit/ExecutableAllocatorSymbian.cpp: + * jit/ExecutableAllocatorWin.cpp: + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITStubs.cpp: + * jsc.cpp: + (main): + * parser/Grammar.y: + * profiler/ProfileNode.cpp: + (JSC::getCount): + * runtime/Collector.cpp: + (JSC::Heap::Heap): + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlockPtr): + (JSC::currentThreadStackBase): + (JSC::getCurrentPlatformThread): + (JSC::suspendThread): + (JSC::resumeThread): + (JSC::getPlatformThreadRegisters): + (JSC::otherThreadStackPointer): + * runtime/Collector.h: + * runtime/DateConstructor.cpp: + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + * runtime/InitializeThreading.cpp: + (JSC::initializeThreading): + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackPosix.cpp: + * runtime/MarkStackSymbian.cpp: + * runtime/MarkStackWin.cpp: + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncLastIndexOf): + * runtime/TimeoutChecker.cpp: + (JSC::getCPUTime): + * runtime/UString.cpp: + (JSC::UString::from): + * wtf/Assertions.cpp: + * wtf/Assertions.h: + * wtf/CurrentTime.cpp: + (WTF::lowResUTCTime): + * wtf/CurrentTime.h: + (WTF::getLocalTime): + * wtf/DateMath.cpp: + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_ThreadCache::InitModule): + (WTF::TCMallocStats::): + * wtf/FastMalloc.h: + * wtf/MathExtras.h: + * wtf/RandomNumber.cpp: + (WTF::randomNumber): + * wtf/RandomNumberSeed.h: + (WTF::initializeRandomNumberGenerator): + * wtf/StringExtras.h: + * wtf/TCSpinLock.h: + (TCMalloc_SpinLock::Unlock): + (TCMalloc_SlowLock): + * wtf/TCSystemAlloc.cpp: + * wtf/ThreadSpecific.h: + (WTF::::destroy): + * wtf/Threading.h: + * wtf/ThreadingPthreads.cpp: + (WTF::initializeThreading): + (WTF::isMainThread): + * wtf/ThreadingWin.cpp: + (WTF::wtfThreadEntryPoint): + (WTF::createThreadInternal): + * wtf/VMTags.h: + * wtf/unicode/icu/CollatorICU.cpp: + (WTF::Collator::userDefault): + * wtf/win/MainThreadWin.cpp: + (WTF::initializeMainThreadPlatform): + +2010-01-04 Gustavo Noronha Silva + + Add missing files to the build system - make distcheck build fix. + + * GNUmakefile.am: + +2010-01-04 Gavin Barraclough + + Reviewed by Sam Weinig, additional coding by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=33163 + Add string hashing functions to WTF. + Use WTF's string hashing functions from UStringImpl. + + * GNUmakefile.am: + * JavaScriptCore.exp: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/UStringImpl.cpp: + * runtime/UStringImpl.h: + (JSC::UStringImpl::computeHash): + * wtf/HashFunctions.h: + * wtf/StringHashFunctions.h: Added. + (WTF::stringHash): + +2010-01-04 Dmitry Titov + + Not reviewed, attempt to fix ARM bulid. + + * wtf/Platform.h: + +2010-01-04 Gavin Barraclough + + Rubber stamped by Geoff Garen. + + Add an 'isIdentifier' to UStringImpl, use this where appropriate + (where previously 'identifierTable' was being tested). + + * API/JSClassRef.cpp: + (OpaqueJSClass::~OpaqueJSClass): + (OpaqueJSClassContextData::OpaqueJSClassContextData): + * runtime/Identifier.cpp: + (JSC::Identifier::addSlowCase): + * runtime/Identifier.h: + (JSC::Identifier::add): + * runtime/PropertyNameArray.cpp: + (JSC::PropertyNameArray::add): + * runtime/UStringImpl.h: + (JSC::UStringImpl::isIdentifier): + +2010-01-04 Gavin Barraclough + + Reviewed by Sam "Shimmey Shimmey" Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=33158 + Refactor JSC API entry/exit to use RAII instead of copy/pasting code. + Make it easier to change set of actions taken when passing across the API boundary. + + * API/APIShims.h: Added. + (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): + (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): + (JSC::APIEntryShim::APIEntryShim): + (JSC::APICallbackShim::APICallbackShim): + (JSC::APICallbackShim::~APICallbackShim): + * API/JSBase.cpp: + (JSEvaluateScript): + (JSCheckScriptSyntax): + (JSGarbageCollect): + (JSReportExtraMemoryCost): + * API/JSCallbackConstructor.cpp: + (JSC::constructJSCallback): + * API/JSCallbackFunction.cpp: + (JSC::JSCallbackFunction::call): + * API/JSCallbackObjectFunctions.h: + (JSC::::init): + (JSC::::getOwnPropertySlot): + (JSC::::put): + (JSC::::deleteProperty): + (JSC::::construct): + (JSC::::hasInstance): + (JSC::::call): + (JSC::::getOwnPropertyNames): + (JSC::::toNumber): + (JSC::::toString): + (JSC::::staticValueGetter): + (JSC::::callbackGetter): + * API/JSContextRef.cpp: + * API/JSObjectRef.cpp: + (JSObjectMake): + (JSObjectMakeFunctionWithCallback): + (JSObjectMakeConstructor): + (JSObjectMakeFunction): + (JSObjectMakeArray): + (JSObjectMakeDate): + (JSObjectMakeError): + (JSObjectMakeRegExp): + (JSObjectGetPrototype): + (JSObjectSetPrototype): + (JSObjectHasProperty): + (JSObjectGetProperty): + (JSObjectSetProperty): + (JSObjectGetPropertyAtIndex): + (JSObjectSetPropertyAtIndex): + (JSObjectDeleteProperty): + (JSObjectCallAsFunction): + (JSObjectCallAsConstructor): + (JSObjectCopyPropertyNames): + (JSPropertyNameArrayRelease): + (JSPropertyNameAccumulatorAddName): + * API/JSValueRef.cpp: + (JSValueGetType): + (JSValueIsUndefined): + (JSValueIsNull): + (JSValueIsBoolean): + (JSValueIsNumber): + (JSValueIsString): + (JSValueIsObject): + (JSValueIsObjectOfClass): + (JSValueIsEqual): + (JSValueIsStrictEqual): + (JSValueIsInstanceOfConstructor): + (JSValueMakeUndefined): + (JSValueMakeNull): + (JSValueMakeBoolean): + (JSValueMakeNumber): + (JSValueMakeString): + (JSValueToBoolean): + (JSValueToNumber): + (JSValueToStringCopy): + (JSValueToObject): + (JSValueProtect): + (JSValueUnprotect): + * JavaScriptCore.xcodeproj/project.pbxproj: + +2010-01-04 Dan Bernstein + + Reviewed by Ada Chan and Mark Rowe. + + Updated copyright string + + * Info.plist: + * JavaScriptCore.vcproj/JavaScriptCore.resources/Info.plist: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: + +2010-01-04 Adam Roben + + No review, rolling out r52741. + http://trac.webkit.org/changeset/52741 + https://bugs.webkit.org/show_bug.cgi?id=33056 + + * wtf/AlwaysInline.h: + +2010-01-04 Patrick Gansterer + + Reviewed by Darin Adler. + + Add cacheFlush support for WinCE + https://bugs.webkit.org/show_bug.cgi?id=33110 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2010-01-04 Patrick Gansterer + + Reviewed by Adam Roben. + + Implement NO_RETURN for COMPILER(MSVC). + https://bugs.webkit.org/show_bug.cgi?id=33056 + + * wtf/AlwaysInline.h: + +2010-01-04 Maciej Stachowiak + + Reviewed by Simon Hausmann. + + Fix some PLATFORM(*_ENDIAN) uses to CPU() + https://bugs.webkit.org/show_bug.cgi?id=33148 + + * runtime/JSCell.cpp: + (JSC::): + * runtime/JSValue.h: + (JSC::JSValue::): + +2010-01-04 Maciej Stachowiak + + Reviewed by Adam Barth. + + Document CPU() macros in comments. + https://bugs.webkit.org/show_bug.cgi?id=33147 + + * wtf/Platform.h: + +2010-01-04 Maciej Stachowiak + + Reviewed by Adam Barth. + + Reorganize, document and rename CPU() platform macros. + https://bugs.webkit.org/show_bug.cgi?id=33145 + ExecutableAllocatorSymbian appears to have buggy ARM version check + https://bugs.webkit.org/show_bug.cgi?id=33138 + + * wtf/Platform.h: + Rename all macros related to detection of particular CPUs or + classes of CPUs to CPU(), reorganize and document them. + + All remaining changes are adapting to the renames, plus fixing the + second bug cited above. + + * assembler/ARMAssembler.cpp: + * assembler/ARMAssembler.h: + * assembler/ARMv7Assembler.h: + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::Imm32::Imm32): + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.cpp: + * assembler/MacroAssemblerARM.h: + * assembler/MacroAssemblerCodeRef.h: + (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): + * assembler/MacroAssemblerX86.h: + * assembler/MacroAssemblerX86Common.h: + * assembler/MacroAssemblerX86_64.h: + * assembler/X86Assembler.h: + (JSC::X86Registers::): + (JSC::X86Assembler::): + (JSC::X86Assembler::movl_mEAX): + (JSC::X86Assembler::movl_EAXm): + (JSC::X86Assembler::repatchLoadPtrToLEA): + (JSC::X86Assembler::X86InstructionFormatter::memoryModRM): + * jit/ExecutableAllocator.h: + * jit/ExecutableAllocatorFixedVMPool.cpp: + * jit/ExecutableAllocatorPosix.cpp: + * jit/ExecutableAllocatorSymbian.cpp: + (JSC::ExecutableAllocator::intializePageSize): + * jit/JIT.cpp: + * jit/JIT.h: + * jit/JITArithmetic.cpp: + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::restoreArgumentReferenceForTrampoline): + (JSC::JIT::emitCount): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompileGetByIdProto): + (JSC::JIT::privateCompileGetByIdProtoList): + (JSC::JIT::privateCompileGetByIdChainList): + (JSC::JIT::privateCompileGetByIdChain): + * jit/JITStubs.cpp: + (JSC::JITThunks::JITThunks): + * jit/JITStubs.h: + * runtime/Collector.cpp: + (JSC::currentThreadStackBase): + (JSC::getPlatformThreadRegisters): + (JSC::otherThreadStackPointer): + * wrec/WREC.h: + * wrec/WRECGenerator.cpp: + (JSC::WREC::Generator::generateEnter): + (JSC::WREC::Generator::generateReturnSuccess): + (JSC::WREC::Generator::generateReturnFailure): + * wrec/WRECGenerator.h: + * wtf/FastMalloc.cpp: + * wtf/TCSpinLock.h: + (TCMalloc_SpinLock::Lock): + (TCMalloc_SpinLock::Unlock): + (TCMalloc_SlowLock): + * wtf/Threading.h: + * wtf/dtoa.cpp: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): + (JSC::Yarr::RegexGenerator::generateReturn): + * yarr/RegexJIT.h: + +2010-01-04 Maciej Stachowiak + + Reviewed by Adam Barth. + + Clean up COMPILER macros and remove unused ones. + https://bugs.webkit.org/show_bug.cgi?id=33132 + + Removed values are COMPILER(BORLAND) and COMPILER(CYGWIN) - they were + not used anywhere. + + * wtf/Platform.h: + +2010-01-03 Maciej Stachowiak + + Reviewed by Eric Seidel. + + Update wtf/Platform.h to document the new system for porting macros. + https://bugs.webkit.org/show_bug.cgi?id=33130 + + * wtf/Platform.h: + +2009-12-29 Laszlo Gombos + + Reviewed by Maciej Stachowiak. + + PLATFORM(CAIRO) should be defined by WIN_CAIRO define + https://bugs.webkit.org/show_bug.cgi?id=22250 + + * wtf/Platform.h: Define WTF_PLATFORM_CAIRO for GTK port only + For the WinCairo port WTF_PLATFORM_CAIRO is already defined in config.h + +2009-12-28 Shu Chang + + Reviewed by Laszlo Gombos. + + [Qt] Delete ThreadPrivate instance after it is finished. + https://bugs.webkit.org/show_bug.cgi?id=32614 + + * wtf/qt/ThreadingQt.cpp: + (WTF::ThreadMonitor::instance): + (WTF::ThreadMonitor::threadFinished): + (WTF::createThreadInternal): + (WTF::detachThread): + +2009-12-28 Patrick Gansterer + + Reviewed by Maciej Stachowiak. + + Cleanup of #define JS_EXPORT. + + * API/JSBase.h: + +2009-12-27 Patrick Gansterer + + Reviewed by Adam Barth. + + WinCE buildfix (HWND_MESSAGE isn't supported there) + + * wtf/win/MainThreadWin.cpp: + (WTF::initializeMainThreadPlatform): + +2009-12-27 Patrick Gansterer + + Reviewed by Adam Barth. + + Added a file with WinMain function to link agains in WinCE. + + * os-win32/WinMain.cpp: Added. + (convertToUtf8): + (WinMain): + +2009-12-24 Laszlo Gombos + + Unreviewed; revert of r52550. + + The change regressed the following LayoutTests for QtWebKit. + + fast/workers/worker-call.html -> crashed + fast/workers/worker-close.html -> crashed + + * wtf/qt/ThreadingQt.cpp: + (WTF::waitForThreadCompletion): + (WTF::detachThread): + +2009-12-24 Shu Chang + + Reviewed by Laszlo Gombos. + + [Qt] Fix memory leak by deleting instance of ThreadPrivate + in function waitForThreadCompletion(), synchronously, or in + detachThread(), asynchronously. + https://bugs.webkit.org/show_bug.cgi?id=32614 + + * wtf/qt/ThreadingQt.cpp: + (WTF::waitForThreadCompletion): + (WTF::detachThread): + +2009-12-23 Kwang Yul Seo + + Reviewed by Laszlo Gombos. + + Include stddef.h for ptrdiff_t + https://bugs.webkit.org/show_bug.cgi?id=32891 + + ptrdiff_t is typedef-ed in stddef.h. + Include stddef.h in jit/ExecutableAllocator.h. + + * jit/ExecutableAllocator.h: + +2009-12-23 Patrick Gansterer + + Reviewed by Eric Seidel. + + Buildfix after r47092. + + * wtf/wince/MemoryManager.cpp: + (WTF::tryFastMalloc): + (WTF::tryFastZeroedMalloc): + (WTF::tryFastCalloc): + (WTF::tryFastRealloc): + +2009-12-23 Kent Tamura + + Reviewed by Darin Adler. + + HTMLInputElement::valueAsDate getter support. + https://bugs.webkit.org/show_bug.cgi?id=32876 + + Expose dateToDaysFrom1970(). + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/DateMath.cpp: + (WTF::dateToDaysFrom1970): + * wtf/DateMath.h: + +2009-12-22 Darin Adler + + Reviewed by Mark Rowe. + + Turn off datagrid by default, at least for all platforms Apple ships. + The datagrid implementation isn't ready for general web use yet. + + * Configurations/FeatureDefines.xcconfig: Turn off datagrid by default. + +2009-12-22 Steve Block + + Reviewed by David Levin. + + Updates Android's scheduleDispatchFunctionsOnMainThread() to use new + AndroidThreading class, rather than using JavaSharedClient directly. + This fixes the current layering violation. + https://bugs.webkit.org/show_bug.cgi?id=32651 + + The pattern is copied from Chromium, which uses the ChromiumThreading + class. This patch also fixes the style in ChromiumThreading.h. + + * wtf/android/AndroidThreading.h: Added. Declares AndroidThreading. + * wtf/android/MainThreadAndroid.cpp: Modified + (WTF::scheduleDispatchFunctionsOnMainThread): Uses AndroidThreading. + * wtf/chromium/ChromiumThreading.h: Modified. Fixes style. + +2009-12-22 Gavin Barraclough + + Reviewed by Sam Weinig. + + Fix a couple of problems with UntypedPtrAndBitfield. + + Add a m_leaksPtr to reduce false positives from leaks in debug builds + (this isn't perfect because we'd like a solution for release builds, + but this is now at least as good as a PtrAndFlags would be). + + Switch SmallStringsto use a regular string for the base, rather than + a static one. UntypedPtrAndBitfield assumes all strings are at least + 8 byte aligned; this migt not be true of static strings. Shared buffers + are heap allocated, as are all UStringImpls other than static strings. + Static strings cannot end up being the owner string of substrings, + since the only static strings are length 0. + + * runtime/SmallStrings.cpp: + (JSC::SmallStringsStorage::SmallStringsStorage): + * runtime/UStringImpl.h: + (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): + (JSC::UStringImpl::UStringImpl): + +2009-12-22 Kwang Yul Seo + + Reviewed by Darin Adler. + + RVCT (__ARMCC_VERSION < 400000) does not provide strcasecmp and strncasecmp + https://bugs.webkit.org/show_bug.cgi?id=32857 + + Add implementation of strcasecmp and strncasecmp for RVCT < 4.0 + because earlier versions of RVCT 4.0 does not provide these functions. + + * wtf/StringExtras.cpp: Added. + (strcasecmp): + (strncasecmp): + * wtf/StringExtras.h: + +2009-12-22 Kwang Yul Seo + + Reviewed by Darin Adler. + + Define ALWAYS_INLINE and WTF_PRIVATE_INLINE to __forceinline for RVCT + https://bugs.webkit.org/show_bug.cgi?id=32853 + + Use __forceinline forces RVCT to compile a C or C++ function + inline. The compiler attempts to inline the function, regardless of + the characteristics of the function. + + * wtf/AlwaysInline.h: + * wtf/FastMalloc.h: + +2009-12-21 Simon Hausmann + + Prospective GTK build fix: Add UStringImpl.cpp/h to the build. + + * GNUmakefile.am: + +2009-12-21 Simon Hausmann + + Fix the Qt build, add UStringImpl.cpp to the build. + + * JavaScriptCore.pri: + +2009-12-21 Gavin Barraclough + + Windows Build fix part 5. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + +2009-12-21 Gavin Barraclough + + Reviewed by NOBODY (build fix). + Fix breakage of world introduced in build fix to r52463. + + * runtime/UStringImpl.h: + +2009-12-21 Gavin Barraclough + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=32831 + Replace UString::Rep implementation, following introduction of ropes to JSC. + + * Remove redundant overcapacity mechanisms. + * Reduce memory cost of Rep's. + * Add an inline storage mechanism akin to that in WebCore's StringImpl. + + ~1% Sunspider progression. + + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + * runtime/SmallStrings.cpp: + (JSC::SmallStringsStorage::SmallStringsStorage): + * runtime/UString.cpp: + (JSC::initializeUString): + (JSC::createRep): + (JSC::UString::createFromUTF8): + (JSC::UString::createUninitialized): + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + (JSC::UString::ascii): + (JSC::UString::operator=): + (JSC::UString::toStrictUInt32): + (JSC::equal): + * runtime/UString.h: + (JSC::UString::isEmpty): + (JSC::UString::cost): + (JSC::makeString): + * runtime/UStringImpl.cpp: Added. + (JSC::UStringImpl::baseSharedBuffer): + (JSC::UStringImpl::sharedBuffer): + (JSC::UStringImpl::destroy): + (JSC::UStringImpl::computeHash): + * runtime/UStringImpl.h: Added. + (JSC::UntypedPtrAndBitfield::UntypedPtrAndBitfield): + (JSC::UntypedPtrAndBitfield::asPtr): + (JSC::UntypedPtrAndBitfield::operator&=): + (JSC::UntypedPtrAndBitfield::operator|=): + (JSC::UntypedPtrAndBitfield::operator&): + (JSC::UStringImpl::create): + (JSC::UStringImpl::createCopying): + (JSC::UStringImpl::createUninitialized): + (JSC::UStringImpl::data): + (JSC::UStringImpl::size): + (JSC::UStringImpl::cost): + (JSC::UStringImpl::hash): + (JSC::UStringImpl::computedHash): + (JSC::UStringImpl::setHash): + (JSC::UStringImpl::identifierTable): + (JSC::UStringImpl::setIdentifierTable): + (JSC::UStringImpl::ref): + (JSC::UStringImpl::deref): + (JSC::UStringImpl::allocChars): + (JSC::UStringImpl::copyChars): + (JSC::UStringImpl::computeHash): + (JSC::UStringImpl::null): + (JSC::UStringImpl::empty): + (JSC::UStringImpl::checkConsistency): + (JSC::UStringImpl::): + (JSC::UStringImpl::UStringImpl): + (JSC::UStringImpl::operator new): + (JSC::UStringImpl::bufferOwnerString): + (JSC::UStringImpl::bufferOwnership): + (JSC::UStringImpl::isStatic): + +2009-12-18 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + Move some build decisions from Qt build system into source files + https://bugs.webkit.org/show_bug.cgi?id=31956 + + * JavaScriptCore.pri: Compile files unconditionally + * jit/ExecutableAllocatorPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN) + * jit/ExecutableAllocatorWin.cpp: Guard with PLATFORM(WIN_OS) + * runtime/MarkStackPosix.cpp: Guard with PLATFORM(UNIX) && !PLATFORM(SYMBIAN) + * runtime/MarkStackSymbian.cpp: Guard with PLATFORM(SYMBIAN) + * runtime/MarkStackWin.cpp: Guard with PLATFORM(WIN_OS) + * wtf/Platform.h: Guard ENABLE_JSC_MULTIPLE_THREADS with ENABLE_SINGLE_THREADED for the Qt port + * wtf/ThreadingNone.cpp: Guard with ENABLE(SINGLE_THREADED) + * wtf/qt/ThreadingQt.cpp: Guard with !ENABLE(SINGLE_THREADED) + +2009-12-18 Gavin Barraclough + + Reviewed by Sam Weinig. + + Add createNonCopying method to UString to make replace constructor passed bool, + to make behaviour more explicit. Add createFromUTF8 to UString (wrapping method + on UString::Rep), since other cases of transliteration (e.g. from ascii) are + performed in UString constructors. Add/use setHash & size() accessors on Rep, + rather than accessing _hash/len directly. + + * API/JSClassRef.cpp: + (OpaqueJSClass::OpaqueJSClass): + * API/OpaqueJSString.cpp: + (OpaqueJSString::ustring): + * JavaScriptCore.exp: + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + * runtime/Identifier.cpp: + (JSC::Identifier::equal): + (JSC::CStringTranslator::translate): + (JSC::UCharBufferTranslator::translate): + (JSC::Identifier::addSlowCase): + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + * runtime/JSString.h: + (JSC::JSString::Rope::Fiber::refAndGetLength): + (JSC::JSString::Rope::append): + * runtime/StringBuilder.h: + (JSC::StringBuilder::release): + * runtime/StringConstructor.cpp: + (JSC::stringFromCharCodeSlowCase): + * runtime/StringPrototype.cpp: + (JSC::substituteBackreferencesSlow): + (JSC::stringProtoFuncToLowerCase): + (JSC::stringProtoFuncToUpperCase): + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncLink): + * runtime/UString.cpp: + (JSC::UString::UString): + (JSC::UString::createNonCopying): + (JSC::UString::createFromUTF8): + * runtime/UString.h: + (JSC::UString::Rep::setHash): + (JSC::UString::~UString): + (JSC::makeString): + +2009-12-18 Geoffrey Garen + + Reviewed by Cameron Zwarich and Gavin Barraclough. + + Changed Register constructors to assignment operators, to streamline + moving values into registers. (In theory, there's no difference between + the two, since the constructor should just inline away, but there seems + to be a big difference in the addled mind of the GCC optimizer.) + + In the interpreter, this is a 3.5% SunSpider speedup and a 1K-2K + reduction in stack usage per privateExecute stack frame. + + * interpreter/CallFrame.h: + (JSC::ExecState::setCalleeArguments): + (JSC::ExecState::setCallerFrame): + (JSC::ExecState::setScopeChain): + (JSC::ExecState::init): + (JSC::ExecState::setArgumentCount): + (JSC::ExecState::setCallee): + (JSC::ExecState::setCodeBlock): Added a little bit of casting so these + functions could use the new Register assignment operators. + + * interpreter/Register.h: + (JSC::Register::withInt): + (JSC::Register::Register): + (JSC::Register::operator=): Swapped in assignment operators for constructors. + +2009-12-18 Yongjun Zhang + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=32713 + [Qt] make wtf/Assertions.h compile in winscw compiler. + + Add string arg before ellipsis to help winscw compiler resolve variadic + macro definitions in wtf/Assertions.h. + + * wtf/Assertions.h: + +2009-12-18 Geoffrey Garen + + Reviewed by Adam Roben. + + Fixed intermittent failure seen on Windows buildbot, and in other JSC + API clients. + + Added a WeakGCPtr class and changed OpaqueJSClass::cachedPrototype to + use it, to avoid vending a stale object as a prototype. + + * API/JSClassRef.cpp: + (OpaqueJSClassContextData::OpaqueJSClassContextData): + (OpaqueJSClass::prototype): + * API/JSClassRef.h: Use WeakGCPtr. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/WeakGCPtr.h: Added. + (JSC::WeakGCPtr::WeakGCPtr): + (JSC::WeakGCPtr::get): + (JSC::WeakGCPtr::clear): + (JSC::WeakGCPtr::operator*): + (JSC::WeakGCPtr::operator->): + (JSC::WeakGCPtr::operator!): + (JSC::WeakGCPtr::operator bool): + (JSC::WeakGCPtr::operator UnspecifiedBoolType): + (JSC::WeakGCPtr::assign): + (JSC::::operator): + (JSC::operator==): + (JSC::operator!=): + (JSC::static_pointer_cast): + (JSC::const_pointer_cast): + (JSC::getPtr): Added WeakGCPtr to the project. + +2009-12-18 Gavin Barraclough + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=32720 + + * JavaScriptCore.exp: + - Remove exports for UString::append + * JavaScriptCore.xcodeproj/project.pbxproj: + - Make StringBuilder a private header (was project). + +2009-12-18 Martin Robinson + + Reviewed by Gustavo Noronha Silva. + + [GTK] GRefPtr does not take a reference when assigned a raw pointer + https://bugs.webkit.org/show_bug.cgi?id=32709 + + Ensure that when assigning a raw pointer to a GRefPtr, the reference + count is incremented. Also remove the GRefPtr conversion overload as + GRefPtr types have necessarily incompatible reference counting. + + * wtf/gtk/GRefPtr.h: + (WTF::GRefPtr::operator=): + +2009-12-18 Simon Hausmann + + Reviewed by Tor Arne Vestbø. + + [Qt] Clean up the qmake build system to distinguish between trunk builds and package builds + + https://bugs.webkit.org/show_bug.cgi?id=32716 + + * pcre/pcre.pri: Use standalone_package instead of QTDIR_build + +2009-12-18 Martin Robinson + + Reviewed by Gustavo Noronha Silva. + + [GTK] Compile warning from line 29 of GRefPtr.cpp + https://bugs.webkit.org/show_bug.cgi?id=32703 + + Fix memory leak and compiler warning in GRefPtr GHashTable template + specialization. + + * wtf/gtk/GRefPtr.cpp: + (WTF::refGPtr): + +2009-12-17 Sam Weinig + + Reviewed by Mark Rowe. + + Add BUILDING_ON_SNOW_LEOPARD and TARGETING_SNOW_LEOPARD #defines. + + * wtf/Platform.h: + +2009-12-17 Adam Roben + + Sync JavaScriptCore.vcproj with JavaScriptCore.xcodeproj and the + source tree + + Fixes . + + Reviewed by Ada Chan. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Moved + around files and filters so that the structure matches + JavaScriptCore.xcodeproj and the source tree. A few headers that were + previously omitted have been added, as well as JSZombie.{cpp,h}. + +2009-12-17 Adam Roben + + Remove HeavyProfile and TreeProfile completely + + These were mostly removed in r42808, but the empty files were left in + place. + + Fixes . + + Reviewed by John Sullivan. + + * Android.mk: + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCoreSources.bkl: + Removed HeavyProfile/TreeProfile source files. + + * profiler/HeavyProfile.cpp: Removed. + * profiler/HeavyProfile.h: Removed. + * profiler/TreeProfile.cpp: Removed. + * profiler/TreeProfile.h: Removed. + +2009-12-17 Martin Robinson + + Reviewed by Gustavo Noronha Silva. + + [GTK] WebKit GTK needs a wrapper for ref counted glib/gobject structs + https://bugs.webkit.org/show_bug.cgi?id=21599 + + Implement GRefPtr, a smart pointer for reference counted GObject types. + + * GNUmakefile.am: + * wtf/gtk/GOwnPtr.cpp: + (WTF::GDir): + * wtf/gtk/GRefPtr.h: Added. + (WTF::): + (WTF::GRefPtr::GRefPtr): + (WTF::GRefPtr::~GRefPtr): + (WTF::GRefPtr::clear): + (WTF::GRefPtr::get): + (WTF::GRefPtr::operator*): + (WTF::GRefPtr::operator->): + (WTF::GRefPtr::operator!): + (WTF::GRefPtr::operator UnspecifiedBoolType): + (WTF::GRefPtr::hashTableDeletedValue): + (WTF::::operator): + (WTF::::swap): + (WTF::swap): + (WTF::operator==): + (WTF::operator!=): + (WTF::static_pointer_cast): + (WTF::const_pointer_cast): + (WTF::getPtr): + (WTF::adoptGRef): + (WTF::refGPtr): + (WTF::derefGPtr): + +2009-12-17 Gustavo Noronha Silva + + Unreviewed. Build fixes for make distcheck. + + * GNUmakefile.am: + +2009-12-16 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed Interpreter::privateExecute macro generates + bloated code + + This patch cuts Interpreter stack use by about a third. + + * bytecode/Opcode.h: Changed Opcode to const void* to work with the + const static initiliazation we want to do in Interpreter::privateExecute. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::Interpreter): Moved hashtable initialization here to + avoid polluting Interpreter::privateExecute's stack, and changed it from a + series of add() calls to one add() call in a loop, to cut down on code size. + + (JSC::Interpreter::privateExecute): Changed a series of label computations + to a copy of a compile-time constant array to cut down on code size. + +2009-12-16 Mark Rowe + + Build fix. Disable debug variants of WebKit frameworks. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-12-15 Geoffrey Garen + + Reviewed by Sam "r=me" Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=32498 + + REGRESSION(r51978-r52039): AJAX "Mark This Forum Read" function no longer + works + + Fixed a tyop. + + * runtime/Operations.h: + (JSC::jsAdd): Use the '&&' operator, not the ',' operator. + +2009-12-15 Geoffrey Garen + + Try to fix the windows build: don't export this inlined function. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-12-15 Geoffrey Garen + + Reviewed by Beth Dakin. + + Inlined JSCell's operator new. + + 3.7% speedup on bench-allocate-nonretained.js. + + * JavaScriptCore.exp: + * runtime/JSCell.cpp: + * runtime/JSCell.h: + (JSC::JSCell::operator new): + +2009-12-15 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Removed the number heap, replacing it with a one-item free list for + numbers, taking advantage of the fact that two number cells fit inside + the space for one regular cell, and number cells don't require destruction. + + SunSpider says 1.6% faster in JSVALUE32 mode (the only mode that + heap-allocates numbers). + + SunSpider says 1.1% faster in JSVALUE32_64 mode. v8 says 0.8% faster + in JSVALUE32_64 mode. 10% speedup on bench-alloc-nonretained.js. 6% + speedup on bench-alloc-retained.js. + + There's a lot of formulaic change in this patch, but not much substance. + + * JavaScriptCore.exp: + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * runtime/Collector.cpp: + (JSC::Heap::Heap): + (JSC::Heap::destroy): + (JSC::Heap::allocateBlock): + (JSC::Heap::freeBlock): + (JSC::Heap::freeBlockPtr): + (JSC::Heap::freeBlocks): + (JSC::Heap::recordExtraCost): + (JSC::Heap::allocate): + (JSC::Heap::resizeBlocks): + (JSC::Heap::growBlocks): + (JSC::Heap::shrinkBlocks): + (JSC::Heap::markConservatively): + (JSC::Heap::clearMarkBits): + (JSC::Heap::markedCells): + (JSC::Heap::sweep): + (JSC::Heap::markRoots): + (JSC::Heap::objectCount): + (JSC::Heap::addToStatistics): + (JSC::Heap::statistics): + (JSC::Heap::isBusy): + (JSC::Heap::reset): + (JSC::Heap::collectAllGarbage): + (JSC::Heap::primaryHeapBegin): + (JSC::Heap::primaryHeapEnd): + * runtime/Collector.h: + (JSC::): Removed all code pertaining to the number heap, and changed all + heap template functions and classes to non-template functions and classes. + + (JSC::Heap::allocateNumber): A new optimization to replace the number + heap: allocate half-sized number cells in pairs, returning the first + cell and caching the second cell for the next allocation. + + * runtime/CollectorHeapIterator.h: + (JSC::LiveObjectIterator::LiveObjectIterator): + (JSC::LiveObjectIterator::operator++): + (JSC::DeadObjectIterator::DeadObjectIterator): + (JSC::DeadObjectIterator::operator++): + (JSC::ObjectIterator::ObjectIterator): + (JSC::ObjectIterator::operator++): + * runtime/JSCell.h: + (JSC::JSCell::isNumber): Removed all code pertaining to the number heap, + and changed all heap template functions and classes to non-template functions + and classes. + +2009-12-15 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for WeakGCMap class + https://bugs.webkit.org/show_bug.cgi?id=32547 + + Inherits WeakGCMap from FastAllocBase because it is instantiated by + 'new' at: WebCore/dom/Document.cpp:512. + + * runtime/WeakGCMap.h: + +2009-12-15 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for dtoa's P5Node struct + https://bugs.webkit.org/show_bug.cgi?id=32544 + + Inherits P5Node struct from Noncopyable because it is instantiated by + 'new' at wtf/dtoa.cpp:588 and don't need to be copyable. + + * wtf/dtoa.cpp: + +2009-12-14 Geoffrey Garen + + Reviewed by Simon Fraser. + + https://bugs.webkit.org/show_bug.cgi?id=32524 + REGRESSION(52084): fast/dom/prototypes.html failing two CSS tests + + * wtf/StdLibExtras.h: + (WTF::bitCount): The original patch put the parentheses in the wrong + place, completely changing the calculation and making it almost always + wrong. Moved the parentheses around the '+' operation, like the original + compiler warning suggested. + +2009-12-14 Gabor Loki + + Unreviewed trivial buildfix. + + Fix crosses initialization of usedPrimaryBlocks for JSValue32 + + * runtime/Collector.cpp: + (JSC::Heap::markConservatively): + +2009-12-14 Csaba Osztrogonác + + Reviewed by Simon Hausmann. + + GCC 4.3.x warning fixed. Suggested parantheses added. + warning: ../../../JavaScriptCore/wtf/StdLibExtras.h:77: warning: suggest parentheses around + or - in operand of & + + * wtf/StdLibExtras.h: + (WTF::bitCount): + +2009-12-13 Geoffrey Garen + + Reviewed by Sam Weinig. + + Changed GC from mark-sweep to mark-allocate. + + Added WeakGCMap to keep WebCore blissfully ignorant about objects that + have become garbage but haven't run their destructors yet. + + 1% SunSpider speedup. + 7.6% v8 speedup (37% splay speedup). + 17% speedup on bench-alloc-nonretained.js. + 18% speedup on bench-alloc-retained.js. + + * API/JSBase.cpp: + (JSGarbageCollect): + * API/JSContextRef.cpp: + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: Updated for renames and new + files. + + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): Updated to use the Collector + iterator abstraction. + + * jsc.cpp: + (functionGC): Updated for rename. + + * runtime/Collector.cpp: Slightly reduced the number of allocations per + collection, so that small workloads only allocate on collector block, + rather than two. + + (JSC::Heap::Heap): Updated to use the new allocateBlock function. + + (JSC::Heap::destroy): Updated to use the new freeBlocks function. + + (JSC::Heap::allocateBlock): New function to initialize a block when + allocating it. + + (JSC::Heap::freeBlock): Consolidated the responsibility for running + destructors into this function. + + (JSC::Heap::freeBlocks): Updated to use freeBlock. + + (JSC::Heap::recordExtraCost): Sweep the heap in this reporting function, + so that allocation, which is more common, doesn't have to check extraCost. + + (JSC::Heap::heapAllocate): Run destructors right before recycling a + garbage cell. This has better cache utilization than a separate sweep phase. + + (JSC::Heap::resizeBlocks): + (JSC::Heap::growBlocks): + (JSC::Heap::shrinkBlocks): New set of functions for managing the size of + the heap, now that the heap doesn't maintain any information about its + size. + + (JSC::isPointerAligned): + (JSC::isHalfCellAligned): + (JSC::isPossibleCell): + (JSC::isCellAligned): + (JSC::Heap::markConservatively): Cleaned up this code a bit. + + (JSC::Heap::clearMarkBits): + (JSC::Heap::markedCells): Some helper functions for examining the the mark + bitmap. + + (JSC::Heap::sweep): Simplified this function by using a DeadObjectIterator. + + (JSC::Heap::markRoots): Reordered some operations for clarity. + + (JSC::Heap::objectCount): + (JSC::Heap::addToStatistics): + (JSC::Heap::statistics): Rewrote these functions to calculate an object + count on demand, since the heap doesn't maintain this information by + itself. + + (JSC::Heap::reset): New function for resetting the heap once we've + exhausted heap space. + + (JSC::Heap::collectAllGarbage): This function matches the old collect() + behavior, but it's now an uncommon function used only by API. + + * runtime/Collector.h: + (JSC::CollectorBitmap::count): + (JSC::CollectorBitmap::isEmpty): Added some helper functions for managing + the collector mark bitmap. + + (JSC::Heap::reportExtraMemoryCost): Changed reporting from cell equivalents + to bytes, so it's easier to understand. + + * runtime/CollectorHeapIterator.h: + (JSC::CollectorHeapIterator::CollectorHeapIterator): + (JSC::CollectorHeapIterator::operator!=): + (JSC::CollectorHeapIterator::operator*): + (JSC::CollectorHeapIterator::advance): + (JSC::::LiveObjectIterator): + (JSC::::operator): + (JSC::::DeadObjectIterator): + (JSC::::ObjectIterator): New iterators for encapsulating details about + heap layout, and what's live and dead on the heap. + + * runtime/JSArray.cpp: + (JSC::JSArray::putSlowCase): + (JSC::JSArray::increaseVectorLength): Delay reporting extra cost until + we're fully constructed, so the heap mark phase won't visit us in an + invalid state. + + * runtime/JSCell.h: + (JSC::JSCell::): + (JSC::JSCell::createDummyStructure): + (JSC::JSCell::JSCell): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: Added a dummy cell to simplify allocation logic. + + * runtime/JSString.h: + (JSC::jsSubstring): Don't report extra cost for substrings, since they + share a buffer that's already reported extra cost. + + * runtime/Tracing.d: + * runtime/Tracing.h: Changed these dtrace hooks not to report object + counts, since they're no longer cheap to compute. + + * runtime/UString.h: Updated for renames. + + * runtime/WeakGCMap.h: Added. + (JSC::WeakGCMap::isEmpty): + (JSC::WeakGCMap::uncheckedGet): + (JSC::WeakGCMap::uncheckedBegin): + (JSC::WeakGCMap::uncheckedEnd): + (JSC::::get): + (JSC::::take): + (JSC::::set): + (JSC::::uncheckedRemove): Mentioned above. + + * wtf/StdLibExtras.h: + (WTF::bitCount): Added a bit population count function, so the heap can + count live objects to fulfill statistics questions. + +The very last cell in the block is not allocated -- should not be marked. + +2009-12-13 Geoffrey Garen + + Windows build fix: Export some new symbols. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-12-13 Geoffrey Garen + + Windows build fix: Removed some old exports. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-12-13 Geoffrey Garen + + Windows build fix: Use unsigned instead of uint32_t to avoid dependencies. + + * wtf/StdLibExtras.h: + (WTF::bitCount): + +2009-12-13 Gavin Barraclough + + Reviewed by NOBODY (speculative Windows build fix). + + * runtime/JSGlobalObjectFunctions.cpp: + +2009-12-13 Gavin Barraclough + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=32496 + Switch remaining cases of string construction to use StringBuilder. + Builds strings using a vector rather than using string append / addition. + + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/Executable.cpp: + (JSC::FunctionExecutable::paramString): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::encode): + (JSC::decode): + (JSC::globalFuncEscape): + (JSC::globalFuncUnescape): + * runtime/JSONObject.cpp: + (JSC::Stringifier::stringify): + (JSC::Stringifier::indent): + * runtime/JSString.h: + * runtime/LiteralParser.cpp: + (JSC::LiteralParser::Lexer::lexString): + * runtime/NumberPrototype.cpp: + (JSC::integerPartNoExp): + (JSC::numberProtoFuncToFixed): + (JSC::numberProtoFuncToPrecision): + * runtime/Operations.h: + (JSC::jsString): + * runtime/StringPrototype.cpp: + (JSC::substituteBackreferencesSlow): + (JSC::substituteBackreferences): + (JSC::stringProtoFuncConcat): + +2009-12-08 Jeremy Moskovich + + Reviewed by Eric Seidel. + + Add code to allow toggling ATSUI/Core Text rendering at runtime in ComplexTextController. + https://bugs.webkit.org/show_bug.cgi?id=31802 + + The goal here is to allow for a zero runtime hit for ports that decide to select + the API at compile time. + When both USE(ATSUI) and USE(CORE_TEXT) are true, the API is toggled + at runtime. Core Text is used for OS Versions >= 10.6. + + * wtf/Platform.h: #define USE_CORE_TEXT and USE_ATSUI on Chrome/Mac. + +2009-12-11 Maciej Stachowiak + + Reviewed by Oliver Hunt. + + Unify codegen for forward and backward variants of branches + https://bugs.webkit.org/show_bug.cgi?id=32463 + + * jit/JIT.h: + (JSC::JIT::emit_op_loop): Implemented in terms of forward variant. + (JSC::JIT::emit_op_loop_if_true): ditto + (JSC::JIT::emitSlow_op_loop_if_true): ditto + (JSC::JIT::emit_op_loop_if_false): ditto + (JSC::JIT::emitSlow_op_loop_if_false): ditto + (JSC::JIT::emit_op_loop_if_less): ditto + (JSC::JIT::emitSlow_op_loop_if_less): ditto + * jit/JITOpcodes.cpp: + +2009-12-11 Sam Weinig + + Reviewed by Anders Carlsson. + + Allow WTFs concept of the main thread to differ from pthreads when necessary. + + * wtf/ThreadingPthreads.cpp: + (WTF::initializeThreading): + (WTF::isMainThread): + * wtf/mac/MainThreadMac.mm: + (WTF::initializeMainThreadPlatform): + (WTF::scheduleDispatchFunctionsOnMainThread): + +2009-12-11 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32454 + Refactor construction of simple strings to avoid string concatenation. + + Building strings through concatenation has a memory and performance cost - + a memory cost since we must over-allocate the buffer to leave space to append + into, and performance in that the string may still require reallocation (and + thus copying during construction). Instead move the full construction to + within a single function call (makeString), so that the arguments' lengths + can be calculated and an appropriate sized buffer allocated before copying + any characters. + + ~No performance change (~2% progression on date tests). + + * bytecode/CodeBlock.cpp: + (JSC::escapeQuotes): + (JSC::valueToSourceString): + (JSC::constantName): + (JSC::idName): + (JSC::CodeBlock::registerName): + (JSC::regexpToSourceString): + (JSC::regexpName): + * bytecompiler/NodesCodegen.cpp: + (JSC::substitute): + * profiler/Profiler.cpp: + (JSC::Profiler::createCallIdentifier): + * runtime/DateConstructor.cpp: + (JSC::callDate): + * runtime/DateConversion.cpp: + (JSC::formatDate): + (JSC::formatDateUTCVariant): + (JSC::formatTime): + (JSC::formatTimeUTC): + * runtime/DateConversion.h: + (JSC::): + * runtime/DatePrototype.cpp: + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncToGMTString): + * runtime/ErrorPrototype.cpp: + (JSC::errorProtoFuncToString): + * runtime/ExceptionHelpers.cpp: + (JSC::createUndefinedVariableError): + (JSC::createErrorMessage): + (JSC::createInvalidParamError): + * runtime/FunctionPrototype.cpp: + (JSC::insertSemicolonIfNeeded): + (JSC::functionProtoFuncToString): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncToString): + * runtime/RegExpConstructor.cpp: + (JSC::constructRegExp): + * runtime/RegExpObject.cpp: + (JSC::RegExpObject::match): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncCompile): + (JSC::regExpProtoFuncToString): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncBig): + (JSC::stringProtoFuncSmall): + (JSC::stringProtoFuncBlink): + (JSC::stringProtoFuncBold): + (JSC::stringProtoFuncFixed): + (JSC::stringProtoFuncItalics): + (JSC::stringProtoFuncStrike): + (JSC::stringProtoFuncSub): + (JSC::stringProtoFuncSup): + (JSC::stringProtoFuncFontcolor): + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncAnchor): + * runtime/UString.h: + (JSC::): + (JSC::makeString): + +2009-12-10 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32400 + Switch remaining cases of string addition to use ropes. + + Re-landing r51975 - added toPrimitiveString method, + performs toPrimitive then subsequent toString operations. + + ~1% progression on Sunspidey. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSString.h: + (JSC::JSString::JSString): + (JSC::JSString::appendStringInConstruct): + * runtime/Operations.cpp: + (JSC::jsAddSlowCase): + * runtime/Operations.h: + (JSC::jsString): + (JSC::jsAdd): + +2009-12-11 Adam Roben + + Windows build fix + + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Added + $(WebKitOutputDir)/include/private to the include path. + +2009-12-11 Adam Roben + + Move QuartzCorePresent.h to include/private + + This fixes other projects that use wtf/Platform.h + + Rubber-stamped by Steve Falkenburg. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Let VS do its thang. + * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Write + QuartzCorePresent.h to $(WebKitOutputDir)/include/private. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + Added $(WebKitOutputDir)/include/private to the include path. + +2009-12-11 Adam Roben + + Fix clean builds and everything rebuilding on every build + + Reviewed by Sam Weinig. + + * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Don't + write out QuartzCorePresent.h if it exists but is older than + QuartzCore.h. Also, create the directory we write QuartzCorePresent.h + into first. + +2009-12-11 Adam Roben + + Windows build fix for systems with spaces in their paths + + * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Quote some paths. + +2009-12-11 Chris Marrin + + Reviewed by Adam Roben. + + Add check for presence of QuartzCore headers + https://bugs.webkit.org/show_bug.cgi?id=31856 + + The script now checks for the presence of QuartzCore.h. If present + it will turn on ACCELERATED_COMPOSITING and 3D_RENDERING to enable + HW compositing on Windows. The script writes QuartzCorePresent.h to + the build directory which has a define telling whether QuartzCore is + present. + + * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: + * wtf/Platform.h: + +2009-12-11 Kent Tamura + + Reviewed by Darin Adler. + + Fix a problem that JSC::gregorianDateTimeToMS() returns a negative + value for a huge year value. + https://bugs.webkit.org/show_bug.cgi?id=32304 + + * wtf/DateMath.cpp: + (WTF::dateToDaysFrom1970): Renamed from dateToDayInYear, and changed the return type to double. + (WTF::calculateDSTOffset): Follow the dateToDaysFrom1970() change. + (WTF::timeClip): Use maxECMAScriptTime. + (JSC::gregorianDateTimeToMS): Follow the dateToDaysFrom1970() change. + +2009-12-10 Adam Barth + + No review, rolling out r51975. + http://trac.webkit.org/changeset/51975 + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSString.h: + (JSC::JSString::JSString): + (JSC::JSString::appendStringInConstruct): + * runtime/Operations.cpp: + (JSC::jsAddSlowCase): + * runtime/Operations.h: + (JSC::jsString): + (JSC::jsAdd): + +2009-12-10 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Incorrect caching of prototype lookup with dictionary base + https://bugs.webkit.org/show_bug.cgi?id=32402 + + Make sure we don't add cached prototype lookup to the proto_list + lookup chain if the top level object is a dictionary. + + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCacheGetByID): + +2009-12-10 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32400 + Switch remaining cases of string addition to use ropes. + + ~1% progression on Sunspidey. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSString.h: + (JSC::JSString::JSString): + (JSC::JSString::appendStringInConstruct): + * runtime/Operations.cpp: + (JSC::jsAddSlowCase): + * runtime/Operations.h: + (JSC::jsString): + (JSC::jsAdd): + +2009-12-10 Kent Hansen + + Reviewed by Geoffrey Garen. + + Remove JSObject::getPropertyAttributes() and all usage of it. + https://bugs.webkit.org/show_bug.cgi?id=31933 + + getOwnPropertyDescriptor() should be used instead. + + * JavaScriptCore.exp: + * JavaScriptCore.order: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::getOwnPropertyDescriptor): + * debugger/DebuggerActivation.h: + * runtime/JSObject.cpp: + (JSC::JSObject::propertyIsEnumerable): + * runtime/JSObject.h: + * runtime/JSVariableObject.cpp: + * runtime/JSVariableObject.h: + +2009-12-10 Gavin Barraclough + + Reviewed by Oliver Hunt & Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=32367 + Add support for short Ropes (up to 3 entries) inline within JSString. + (rather than externally allocating an object to hold the rope). + Switch jsAdd of (JSString* + JSString*) to now make use of Ropes. + + ~1% progression on Sunspidey. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/JSString.cpp: + (JSC::JSString::resolveRope): + (JSC::JSString::toBoolean): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSC::JSString::Rope::Fiber::deref): + (JSC::JSString::Rope::Fiber::ref): + (JSC::JSString::Rope::Fiber::refAndGetLength): + (JSC::JSString::Rope::append): + (JSC::JSString::JSString): + (JSC::JSString::~JSString): + (JSC::JSString::value): + (JSC::JSString::tryGetValue): + (JSC::JSString::length): + (JSC::JSString::canGetIndex): + (JSC::JSString::appendStringInConstruct): + (JSC::JSString::appendValueInConstructAndIncrementLength): + (JSC::JSString::isRope): + (JSC::JSString::string): + (JSC::JSString::ropeLength): + (JSC::JSString::getStringPropertySlot): + * runtime/Operations.h: + (JSC::jsString): + (JSC::jsAdd): + (JSC::resolveBase): + +2009-12-09 Anders Carlsson + + Reviewed by Geoffrey Garen. + + Fix three more things found by compiling with clang++. + + * runtime/Structure.h: + (JSC::StructureTransitionTable::reifySingleTransition): + Add the 'std' qualifier to the call to make_pair. + + * wtf/DateMath.cpp: + (WTF::initializeDates): + Incrementing a bool is deprecated according to the C++ specification. + + * wtf/PtrAndFlags.h: + (WTF::PtrAndFlags::PtrAndFlags): + Name lookup should not be done in dependent bases, so explicitly qualify the call to set. + +2009-12-09 Maciej Stachowiak + + Reviewed by Oliver Hunt. + + Google reader gets stuck in the "Loading..." state and does not complete + https://bugs.webkit.org/show_bug.cgi?id=32256 + + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_jless): Fix some backward branches. + +2009-12-09 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32228 + Make destruction of ropes non-recursive to prevent stack exhaustion. + Also, pass a UString& into initializeFiber rather than a Ustring::Rep*, + since the Rep is not being ref counted this could result in usage of a + Rep with refcount zero (where the Rep comes from a temporary UString + returned from a function). + + * runtime/JSString.cpp: + (JSC::JSString::Rope::destructNonRecursive): + (JSC::JSString::Rope::~Rope): + * runtime/JSString.h: + (JSC::JSString::Rope::initializeFiber): + * runtime/Operations.h: + (JSC::concatenateStrings): + +2009-12-09 Zoltan Herczeg + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=31930 + + Update to r51457. ASSERTs changed to COMPILE_ASSERTs. + The speedup is 25%. + + * runtime/JSGlobalData.cpp: + (JSC::VPtrSet::VPtrSet): + +2009-12-09 Steve Block + + Reviewed by Adam Barth. + + Updates Android Makefiles with latest additions. + https://bugs.webkit.org/show_bug.cgi?id=32278 + + * Android.mk: Modified. + * Android.v8.wtf.mk: Modified. + +2009-12-09 Sam Weinig + + Reviewed by Gavin Barraclough. + + Fix a bug found while trying to compile JavaScriptCore with clang++. + + * yarr/RegexPattern.h: + (JSC::Yarr::PatternTerm::PatternTerm): Don't self assign here. Use false instead. + +2009-12-09 Anders Carlsson + + Reviewed by Sam Weinig. + + Attempt to fix the Windows build. + + * wtf/FastMalloc.h: + +2009-12-09 Anders Carlsson + + Reviewed by Sam Weinig. + + Fix some things found while trying to compile JavaScriptCore with clang++. + + * wtf/FastMalloc.h: + Add correct exception specifications for the allocation/deallocation operators. + + * wtf/Vector.h: + * wtf/VectorTraits.h: + Fix a bunch of struct/class mismatches. + +2009-12-08 Maciej Stachowiak + + Reviewed by Darin Adler. + + move code generation portions of Nodes.cpp to bytecompiler directory + https://bugs.webkit.org/show_bug.cgi?id=32284 + + * bytecompiler/NodesCodegen.cpp: Copied from parser/Nodes.cpp. Removed parts that + are not about codegen. + * parser/Nodes.cpp: Removed everything that is about codegen. + + Update build systems: + + * Android.mk: + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * JavaScriptCoreSources.bkl: + +2009-12-08 Kevin Watters + + Reviewed by Kevin Ollivier. + + [wx] Mac plugins support. + + https://bugs.webkit.org/show_bug.cgi?id=32236 + + * wtf/Platform.h: + +2009-12-08 Dmitry Titov + + Rubber-stamped by David Levin. + + Revert and reopen "Add asserts to RefCounted to make sure ref/deref happens on the right thread." + It may have caused massive increase of reported leaks on the bots. + https://bugs.webkit.org/show_bug.cgi?id=31639 + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/WTF/WTF.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/Structure.cpp: + (JSC::Structure::Structure): + * wtf/RefCounted.h: + (WTF::RefCountedBase::ref): + (WTF::RefCountedBase::hasOneRef): + (WTF::RefCountedBase::refCount): + (WTF::RefCountedBase::derefBase): + * wtf/ThreadVerifier.h: Removed. + +2009-12-08 Gustavo Noronha Silva + + Reviewed by Darin Adler. + + Make WebKit build correctly on FreeBSD, IA64, and Alpha. + Based on work by Petr Salinger , + and Colin Watson . + + * wtf/Platform.h: + +2009-12-08 Dmitry Titov + + Reviewed by Darin Adler. + + Add asserts to RefCounted to make sure ref/deref happens on the right thread. + https://bugs.webkit.org/show_bug.cgi?id=31639 + + * runtime/Structure.cpp: + (JSC::Structure::Structure): Disable thread verification on this class since it uses addressOfCount(). + * wtf/RefCounted.h: + (WTF::RefCountedBase::ref): Add ASSERT. + (WTF::RefCountedBase::hasOneRef): Ditto. + (WTF::RefCountedBase::refCount): Ditto. + (WTF::RefCountedBase::derefBase): Ditto. + (WTF::RefCountedBase::disableThreadVerification): delegate to ThreadVerifier method. + * wtf/ThreadVerifier.h: Added. + (WTF::ThreadVerifier::ThreadVerifier): New Debug-only class to verify that ref/deref of RefCounted is done on the same thread. + (WTF::ThreadVerifier::activate): Activates checks. Called when ref count becomes above 2. + (WTF::ThreadVerifier::deactivate): Deactivates checks. Called when ref count drops below 2. + (WTF::ThreadVerifier::disableThreadVerification): used on objects that should not be checked (StringImpl etc) + (WTF::ThreadVerifier::verifyThread): + * GNUmakefile.am: Add ThreadVerifier.h to the build file. + * JavaScriptCore.gypi: Ditto. + * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto. + * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. + +2009-12-08 Steve Block + + Reviewed by Adam Barth. + + [Android] Adds Makefiles for Android port. + https://bugs.webkit.org/show_bug.cgi?id=31325 + + * Android.mk: Added. + * Android.v8.wtf.mk: Added. + +2009-12-07 Dmitry Titov + + Rubber-stamped by Darin Adler. + + Remove ENABLE_SHARED_SCRIPT flags + https://bugs.webkit.org/show_bug.cgi?id=32245 + This patch was obtained by "git revert" command and then un-reverting of ChangeLog files. + + * Configurations/FeatureDefines.xcconfig: + * wtf/Platform.h: + +2009-12-07 Gavin Barraclough + + Reviewed by NOBODY (Windows build fixage part I). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-12-05 Gavin Barraclough + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32184 + Handle out-of-memory conditions with JSC Ropes with a JS exception, rather than crashing. + Switch from using fastMalloc to tryFastMalloc, pass an ExecState to record the exception on. + + * API/JSCallbackObjectFunctions.h: + (JSC::::toString): + * API/JSValueRef.cpp: + (JSValueIsStrictEqual): + * JavaScriptCore.exp: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitEqualityOp): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::functionName): + (JSC::DebuggerCallFrame::calculatedFunctionName): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + (JSC::Interpreter::privateExecute): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * profiler/ProfileGenerator.cpp: + (JSC::ProfileGenerator::addParentForConsoleStart): + * profiler/Profiler.cpp: + (JSC::Profiler::willExecute): + (JSC::Profiler::didExecute): + (JSC::Profiler::createCallIdentifier): + (JSC::createCallIdentifierFromFunctionImp): + * profiler/Profiler.h: + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncIndexOf): + (JSC::arrayProtoFuncLastIndexOf): + * runtime/DateConstructor.cpp: + (JSC::constructDate): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/InternalFunction.cpp: + (JSC::InternalFunction::name): + (JSC::InternalFunction::displayName): + (JSC::InternalFunction::calculatedDisplayName): + * runtime/InternalFunction.h: + * runtime/JSCell.cpp: + (JSC::JSCell::getString): + * runtime/JSCell.h: + (JSC::JSValue::getString): + * runtime/JSONObject.cpp: + (JSC::gap): + (JSC::Stringifier::Stringifier): + (JSC::Stringifier::appendStringifiedValue): + * runtime/JSObject.cpp: + (JSC::JSObject::putDirectFunction): + (JSC::JSObject::putDirectFunctionWithoutTransition): + (JSC::JSObject::defineOwnProperty): + * runtime/JSObject.h: + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::get): + * runtime/JSString.cpp: + (JSC::JSString::Rope::~Rope): + (JSC::JSString::resolveRope): + (JSC::JSString::getPrimitiveNumber): + (JSC::JSString::toNumber): + (JSC::JSString::toString): + (JSC::JSString::toThisString): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSC::JSString::Rope::createOrNull): + (JSC::JSString::Rope::operator new): + (JSC::JSString::value): + (JSC::JSString::tryGetValue): + (JSC::JSString::getIndex): + (JSC::JSString::getStringPropertySlot): + (JSC::JSValue::toString): + * runtime/JSValue.h: + * runtime/NativeErrorConstructor.cpp: + (JSC::NativeErrorConstructor::NativeErrorConstructor): + * runtime/Operations.cpp: + (JSC::JSValue::strictEqualSlowCase): + * runtime/Operations.h: + (JSC::JSValue::equalSlowCaseInline): + (JSC::JSValue::strictEqualSlowCaseInline): + (JSC::JSValue::strictEqual): + (JSC::jsLess): + (JSC::jsLessEq): + (JSC::jsAdd): + (JSC::concatenateStrings): + * runtime/PropertyDescriptor.cpp: + (JSC::PropertyDescriptor::equalTo): + * runtime/PropertyDescriptor.h: + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncToLowerCase): + (JSC::stringProtoFuncToUpperCase): + +2009-12-07 Nikolas Zimmermann + + Reviewed by Holger Freyther. + + Turn on (SVG) Filters support, by default. + https://bugs.webkit.org/show_bug.cgi?id=32224 + + * Configurations/FeatureDefines.xcconfig: Enable FILTERS build flag. + +2009-12-07 Steve Falkenburg + + Build fix. Be flexible about which version of ICU is used on Windows. + + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Add optional xcopy commands to copy ICU 4.2. + +2009-12-07 Maciej Stachowiak + + Reviewed by Oliver Hunt. + + op_loop_if_less JIT codegen is broken for 64-bit + https://bugs.webkit.org/show_bug.cgi?id=32221 + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_false): Fix codegen in this version - test was backwards. + +2009-12-07 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Object.create fails if properties on the descriptor are getters + https://bugs.webkit.org/show_bug.cgi?id=32219 + + Correctly initialise the PropertySlots with the descriptor object. + + * runtime/ObjectConstructor.cpp: + (JSC::toPropertyDescriptor): + +2009-12-06 Maciej Stachowiak + + Not reviewed, build fix. + + Actually tested 64-bit *and* 32-bit build this time. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_false): + +2009-12-06 Maciej Stachowiak + + Not reviewed, build fix. + + Really really fix 64-bit build for prior patch (actually tested this time). + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_loop_if_false): + (JSC::JIT::emitSlow_op_loop_if_false): + +2009-12-06 Maciej Stachowiak + + Not reviewed, build fix. + + Really fix 64-bit build for prior patch. + + * jit/JITArithmetic.cpp: + (JSC::JIT::emitSlow_op_jless): + +2009-12-06 Maciej Stachowiak + + Not reviewed, build fix. + + Fix 64-bit build for prior patch. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_loop_if_less): + +2009-12-05 Maciej Stachowiak + + Reviewed by Oliver Hunt. + + conway benchmark spends half it's time in op_less (jump fusion fails) + https://bugs.webkit.org/show_bug.cgi?id=32190 + + <1% speedup on SunSpider and V8 + 2x speedup on "conway" benchmark + + Two optimizations: + 1) Improve codegen for logical operators &&, || and ! in a condition context + + When generating code for combinations of &&, || and !, in a + condition context (i.e. in an if statement or loop condition), we + used to produce a value, and then separately jump based on its + truthiness. Now we pass the false and true targets in, and let the + logical operators generate jumps directly. This helps in four + ways: + + a) Individual clauses of a short-circuit logical operator can now + jump directly to the then or else clause of an if statement (or to + the top or exit of a loop) instead of jumping to a jump. + + b) It used to be that jump fusion with the condition of the first + clause of a logical operator was inhibited, because the register + was ref'd to be used later, in the actual condition jump; this no + longer happens since a jump straight to the final target is + generated directly. + + c) It used to be that jump fusion with the condition of the second + clause of a logical operator was inhibited, because there was a + jump target right after the second clause and before the actual + condition jump. But now it's no longer necessary for the first + clause to jump there so jump fusion is not blocked. + + d) We avoid generating excess mov statements in some cases. + + As a concrete example this source: + + if (!((x < q && y < q) || (t < q && z < q))) { + // ... + } + + Used to generate this bytecode: + + [ 34] less r1, r-15, r-19 + [ 38] jfalse r1, 7(->45) + [ 41] less r1, r-16, r-19 + [ 45] jtrue r1, 14(->59) + [ 48] less r1, r-17, r-19 + [ 52] jfalse r1, 7(->59) + [ 55] less r1, r-18, r-19 + [ 59] jtrue r1, 17(->76) + + And now generates this bytecode (also taking advantage of the second optimization below): + + [ 34] jnless r-15, r-19, 8(->42) + [ 38] jless r-16, r-19, 26(->64) + [ 42] jnless r-17, r-19, 8(->50) + [ 46] jless r-18, r-19, 18(->64) + + Note the jump fusion and the fact that there's less jump + indirection - three of the four jumps go straight to the target + clause instead of indirecting through another jump. + + 2) Implement jless opcode to take advantage of the above, since we'll now often generate + a less followed by a jtrue where fusion is not forbidden. + + * parser/Nodes.h: + (JSC::ExpressionNode::hasConditionContextCodegen): Helper function to determine + whether a node supports special conditional codegen. Return false as this is the default. + (JSC::ExpressionNode::emitBytecodeInConditionContext): Assert not reached - only really + defined for nodes that do have conditional codegen. + (JSC::UnaryOpNode::expr): Add const version. + (JSC::LogicalNotNode::hasConditionContextCodegen): Returne true only if subexpression + supports it. + (JSC::LogicalOpNode::hasConditionContextCodegen): Return true. + * parser/Nodes.cpp: + (JSC::LogicalNotNode::emitBytecodeInConditionContext): Implemented - just swap + the true and false targets for the child node. + (JSC::LogicalOpNode::emitBytecodeInConditionContext): Implemented - handle jumps + directly, improving codegen quality. Also handles further nested conditional codegen. + (JSC::ConditionalNode::emitBytecode): Use condition context codegen when available. + (JSC::IfNode::emitBytecode): ditto + (JSC::IfElseNode::emitBytecode): ditto + (JSC::DoWhileNode::emitBytecode): ditto + (JSC::WhileNode::emitBytecode): ditto + (JSC::ForNode::emitBytecode): ditto + + * bytecode/Opcode.h: + - Added loop_if_false opcode - needed now that falsey jumps can be backwards. + - Added jless opcode to take advantage of new fusion opportunities. + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): Handle above. + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitJumpIfTrue): Add peephole for less + jtrue ==> jless. + (JSC::BytecodeGenerator::emitJumpIfFalse): Add handling of backwrds falsey jumps. + * bytecompiler/BytecodeGenerator.h: + (JSC::BytecodeGenerator::emitNodeInConditionContext): Wrapper to handle tracking of + overly deep expressions etc. + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): Implement the two new opcodes (loop_if_false, jless). + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): Implement JIT support for the two new opcodes. + (JSC::JIT::privateCompileSlowCases): ditto + * jit/JIT.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jless): + (JSC::JIT::emitSlow_op_jless): ditto + (JSC::JIT::emitBinaryDoubleOp): ditto + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_loop_if_less): ditto + (JSC::JIT::emit_op_loop_if_false): ditto + (JSC::JIT::emitSlow_op_loop_if_false): ditto + * jit/JITStubs.cpp: + * jit/JITStubs.h: + (JSC::): + +2009-12-04 Kent Hansen + + Reviewed by Darin Adler. + + JavaScript delete operator should return false for string properties + https://bugs.webkit.org/show_bug.cgi?id=32012 + + * runtime/StringObject.cpp: + (JSC::StringObject::deleteProperty): + +2009-12-03 Drew Wilson + + Rolled back r51633 because it causes a perf regression in Chromium. + + * wtf/Platform.h: + +2009-12-03 Gavin Barraclough + + Try and fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a symbol that should be exported. + +2009-12-03 Mark Rowe + + Try and fix the Mac build. + + * JavaScriptCore.exp: Export a symbol that should be exported. + +2009-12-03 Oliver Hunt + + Reviewed by Gavin Barraclough. + + REGRESSION(4.0.3-48777): Crash in JSC::ExecState::propertyNames() (Debug-only?) + https://bugs.webkit.org/show_bug.cgi?id=32133 + + Work around odd GCC-ism and correct the scopechain for use by + calls made while a cachedcall is active on the callstack. + + * interpreter/CachedCall.h: + (JSC::CachedCall::newCallFrame): + * runtime/JSArray.cpp: + (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + +2009-12-03 Gavin Barraclough + + Reviewed by Oliver "Brraaaaiiiinnnnnzzzzzzzz" Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=32136 + Add a rope representation to JSString. Presently JSString always holds its data in UString form. + Instead, allow the result of a string concatenation to be represented in a tree form - with a + variable sized, reference-counted rope node retaining a set of UString::Reps (or other rope nopes). + + Strings must still currently be resolved down to a flat UString representation before being used, + but by holding the string in a rope representation during construction we can avoid copying data + until we know the final size of the string. + + ~2% progression on SunSpider (~25% on date-format-xparb, ~20% on string-validate-input). + + * JavaScriptCore.exp: + + - Update exports. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + + - Make use of new JSString::length() method to avoid prematurely resolving ropes. + + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + + - Switch the string length trampoline to read the length directly from JSString::m_length, + rather than from the JSString's UString::Rep's 'len' property. + + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + + - Modify op_add such that addition of two strings, where either or both strings are already + in rope representation, produces a rope as a result. + + * runtime/JSString.cpp: + (JSC::JSString::Rope::~Rope): + (JSC::copyChars): + (JSC::JSString::resolveRope): + (JSC::JSString::getPrimitiveNumber): + (JSC::JSString::toBoolean): + (JSC::JSString::toNumber): + (JSC::JSString::toString): + (JSC::JSString::toThisString): + (JSC::JSString::getStringPropertyDescriptor): + * runtime/JSString.h: + (JSC::JSString::Rope::Fiber::Fiber): + (JSC::JSString::Rope::Fiber::destroy): + (JSC::JSString::Rope::Fiber::isRope): + (JSC::JSString::Rope::Fiber::rope): + (JSC::JSString::Rope::Fiber::string): + (JSC::JSString::Rope::create): + (JSC::JSString::Rope::initializeFiber): + (JSC::JSString::Rope::ropeLength): + (JSC::JSString::Rope::stringLength): + (JSC::JSString::Rope::fibers): + (JSC::JSString::Rope::Rope): + (JSC::JSString::Rope::operator new): + (JSC::JSString::JSString): + (JSC::JSString::value): + (JSC::JSString::length): + (JSC::JSString::isRope): + (JSC::JSString::rope): + (JSC::JSString::string): + (JSC::JSString::canGetIndex): + (JSC::jsSingleCharacterSubstring): + (JSC::JSString::getIndex): + (JSC::jsSubstring): + (JSC::JSString::getStringPropertySlot): + + - Add rope form. + + * runtime/Operations.h: + (JSC::jsAdd): + (JSC::concatenateStrings): + + - Update string concatenation, and addition of ropes, to produce ropes. + + * runtime/StringObject.cpp: + (JSC::StringObject::getOwnPropertyNames): + + - Make use of new JSString::length() method to avoid prematurely resolving ropes. + +2009-11-23 Jeremy Moskovich + + Reviewed by Eric Seidel. + + Switch Chrome/Mac to use Core Text APIs rather than ATSUI APIs. + https://bugs.webkit.org/show_bug.cgi?id=31802 + + No test since this is already covered by existing pixel tests. + + * wtf/Platform.h: #define USE_CORE_TEXT for Chrome/Mac. + +2009-12-02 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Add files missed in prior patch. + + * runtime/JSZombie.cpp: + (JSC::): + (JSC::JSZombie::leakedZombieStructure): + * runtime/JSZombie.h: Added. + (JSC::JSZombie::JSZombie): + (JSC::JSZombie::isZombie): + (JSC::JSZombie::classInfo): + (JSC::JSZombie::isGetterSetter): + (JSC::JSZombie::isAPIValueWrapper): + (JSC::JSZombie::isPropertyNameIterator): + (JSC::JSZombie::getCallData): + (JSC::JSZombie::getConstructData): + (JSC::JSZombie::getUInt32): + (JSC::JSZombie::toPrimitive): + (JSC::JSZombie::getPrimitiveNumber): + (JSC::JSZombie::toBoolean): + (JSC::JSZombie::toNumber): + (JSC::JSZombie::toString): + (JSC::JSZombie::toObject): + (JSC::JSZombie::markChildren): + (JSC::JSZombie::put): + (JSC::JSZombie::deleteProperty): + (JSC::JSZombie::toThisObject): + (JSC::JSZombie::toThisString): + (JSC::JSZombie::toThisJSString): + (JSC::JSZombie::getJSNumber): + (JSC::JSZombie::getOwnPropertySlot): + +2009-12-02 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Add zombies to JSC + https://bugs.webkit.org/show_bug.cgi?id=32103 + + Add a compile time flag to make the JSC collector replace "unreachable" + objects with zombie objects. The zombie object is a JSCell subclass that + ASSERTs on any attempt to use the JSCell methods. In addition there are + a number of additional assertions in bottleneck code to catch zombie usage + as quickly as possible. + + Grrr. Argh. Brains. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * interpreter/Register.h: + (JSC::Register::Register): + * runtime/ArgList.h: + (JSC::MarkedArgumentBuffer::append): + (JSC::ArgList::ArgList): + * runtime/Collector.cpp: + (JSC::Heap::destroy): + (JSC::Heap::sweep): + * runtime/Collector.h: + * runtime/JSCell.h: + (JSC::JSCell::isZombie): + (JSC::JSValue::isZombie): + * runtime/JSValue.h: + (JSC::JSValue::decode): + (JSC::JSValue::JSValue): + * wtf/Platform.h: + +2009-12-01 Jens Alfke + + Reviewed by Darin Adler. + + Added variants of find/contains/add that allow a foreign key type to be used. + This will allow AtomicString-keyed maps to be queried by C string without + having to create a temporary AtomicString (see HTTPHeaderMap.) + The code for this is adapted from the equivalent in HashSet.h. + + * wtf/HashMap.h: + (WTF::HashMap::find): + (WTF::HashMap::contains): + (WTF::HashMap::add): + * wtf/HashSet.h: Changed "method" to "function member" in a comment. + +2009-12-01 Gustavo Noronha Silva + + Revert 51551 because it broke GTK+. + + * wtf/Platform.h: + +2009-11-30 Gavin Barraclough + + Windows Build fix. Reviewed by NOBODY. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-11-24 Gavin Barraclough + + Reviewed by Geoff Garen. + + Bug 31859 - Make world selection for JSC IsolatedWorlds automagical. + + WebCore presently has to explicitly specify the world before entering into JSC, + which is a little fragile (particularly since property access via a + getter/setter might invoke execution). Instead derive the current world from + the lexical global object. + + Remove the temporary duct tape of willExecute/didExecute virtual hooks on the JSGlobalData::ClientData - these are no longer necessary. + + * API/JSBase.cpp: + (JSEvaluateScript): + * API/JSObjectRef.cpp: + (JSObjectCallAsFunction): + * JavaScriptCore.exp: + * runtime/JSGlobalData.cpp: + * runtime/JSGlobalData.h: + +2009-11-30 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove obsolete PLATFORM(KDE) code + https://bugs.webkit.org/show_bug.cgi?id=31958 + + KDE is now using unpatched QtWebKit. + + * parser/Lexer.cpp: Remove obsolete KDE_USE_FINAL guard + * wtf/Platform.h: Remove PLATFORM(KDE) definition and code + section that is guarded with it. + +2009-11-30 Jan-Arve Sæther + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + The Intel compiler does not support the __has_trivial_constructor type + trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The + reason for that is that the Intel Compiler depends on the Microsoft + Platform SDK, and in order to try to be "fully" MS compatible it will + "pretend" to be the same MS compiler as was shipped with the MS PSDK. + (Thus, compiling with win32-icc with VC8 SDK will make the source code + "think" the compiler at hand supports this type trait). + + * wtf/TypeTraits.h: + +2009-11-29 Laszlo Gombos + + Reviewed by Eric Seidel. + + [Qt] Mac build has JIT disabled + https://bugs.webkit.org/show_bug.cgi?id=31828 + + * wtf/Platform.h: Enable JIT for Qt Mac builds + +2009-11-28 Laszlo Gombos + + Reviewed by Eric Seidel. + + Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows + https://bugs.webkit.org/show_bug.cgi?id=31943 + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + +2009-11-28 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + https://bugs.webkit.org/show_bug.cgi?id=31930 + + Seems a typo. We don't need ~270k memory to determine the vptrs. + + * runtime/JSGlobalData.cpp: + (JSC::VPtrSet::VPtrSet): + +2009-11-27 Shinichiro Hamaji + + Unreviewed. + + Move GOwnPtr* from wtf to wtf/gtk + https://bugs.webkit.org/show_bug.cgi?id=31793 + + Build fix for chromium after r51423. + Exclude gtk directory from chromium build. + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + +2009-11-25 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Incorrect behaviour of jneq_null in the interpreter + https://bugs.webkit.org/show_bug.cgi?id=31901 + + Correct the logic of jneq_null. This is already covered by existing tests. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + +2009-11-26 Laszlo Gombos + + Reviewed by Oliver Hunt. + + Move GOwnPtr* from wtf to wtf/gtk + https://bugs.webkit.org/show_bug.cgi?id=31793 + + * GNUmakefile.am: Change the path for GOwnPtr.*. + * JavaScriptCore.gyp/JavaScriptCore.gyp: Remove + GOwnPtr.cpp from the exclude list. + * JavaScriptCore.gypi: Change the path for GOwnPtr.*. + * wscript: Remove GOwnPtr.cpp from the exclude list. + * wtf/GOwnPtr.cpp: Removed. + * wtf/GOwnPtr.h: Removed. + * wtf/Threading.h: Change the path for GOwnPtr.h. + * wtf/gtk/GOwnPtr.cpp: Copied from JavaScriptCore/wtf/GOwnPtr.cpp. + * wtf/gtk/GOwnPtr.h: Copied from JavaScriptCore/wtf/GOwnPtr.h. + * wtf/unicode/glib/UnicodeGLib.h: Change the path for GOwnPtr.h. + +2009-11-24 Dmitry Titov + + Reviewed by Eric Seidel. + + Add ENABLE_SHARED_SCRIPT feature define and flag for build-webkit + https://bugs.webkit.org/show_bug.cgi?id=31444 + + * Configurations/FeatureDefines.xcconfig: + * wtf/Platform.h: + +2009-11-24 Chris Marrin + + Reviewed by Simon Fraser. + + Add ability to enable ACCELERATED_COMPOSITING on Windows (currently disabled) + https://bugs.webkit.org/show_bug.cgi?id=27314 + + * wtf/Platform.h: + +2009-11-24 Jason Smith + + Reviewed by Alexey Proskuryakov. + + RegExp#exec's returned Array-like object behaves differently from + regular Arrays + https://bugs.webkit.org/show_bug.cgi?id=31689 + + * JavaScriptCore/runtime/RegExpConstructor.cpp: ensure that undefined + values are added to the returned RegExpMatchesArray + +2009-11-24 Oliver Hunt + + Reviewed by Alexey Proskuryakov. + + JSON.stringify performance on undefined is very poor + https://bugs.webkit.org/show_bug.cgi?id=31839 + + Switch from a UString to a Vector when building + the JSON string, allowing us to safely remove the substr-copy + we otherwise did when unwinding an undefined property. + + Also turns out to be a ~5% speedup on stringification. + + * runtime/JSONObject.cpp: + (JSC::Stringifier::StringBuilder::append): + (JSC::Stringifier::stringify): + (JSC::Stringifier::Holder::appendNextProperty): + +2009-11-24 Mark Rowe + + Fix production builds where the source tree may be read-only. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-11-23 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + Include "config.h" to meet Coding Style Guidelines + https://bugs.webkit.org/show_bug.cgi?id=31792 + + * wtf/unicode/UTF8.cpp: + * wtf/unicode/glib/UnicodeGLib.cpp: + * wtf/unicode/wince/UnicodeWince.cpp: + +2009-11-23 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Streamlined some Math functions where we expect or know the result not + to be representable as an int. + + SunSpider says 0.6% faster. + + * runtime/JSNumberCell.h: + (JSC::JSValue::JSValue): + * runtime/JSValue.h: + (JSC::JSValue::): + (JSC::jsDoubleNumber): + (JSC::JSValue::JSValue): Added a function for making a numeric JSValue + and skipping the "can I encode this as an int?" check, avoiding the + overhead of int <-> double roundtripping and double <-> double comparison + and branching. + + * runtime/MathObject.cpp: + (JSC::mathProtoFuncACos): + (JSC::mathProtoFuncASin): + (JSC::mathProtoFuncATan): + (JSC::mathProtoFuncATan2): + (JSC::mathProtoFuncCos): + (JSC::mathProtoFuncExp): + (JSC::mathProtoFuncLog): + (JSC::mathProtoFuncRandom): + (JSC::mathProtoFuncSin): + (JSC::mathProtoFuncSqrt): + (JSC::mathProtoFuncTan): For these functions, which we expect or know + to produce results not representable as ints, call jsDoubleNumber instead + of jsNumber. + +2009-11-23 Mark Rowe + + Unreviewed. Unbreak the regression tests after r51329. + + * API/JSBase.cpp: + (JSEvaluateScript): Null-check clientData before dereferencing it. + * API/JSObjectRef.cpp: + (JSObjectCallAsFunction): Ditto. + +2009-11-23 Gavin Barraclough + + Reviewed by Geoff Garen. + + Part 1/3 of REGRESSION: Many web pages fail to render after interesting script runs in isolated world + + Some clients of the JavaScriptCore API expect to be able to make callbacks over the JSC API, + and for this to automagically cause execution to take place in the world associated with the + global object associated with the ExecState (JSContextRef) passed. However this is not how + things work - the world must be explicitly set within WebCore. + + Making this work just for API calls to evaluate & call will be a far from perfect solution, + since direct (non-API) use of JSC still relies on WebCore setting the current world correctly. + A better solution would be to make this all work automagically all throughout WebCore, but this + will require more refactoring. + + Since the API is in JSC but worlds only exist in WebCore, add callbacks on the JSGlobalData::ClientData + to allow it to update the current world on entry/exit via the JSC API. This is temporary duck + tape, and should be removed once the current world no longer needs to be explicitly tracked. + + * API/JSBase.cpp: + (JSEvaluateScript): + * API/JSObjectRef.cpp: + (JSObjectCallAsFunction): + * JavaScriptCore.exp: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::ClientData::beginningExecution): + (JSC::JSGlobalData::ClientData::completedExecution): + * runtime/JSGlobalData.h: + +2009-11-23 Steve Block + + Reviewed by Dmitry Titov. + + Adds MainThreadAndroid.cpp with Android-specific WTF threading functions. + https://bugs.webkit.org/show_bug.cgi?id=31807 + + * wtf/android: Added. + * wtf/android/MainThreadAndroid.cpp: Added. + (WTF::timeoutFired): + (WTF::initializeMainThreadPlatform): + (WTF::scheduleDispatchFunctionsOnMainThread): + +2009-11-23 Alexey Proskuryakov + + Reviewed by Brady Eidson. + + https://bugs.webkit.org/show_bug.cgi?id=31748 + Make WebSocketHandleCFNet respect proxy auto-configuration files via CFProxySupport + + * JavaScriptCore.exp: Export callOnMainThreadAndWait. + +2009-11-23 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Symbian] Fix lastIndexOf() for Symbian + https://bugs.webkit.org/show_bug.cgi?id=31773 + + Symbian soft floating point library has problems with operators + comparing NaN to numbers. Without a workaround lastIndexOf() + function does not work. + + Patch developed by David Leong. + + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncLastIndexOf):Add an extra test + to check for NaN for Symbian. + +2009-11-23 Steve Block + + Reviewed by Eric Seidel. + + Android port lacks implementation of atomicIncrement and atomicDecrement. + https://bugs.webkit.org/show_bug.cgi?id=31715 + + * wtf/Threading.h: Modified. + (WTF::atomicIncrement): Added Android implementation. + (WTF::atomicDecrement): Added Android implementation. + +2009-11-22 Laszlo Gombos + + Unreviewed. + + [Qt] Sort source lists and remove obsolete comments + from the build system. + + * JavaScriptCore.pri: + +2009-11-21 Laszlo Gombos + + Reviewed by Eric Seidel. + + [Qt][Mac] Turn on multiple JavaScript threads for QtWebkit on Mac + https://bugs.webkit.org/show_bug.cgi?id=31753 + + * wtf/Platform.h: + +2009-11-19 Steve Block + + Android port lacks configuration in Platform.h and config.h. + https://bugs.webkit.org/show_bug.cgi?id=31671 + + * wtf/Platform.h: Modified. Added Android-specific configuration. + +2009-11-19 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=31690 + Make SocketStreamHandleCFNet work on Windows + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/MainThread.cpp: + (WTF::FunctionWithContext::FunctionWithContext): + (WTF::dispatchFunctionsFromMainThread): + (WTF::callOnMainThreadAndWait): + * wtf/MainThread.h: + Re-add callOnMainThreadAndWait(), which was removed in bug 23926. + +2009-11-19 Dmitry Titov + + Reviewed by David Levin. + + isMainThread() on Chromium (Mac and Linux) is so slow it timeouts LayoutTests.. + https://bugs.webkit.org/show_bug.cgi?id=31693 + + * wtf/ThreadingPthreads.cpp: + (WTF::initializeThreading): grab and use the pthread_t of the main thread instead of ThreadIdentifier. + (WTF::isMainThread): Ditto. + +2009-11-19 Laszlo Gombos + + Reviewed by Darin Adler. + + Remove HAVE(STRING_H) guard from JavaScriptCore + https://bugs.webkit.org/show_bug.cgi?id=31668 + + * config.h: + * runtime/UString.cpp: + +2009-11-19 Dumitru Daniliuc + + Reviewed by Dmitry Titov. + + Fixing a bug in MessageQueue::removeIf() that leads to an + assertion failure. + + https://bugs.webkit.org/show_bug.cgi?id=31657 + + * wtf/MessageQueue.h: + (WTF::MessageQueue::removeIf): + +2009-11-19 Laszlo Gombos + + Reviewed by Darin Adler. + + Remove HAVE(FLOAT_H) guard + https://bugs.webkit.org/show_bug.cgi?id=31661 + + JavaScriptCore has a dependency on float.h, there is + no need to guard float.h. + + * runtime/DatePrototype.cpp: Remove include directive + for float.h as it is included in MathExtras.h already. + * runtime/Operations.cpp: Ditto. + * runtime/UString.cpp: Ditto. + * wtf/dtoa.cpp: Ditto. + * wtf/MathExtras.h: Remove HAVE(FLOAT_H) guard. + * wtf/Platform.h: Ditto. + +2009-11-19 Thiago Macieira + + Reviewed by Simon Hausmann. + + Build fix for 32-bit Sparc machines: these machines are big-endian. + + * wtf/Platform.h: + +2009-11-18 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove support for Qt v4.3 or older versions + https://bugs.webkit.org/show_bug.cgi?id=29469 + + * JavaScriptCore.pro: + * jsc.pro: + * wtf/unicode/qt4/UnicodeQt4.h: + +2009-11-18 Kent Tamura + + Reviewed by Darin Adler. + + Move UString::from(double) implementation to new + WTF::doubleToStringInJavaScriptFormat(), and expose it because WebCore + code will use it. + https://bugs.webkit.org/show_bug.cgi?id=31330 + + - Introduce new function createRep(const char*, unsigned) and + UString::UString(const char*, unsigned) to reduce 2 calls to strlen(). + - Fix a bug that dtoa() doesn't update *rve if the input value is NaN + or Infinity. + + No new tests because this doesn't change the behavior. + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * runtime/UString.cpp: + (JSC::createRep): + (JSC::UString::UString): + (JSC::UString::from): Move the code to doubleToStringInJavaScriptFormat(). + * runtime/UString.h: + * wtf/dtoa.cpp: + (WTF::dtoa): Fix a bug about rve. + (WTF::append): A helper for doubleToStringInJavaScriptFormat(). + (WTF::doubleToStringInJavaScriptFormat): Move the code from UString::from(double). + * wtf/dtoa.h: + +2009-11-18 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Remove WTF_USE_JAVASCRIPTCORE_BINDINGS as it is no longer used + https://bugs.webkit.org/show_bug.cgi?id=31643 + + * JavaScriptCore.pro: + +2009-11-18 Nate Chapin + + Reviewed by Darin Fisher. + + Remove Chromium's unnecessary dependency on wtf's tcmalloc files. + + https://bugs.webkit.org/show_bug.cgi?id=31648 + + * JavaScriptCore.gyp/JavaScriptCore.gyp: + +2009-11-18 Thiago Macieira + + Reviewed by Gavin Barraclough. + + [Qt] Implement symbol hiding for JSC's JIT functions. + + These functions are implemented directly in assembly, so they need the + proper directives to enable/disable visibility. On ELF systems, it's + .hidden, whereas on Mach-O systems (Mac) it's .private_extern. On + Windows, it's not necessary since you have to explicitly export. I + also implemented the AIX idiom, though it's unlikely anyone will + implement AIX/POWER JIT. + https://bugs.webkit.org/show_bug.cgi?id=30864 + + * jit/JITStubs.cpp: + +2009-11-18 Oliver Hunt + + Reviewed by Alexey Proskuryakov. + + Interpreter may do an out of range access when throwing an exception in the profiler. + https://bugs.webkit.org/show_bug.cgi?id=31635 + + Add bounds check. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::throwException): + +2009-11-18 Gabor Loki + + Reviewed by Darin Adler. + + Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=31631 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + +2009-11-18 Harald Fernengel + + Reviewed by Simon Hausmann. + + [Qt] Fix detection of linux-g++ + + Never use "linux-g++*" to check for linux-g++, since this will break embedded + builds which use linux-arm-g++ and friends. Use 'linux*-g++*' to check for any + g++ on linux mkspec. + + * JavaScriptCore.pri: + +2009-11-17 Jon Honeycutt + + Add JSContextRefPrivate.h to list of copied files. + + Reviewed by Mark Rowe. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: + +2009-11-17 Martin Robinson + + Reviewed by Adam Barth. + + [GTK] Style cleanup for GOwnPtr + https://bugs.webkit.org/show_bug.cgi?id=31506 + + Remove forward declaration in GOwnPtr and do some style cleanup. + + * wtf/GOwnPtr.cpp: + * wtf/GOwnPtr.h: + (WTF::GOwnPtr::GOwnPtr): + (WTF::GOwnPtr::~GOwnPtr): + (WTF::GOwnPtr::get): + (WTF::GOwnPtr::release): + (WTF::GOwnPtr::outPtr): + (WTF::GOwnPtr::set): + (WTF::GOwnPtr::clear): + (WTF::GOwnPtr::operator*): + (WTF::GOwnPtr::operator->): + (WTF::GOwnPtr::operator!): + (WTF::GOwnPtr::operator UnspecifiedBoolType): + (WTF::GOwnPtr::swap): + (WTF::swap): + (WTF::operator==): + (WTF::operator!=): + (WTF::getPtr): + (WTF::freeOwnedGPtr): + +2009-11-17 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Incorrect use of JavaScriptCore API in DumpRenderTree + https://bugs.webkit.org/show_bug.cgi?id=31577 + + Add assertions to the 'toJS' functions to catch mistakes like + this early. Restructure existing code which blindly passed potentially + null values to toJS when forwarding exceptions so that a null check is + performed first. + + * API/APICast.h: + (toJS): + (toJSForGC): + * API/JSCallbackObjectFunctions.h: + (JSC::::getOwnPropertySlot): + (JSC::::put): + (JSC::::deleteProperty): + (JSC::::construct): + (JSC::::hasInstance): + (JSC::::call): + (JSC::::toNumber): + (JSC::::toString): + (JSC::::staticValueGetter): + (JSC::::callbackGetter): + * API/tests/testapi.c: Fix errors in the API tester. + (MyObject_getProperty): + (MyObject_convertToType): + (EvilExceptionObject_convertToType): + +2009-11-16 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + https://bugs.webkit.org/show_bug.cgi?id=31050 + + Minor fixes for JSVALUE32_64: branchConvertDoubleToInt32 + failed on a CortexA8 CPU, but not on a simulator; and + JITCall.cpp modifications was somehow not committed to mainline. + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::fmrs_r): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::branchConvertDoubleToInt32): + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + +2009-11-16 Joerg Bornemann + + Reviewed by Simon Hausmann. + + Fix Qt build on Windows CE 6. + + * JavaScriptCore.pri: Add missing include path. + * wtf/Platform.h: Include ce_time.h for Windows CE 6. + +2009-11-13 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + https://bugs.webkit.org/show_bug.cgi?id=31050 + + Adding optimization support for mode JSVALUE32_64 + on ARM systems. + + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::emit_op_put_by_id): + +2009-11-14 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + https://bugs.webkit.org/show_bug.cgi?id=31050 + + Adding JSVALUE32_64 support for ARM (but not turning it + on by default). All optimizations must be disabled, since + this patch is only the first of a series of patches. + + During the work, a lot of x86 specific code revealed and + made platform independent. + See revisions: 50531 50541 50593 50594 50595 + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::): + (JSC::ARMAssembler::fdivd_r): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::lshift32): + (JSC::MacroAssemblerARM::neg32): + (JSC::MacroAssemblerARM::rshift32): + (JSC::MacroAssemblerARM::branchOr32): + (JSC::MacroAssemblerARM::set8): + (JSC::MacroAssemblerARM::setTest8): + (JSC::MacroAssemblerARM::loadDouble): + (JSC::MacroAssemblerARM::divDouble): + (JSC::MacroAssemblerARM::convertInt32ToDouble): + (JSC::MacroAssemblerARM::zeroDouble): + * jit/JIT.cpp: + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JITStubs.cpp: + * wtf/StdLibExtras.h: + +2009-11-13 Dominik Röttsches + + Reviewed by Eric Seidel. + + Unify TextBoundaries implementations by only relying on WTF Unicode abstractions + https://bugs.webkit.org/show_bug.cgi?id=31468 + + Adding isAlphanumeric abstraction, required + by TextBoundaries.cpp. + + * wtf/unicode/glib/UnicodeGLib.h: + (WTF::Unicode::isAlphanumeric): + * wtf/unicode/icu/UnicodeIcu.h: + (WTF::Unicode::isAlphanumeric): + +2009-11-13 Norbert Leser + + Reviewed by Eric Seidel. + + Added macros for USERINCLUDE paths within symbian blocks + to guarantee inclusion of respective header files from local path + first (to avoid clashes with same names of header files in system include path). + + * JavaScriptCore.pri: + +2009-11-13 Oliver Hunt + + Reviewed by Geoff Garen. + + JSValueProtect and JSValueUnprotect don't protect API wrapper values + https://bugs.webkit.org/show_bug.cgi?id=31485 + + Make JSValueProtect/Unprotect use a new 'toJS' function, 'toJSForGC' that + does not attempt to to strip out API wrapper objects. + + * API/APICast.h: + (toJSForGC): + * API/JSValueRef.cpp: + (JSValueProtect): + (JSValueUnprotect): + * API/tests/testapi.c: + (makeGlobalNumberValue): + (main): + +2009-11-13 İsmail Dönmez + + Reviewed by Antti Koivisto. + + Fix typo, ce_time.cpp should be ce_time.c + + * JavaScriptCore.pri: + +2009-11-12 Steve VanDeBogart + + Reviewed by Adam Barth. + + Calculate the time offset only if we were able to parse + the date string. This saves an IPC in Chromium for + invalid date strings. + https://bugs.webkit.org/show_bug.cgi?id=31416 + + * wtf/DateMath.cpp: + (WTF::parseDateFromNullTerminatedCharacters): + (JSC::parseDateFromNullTerminatedCharacters): + +2009-11-12 Oliver Hunt + + Rollout r50896 until i can work out why it causes failures. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitReturn): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + * parser/Nodes.cpp: + (JSC::EvalNode::emitBytecode): + +2009-11-12 Steve Falkenburg + + Reviewed by Stephanie Lewis. + + Remove LIBRARY directive from def file to fix Debug_All target. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-11-12 Gustavo Noronha Silva + + Rubber-stamped by Holger Freyther. + + Revert r50204, since it makes DRT crash on 32 bits release builds + for GTK+. + + * wtf/FastMalloc.h: + +2009-11-12 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Start unifying entry logic for function and eval code. + + Eval now uses a ret instruction to end execution, and sets up + a callframe more in line with what we do for function entry. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitReturn): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + * parser/Nodes.cpp: + (JSC::EvalNode::emitBytecode): + +2009-11-12 Richard Moe Gustavsen + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Disable pthread_setname_np. + + This allows Qt builds on Mac from 10.6 to run on earlier version + where this symbol is not present. + https://bugs.webkit.org/show_bug.cgi?id=31403 + + * wtf/Platform.h: + +2009-11-12 Thiago Macieira + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix linking on Linux 32-bit. + + It was missing the ".text" directive at the top of the file, + indicating that code would follow. Without it, the assembler created + "NOTYPE" symbols, which would result in linker errors. + https://bugs.webkit.org/show_bug.cgi?id=30863 + + * jit/JITStubs.cpp: + +2009-11-11 Laszlo Gombos + + Reviewed by Alexey Proskuryakov. + + Refactor multiple JavaScriptCore threads + https://bugs.webkit.org/show_bug.cgi?id=31328 + + Remove the id field from the PlatformThread structure + as it is not used. + + * runtime/Collector.cpp: + (JSC::getCurrentPlatformThread): + (JSC::suspendThread): + (JSC::resumeThread): + (JSC::getPlatformThreadRegisters): + +2009-11-10 Geoffrey Garen + + Linux build fix: Added an #include for UINT_MAX. + + * runtime/WeakRandom.h: + +2009-11-10 Geoffrey Garen + + JavaScriptGlue build fix: Marked a file 'private' instead of 'project'. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-11-10 Geoffrey Garen + + Reviewed by Gavin "avGni arBalroguch" Barraclough. + + Faster Math.random, based on GameRand. + + SunSpider says 1.4% faster. + + * GNUmakefile.am: + * JavaScriptCore.gypi: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: Added the header to the project. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: Use an object to track random number generation + state, initialized to the current time. + + * runtime/MathObject.cpp: + (JSC::MathObject::MathObject): + (JSC::mathProtoFuncRandom): Use the new hotness. + + * runtime/WeakRandom.h: Added. + (JSC::WeakRandom::WeakRandom): + (JSC::WeakRandom::get): + (JSC::WeakRandom::advance): The new hotness. + +2009-11-09 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Imported the v8 DST cache. + + SunSpider says 1.5% faster. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::resetDateCache): Reset the DST cache when resetting + other date data. + + * runtime/JSGlobalData.h: + (JSC::DSTOffsetCache::DSTOffsetCache): + (JSC::DSTOffsetCache::reset): Added a struct for the DST cache. + + * wtf/DateMath.cpp: + (WTF::calculateDSTOffsetSimple): + (WTF::calculateDSTOffset): + (WTF::parseDateFromNullTerminatedCharacters): + (JSC::getDSTOffset): + (JSC::gregorianDateTimeToMS): + (JSC::msToGregorianDateTime): + (JSC::parseDateFromNullTerminatedCharacters): + * wtf/DateMath.h: The imported code for probing and updating the cache. + +2009-11-09 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed an edge case that could cause the engine not to notice a timezone + change. + + No test because this case would require manual intervention to change + the timezone during the test. + + SunSpider reports no change. + + * runtime/DateInstanceCache.h: + (JSC::DateInstanceCache::DateInstanceCache): + (JSC::DateInstanceCache::reset): Added a helper function for resetting + this cache. Also, shrank the cache, since we'll be resetting it often. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::resetDateCache): Include resetting the DateInstanceCache + in resetting Date data. (Otherwise, a cache hit could bypass a necessary + timezone update check.) + +2009-11-09 Geoffrey Garen + + Reviewed by Sam Weinig. + + Some manual inlining and constant propogation in Date code. + + SunSpider reports a 0.4% speedup on date-*, no overall speedup. Shark + says some previously evident stalls are now gone. + + * runtime/DateConstructor.cpp: + (JSC::callDate): + * runtime/DateConversion.cpp: + (JSC::formatTime): + (JSC::formatTimeUTC): Split formatTime into UTC and non-UTC variants. + + * runtime/DateConversion.h: + * runtime/DateInstance.cpp: + (JSC::DateInstance::calculateGregorianDateTime): + (JSC::DateInstance::calculateGregorianDateTimeUTC): + * runtime/DateInstance.h: + (JSC::DateInstance::gregorianDateTime): + (JSC::DateInstance::gregorianDateTimeUTC): Split gregorianDateTime into + a UTC and non-UTC variant, and split each variant into a fast inline + case and a slow out-of-line case. + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Updated for the gregorianDateTime change above. + +2009-11-09 Geoffrey Garen + + Build fix: export a new symbol. + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-11-09 Geoffrey Garen + + Reviewed by Sam "Home Wrecker" Weinig. + + Added a tiny cache for Date parsing. + + SunSpider says 1.2% faster. + + * runtime/DateConversion.cpp: + (JSC::parseDate): Try to reuse the last parsed Date, if present. + + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::resetDateCache): + * runtime/JSGlobalData.h: Added storage for last parsed Date. Refactored + this code to make resetting the date cache easier. + + * runtime/JSGlobalObject.h: + (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for + refactoring. + + * wtf/DateMath.cpp: + (JSC::parseDateFromNullTerminatedCharacters): + * wtf/DateMath.h: Changed ExecState to be first parameter, as is the JSC custom. + +2009-11-09 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Can cache prototype lookups on uncacheable dictionaries. + https://bugs.webkit.org/show_bug.cgi?id=31198 + + Replace fromDictionaryTransition with flattenDictionaryObject and + flattenDictionaryStructure. This change is necessary as we need to + guarantee that our attempt to convert away from a dictionary structure + will definitely succeed, and in some cases this requires mutating the + object storage itself. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCacheGetByID): + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCacheGetByID): + (JSC::DEFINE_STUB_FUNCTION): + * runtime/BatchedTransitionOptimizer.h: + (JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer): + * runtime/JSObject.h: + (JSC::JSObject::flattenDictionaryObject): + * runtime/Operations.h: + (JSC::normalizePrototypeChain): + * runtime/Structure.cpp: + (JSC::Structure::flattenDictionaryStructure): + (JSC::comparePropertyMapEntryIndices): + * runtime/Structure.h: + +2009-11-09 Laszlo Gombos + + Not reviewed, build fix. + + Remove extra character from r50701. + + * JavaScriptCore.pri: + +2009-11-09 Laszlo Gombos + + Not reviewed, build fix. + + Revert r50695 because it broke QtWebKit (clean builds). + + * JavaScriptCore.pri: + +2009-11-09 Norbert Leser + + Reviewed by Kenneth Rohde Christiansen. + + Prepended $$PWD to GENERATED_SOURCES_DIR to avoid potential ambiguities when included from WebCore.pro. + Some preprocessors consider this GENERATED_SOURCES_DIR relative to current invoking dir (e.g., ./WebCore), + and not the working dir of JavaCriptCore.pri (i.e., ../JavaScriptCore/). + + * JavaScriptCore.pri: + +2009-11-09 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + Use explicit parentheses to silence gcc 4.4 -Wparentheses warnings + https://bugs.webkit.org/show_bug.cgi?id=31040 + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + +2009-11-08 David Levin + + Reviewed by NOBODY (speculative snow leopard and windows build fixes). + + * wtf/DateMath.cpp: + (WTF::parseDateFromNullTerminatedCharacters): + (JSC::gregorianDateTimeToMS): + (JSC::msToGregorianDateTime): + (JSC::parseDateFromNullTerminatedCharacters): + * wtf/DateMath.h: + (JSC::GregorianDateTime::GregorianDateTime): + +2009-11-08 David Levin + + Reviewed by NOBODY (chromium build fix). + + Hopefully, the last build fix. + + Create better separation in DateMath about the JSC + and non-JSC portions. Also, only expose the non-JSC + version in the exports. + + * JavaScriptCore.exp: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * wtf/DateMath.cpp: + (WTF::parseDateFromNullTerminatedCharacters): + (JSC::getUTCOffset): + (JSC::gregorianDateTimeToMS): + (JSC::msToGregorianDateTime): + (JSC::parseDateFromNullTerminatedCharacters): + * wtf/DateMath.h: + (JSC::gmtoffset): + +2009-11-08 David Levin + + Reviewed by NOBODY (chromium build fix). + + For the change in DateMath. + + * config.h: + * wtf/DateMath.cpp: + +2009-11-06 Geoffrey Garen + + Windows build fix: export some symbols. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-11-06 Geoffrey Garen + + Build fix: updated export file. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + +2009-11-06 Geoffrey Garen + + Build fix: added some #includes. + + * wtf/CurrentTime.h: + * wtf/DateMath.h: + +2009-11-06 Geoffrey Garen + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=31197 + Implemented a timezone cache not based on Mac OS X's notify_check API. + + If the VM calculates the local timezone offset from UTC, it caches the + result until the end of the current VM invocation. (We don't want to cache + forever, because the user's timezone may change over time.) + + This removes notify_* overhead on Mac, and, more significantly, removes + OS time and date call overhead on non-Mac platforms. + + ~8% speedup on Date microbenchmark on Mac. SunSpider reports maybe a tiny + speedup on Mac. (Speedup on non-Mac platforms should be even more noticeable.) + + * JavaScriptCore.exp: + + * interpreter/CachedCall.h: + (JSC::CachedCall::CachedCall): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + * runtime/JSGlobalObject.h: + (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Made the + DynamicGlobalObjectScope constructor responsible for checking whether a + dynamicGlobalObject has already been set. This eliminated some duplicate + client code, and allowed me to avoid adding even more duplicate client + code. Made DynamicGlobalObjectScope responsible for resetting the + local timezone cache upon first entry to the VM. + + * runtime/DateConstructor.cpp: + (JSC::constructDate): + (JSC::callDate): + (JSC::dateParse): + (JSC::dateUTC): + * runtime/DateConversion.cpp: + (JSC::parseDate): + * runtime/DateConversion.h: + * runtime/DateInstance.cpp: + (JSC::DateInstance::gregorianDateTime): + * runtime/DateInstance.h: + * runtime/DateInstanceCache.h: + * runtime/DatePrototype.cpp: + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + * runtime/InitializeThreading.cpp: + (JSC::initializeThreadingOnce): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSGlobalData.h: + * wtf/DateMath.cpp: + (WTF::getCurrentUTCTime): + (WTF::getCurrentUTCTimeWithMicroseconds): + (WTF::getLocalTime): + (JSC::getUTCOffset): Use the new cache. Also, see below. + (JSC::gregorianDateTimeToMS): + (JSC::msToGregorianDateTime): + (JSC::initializeDates): + (JSC::parseDateFromNullTerminatedCharacters): Simplified the way this function + accounts for the local timezone offset, to accomodate our new caching API, + and a (possibly misguided) caller in WebCore. Also, see below. + * wtf/DateMath.h: + (JSC::GregorianDateTime::GregorianDateTime): Moved most of the code in + DateMath.* into the JSC namespace. The code needed to move so it could + naturally interact with ExecState and JSGlobalData to support caching. + Logically, it seemed right to move it, too, since this code is not really + as low-level as the WTF namespace might imply -- it implements a set of + date parsing and conversion quirks that are finely tuned to the JavaScript + language. Also removed the Mac OS X notify_* infrastructure. + + * wtf/CurrentTime.h: + (WTF::currentTimeMS): + (WTF::getLocalTime): Moved the rest of the DateMath code here, and renamed + it to make it consistent with WTF's currentTime function. + +2009-11-06 Gabor Loki + + Unreviewed trivial buildfix after r50595. + + Rename the remaining rshiftPtr calls to rshift32 - [Qt] use nanval() for Symbian as nonInlineNaN - https://bugs.webkit.org/show_bug.cgi?id=34170 + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_rshift): + * jit/JITInlineMethods.h: + (JSC::JIT::emitFastArithImmToInt): - numeric_limits::quiet_NaN is broken in Symbian - causing NaN to be evaluated as a number. +2009-11-06 Gavin Barraclough - * runtime/JSValue.cpp: - (JSC::nonInlineNaN): + Reviewed by Oliver Hunt. -2010-01-07 Norbert Leser + Tidy up the shift methods on the macro-assembler interface. - Reviewed by NOBODY (OOPS!). + Currently behaviour of shifts of a magnitude > 0x1f is undefined. + Instead defined that all shifts are masked to this range. This makes a lot of + practical sense, both since having undefined behaviour is not particularly + desirable, and because this behaviour is commonly required (particularly since + it is required bt ECMA-262 for shifts). - RVCT compiler with "-Otime -O3" optimization tries to optimize out - inline new'ed pointers that are passed as arguments. - Proposed patch assigns new'ed pointer explicitly outside function call. + Update the ARM assemblers to provide this behaviour. Remove (now) redundant + masks from JITArithmetic, and remove rshiftPtr (this was used in case that + could be rewritten in a simpler form using rshift32, only optimized JSVALUE32 + on x86-64, which uses JSVALUE64!) - * API/JSClassRef.cpp: - (OpaqueJSClass::OpaqueJSClass): - (OpaqueJSClassContextData::OpaqueJSClassContextData): + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::lshift32): + (JSC::MacroAssemblerARM::rshift32): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::lshift32): + (JSC::MacroAssemblerARMv7::rshift32): + * assembler/MacroAssemblerX86_64.h: + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_lshift): + (JSC::JIT::emit_op_rshift): -2009-11-19 Thiago Macieira +2009-11-05 Gavin Barraclough - Reviewed by Simon Hausmann. + Rubber Stamped by Oliver Hunt. - Build fix for 32-bit Sparc machines: these machines are big-endian. + Remove a magic number (1) from the JIT, instead compute the value with OBJECT_OFFSET. - * wtf/Platform.h: + * jit/JITInlineMethods.h: + (JSC::JIT::emitPutJITStubArg): + (JSC::JIT::emitPutJITStubArgConstant): + (JSC::JIT::emitGetJITStubArg): + (JSC::JIT::emitPutJITStubArgFromVirtualRegister): + * jit/JITStubCall.h: + (JSC::JITStubCall::JITStubCall): + (JSC::JITStubCall::getArgument): + * jit/JITStubs.h: -2009-12-08 Gustavo Noronha Silva +2009-11-05 Zoltan Herczeg - Reviewed by Darin Adler. + Reviewed by Gavin Barraclough. - Make WebKit build correctly on FreeBSD, IA64, and Alpha. - Based on work by Petr Salinger , - and Colin Watson . + https://bugs.webkit.org/show_bug.cgi?id=31159 + Fix branchDouble behaviour on ARM THUMB2 JIT. - * wtf/Platform.h: + The x86 branchDouble behaviour is reworked, and all JIT + ports should follow the x86 port. See bug 31104 and 31151 -2009-12-18 Yongjun Zhang + This patch contains a fix for the traditional ARM port - Reviewed by Simon Hausmann. + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::): + (JSC::ARMAssembler::fmrs_r): + (JSC::ARMAssembler::ftosid_r): + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::): + (JSC::MacroAssemblerARM::branchDouble): + (JSC::MacroAssemblerARM::branchConvertDoubleToInt32): - https://bugs.webkit.org/show_bug.cgi?id=32713 - [Qt] make wtf/Assertions.h compile in winscw compiler. +2009-11-05 Chris Jerdonek - Add string arg before ellipsis to help winscw compiler resolve variadic - macro definitions in wtf/Assertions.h. + Reviewed by Eric Seidel. - * wtf/Assertions.h: + Removed the "this is part of the KDE project" comments from + all *.h, *.cpp, *.idl, and *.pm files. + + https://bugs.webkit.org/show_bug.cgi?id=31167 + + The maintenance and architecture page in the project wiki lists + this as a task. + + This change includes no changes or additions to test cases + since the change affects only comments. + + * wtf/wince/FastMallocWince.h: -2009-11-30 Jan-Arve Sæther +2009-11-05 Gabor Loki - Reviewed by Simon Hausmann. + Reviewed by Gavin Barraclough. - [Qt] Fix compilation with win32-icc + Use ARMv7 specific encoding for immediate constants on ARMv7 target + https://bugs.webkit.org/show_bug.cgi?id=31060 - The Intel compiler does not support the __has_trivial_constructor type - trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The - reason for that is that the Intel Compiler depends on the Microsoft - Platform SDK, and in order to try to be "fully" MS compatible it will - "pretend" to be the same MS compiler as was shipped with the MS PSDK. - (Thus, compiling with win32-icc with VC8 SDK will make the source code - "think" the compiler at hand supports this type trait). + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::getOp2): Use INVALID_IMM + (JSC::ARMAssembler::getImm): Use encodeComplexImm for complex immediate + (JSC::ARMAssembler::moveImm): Ditto. + (JSC::ARMAssembler::encodeComplexImm): Encode a constant by one or two + instructions or a PC relative load. + * assembler/ARMAssembler.h: Use INVALID_IMM if a constant cannot be + encoded as an immediate constant. + (JSC::ARMAssembler::): + (JSC::ARMAssembler::movw_r): 16-bit immediate load + (JSC::ARMAssembler::movt_r): High halfword 16-bit immediate load + (JSC::ARMAssembler::getImm16Op2): Encode immediate constant for + movw_r and mowt_r - * wtf/TypeTraits.h: +2009-11-04 Mark Mentovai -2009-11-28 Laszlo Gombos + Reviewed by Mark Rowe. - Reviewed by Eric Seidel. + Provide TARGETING_TIGER and TARGETING_LEOPARD as analogues to + BUILDING_ON_TIGER and BUILDING_ON_LEOPARD. The TARGETING_ macros + consider the deployment target; the BUILDING_ON_ macros consider the + headers being built against. - Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows - https://bugs.webkit.org/show_bug.cgi?id=31943 + * wtf/Platform.h: - * runtime/MarkStack.h: - (JSC::MarkStack::MarkStackArray::shrinkAllocation): +2009-11-04 Gavin Barraclough -2009-11-18 Gabor Loki + Reviewed by Oliver Hunt. - Reviewed by Darin Adler. + https://bugs.webkit.org/show_bug.cgi?id=31151 + Fix branchDouble behaviour on ARM THUMB2 JIT. - Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux - https://bugs.webkit.org/show_bug.cgi?id=31631 + The ARMv7 JIT is currently using ARMv7Assembler::ConditionEQ to branch + for DoubleEqualOrUnordered, however this is incorrect – ConditionEQ won't + branch on unordered operands. Similarly, DoubleLessThanOrUnordered & + DoubleLessThanOrEqualOrUnordered use ARMv7Assembler::ConditionLO & + ARMv7Assembler::ConditionLS, whereas they should be using + ARMv7Assembler::ConditionLT & ARMv7Assembler::ConditionLE. - * jit/ExecutableAllocator.h: - (JSC::ExecutableAllocator::cacheFlush): + Fix these, and fill out the missing DoubleConditions. -2009-11-23 Laszlo Gombos + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::): + (JSC::MacroAssemblerARMv7::branchDouble): - Reviewed by Kenneth Rohde Christiansen. +2009-11-04 Gavin Barraclough - [Symbian] Fix lastIndexOf() for Symbian - https://bugs.webkit.org/show_bug.cgi?id=31773 + Rubber Stamped by Oliver Hunt. - Symbian soft floating point library has problems with operators - comparing NaN to numbers. Without a workaround lastIndexOf() - function does not work. + Enable native call optimizations on ARMv7. (Existing ARM_TRADITIONAL + implementation was generic, worked perfectly, just needed turning on). - Patch developed by David Leong. + * jit/JITOpcodes.cpp: + * wtf/Platform.h: - * runtime/StringPrototype.cpp: - (JSC::stringProtoFuncLastIndexOf):Add an extra test - to check for NaN for Symbian. +2009-11-04 Gavin Barraclough -2009-11-18 Harald Fernengel + Rubber Stamped by Mark Rowe, Oliver Hunt, and Sam Weinig. - Reviewed by Simon Hausmann. + Add a missing assert to the ARMv7 JIT. - [Qt] Fix detection of linux-g++ + * assembler/ARMv7Assembler.h: + (JSC::ARMThumbImmediate::ARMThumbImmediate): - Never use "linux-g++*" to check for linux-g++, since this will break embedded - builds which use linux-arm-g++ and friends. Use 'linux*-g++*' to check for any - g++ on linux mkspec. +2009-11-04 Mark Rowe - * JavaScriptCore.pri: + Rubber-stamped by Oliver Hunt. -2009-11-16 Joerg Bornemann + Remove bogus op_ prefix on dumped version of three opcodes. - Reviewed by Simon Hausmann. + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): - Fix Qt build on Windows CE 6. +2009-11-04 Mark Rowe - * JavaScriptCore.pri: Add missing include path. - * wtf/Platform.h: Include ce_time.h for Windows CE 6. + Reviewed by Sam Weinig. -2009-11-12 Thiago Macieira + Fix dumping of constants in bytecode so that they aren't printed as large positive register numbers. - Reviewed by Kenneth Rohde Christiansen. + We do this by having the registerName function return information about the constant if the register + number corresponds to a constant. This requires that registerName, and several functions that call it, + be converted to member functions of CodeBlock so that the constant value can be retrieved. The + ExecState also needs to be threaded down through these functions so that it can be passed on to + constantName when needed. - [Qt] Fix linking on Linux 32-bit. + * bytecode/CodeBlock.cpp: + (JSC::constantName): + (JSC::CodeBlock::registerName): + (JSC::CodeBlock::printUnaryOp): + (JSC::CodeBlock::printBinaryOp): + (JSC::CodeBlock::printConditionalJump): + (JSC::CodeBlock::printGetByIdOp): + (JSC::CodeBlock::printPutByIdOp): + (JSC::CodeBlock::dump): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::isConstantRegisterIndex): - It was missing the ".text" directive at the top of the file, - indicating that code would follow. Without it, the assembler created - "NOTYPE" symbols, which would result in linker errors. - https://bugs.webkit.org/show_bug.cgi?id=30863 +2009-11-04 Pavel Heimlich - * jit/JITStubs.cpp: + Reviewed by Alexey Proskuryakov. -2009-11-13 İsmail Dönmez + https://bugs.webkit.org/show_bug.cgi?id=30647 + Solaris build failure due to strnstr. - Reviewed by Antti Koivisto. + * wtf/StringExtras.h: Enable strnstr on Solaris, too. - Fix typo, ce_time.cpp should be ce_time.c +2009-11-04 Gavin Barraclough - * JavaScriptCore.pri: + Reviewed by Oliver Hunt. -2009-11-12 Richard Moe Gustavsen + https://bugs.webkit.org/show_bug.cgi?id=31104 + Refactor x86-specific behaviour out of the JIT. - Reviewed by Kenneth Rohde Christiansen. + - Add explicit double branch conditions for ordered and unordered comparisons (presently the brehaviour is a mix). + - Refactor double to int conversion out into the MacroAssembler. + - Remove broken double to int conversion for !JSVALUE32_64 builds - this code was broken and slowing us down, fixing it showed it not to be an improvement. + - Remove exclusion of double to int conversion from (1 % X) cases in JSVALUE32_64 builds - if this was of benefit this is no longer the case; simplify. - [Qt] Disable pthread_setname_np. + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::): + * assembler/MacroAssemblerX86Common.h: + (JSC::MacroAssemblerX86Common::): + (JSC::MacroAssemblerX86Common::convertInt32ToDouble): + (JSC::MacroAssemblerX86Common::branchDouble): + (JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32): + * jit/JITArithmetic.cpp: + (JSC::JIT::emitBinaryDoubleOp): + (JSC::JIT::emit_op_div): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emitSlow_op_jnlesseq): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jfalse): - This allows Qt builds on Mac from 10.6 to run on earlier version - where this symbol is not present. - https://bugs.webkit.org/show_bug.cgi?id=31403 +2009-11-04 Mark Mentovai - * wtf/Platform.h: + Reviewed by Eric Seidel. + + Remove BUILDING_ON_LEOPARD from JavaScriptCore.gyp. This is supposed + to be set as needed only in wtf/Platform.h. + + * JavaScriptCore.gyp/JavaScriptCore.gyp: 2009-11-02 Oliver Hunt @@ -177,19 +7852,161 @@ * jit/JITStubs.cpp: (JSC::JITThunks::tryCacheGetByID): -2009-10-30 Tor Arne Vestbø +2009-11-02 Laszlo Gombos - Reviewed by NOBODY (OOPS!). + Reviewed by Darin Adler. - [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + PLATFORM(CF) should be set when building for Qt on Darwin + https://bugs.webkit.org/show_bug.cgi?id=23671 - This ensures that long-running JavaScript (for example due to a modal alert() dialog), - will not trigger a deferred load after only 500ms (the default tokenizer delay) while - still giving a reasonable timeout (10 seconds) to prevent deadlock. + * wtf/Platform.h: Turn on CF support if both QT and DARWIN + platforms are defined. - https://bugs.webkit.org/show_bug.cgi?id=29381 +2009-11-02 Dmitry Titov - * runtime/TimeoutChecker.h: Add getter for the timeout interval + Reviewed by David Levin. + + Remove threadsafe refcounting from tasks used with WTF::MessageQueue. + https://bugs.webkit.org/show_bug.cgi?id=30612 + + * wtf/MessageQueue.h: + (WTF::MessageQueue::alwaysTruePredicate): + (WTF::MessageQueue::~MessageQueue): + (WTF::MessageQueue::append): + (WTF::MessageQueue::appendAndCheckEmpty): + (WTF::MessageQueue::prepend): + (WTF::MessageQueue::waitForMessage): + (WTF::MessageQueue::waitForMessageFilteredWithTimeout): + (WTF::MessageQueue::tryGetMessage): + (WTF::MessageQueue::removeIf): + The MessageQueue is changed to act as a queue of OwnPtr. It takes ownership + of posted tasks and passes it to the new owner (in another thread) when the task is fetched. + All methods have arguments of type PassOwnPtr and return the same type. + + * wtf/Threading.cpp: + (WTF::createThread): + Superficial change to trigger rebuild of JSC project on Windows, + workaround for https://bugs.webkit.org/show_bug.cgi?id=30890 + +2009-10-30 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed failing layout test: restore a special case I accidentally deleted. + + * runtime/DatePrototype.cpp: + (JSC::setNewValueFromDateArgs): In the case of applying a change to a date + that is NaN, reset the date to 0 *and* then apply the change; don't just + reset the date to 0. + +2009-10-30 Geoffrey Garen + + Windows build fix: update for object-to-pointer change. + + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + +2009-10-29 Geoffrey Garen + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=30942 + Use pointers instead of copies to pass GregorianDateTime objects around. + + SunSpider reports a shocking 4.5% speedup on date-format-xparb, and 1.3% + speedup on date-format-tofte. + + * runtime/DateInstance.cpp: + (JSC::DateInstance::gregorianDateTime): + * runtime/DateInstance.h: + * runtime/DatePrototype.cpp: + (JSC::formatLocaleDate): + (JSC::dateProtoFuncToString): + (JSC::dateProtoFuncToUTCString): + (JSC::dateProtoFuncToISOString): + (JSC::dateProtoFuncToDateString): + (JSC::dateProtoFuncToTimeString): + (JSC::dateProtoFuncGetFullYear): + (JSC::dateProtoFuncGetUTCFullYear): + (JSC::dateProtoFuncToGMTString): + (JSC::dateProtoFuncGetMonth): + (JSC::dateProtoFuncGetUTCMonth): + (JSC::dateProtoFuncGetDate): + (JSC::dateProtoFuncGetUTCDate): + (JSC::dateProtoFuncGetDay): + (JSC::dateProtoFuncGetUTCDay): + (JSC::dateProtoFuncGetHours): + (JSC::dateProtoFuncGetUTCHours): + (JSC::dateProtoFuncGetMinutes): + (JSC::dateProtoFuncGetUTCMinutes): + (JSC::dateProtoFuncGetSeconds): + (JSC::dateProtoFuncGetUTCSeconds): + (JSC::dateProtoFuncGetTimezoneOffset): + (JSC::setNewValueFromTimeArgs): + (JSC::setNewValueFromDateArgs): + (JSC::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): Renamed getGregorianDateTime to gregorianDateTime, + since it no longer has an out parameter. Uses 0 to indicate invalid dates. + +2009-10-30 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's ListHashSet + https://bugs.webkit.org/show_bug.cgi?id=30853 + + Inherits ListHashSet class from FastAllocBase because it is + instantiated by 'new' in WebCore/rendering/RenderBlock.cpp:1813. + + * wtf/ListHashSet.h: + +2009-10-30 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Regression: crash enumerating properties of an object with getters or setters + https://bugs.webkit.org/show_bug.cgi?id=30948 + + Add a guard to prevent us trying to cache property enumeration on + objects with getters or setters. + + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): + +2009-10-30 Roland Steiner + + Reviewed by Eric Seidel. + + Remove ENABLE_RUBY guards as discussed with Dave Hyatt and Maciej Stachowiak. + + Bug 28420 - Implement HTML5 rendering + (https://bugs.webkit.org/show_bug.cgi?id=28420) + + No new tests (no functional change). + + * Configurations/FeatureDefines.xcconfig: + +2009-10-29 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + REGRESSION (r50218-r50262): E*TRADE accounts page is missing content + https://bugs.webkit.org/show_bug.cgi?id=30947 + + + The logic for flagging that a structure has non-enumerable properties + was in addPropertyWithoutTransition, rather than in the core Structure::put + method. Despite this I was unable to produce a testcase that caused + the failure that etrade was experiencing, but the new assertion in + getEnumerablePropertyNames triggers on numerous layout tests without + the fix, so in effecti all for..in enumeration in any test ends up + doing the required consistency check. + + * runtime/Structure.cpp: + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::put): + (JSC::Structure::getEnumerablePropertyNames): + (JSC::Structure::checkConsistency): 2009-10-29 Gabor Loki diff --git a/src/3rdparty/webkit/JavaScriptCore/Info.plist b/src/3rdparty/webkit/JavaScriptCore/Info.plist index 17949b0..77c9eb8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/Info.plist +++ b/src/3rdparty/webkit/JavaScriptCore/Info.plist @@ -1,5 +1,5 @@ - + CFBundleDevelopmentRegion @@ -7,7 +7,7 @@ CFBundleExecutable ${PRODUCT_NAME} CFBundleGetInfoString - ${BUNDLE_VERSION}, Copyright 2003-2009 Apple Inc.; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2001 Peter Kelly <pmk@post.com>; Copyright 1997-2005 University of Cambridge; Copyright 1991, 2000, 2001 by Lucent Technologies. + ${BUNDLE_VERSION}, Copyright 2003-2010 Apple Inc.; Copyright 1999-2001 Harri Porten <porten@kde.org>; Copyright 2001 Peter Kelly <pmk@post.com>; Copyright 1997-2005 University of Cambridge; Copyright 1991, 2000, 2001 by Lucent Technologies. CFBundleIdentifier com.apple.${PRODUCT_NAME} CFBundleInfoDictionaryVersion diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi index 03c23c3..c0eb086 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi @@ -64,6 +64,7 @@ 'bytecode/StructureStubInfo.h', 'bytecompiler/BytecodeGenerator.cpp', 'bytecompiler/BytecodeGenerator.h', + 'bytecompiler/NodesCodegen.cpp', 'bytecompiler/Label.h', 'bytecompiler/LabelScope.h', 'bytecompiler/RegisterID.h', @@ -119,6 +120,7 @@ 'jit/JITInlineMethods.h', 'jit/JITOpcodes.cpp', 'jit/JITPropertyAccess.cpp', + 'jit/JITPropertyAccess32_64.cpp', 'jit/JITStubCall.h', 'jit/JITStubs.cpp', 'jit/JITStubs.h', @@ -148,8 +150,6 @@ 'pcre/ucpinternal.h', 'pcre/ucptable.cpp', 'profiler/CallIdentifier.h', - 'profiler/HeavyProfile.cpp', - 'profiler/HeavyProfile.h', 'profiler/Profile.cpp', 'profiler/Profile.h', 'profiler/ProfileGenerator.cpp', @@ -159,8 +159,6 @@ 'profiler/Profiler.cpp', 'profiler/Profiler.h', 'profiler/ProfilerServer.h', - 'profiler/TreeProfile.cpp', - 'profiler/TreeProfile.h', 'runtime/ArgList.cpp', 'runtime/ArgList.h', 'runtime/Arguments.cpp', @@ -332,6 +330,7 @@ 'runtime/Tracing.h', 'runtime/UString.cpp', 'runtime/UString.h', + 'runtime/WeakRandom.h', 'wrec/CharacterClass.cpp', 'wrec/CharacterClass.h', 'wrec/CharacterClassConstructor.cpp', @@ -369,8 +368,8 @@ 'wtf/FastMalloc.h', 'wtf/Forward.h', 'wtf/GetPtr.h', - 'wtf/GOwnPtr.cpp', - 'wtf/GOwnPtr.h', + 'wtf/gtk/GOwnPtr.cpp', + 'wtf/gtk/GOwnPtr.h', 'wtf/gtk/MainThreadGtk.cpp', 'wtf/gtk/ThreadingGtk.cpp', 'wtf/HashCountedSet.h', @@ -400,8 +399,6 @@ 'wtf/PassRefPtr.h', 'wtf/Platform.h', 'wtf/PtrAndFlags.h', - 'wtf/qt/MainThreadQt.cpp', - 'wtf/qt/ThreadingQt.cpp', 'wtf/RandomNumber.cpp', 'wtf/RandomNumber.h', 'wtf/RandomNumberSeed.h', @@ -414,11 +411,16 @@ 'wtf/SegmentedVector.h', 'wtf/StdLibExtras.h', 'wtf/StringExtras.h', + 'wtf/StringHashFunctions.h', 'wtf/TCPackedCache.h', + 'wtf/qt/MainThreadQt.cpp', + 'wtf/qt/ThreadingQt.cpp', 'wtf/TCPageMap.h', 'wtf/TCSpinLock.h', 'wtf/TCSystemAlloc.cpp', 'wtf/TCSystemAlloc.h', + 'wtf/ThreadIdentifierDataPthreads.cpp', + 'wtf/ThreadIdentifierDataPthreads.h', 'wtf/Threading.cpp', 'wtf/Threading.h', 'wtf/ThreadingNone.cpp', @@ -440,6 +442,7 @@ 'wtf/unicode/UTF8.cpp', 'wtf/unicode/UTF8.h', 'wtf/UnusedParam.h', + 'wtf/ValueCheck.h', 'wtf/Vector.h', 'wtf/VectorTraits.h', 'wtf/VMTags.h', diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order index 3ae3ec6..d6f6caa 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.order @@ -1625,7 +1625,6 @@ __ZN3JSC18EmptyStatementNode12emitBytecodeERNS_17BytecodeGeneratorEPNS_10Registe __ZN3JSCL27compareByStringPairForQSortEPKvS1_ __Z22jsc_pcre_ucp_othercasej __ZN3JSCL35objectProtoFuncPropertyIsEnumerableEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE -__ZNK3JSC8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj __ZN3WTF7HashMapIjN3JSC7JSValueENS_7IntHashIjEENS_10HashTraitsIjEENS5_IS2_EEE3setERKjRKS2_ __ZN3WTF9HashTableIjSt4pairIjN3JSC7JSValueEENS_18PairFirstExtractorIS4_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIjEE __ZN3JSC12RegisterFile21releaseExcessCapacityEv @@ -1841,7 +1840,6 @@ __ZN3JSC6JSCell14toThisJSStringEPNS_9ExecStateE __ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE __ZN3JSCL27objectProtoFuncLookupSetterEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE __ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE -__ZNK3JSC16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj __ZN3JSC9ExecState22regExpConstructorTableEPS0_ __ZN3JSCL24regExpConstructorDollar7EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE __ZN3JSCL24regExpConstructorDollar8EPNS_9ExecStateERKNS_10IdentifierERKNS_12PropertySlotE diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index bb531e5..d4cfe10 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -1,14 +1,23 @@ # JavaScriptCore - Qt4 build info VPATH += $$PWD +CONFIG(standalone_package) { + isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/generated +} else { + isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = generated +} + CONFIG(debug, debug|release) { - isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = generated$${QMAKE_DIR_SEP}debug OBJECTS_DIR = obj/debug } else { # Release - isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = generated$${QMAKE_DIR_SEP}release OBJECTS_DIR = obj/release } +symbian: { + # Need to guarantee this comes before system includes of /epoc32/include + MMP_RULES += "USERINCLUDE ../JavaScriptCore/profiler" +} + INCLUDEPATH = \ $$PWD \ $$PWD/.. \ @@ -19,6 +28,7 @@ INCLUDEPATH = \ $$PWD/interpreter \ $$PWD/jit \ $$PWD/parser \ + $$PWD/pcre \ $$PWD/profiler \ $$PWD/runtime \ $$PWD/wrec \ @@ -27,12 +37,11 @@ INCLUDEPATH = \ $$PWD/yarr \ $$PWD/API \ $$PWD/ForwardingHeaders \ - $$GENERATED_SOURCES_DIR \ + $$JSC_GENERATED_SOURCES_DIR \ $$INCLUDEPATH DEFINES += BUILDING_QT__ BUILDING_JavaScriptCore BUILDING_WTF -GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP} win32-* { LIBS += -lwinmm } @@ -47,11 +56,6 @@ contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_YARR=0 } -# In debug mode JIT disabled until crash fixed -win32-* { - CONFIG(debug):!contains(DEFINES, ENABLE_JIT=1): DEFINES+=ENABLE_JIT=0 -} - # Rules when JIT enabled (not disabled) !contains(DEFINES, ENABLE_JIT=0) { linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { @@ -68,33 +72,7 @@ wince* { include(pcre/pcre.pri) -LUT_FILES += \ - runtime/DatePrototype.cpp \ - runtime/JSONObject.cpp \ - runtime/NumberConstructor.cpp \ - runtime/StringPrototype.cpp \ - runtime/ArrayPrototype.cpp \ - runtime/MathObject.cpp \ - runtime/RegExpConstructor.cpp \ - runtime/RegExpObject.cpp - -KEYWORDLUT_FILES += \ - parser/Keywords.table - -JSCBISON += \ - parser/Grammar.y - SOURCES += \ - wtf/Assertions.cpp \ - wtf/ByteArray.cpp \ - wtf/HashTable.cpp \ - wtf/MainThread.cpp \ - wtf/RandomNumber.cpp \ - wtf/RefCountedLeakCounter.cpp \ - wtf/TypeTraits.cpp \ - wtf/unicode/CollatorDefault.cpp \ - wtf/unicode/icu/CollatorICU.cpp \ - wtf/unicode/UTF8.cpp \ API/JSBase.cpp \ API/JSCallbackConstructor.cpp \ API/JSCallbackFunction.cpp \ @@ -105,60 +83,40 @@ SOURCES += \ API/JSStringRef.cpp \ API/JSValueRef.cpp \ API/OpaqueJSString.cpp \ - runtime/InitializeThreading.cpp \ - runtime/JSGlobalData.cpp \ - runtime/JSGlobalObject.cpp \ - runtime/JSStaticScopeObject.cpp \ - runtime/JSVariableObject.cpp \ - runtime/JSActivation.cpp \ - runtime/JSNotAnObject.cpp \ - runtime/JSONObject.cpp \ - runtime/LiteralParser.cpp \ - runtime/MarkStack.cpp \ - runtime/TimeoutChecker.cpp \ - bytecode/CodeBlock.cpp \ - bytecode/StructureStubInfo.cpp \ - bytecode/JumpTable.cpp \ assembler/ARMAssembler.cpp \ assembler/MacroAssemblerARM.cpp \ - jit/JIT.cpp \ - jit/JITCall.cpp \ + bytecode/CodeBlock.cpp \ + bytecode/JumpTable.cpp \ + bytecode/Opcode.cpp \ + bytecode/SamplingTool.cpp \ + bytecode/StructureStubInfo.cpp \ + bytecompiler/BytecodeGenerator.cpp \ + bytecompiler/NodesCodegen.cpp \ + debugger/DebuggerActivation.cpp \ + debugger/DebuggerCallFrame.cpp \ + debugger/Debugger.cpp \ + interpreter/CallFrame.cpp \ + interpreter/Interpreter.cpp \ + interpreter/RegisterFile.cpp \ + jit/ExecutableAllocatorPosix.cpp \ + jit/ExecutableAllocatorSymbian.cpp \ + jit/ExecutableAllocatorWin.cpp \ + jit/ExecutableAllocator.cpp \ jit/JITArithmetic.cpp \ + jit/JITCall.cpp \ + jit/JIT.cpp \ jit/JITOpcodes.cpp \ jit/JITPropertyAccess.cpp \ - jit/ExecutableAllocator.cpp \ + jit/JITPropertyAccess32_64.cpp \ jit/JITStubs.cpp \ - bytecompiler/BytecodeGenerator.cpp \ - runtime/ExceptionHelpers.cpp \ - runtime/JSPropertyNameIterator.cpp \ - interpreter/Interpreter.cpp \ - bytecode/Opcode.cpp \ - bytecode/SamplingTool.cpp \ - yarr/RegexCompiler.cpp \ - yarr/RegexInterpreter.cpp \ - yarr/RegexJIT.cpp \ - interpreter/RegisterFile.cpp - -symbian { - SOURCES += jit/ExecutableAllocatorSymbian.cpp \ - runtime/MarkStackSymbian.cpp -} else { - win32-*|wince* { - SOURCES += jit/ExecutableAllocatorWin.cpp \ - runtime/MarkStackWin.cpp - } else { - SOURCES += jit/ExecutableAllocatorPosix.cpp \ - runtime/MarkStackPosix.cpp - } -} - -!contains(DEFINES, USE_SYSTEM_MALLOC) { - SOURCES += wtf/TCSystemAlloc.cpp -} - -# AllInOneFile.cpp helps gcc analize and optimize code -# Other compilers may be able to do this at link time -SOURCES += \ + parser/Lexer.cpp \ + parser/Nodes.cpp \ + parser/ParserArena.cpp \ + parser/Parser.cpp \ + profiler/Profile.cpp \ + profiler/ProfileGenerator.cpp \ + profiler/ProfileNode.cpp \ + profiler/Profiler.cpp \ runtime/ArgList.cpp \ runtime/Arguments.cpp \ runtime/ArrayConstructor.cpp \ @@ -169,62 +127,67 @@ SOURCES += \ runtime/CallData.cpp \ runtime/Collector.cpp \ runtime/CommonIdentifiers.cpp \ + runtime/Completion.cpp \ runtime/ConstructData.cpp \ - wtf/CurrentTime.cpp \ runtime/DateConstructor.cpp \ runtime/DateConversion.cpp \ runtime/DateInstance.cpp \ runtime/DatePrototype.cpp \ - debugger/Debugger.cpp \ - debugger/DebuggerCallFrame.cpp \ - debugger/DebuggerActivation.cpp \ - wtf/dtoa.cpp \ - runtime/Error.cpp \ runtime/ErrorConstructor.cpp \ + runtime/Error.cpp \ runtime/ErrorInstance.cpp \ runtime/ErrorPrototype.cpp \ - interpreter/CallFrame.cpp \ + runtime/ExceptionHelpers.cpp \ runtime/Executable.cpp \ runtime/FunctionConstructor.cpp \ runtime/FunctionPrototype.cpp \ runtime/GetterSetter.cpp \ runtime/GlobalEvalFunction.cpp \ runtime/Identifier.cpp \ + runtime/InitializeThreading.cpp \ runtime/InternalFunction.cpp \ - runtime/Completion.cpp \ - runtime/JSArray.cpp \ + runtime/JSActivation.cpp \ runtime/JSAPIValueWrapper.cpp \ + runtime/JSArray.cpp \ runtime/JSByteArray.cpp \ runtime/JSCell.cpp \ runtime/JSFunction.cpp \ + runtime/JSGlobalData.cpp \ + runtime/JSGlobalObject.cpp \ runtime/JSGlobalObjectFunctions.cpp \ runtime/JSImmediate.cpp \ runtime/JSLock.cpp \ + runtime/JSNotAnObject.cpp \ runtime/JSNumberCell.cpp \ runtime/JSObject.cpp \ + runtime/JSONObject.cpp \ + runtime/JSPropertyNameIterator.cpp \ + runtime/JSStaticScopeObject.cpp \ runtime/JSString.cpp \ runtime/JSValue.cpp \ + runtime/JSVariableObject.cpp \ runtime/JSWrapperObject.cpp \ - parser/Lexer.cpp \ + runtime/LiteralParser.cpp \ runtime/Lookup.cpp \ + runtime/MarkStackPosix.cpp \ + runtime/MarkStackSymbian.cpp \ + runtime/MarkStackWin.cpp \ + runtime/MarkStack.cpp \ runtime/MathObject.cpp \ runtime/NativeErrorConstructor.cpp \ runtime/NativeErrorPrototype.cpp \ - parser/Nodes.cpp \ runtime/NumberConstructor.cpp \ runtime/NumberObject.cpp \ runtime/NumberPrototype.cpp \ runtime/ObjectConstructor.cpp \ runtime/ObjectPrototype.cpp \ runtime/Operations.cpp \ - parser/Parser.cpp \ - parser/ParserArena.cpp \ runtime/PropertyDescriptor.cpp \ runtime/PropertyNameArray.cpp \ runtime/PropertySlot.cpp \ runtime/PrototypeFunction.cpp \ - runtime/RegExp.cpp \ runtime/RegExpConstructor.cpp \ + runtime/RegExp.cpp \ runtime/RegExpObject.cpp \ runtime/RegExpPrototype.cpp \ runtime/ScopeChain.cpp \ @@ -232,50 +195,38 @@ SOURCES += \ runtime/StringConstructor.cpp \ runtime/StringObject.cpp \ runtime/StringPrototype.cpp \ - runtime/Structure.cpp \ runtime/StructureChain.cpp \ + runtime/Structure.cpp \ + runtime/TimeoutChecker.cpp \ runtime/UString.cpp \ - profiler/HeavyProfile.cpp \ - profiler/Profile.cpp \ - profiler/ProfileGenerator.cpp \ - profiler/ProfileNode.cpp \ - profiler/Profiler.cpp \ - profiler/TreeProfile.cpp \ + runtime/UStringImpl.cpp \ + wtf/Assertions.cpp \ + wtf/ByteArray.cpp \ + wtf/CurrentTime.cpp \ wtf/DateMath.cpp \ + wtf/dtoa.cpp \ wtf/FastMalloc.cpp \ + wtf/HashTable.cpp \ + wtf/MainThread.cpp \ + wtf/qt/MainThreadQt.cpp \ + wtf/qt/ThreadingQt.cpp \ + wtf/RandomNumber.cpp \ + wtf/RefCountedLeakCounter.cpp \ + wtf/ThreadingNone.cpp \ wtf/Threading.cpp \ - wtf/qt/MainThreadQt.cpp - -!contains(DEFINES, ENABLE_SINGLE_THREADED=1) { - SOURCES += wtf/qt/ThreadingQt.cpp -} else { - DEFINES += ENABLE_JSC_MULTIPLE_THREADS=0 - SOURCES += wtf/ThreadingNone.cpp -} - -# GENERATOR 1-A: LUT creator -lut.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.lut.h -lut.commands = perl $$PWD/create_hash_table ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT} -lut.depend = ${QMAKE_FILE_NAME} -lut.input = LUT_FILES -lut.CONFIG += no_link -addExtraCompiler(lut) + wtf/TypeTraits.cpp \ + wtf/unicode/CollatorDefault.cpp \ + wtf/unicode/icu/CollatorICU.cpp \ + wtf/unicode/UTF8.cpp \ + yarr/RegexCompiler.cpp \ + yarr/RegexInterpreter.cpp \ + yarr/RegexJIT.cpp -# GENERATOR 1-B: particular LUT creator (for 1 file only) -keywordlut.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}Lexer.lut.h -keywordlut.commands = perl $$PWD/create_hash_table ${QMAKE_FILE_NAME} -i > ${QMAKE_FILE_OUT} -keywordlut.depend = ${QMAKE_FILE_NAME} -keywordlut.input = KEYWORDLUT_FILES -keywordlut.CONFIG += no_link -addExtraCompiler(keywordlut) +# Generated files, simply list them for JavaScriptCore +SOURCES += \ + $${JSC_GENERATED_SOURCES_DIR}/Grammar.cpp -# GENERATOR 2: bison grammar -jscbison.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp -jscbison.commands = bison -d -p jscyy ${QMAKE_FILE_NAME} -o $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c && $(MOVE) $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.c ${QMAKE_FILE_OUT} && $(MOVE) $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.tab.h $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.h -jscbison.depend = ${QMAKE_FILE_NAME} -jscbison.input = JSCBISON -jscbison.variable_out = GENERATED_SOURCES -jscbison.dependency_type = TYPE_C -jscbison.CONFIG = target_predeps -addExtraCompilerWithHeader(jscbison) +!contains(DEFINES, USE_SYSTEM_MALLOC) { + SOURCES += wtf/TCSystemAlloc.cpp +} diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index a1affd4..0d6becb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -52,17 +52,11 @@ win32-g++ { QMAKE_LIBDIR_POST += $$split(TMPPATH,";") } -DEFINES += WTF_USE_JAVASCRIPTCORE_BINDINGS=1 - DEFINES += WTF_CHANGES=1 include(JavaScriptCore.pri) QMAKE_EXTRA_TARGETS += generated_files -lessThan(QT_MINOR_VERSION, 4) { - DEFINES += QT_BEGIN_NAMESPACE="" QT_END_NAMESPACE="" -} - *-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2 *-g++*:QMAKE_CXXFLAGS_RELEASE += -O3 diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp index 1324586..6dd2b87 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #include "ARMAssembler.h" @@ -34,39 +34,6 @@ namespace JSC { // Patching helpers -ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool) -{ - // Must be an ldr ..., [pc +/- imm] - ASSERT((*insn & 0x0f7f0000) == 0x051f0000); - - if (constPool && (*insn & 0x1)) - return reinterpret_cast(constPool + ((*insn & SDT_OFFSET_MASK) >> 1)); - - ARMWord addr = reinterpret_cast(insn) + 2 * sizeof(ARMWord); - if (*insn & DT_UP) - return reinterpret_cast(addr + (*insn & SDT_OFFSET_MASK)); - else - return reinterpret_cast(addr - (*insn & SDT_OFFSET_MASK)); -} - -void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool) -{ - ARMWord* insn = reinterpret_cast(code) + (from.m_offset / sizeof(ARMWord)); - - if (!useConstantPool) { - int diff = reinterpret_cast(to) - reinterpret_cast(insn + 2); - - if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { - *insn = B | getConditionalField(*insn) | (diff & BRANCH_MASK); - ExecutableAllocator::cacheFlush(insn, sizeof(ARMWord)); - return; - } - } - ARMWord* addr = getLdrImmAddress(insn); - *addr = reinterpret_cast(to); - ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord)); -} - void ARMAssembler::patchConstantPoolLoad(void* loadAddr, void* constPoolAddr) { ARMWord *ldr = reinterpret_cast(loadAddr); @@ -118,7 +85,7 @@ ARMWord ARMAssembler::getOp2(ARMWord imm) if ((imm & 0x00ffffff) == 0) return OP2_IMM | (imm >> 24) | (rol << 8); - return 0; + return INVALID_IMM; } int ARMAssembler::genInt(int reg, ARMWord imm, bool positive) @@ -236,25 +203,18 @@ ARMWord ARMAssembler::getImm(ARMWord imm, int tmpReg, bool invert) // Do it by 1 instruction tmp = getOp2(imm); - if (tmp) + if (tmp != INVALID_IMM) return tmp; tmp = getOp2(~imm); - if (tmp) { + if (tmp != INVALID_IMM) { if (invert) return tmp | OP2_INV_IMM; mvn_r(tmpReg, tmp); return tmpReg; } - // Do it by 2 instruction - if (genInt(tmpReg, imm, true)) - return tmpReg; - if (genInt(tmpReg, ~imm, false)) - return tmpReg; - - ldr_imm(tmpReg, imm); - return tmpReg; + return encodeComplexImm(imm, tmpReg); } void ARMAssembler::moveImm(ARMWord imm, int dest) @@ -263,24 +223,41 @@ void ARMAssembler::moveImm(ARMWord imm, int dest) // Do it by 1 instruction tmp = getOp2(imm); - if (tmp) { + if (tmp != INVALID_IMM) { mov_r(dest, tmp); return; } tmp = getOp2(~imm); - if (tmp) { + if (tmp != INVALID_IMM) { mvn_r(dest, tmp); return; } + encodeComplexImm(imm, dest); +} + +ARMWord ARMAssembler::encodeComplexImm(ARMWord imm, int dest) +{ +#if WTF_ARM_ARCH_AT_LEAST(7) + ARMWord tmp = getImm16Op2(imm); + if (tmp != INVALID_IMM) { + movw_r(dest, tmp); + return dest; + } + movw_r(dest, getImm16Op2(imm & 0xffff)); + movt_r(dest, getImm16Op2(imm >> 16)); + return dest; +#else // Do it by 2 instruction if (genInt(dest, imm, true)) - return; + return dest; if (genInt(dest, ~imm, false)) - return; + return dest; ldr_imm(dest, imm); + return dest; +#endif } // Memory load/store helpers @@ -378,10 +355,17 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) // The last bit is set if the constant must be placed on constant pool. int pos = (*iter) & (~0x1); ARMWord* ldrAddr = reinterpret_cast(data + pos); - ARMWord offset = *getLdrImmAddress(ldrAddr); - if (offset != 0xffffffff) { - JmpSrc jmpSrc(pos); - linkBranch(data, jmpSrc, data + offset, ((*iter) & 1)); + ARMWord* addr = getLdrImmAddress(ldrAddr); + if (*addr != 0xffffffff) { + if (!(*iter & 1)) { + int diff = reinterpret_cast(data + *addr) - (ldrAddr + DefaultPrefetching); + + if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { + *ldrAddr = B | getConditionalField(*ldrAddr) | (diff & BRANCH_MASK); + continue; + } + } + *addr = reinterpret_cast(data + *addr); } } @@ -390,4 +374,4 @@ void* ARMAssembler::executableCopy(ExecutablePool* allocator) } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h index 9f9a450..6967b37 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMAssembler.h @@ -29,7 +29,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #include "AssemblerBufferWithConstantPool.h" #include @@ -121,6 +121,7 @@ namespace JSC { MUL = 0x00000090, MULL = 0x00c00090, FADDD = 0x0e300b00, + FDIVD = 0x0e800b00, FSUBD = 0x0e300b40, FMULD = 0x0e200b00, FCMPD = 0x0eb40b40, @@ -133,12 +134,18 @@ namespace JSC { B = 0x0a000000, BL = 0x0b000000, FMSR = 0x0e000a10, + FMRS = 0x0e100a10, FSITOD = 0x0eb80bc0, + FTOSID = 0x0ebd0b40, FMSTAT = 0x0ef1fa10, -#if ARM_ARCH_VERSION >= 5 +#if WTF_ARM_ARCH_AT_LEAST(5) CLZ = 0x016f0f10, BKPT = 0xe120070, #endif +#if WTF_ARM_ARCH_AT_LEAST(7) + MOVW = 0x03000000, + MOVT = 0x03400000, +#endif }; enum { @@ -175,6 +182,9 @@ namespace JSC { padForAlign32 = 0xee120070, }; + static const ARMWord INVALID_IMM = 0xf0000000; + static const int DefaultPrefetching = 2; + class JmpSrc { friend class ARMAssembler; public: @@ -333,6 +343,20 @@ namespace JSC { emitInst(static_cast(cc) | MOV, rd, ARMRegisters::r0, op2); } +#if WTF_ARM_ARCH_AT_LEAST(7) + void movw_r(int rd, ARMWord op2, Condition cc = AL) + { + ASSERT((op2 | 0xf0fff) == 0xf0fff); + m_buffer.putInt(static_cast(cc) | MOVW | RD(rd) | op2); + } + + void movt_r(int rd, ARMWord op2, Condition cc = AL) + { + ASSERT((op2 | 0xf0fff) == 0xf0fff); + m_buffer.putInt(static_cast(cc) | MOVT | RD(rd) | op2); + } +#endif + void movs_r(int rd, ARMWord op2, Condition cc = AL) { emitInst(static_cast(cc) | MOV | SET_CC, rd, ARMRegisters::r0, op2); @@ -378,6 +402,11 @@ namespace JSC { emitInst(static_cast(cc) | FADDD, dd, dn, dm); } + void fdivd_r(int dd, int dn, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FDIVD, dd, dn, dm); + } + void fsubd_r(int dd, int dn, int dm, Condition cc = AL) { emitInst(static_cast(cc) | FSUBD, dd, dn, dm); @@ -482,17 +511,27 @@ namespace JSC { emitInst(static_cast(cc) | FMSR, rn, dd, 0); } + void fmrs_r(int rd, int dn, Condition cc = AL) + { + emitInst(static_cast(cc) | FMRS, rd, dn, 0); + } + void fsitod_r(int dd, int dm, Condition cc = AL) { emitInst(static_cast(cc) | FSITOD, dd, 0, dm); } + void ftosid_r(int fd, int dm, Condition cc = AL) + { + emitInst(static_cast(cc) | FTOSID, fd, 0, dm); + } + void fmstat(Condition cc = AL) { m_buffer.putInt(static_cast(cc) | FMSTAT); } -#if ARM_ARCH_VERSION >= 5 +#if WTF_ARM_ARCH_AT_LEAST(5) void clz_r(int rd, int rm, Condition cc = AL) { m_buffer.putInt(static_cast(cc) | CLZ | RD(rd) | RM(rm)); @@ -501,7 +540,7 @@ namespace JSC { void bkpt(ARMWord value) { -#if ARM_ARCH_VERSION >= 5 +#if WTF_ARM_ARCH_AT_LEAST(5) m_buffer.putInt(BKPT | ((value & 0xff0) << 4) | (value & 0xf)); #else // Cannot access to Zero memory address @@ -594,15 +633,32 @@ namespace JSC { // Patching helpers - static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0); - static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0); + static ARMWord* getLdrImmAddress(ARMWord* insn) + { + // Must be an ldr ..., [pc +/- imm] + ASSERT((*insn & 0x0f7f0000) == 0x051f0000); + + ARMWord addr = reinterpret_cast(insn) + DefaultPrefetching * sizeof(ARMWord); + if (*insn & DT_UP) + return reinterpret_cast(addr + (*insn & SDT_OFFSET_MASK)); + return reinterpret_cast(addr - (*insn & SDT_OFFSET_MASK)); + } + + static ARMWord* getLdrImmAddressOnPool(ARMWord* insn, uint32_t* constPool) + { + // Must be an ldr ..., [pc +/- imm] + ASSERT((*insn & 0x0f7f0000) == 0x051f0000); + + if (*insn & 0x1) + return reinterpret_cast(constPool + ((*insn & SDT_OFFSET_MASK) >> 1)); + return getLdrImmAddress(insn); + } static void patchPointerInternal(intptr_t from, void* to) { ARMWord* insn = reinterpret_cast(from); ARMWord* addr = getLdrImmAddress(insn); *addr = reinterpret_cast(to); - ExecutableAllocator::cacheFlush(addr, sizeof(ARMWord)); } static ARMWord patchConstantPoolLoad(ARMWord load, ARMWord value) @@ -647,12 +703,13 @@ namespace JSC { void linkJump(JmpSrc from, JmpDst to) { ARMWord* insn = reinterpret_cast(m_buffer.data()) + (from.m_offset / sizeof(ARMWord)); - *getLdrImmAddress(insn, m_buffer.poolAddress()) = static_cast(to.m_offset); + ARMWord* addr = getLdrImmAddressOnPool(insn, m_buffer.poolAddress()); + *addr = static_cast(to.m_offset); } static void linkJump(void* code, JmpSrc from, void* to) { - linkBranch(code, from, to); + patchPointerInternal(reinterpret_cast(code) + from.m_offset, to); } static void relinkJump(void* from, void* to) @@ -662,12 +719,12 @@ namespace JSC { static void linkCall(void* code, JmpSrc from, void* to) { - linkBranch(code, from, to, true); + patchPointerInternal(reinterpret_cast(code) + from.m_offset, to); } static void relinkCall(void* from, void* to) { - relinkJump(from, to); + patchPointerInternal(reinterpret_cast(from) - sizeof(ARMWord), to); } // Address operations @@ -708,8 +765,18 @@ namespace JSC { } static ARMWord getOp2(ARMWord imm); + +#if WTF_ARM_ARCH_AT_LEAST(7) + static ARMWord getImm16Op2(ARMWord imm) + { + if (imm <= 0xffff) + return (imm & 0xf000) << 4 | (imm & 0xfff); + return INVALID_IMM; + } +#endif ARMWord getImm(ARMWord imm, int tmpReg, bool invert = false); void moveImm(ARMWord imm, int dest); + ARMWord encodeComplexImm(ARMWord imm, int dest); // Memory load/store helpers @@ -764,6 +831,6 @@ namespace JSC { } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h index 02ce2e9..4e394b2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/ARMv7Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) +#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) #include "AssemblerBuffer.h" #include @@ -201,10 +201,10 @@ class ARMThumbImmediate { ALWAYS_INLINE static void countLeadingZerosPartial(uint32_t& value, int32_t& zeros, const int N) { - if (value & ~((1<>= N; /* if any were set, lose the bottom N */ \ - else /* if none of the top N bits are set, */ \ - zeros += N; /* then we have identified N leading zeros */ + if (value & ~((1 << N) - 1)) /* check for any of the top N bits (of 2N bits) are set */ + value >>= N; /* if any were set, lose the bottom N */ + else /* if none of the top N bits are set, */ + zeros += N; /* then we have identified N leading zeros */ } static int32_t countLeadingZeros(uint32_t value) @@ -236,6 +236,11 @@ class ARMThumbImmediate { ARMThumbImmediate(ThumbImmediateType type, uint16_t value) : m_type(TypeUInt16) { + // Make sure this constructor is only reached with type TypeUInt16; + // this extra parameter makes the code a little clearer by making it + // explicit at call sites which type is being constructed + ASSERT_UNUSED(type, type == TypeUInt16); + m_value.asInt = value; } @@ -1827,6 +1832,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_THUMB2) +#endif // ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) #endif // ARMAssembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h index 525fe98..198e8d1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -173,16 +173,16 @@ public: struct Imm32 { explicit Imm32(int32_t value) : m_value(value) -#if PLATFORM(ARM) +#if CPU(ARM) , m_isPointer(false) #endif { } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) explicit Imm32(ImmPtr ptr) : m_value(ptr.asIntptr()) -#if PLATFORM(ARM) +#if CPU(ARM) , m_isPointer(true) #endif { @@ -190,7 +190,7 @@ public: #endif int32_t m_value; -#if PLATFORM(ARM) +#if CPU(ARM) // We rely on being able to regenerate code to recover exception handling // information. Since ARMv7 supports 16-bit immediates there is a danger // that if pointer values change the layout of the generated code will change. diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h index 2743ab4..76bd205 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssembler.h @@ -30,19 +30,19 @@ #if ENABLE(ASSEMBLER) -#if PLATFORM(ARM_THUMB2) +#if CPU(ARM_THUMB2) #include "MacroAssemblerARMv7.h" namespace JSC { typedef MacroAssemblerARMv7 MacroAssemblerBase; }; -#elif PLATFORM(ARM_TRADITIONAL) +#elif CPU(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" namespace JSC { typedef MacroAssemblerARM MacroAssemblerBase; }; -#elif PLATFORM(X86) +#elif CPU(X86) #include "MacroAssemblerX86.h" namespace JSC { typedef MacroAssemblerX86 MacroAssemblerBase; }; -#elif PLATFORM(X86_64) +#elif CPU(X86_64) #include "MacroAssemblerX86_64.h" namespace JSC { typedef MacroAssemblerX86_64 MacroAssemblerBase; }; @@ -60,7 +60,7 @@ public: using MacroAssemblerBase::jump; using MacroAssemblerBase::branch32; using MacroAssemblerBase::branch16; -#if PLATFORM(X86_64) +#if CPU(X86_64) using MacroAssemblerBase::branchPtr; using MacroAssemblerBase::branchTestPtr; #endif @@ -133,7 +133,8 @@ public: // Ptr methods // On 32-bit platforms (i.e. x86), these methods directly map onto their 32-bit equivalents. -#if !PLATFORM(X86_64) + // FIXME: should this use a test for 32-bitness instead of this specific exception? +#if !CPU(X86_64) void addPtr(RegisterID src, RegisterID dest) { add32(src, dest); @@ -179,16 +180,6 @@ public: or32(imm, dest); } - void rshiftPtr(RegisterID shift_amount, RegisterID dest) - { - rshift32(shift_amount, dest); - } - - void rshiftPtr(Imm32 imm, RegisterID dest) - { - rshift32(imm, dest); - } - void subPtr(RegisterID src, RegisterID dest) { sub32(src, dest); diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp index d726ecd..b5b20fa 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.cpp @@ -26,11 +26,11 @@ #include "config.h" -#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #include "MacroAssemblerARM.h" -#if PLATFORM(LINUX) +#if OS(LINUX) #include #include #include @@ -43,7 +43,7 @@ namespace JSC { static bool isVFPPresent() { -#if PLATFORM(LINUX) +#if OS(LINUX) int fd = open("/proc/self/auxv", O_RDONLY); if (fd > 0) { Elf32_auxv_t aux; @@ -62,7 +62,8 @@ static bool isVFPPresent() const bool MacroAssemblerARM::s_isVFPPresent = isVFPPresent(); -#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT +#if CPU(ARMV5_OR_LOWER) +/* On ARMv5 and below, natural alignment is required. */ void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) { ARMWord op2; @@ -91,4 +92,4 @@ void MacroAssemblerARM::load32WithUnalignedHalfWords(BaseIndex address, Register } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h index 7a72b06..21b8de8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -30,7 +30,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #include "ARMAssembler.h" #include "AbstractMacroAssembler.h" @@ -38,6 +38,9 @@ namespace JSC { class MacroAssemblerARM : public AbstractMacroAssembler { + static const int DoubleConditionMask = 0x0f; + static const int DoubleConditionBitSpecial = 0x10; + COMPILE_ASSERT(!(DoubleConditionBitSpecial & DoubleConditionMask), DoubleConditionBitSpecial_should_not_interfere_with_ARMAssembler_Condition_codes); public: enum Condition { Equal = ARMAssembler::EQ, @@ -57,11 +60,20 @@ public: }; enum DoubleCondition { + // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. DoubleEqual = ARMAssembler::EQ, + DoubleNotEqual = ARMAssembler::NE | DoubleConditionBitSpecial, DoubleGreaterThan = ARMAssembler::GT, DoubleGreaterThanOrEqual = ARMAssembler::GE, - DoubleLessThan = ARMAssembler::LT, - DoubleLessThanOrEqual = ARMAssembler::LE, + DoubleLessThan = ARMAssembler::CC, + DoubleLessThanOrEqual = ARMAssembler::LS, + // If either operand is NaN, these conditions always evaluate to true. + DoubleEqualOrUnordered = ARMAssembler::EQ | DoubleConditionBitSpecial, + DoubleNotEqualOrUnordered = ARMAssembler::NE, + DoubleGreaterThanOrUnordered = ARMAssembler::HI, + DoubleGreaterThanOrEqualOrUnordered = ARMAssembler::CS, + DoubleLessThanOrUnordered = ARMAssembler::LT, + DoubleLessThanOrEqualOrUnordered = ARMAssembler::LE, }; static const RegisterID stackPointerRegister = ARMRegisters::sp; @@ -106,14 +118,18 @@ public: m_assembler.ands_r(dest, dest, w); } - void lshift32(Imm32 imm, RegisterID dest) + void lshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.movs_r(dest, m_assembler.lsl(dest, imm.m_value & 0x1f)); + ARMWord w = ARMAssembler::getOp2(0x1f); + ASSERT(w != ARMAssembler::INVALID_IMM); + m_assembler.and_r(ARMRegisters::S0, shift_amount, w); + + m_assembler.movs_r(dest, m_assembler.lsl_r(dest, ARMRegisters::S0)); } - void lshift32(RegisterID shift_amount, RegisterID dest) + void lshift32(Imm32 imm, RegisterID dest) { - m_assembler.movs_r(dest, m_assembler.lsl_r(dest, shift_amount)); + m_assembler.movs_r(dest, m_assembler.lsl(dest, imm.m_value & 0x1f)); } void mul32(RegisterID src, RegisterID dest) @@ -131,6 +147,11 @@ public: m_assembler.muls_r(dest, src, ARMRegisters::S0); } + void neg32(RegisterID srcDest) + { + m_assembler.rsbs_r(srcDest, srcDest, ARMAssembler::getOp2(0)); + } + void not32(RegisterID dest) { m_assembler.mvns_r(dest, dest); @@ -148,7 +169,11 @@ public: void rshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.movs_r(dest, m_assembler.asr_r(dest, shift_amount)); + ARMWord w = ARMAssembler::getOp2(0x1f); + ASSERT(w != ARMAssembler::INVALID_IMM); + m_assembler.and_r(ARMRegisters::S0, shift_amount, w); + + m_assembler.movs_r(dest, m_assembler.asr_r(dest, ARMRegisters::S0)); } void rshift32(Imm32 imm, RegisterID dest) @@ -199,7 +224,7 @@ public: m_assembler.baseIndexTransfer32(true, dest, address.base, address.index, static_cast(address.scale), address.offset); } -#if defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_REQUIRE_NATURAL_ALIGNMENT +#if CPU(ARMV5_OR_LOWER) void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest); #else void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest) @@ -505,6 +530,13 @@ public: return Jump(m_assembler.jmp(ARMCondition(cond))); } + Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) + { + ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); + or32(src, dest); + return Jump(m_assembler.jmp(ARMCondition(cond))); + } + void breakpoint() { m_assembler.bkpt(0); @@ -548,6 +580,25 @@ public: m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } + void set8(Condition cond, RegisterID left, RegisterID right, RegisterID dest) + { + // ARM doesn't have byte registers + set32(cond, left, right, dest); + } + + void set8(Condition cond, Address left, RegisterID right, RegisterID dest) + { + // ARM doesn't have byte registers + load32(left, ARMRegisters::S1); + set32(cond, ARMRegisters::S1, right, dest); + } + + void set8(Condition cond, RegisterID left, Imm32 right, RegisterID dest) + { + // ARM doesn't have byte registers + set32(cond, left, right, dest); + } + void setTest32(Condition cond, Address address, Imm32 mask, RegisterID dest) { load32(address, ARMRegisters::S1); @@ -559,6 +610,12 @@ public: m_assembler.mov_r(dest, ARMAssembler::getOp2(1), ARMCondition(cond)); } + void setTest8(Condition cond, Address address, Imm32 mask, RegisterID dest) + { + // ARM doesn't have byte registers + setTest32(cond, address, mask, dest); + } + void add32(Imm32 imm, RegisterID src, RegisterID dest) { m_assembler.add_r(dest, src, m_assembler.getImm(imm.m_value, ARMRegisters::S0)); @@ -666,6 +723,12 @@ public: m_assembler.doubleTransfer(true, dest, address.base, address.offset); } + void loadDouble(void* address, FPRegisterID dest) + { + m_assembler.ldr_un_imm(ARMRegisters::S0, (ARMWord)address); + m_assembler.fdtr_u(true, dest, ARMRegisters::S0, 0); + } + void storeDouble(FPRegisterID src, ImplicitAddress address) { m_assembler.doubleTransfer(false, src, address.base, address.offset); @@ -682,6 +745,18 @@ public: addDouble(ARMRegisters::SD0, dest); } + void divDouble(FPRegisterID src, FPRegisterID dest) + { + m_assembler.fdivd_r(dest, dest, src); + } + + void divDouble(Address src, FPRegisterID dest) + { + ASSERT_NOT_REACHED(); // Untested + loadDouble(src, ARMRegisters::SD0); + divDouble(ARMRegisters::SD0, dest); + } + void subDouble(FPRegisterID src, FPRegisterID dest) { m_assembler.fsubd_r(dest, dest, src); @@ -710,11 +785,30 @@ public: m_assembler.fsitod_r(dest, dest); } + void convertInt32ToDouble(Address src, FPRegisterID dest) + { + ASSERT_NOT_REACHED(); // Untested + // flds does not worth the effort here + load32(src, ARMRegisters::S1); + convertInt32ToDouble(ARMRegisters::S1, dest); + } + + void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) + { + ASSERT_NOT_REACHED(); // Untested + // flds does not worth the effort here + m_assembler.ldr_un_imm(ARMRegisters::S1, (ARMWord)src.m_ptr); + m_assembler.dtr_u(true, ARMRegisters::S1, ARMRegisters::S1, 0); + convertInt32ToDouble(ARMRegisters::S1, dest); + } + Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { m_assembler.fcmpd_r(left, right); m_assembler.fmstat(); - return Jump(m_assembler.jmp(static_cast(cond))); + if (cond & DoubleConditionBitSpecial) + m_assembler.cmp_r(ARMRegisters::S0, ARMRegisters::S0, ARMAssembler::VS); + return Jump(m_assembler.jmp(static_cast(cond & ~DoubleConditionMask))); } // Truncates 'src' to an integer, and places the resulting 'dest'. @@ -729,6 +823,29 @@ public: return jump(); } + // Convert 'src' to an integer, and places the resulting 'dest'. + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, 0). + void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) + { + m_assembler.ftosid_r(ARMRegisters::SD0, src); + m_assembler.fmrs_r(dest, ARMRegisters::SD0); + + // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. + m_assembler.fsitod_r(ARMRegisters::SD0, ARMRegisters::SD0); + failureCases.append(branchDouble(DoubleNotEqualOrUnordered, src, ARMRegisters::SD0)); + + // If the result is zero, it might have been -0.0, and 0.0 equals to -0.0 + failureCases.append(branchTest32(Zero, dest)); + } + + void zeroDouble(FPRegisterID srcDest) + { + m_assembler.mov_r(ARMRegisters::S0, ARMAssembler::getOp2(0)); + convertInt32ToDouble(ARMRegisters::S0, srcDest); + } + protected: ARMAssembler::Condition ARMCondition(Condition cond) { @@ -811,6 +928,6 @@ private: } -#endif // ENABLE(ASSEMBLER) && PLATFORM(ARM_TRADITIONAL) +#endif // ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) #endif // MacroAssemblerARM_h diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h index c479517..532a9cf 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerARMv7.h @@ -93,13 +93,21 @@ public: Zero = ARMv7Assembler::ConditionEQ, NonZero = ARMv7Assembler::ConditionNE }; - enum DoubleCondition { + // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. DoubleEqual = ARMv7Assembler::ConditionEQ, + DoubleNotEqual = ARMv7Assembler::ConditionVC, // Not the right flag! check for this & handle differently. DoubleGreaterThan = ARMv7Assembler::ConditionGT, DoubleGreaterThanOrEqual = ARMv7Assembler::ConditionGE, DoubleLessThan = ARMv7Assembler::ConditionLO, DoubleLessThanOrEqual = ARMv7Assembler::ConditionLS, + // If either operand is NaN, these conditions always evaluate to true. + DoubleEqualOrUnordered = ARMv7Assembler::ConditionVS, // Not the right flag! check for this & handle differently. + DoubleNotEqualOrUnordered = ARMv7Assembler::ConditionNE, + DoubleGreaterThanOrUnordered = ARMv7Assembler::ConditionHI, + DoubleGreaterThanOrEqualOrUnordered = ARMv7Assembler::ConditionHS, + DoubleLessThanOrUnordered = ARMv7Assembler::ConditionLT, + DoubleLessThanOrEqualOrUnordered = ARMv7Assembler::ConditionLE, }; static const RegisterID stackPointerRegister = ARMRegisters::sp; @@ -189,14 +197,19 @@ public: } } - void lshift32(Imm32 imm, RegisterID dest) + void lshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.lsl(dest, dest, imm.m_value); + // Clamp the shift to the range 0..31 + ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f); + ASSERT(armImm.isValid()); + m_assembler.ARM_and(dataTempRegister, shift_amount, armImm); + + m_assembler.lsl(dest, dest, dataTempRegister); } - void lshift32(RegisterID shift_amount, RegisterID dest) + void lshift32(Imm32 imm, RegisterID dest) { - m_assembler.lsl(dest, dest, shift_amount); + m_assembler.lsl(dest, dest, imm.m_value & 0x1f); } void mul32(RegisterID src, RegisterID dest) @@ -233,12 +246,17 @@ public: void rshift32(RegisterID shift_amount, RegisterID dest) { - m_assembler.asr(dest, dest, shift_amount); + // Clamp the shift to the range 0..31 + ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(0x1f); + ASSERT(armImm.isValid()); + m_assembler.ARM_and(dataTempRegister, shift_amount, armImm); + + m_assembler.asr(dest, dest, dataTempRegister); } void rshift32(Imm32 imm, RegisterID dest) { - m_assembler.asr(dest, dest, imm.m_value); + m_assembler.asr(dest, dest, imm.m_value & 0x1f); } void sub32(RegisterID src, RegisterID dest) @@ -531,6 +549,23 @@ public: { m_assembler.vcmp_F64(left, right); m_assembler.vmrs_APSR_nzcv_FPSCR(); + + if (cond == DoubleNotEqual) { + // ConditionNE jumps if NotEqual *or* unordered - force the unordered cases not to jump. + Jump unordered = makeBranch(ARMv7Assembler::ConditionVS); + Jump result = makeBranch(ARMv7Assembler::ConditionNE); + unordered.link(this); + return result; + } + if (cond == DoubleEqualOrUnordered) { + Jump unordered = makeBranch(ARMv7Assembler::ConditionVS); + Jump notEqual = makeBranch(ARMv7Assembler::ConditionNE); + unordered.link(this); + // We get here if either unordered, or equal. + Jump result = makeJump(); + notEqual.link(this); + return result; + } return makeBranch(cond); } diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 3681af8..cae8bf6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -37,7 +37,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if PLATFORM(ARM_THUMB2) +#if CPU(ARM_THUMB2) // ARM/thumb instructions must be 16-bit aligned, but all code pointers to be loaded // into the processor are decorated with the bottom bit set, indicating that this is // thumb code (as oposed to 32-bit traditional ARM). The first test checks for both @@ -130,7 +130,7 @@ public: } explicit MacroAssemblerCodePtr(void* value) -#if PLATFORM(ARM_THUMB2) +#if CPU(ARM_THUMB2) // Decorate the pointer as a thumb code pointer. : m_value(reinterpret_cast(value) + 1) #else @@ -147,7 +147,7 @@ public: } void* executableAddress() const { return m_value; } -#if PLATFORM(ARM_THUMB2) +#if CPU(ARM_THUMB2) // To use this pointer as a data address remove the decoration. void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return reinterpret_cast(m_value) - 1; } #else diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h index 6e96240..ca7c31a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(X86) +#if ENABLE(ASSEMBLER) && CPU(X86) #include "MacroAssemblerX86Common.h" diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h index 5ebefa7..449df86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86Common.h @@ -36,6 +36,10 @@ namespace JSC { class MacroAssemblerX86Common : public AbstractMacroAssembler { + static const int DoubleConditionBitInvert = 0x10; + static const int DoubleConditionBitSpecial = 0x20; + static const int DoubleConditionBits = DoubleConditionBitInvert | DoubleConditionBitSpecial; + public: enum Condition { @@ -56,13 +60,24 @@ public: }; enum DoubleCondition { - DoubleEqual = X86Assembler::ConditionE, + // These conditions will only evaluate to true if the comparison is ordered - i.e. neither operand is NaN. + DoubleEqual = X86Assembler::ConditionE | DoubleConditionBitSpecial, DoubleNotEqual = X86Assembler::ConditionNE, DoubleGreaterThan = X86Assembler::ConditionA, DoubleGreaterThanOrEqual = X86Assembler::ConditionAE, - DoubleLessThan = X86Assembler::ConditionB, - DoubleLessThanOrEqual = X86Assembler::ConditionBE, + DoubleLessThan = X86Assembler::ConditionA | DoubleConditionBitInvert, + DoubleLessThanOrEqual = X86Assembler::ConditionAE | DoubleConditionBitInvert, + // If either operand is NaN, these conditions always evaluate to true. + DoubleEqualOrUnordered = X86Assembler::ConditionE, + DoubleNotEqualOrUnordered = X86Assembler::ConditionNE | DoubleConditionBitSpecial, + DoubleGreaterThanOrUnordered = X86Assembler::ConditionB | DoubleConditionBitInvert, + DoubleGreaterThanOrEqualOrUnordered = X86Assembler::ConditionBE | DoubleConditionBitInvert, + DoubleLessThanOrUnordered = X86Assembler::ConditionB, + DoubleLessThanOrEqualOrUnordered = X86Assembler::ConditionBE, }; + COMPILE_ASSERT( + !((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits), + DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes); static const RegisterID stackPointerRegister = X86Registers::esp; @@ -416,20 +431,35 @@ public: void convertInt32ToDouble(Address src, FPRegisterID dest) { + ASSERT(isSSE2Present()); m_assembler.cvtsi2sd_mr(src.offset, src.base, dest); } Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) { ASSERT(isSSE2Present()); - m_assembler.ucomisd_rr(right, left); - return Jump(m_assembler.jCC(x86Condition(cond))); - } - Jump branchDouble(DoubleCondition cond, FPRegisterID left, Address right) - { - m_assembler.ucomisd_mr(right.offset, right.base, left); - return Jump(m_assembler.jCC(x86Condition(cond))); + if (cond & DoubleConditionBitInvert) + m_assembler.ucomisd_rr(left, right); + else + m_assembler.ucomisd_rr(right, left); + + if (cond == DoubleEqual) { + Jump isUnordered(m_assembler.jp()); + Jump result = Jump(m_assembler.je()); + isUnordered.link(this); + return result; + } else if (cond == DoubleNotEqualOrUnordered) { + Jump isUnordered(m_assembler.jp()); + Jump isEqual(m_assembler.je()); + isUnordered.link(this); + Jump result = jump(); + isEqual.link(this); + return result; + } + + ASSERT(!(cond & DoubleConditionBitSpecial)); + return Jump(m_assembler.jCC(static_cast(cond & ~DoubleConditionBits))); } // Truncates 'src' to an integer, and places the resulting 'dest'. @@ -443,6 +473,25 @@ public: return branch32(Equal, dest, Imm32(0x80000000)); } + // Convert 'src' to an integer, and places the resulting 'dest'. + // If the result is not representable as a 32 bit value, branch. + // May also branch for some values that are representable in 32 bits + // (specifically, in this case, 0). + void branchConvertDoubleToInt32(FPRegisterID src, RegisterID dest, JumpList& failureCases, FPRegisterID fpTemp) + { + ASSERT(isSSE2Present()); + m_assembler.cvttsd2si_rr(src, dest); + + // If the result is zero, it might have been -0.0, and the double comparison won't catch this! + failureCases.append(branchTest32(Zero, dest)); + + // Convert the integer result back to float & compare to the original value - if not equal or unordered (NaN) then jump. + convertInt32ToDouble(dest, fpTemp); + m_assembler.ucomisd_rr(fpTemp, src); + failureCases.append(m_assembler.jp()); + failureCases.append(m_assembler.jne()); + } + void zeroDouble(FPRegisterID srcDest) { ASSERT(isSSE2Present()); @@ -493,7 +542,7 @@ public: m_assembler.movl_i32r(imm.m_value, dest); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void move(RegisterID src, RegisterID dest) { // Note: on 64-bit this is is a full register move; perhaps it would be @@ -509,7 +558,8 @@ public: void swap(RegisterID reg1, RegisterID reg2) { - m_assembler.xchgq_rr(reg1, reg2); + if (reg1 != reg2) + m_assembler.xchgq_rr(reg1, reg2); } void signExtend32ToPtr(RegisterID src, RegisterID dest) @@ -889,18 +939,13 @@ protected: return static_cast(cond); } - X86Assembler::Condition x86Condition(DoubleCondition cond) - { - return static_cast(cond); - } - private: // Only MacroAssemblerX86 should be using the following method; SSE2 is always available on // x86_64, and clients & subclasses of MacroAssembler should be using 'supportsFloatingPoint()'. friend class MacroAssemblerX86; -#if PLATFORM(X86) -#if PLATFORM(MAC) +#if CPU(X86) +#if OS(MAC_OS_X) // All X86 Macs are guaranteed to support at least SSE2, static bool isSSE2Present() @@ -908,7 +953,7 @@ private: return true; } -#else // PLATFORM(MAC) +#else // OS(MAC_OS_X) enum SSE2CheckState { NotCheckedSSE2, @@ -951,8 +996,8 @@ private: static SSE2CheckState s_sse2CheckState; -#endif // PLATFORM(MAC) -#elif !defined(NDEBUG) // PLATFORM(X86) +#endif // OS(MAC_OS_X) +#elif !defined(NDEBUG) // CPU(X86) // On x86-64 we should never be checking for SSE2 in a non-debug build, // but non debug add this method to keep the asserts above happy. diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h index 0f95fe6..ec93f8c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerX86_64.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && PLATFORM(X86_64) +#if ENABLE(ASSEMBLER) && CPU(X86_64) #include "MacroAssemblerX86Common.h" @@ -192,33 +192,6 @@ public: m_assembler.orq_ir(imm.m_value, dest); } - void rshiftPtr(RegisterID shift_amount, RegisterID dest) - { - // On x86 we can only shift by ecx; if asked to shift by another register we'll - // need rejig the shift amount into ecx first, and restore the registers afterwards. - if (shift_amount != X86Registers::ecx) { - swap(shift_amount, X86Registers::ecx); - - // E.g. transform "shll %eax, %eax" -> "xchgl %eax, %ecx; shll %ecx, %ecx; xchgl %eax, %ecx" - if (dest == shift_amount) - m_assembler.sarq_CLr(X86Registers::ecx); - // E.g. transform "shll %eax, %ecx" -> "xchgl %eax, %ecx; shll %ecx, %eax; xchgl %eax, %ecx" - else if (dest == X86Registers::ecx) - m_assembler.sarq_CLr(shift_amount); - // E.g. transform "shll %eax, %ebx" -> "xchgl %eax, %ecx; shll %ecx, %ebx; xchgl %eax, %ecx" - else - m_assembler.sarq_CLr(dest); - - swap(shift_amount, X86Registers::ecx); - } else - m_assembler.sarq_CLr(dest); - } - - void rshiftPtr(Imm32 imm, RegisterID dest) - { - m_assembler.sarq_i8r(imm.m_value, dest); - } - void subPtr(RegisterID src, RegisterID dest) { m_assembler.subq_rr(src, dest); diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h index cbbaaa5..ab3d05f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/X86Assembler.h @@ -28,7 +28,7 @@ #include -#if ENABLE(ASSEMBLER) && (PLATFORM(X86) || PLATFORM(X86_64)) +#if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64)) #include "AssemblerBuffer.h" #include @@ -50,7 +50,7 @@ namespace X86Registers { esi, edi, -#if PLATFORM(X86_64) +#if CPU(X86_64) r8, r9, r10, @@ -118,12 +118,12 @@ private: OP_XOR_GvEv = 0x33, OP_CMP_EvGv = 0x39, OP_CMP_GvEv = 0x3B, -#if PLATFORM(X86_64) +#if CPU(X86_64) PRE_REX = 0x40, #endif OP_PUSH_EAX = 0x50, OP_POP_EAX = 0x58, -#if PLATFORM(X86_64) +#if CPU(X86_64) OP_MOVSXD_GvEv = 0x63, #endif PRE_OPERAND_SIZE = 0x66, @@ -296,7 +296,7 @@ public: // Arithmetic operations: -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void adcl_im(int imm, void* addr) { if (CAN_SIGN_EXTEND_8_32(imm)) { @@ -346,7 +346,7 @@ public: } } -#if PLATFORM(X86_64) +#if CPU(X86_64) void addq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_ADD_EvGv, src, dst); @@ -423,7 +423,7 @@ public: } } -#if PLATFORM(X86_64) +#if CPU(X86_64) void andq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_AND_EvGv, src, dst); @@ -509,7 +509,7 @@ public: } } -#if PLATFORM(X86_64) +#if CPU(X86_64) void orq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_OR_EvGv, src, dst); @@ -575,7 +575,7 @@ public: } } -#if PLATFORM(X86_64) +#if CPU(X86_64) void subq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_SUB_EvGv, src, dst); @@ -641,7 +641,7 @@ public: } } -#if PLATFORM(X86_64) +#if CPU(X86_64) void xorq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_XOR_EvGv, src, dst); @@ -689,7 +689,7 @@ public: m_formatter.oneByteOp(OP_GROUP2_EvCL, GROUP2_OP_SHL, dst); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void sarq_CLr(RegisterID dst) { m_formatter.oneByteOp64(OP_GROUP2_EvCL, GROUP2_OP_SAR, dst); @@ -789,7 +789,7 @@ public: m_formatter.immediate32(imm); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void cmpq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_CMP_EvGv, src, dst); @@ -897,7 +897,7 @@ public: m_formatter.immediate32(imm); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void testq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_TEST_EvGv, src, dst); @@ -971,7 +971,7 @@ public: m_formatter.oneByteOp(OP_XCHG_EvGv, src, dst); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void xchgq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_XCHG_EvGv, src, dst); @@ -1001,7 +1001,7 @@ public: void movl_mEAX(void* addr) { m_formatter.oneByteOp(OP_MOV_EAXOv); -#if PLATFORM(X86_64) +#if CPU(X86_64) m_formatter.immediate64(reinterpret_cast(addr)); #else m_formatter.immediate32(reinterpret_cast(addr)); @@ -1038,14 +1038,14 @@ public: void movl_EAXm(void* addr) { m_formatter.oneByteOp(OP_MOV_OvEAX); -#if PLATFORM(X86_64) +#if CPU(X86_64) m_formatter.immediate64(reinterpret_cast(addr)); #else m_formatter.immediate32(reinterpret_cast(addr)); #endif } -#if PLATFORM(X86_64) +#if CPU(X86_64) void movq_rr(RegisterID src, RegisterID dst) { m_formatter.oneByteOp64(OP_MOV_EvGv, src, dst); @@ -1157,7 +1157,7 @@ public: { m_formatter.oneByteOp(OP_LEA, dst, base, offset); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void leaq_mr(int offset, RegisterID base, RegisterID dst) { m_formatter.oneByteOp64(OP_LEA, dst, base, offset); @@ -1323,7 +1323,7 @@ public: m_formatter.twoByteOp(OP2_CVTSI2SD_VsdEd, (RegisterID)dst, base, offset); } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void cvtsi2sd_mr(void* address, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1343,7 +1343,7 @@ public: m_formatter.twoByteOp(OP2_MOVD_EdVd, (RegisterID)src, dst); } -#if PLATFORM(X86_64) +#if CPU(X86_64) void movq_rr(XMMRegisterID src, RegisterID dst) { m_formatter.prefix(PRE_SSE_66); @@ -1369,7 +1369,7 @@ public: m_formatter.twoByteOp(OP2_MOVSD_VsdWsd, (RegisterID)dst, base, offset); } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void movsd_mr(void* address, XMMRegisterID dst) { m_formatter.prefix(PRE_SSE_F2); @@ -1535,7 +1535,7 @@ public: static void repatchLoadPtrToLEA(void* where) { -#if PLATFORM(X86_64) +#if CPU(X86_64) // On x86-64 pointer memory accesses require a 64-bit operand, and as such a REX prefix. // Skip over the prefix byte. where = reinterpret_cast(where) + 1; @@ -1679,7 +1679,7 @@ private: memoryModRM(reg, base, index, scale, offset); } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void oneByteOp(OneByteOpcodeID opcode, int reg, void* address) { m_buffer.ensureSpace(maxInstructionSize); @@ -1722,7 +1722,7 @@ private: memoryModRM(reg, base, index, scale, offset); } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void twoByteOp(TwoByteOpcodeID opcode, int reg, void* address) { m_buffer.ensureSpace(maxInstructionSize); @@ -1732,7 +1732,7 @@ private: } #endif -#if PLATFORM(X86_64) +#if CPU(X86_64) // Quad-word-sized operands: // // Used to format 64-bit operantions, planting a REX.w prefix. @@ -1891,7 +1891,7 @@ private: static const RegisterID noBase = X86Registers::ebp; static const RegisterID hasSib = X86Registers::esp; static const RegisterID noIndex = X86Registers::esp; -#if PLATFORM(X86_64) +#if CPU(X86_64) static const RegisterID noBase2 = X86Registers::r13; static const RegisterID hasSib2 = X86Registers::r12; @@ -1967,7 +1967,7 @@ private: void memoryModRM(int reg, RegisterID base, int offset) { // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there. -#if PLATFORM(X86_64) +#if CPU(X86_64) if ((base == hasSib) || (base == hasSib2)) { #else if (base == hasSib) { @@ -1982,7 +1982,7 @@ private: m_buffer.putIntUnchecked(offset); } } else { -#if PLATFORM(X86_64) +#if CPU(X86_64) if (!offset && (base != noBase) && (base != noBase2)) #else if (!offset && (base != noBase)) @@ -2001,7 +2001,7 @@ private: void memoryModRM_disp32(int reg, RegisterID base, int offset) { // A base of esp or r12 would be interpreted as a sib, so force a sib with no index & put the base in there. -#if PLATFORM(X86_64) +#if CPU(X86_64) if ((base == hasSib) || (base == hasSib2)) { #else if (base == hasSib) { @@ -2018,7 +2018,7 @@ private: { ASSERT(index != noIndex); -#if PLATFORM(X86_64) +#if CPU(X86_64) if (!offset && (base != noBase) && (base != noBase2)) #else if (!offset && (base != noBase)) @@ -2033,7 +2033,7 @@ private: } } -#if !PLATFORM(X86_64) +#if !CPU(X86_64) void memoryModRM(int reg, void* address) { // noBase + ModRmMemoryNoDisp means noBase + ModRmMemoryDisp32! @@ -2048,6 +2048,6 @@ private: } // namespace JSC -#endif // ENABLE(ASSEMBLER) && PLATFORM(X86) +#endif // ENABLE(ASSEMBLER) && CPU(X86) #endif // X86Assembler_h diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index c915934..68debb2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -49,9 +49,9 @@ namespace JSC { static UString escapeQuotes(const UString& str) { UString result = str; - int pos = 0; - while ((pos = result.find('\"', pos)) >= 0) { - result = result.substr(0, pos) + "\"\\\"\"" + result.substr(pos + 1); + unsigned pos = 0; + while ((pos = result.find('\"', pos)) != UString::NotFound) { + result = makeString(result.substr(0, pos), "\"\\\"\"", result.substr(pos + 1)); pos += 4; } return result; @@ -62,49 +62,50 @@ static UString valueToSourceString(ExecState* exec, JSValue val) if (!val) return "0"; - if (val.isString()) { - UString result("\""); - result += escapeQuotes(val.toString(exec)) + "\""; - return result; - } + if (val.isString()) + return makeString("\"", escapeQuotes(val.toString(exec)), "\""); return val.toString(exec); } -static CString registerName(int r) +static CString constantName(ExecState* exec, int k, JSValue value) { - if (r == missingThisObjectMarker()) - return ""; - - return (UString("r") + UString::from(r)).UTF8String(); + return makeString(valueToSourceString(exec, value), "(@k", UString::from(k - FirstConstantRegisterIndex), ")").UTF8String(); } -static CString constantName(ExecState* exec, int k, JSValue value) +static CString idName(int id0, const Identifier& ident) { - return (valueToSourceString(exec, value) + "(@k" + UString::from(k) + ")").UTF8String(); + return makeString(ident.ustring(), "(@id", UString::from(id0), ")").UTF8String(); } -static CString idName(int id0, const Identifier& ident) +CString CodeBlock::registerName(ExecState* exec, int r) const { - return (ident.ustring() + "(@id" + UString::from(id0) +")").UTF8String(); + if (r == missingThisObjectMarker()) + return ""; + + if (isConstantRegisterIndex(r)) + return constantName(exec, r, getConstant(r)); + + return makeString("r", UString::from(r)).UTF8String(); } static UString regexpToSourceString(RegExp* regExp) { - UString pattern = UString("/") + regExp->pattern() + "/"; + char postfix[5] = { '/', 0, 0, 0, 0 }; + int index = 1; if (regExp->global()) - pattern += "g"; + postfix[index++] = 'g'; if (regExp->ignoreCase()) - pattern += "i"; + postfix[index++] = 'i'; if (regExp->multiline()) - pattern += "m"; + postfix[index] = 'm'; - return pattern; + return makeString("/", regExp->pattern(), postfix); } static CString regexpName(int re, RegExp* regexp) { - return (regexpToSourceString(regexp) + "(@re" + UString::from(re) + ")").UTF8String(); + return makeString(regexpToSourceString(regexp), "(@re", UString::from(re), ")").UTF8String(); } static UString pointerToSourceString(void* p) @@ -135,44 +136,44 @@ NEVER_INLINE static const char* debugHookName(int debugHookID) return ""; } -static void printUnaryOp(int location, Vector::const_iterator& it, const char* op) +void CodeBlock::printUnaryOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str()); + printf("[%4d] %s\t\t %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); } -static void printBinaryOp(int location, Vector::const_iterator& it, const char* op) +void CodeBlock::printBinaryOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); + printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); } -static void printConditionalJump(const Vector::const_iterator&, Vector::const_iterator& it, int location, const char* op) +void CodeBlock::printConditionalJump(ExecState* exec, const Vector::const_iterator&, Vector::const_iterator& it, int location, const char* op) const { int r0 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, location + offset); + printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(exec, r0).c_str(), offset, location + offset); } -static void printGetByIdOp(int location, Vector::const_iterator& it, const Vector& m_identifiers, const char* op) +void CodeBlock::printGetByIdOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); it += 4; } -static void printPutByIdOp(int location, Vector::const_iterator& it, const Vector& m_identifiers, const char* op) +void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector::const_iterator& it, const char* op) const { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); + printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); it += 4; } @@ -357,7 +358,7 @@ void CodeBlock::dump(ExecState* exec) const unsigned registerIndex = m_numVars; size_t i = 0; do { - printf(" r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii()); + printf(" k%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue()).ascii()); ++i; ++registerIndex; } while (i < m_constantRegisters.size()); @@ -481,7 +482,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_enter_with_activation: { int r0 = (++it)->u.operand; - printf("[%4d] enter_with_activation %s\n", location, registerName(r0).c_str()); + printf("[%4d] enter_with_activation %s\n", location, registerName(exec, r0).c_str()); break; } case op_create_arguments: { @@ -494,148 +495,148 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_convert_this: { int r0 = (++it)->u.operand; - printf("[%4d] convert_this %s\n", location, registerName(r0).c_str()); + printf("[%4d] convert_this %s\n", location, registerName(exec, r0).c_str()); break; } case op_new_object: { int r0 = (++it)->u.operand; - printf("[%4d] new_object\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] new_object\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_new_array: { int dst = (++it)->u.operand; int argv = (++it)->u.operand; int argc = (++it)->u.operand; - printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(dst).c_str(), registerName(argv).c_str(), argc); + printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, argv).c_str(), argc); break; } case op_new_regexp: { int r0 = (++it)->u.operand; int re0 = (++it)->u.operand; - printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexp(re0)).c_str()); + printf("[%4d] new_regexp\t %s, %s\n", location, registerName(exec, r0).c_str(), regexpName(re0, regexp(re0)).c_str()); break; } case op_mov: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] mov\t\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + printf("[%4d] mov\t\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); break; } case op_not: { - printUnaryOp(location, it, "not"); + printUnaryOp(exec, location, it, "not"); break; } case op_eq: { - printBinaryOp(location, it, "eq"); + printBinaryOp(exec, location, it, "eq"); break; } case op_eq_null: { - printUnaryOp(location, it, "eq_null"); + printUnaryOp(exec, location, it, "eq_null"); break; } case op_neq: { - printBinaryOp(location, it, "neq"); + printBinaryOp(exec, location, it, "neq"); break; } case op_neq_null: { - printUnaryOp(location, it, "neq_null"); + printUnaryOp(exec, location, it, "neq_null"); break; } case op_stricteq: { - printBinaryOp(location, it, "stricteq"); + printBinaryOp(exec, location, it, "stricteq"); break; } case op_nstricteq: { - printBinaryOp(location, it, "nstricteq"); + printBinaryOp(exec, location, it, "nstricteq"); break; } case op_less: { - printBinaryOp(location, it, "less"); + printBinaryOp(exec, location, it, "less"); break; } case op_lesseq: { - printBinaryOp(location, it, "lesseq"); + printBinaryOp(exec, location, it, "lesseq"); break; } case op_pre_inc: { int r0 = (++it)->u.operand; - printf("[%4d] pre_inc\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] pre_inc\t\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_pre_dec: { int r0 = (++it)->u.operand; - printf("[%4d] pre_dec\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] pre_dec\t\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_post_inc: { - printUnaryOp(location, it, "post_inc"); + printUnaryOp(exec, location, it, "post_inc"); break; } case op_post_dec: { - printUnaryOp(location, it, "post_dec"); + printUnaryOp(exec, location, it, "post_dec"); break; } case op_to_jsnumber: { - printUnaryOp(location, it, "to_jsnumber"); + printUnaryOp(exec, location, it, "to_jsnumber"); break; } case op_negate: { - printUnaryOp(location, it, "negate"); + printUnaryOp(exec, location, it, "negate"); break; } case op_add: { - printBinaryOp(location, it, "add"); + printBinaryOp(exec, location, it, "add"); ++it; break; } case op_mul: { - printBinaryOp(location, it, "mul"); + printBinaryOp(exec, location, it, "mul"); ++it; break; } case op_div: { - printBinaryOp(location, it, "div"); + printBinaryOp(exec, location, it, "div"); ++it; break; } case op_mod: { - printBinaryOp(location, it, "mod"); + printBinaryOp(exec, location, it, "mod"); break; } case op_sub: { - printBinaryOp(location, it, "sub"); + printBinaryOp(exec, location, it, "sub"); ++it; break; } case op_lshift: { - printBinaryOp(location, it, "lshift"); + printBinaryOp(exec, location, it, "lshift"); break; } case op_rshift: { - printBinaryOp(location, it, "rshift"); + printBinaryOp(exec, location, it, "rshift"); break; } case op_urshift: { - printBinaryOp(location, it, "urshift"); + printBinaryOp(exec, location, it, "urshift"); break; } case op_bitand: { - printBinaryOp(location, it, "bitand"); + printBinaryOp(exec, location, it, "bitand"); ++it; break; } case op_bitxor: { - printBinaryOp(location, it, "bitxor"); + printBinaryOp(exec, location, it, "bitxor"); ++it; break; } case op_bitor: { - printBinaryOp(location, it, "bitor"); + printBinaryOp(exec, location, it, "bitor"); ++it; break; } case op_bitnot: { - printUnaryOp(location, it, "bitnot"); + printUnaryOp(exec, location, it, "bitnot"); break; } case op_instanceof: { @@ -643,59 +644,59 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; int r3 = (++it)->u.operand; - printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str()); + printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str()); break; } case op_typeof: { - printUnaryOp(location, it, "typeof"); + printUnaryOp(exec, location, it, "typeof"); break; } case op_is_undefined: { - printUnaryOp(location, it, "is_undefined"); + printUnaryOp(exec, location, it, "is_undefined"); break; } case op_is_boolean: { - printUnaryOp(location, it, "is_boolean"); + printUnaryOp(exec, location, it, "is_boolean"); break; } case op_is_number: { - printUnaryOp(location, it, "is_number"); + printUnaryOp(exec, location, it, "is_number"); break; } case op_is_string: { - printUnaryOp(location, it, "is_string"); + printUnaryOp(exec, location, it, "is_string"); break; } case op_is_object: { - printUnaryOp(location, it, "is_object"); + printUnaryOp(exec, location, it, "is_object"); break; } case op_is_function: { - printUnaryOp(location, it, "is_function"); + printUnaryOp(exec, location, it, "is_function"); break; } case op_in: { - printBinaryOp(location, it, "in"); + printBinaryOp(exec, location, it, "in"); break; } case op_resolve: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve\t\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_resolve_skip: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int skipLevels = (++it)->u.operand; - printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); + printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); break; } case op_resolve_global: { int r0 = (++it)->u.operand; JSValue scope = JSValue((++it)->u.jsCell); int id0 = (++it)->u.operand; - printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); it += 2; break; } @@ -703,125 +704,145 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int index = (++it)->u.operand; int skipLevels = (++it)->u.operand; - printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(r0).c_str(), index, skipLevels); + printf("[%4d] get_scoped_var\t %s, %d, %d\n", location, registerName(exec, r0).c_str(), index, skipLevels); break; } case op_put_scoped_var: { int index = (++it)->u.operand; int skipLevels = (++it)->u.operand; int r0 = (++it)->u.operand; - printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(r0).c_str()); + printf("[%4d] put_scoped_var\t %d, %d, %s\n", location, index, skipLevels, registerName(exec, r0).c_str()); break; } case op_get_global_var: { int r0 = (++it)->u.operand; JSValue scope = JSValue((++it)->u.jsCell); int index = (++it)->u.operand; - printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), index); + printf("[%4d] get_global_var\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), valueToSourceString(exec, scope).ascii(), index); break; } case op_put_global_var: { JSValue scope = JSValue((++it)->u.jsCell); int index = (++it)->u.operand; int r0 = (++it)->u.operand; - printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(r0).c_str()); + printf("[%4d] put_global_var\t %s, %d, %s\n", location, valueToSourceString(exec, scope).ascii(), index, registerName(exec, r0).c_str()); break; } case op_resolve_base: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_base\t %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_resolve_with_base: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_get_by_id: { - printGetByIdOp(location, it, m_identifiers, "get_by_id"); + printGetByIdOp(exec, location, it, "get_by_id"); break; } case op_get_by_id_self: { - printGetByIdOp(location, it, m_identifiers, "get_by_id_self"); + printGetByIdOp(exec, location, it, "get_by_id_self"); break; } case op_get_by_id_self_list: { - printGetByIdOp(location, it, m_identifiers, "get_by_id_self_list"); + printGetByIdOp(exec, location, it, "get_by_id_self_list"); break; } case op_get_by_id_proto: { - printGetByIdOp(location, it, m_identifiers, "get_by_id_proto"); + printGetByIdOp(exec, location, it, "get_by_id_proto"); break; } case op_get_by_id_proto_list: { - printGetByIdOp(location, it, m_identifiers, "op_get_by_id_proto_list"); + printGetByIdOp(exec, location, it, "op_get_by_id_proto_list"); break; } case op_get_by_id_chain: { - printGetByIdOp(location, it, m_identifiers, "get_by_id_chain"); + printGetByIdOp(exec, location, it, "get_by_id_chain"); + break; + } + case op_get_by_id_getter_self: { + printGetByIdOp(exec, location, it, "get_by_id_getter_self"); + break; + } + case op_get_by_id_getter_self_list: { + printGetByIdOp(exec, location, it, "get_by_id_getter_self_list"); + break; + } + case op_get_by_id_getter_proto: { + printGetByIdOp(exec, location, it, "get_by_id_getter_proto"); + break; + } + case op_get_by_id_getter_proto_list: { + printGetByIdOp(exec, location, it, "get_by_id_getter_proto_list"); + break; + } + case op_get_by_id_getter_chain: { + printGetByIdOp(exec, location, it, "get_by_id_getter_chain"); break; } case op_get_by_id_generic: { - printGetByIdOp(location, it, m_identifiers, "get_by_id_generic"); + printGetByIdOp(exec, location, it, "get_by_id_generic"); break; } case op_get_array_length: { - printGetByIdOp(location, it, m_identifiers, "get_array_length"); + printGetByIdOp(exec, location, it, "get_array_length"); break; } case op_get_string_length: { - printGetByIdOp(location, it, m_identifiers, "get_string_length"); + printGetByIdOp(exec, location, it, "get_string_length"); break; } case op_put_by_id: { - printPutByIdOp(location, it, m_identifiers, "put_by_id"); + printPutByIdOp(exec, location, it, "put_by_id"); break; } case op_put_by_id_replace: { - printPutByIdOp(location, it, m_identifiers, "put_by_id_replace"); + printPutByIdOp(exec, location, it, "put_by_id_replace"); break; } case op_put_by_id_transition: { - printPutByIdOp(location, it, m_identifiers, "put_by_id_transition"); + printPutByIdOp(exec, location, it, "put_by_id_transition"); break; } case op_put_by_id_generic: { - printPutByIdOp(location, it, m_identifiers, "put_by_id_generic"); + printPutByIdOp(exec, location, it, "put_by_id_generic"); break; } case op_put_getter: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); + printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); break; } case op_put_setter: { int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); + printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); break; } case op_method_check: { - printf("[%4d] op_method_check\n", location); + printf("[%4d] method_check\n", location); break; } case op_del_by_id: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int id0 = (++it)->u.operand; - printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); + printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); break; } case op_get_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); + printf("[%4d] get_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); break; } case op_get_by_pname: { @@ -831,28 +852,28 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r3 = (++it)->u.operand; int r4 = (++it)->u.operand; int r5 = (++it)->u.operand; - printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), registerName(r4).c_str(), registerName(r5).c_str()); + printf("[%4d] get_by_pname\t %s, %s, %s, %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), registerName(exec, r4).c_str(), registerName(exec, r5).c_str()); break; } case op_put_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); + printf("[%4d] put_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); break; } case op_del_by_val: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int r2 = (++it)->u.operand; - printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); + printf("[%4d] del_by_val\t %s, %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str()); break; } case op_put_by_index: { int r0 = (++it)->u.operand; unsigned n0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(r0).c_str(), n0, registerName(r1).c_str()); + printf("[%4d] put_by_index\t %s, %u, %s\n", location, registerName(exec, r0).c_str(), n0, registerName(exec, r1).c_str()); break; } case op_jmp: { @@ -866,91 +887,102 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& break; } case op_jtrue: { - printConditionalJump(begin, it, location, "jtrue"); + printConditionalJump(exec, begin, it, location, "jtrue"); break; } case op_loop_if_true: { - printConditionalJump(begin, it, location, "loop_if_true"); + printConditionalJump(exec, begin, it, location, "loop_if_true"); + break; + } + case op_loop_if_false: { + printConditionalJump(exec, begin, it, location, "loop_if_false"); break; } case op_jfalse: { - printConditionalJump(begin, it, location, "jfalse"); + printConditionalJump(exec, begin, it, location, "jfalse"); break; } case op_jeq_null: { - printConditionalJump(begin, it, location, "jeq_null"); + printConditionalJump(exec, begin, it, location, "jeq_null"); break; } case op_jneq_null: { - printConditionalJump(begin, it, location, "jneq_null"); + printConditionalJump(exec, begin, it, location, "jneq_null"); break; } case op_jneq_ptr: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); + printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); break; } case op_jnless: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); + printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); break; } case op_jnlesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); + printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); break; } case op_loop_if_less: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); + printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); + break; + } + case op_jless: { + int r0 = (++it)->u.operand; + int r1 = (++it)->u.operand; + int offset = (++it)->u.operand; + printf("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); break; } case op_loop_if_lesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); + printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), offset, location + offset); break; } case op_switch_imm: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); break; } case op_switch_char: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); break; } case op_switch_string: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(exec, scrutineeRegister).c_str()); break; } case op_new_func: { int r0 = (++it)->u.operand; int f0 = (++it)->u.operand; - printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(r0).c_str(), f0); + printf("[%4d] new_func\t\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); break; } case op_new_func_exp: { int r0 = (++it)->u.operand; int f0 = (++it)->u.operand; - printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(r0).c_str(), f0); + printf("[%4d] new_func_exp\t %s, f%d\n", location, registerName(exec, r0).c_str(), f0); break; } case op_call: { @@ -958,7 +990,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset); + printf("[%4d] call\t\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); break; } case op_call_eval: { @@ -966,7 +998,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset); + printf("[%4d] call_eval\t %s, %s, %d, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset); break; } case op_call_varargs: { @@ -974,16 +1006,16 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int func = (++it)->u.operand; int argCount = (++it)->u.operand; int registerOffset = (++it)->u.operand; - printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), registerName(argCount).c_str(), registerOffset); + printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), registerName(exec, argCount).c_str(), registerOffset); break; } case op_load_varargs: { - printUnaryOp(location, it, "load_varargs"); + printUnaryOp(exec, location, it, "load_varargs"); break; } case op_tear_off_activation: { int r0 = (++it)->u.operand; - printf("[%4d] tear_off_activation\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] tear_off_activation\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_tear_off_arguments: { @@ -992,7 +1024,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_ret: { int r0 = (++it)->u.operand; - printf("[%4d] ret\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] ret\t\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_construct: { @@ -1002,26 +1034,26 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int registerOffset = (++it)->u.operand; int proto = (++it)->u.operand; int thisRegister = (++it)->u.operand; - printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(dst).c_str(), registerName(func).c_str(), argCount, registerOffset, registerName(proto).c_str(), registerName(thisRegister).c_str()); + printf("[%4d] construct\t %s, %s, %d, %d, %s, %s\n", location, registerName(exec, dst).c_str(), registerName(exec, func).c_str(), argCount, registerOffset, registerName(exec, proto).c_str(), registerName(exec, thisRegister).c_str()); break; } case op_construct_verify: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] construct_verify\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + printf("[%4d] construct_verify\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); break; } case op_strcat: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int count = (++it)->u.operand; - printf("[%4d] op_strcat\t %s, %s, %d\n", location, registerName(r0).c_str(), registerName(r1).c_str(), count); + printf("[%4d] strcat\t\t %s, %s, %d\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), count); break; } case op_to_primitive: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] op_to_primitive\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + printf("[%4d] to_primitive\t %s, %s\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str()); break; } case op_get_pnames: { @@ -1030,7 +1062,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r2 = it[3].u.operand; int r3 = it[4].u.operand; int offset = it[5].u.operand; - printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str(), offset, location + offset); + printf("[%4d] get_pnames\t %s, %s, %s, %s, %d(->%d)\n", location, registerName(exec, r0).c_str(), registerName(exec, r1).c_str(), registerName(exec, r2).c_str(), registerName(exec, r3).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_get_pnames) - 1; break; } @@ -1038,13 +1070,13 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int dest = it[1].u.operand; int iter = it[4].u.operand; int offset = it[5].u.operand; - printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, location + offset); + printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(exec, dest).c_str(), registerName(exec, iter).c_str(), offset, location + offset); it += OPCODE_LENGTH(op_next_pname) - 1; break; } case op_push_scope: { int r0 = (++it)->u.operand; - printf("[%4d] push_scope\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] push_scope\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_pop_scope: { @@ -1055,7 +1087,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int id0 = (++it)->u.operand; int r1 = (++it)->u.operand; - printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); + printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(exec, r1).c_str()); break; } case op_jmp_scopes: { @@ -1066,30 +1098,30 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_catch: { int r0 = (++it)->u.operand; - printf("[%4d] catch\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] catch\t\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_throw: { int r0 = (++it)->u.operand; - printf("[%4d] throw\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] throw\t\t %s\n", location, registerName(exec, r0).c_str()); break; } case op_new_error: { int r0 = (++it)->u.operand; int errorType = (++it)->u.operand; int k0 = (++it)->u.operand; - printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str()); + printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(exec, r0).c_str(), errorType, constantName(exec, k0, getConstant(k0)).c_str()); break; } case op_jsr: { int retAddrDst = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, location + offset); + printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(exec, retAddrDst).c_str(), offset, location + offset); break; } case op_sret: { int retAddrSrc = (++it)->u.operand; - printf("[%4d] sret\t\t %s\n", location, registerName(retAddrSrc).c_str()); + printf("[%4d] sret\t\t %s\n", location, registerName(exec, retAddrSrc).c_str()); break; } case op_debug: { @@ -1101,17 +1133,17 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_profile_will_call: { int function = (++it)->u.operand; - printf("[%4d] profile_will_call %s\n", location, registerName(function).c_str()); + printf("[%4d] profile_will_call %s\n", location, registerName(exec, function).c_str()); break; } case op_profile_did_call: { int function = (++it)->u.operand; - printf("[%4d] profile_did_call\t %s\n", location, registerName(function).c_str()); + printf("[%4d] profile_did_call\t %s\n", location, registerName(exec, function).c_str()); break; } case op_end: { int r0 = (++it)->u.operand; - printf("[%4d] end\t\t %s\n", location, registerName(r0).c_str()); + printf("[%4d] end\t\t %s\n", location, registerName(exec, r0).c_str()); break; } } @@ -1343,16 +1375,16 @@ void CodeBlock::derefStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { vPC[4].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { vPC[4].u.structure->deref(); vPC[5].u.structure->deref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { vPC[4].u.structure->deref(); vPC[5].u.structureChain->deref(); return; @@ -1373,7 +1405,9 @@ void CodeBlock::derefStructures(Instruction* vPC) const return; } if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) - || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list))) { + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list)) + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto_list)) + || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self_list))) { PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures; polymorphicStructures->derefStructures(vPC[5].u.operand); delete polymorphicStructures; @@ -1388,16 +1422,16 @@ void CodeBlock::refStructures(Instruction* vPC) const { Interpreter* interpreter = m_globalData->interpreter; - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_self)) { vPC[4].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_proto)) { vPC[4].u.structure->ref(); vPC[5].u.structure->ref(); return; } - if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) { + if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain)) { vPC[4].u.structure->ref(); vPC[5].u.structureChain->ref(); return; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h index 4ba58d7..d92dc9d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.h @@ -36,7 +36,6 @@ #include "JSGlobalObject.h" #include "JumpTable.h" #include "Nodes.h" -#include "PtrAndFlags.h" #include "RegExp.h" #include "UString.h" #include @@ -110,44 +109,54 @@ namespace JSC { CodeLocationNearCall callReturnLocation; CodeLocationDataLabelPtr hotPathBegin; CodeLocationNearCall hotPathOther; - PtrAndFlags ownerCodeBlock; + CodeBlock* ownerCodeBlock; CodeBlock* callee; - unsigned position; + unsigned position : 31; + unsigned hasSeenShouldRepatch : 1; void setUnlinked() { callee = 0; } bool isLinked() { return callee; } bool seenOnce() { - return ownerCodeBlock.isFlagSet(hasSeenShouldRepatch); + return hasSeenShouldRepatch; } void setSeen() { - ownerCodeBlock.setFlag(hasSeenShouldRepatch); + hasSeenShouldRepatch = true; } }; struct MethodCallLinkInfo { MethodCallLinkInfo() : cachedStructure(0) + , cachedPrototypeStructure(0) { } bool seenOnce() { - return cachedPrototypeStructure.isFlagSet(hasSeenShouldRepatch); + ASSERT(!cachedStructure); + return cachedPrototypeStructure; } void setSeen() { - cachedPrototypeStructure.setFlag(hasSeenShouldRepatch); + ASSERT(!cachedStructure && !cachedPrototypeStructure); + // We use the values of cachedStructure & cachedPrototypeStructure to indicate the + // current state. + // - In the initial state, both are null. + // - Once this transition has been taken once, cachedStructure is + // null and cachedPrototypeStructure is set to a nun-null value. + // - Once the call is linked both structures are set to non-null values. + cachedPrototypeStructure = (Structure*)1; } CodeLocationCall callReturnLocation; CodeLocationDataLabelPtr structureLabel; Structure* cachedStructure; - PtrAndFlags cachedPrototypeStructure; + Structure* cachedPrototypeStructure; }; struct FunctionRegisterInfo { @@ -438,7 +447,7 @@ namespace JSC { size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); } void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); } Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } - ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; } + ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } unsigned addFunctionDecl(NonNullPassRefPtr n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; } @@ -482,6 +491,13 @@ namespace JSC { private: #if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) void dump(ExecState*, const Vector::const_iterator& begin, Vector::const_iterator&) const; + + CString registerName(ExecState*, int r) const; + void printUnaryOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; + void printBinaryOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; + void printConditionalJump(ExecState*, const Vector::const_iterator&, Vector::const_iterator&, int location, const char* op) const; + void printGetByIdOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; + void printPutByIdOp(ExecState*, int location, Vector::const_iterator&, const char* op) const; #endif void reparseForExceptionInfoIfNecessary(CallFrame*); diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h index 05834fc..a036dd4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/EvalCodeCache.h @@ -65,7 +65,7 @@ namespace JSC { bool isEmpty() const { return m_cacheMap.isEmpty(); } private: - static const int maxCacheableSourceLength = 256; + static const unsigned maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; typedef HashMap, RefPtr > EvalCacheMap; diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 4facbef..56555f3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -104,6 +104,11 @@ namespace JSC { macro(op_get_by_id_proto, 8) \ macro(op_get_by_id_proto_list, 8) \ macro(op_get_by_id_chain, 8) \ + macro(op_get_by_id_getter_self, 8) \ + macro(op_get_by_id_getter_self_list, 8) \ + macro(op_get_by_id_getter_proto, 8) \ + macro(op_get_by_id_getter_proto_list, 8) \ + macro(op_get_by_id_getter_chain, 8) \ macro(op_get_by_id_generic, 8) \ macro(op_get_array_length, 8) \ macro(op_get_string_length, 8) \ @@ -128,9 +133,11 @@ namespace JSC { macro(op_jneq_ptr, 4) \ macro(op_jnless, 4) \ macro(op_jnlesseq, 4) \ + macro(op_jless, 4) \ macro(op_jmp_scopes, 3) \ macro(op_loop, 2) \ macro(op_loop_if_true, 3) \ + macro(op_loop_if_false, 3) \ macro(op_loop_if_less, 4) \ macro(op_loop_if_lesseq, 4) \ macro(op_switch_imm, 4) \ @@ -194,8 +201,12 @@ namespace JSC { #undef VERIFY_OPCODE_ID #if HAVE(COMPUTED_GOTO) +#if COMPILER(RVCT) typedef void* Opcode; #else + typedef const void* Opcode; +#endif +#else typedef OpcodeID Opcode; #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp index 865c919..3f0babc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/SamplingTool.cpp @@ -33,7 +33,7 @@ #include "Interpreter.h" #include "Opcode.h" -#if !PLATFORM(WIN_OS) +#if !OS(WINDOWS) #include #endif @@ -91,7 +91,7 @@ void SamplingFlags::stop() {} uint32_t SamplingFlags::s_flags = 1 << 15; -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) static void sleepForMicroseconds(unsigned us) { diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 04dae15..f2193b0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -616,7 +616,7 @@ PassRefPtr
" + s + ""); + return jsMakeNontrivialString(exec, "", s, ""); } JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) @@ -890,7 +994,8 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue th unsigned stringSize = s.size(); unsigned bufferSize = 15 + linkTextSize + stringSize; UChar* buffer; - if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer)) + PassRefPtr impl = UStringImpl::tryCreateUninitialized(bufferSize, buffer); + if (!impl) return jsUndefined(); buffer[0] = '<'; buffer[1] = 'a'; @@ -909,7 +1014,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue th buffer[12 + linkTextSize + stringSize] = '/'; buffer[13 + linkTextSize + stringSize] = 'a'; buffer[14 + linkTextSize + stringSize] = '>'; - return jsNontrivialString(exec, UString(buffer, bufferSize, false)); + return jsNontrivialString(exec, impl); } enum { @@ -925,12 +1030,12 @@ static inline bool isTrimWhitespace(UChar c) static inline JSValue trimString(ExecState* exec, JSValue thisValue, int trimKind) { UString str = thisValue.toThisString(exec); - int left = 0; + unsigned left = 0; if (trimKind & TrimLeft) { while (left < str.size() && isTrimWhitespace(str[left])) left++; } - int right = str.size(); + unsigned right = str.size(); if (trimKind & TrimRight) { while (right > left && isTrimWhitespace(str[right - 1])) right--; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp index 65b62f9..ebf8a4c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.cpp @@ -77,6 +77,108 @@ static HashSet& ignoreSet = *(new HashSet); static HashSet& liveStructureSet = *(new HashSet); #endif +static int comparePropertyMapEntryIndices(const void* a, const void* b); + +inline void Structure::setTransitionTable(TransitionTable* table) +{ + ASSERT(m_isUsingSingleSlot); +#ifndef NDEBUG + setSingleTransition(0); +#endif + m_isUsingSingleSlot = false; + m_transitions.m_table = table; + // This implicitly clears the flag that indicates we're using a single transition + ASSERT(!m_isUsingSingleSlot); +} + +// The contains and get methods accept imprecise matches, so if an unspecialised transition exists +// for the given key they will consider that transition to be a match. If a specialised transition +// exists and it matches the provided specificValue, get will return the specific transition. +inline bool Structure::transitionTableContains(const StructureTransitionTableHash::Key& key, JSCell* specificValue) +{ + if (m_isUsingSingleSlot) { + Structure* existingTransition = singleTransition(); + return existingTransition && existingTransition->m_nameInPrevious.get() == key.first + && existingTransition->m_attributesInPrevious == key.second + && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0); + } + TransitionTable::iterator find = transitionTable()->find(key); + if (find == transitionTable()->end()) + return false; + + return find->second.first || find->second.second->transitionedFor(specificValue); +} + +inline Structure* Structure::transitionTableGet(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const +{ + if (m_isUsingSingleSlot) { + Structure* existingTransition = singleTransition(); + if (existingTransition && existingTransition->m_nameInPrevious.get() == key.first + && existingTransition->m_attributesInPrevious == key.second + && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0)) + return existingTransition; + return 0; + } + + Transition transition = transitionTable()->get(key); + if (transition.second && transition.second->transitionedFor(specificValue)) + return transition.second; + return transition.first; +} + +inline bool Structure::transitionTableHasTransition(const StructureTransitionTableHash::Key& key) const +{ + if (m_isUsingSingleSlot) { + Structure* transition = singleTransition(); + return transition && transition->m_nameInPrevious == key.first + && transition->m_attributesInPrevious == key.second; + } + return transitionTable()->contains(key); +} + +inline void Structure::transitionTableRemove(const StructureTransitionTableHash::Key& key, JSCell* specificValue) +{ + if (m_isUsingSingleSlot) { + ASSERT(transitionTableContains(key, specificValue)); + setSingleTransition(0); + return; + } + TransitionTable::iterator find = transitionTable()->find(key); + if (!specificValue) + find->second.first = 0; + else + find->second.second = 0; + if (!find->second.first && !find->second.second) + transitionTable()->remove(find); +} + +inline void Structure::transitionTableAdd(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue) +{ + if (m_isUsingSingleSlot) { + if (!singleTransition()) { + setSingleTransition(structure); + return; + } + Structure* existingTransition = singleTransition(); + TransitionTable* transitionTable = new TransitionTable; + setTransitionTable(transitionTable); + if (existingTransition) + transitionTableAdd(std::make_pair(existingTransition->m_nameInPrevious.get(), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious); + } + if (!specificValue) { + TransitionTable::iterator find = transitionTable()->find(key); + if (find == transitionTable()->end()) + transitionTable()->add(key, Transition(structure, 0)); + else + find->second.first = structure; + } else { + // If we're adding a transition to a specific value, then there cannot be + // an existing transition + ASSERT(!transitionTable()->contains(key)); + transitionTable()->add(key, Transition(0, structure)); + } +} + void Structure::dumpStatistics() { #if DUMP_STRUCTURE_ID_STATISTICS @@ -121,7 +223,7 @@ void Structure::dumpStatistics() #endif } -Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) +Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount) : m_typeInfo(typeInfo) , m_prototype(prototype) , m_specificValueInPrevious(0) @@ -132,7 +234,12 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) , m_isPinnedPropertyTable(false) , m_hasGetterSetterProperties(false) , m_attributesInPrevious(0) + , m_specificFunctionThrashCount(0) + , m_anonymousSlotCount(anonymousSlotCount) + , m_isUsingSingleSlot(true) { + m_transitions.m_singleTransition = 0; + ASSERT(m_prototype); ASSERT(m_prototype.isObject() || m_prototype.isNull()); @@ -154,10 +261,8 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo) Structure::~Structure() { if (m_previous) { - if (m_nameInPrevious) - m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious); - else - m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious); + ASSERT(m_nameInPrevious); + m_previous->transitionTableRemove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious); } @@ -175,6 +280,9 @@ Structure::~Structure() fastFree(m_propertyTable); } + if (!m_isUsingSingleSlot) + delete transitionTable(); + #ifndef NDEBUG #if ENABLE(JSC_MULTIPLE_THREADS) MutexLocker protect(ignoreSetMutex); @@ -273,12 +381,8 @@ void Structure::materializePropertyMap() for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) { structure = structures[i]; - if (!structure->m_nameInPrevious) { - m_propertyTable->anonymousSlotCount += structure->m_anonymousSlotsInPrevious; - continue; - } structure->m_nameInPrevious->ref(); - PropertyMapEntry entry(structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed); + PropertyMapEntry entry(structure->m_nameInPrevious.get(), m_anonymousSlotCount + structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious, ++m_propertyTable->lastIndexUsed); insertIntoPropertyMapHashTable(entry); } } @@ -300,7 +404,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) ASSERT(isDictionary()); ASSERT(m_propertyTable); - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); #if DUMP_PROPERTYMAP_STATS ++numProbes; @@ -318,7 +422,7 @@ void Structure::despecifyDictionaryFunction(const Identifier& propertyName) ++numCollisions; #endif - unsigned k = 1 | doubleHash(rep->computedHash()); + unsigned k = 1 | doubleHash(rep->existingHash()); while (1) { i += k; @@ -342,9 +446,11 @@ PassRefPtr Structure::addPropertyTransitionToExistingStructure(Struct ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); - if (Structure* existingTransition = structure->table.get(make_pair(propertyName.ustring().rep(), attributes), specificValue)) { + if (Structure* existingTransition = structure->transitionTableGet(make_pair(propertyName.ustring().rep(), attributes), specificValue)) { ASSERT(existingTransition->m_offset != noOffset); - offset = existingTransition->m_offset; + offset = existingTransition->m_offset + existingTransition->m_anonymousSlotCount; + ASSERT(offset >= structure->m_anonymousSlotCount); + ASSERT(structure->m_anonymousSlotCount == existingTransition->m_anonymousSlotCount); return existingTransition; } @@ -356,17 +462,22 @@ PassRefPtr Structure::addPropertyTransition(Structure* structure, con ASSERT(!structure->isDictionary()); ASSERT(structure->typeInfo().type() == ObjectType); ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset)); + + if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) + specificValue = 0; if (structure->transitionCount() > s_maxTransitionLength) { RefPtr transition = toCacheableDictionaryTransition(structure); ASSERT(structure != transition); offset = transition->put(propertyName, attributes, specificValue); + ASSERT(offset >= structure->m_anonymousSlotCount); + ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) transition->growPropertyStorageCapacity(); return transition.release(); } - RefPtr transition = create(structure->m_prototype, structure->typeInfo()); + RefPtr transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount()); transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain; transition->m_previous = structure; @@ -376,6 +487,7 @@ PassRefPtr Structure::addPropertyTransition(Structure* structure, con transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; + transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; if (structure->m_propertyTable) { if (structure->m_isPinnedPropertyTable) @@ -392,12 +504,14 @@ PassRefPtr Structure::addPropertyTransition(Structure* structure, con } offset = transition->put(propertyName, attributes, specificValue); + ASSERT(offset >= structure->m_anonymousSlotCount); + ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) transition->growPropertyStorageCapacity(); - transition->m_offset = offset; - - structure->table.add(make_pair(propertyName.ustring().rep(), attributes), transition.get(), specificValue); + transition->m_offset = offset - structure->m_anonymousSlotCount; + ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); + structure->transitionTableAdd(make_pair(propertyName.ustring().rep(), attributes), transition.get(), specificValue); return transition.release(); } @@ -408,34 +522,40 @@ PassRefPtr Structure::removePropertyTransition(Structure* structure, RefPtr transition = toUncacheableDictionaryTransition(structure); offset = transition->remove(propertyName); + ASSERT(offset >= structure->m_anonymousSlotCount); + ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount); return transition.release(); } PassRefPtr Structure::changePrototypeTransition(Structure* structure, JSValue prototype) { - RefPtr transition = create(prototype, structure->typeInfo()); + RefPtr transition = create(prototype, structure->typeInfo(), structure->anonymousSlotCount()); transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; + transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; // Don't set m_offset, as one can not transition to this. structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; - + + ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); return transition.release(); } PassRefPtr Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction) { - RefPtr transition = create(structure->storedPrototype(), structure->typeInfo()); + ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); + RefPtr transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount()); transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; + transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount + 1; // Don't set m_offset, as one can not transition to this. @@ -443,67 +563,32 @@ PassRefPtr Structure::despecifyFunctionTransition(Structure* structur transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; - bool removed = transition->despecifyFunction(replaceFunction); - ASSERT_UNUSED(removed, removed); - - return transition.release(); -} - -PassRefPtr Structure::addAnonymousSlotsTransition(Structure* structure, unsigned count) -{ - if (Structure* transition = structure->table.getAnonymousSlotTransition(count)) { - ASSERT(transition->storedPrototype() == structure->storedPrototype()); - return transition; + if (transition->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) + transition->despecifyAllFunctions(); + else { + bool removed = transition->despecifyFunction(replaceFunction); + ASSERT_UNUSED(removed, removed); } - ASSERT(count); - ASSERT(count < ((1<<6) - 2)); - RefPtr transition = create(structure->m_prototype, structure->typeInfo()); - transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain; - transition->m_previous = structure; - transition->m_nameInPrevious = 0; - transition->m_attributesInPrevious = 0; - transition->m_anonymousSlotsInPrevious = count; - transition->m_specificValueInPrevious = 0; - transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; - transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; - transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; - - if (structure->m_propertyTable) { - if (structure->m_isPinnedPropertyTable) - transition->m_propertyTable = structure->copyPropertyTable(); - else { - transition->m_propertyTable = structure->m_propertyTable; - structure->m_propertyTable = 0; - } - } else { - if (structure->m_previous) - transition->materializePropertyMap(); - else - transition->createPropertyMapHashTable(); - } - - transition->addAnonymousSlots(count); - if (transition->propertyStorageSize() > transition->propertyStorageCapacity()) - transition->growPropertyStorageCapacity(); - - structure->table.addAnonymousSlotTransition(count, transition.get()); - return transition.release(); + ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); + return transition.release(); } PassRefPtr Structure::getterSetterTransition(Structure* structure) { - RefPtr transition = create(structure->storedPrototype(), structure->typeInfo()); + RefPtr transition = create(structure->storedPrototype(), structure->typeInfo(), structure->anonymousSlotCount()); transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties; transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; + transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; // Don't set m_offset, as one can not transition to this. structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; - + + ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); return transition.release(); } @@ -511,16 +596,18 @@ PassRefPtr Structure::toDictionaryTransition(Structure* structure, Di { ASSERT(!structure->isUncacheableDictionary()); - RefPtr transition = create(structure->m_prototype, structure->typeInfo()); + RefPtr transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount()); transition->m_dictionaryKind = kind; transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity; transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties; transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties; + transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount; structure->materializePropertyMapIfNecessary(); transition->m_propertyTable = structure->copyPropertyTable(); transition->m_isPinnedPropertyTable = true; + ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount()); return transition.release(); } @@ -534,32 +621,62 @@ PassRefPtr Structure::toUncacheableDictionaryTransition(Structure* st return toDictionaryTransition(structure, UncachedDictionaryKind); } -PassRefPtr Structure::fromDictionaryTransition(Structure* structure) +PassRefPtr Structure::flattenDictionaryStructure(JSObject* object) { - ASSERT(structure->isDictionary()); - - // Since dictionary Structures are not shared, and no opcodes specialize - // for them, we don't need to allocate a new Structure when transitioning - // to non-dictionary status. - - // FIMXE: We can make this more efficient by canonicalizing the Structure (draining the - // deleted offsets vector) before transitioning from dictionary. - if (!structure->m_propertyTable || !structure->m_propertyTable->deletedOffsets || structure->m_propertyTable->deletedOffsets->isEmpty()) - structure->m_dictionaryKind = NoneDictionaryKind; + ASSERT(isDictionary()); + if (isUncacheableDictionary()) { + ASSERT(m_propertyTable); + Vector sortedPropertyEntries(m_propertyTable->keyCount); + PropertyMapEntry** p = sortedPropertyEntries.data(); + unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; + for (unsigned i = 1; i <= entryCount; i++) { + if (m_propertyTable->entries()[i].key) + *p++ = &m_propertyTable->entries()[i]; + } + size_t propertyCount = p - sortedPropertyEntries.data(); + qsort(sortedPropertyEntries.data(), propertyCount, sizeof(PropertyMapEntry*), comparePropertyMapEntryIndices); + sortedPropertyEntries.resize(propertyCount); + + // We now have the properties currently defined on this object + // in the order that they are expected to be in, but we need to + // reorder the storage, so we have to copy the current values out + Vector values(propertyCount); + unsigned anonymousSlotCount = m_anonymousSlotCount; + for (unsigned i = 0; i < propertyCount; i++) { + PropertyMapEntry* entry = sortedPropertyEntries[i]; + values[i] = object->getDirectOffset(entry->offset); + // Update property table to have the new property offsets + entry->offset = anonymousSlotCount + i; + entry->index = i; + } + + // Copy the original property values into their final locations + for (unsigned i = 0; i < propertyCount; i++) + object->putDirectOffset(anonymousSlotCount + i, values[i]); + + if (m_propertyTable->deletedOffsets) { + delete m_propertyTable->deletedOffsets; + m_propertyTable->deletedOffsets = 0; + } + } - return structure; + m_dictionaryKind = NoneDictionaryKind; + return this; } size_t Structure::addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!m_enumerationCache); + + if (m_specificFunctionThrashCount == maxSpecificFunctionThrashCount) + specificValue = 0; + materializePropertyMapIfNecessary(); m_isPinnedPropertyTable = true; - if (attributes & DontEnum) - m_hasNonEnumerableProperties = true; size_t offset = put(propertyName, attributes, specificValue); + ASSERT(offset >= m_anonymousSlotCount); if (propertyStorageSize() > propertyStorageCapacity()) growPropertyStorageCapacity(); return offset; @@ -574,6 +691,7 @@ size_t Structure::removePropertyWithoutTransition(const Identifier& propertyName m_isPinnedPropertyTable = true; size_t offset = remove(propertyName); + ASSERT(offset >= m_anonymousSlotCount); return offset; } @@ -630,7 +748,6 @@ PropertyMapHashTable* Structure::copyPropertyTable() if (m_propertyTable->deletedOffsets) newTable->deletedOffsets = new Vector(*m_propertyTable->deletedOffsets); - newTable->anonymousSlotCount = m_propertyTable->anonymousSlotCount; return newTable; } @@ -640,7 +757,7 @@ size_t Structure::get(const UString::Rep* rep, unsigned& attributes, JSCell*& sp if (!m_propertyTable) return notFound; - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); #if DUMP_PROPERTYMAP_STATS ++numProbes; @@ -653,6 +770,7 @@ size_t Structure::get(const UString::Rep* rep, unsigned& attributes, JSCell*& sp if (rep == m_propertyTable->entries()[entryIndex - 1].key) { attributes = m_propertyTable->entries()[entryIndex - 1].attributes; specificValue = m_propertyTable->entries()[entryIndex - 1].specificValue; + ASSERT(m_propertyTable->entries()[entryIndex - 1].offset >= m_anonymousSlotCount); return m_propertyTable->entries()[entryIndex - 1].offset; } @@ -660,7 +778,7 @@ size_t Structure::get(const UString::Rep* rep, unsigned& attributes, JSCell*& sp ++numCollisions; #endif - unsigned k = 1 | doubleHash(rep->computedHash()); + unsigned k = 1 | doubleHash(rep->existingHash()); while (1) { i += k; @@ -676,6 +794,7 @@ size_t Structure::get(const UString::Rep* rep, unsigned& attributes, JSCell*& sp if (rep == m_propertyTable->entries()[entryIndex - 1].key) { attributes = m_propertyTable->entries()[entryIndex - 1].attributes; specificValue = m_propertyTable->entries()[entryIndex - 1].specificValue; + ASSERT(m_propertyTable->entries()[entryIndex - 1].offset >= m_anonymousSlotCount); return m_propertyTable->entries()[entryIndex - 1].offset; } } @@ -691,7 +810,7 @@ bool Structure::despecifyFunction(const Identifier& propertyName) UString::Rep* rep = propertyName._ustring.rep(); - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); #if DUMP_PROPERTYMAP_STATS ++numProbes; @@ -711,7 +830,7 @@ bool Structure::despecifyFunction(const Identifier& propertyName) ++numCollisions; #endif - unsigned k = 1 | doubleHash(rep->computedHash()); + unsigned k = 1 | doubleHash(rep->existingHash()); while (1) { i += k; @@ -732,6 +851,17 @@ bool Structure::despecifyFunction(const Identifier& propertyName) } } +void Structure::despecifyAllFunctions() +{ + materializePropertyMapIfNecessary(); + if (!m_propertyTable) + return; + + unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; + for (unsigned i = 1; i <= entryCount; ++i) + m_propertyTable->entries()[i].specificValue = 0; +} + size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!propertyName.isNull()); @@ -739,6 +869,9 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel checkConsistency(); + if (attributes & DontEnum) + m_hasNonEnumerableProperties = true; + UString::Rep* rep = propertyName._ustring.rep(); if (!m_propertyTable) @@ -746,7 +879,7 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel // FIXME: Consider a fast case for tables with no deleted sentinels. - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); unsigned k = 0; bool foundDeletedElement = false; unsigned deletedElementIndex = 0; // initialize to make the compiler happy @@ -769,7 +902,7 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel } if (k == 0) { - k = 1 | doubleHash(rep->computedHash()); + k = 1 | doubleHash(rep->existingHash()); #if DUMP_PROPERTYMAP_STATS ++numCollisions; #endif @@ -810,9 +943,10 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel newOffset = m_propertyTable->deletedOffsets->last(); m_propertyTable->deletedOffsets->removeLast(); } else - newOffset = m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount; + newOffset = m_propertyTable->keyCount + m_anonymousSlotCount; m_propertyTable->entries()[entryIndex - 1].offset = newOffset; - + + ASSERT(newOffset >= m_anonymousSlotCount); ++m_propertyTable->keyCount; if ((m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount) * 2 >= m_propertyTable->size) @@ -822,14 +956,9 @@ size_t Structure::put(const Identifier& propertyName, unsigned attributes, JSCel return newOffset; } -void Structure::addAnonymousSlots(unsigned count) -{ - m_propertyTable->anonymousSlotCount += count; -} - bool Structure::hasTransition(UString::Rep* rep, unsigned attributes) { - return table.hasTransition(make_pair(rep, attributes)); + return transitionTableHasTransition(make_pair(rep, attributes)); } size_t Structure::remove(const Identifier& propertyName) @@ -849,7 +978,7 @@ size_t Structure::remove(const Identifier& propertyName) #endif // Find the thing to remove. - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); unsigned k = 0; unsigned entryIndex; UString::Rep* key = 0; @@ -863,7 +992,7 @@ size_t Structure::remove(const Identifier& propertyName) break; if (k == 0) { - k = 1 | doubleHash(rep->computedHash()); + k = 1 | doubleHash(rep->existingHash()); #if DUMP_PROPERTYMAP_STATS ++numCollisions; #endif @@ -881,6 +1010,7 @@ size_t Structure::remove(const Identifier& propertyName) m_propertyTable->entryIndices[i & m_propertyTable->sizeMask] = deletedSentinelIndex; size_t offset = m_propertyTable->entries()[entryIndex - 1].offset; + ASSERT(offset >= m_anonymousSlotCount); key->deref(); m_propertyTable->entries()[entryIndex - 1].key = 0; @@ -906,8 +1036,8 @@ size_t Structure::remove(const Identifier& propertyName) void Structure::insertIntoPropertyMapHashTable(const PropertyMapEntry& entry) { ASSERT(m_propertyTable); - - unsigned i = entry.key->computedHash(); + ASSERT(entry.offset >= m_anonymousSlotCount); + unsigned i = entry.key->existingHash(); unsigned k = 0; #if DUMP_PROPERTYMAP_STATS @@ -920,7 +1050,7 @@ void Structure::insertIntoPropertyMapHashTable(const PropertyMapEntry& entry) break; if (k == 0) { - k = 1 | doubleHash(entry.key->computedHash()); + k = 1 | doubleHash(entry.key->existingHash()); #if DUMP_PROPERTYMAP_STATS ++numCollisions; #endif @@ -985,7 +1115,6 @@ void Structure::rehashPropertyMapHashTable(unsigned newTableSize) m_propertyTable = static_cast(fastZeroedMalloc(PropertyMapHashTable::allocationSize(newTableSize))); m_propertyTable->size = newTableSize; m_propertyTable->sizeMask = newTableSize - 1; - m_propertyTable->anonymousSlotCount = oldTable->anonymousSlotCount; unsigned lastIndexUsed = 0; unsigned entryCount = oldTable->keyCount + oldTable->deletedSentinelCount; @@ -1003,7 +1132,7 @@ void Structure::rehashPropertyMapHashTable(unsigned newTableSize) checkConsistency(); } -static int comparePropertyMapEntryIndices(const void* a, const void* b) +int comparePropertyMapEntryIndices(const void* a, const void* b) { unsigned ia = static_cast(a)[0]->index; unsigned ib = static_cast(b)[0]->index; @@ -1014,7 +1143,7 @@ static int comparePropertyMapEntryIndices(const void* a, const void* b) return 0; } -void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames) +void Structure::getPropertyNames(PropertyNameArray& propertyNames, EnumerationMode mode) { materializePropertyMapIfNecessary(); if (!m_propertyTable) @@ -1025,7 +1154,8 @@ void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames) int i = 0; unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; for (unsigned k = 1; k <= entryCount; k++) { - if (m_propertyTable->entries()[k].key && !(m_propertyTable->entries()[k].attributes & DontEnum)) { + ASSERT(m_hasNonEnumerableProperties || !(m_propertyTable->entries()[k].attributes & DontEnum)); + if (m_propertyTable->entries()[k].key && (!(m_propertyTable->entries()[k].attributes & DontEnum) || (mode == IncludeDontEnumProperties))) { PropertyMapEntry* value = &m_propertyTable->entries()[k]; int j; for (j = i - 1; j >= 0 && a[j]->index > value->index; --j) @@ -1052,7 +1182,7 @@ void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames) PropertyMapEntry** p = sortedEnumerables.data(); unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; for (unsigned i = 1; i <= entryCount; i++) { - if (m_propertyTable->entries()[i].key && !(m_propertyTable->entries()[i].attributes & DontEnum)) + if (m_propertyTable->entries()[i].key && (!(m_propertyTable->entries()[i].attributes & DontEnum) || (mode == IncludeDontEnumProperties))) *p++ = &m_propertyTable->entries()[i]; } @@ -1112,11 +1242,13 @@ void Structure::checkConsistency() unsigned nonEmptyEntryCount = 0; for (unsigned c = 1; c <= m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount; ++c) { + ASSERT(m_hasNonEnumerableProperties || !(m_propertyTable->entries()[c].attributes & DontEnum)); UString::Rep* rep = m_propertyTable->entries()[c].key; + ASSERT(m_propertyTable->entries()[c].offset >= m_anonymousSlotCount); if (!rep) continue; ++nonEmptyEntryCount; - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); unsigned k = 0; unsigned entryIndex; while (1) { @@ -1125,7 +1257,7 @@ void Structure::checkConsistency() if (rep == m_propertyTable->entries()[entryIndex - 1].key) break; if (k == 0) - k = 1 | doubleHash(rep->computedHash()); + k = 1 | doubleHash(rep->existingHash()); i += k; } ASSERT(entryIndex == c + 1); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h index f355c53..968443a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Structure.h @@ -36,6 +36,7 @@ #include "StructureTransitionTable.h" #include "JSTypeInfo.h" #include "UString.h" +#include "WeakGCPtr.h" #include #include @@ -51,13 +52,18 @@ namespace JSC { class PropertyNameArray; class PropertyNameArrayData; + enum EnumerationMode { + ExcludeDontEnumProperties, + IncludeDontEnumProperties + }; + class Structure : public RefCounted { public: friend class JIT; friend class StructureTransitionTable; - static PassRefPtr create(JSValue prototype, const TypeInfo& typeInfo) + static PassRefPtr create(JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount) { - return adoptRef(new Structure(prototype, typeInfo)); + return adoptRef(new Structure(prototype, typeInfo, anonymousSlotCount)); } static void startIgnoringLeaks(); @@ -70,11 +76,11 @@ namespace JSC { static PassRefPtr removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset); static PassRefPtr changePrototypeTransition(Structure*, JSValue prototype); static PassRefPtr despecifyFunctionTransition(Structure*, const Identifier&); - static PassRefPtr addAnonymousSlotsTransition(Structure*, unsigned count); static PassRefPtr getterSetterTransition(Structure*); static PassRefPtr toCacheableDictionaryTransition(Structure*); static PassRefPtr toUncacheableDictionaryTransition(Structure*); - static PassRefPtr fromDictionaryTransition(Structure*); + + PassRefPtr flattenDictionaryStructure(JSObject*); ~Structure(); @@ -96,7 +102,7 @@ namespace JSC { void growPropertyStorageCapacity(); unsigned propertyStorageCapacity() const { return m_propertyStorageCapacity; } - unsigned propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_propertyTable->anonymousSlotCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : m_offset + 1; } + unsigned propertyStorageSize() const { return m_anonymousSlotCount + (m_propertyTable ? m_propertyTable->keyCount + (m_propertyTable->deletedOffsets ? m_propertyTable->deletedOffsets->size() : 0) : static_cast(m_offset + 1)); } bool isUsingInlineStorage() const; size_t get(const Identifier& propertyName); @@ -121,19 +127,22 @@ namespace JSC { bool hasNonEnumerableProperties() const { return m_hasNonEnumerableProperties; } - bool hasAnonymousSlots() const { return m_propertyTable && m_propertyTable->anonymousSlotCount; } + bool hasAnonymousSlots() const { return !!m_anonymousSlotCount; } + unsigned anonymousSlotCount() const { return m_anonymousSlotCount; } bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; } - JSCell* specificValue() { return m_specificValueInPrevious; } void despecifyDictionaryFunction(const Identifier& propertyName); + void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; } void setEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. - JSPropertyNameIterator* enumerationCache() { return m_enumerationCache.get(); } - void getEnumerablePropertyNames(PropertyNameArray&); - + void clearEnumerationCache(JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. + JSPropertyNameIterator* enumerationCache(); // Defined in JSPropertyNameIterator.h. + void getPropertyNames(PropertyNameArray&, EnumerationMode mode); + private: - Structure(JSValue prototype, const TypeInfo&); + + Structure(JSValue prototype, const TypeInfo&, unsigned anonymousSlotCount); typedef enum { NoneDictionaryKind = 0, @@ -144,7 +153,6 @@ namespace JSC { size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue); size_t remove(const Identifier& propertyName); - void addAnonymousSlots(unsigned slotCount); void expandPropertyMapHashTable(); void rehashPropertyMapHashTable(); @@ -155,6 +163,7 @@ namespace JSC { void checkConsistency(); bool despecifyFunction(const Identifier&); + void despecifyAllFunctions(); PropertyMapHashTable* copyPropertyTable(); void materializePropertyMap(); @@ -170,6 +179,20 @@ namespace JSC { // Since the number of transitions is always the same as m_offset, we keep the size of Structure down by not storing both. return m_offset == noOffset ? 0 : m_offset + 1; } + + typedef std::pair Transition; + typedef HashMap TransitionTable; + + inline bool transitionTableContains(const StructureTransitionTableHash::Key& key, JSCell* specificValue); + inline void transitionTableRemove(const StructureTransitionTableHash::Key& key, JSCell* specificValue); + inline void transitionTableAdd(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue); + inline bool transitionTableHasTransition(const StructureTransitionTableHash::Key& key) const; + inline Structure* transitionTableGet(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const; + + TransitionTable* transitionTable() const { ASSERT(!m_isUsingSingleSlot); return m_transitions.m_table; } + inline void setTransitionTable(TransitionTable* table); + Structure* singleTransition() const { ASSERT(m_isUsingSingleSlot); return m_transitions.m_singleTransition; } + void setSingleTransition(Structure* structure) { ASSERT(m_isUsingSingleSlot); m_transitions.m_singleTransition = structure; } bool isValid(ExecState*, StructureChain* cachedPrototypeChain) const; @@ -179,6 +202,8 @@ namespace JSC { static const signed char noOffset = -1; + static const unsigned maxSpecificFunctionThrashCount = 3; + TypeInfo m_typeInfo; JSValue m_prototype; @@ -188,13 +213,19 @@ namespace JSC { RefPtr m_nameInPrevious; JSCell* m_specificValueInPrevious; - StructureTransitionTable table; + // 'm_isUsingSingleSlot' indicates whether we are using the single transition optimisation. + union { + TransitionTable* m_table; + Structure* m_singleTransition; + } m_transitions; - ProtectedPtr m_enumerationCache; + WeakGCPtr m_enumerationCache; PropertyMapHashTable* m_propertyTable; uint32_t m_propertyStorageCapacity; + + // m_offset does not account for anonymous slots signed char m_offset; unsigned m_dictionaryKind : 2; @@ -209,7 +240,10 @@ namespace JSC { #else unsigned m_attributesInPrevious : 7; #endif - unsigned m_anonymousSlotsInPrevious : 6; + unsigned m_specificFunctionThrashCount : 2; + unsigned m_anonymousSlotCount : 5; + unsigned m_isUsingSingleSlot : 1; + // 4 free bits }; inline size_t Structure::get(const Identifier& propertyName) @@ -222,7 +256,7 @@ namespace JSC { UString::Rep* rep = propertyName._ustring.rep(); - unsigned i = rep->computedHash(); + unsigned i = rep->existingHash(); #if DUMP_PROPERTYMAP_STATS ++numProbes; @@ -239,7 +273,7 @@ namespace JSC { ++numCollisions; #endif - unsigned k = 1 | WTF::doubleHash(rep->computedHash()); + unsigned k = 1 | WTF::doubleHash(rep->existingHash()); while (1) { i += k; @@ -256,58 +290,7 @@ namespace JSC { return m_propertyTable->entries()[entryIndex - 1].offset; } } - - bool StructureTransitionTable::contains(const StructureTransitionTableHash::Key& key, JSCell* specificValue) - { - if (usingSingleTransitionSlot()) { - Structure* existingTransition = singleTransition(); - return existingTransition && existingTransition->m_nameInPrevious.get() == key.first - && existingTransition->m_attributesInPrevious == key.second - && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0); - } - TransitionTable::iterator find = table()->find(key); - if (find == table()->end()) - return false; - return find->second.first || find->second.second->transitionedFor(specificValue); - } - - Structure* StructureTransitionTable::get(const StructureTransitionTableHash::Key& key, JSCell* specificValue) const - { - if (usingSingleTransitionSlot()) { - Structure* existingTransition = singleTransition(); - if (existingTransition && existingTransition->m_nameInPrevious.get() == key.first - && existingTransition->m_attributesInPrevious == key.second - && (existingTransition->m_specificValueInPrevious == specificValue || existingTransition->m_specificValueInPrevious == 0)) - return existingTransition; - return 0; - } - - Transition transition = table()->get(key); - if (transition.second && transition.second->transitionedFor(specificValue)) - return transition.second; - return transition.first; - } - - bool StructureTransitionTable::hasTransition(const StructureTransitionTableHash::Key& key) const - { - if (usingSingleTransitionSlot()) { - Structure* transition = singleTransition(); - return transition && transition->m_nameInPrevious == key.first - && transition->m_attributesInPrevious == key.second; - } - return table()->contains(key); - } - - void StructureTransitionTable::reifySingleTransition() - { - ASSERT(usingSingleTransitionSlot()); - Structure* existingTransition = singleTransition(); - TransitionTable* transitionTable = new TransitionTable; - setTransitionTable(transitionTable); - if (existingTransition) - add(make_pair(existingTransition->m_nameInPrevious.get(), existingTransition->m_attributesInPrevious), existingTransition, existingTransition->m_specificValueInPrevious); - } } // namespace JSC #endif // Structure_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h index 0fa7b73..d1dc2d9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StructureTransitionTable.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,7 @@ namespace JSC { typedef std::pair, unsigned> Key; static unsigned hash(const Key& p) { - return p.first->computedHash(); + return p.first->existingHash(); } static bool equal(const Key& a, const Key& b) @@ -67,148 +66,6 @@ namespace JSC { static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); } }; - class StructureTransitionTable { - typedef std::pair Transition; - struct TransitionTable : public HashMap { - typedef HashMap AnonymousSlotMap; - - void addSlotTransition(unsigned count, Structure* structure) - { - ASSERT(!getSlotTransition(count)); - if (!m_anonymousSlotTable) - m_anonymousSlotTable.set(new AnonymousSlotMap); - m_anonymousSlotTable->add(count, structure); - } - - void removeSlotTransition(unsigned count) - { - ASSERT(getSlotTransition(count)); - m_anonymousSlotTable->remove(count); - } - - Structure* getSlotTransition(unsigned count) - { - if (!m_anonymousSlotTable) - return 0; - - AnonymousSlotMap::iterator find = m_anonymousSlotTable->find(count); - if (find == m_anonymousSlotTable->end()) - return 0; - return find->second; - } - private: - OwnPtr m_anonymousSlotTable; - }; - public: - StructureTransitionTable() { - m_transitions.m_singleTransition.set(0); - m_transitions.m_singleTransition.setFlag(usingSingleSlot); - } - - ~StructureTransitionTable() { - if (!usingSingleTransitionSlot()) - delete table(); - } - - // The contains and get methods accept imprecise matches, so if an unspecialised transition exists - // for the given key they will consider that transition to be a match. If a specialised transition - // exists and it matches the provided specificValue, get will return the specific transition. - inline bool contains(const StructureTransitionTableHash::Key&, JSCell* specificValue); - inline Structure* get(const StructureTransitionTableHash::Key&, JSCell* specificValue) const; - inline bool hasTransition(const StructureTransitionTableHash::Key& key) const; - void remove(const StructureTransitionTableHash::Key& key, JSCell* specificValue) - { - if (usingSingleTransitionSlot()) { - ASSERT(contains(key, specificValue)); - setSingleTransition(0); - return; - } - TransitionTable::iterator find = table()->find(key); - if (!specificValue) - find->second.first = 0; - else - find->second.second = 0; - if (!find->second.first && !find->second.second) - table()->remove(find); - } - void add(const StructureTransitionTableHash::Key& key, Structure* structure, JSCell* specificValue) - { - if (usingSingleTransitionSlot()) { - if (!singleTransition()) { - setSingleTransition(structure); - return; - } - reifySingleTransition(); - } - if (!specificValue) { - TransitionTable::iterator find = table()->find(key); - if (find == table()->end()) - table()->add(key, Transition(structure, 0)); - else - find->second.first = structure; - } else { - // If we're adding a transition to a specific value, then there cannot be - // an existing transition - ASSERT(!table()->contains(key)); - table()->add(key, Transition(0, structure)); - } - } - - Structure* getAnonymousSlotTransition(unsigned count) - { - if (usingSingleTransitionSlot()) - return 0; - return table()->getSlotTransition(count); - } - - void addAnonymousSlotTransition(unsigned count, Structure* structure) - { - if (usingSingleTransitionSlot()) - reifySingleTransition(); - ASSERT(!table()->getSlotTransition(count)); - table()->addSlotTransition(count, structure); - } - - void removeAnonymousSlotTransition(unsigned count) - { - ASSERT(!usingSingleTransitionSlot()); - table()->removeSlotTransition(count); - } - private: - TransitionTable* table() const { ASSERT(!usingSingleTransitionSlot()); return m_transitions.m_table; } - Structure* singleTransition() const { - ASSERT(usingSingleTransitionSlot()); - return m_transitions.m_singleTransition.get(); - } - bool usingSingleTransitionSlot() const { return m_transitions.m_singleTransition.isFlagSet(usingSingleSlot); } - void setSingleTransition(Structure* structure) - { - ASSERT(usingSingleTransitionSlot()); - m_transitions.m_singleTransition.set(structure); - } - - void setTransitionTable(TransitionTable* table) - { - ASSERT(usingSingleTransitionSlot()); -#ifndef NDEBUG - setSingleTransition(0); -#endif - m_transitions.m_table = table; - // This implicitly clears the flag that indicates we're using a single transition - ASSERT(!usingSingleTransitionSlot()); - } - inline void reifySingleTransition(); - - enum UsingSingleSlot { - usingSingleSlot - }; - // Last bit indicates whether we are using the single transition optimisation - union { - TransitionTable* m_table; - PtrAndFlagsBase m_singleTransition; - } m_transitions; - }; - } // namespace JSC #endif // StructureTransitionTable_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp index 2a056c9..250fdaf 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp @@ -33,14 +33,18 @@ #include "CallFrame.h" #include "JSGlobalObject.h" -#if PLATFORM(DARWIN) +#if OS(DARWIN) #include -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) #include #else #include "CurrentTime.h" #endif +#if PLATFORM(BREWMP) +#include +#endif + using namespace std; namespace JSC { @@ -54,7 +58,7 @@ static const int intervalBetweenChecks = 1000; // Returns the time the current thread has spent executing, in milliseconds. static inline unsigned getCPUTime() { -#if PLATFORM(DARWIN) +#if OS(DARWIN) mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT; thread_basic_info_data_t info; @@ -67,7 +71,7 @@ static inline unsigned getCPUTime() time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000; return time; -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) union { FILETIME fileTime; unsigned long long fileTimeAsLong; @@ -80,6 +84,11 @@ static inline unsigned getCPUTime() GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime.fileTime, &userTime.fileTime); return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000; +#elif PLATFORM(BREWMP) + // This function returns a continuously and linearly increasing millisecond + // timer from the time the device was powered on. + // There is only one thread in BREW, so this is enough. + return GETUPTIMEMS(); #else // FIXME: We should return the time the current thread has spent executing. return currentTime() * 1000; diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h index e544f66..c28c85f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Tracing.h @@ -33,7 +33,7 @@ #define JAVASCRIPTCORE_GC_BEGIN() #define JAVASCRIPTCORE_GC_BEGIN_ENABLED() 0 -#define JAVASCRIPTCORE_GC_END(arg0, arg1) +#define JAVASCRIPTCORE_GC_END() #define JAVASCRIPTCORE_GC_END_ENABLED() 0 #define JAVASCRIPTCORE_GC_MARKED() diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp index e66ca93..1684ec2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.cpp @@ -30,12 +30,12 @@ #include "Identifier.h" #include "Operations.h" #include -#include #include #include #include #include #include +#include #include #include #include @@ -44,9 +44,6 @@ #include #include -#if HAVE(STRING_H) -#include -#endif #if HAVE(STRINGS_H) #include #endif @@ -55,52 +52,11 @@ using namespace WTF; using namespace WTF::Unicode; using namespace std; -// This can be tuned differently per platform by putting platform #ifs right here. -// If you don't define this macro at all, then copyChars will just call directly -// to memcpy. -#define USTRING_COPY_CHARS_INLINE_CUTOFF 20 - namespace JSC { - + extern const double NaN; extern const double Inf; -// This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. -static const int minLengthToShare = 10; - -static inline size_t overflowIndicator() { return std::numeric_limits::max(); } -static inline size_t maxUChars() { return std::numeric_limits::max() / sizeof(UChar); } - -static inline PossiblyNull allocChars(size_t length) -{ - ASSERT(length); - if (length > maxUChars()) - return 0; - return tryFastMalloc(sizeof(UChar) * length); -} - -static inline PossiblyNull reallocChars(UChar* buffer, size_t length) -{ - ASSERT(length); - if (length > maxUChars()) - return 0; - return tryFastRealloc(buffer, sizeof(UChar) * length); -} - -static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters) -{ -#ifdef USTRING_COPY_CHARS_INLINE_CUTOFF - if (numCharacters <= USTRING_COPY_CHARS_INLINE_CUTOFF) { - for (unsigned i = 0; i < numCharacters; ++i) - destination[i] = source[i]; - return; - } -#endif - memcpy(destination, source, numCharacters * sizeof(UChar)); -} - -COMPILE_ASSERT(sizeof(UChar) == 2, uchar_is_2_bytes); - CString::CString(const char* c) : m_length(strlen(c)) , m_data(new char[m_length + 1]) @@ -190,736 +146,46 @@ bool operator==(const CString& c1, const CString& c2) return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0); } -// These static strings are immutable, except for rc, whose initial value is chosen to +// These static strings are immutable, except for rc, whose initial value is chosen to // reduce the possibility of it becoming zero due to ref/deref not being thread-safe. static UChar sharedEmptyChar; -UString::BaseString* UString::Rep::nullBaseString; -UString::BaseString* UString::Rep::emptyBaseString; -UString* UString::nullUString; +UStringImpl* UStringImpl::s_empty; -static void initializeStaticBaseString(UString::BaseString& base) -{ - base.rc = INT_MAX / 2; - base.m_identifierTableAndFlags.setFlag(UString::Rep::StaticFlag); - base.checkConsistency(); -} +UString::Rep* UString::s_nullRep; +UString* UString::s_nullUString; void initializeUString() { - UString::Rep::nullBaseString = new UString::BaseString(0, 0); - initializeStaticBaseString(*UString::Rep::nullBaseString); - - UString::Rep::emptyBaseString = new UString::BaseString(&sharedEmptyChar, 0); - initializeStaticBaseString(*UString::Rep::emptyBaseString); - - UString::nullUString = new UString; -} - -static char* statBuffer = 0; // Only used for debugging via UString::ascii(). - -PassRefPtr UString::Rep::createCopying(const UChar* d, int l) -{ - UChar* copyD = static_cast(fastMalloc(l * sizeof(UChar))); - copyChars(copyD, d, l); - return create(copyD, l); -} - -PassRefPtr UString::Rep::createFromUTF8(const char* string) -{ - if (!string) - return &UString::Rep::null(); - - size_t length = strlen(string); - Vector buffer(length); - UChar* p = buffer.data(); - if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length)) - return &UString::Rep::null(); - - return UString::Rep::createCopying(buffer.data(), p - buffer.data()); -} - -PassRefPtr UString::Rep::create(UChar* string, int length, PassRefPtr sharedBuffer) -{ - PassRefPtr rep = create(string, length); - rep->baseString()->setSharedBuffer(sharedBuffer); - rep->checkConsistency(); - return rep; -} - -UString::SharedUChar* UString::Rep::sharedBuffer() -{ - UString::BaseString* base = baseString(); - if (len < minLengthToShare) - return 0; - - return base->sharedBuffer(); -} - -void UString::Rep::destroy() -{ - checkConsistency(); - - // Static null and empty strings can never be destroyed, but we cannot rely on - // reference counting, because ref/deref are not thread-safe. - if (!isStatic()) { - if (identifierTable()) - Identifier::remove(this); - - UString::BaseString* base = baseString(); - if (base == this) { - if (m_sharedBuffer) - m_sharedBuffer->deref(); - else - fastFree(base->buf); - } else - base->deref(); - - delete this; - } -} - -// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's -// or anything like that. -const unsigned PHI = 0x9e3779b9U; - -// Paul Hsieh's SuperFastHash -// http://www.azillionmonkeys.com/qed/hash.html -unsigned UString::Rep::computeHash(const UChar* s, int len) -{ - unsigned l = len; - uint32_t hash = PHI; - uint32_t tmp; - - int rem = l & 1; - l >>= 1; - - // Main loop - for (; l > 0; l--) { - hash += s[0]; - tmp = (s[1] << 11) ^ hash; - hash = (hash << 16) ^ tmp; - s += 2; - hash += hash >> 11; - } - - // Handle end case - if (rem) { - hash += s[0]; - hash ^= hash << 11; - hash += hash >> 17; - } - - // Force "avalanching" of final 127 bits - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 2; - hash += hash >> 15; - hash ^= hash << 10; - - // this avoids ever returning a hash code of 0, since that is used to - // signal "hash not computed yet", using a value that is likely to be - // effectively the same as 0 when the low bits are masked - if (hash == 0) - hash = 0x80000000; - - return hash; -} - -// Paul Hsieh's SuperFastHash -// http://www.azillionmonkeys.com/qed/hash.html -unsigned UString::Rep::computeHash(const char* s, int l) -{ - // This hash is designed to work on 16-bit chunks at a time. But since the normal case - // (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they - // were 16-bit chunks, which should give matching results - - uint32_t hash = PHI; - uint32_t tmp; - - size_t rem = l & 1; - l >>= 1; - - // Main loop - for (; l > 0; l--) { - hash += static_cast(s[0]); - tmp = (static_cast(s[1]) << 11) ^ hash; - hash = (hash << 16) ^ tmp; - s += 2; - hash += hash >> 11; - } - - // Handle end case - if (rem) { - hash += static_cast(s[0]); - hash ^= hash << 11; - hash += hash >> 17; - } - - // Force "avalanching" of final 127 bits - hash ^= hash << 3; - hash += hash >> 5; - hash ^= hash << 2; - hash += hash >> 15; - hash ^= hash << 10; - - // this avoids ever returning a hash code of 0, since that is used to - // signal "hash not computed yet", using a value that is likely to be - // effectively the same as 0 when the low bits are masked - if (hash == 0) - hash = 0x80000000; - - return hash; -} - -#ifndef NDEBUG -void UString::Rep::checkConsistency() const -{ - const UString::BaseString* base = baseString(); - - // There is no recursion for base strings. - ASSERT(base == base->baseString()); - - if (isStatic()) { - // There are only two static strings: null and empty. - ASSERT(!len); - - // Static strings cannot get in identifier tables, because they are globally shared. - ASSERT(!identifierTable()); - } - - // The string fits in buffer. - ASSERT(base->usedPreCapacity <= base->preCapacity); - ASSERT(base->usedCapacity <= base->capacity); - ASSERT(-offset <= base->usedPreCapacity); - ASSERT(offset + len <= base->usedCapacity); -} -#endif - -UString::SharedUChar* UString::BaseString::sharedBuffer() -{ - if (!m_sharedBuffer) - setSharedBuffer(SharedUChar::create(new OwnFastMallocPtr(buf))); - return m_sharedBuffer; -} - -void UString::BaseString::setSharedBuffer(PassRefPtr sharedBuffer) -{ - // The manual steps below are because m_sharedBuffer can't be a RefPtr. m_sharedBuffer - // is in a union with another variable to avoid making BaseString any larger. - if (m_sharedBuffer) - m_sharedBuffer->deref(); - m_sharedBuffer = sharedBuffer.releaseRef(); -} - -bool UString::BaseString::slowIsBufferReadOnly() -{ - // The buffer may not be modified as soon as the underlying data has been shared with another class. - if (m_sharedBuffer->isShared()) - return true; - - // At this point, we know it that the underlying buffer isn't shared outside of this base class, - // so get rid of m_sharedBuffer. - OwnPtr > mallocPtr(m_sharedBuffer->release()); - UChar* unsharedBuf = const_cast(mallocPtr->release()); - setSharedBuffer(0); - preCapacity += (buf - unsharedBuf); - buf = unsharedBuf; - return false; -} - -// Put these early so they can be inlined. -static inline size_t expandedSize(size_t capacitySize, size_t precapacitySize) -{ - // Combine capacitySize & precapacitySize to produce a single size to allocate, - // check that doing so does not result in overflow. - size_t size = capacitySize + precapacitySize; - if (size < capacitySize) - return overflowIndicator(); - - // Small Strings (up to 4 pages): - // Expand the allocation size to 112.5% of the amount requested. This is largely sicking - // to our previous policy, however 112.5% is cheaper to calculate. - if (size < 0x4000) { - size_t expandedSize = ((size + (size >> 3)) | 15) + 1; - // Given the limited range within which we calculate the expansion in this - // fashion the above calculation should never overflow. - ASSERT(expandedSize >= size); - ASSERT(expandedSize < maxUChars()); - return expandedSize; - } - - // Medium Strings (up to 128 pages): - // For pages covering multiple pages over-allocation is less of a concern - any unused - // space will not be paged in if it is not used, so this is purely a VM overhead. For - // these strings allocate 2x the requested size. - if (size < 0x80000) { - size_t expandedSize = ((size + size) | 0xfff) + 1; - // Given the limited range within which we calculate the expansion in this - // fashion the above calculation should never overflow. - ASSERT(expandedSize >= size); - ASSERT(expandedSize < maxUChars()); - return expandedSize; - } - - // Large Strings (to infinity and beyond!): - // Revert to our 112.5% policy - probably best to limit the amount of unused VM we allow - // any individual string be responsible for. - size_t expandedSize = ((size + (size >> 3)) | 0xfff) + 1; - - // Check for overflow - any result that is at least as large as requested (but - // still below the limit) is okay. - if ((expandedSize >= size) && (expandedSize < maxUChars())) - return expandedSize; - return overflowIndicator(); -} - -static inline bool expandCapacity(UString::Rep* rep, int requiredLength) -{ - rep->checkConsistency(); - ASSERT(!rep->baseString()->isBufferReadOnly()); - - UString::BaseString* base = rep->baseString(); - - if (requiredLength > base->capacity) { - size_t newCapacity = expandedSize(requiredLength, base->preCapacity); - UChar* oldBuf = base->buf; - if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) { - base->buf = oldBuf; - return false; - } - base->capacity = newCapacity - base->preCapacity; - } - if (requiredLength > base->usedCapacity) - base->usedCapacity = requiredLength; - - rep->checkConsistency(); - return true; -} - -bool UString::Rep::reserveCapacity(int capacity) -{ - // If this is an empty string there is no point 'growing' it - just allocate a new one. - // If the BaseString is shared with another string that is using more capacity than this - // string is, then growing the buffer won't help. - // If the BaseString's buffer is readonly, then it isn't allowed to grow. - UString::BaseString* base = baseString(); - if (!base->buf || !base->capacity || (offset + len) != base->usedCapacity || base->isBufferReadOnly()) - return false; - - // If there is already sufficient capacity, no need to grow! - if (capacity <= base->capacity) - return true; - - checkConsistency(); - - size_t newCapacity = expandedSize(capacity, base->preCapacity); - UChar* oldBuf = base->buf; - if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) { - base->buf = oldBuf; - return false; - } - base->capacity = newCapacity - base->preCapacity; - - checkConsistency(); - return true; -} - -void UString::expandCapacity(int requiredLength) -{ - if (!JSC::expandCapacity(m_rep.get(), requiredLength)) - makeNull(); -} - -void UString::expandPreCapacity(int requiredPreCap) -{ - m_rep->checkConsistency(); - ASSERT(!m_rep->baseString()->isBufferReadOnly()); - - BaseString* base = m_rep->baseString(); - - if (requiredPreCap > base->preCapacity) { - size_t newCapacity = expandedSize(requiredPreCap, base->capacity); - int delta = newCapacity - base->capacity - base->preCapacity; - - UChar* newBuf; - if (!allocChars(newCapacity).getValue(newBuf)) { - makeNull(); - return; - } - copyChars(newBuf + delta, base->buf, base->capacity + base->preCapacity); - fastFree(base->buf); - base->buf = newBuf; - - base->preCapacity = newCapacity - base->capacity; - } - if (requiredPreCap > base->usedPreCapacity) - base->usedPreCapacity = requiredPreCap; - - m_rep->checkConsistency(); -} - -static PassRefPtr createRep(const char* c) -{ - if (!c) - return &UString::Rep::null(); - - if (!c[0]) - return &UString::Rep::empty(); - - size_t length = strlen(c); - UChar* d; - if (!allocChars(length).getValue(d)) - return &UString::Rep::null(); - else { - for (size_t i = 0; i < length; i++) - d[i] = static_cast(c[i]); // use unsigned char to zero-extend instead of sign-extend - return UString::Rep::create(d, static_cast(length)); - } + UStringImpl::s_empty = new UStringImpl(&sharedEmptyChar, 0, UStringImpl::ConstructStaticString); + UString::s_nullRep = new UStringImpl(0, 0, UStringImpl::ConstructStaticString); + UString::s_nullUString = new UString; } UString::UString(const char* c) - : m_rep(createRep(c)) + : m_rep(Rep::create(c)) { } -UString::UString(const UChar* c, int length) +UString::UString(const char* c, unsigned length) + : m_rep(Rep::create(c, length)) { - if (length == 0) - m_rep = &Rep::empty(); - else - m_rep = Rep::createCopying(c, length); } -UString::UString(UChar* c, int length, bool copy) +UString::UString(const UChar* c, unsigned length) { if (length == 0) m_rep = &Rep::empty(); - else if (copy) - m_rep = Rep::createCopying(c, length); else m_rep = Rep::create(c, length); } -UString::UString(const Vector& buffer) -{ - if (!buffer.size()) - m_rep = &Rep::empty(); - else - m_rep = Rep::createCopying(buffer.data(), buffer.size()); -} - -static ALWAYS_INLINE int newCapacityWithOverflowCheck(const int currentCapacity, const int extendLength, const bool plusOne = false) -{ - ASSERT_WITH_MESSAGE(extendLength >= 0, "extendedLength = %d", extendLength); - - const int plusLength = plusOne ? 1 : 0; - if (currentCapacity > std::numeric_limits::max() - extendLength - plusLength) - CRASH(); - - return currentCapacity + extendLength + plusLength; -} - -static ALWAYS_INLINE PassRefPtr concatenate(PassRefPtr r, const UChar* tData, int tSize) -{ - RefPtr rep = r; - - rep->checkConsistency(); - - int thisSize = rep->size(); - int thisOffset = rep->offset; - int length = thisSize + tSize; - UString::BaseString* base = rep->baseString(); - - // possible cases: - if (tSize == 0) { - // t is empty - } else if (thisSize == 0) { - // this is empty - rep = UString::Rep::createCopying(tData, tSize); - } else if (rep == base && !base->isShared()) { - // this is direct and has refcount of 1 (so we can just alter it directly) - if (!expandCapacity(rep.get(), newCapacityWithOverflowCheck(thisOffset, length))) - rep = &UString::Rep::null(); - if (rep->data()) { - copyChars(rep->data() + thisSize, tData, tSize); - rep->len = length; - rep->_hash = 0; - } - } else if (thisOffset + thisSize == base->usedCapacity && thisSize >= minShareSize && !base->isBufferReadOnly()) { - // this reaches the end of the buffer - extend it if it's long enough to append to - if (!expandCapacity(rep.get(), newCapacityWithOverflowCheck(thisOffset, length))) - rep = &UString::Rep::null(); - if (rep->data()) { - copyChars(rep->data() + thisSize, tData, tSize); - rep = UString::Rep::create(rep, 0, length); - } - } else { - // This is shared in some way that prevents us from modifying base, so we must make a whole new string. - size_t newCapacity = expandedSize(length, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - rep = &UString::Rep::null(); - else { - copyChars(d, rep->data(), thisSize); - copyChars(d + thisSize, tData, tSize); - rep = UString::Rep::create(d, length); - rep->baseString()->capacity = newCapacity; - } - } - - rep->checkConsistency(); - - return rep.release(); -} - -static ALWAYS_INLINE PassRefPtr concatenate(PassRefPtr r, const char* t) -{ - RefPtr rep = r; - - rep->checkConsistency(); - - int thisSize = rep->size(); - int thisOffset = rep->offset; - int tSize = static_cast(strlen(t)); - int length = thisSize + tSize; - UString::BaseString* base = rep->baseString(); - - // possible cases: - if (thisSize == 0) { - // this is empty - rep = createRep(t); - } else if (tSize == 0) { - // t is empty, we'll just return *this below. - } else if (rep == base && !base->isShared()) { - // this is direct and has refcount of 1 (so we can just alter it directly) - expandCapacity(rep.get(), newCapacityWithOverflowCheck(thisOffset, length)); - UChar* d = rep->data(); - if (d) { - for (int i = 0; i < tSize; ++i) - d[thisSize + i] = static_cast(t[i]); // use unsigned char to zero-extend instead of sign-extend - rep->len = length; - rep->_hash = 0; - } - } else if (thisOffset + thisSize == base->usedCapacity && thisSize >= minShareSize && !base->isBufferReadOnly()) { - // this string reaches the end of the buffer - extend it - expandCapacity(rep.get(), newCapacityWithOverflowCheck(thisOffset, length)); - UChar* d = rep->data(); - if (d) { - for (int i = 0; i < tSize; ++i) - d[thisSize + i] = static_cast(t[i]); // use unsigned char to zero-extend instead of sign-extend - rep = UString::Rep::create(rep, 0, length); - } - } else { - // This is shared in some way that prevents us from modifying base, so we must make a whole new string. - size_t newCapacity = expandedSize(length, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - rep = &UString::Rep::null(); - else { - copyChars(d, rep->data(), thisSize); - for (int i = 0; i < tSize; ++i) - d[thisSize + i] = static_cast(t[i]); // use unsigned char to zero-extend instead of sign-extend - rep = UString::Rep::create(d, length); - rep->baseString()->capacity = newCapacity; - } - } - - rep->checkConsistency(); - - return rep.release(); -} - -PassRefPtr concatenate(UString::Rep* a, UString::Rep* b) -{ - a->checkConsistency(); - b->checkConsistency(); - - int aSize = a->size(); - int bSize = b->size(); - int aOffset = a->offset; - - // possible cases: - - UString::BaseString* aBase = a->baseString(); - if (bSize == 1 && aOffset + aSize == aBase->usedCapacity && aOffset + aSize < aBase->capacity && !aBase->isBufferReadOnly()) { - // b is a single character (common fast case) - ++aBase->usedCapacity; - a->data()[aSize] = b->data()[0]; - return UString::Rep::create(a, 0, aSize + 1); - } - - // a is empty - if (aSize == 0) - return b; - // b is empty - if (bSize == 0) - return a; - - int bOffset = b->offset; - int length = aSize + bSize; - - UString::BaseString* bBase = b->baseString(); - if (aOffset + aSize == aBase->usedCapacity && aSize >= minShareSize && 4 * aSize >= bSize - && (-bOffset != bBase->usedPreCapacity || aSize >= bSize) && !aBase->isBufferReadOnly()) { - // - a reaches the end of its buffer so it qualifies for shared append - // - also, it's at least a quarter the length of b - appending to a much shorter - // string does more harm than good - // - however, if b qualifies for prepend and is longer than a, we'd rather prepend - - UString x(a); - x.expandCapacity(newCapacityWithOverflowCheck(aOffset, length)); - if (!a->data() || !x.data()) - return 0; - copyChars(a->data() + aSize, b->data(), bSize); - PassRefPtr result = UString::Rep::create(a, 0, length); - - a->checkConsistency(); - b->checkConsistency(); - result->checkConsistency(); - - return result; - } - - if (-bOffset == bBase->usedPreCapacity && bSize >= minShareSize && 4 * bSize >= aSize && !bBase->isBufferReadOnly()) { - // - b reaches the beginning of its buffer so it qualifies for shared prepend - // - also, it's at least a quarter the length of a - prepending to a much shorter - // string does more harm than good - UString y(b); - y.expandPreCapacity(-bOffset + aSize); - if (!b->data() || !y.data()) - return 0; - copyChars(b->data() - aSize, a->data(), aSize); - PassRefPtr result = UString::Rep::create(b, -aSize, length); - - a->checkConsistency(); - b->checkConsistency(); - result->checkConsistency(); - - return result; - } - - // a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string - size_t newCapacity = expandedSize(length, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - return 0; - copyChars(d, a->data(), aSize); - copyChars(d + aSize, b->data(), bSize); - PassRefPtr result = UString::Rep::create(d, length); - result->baseString()->capacity = newCapacity; - - a->checkConsistency(); - b->checkConsistency(); - result->checkConsistency(); - - return result; -} - -PassRefPtr concatenate(UString::Rep* rep, int i) -{ - UChar buf[1 + sizeof(i) * 3]; - UChar* end = buf + sizeof(buf) / sizeof(UChar); - UChar* p = end; - - if (i == 0) - *--p = '0'; - else if (i == INT_MIN) { - char minBuf[1 + sizeof(i) * 3]; - sprintf(minBuf, "%d", INT_MIN); - return concatenate(rep, minBuf); - } else { - bool negative = false; - if (i < 0) { - negative = true; - i = -i; - } - while (i) { - *--p = static_cast((i % 10) + '0'); - i /= 10; - } - if (negative) - *--p = '-'; - } - - return concatenate(rep, p, static_cast(end - p)); - -} - -PassRefPtr concatenate(UString::Rep* rep, double d) -{ - // avoid ever printing -NaN, in JS conceptually there is only one NaN value - if (isnan(d)) - return concatenate(rep, "NaN"); - - if (d == 0.0) // stringify -0 as 0 - d = 0.0; - - char buf[80]; - int decimalPoint; - int sign; - - char result[80]; - WTF::dtoa(result, d, 0, &decimalPoint, &sign, NULL); - int length = static_cast(strlen(result)); - - int i = 0; - if (sign) - buf[i++] = '-'; - - if (decimalPoint <= 0 && decimalPoint > -6) { - buf[i++] = '0'; - buf[i++] = '.'; - for (int j = decimalPoint; j < 0; j++) - buf[i++] = '0'; - strcpy(buf + i, result); - } else if (decimalPoint <= 21 && decimalPoint > 0) { - if (length <= decimalPoint) { - strcpy(buf + i, result); - i += length; - for (int j = 0; j < decimalPoint - length; j++) - buf[i++] = '0'; - buf[i] = '\0'; - } else { - strncpy(buf + i, result, decimalPoint); - i += decimalPoint; - buf[i++] = '.'; - strcpy(buf + i, result + decimalPoint); - } - } else if (result[0] < '0' || result[0] > '9') - strcpy(buf + i, result); - else { - buf[i++] = result[0]; - if (length > 1) { - buf[i++] = '.'; - strcpy(buf + i, result + 1); - i += length - 1; - } - - buf[i++] = 'e'; - buf[i++] = (decimalPoint >= 0) ? '+' : '-'; - // decimalPoint can't be more than 3 digits decimal given the - // nature of float representation - int exponential = decimalPoint - 1; - if (exponential < 0) - exponential = -exponential; - if (exponential >= 100) - buf[i++] = static_cast('0' + exponential / 100); - if (exponential >= 10) - buf[i++] = static_cast('0' + (exponential % 100) / 10); - buf[i++] = static_cast('0' + exponential % 10); - buf[i++] = '\0'; - } - - return concatenate(rep, buf); -} - UString UString::from(int i) { UChar buf[1 + sizeof(i) * 3]; UChar* end = buf + sizeof(buf) / sizeof(UChar); UChar* p = end; - + if (i == 0) *--p = '0'; else if (i == INT_MIN) { @@ -940,7 +206,7 @@ UString UString::from(int i) *--p = '-'; } - return UString(p, static_cast(end - p)); + return UString(p, static_cast(end - p)); } UString UString::from(long long i) @@ -953,7 +219,7 @@ UString UString::from(long long i) *--p = '0'; else if (i == std::numeric_limits::min()) { char minBuf[1 + sizeof(i) * 3]; -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) snprintf(minBuf, sizeof(minBuf) - 1, "%I64d", std::numeric_limits::min()); #else snprintf(minBuf, sizeof(minBuf) - 1, "%lld", std::numeric_limits::min()); @@ -973,7 +239,7 @@ UString UString::from(long long i) *--p = '-'; } - return UString(p, static_cast(end - p)); + return UString(p, static_cast(end - p)); } UString UString::from(unsigned int u) @@ -981,7 +247,7 @@ UString UString::from(unsigned int u) UChar buf[sizeof(u) * 3]; UChar* end = buf + sizeof(buf) / sizeof(UChar); UChar* p = end; - + if (u == 0) *--p = '0'; else { @@ -990,8 +256,8 @@ UString UString::from(unsigned int u) u /= 10; } } - - return UString(p, static_cast(end - p)); + + return UString(p, static_cast(end - p)); } UString UString::from(long l) @@ -1020,264 +286,21 @@ UString UString::from(long l) *--p = '-'; } - return UString(p, static_cast(end - p)); + return UString(p, end - p); } UString UString::from(double d) { - // avoid ever printing -NaN, in JS conceptually there is only one NaN value - if (isnan(d)) - return "NaN"; - if (!d) - return "0"; // -0 -> "0" - - char buf[80]; - int decimalPoint; - int sign; - - char result[80]; - WTF::dtoa(result, d, 0, &decimalPoint, &sign, NULL); - int length = static_cast(strlen(result)); - - int i = 0; - if (sign) - buf[i++] = '-'; - - if (decimalPoint <= 0 && decimalPoint > -6) { - buf[i++] = '0'; - buf[i++] = '.'; - for (int j = decimalPoint; j < 0; j++) - buf[i++] = '0'; - strcpy(buf + i, result); - } else if (decimalPoint <= 21 && decimalPoint > 0) { - if (length <= decimalPoint) { - strcpy(buf + i, result); - i += length; - for (int j = 0; j < decimalPoint - length; j++) - buf[i++] = '0'; - buf[i] = '\0'; - } else { - strncpy(buf + i, result, decimalPoint); - i += decimalPoint; - buf[i++] = '.'; - strcpy(buf + i, result + decimalPoint); - } - } else if (result[0] < '0' || result[0] > '9') - strcpy(buf + i, result); - else { - buf[i++] = result[0]; - if (length > 1) { - buf[i++] = '.'; - strcpy(buf + i, result + 1); - i += length - 1; - } - - buf[i++] = 'e'; - buf[i++] = (decimalPoint >= 0) ? '+' : '-'; - // decimalPoint can't be more than 3 digits decimal given the - // nature of float representation - int exponential = decimalPoint - 1; - if (exponential < 0) - exponential = -exponential; - if (exponential >= 100) - buf[i++] = static_cast('0' + exponential / 100); - if (exponential >= 10) - buf[i++] = static_cast('0' + (exponential % 100) / 10); - buf[i++] = static_cast('0' + exponential % 10); - buf[i++] = '\0'; - } - - return UString(buf); -} - -UString UString::spliceSubstringsWithSeparators(const Range* substringRanges, int rangeCount, const UString* separators, int separatorCount) const -{ - m_rep->checkConsistency(); - - if (rangeCount == 1 && separatorCount == 0) { - int thisSize = size(); - int position = substringRanges[0].position; - int length = substringRanges[0].length; - if (position <= 0 && length >= thisSize) - return *this; - return UString::Rep::create(m_rep, max(0, position), min(thisSize, length)); - } - - int totalLength = 0; - for (int i = 0; i < rangeCount; i++) - totalLength += substringRanges[i].length; - for (int i = 0; i < separatorCount; i++) - totalLength += separators[i].size(); - - if (totalLength == 0) - return ""; - - UChar* buffer; - if (!allocChars(totalLength).getValue(buffer)) - return null(); - - int maxCount = max(rangeCount, separatorCount); - int bufferPos = 0; - for (int i = 0; i < maxCount; i++) { - if (i < rangeCount) { - copyChars(buffer + bufferPos, data() + substringRanges[i].position, substringRanges[i].length); - bufferPos += substringRanges[i].length; - } - if (i < separatorCount) { - copyChars(buffer + bufferPos, separators[i].data(), separators[i].size()); - bufferPos += separators[i].size(); - } - } - - return UString::Rep::create(buffer, totalLength); -} - -UString UString::replaceRange(int rangeStart, int rangeLength, const UString& replacement) const -{ - m_rep->checkConsistency(); - - int replacementLength = replacement.size(); - int totalLength = size() - rangeLength + replacementLength; - if (totalLength == 0) - return ""; - - UChar* buffer; - if (!allocChars(totalLength).getValue(buffer)) - return null(); - - copyChars(buffer, data(), rangeStart); - copyChars(buffer + rangeStart, replacement.data(), replacementLength); - int rangeEnd = rangeStart + rangeLength; - copyChars(buffer + rangeStart + replacementLength, data() + rangeEnd, size() - rangeEnd); - - return UString::Rep::create(buffer, totalLength); -} - - -UString& UString::append(const UString &t) -{ - m_rep->checkConsistency(); - t.rep()->checkConsistency(); - - int thisSize = size(); - int thisOffset = m_rep->offset; - int tSize = t.size(); - int length = thisSize + tSize; - BaseString* base = m_rep->baseString(); - - // possible cases: - if (thisSize == 0) { - // this is empty - *this = t; - } else if (tSize == 0) { - // t is empty - } else if (m_rep == base && !base->isShared()) { - // this is direct and has refcount of 1 (so we can just alter it directly) - expandCapacity(newCapacityWithOverflowCheck(thisOffset, length)); - if (data()) { - copyChars(m_rep->data() + thisSize, t.data(), tSize); - m_rep->len = length; - m_rep->_hash = 0; - } - } else if (thisOffset + thisSize == base->usedCapacity && thisSize >= minShareSize && !base->isBufferReadOnly()) { - // this reaches the end of the buffer - extend it if it's long enough to append to - expandCapacity(newCapacityWithOverflowCheck(thisOffset, length)); - if (data()) { - copyChars(m_rep->data() + thisSize, t.data(), tSize); - m_rep = Rep::create(m_rep, 0, length); - } - } else { - // This is shared in some way that prevents us from modifying base, so we must make a whole new string. - size_t newCapacity = expandedSize(length, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - makeNull(); - else { - copyChars(d, data(), thisSize); - copyChars(d + thisSize, t.data(), tSize); - m_rep = Rep::create(d, length); - m_rep->baseString()->capacity = newCapacity; - } - } - - m_rep->checkConsistency(); - t.rep()->checkConsistency(); - - return *this; -} - -UString& UString::append(const UChar* tData, int tSize) -{ - m_rep = concatenate(m_rep.release(), tData, tSize); - return *this; -} - -UString& UString::append(const char* t) -{ - m_rep = concatenate(m_rep.release(), t); - return *this; -} - -UString& UString::append(UChar c) -{ - m_rep->checkConsistency(); - - int thisOffset = m_rep->offset; - int length = size(); - BaseString* base = m_rep->baseString(); - - // possible cases: - if (length == 0) { - // this is empty - must make a new m_rep because we don't want to pollute the shared empty one - size_t newCapacity = expandedSize(1, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - makeNull(); - else { - d[0] = c; - m_rep = Rep::create(d, 1); - m_rep->baseString()->capacity = newCapacity; - } - } else if (m_rep == base && !base->isShared()) { - // this is direct and has refcount of 1 (so we can just alter it directly) - expandCapacity(newCapacityWithOverflowCheck(thisOffset, length, true)); - UChar* d = m_rep->data(); - if (d) { - d[length] = c; - m_rep->len = length + 1; - m_rep->_hash = 0; - } - } else if (thisOffset + length == base->usedCapacity && length >= minShareSize && !base->isBufferReadOnly()) { - // this reaches the end of the string - extend it and share - expandCapacity(newCapacityWithOverflowCheck(thisOffset, length, true)); - UChar* d = m_rep->data(); - if (d) { - d[length] = c; - m_rep = Rep::create(m_rep, 0, length + 1); - } - } else { - // This is shared in some way that prevents us from modifying base, so we must make a whole new string. - size_t newCapacity = expandedSize(length + 1, 0); - UChar* d; - if (!allocChars(newCapacity).getValue(d)) - makeNull(); - else { - copyChars(d, data(), length); - d[length] = c; - m_rep = Rep::create(d, length + 1); - m_rep->baseString()->capacity = newCapacity; - } - } - - m_rep->checkConsistency(); - - return *this; + DtoaBuffer buffer; + unsigned length; + doubleToStringInJavaScriptFormat(d, buffer, &length); + return UString(buffer, length); } bool UString::getCString(CStringBuffer& buffer) const { - int length = size(); - int neededSize = length + 1; + unsigned length = size(); + unsigned neededSize = length + 1; buffer.resize(neededSize); char* buf = buffer.data(); @@ -1299,13 +322,15 @@ bool UString::getCString(CStringBuffer& buffer) const char* UString::ascii() const { - int length = size(); - int neededSize = length + 1; - delete[] statBuffer; - statBuffer = new char[neededSize]; + static char* asciiBuffer = 0; + + unsigned length = size(); + unsigned neededSize = length + 1; + delete[] asciiBuffer; + asciiBuffer = new char[neededSize]; const UChar* p = data(); - char* q = statBuffer; + char* q = asciiBuffer; const UChar* limit = p + length; while (p != limit) { *q = static_cast(p[0]); @@ -1314,39 +339,7 @@ char* UString::ascii() const } *q = '\0'; - return statBuffer; -} - -UString& UString::operator=(const char* c) -{ - if (!c) { - m_rep = &Rep::null(); - return *this; - } - - if (!c[0]) { - m_rep = &Rep::empty(); - return *this; - } - - int l = static_cast(strlen(c)); - UChar* d; - BaseString* base = m_rep->baseString(); - if (!base->isShared() && l <= base->capacity && m_rep == base && m_rep->offset == 0 && base->preCapacity == 0) { - d = base->buf; - m_rep->_hash = 0; - m_rep->len = l; - } else { - if (!allocChars(l).getValue(d)) { - makeNull(); - return *this; - } - m_rep = Rep::create(d, l); - } - for (int i = 0; i < l; i++) - d[i] = static_cast(c[i]); // use unsigned char to zero-extend instead of sign-extend - - return *this; + return asciiBuffer; } bool UString::is8Bit() const @@ -1362,7 +355,7 @@ bool UString::is8Bit() const return true; } -UChar UString::operator[](int pos) const +UChar UString::operator[](unsigned pos) const { if (pos >= size()) return '\0'; @@ -1502,7 +495,7 @@ uint32_t UString::toStrictUInt32(bool* ok) const *ok = false; // Empty string is not OK. - int len = m_rep->len; + unsigned len = m_rep->length(); if (len == 0) return 0; const UChar* p = m_rep->data(); @@ -1546,12 +539,9 @@ uint32_t UString::toStrictUInt32(bool* ok) const } } -int UString::find(const UString& f, int pos) const +unsigned UString::find(const UString& f, unsigned pos) const { - int fsz = f.size(); - - if (pos < 0) - pos = 0; + unsigned fsz = f.size(); if (fsz == 1) { UChar ch = f[0]; @@ -1560,16 +550,16 @@ int UString::find(const UString& f, int pos) const if (*c == ch) return static_cast(c - data()); } - return -1; + return NotFound; } - int sz = size(); + unsigned sz = size(); if (sz < fsz) - return -1; + return NotFound; if (fsz == 0) return pos; const UChar* end = data() + sz - fsz; - int fsizeminusone = (fsz - 1) * sizeof(UChar); + unsigned fsizeminusone = (fsz - 1) * sizeof(UChar); const UChar* fdata = f.data(); unsigned short fchar = fdata[0]; ++fdata; @@ -1578,48 +568,44 @@ int UString::find(const UString& f, int pos) const return static_cast(c - data()); } - return -1; + return NotFound; } -int UString::find(UChar ch, int pos) const +unsigned UString::find(UChar ch, unsigned pos) const { - if (pos < 0) - pos = 0; const UChar* end = data() + size(); for (const UChar* c = data() + pos; c < end; c++) { if (*c == ch) return static_cast(c - data()); } - - return -1; + + return NotFound; } -int UString::rfind(const UString& f, int pos) const +unsigned UString::rfind(const UString& f, unsigned pos) const { - int sz = size(); - int fsz = f.size(); + unsigned sz = size(); + unsigned fsz = f.size(); if (sz < fsz) - return -1; - if (pos < 0) - pos = 0; + return NotFound; if (pos > sz - fsz) pos = sz - fsz; if (fsz == 0) return pos; - int fsizeminusone = (fsz - 1) * sizeof(UChar); + unsigned fsizeminusone = (fsz - 1) * sizeof(UChar); const UChar* fdata = f.data(); for (const UChar* c = data() + pos; c >= data(); c--) { if (*c == *fdata && !memcmp(c + 1, fdata + 1, fsizeminusone)) return static_cast(c - data()); } - return -1; + return NotFound; } -int UString::rfind(UChar ch, int pos) const +unsigned UString::rfind(UChar ch, unsigned pos) const { if (isEmpty()) - return -1; + return NotFound; if (pos + 1 >= size()) pos = size() - 1; for (const UChar* c = data() + pos; c >= data(); c--) { @@ -1627,21 +613,18 @@ int UString::rfind(UChar ch, int pos) const return static_cast(c - data()); } - return -1; + return NotFound; } -UString UString::substr(int pos, int len) const +UString UString::substr(unsigned pos, unsigned len) const { - int s = size(); + unsigned s = size(); - if (pos < 0) - pos = 0; - else if (pos >= s) + if (pos >= s) pos = s; - if (len < 0) - len = s; - if (pos + len >= s) - len = s - pos; + unsigned limit = s - pos; + if (len > limit) + len = limit; if (pos == 0 && len == s) return *this; @@ -1668,12 +651,12 @@ bool operator==(const UString& s1, const char *s2) bool operator<(const UString& s1, const UString& s2) { - const int l1 = s1.size(); - const int l2 = s2.size(); - const int lmin = l1 < l2 ? l1 : l2; + const unsigned l1 = s1.size(); + const unsigned l2 = s2.size(); + const unsigned lmin = l1 < l2 ? l1 : l2; const UChar* c1 = s1.data(); const UChar* c2 = s2.data(); - int l = 0; + unsigned l = 0; while (l < lmin && *c1 == *c2) { c1++; c2++; @@ -1687,12 +670,12 @@ bool operator<(const UString& s1, const UString& s2) bool operator>(const UString& s1, const UString& s2) { - const int l1 = s1.size(); - const int l2 = s2.size(); - const int lmin = l1 < l2 ? l1 : l2; + const unsigned l1 = s1.size(); + const unsigned l2 = s2.size(); + const unsigned lmin = l1 < l2 ? l1 : l2; const UChar* c1 = s1.data(); const UChar* c2 = s2.data(); - int l = 0; + unsigned l = 0; while (l < lmin && *c1 == *c2) { c1++; c2++; @@ -1706,12 +689,12 @@ bool operator>(const UString& s1, const UString& s2) int compare(const UString& s1, const UString& s2) { - const int l1 = s1.size(); - const int l2 = s2.size(); - const int lmin = l1 < l2 ? l1 : l2; + const unsigned l1 = s1.size(); + const unsigned l2 = s2.size(); + const unsigned lmin = l1 < l2 ? l1 : l2; const UChar* c1 = s1.data(); const UChar* c2 = s2.data(); - int l = 0; + unsigned l = 0; while (l < lmin && *c1 == *c2) { c1++; c2++; @@ -1729,12 +712,12 @@ int compare(const UString& s1, const UString& s2) bool equal(const UString::Rep* r, const UString::Rep* b) { - int length = r->len; - if (length != b->len) + unsigned length = r->length(); + if (length != b->length()) return false; const UChar* d = r->data(); const UChar* s = b->data(); - for (int i = 0; i != length; ++i) { + for (unsigned i = 0; i != length; ++i) { if (d[i] != s[i]) return false; } @@ -1744,7 +727,7 @@ bool equal(const UString::Rep* r, const UString::Rep* b) CString UString::UTF8String(bool strict) const { // Allocate a buffer big enough to hold all the characters. - const int length = size(); + const unsigned length = size(); Vector buffer(length * 3); // Convert to runs of 8-bit characters. @@ -1757,16 +740,4 @@ CString UString::UTF8String(bool strict) const return CString(buffer.data(), p - buffer.data()); } -// For use in error handling code paths -- having this not be inlined helps avoid PIC branches to fetch the global on Mac OS X. -NEVER_INLINE void UString::makeNull() -{ - m_rep = &Rep::null(); -} - -// For use in error handling code paths -- having this not be inlined helps avoid PIC branches to fetch the global on Mac OS X. -NEVER_INLINE UString::Rep* UString::nullRep() -{ - return &Rep::null(); -} - } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h index c4dad2a..75b43b7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UString.h @@ -24,13 +24,13 @@ #define UString_h #include "Collector.h" +#include "UStringImpl.h" #include #include #include #include #include #include -#include #include #include #include @@ -40,8 +40,6 @@ namespace JSC { using WTF::PlacementNewAdoptType; using WTF::PlacementNewAdopt; - class IdentifierTable; - class CString { public: CString() @@ -71,189 +69,42 @@ namespace JSC { char* m_data; }; + bool operator==(const CString&, const CString&); + typedef Vector CStringBuffer; class UString { friend class JIT; public: - typedef CrossThreadRefCounted > SharedUChar; - struct BaseString; - struct Rep : Noncopyable { - friend class JIT; - - static PassRefPtr create(UChar* buffer, int length) - { - return adoptRef(new BaseString(buffer, length)); - } - - static PassRefPtr createEmptyBuffer(size_t size) - { - // Guard against integer overflow - if (size < (std::numeric_limits::max() / sizeof(UChar))) { - void* buf = 0; - if (tryFastMalloc(size * sizeof(UChar)).getValue(buf)) - return adoptRef(new BaseString(static_cast(buf), 0, size)); - } - return adoptRef(new BaseString(0, 0, 0)); - } - - static PassRefPtr createCopying(const UChar*, int); - static PassRefPtr create(PassRefPtr base, int offset, int length); - - // Constructs a string from a UTF-8 string, using strict conversion (see comments in UTF8.h). - // Returns UString::Rep::null for null input or conversion failure. - static PassRefPtr createFromUTF8(const char*); - - // Uses SharedUChar to have joint ownership over the UChar*. - static PassRefPtr create(UChar*, int, PassRefPtr); - - SharedUChar* sharedBuffer(); - void destroy(); - - bool baseIsSelf() const { return m_identifierTableAndFlags.isFlagSet(BaseStringFlag); } - UChar* data() const; - int size() const { return len; } - - unsigned hash() const { if (_hash == 0) _hash = computeHash(data(), len); return _hash; } - unsigned computedHash() const { ASSERT(_hash); return _hash; } // fast path for Identifiers - - static unsigned computeHash(const UChar*, int length); - static unsigned computeHash(const char*, int length); - static unsigned computeHash(const char* s) { return computeHash(s, strlen(s)); } - - IdentifierTable* identifierTable() const { return m_identifierTableAndFlags.get(); } - void setIdentifierTable(IdentifierTable* table) { ASSERT(!isStatic()); m_identifierTableAndFlags.set(table); } - - bool isStatic() const { return m_identifierTableAndFlags.isFlagSet(StaticFlag); } - void setStatic(bool); - void setBaseString(PassRefPtr); - BaseString* baseString(); - const BaseString* baseString() const; - - Rep* ref() { ++rc; return this; } - ALWAYS_INLINE void deref() { if (--rc == 0) destroy(); } - - void checkConsistency() const; - enum UStringFlags { - StaticFlag, - BaseStringFlag - }; - - // unshared data - int offset; - int len; - int rc; // For null and empty static strings, this field does not reflect a correct count, because ref/deref are not thread-safe. A special case in destroy() guarantees that these do not get deleted. - mutable unsigned _hash; - PtrAndFlags m_identifierTableAndFlags; - - static BaseString& null() { return *nullBaseString; } - static BaseString& empty() { return *emptyBaseString; } - - bool reserveCapacity(int capacity); - - protected: - // Constructor for use by BaseString subclass; they use the union with m_baseString for another purpose. - Rep(int length) - : offset(0) - , len(length) - , rc(1) - , _hash(0) - , m_baseString(0) - { - } - - Rep(PassRefPtr base, int offsetInBase, int length) - : offset(offsetInBase) - , len(length) - , rc(1) - , _hash(0) - , m_baseString(base.releaseRef()) - { - checkConsistency(); - } - - union { - // If !baseIsSelf() - BaseString* m_baseString; - // If baseIsSelf() - SharedUChar* m_sharedBuffer; - }; - - private: - // For SmallStringStorage which allocates an array and does initialization manually. - Rep() { } - - friend class SmallStringsStorage; - friend void initializeUString(); - JS_EXPORTDATA static BaseString* nullBaseString; - JS_EXPORTDATA static BaseString* emptyBaseString; - }; - - - struct BaseString : public Rep { - bool isShared() { return rc != 1 || isBufferReadOnly(); } - void setSharedBuffer(PassRefPtr); - - bool isBufferReadOnly() - { - if (!m_sharedBuffer) - return false; - return slowIsBufferReadOnly(); - } - - // potentially shared data. - UChar* buf; - int preCapacity; - int usedPreCapacity; - int capacity; - int usedCapacity; - - size_t reportedCost; - - private: - BaseString(UChar* buffer, int length, int additionalCapacity = 0) - : Rep(length) - , buf(buffer) - , preCapacity(0) - , usedPreCapacity(0) - , capacity(length + additionalCapacity) - , usedCapacity(length) - , reportedCost(0) - { - m_identifierTableAndFlags.setFlag(BaseStringFlag); - checkConsistency(); - } - - SharedUChar* sharedBuffer(); - bool slowIsBufferReadOnly(); - - friend struct Rep; - friend class SmallStringsStorage; - friend void initializeUString(); - }; - + typedef UStringImpl Rep; + public: UString(); - UString(const char*); - UString(const UChar*, int length); - UString(UChar*, int length, bool copy); + UString(const char*); // Constructor for null-terminated string. + UString(const char*, unsigned length); + UString(const UChar*, unsigned length); + UString(const Vector& buffer); UString(const UString& s) : m_rep(s.m_rep) { } - UString(const Vector& buffer); + // Special constructor for cases where we overwrite an object in place. + UString(PlacementNewAdoptType) + : m_rep(PlacementNewAdopt) + { + } ~UString() { } - // Special constructor for cases where we overwrite an object in place. - UString(PlacementNewAdoptType) - : m_rep(PlacementNewAdopt) + template + static PassRefPtr adopt(Vector& vector) { + return Rep::adopt(vector); } static UString from(int); @@ -262,32 +113,6 @@ namespace JSC { static UString from(long); static UString from(double); - struct Range { - public: - Range(int pos, int len) - : position(pos) - , length(len) - { - } - - Range() - { - } - - int position; - int length; - }; - - UString spliceSubstringsWithSeparators(const Range* substringRanges, int rangeCount, const UString* separators, int separatorCount) const; - - UString replaceRange(int rangeStart, int RangeEnd, const UString& replacement) const; - - UString& append(const UString&); - UString& append(const char*); - UString& append(UChar); - UString& append(char c) { return append(static_cast(static_cast(c))); } - UString& append(const UChar*, int size); - bool getCString(CStringBuffer&) const; // NOTE: This method should only be used for *debugging* purposes as it @@ -304,21 +129,16 @@ namespace JSC { */ CString UTF8String(bool strict = false) const; - UString& operator=(const char*c); - - UString& operator+=(const UString& s) { return append(s); } - UString& operator+=(const char* s) { return append(s); } - const UChar* data() const { return m_rep->data(); } - bool isNull() const { return (m_rep == &Rep::null()); } - bool isEmpty() const { return (!m_rep->len); } + bool isNull() const { return m_rep == s_nullRep; } + bool isEmpty() const { return !m_rep->length(); } bool is8Bit() const; - int size() const { return m_rep->size(); } + unsigned size() const { return m_rep->length(); } - UChar operator[](int pos) const; + UChar operator[](unsigned pos) const; double toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) const; double toDouble(bool tolerateTrailingJunk) const; @@ -330,17 +150,17 @@ namespace JSC { unsigned toArrayIndex(bool* ok = 0) const; - int find(const UString& f, int pos = 0) const; - int find(UChar, int pos = 0) const; - int rfind(const UString& f, int pos) const; - int rfind(UChar, int pos) const; + static const unsigned NotFound = 0xFFFFFFFFu; + unsigned find(const UString& f, unsigned pos = 0) const; + unsigned find(UChar, unsigned pos = 0) const; + unsigned rfind(const UString& f, unsigned pos) const; + unsigned rfind(UChar, unsigned pos) const; - UString substr(int pos = 0, int len = -1) const; + UString substr(unsigned pos = 0, unsigned len = 0xFFFFFFFF) const; - static const UString& null() { return *nullUString; } + static const UString& null() { return *s_nullUString; } Rep* rep() const { return m_rep.get(); } - static Rep* nullRep(); UString(PassRefPtr r) : m_rep(r) @@ -348,38 +168,21 @@ namespace JSC { ASSERT(m_rep); } - size_t cost() const; - - // Attempt to grow this string such that it can grow to a total length of 'capacity' - // without reallocation. This may fail a number of reasons - if the BasicString is - // shared and another string is using part of the capacity beyond our end point, if - // the realloc fails, or if this string is empty and has no storage. - // - // This method returns a boolean indicating success. - bool reserveCapacity(int capacity) - { - return m_rep->reserveCapacity(capacity); - } + size_t cost() const { return m_rep->cost(); } private: - void expandCapacity(int requiredLength); - void expandPreCapacity(int requiredPreCap); - void makeNull(); - RefPtr m_rep; - static UString* nullUString; + + JS_EXPORTDATA static Rep* s_nullRep; + static UString* s_nullUString; friend void initializeUString(); friend bool operator==(const UString&, const UString&); - friend PassRefPtr concatenate(Rep*, Rep*); // returns 0 if out of memory }; - PassRefPtr concatenate(UString::Rep*, UString::Rep*); - PassRefPtr concatenate(UString::Rep*, int); - PassRefPtr concatenate(UString::Rep*, double); - inline bool operator==(const UString& s1, const UString& s2) + ALWAYS_INLINE bool operator==(const UString& s1, const UString& s2) { - int size = s1.size(); + unsigned size = s1.size(); switch (size) { case 0: return !s2.size(); @@ -423,117 +226,428 @@ namespace JSC { return !JSC::operator==(s1, s2); } - bool operator==(const CString&, const CString&); + int compare(const UString&, const UString&); - inline UString operator+(const UString& s1, const UString& s2) + inline UString::UString() + : m_rep(s_nullRep) { - RefPtr result = concatenate(s1.rep(), s2.rep()); - return UString(result ? result.release() : UString::nullRep()); } - int compare(const UString&, const UString&); + // Rule from ECMA 15.2 about what an array index is. + // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1. + inline unsigned UString::toArrayIndex(bool* ok) const + { + unsigned i = toStrictUInt32(ok); + if (ok && i >= 0xFFFFFFFFU) + *ok = false; + return i; + } - bool equal(const UString::Rep*, const UString::Rep*); + // We'd rather not do shared substring append for small strings, since + // this runs too much risk of a tiny initial string holding down a + // huge buffer. + static const unsigned minShareSize = Heap::minExtraCost / sizeof(UChar); - inline PassRefPtr UString::Rep::create(PassRefPtr rep, int offset, int length) - { - ASSERT(rep); - rep->checkConsistency(); + struct IdentifierRepHash : PtrHash > { + static unsigned hash(const RefPtr& key) { return key->existingHash(); } + static unsigned hash(JSC::UString::Rep* key) { return key->existingHash(); } + }; - int repOffset = rep->offset; + void initializeUString(); - PassRefPtr base = rep->baseString(); + template + class StringTypeAdapter { + }; - ASSERT(-(offset + repOffset) <= base->usedPreCapacity); - ASSERT(offset + repOffset + length <= base->usedCapacity); + template<> + class StringTypeAdapter { + public: + StringTypeAdapter(char* buffer) + : m_buffer((unsigned char*)buffer) + , m_length(strlen(buffer)) + { + } - // Steal the single reference this Rep was created with. - return adoptRef(new Rep(base, repOffset + offset, length)); - } + unsigned length() { return m_length; } + + void writeTo(UChar* destination) + { + for (unsigned i = 0; i < m_length; ++i) + destination[i] = m_buffer[i]; + } + + private: + const unsigned char* m_buffer; + unsigned m_length; + }; + + template<> + class StringTypeAdapter { + public: + StringTypeAdapter(const char* buffer) + : m_buffer((unsigned char*)buffer) + , m_length(strlen(buffer)) + { + } + + unsigned length() { return m_length; } - inline UChar* UString::Rep::data() const + void writeTo(UChar* destination) + { + for (unsigned i = 0; i < m_length; ++i) + destination[i] = m_buffer[i]; + } + + private: + const unsigned char* m_buffer; + unsigned m_length; + }; + + template<> + class StringTypeAdapter { + public: + StringTypeAdapter(UString& string) + : m_data(string.data()) + , m_length(string.size()) + { + } + + unsigned length() { return m_length; } + + void writeTo(UChar* destination) + { + for (unsigned i = 0; i < m_length; ++i) + destination[i] = m_data[i]; + } + + private: + const UChar* m_data; + unsigned m_length; + }; + + inline void sumWithOverflow(unsigned& total, unsigned addend, bool& overflow) { - const BaseString* base = baseString(); - return base->buf + base->preCapacity + offset; + unsigned oldTotal = total; + total = oldTotal + addend; + if (total < oldTotal) + overflow = true; } - inline void UString::Rep::setStatic(bool v) + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2) { - ASSERT(!identifierTable()); - if (v) - m_identifierTableAndFlags.setFlag(StaticFlag); - else - m_identifierTableAndFlags.clearFlag(StaticFlag); + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + + return resultImpl; } - inline void UString::Rep::setBaseString(PassRefPtr base) + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3) { - ASSERT(base != this); - ASSERT(!baseIsSelf()); - m_baseString = base.releaseRef(); + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + + return resultImpl; } - inline UString::BaseString* UString::Rep::baseString() + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4) { - return !baseIsSelf() ? m_baseString : reinterpret_cast(this) ; + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + StringTypeAdapter adapter4(string4); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + + return resultImpl; } - inline const UString::BaseString* UString::Rep::baseString() const + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5) { - return const_cast(this)->baseString(); + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + StringTypeAdapter adapter4(string4); + StringTypeAdapter adapter5(string5); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + sumWithOverflow(length, adapter5.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + result += adapter4.length(); + adapter5.writeTo(result); + + return resultImpl; } -#ifdef NDEBUG - inline void UString::Rep::checkConsistency() const + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6) { + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + StringTypeAdapter adapter4(string4); + StringTypeAdapter adapter5(string5); + StringTypeAdapter adapter6(string6); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + sumWithOverflow(length, adapter5.length(), overflow); + sumWithOverflow(length, adapter6.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + result += adapter4.length(); + adapter5.writeTo(result); + result += adapter5.length(); + adapter6.writeTo(result); + + return resultImpl; } -#endif - inline UString::UString() - : m_rep(&Rep::null()) + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7) { + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + StringTypeAdapter adapter4(string4); + StringTypeAdapter adapter5(string5); + StringTypeAdapter adapter6(string6); + StringTypeAdapter adapter7(string7); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + sumWithOverflow(length, adapter5.length(), overflow); + sumWithOverflow(length, adapter6.length(), overflow); + sumWithOverflow(length, adapter7.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + result += adapter4.length(); + adapter5.writeTo(result); + result += adapter5.length(); + adapter6.writeTo(result); + result += adapter6.length(); + adapter7.writeTo(result); + + return resultImpl; } - // Rule from ECMA 15.2 about what an array index is. - // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1. - inline unsigned UString::toArrayIndex(bool* ok) const + template + PassRefPtr tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8) { - unsigned i = toStrictUInt32(ok); - if (ok && i >= 0xFFFFFFFFU) - *ok = false; - return i; + StringTypeAdapter adapter1(string1); + StringTypeAdapter adapter2(string2); + StringTypeAdapter adapter3(string3); + StringTypeAdapter adapter4(string4); + StringTypeAdapter adapter5(string5); + StringTypeAdapter adapter6(string6); + StringTypeAdapter adapter7(string7); + StringTypeAdapter adapter8(string8); + + UChar* buffer; + bool overflow = false; + unsigned length = adapter1.length(); + sumWithOverflow(length, adapter2.length(), overflow); + sumWithOverflow(length, adapter3.length(), overflow); + sumWithOverflow(length, adapter4.length(), overflow); + sumWithOverflow(length, adapter5.length(), overflow); + sumWithOverflow(length, adapter6.length(), overflow); + sumWithOverflow(length, adapter7.length(), overflow); + sumWithOverflow(length, adapter8.length(), overflow); + if (overflow) + return 0; + PassRefPtr resultImpl = UStringImpl::tryCreateUninitialized(length, buffer); + if (!resultImpl) + return 0; + + UChar* result = buffer; + adapter1.writeTo(result); + result += adapter1.length(); + adapter2.writeTo(result); + result += adapter2.length(); + adapter3.writeTo(result); + result += adapter3.length(); + adapter4.writeTo(result); + result += adapter4.length(); + adapter5.writeTo(result); + result += adapter5.length(); + adapter6.writeTo(result); + result += adapter6.length(); + adapter7.writeTo(result); + result += adapter7.length(); + adapter8.writeTo(result); + + return resultImpl; } - // We'd rather not do shared substring append for small strings, since - // this runs too much risk of a tiny initial string holding down a - // huge buffer. - // FIXME: this should be size_t but that would cause warnings until we - // fix UString sizes to be size_t instead of int - static const int minShareSize = Heap::minExtraCostSize / sizeof(UChar); + template + UString makeString(StringType1 string1, StringType2 string2) + { + PassRefPtr resultImpl = tryMakeString(string1, string2); + if (!resultImpl) + CRASH(); + return resultImpl; + } - inline size_t UString::cost() const + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3) { - BaseString* base = m_rep->baseString(); - size_t capacity = (base->capacity + base->preCapacity) * sizeof(UChar); - size_t reportedCost = base->reportedCost; - ASSERT(capacity >= reportedCost); + PassRefPtr resultImpl = tryMakeString(string1, string2, string3); + if (!resultImpl) + CRASH(); + return resultImpl; + } - size_t capacityDelta = capacity - reportedCost; + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4) + { + PassRefPtr resultImpl = tryMakeString(string1, string2, string3, string4); + if (!resultImpl) + CRASH(); + return resultImpl; + } - if (capacityDelta < static_cast(minShareSize)) - return 0; + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5) + { + PassRefPtr resultImpl = tryMakeString(string1, string2, string3, string4, string5); + if (!resultImpl) + CRASH(); + return resultImpl; + } - base->reportedCost = capacity; + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6) + { + PassRefPtr resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6); + if (!resultImpl) + CRASH(); + return resultImpl; + } - return capacityDelta; + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7) + { + PassRefPtr resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7); + if (!resultImpl) + CRASH(); + return resultImpl; } - struct IdentifierRepHash : PtrHash > { - static unsigned hash(const RefPtr& key) { return key->computedHash(); } - static unsigned hash(JSC::UString::Rep* key) { return key->computedHash(); } - }; + template + UString makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8) + { + PassRefPtr resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8); + if (!resultImpl) + CRASH(); + return resultImpl; + } - void initializeUString(); } // namespace JSC namespace WTF { diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp new file mode 100644 index 0000000..aeecf47 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "UStringImpl.h" + +#include "Identifier.h" +#include "UString.h" +#include + +using namespace WTF::Unicode; +using namespace std; + +namespace JSC { + +PassRefPtr UStringImpl::create(const char* c) +{ + ASSERT(c); + + if (!c[0]) + return &UStringImpl::empty(); + + size_t length = strlen(c); + UChar* d; + PassRefPtr result = UStringImpl::createUninitialized(length, d); + for (size_t i = 0; i < length; i++) + d[i] = static_cast(c[i]); // use unsigned char to zero-extend instead of sign-extend + return result; +} + +PassRefPtr UStringImpl::create(const char* c, unsigned length) +{ + ASSERT(c); + + if (!length) + return &UStringImpl::empty(); + + UChar* d; + PassRefPtr result = UStringImpl::createUninitialized(length, d); + for (unsigned i = 0; i < length; i++) + d[i] = static_cast(c[i]); // use unsigned char to zero-extend instead of sign-extend + return result; +} + +PassRefPtr UStringImpl::create(const UChar* buffer, unsigned length) +{ + UChar* newBuffer; + PassRefPtr impl = createUninitialized(length, newBuffer); + copyChars(newBuffer, buffer, length); + return impl; +} + +SharedUChar* UStringImpl::baseSharedBuffer() +{ + ASSERT((bufferOwnership() == BufferShared) + || ((bufferOwnership() == BufferOwned) && !m_buffer)); + + if (bufferOwnership() != BufferShared) { + m_refCountAndFlags = (m_refCountAndFlags & ~s_refCountMaskBufferOwnership) | BufferShared; + m_bufferShared = SharedUChar::create(new OwnFastMallocPtr(m_data)).releaseRef(); + } + + return m_bufferShared; +} + +SharedUChar* UStringImpl::sharedBuffer() +{ + if (m_length < s_minLengthToShare) + return 0; + ASSERT(!isStatic()); + + UStringImpl* owner = bufferOwnerString(); + if (owner->bufferOwnership() == BufferInternal) + return 0; + + return owner->baseSharedBuffer(); +} + +UStringImpl::~UStringImpl() +{ + ASSERT(!isStatic()); + checkConsistency(); + + if (isIdentifier()) + Identifier::remove(this); + + if (bufferOwnership() != BufferInternal) { + if (bufferOwnership() == BufferOwned) + fastFree(m_data); + else if (bufferOwnership() == BufferSubstring) + m_bufferSubstring->deref(); + else { + ASSERT(bufferOwnership() == BufferShared); + m_bufferShared->deref(); + } + } +} + +void URopeImpl::derefFibersNonRecursive(Vector& workQueue) +{ + unsigned length = fiberCount(); + for (unsigned i = 0; i < length; ++i) { + Fiber& fiber = fibers(i); + if (fiber->isRope()) { + URopeImpl* nextRope = static_cast(fiber); + if (nextRope->hasOneRef()) + workQueue.append(nextRope); + else + nextRope->deref(); + } else + static_cast(fiber)->deref(); + } +} + +void URopeImpl::destructNonRecursive() +{ + Vector workQueue; + + derefFibersNonRecursive(workQueue); + delete this; + + while (!workQueue.isEmpty()) { + URopeImpl* rope = workQueue.last(); + workQueue.removeLast(); + rope->derefFibersNonRecursive(workQueue); + delete rope; + } +} + +PassRefPtr singleCharacterSubstring(UStringOrRopeImpl* impl, unsigned index) +{ +top: + if (impl->isRope()) { + URopeImpl* rope = static_cast(impl); + for (unsigned i = 0; i < rope->m_fiberCount; ++i) { + UStringOrRopeImpl* currentFiber = rope->fibers(i); + unsigned fiberLength = currentFiber->length(); + if (index < fiberLength) { + impl = currentFiber; + goto top; + } + index -= fiberLength; + } + CRASH(); + } + + return static_cast(impl)->singleCharacterSubstring(index); +} + +} // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h new file mode 100644 index 0000000..718cea4 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/UStringImpl.h @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UStringImpl_h +#define UStringImpl_h + +#include +#include +#include +#include +#include +#include +#include + +namespace JSC { + +class IdentifierTable; + +typedef CrossThreadRefCounted > SharedUChar; + +class UStringOrRopeImpl : public Noncopyable { +public: + bool isRope() { return (m_refCountAndFlags & s_refCountIsRope) == s_refCountIsRope; } + unsigned length() const { return m_length; } + + void ref() { m_refCountAndFlags += s_refCountIncrement; } + inline void deref(); + +protected: + enum BufferOwnership { + BufferInternal, + BufferOwned, + BufferSubstring, + BufferShared, + }; + + using Noncopyable::operator new; + void* operator new(size_t, void* inPlace) { return inPlace; } + + // For SmallStringStorage, which allocates an array and uses an in-place new. + UStringOrRopeImpl() { } + + UStringOrRopeImpl(unsigned length, BufferOwnership ownership) + : m_refCountAndFlags(s_refCountIncrement | s_refCountFlagShouldReportedCost | ownership) + , m_length(length) + { + ASSERT(!isRope()); + } + + enum StaticStringConstructType { ConstructStaticString }; + UStringOrRopeImpl(unsigned length, StaticStringConstructType) + : m_refCountAndFlags(s_refCountFlagStatic | BufferOwned) + , m_length(length) + { + ASSERT(!isRope()); + } + + enum RopeConstructType { ConstructRope }; + UStringOrRopeImpl(RopeConstructType) + : m_refCountAndFlags(s_refCountIncrement | s_refCountIsRope) + , m_length(0) + { + ASSERT(isRope()); + } + + // The bottom 5 bits hold flags, the top 27 bits hold the ref count. + // When dereferencing UStringImpls we check for the ref count AND the + // static bit both being zero - static strings are never deleted. + static const unsigned s_refCountMask = 0xFFFFFFE0; + static const unsigned s_refCountIncrement = 0x20; + static const unsigned s_refCountFlagStatic = 0x10; + static const unsigned s_refCountFlagShouldReportedCost = 0x8; + static const unsigned s_refCountFlagIsIdentifier = 0x4; + static const unsigned s_refCountMaskBufferOwnership = 0x3; + // Use an otherwise invalid permutation of flags (static & shouldReportedCost - + // static strings do not set shouldReportedCost in the constructor, and this bit + // is only ever cleared, not set) to identify objects that are ropes. + static const unsigned s_refCountIsRope = s_refCountFlagStatic | s_refCountFlagShouldReportedCost; + + unsigned m_refCountAndFlags; + unsigned m_length; +}; + +class UStringImpl : public UStringOrRopeImpl { +public: + template + static PassRefPtr adopt(Vector& vector) + { + if (unsigned length = vector.size()) { + ASSERT(vector.data()); + return adoptRef(new UStringImpl(vector.releaseBuffer(), length)); + } + return &empty(); + } + + static PassRefPtr create(const char* c); + static PassRefPtr create(const char* c, unsigned length); + static PassRefPtr create(const UChar* buffer, unsigned length); + + static PassRefPtr create(PassRefPtr rep, unsigned offset, unsigned length) + { + ASSERT(rep); + rep->checkConsistency(); + return adoptRef(new UStringImpl(rep->m_data + offset, length, rep->bufferOwnerString())); + } + + static PassRefPtr create(PassRefPtr sharedBuffer, UChar* buffer, unsigned length) + { + return adoptRef(new UStringImpl(buffer, length, sharedBuffer)); + } + + static PassRefPtr createUninitialized(unsigned length, UChar*& output) + { + if (!length) { + output = 0; + return &empty(); + } + + if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) + CRASH(); + UStringImpl* resultImpl = static_cast(fastMalloc(sizeof(UChar) * length + sizeof(UStringImpl))); + output = reinterpret_cast(resultImpl + 1); + return adoptRef(new(resultImpl) UStringImpl(length)); + } + + static PassRefPtr tryCreateUninitialized(unsigned length, UChar*& output) + { + if (!length) { + output = 0; + return &empty(); + } + + if (length > ((std::numeric_limits::max() - sizeof(UStringImpl)) / sizeof(UChar))) + return 0; + UStringImpl* resultImpl; + if (!tryFastMalloc(sizeof(UChar) * length + sizeof(UStringImpl)).getValue(resultImpl)) + return 0; + output = reinterpret_cast(resultImpl + 1); + return adoptRef(new(resultImpl) UStringImpl(length)); + } + + SharedUChar* sharedBuffer(); + UChar* data() const { return m_data; } + size_t cost() + { + // For substrings, return the cost of the base string. + if (bufferOwnership() == BufferSubstring) + return m_bufferSubstring->cost(); + + if (m_refCountAndFlags & s_refCountFlagShouldReportedCost) { + m_refCountAndFlags &= ~s_refCountFlagShouldReportedCost; + return m_length; + } + return 0; + } + unsigned hash() const { if (!m_hash) m_hash = computeHash(data(), m_length); return m_hash; } + unsigned existingHash() const { ASSERT(m_hash); return m_hash; } // fast path for Identifiers + void setHash(unsigned hash) { ASSERT(hash == computeHash(data(), m_length)); m_hash = hash; } // fast path for Identifiers + bool isIdentifier() const { return m_refCountAndFlags & s_refCountFlagIsIdentifier; } + void setIsIdentifier(bool isIdentifier) + { + if (isIdentifier) + m_refCountAndFlags |= s_refCountFlagIsIdentifier; + else + m_refCountAndFlags &= ~s_refCountFlagIsIdentifier; + } + + ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & (s_refCountMask | s_refCountFlagStatic))) delete this; } + + static void copyChars(UChar* destination, const UChar* source, unsigned numCharacters) + { + if (numCharacters <= s_copyCharsInlineCutOff) { + for (unsigned i = 0; i < numCharacters; ++i) + destination[i] = source[i]; + } else + memcpy(destination, source, numCharacters * sizeof(UChar)); + } + + static unsigned computeHash(const UChar* s, unsigned length) { return WTF::stringHash(s, length); } + static unsigned computeHash(const char* s, unsigned length) { return WTF::stringHash(s, length); } + static unsigned computeHash(const char* s) { return WTF::stringHash(s); } + + static UStringImpl& empty() { return *s_empty; } + + ALWAYS_INLINE void checkConsistency() const + { + // There is no recursion of substrings. + ASSERT(bufferOwnerString()->bufferOwnership() != BufferSubstring); + // Static strings cannot be put in identifier tables, because they are globally shared. + ASSERT(!isStatic() || !isIdentifier()); + } + + PassRefPtr singleCharacterSubstring(unsigned index) { ASSERT(index < length()); return create(this, index, 1); } + +private: + // For SmallStringStorage, which allocates an array and uses an in-place new. + UStringImpl() { } + + // Used to construct normal strings with an internal buffer. + UStringImpl(unsigned length) + : UStringOrRopeImpl(length, BufferInternal) + , m_data(reinterpret_cast(this + 1)) + , m_buffer(0) + , m_hash(0) + { + checkConsistency(); + } + + // Used to construct normal strings with an external buffer. + UStringImpl(UChar* data, unsigned length) + : UStringOrRopeImpl(length, BufferOwned) + , m_data(data) + , m_buffer(0) + , m_hash(0) + { + checkConsistency(); + } + + // Used to construct static strings, which have an special refCount that can never hit zero. + // This means that the static string will never be destroyed, which is important because + // static strings will be shared across threads & ref-counted in a non-threadsafe manner. + UStringImpl(UChar* data, unsigned length, StaticStringConstructType) + : UStringOrRopeImpl(length, ConstructStaticString) + , m_data(data) + , m_buffer(0) + , m_hash(0) + { + checkConsistency(); + } + + // Used to create new strings that are a substring of an existing string. + UStringImpl(UChar* data, unsigned length, PassRefPtr base) + : UStringOrRopeImpl(length, BufferSubstring) + , m_data(data) + , m_bufferSubstring(base.releaseRef()) + , m_hash(0) + { + // Do use static strings as a base for substrings; UntypedPtrAndBitfield assumes + // that all pointers will be at least 8-byte aligned, we cannot guarantee that of + // UStringImpls that are not heap allocated. + ASSERT(m_bufferSubstring->length()); + ASSERT(!m_bufferSubstring->isStatic()); + checkConsistency(); + } + + // Used to construct new strings sharing an existing shared buffer. + UStringImpl(UChar* data, unsigned length, PassRefPtr sharedBuffer) + : UStringOrRopeImpl(length, BufferShared) + , m_data(data) + , m_bufferShared(sharedBuffer.releaseRef()) + , m_hash(0) + { + checkConsistency(); + } + + ~UStringImpl(); + + // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. + static const unsigned s_minLengthToShare = 10; + static const unsigned s_copyCharsInlineCutOff = 20; + + UStringImpl* bufferOwnerString() { return (bufferOwnership() == BufferSubstring) ? m_bufferSubstring : this; } + const UStringImpl* bufferOwnerString() const { return (bufferOwnership() == BufferSubstring) ? m_bufferSubstring : this; } + SharedUChar* baseSharedBuffer(); + unsigned bufferOwnership() const { return m_refCountAndFlags & s_refCountMaskBufferOwnership; } + bool isStatic() const { return m_refCountAndFlags & s_refCountFlagStatic; } + + // unshared data + UChar* m_data; + union { + void* m_buffer; + UStringImpl* m_bufferSubstring; + SharedUChar* m_bufferShared; + }; + mutable unsigned m_hash; + + JS_EXPORTDATA static UStringImpl* s_empty; + + friend class JIT; + friend class SmallStringsStorage; + friend class UStringOrRopeImpl; + friend void initializeUString(); +}; + +class URopeImpl : public UStringOrRopeImpl { +public: + // A URopeImpl is composed from a set of smaller strings called Fibers. + // Each Fiber in a rope is either UStringImpl or another URopeImpl. + typedef UStringOrRopeImpl* Fiber; + + // Creates a URopeImpl comprising of 'fiberCount' Fibers. + // The URopeImpl is constructed in an uninitialized state - initialize must be called for each Fiber in the URopeImpl. + static PassRefPtr tryCreateUninitialized(unsigned fiberCount) + { + void* allocation; + if (tryFastMalloc(sizeof(URopeImpl) + (fiberCount - 1) * sizeof(Fiber)).getValue(allocation)) + return adoptRef(new (allocation) URopeImpl(fiberCount)); + return 0; + } + + void initializeFiber(unsigned &index, Fiber fiber) + { + m_fibers[index++] = fiber; + fiber->ref(); + m_length += fiber->length(); + } + + unsigned fiberCount() { return m_fiberCount; } + Fiber& fibers(unsigned index) { return m_fibers[index]; } + + ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & s_refCountMask)) destructNonRecursive(); } + +private: + URopeImpl(unsigned fiberCount) : UStringOrRopeImpl(ConstructRope), m_fiberCount(fiberCount) {} + + void destructNonRecursive(); + void derefFibersNonRecursive(Vector& workQueue); + + bool hasOneRef() { return (m_refCountAndFlags & s_refCountMask) == s_refCountIncrement; } + + unsigned m_fiberCount; + Fiber m_fibers[1]; + + friend class UStringOrRopeImpl; + friend PassRefPtr singleCharacterSubstring(UStringOrRopeImpl* ropeoid, unsigned index); +}; + +inline void UStringOrRopeImpl::deref() +{ + if (isRope()) + static_cast(this)->deref(); + else + static_cast(this)->deref(); +} + +bool equal(const UStringImpl*, const UStringImpl*); + +PassRefPtr singleCharacterSubstring(UStringOrRopeImpl* ropeoid, unsigned index); + +} + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h new file mode 100644 index 0000000..39a91c5 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCMap.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WeakGCMap_h +#define WeakGCMap_h + +#include "Collector.h" +#include + +namespace JSC { + +class JSCell; + +// A HashMap whose get() function returns emptyValue() for cells awaiting destruction. +template +class WeakGCMap : public FastAllocBase { + /* + Invariants: + * A value enters the WeakGCMap marked. (Guaranteed by set().) + * A value that becomes unmarked leaves the WeakGCMap before being recycled. (Guaranteed by the value's destructor removing it from the WeakGCMap.) + * A value that becomes unmarked leaves the WeakGCMap before becoming marked again. (Guaranteed by all destructors running before the mark phase begins.) + * During the mark phase, all values in the WeakGCMap are valid. (Guaranteed by all destructors running before the mark phase begins.) + */ + +public: + typedef typename HashMap::iterator iterator; + typedef typename HashMap::const_iterator const_iterator; + + bool isEmpty() { return m_map.isEmpty(); } + + MappedType get(const KeyType& key) const; + pair set(const KeyType&, const MappedType&); + MappedType take(const KeyType& key); + + // These unchecked functions provide access to a value even if the value's + // mark bit is not set. This is used, among other things, to retrieve values + // during the GC mark phase, which begins by clearing all mark bits. + + MappedType uncheckedGet(const KeyType& key) const { return m_map.get(key); } + bool uncheckedRemove(const KeyType&, const MappedType&); + + iterator uncheckedBegin() { return m_map.begin(); } + iterator uncheckedEnd() { return m_map.end(); } + + const_iterator uncheckedBegin() const { return m_map.begin(); } + const_iterator uncheckedEnd() const { return m_map.end(); } + +private: + HashMap m_map; +}; + +template +inline MappedType WeakGCMap::get(const KeyType& key) const +{ + MappedType result = m_map.get(key); + if (result == HashTraits::emptyValue()) + return result; + if (!Heap::isCellMarked(result)) + return HashTraits::emptyValue(); + return result; +} + +template +MappedType WeakGCMap::take(const KeyType& key) +{ + MappedType result = m_map.take(key); + if (result == HashTraits::emptyValue()) + return result; + if (!Heap::isCellMarked(result)) + return HashTraits::emptyValue(); + return result; +} + +template +pair::iterator, bool> WeakGCMap::set(const KeyType& key, const MappedType& value) +{ + Heap::markCell(value); // If value is newly allocated, it's not marked, so mark it now. + pair result = m_map.add(key, value); + if (!result.second) { // pre-existing entry + result.second = !Heap::isCellMarked(result.first->second); + result.first->second = value; + } + return result; +} + +template +bool WeakGCMap::uncheckedRemove(const KeyType& key, const MappedType& value) +{ + iterator it = m_map.find(key); + if (it == m_map.end()) + return false; + if (it->second != value) + return false; + m_map.remove(it); + return true; +} + +} // namespace JSC + +#endif // WeakGCMap_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h new file mode 100644 index 0000000..3ed4645 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakGCPtr.h @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WeakGCPtr_h +#define WeakGCPtr_h + +#include "Collector.h" +#include + +namespace JSC { + +// A smart pointer whose get() function returns 0 for cells awaiting destruction. +template class WeakGCPtr : Noncopyable { +public: + WeakGCPtr() : m_ptr(0) { } + WeakGCPtr(T* ptr) { assign(ptr); } + + T* get() const + { + if (!m_ptr || !Heap::isCellMarked(m_ptr)) + return 0; + return m_ptr; + } + + void clear(JSCell* ptr) + { + if (ptr == m_ptr) + m_ptr = 0; + } + + T& operator*() const { return *get(); } + T* operator->() const { return get(); } + + bool operator!() const { return !get(); } + + // This conversion operator allows implicit conversion to bool but not to other integer types. +#if COMPILER(WINSCW) + operator bool() const { return m_ptr; } +#else + typedef T* WeakGCPtr::*UnspecifiedBoolType; + operator UnspecifiedBoolType() const { return get() ? &WeakGCPtr::m_ptr : 0; } +#endif + + WeakGCPtr& operator=(T*); + +private: + void assign(T* ptr) + { + if (ptr) + Heap::markCell(ptr); + m_ptr = ptr; + } + + T* m_ptr; +}; + +template inline WeakGCPtr& WeakGCPtr::operator=(T* optr) +{ + assign(optr); + return *this; +} + +template inline bool operator==(const WeakGCPtr& a, const WeakGCPtr& b) +{ + return a.get() == b.get(); +} + +template inline bool operator==(const WeakGCPtr& a, U* b) +{ + return a.get() == b; +} + +template inline bool operator==(T* a, const WeakGCPtr& b) +{ + return a == b.get(); +} + +template inline bool operator!=(const WeakGCPtr& a, const WeakGCPtr& b) +{ + return a.get() != b.get(); +} + +template inline bool operator!=(const WeakGCPtr& a, U* b) +{ + return a.get() != b; +} + +template inline bool operator!=(T* a, const WeakGCPtr& b) +{ + return a != b.get(); +} + +template inline WeakGCPtr static_pointer_cast(const WeakGCPtr& p) +{ + return WeakGCPtr(static_cast(p.get())); +} + +template inline WeakGCPtr const_pointer_cast(const WeakGCPtr& p) +{ + return WeakGCPtr(const_cast(p.get())); +} + +template inline T* getPtr(const WeakGCPtr& p) +{ + return p.get(); +} + +} // namespace JSC + +#endif // WeakGCPtr_h diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h new file mode 100644 index 0000000..ff3995e --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/WeakRandom.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Copyright (c) 2009 Ian C. Bullard + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef WeakRandom_h +#define WeakRandom_h + +#include +#include + +namespace JSC { + +class WeakRandom { +public: + WeakRandom(unsigned seed) + : m_low(seed ^ 0x49616E42) + , m_high(seed) + { + } + + double get() + { + return advance() / (UINT_MAX + 1.0); + } + +private: + unsigned advance() + { + m_high = (m_high << 16) + (m_high >> 16); + m_high += m_low; + m_low += m_high; + return m_high; + } + + unsigned m_low; + unsigned m_high; +}; + +} // namespace JSC + +#endif // WeakRandom_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h b/src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h index 483dce0..13324e7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h +++ b/src/3rdparty/webkit/JavaScriptCore/wrec/WREC.h @@ -32,7 +32,7 @@ #include -#if COMPILER(GCC) && PLATFORM(X86) +#if COMPILER(GCC) && CPU(X86) #define WREC_CALL __attribute__ ((regparm (3))) #else #define WREC_CALL diff --git a/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.cpp index e62add3..7105984 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.cpp @@ -40,7 +40,7 @@ namespace JSC { namespace WREC { void Generator::generateEnter() { -#if PLATFORM(X86) +#if CPU(X86) // On x86 edi & esi are callee preserved registers. push(X86Registers::edi); push(X86Registers::esi); @@ -71,7 +71,7 @@ void Generator::generateReturnSuccess() store32(index, Address(output, 4)); // match end // Restore callee save registers. -#if PLATFORM(X86) +#if CPU(X86) pop(X86Registers::esi); pop(X86Registers::edi); #endif @@ -110,7 +110,7 @@ void Generator::generateReturnFailure() pop(); move(Imm32(-1), returnRegister); -#if PLATFORM(X86) +#if CPU(X86) pop(X86Registers::esi); pop(X86Registers::edi); #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.h b/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.h index 294c3d0..d707a6e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/wrec/WRECGenerator.h @@ -62,7 +62,7 @@ namespace JSC { { } -#if PLATFORM(X86) +#if CPU(X86) static const RegisterID input = X86Registers::eax; static const RegisterID index = X86Registers::edx; static const RegisterID length = X86Registers::ecx; @@ -73,7 +73,7 @@ namespace JSC { static const RegisterID returnRegister = X86Registers::eax; #endif -#if PLATFORM(X86_64) +#if CPU(X86_64) static const RegisterID input = X86Registers::edi; static const RegisterID index = X86Registers::esi; static const RegisterID length = X86Registers::edx; diff --git a/src/3rdparty/webkit/JavaScriptCore/wscript b/src/3rdparty/webkit/JavaScriptCore/wscript index 7a5ba1b..7caf8b4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wscript +++ b/src/3rdparty/webkit/JavaScriptCore/wscript @@ -29,18 +29,19 @@ import commands from settings import * -jscore_excludes = ['jsc.cpp', 'ucptable.cpp', 'GOwnPtr.cpp'] +jscore_excludes = ['jsc.cpp', 'ucptable.cpp'] jscore_excludes.extend(get_excludes(jscore_dir, ['*CF.cpp', '*Symbian.cpp'])) sources = [] -jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp', '*None.cpp'])) +jscore_excludes.extend(get_excludes(jscore_dir, ['*None.cpp'])) if building_on_win32: - jscore_excludes += ['ExecutableAllocatorPosix.cpp', 'MarkStackPosix.cpp'] + jscore_excludes += ['ExecutableAllocatorPosix.cpp', 'MarkStackPosix.cpp', 'ThreadingPthreads.cpp'] sources += ['jit/ExecutableAllocatorWin.cpp', 'runtime/MarkStackWin.cpp'] else: jscore_excludes.append('JSStringRefBSTR.cpp') + jscore_excludes.extend(get_excludes(jscore_dir, ['*Win.cpp'])) def generate_jscore_derived_sources(): # build the derived sources @@ -71,6 +72,8 @@ def build(bld): full_dirs = get_dirs_for_features(jscore_dir, features=[build_port], dirs=jscore_dirs) includes = common_includes + full_dirs + if sys.platform.startswith('darwin'): + includes.append(os.path.join(jscore_dir, 'icu')) # 1. A simple program jscore = bld.new_task_gen( diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h b/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h index 64fdd99..ce27df6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/AlwaysInline.h @@ -23,7 +23,7 @@ #ifndef ALWAYS_INLINE #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW) #define ALWAYS_INLINE inline __attribute__((__always_inline__)) -#elif COMPILER(MSVC) && defined(NDEBUG) +#elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG) #define ALWAYS_INLINE __forceinline #else #define ALWAYS_INLINE inline @@ -33,6 +33,8 @@ #ifndef NEVER_INLINE #if COMPILER(GCC) #define NEVER_INLINE __attribute__((__noinline__)) +#elif COMPILER(RVCT) +#define NEVER_INLINE __declspec(noinline) #else #define NEVER_INLINE #endif @@ -57,6 +59,8 @@ #ifndef NO_RETURN #if COMPILER(GCC) #define NO_RETURN __attribute((__noreturn__)) +#elif COMPILER(RVCT) +#define NO_RETURN __declspec(noreturn) #else #define NO_RETURN #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp index 6c5e2e3..cadbc91 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp @@ -35,7 +35,7 @@ #include #endif -#if COMPILER(MSVC) && !PLATFORM(WINCE) +#if COMPILER(MSVC) && !OS(WINCE) #ifndef WINVER #define WINVER 0x0500 #endif @@ -46,7 +46,7 @@ #include #endif -#if PLATFORM(WINCE) +#if OS(WINCE) #include #endif @@ -82,7 +82,7 @@ static void vprintf_stderr_common(const char* format, va_list args) break; if (_vsnprintf(buffer, size, format, args) != -1) { -#if PLATFORM(WINCE) +#if OS(WINCE) // WinCE only supports wide chars wchar_t* wideBuffer = (wchar_t*)malloc(size * sizeof(wchar_t)); if (wideBuffer == NULL) @@ -105,7 +105,7 @@ static void vprintf_stderr_common(const char* format, va_list args) } while (size > 1024); } #endif -#if PLATFORM(SYMBIAN) +#if OS(SYMBIAN) vfprintf(stdout, format, args); #else vfprintf(stderr, format, args); @@ -123,7 +123,7 @@ static void printf_stderr_common(const char* format, ...) static void printCallSite(const char* file, int line, const char* function) { -#if PLATFORM(WIN) && !PLATFORM(WINCE) && defined _DEBUG +#if OS(WIN) && !OS(WINCE) && defined _DEBUG _CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function); #else printf_stderr_common("(%s:%d %s)\n", file, line, function); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h index aa72e5a..0e02af5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h @@ -50,7 +50,7 @@ #include #endif -#if PLATFORM(SYMBIAN) +#if OS(SYMBIAN) #include #include #endif @@ -61,24 +61,50 @@ #define ASSERTIONS_DISABLED_DEFAULT 0 #endif +#if COMPILER(MSVC7) || COMPILER(WINSCW) +#define HAVE_VARIADIC_MACRO 0 +#else +#define HAVE_VARIADIC_MACRO 1 +#endif + #ifndef ASSERT_DISABLED #define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT #endif +#ifndef ASSERT_MSG_DISABLED +#if HAVE(VARIADIC_MACRO) +#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT +#else +#define ASSERT_MSG_DISABLED 1 +#endif +#endif + #ifndef ASSERT_ARG_DISABLED #define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED_DEFAULT #endif #ifndef FATAL_DISABLED +#if HAVE(VARIADIC_MACRO) #define FATAL_DISABLED ASSERTIONS_DISABLED_DEFAULT +#else +#define FATAL_DISABLED 1 +#endif #endif #ifndef ERROR_DISABLED +#if HAVE(VARIADIC_MACRO) #define ERROR_DISABLED ASSERTIONS_DISABLED_DEFAULT +#else +#define ERROR_DISABLED 1 +#endif #endif #ifndef LOG_DISABLED +#if HAVE(VARIADIC_MACRO) #define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT +#else +#define LOG_DISABLED 1 +#endif #endif #if COMPILER(GCC) @@ -125,7 +151,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann /* CRASH -- gets us into the debugger or the crash reporter -- signals are ignored by the crash reporter so we must do better */ #ifndef CRASH -#if PLATFORM(SYMBIAN) +#if OS(SYMBIAN) #define CRASH() do { \ __DEBUGGER(); \ User::Panic(_L("Webkit CRASH"),0); \ @@ -138,9 +164,9 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #endif #endif -/* ASSERT, ASSERT_WITH_MESSAGE, ASSERT_NOT_REACHED */ +/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED */ -#if PLATFORM(WINCE) && !PLATFORM(TORCHMOBILE) +#if OS(WINCE) && !PLATFORM(TORCHMOBILE) /* FIXME: We include this here only to avoid a conflict with the ASSERT macro. */ #include #undef min @@ -148,21 +174,22 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #undef ERROR #endif -#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN) +#if OS(WINDOWS) || OS(SYMBIAN) /* FIXME: Change to use something other than ASSERT to avoid this conflict with the underlying platform */ #undef ASSERT #endif +#if PLATFORM(BREWMP) +/* FIXME: We include this here only to avoid a conflict with the COMPILE_ASSERT macro. */ +#include + +/* FIXME: Change to use something other than COMPILE_ASSERT to avoid this conflict with the underlying platform */ +#undef COMPILE_ASSERT +#endif + #if ASSERT_DISABLED #define ASSERT(assertion) ((void)0) -#if COMPILER(MSVC7) -#define ASSERT_WITH_MESSAGE(assertion) ((void)0) -#elif COMPILER(WINSCW) -#define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0) -#else -#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) -#endif /* COMPILER(MSVC7) */ #define ASSERT_NOT_REACHED() ((void)0) #define ASSERT_UNUSED(variable, assertion) ((void)variable) @@ -174,10 +201,24 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann CRASH(); \ } \ while (0) + +#define ASSERT_NOT_REACHED() do { \ + WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \ + CRASH(); \ +} while (0) + +#define ASSERT_UNUSED(variable, assertion) ASSERT(assertion) + +#endif + +/* ASSERT_WITH_MESSAGE */ + #if COMPILER(MSVC7) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) #elif COMPILER(WINSCW) #define ASSERT_WITH_MESSAGE(assertion, arg...) ((void)0) +#elif ASSERT_MSG_DISABLED +#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) do \ if (!(assertion)) { \ @@ -185,16 +226,9 @@ while (0) CRASH(); \ } \ while (0) -#endif /* COMPILER(MSVC7) */ -#define ASSERT_NOT_REACHED() do { \ - WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \ - CRASH(); \ -} while (0) - -#define ASSERT_UNUSED(variable, assertion) ASSERT(assertion) - #endif - + + /* ASSERT_ARG */ #if ASSERT_ARG_DISABLED @@ -219,12 +253,12 @@ while (0) /* FATAL */ -#if FATAL_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) -#define FATAL(...) ((void)0) -#elif COMPILER(MSVC7) +#if COMPILER(MSVC7) #define FATAL() ((void)0) #elif COMPILER(WINSCW) -#define FATAL(args...) ((void)0) +#define FATAL(arg...) ((void)0) +#elif FATAL_DISABLED +#define FATAL(...) ((void)0) #else #define FATAL(...) do { \ WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__); \ @@ -234,24 +268,24 @@ while (0) /* LOG_ERROR */ -#if ERROR_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) -#define LOG_ERROR(...) ((void)0) -#elif COMPILER(MSVC7) +#if COMPILER(MSVC7) #define LOG_ERROR() ((void)0) #elif COMPILER(WINSCW) #define LOG_ERROR(arg...) ((void)0) +#elif ERROR_DISABLED +#define LOG_ERROR(...) ((void)0) #else #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) #endif /* LOG */ -#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) -#define LOG(channel, ...) ((void)0) -#elif COMPILER(MSVC7) +#if COMPILER(MSVC7) #define LOG() ((void)0) #elif COMPILER(WINSCW) #define LOG(arg...) ((void)0) +#elif LOG_DISABLED +#define LOG(channel, ...) ((void)0) #else #define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) @@ -260,12 +294,12 @@ while (0) /* LOG_VERBOSE */ -#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) -#define LOG_VERBOSE(channel, ...) ((void)0) -#elif COMPILER(MSVC7) +#if COMPILER(MSVC7) #define LOG_VERBOSE(channel) ((void)0) #elif COMPILER(WINSCW) #define LOG_VERBOSE(channel, arg...) ((void)0) +#elif LOG_DISABLED +#define LOG_VERBOSE(channel, ...) ((void)0) #else #define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h new file mode 100644 index 0000000..cfd1d20 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Complex.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Complex_h +#define Complex_h + +#include +#include + +namespace WebCore { + +typedef std::complex Complex; + +inline Complex complexFromMagnitudePhase(double magnitude, double phase) +{ + return Complex(magnitude * cos(phase), magnitude * sin(phase)); +} + +} // namespace WebCore + +#endif // Complex_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp index b36cae5..30ca7c3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp @@ -33,7 +33,7 @@ #include "config.h" #include "CurrentTime.h" -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) // Windows is first since we want to use hires timers, despite PLATFORM(CF) // being defined. @@ -45,7 +45,7 @@ #include #if USE(QUERY_PERFORMANCE_COUNTER) -#if PLATFORM(WINCE) +#if OS(WINCE) extern "C" time_t mktime(struct tm *t); #else #include @@ -59,6 +59,8 @@ extern "C" time_t mktime(struct tm *t); #include #elif PLATFORM(WX) #include +#elif PLATFORM(BREWMP) +#include #else // Posix systems relying on the gettimeofday() #include #endif @@ -71,7 +73,7 @@ namespace WTF { const double msPerSecond = 1000.0; -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #if USE(QUERY_PERFORMANCE_COUNTER) @@ -123,7 +125,7 @@ static double highResUpTime() static double lowResUTCTime() { -#if PLATFORM(WINCE) +#if OS(WINCE) SYSTEMTIME systemTime; GetSystemTime(&systemTime); struct tm tmtime; @@ -277,6 +279,20 @@ double currentTime() return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); } +#elif PLATFORM(BREWMP) + +// GETUTCSECONDS returns the number of seconds since 1980/01/06 00:00:00 UTC, +// and GETTIMEMS returns the number of milliseconds that have elapsed since the last +// occurrence of 00:00:00 local time. +// We can combine GETUTCSECONDS and GETTIMEMS to calculate the number of milliseconds +// since 1970/01/01 00:00:00 UTC. +double currentTime() +{ + // diffSeconds is the number of seconds from 1970/01/01 to 1980/01/06 + const unsigned diffSeconds = 315964800; + return static_cast(diffSeconds + GETUTCSECONDS() + ((GETTIMEMS() % 1000) / msPerSecond)); +} + #else // Other Posix systems rely on the gettimeofday(). double currentTime() diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h index 31f1ec8..033448f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.h @@ -32,16 +32,36 @@ #ifndef CurrentTime_h #define CurrentTime_h +#include + namespace WTF { - // Returns the current system (UTC) time in seconds, starting January 1, 1970. - // Precision varies depending on a platform but usually is as good or better + // Returns the current UTC time in seconds, counted from January 1, 1970. + // Precision varies depending on platform but is usually as good or better // than a millisecond. double currentTime(); + // Same thing, in milliseconds. + inline double currentTimeMS() + { + return currentTime() * 1000.0; + } + + inline void getLocalTime(const time_t* localTime, struct tm* localTM) + { + #if COMPILER(MSVC7) || COMPILER(MINGW) || OS(WINCE) + *localTM = *localtime(localTime); + #elif COMPILER(MSVC) + localtime_s(localTM, localTime); + #else + localtime_r(localTime, localTM); + #endif + } + } // namespace WTF using WTF::currentTime; +using WTF::getLocalTime; #endif // CurrentTime_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp index 2110432..b9a0207 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp @@ -39,6 +39,33 @@ * other provisions required by the MPL or the GPL, as the case may be. * If you do not delete the provisions above, a recipient may use your * version of this file under any of the LGPL, the MPL or the GPL. + + * Copyright 2006-2008 the V8 project authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -61,11 +88,7 @@ #include #endif -#if PLATFORM(DARWIN) -#include -#endif - -#if PLATFORM(WINCE) +#if OS(WINCE) extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); extern "C" struct tm * localtime(const time_t *timer); #endif @@ -78,8 +101,14 @@ extern "C" struct tm * localtime(const time_t *timer); #include #endif +#if USE(JSC) +#include "CallFrame.h" +#endif + #define NaN std::numeric_limits::quiet_NaN() +using namespace WTF; + namespace WTF { /* Constants */ @@ -91,6 +120,10 @@ static const double secondsPerYear = 24.0 * 60.0 * 60.0 * 365.0; static const double usecPerSec = 1000000.0; static const double maxUnixTime = 2145859200.0; // 12/31/2037 +// ECMAScript asks not to support for a date of which total +// millisecond value is larger than the following value. +// See 15.9.1.14 of ECMA-262 5th edition. +static const double maxECMAScriptTime = 8.64E15; // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1. // First for non-leap years, then for leap years. @@ -139,7 +172,7 @@ static inline double msToDays(double ms) return floor(ms / msPerDay); } -static inline int msToYear(double ms) +int msToYear(double ms) { int approxYear = static_cast(floor(ms / (msPerDay * 365.2425)) + 1970); double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear); @@ -150,7 +183,7 @@ static inline int msToYear(double ms) return approxYear; } -static inline int dayInYear(double ms, int year) +int dayInYear(double ms, int year) { return static_cast(msToDays(ms) - daysFrom1970ToYear(year)); } @@ -196,7 +229,7 @@ static inline int msToHours(double ms) return static_cast(result); } -static inline int monthFromDayInYear(int dayInYear, bool leapYear) +int monthFromDayInYear(int dayInYear, bool leapYear) { const int d = dayInYear; int step; @@ -234,7 +267,7 @@ static inline bool checkMonth(int dayInYear, int& startDayOfThisMonth, int& star return (dayInYear <= startDayOfNextMonth); } -static inline int dayInMonthFromDayInYear(int dayInYear, bool leapYear) +int dayInMonthFromDayInYear(int dayInYear, bool leapYear) { const int d = dayInYear; int step; @@ -277,7 +310,7 @@ static inline double timeToMS(double hour, double min, double sec, double ms) return (((hour * minutesPerHour + min) * secondsPerMinute + sec) * msPerSecond + ms); } -static int dateToDayInYear(int year, int month, int day) +double dateToDaysFrom1970(int year, int month, int day) { year += month / 12; @@ -287,34 +320,13 @@ static int dateToDayInYear(int year, int month, int day) --year; } - int yearday = static_cast(floor(daysFrom1970ToYear(year))); + double yearday = floor(daysFrom1970ToYear(year)); + ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0)); int monthday = monthToDayInYear(month, isLeapYear(year)); return yearday + monthday + day - 1; } -double getCurrentUTCTime() -{ - return floor(getCurrentUTCTimeWithMicroseconds()); -} - -// Returns current time in milliseconds since 1 Jan 1970. -double getCurrentUTCTimeWithMicroseconds() -{ - return currentTime() * 1000.0; -} - -void getLocalTime(const time_t* localTime, struct tm* localTM) -{ -#if COMPILER(MSVC7) || COMPILER(MINGW) || PLATFORM(WINCE) - *localTM = *localtime(localTime); -#elif COMPILER(MSVC) - localtime_s(localTM, localTime); -#else - localtime_r(localTime, localTM); -#endif -} - // There is a hard limit at 2038 that we currently do not have a workaround // for (rdar://problem/5052975). static inline int maximumYearForDST() @@ -328,7 +340,7 @@ static inline int minimumYearForDST() // greater than the max year minus 27 (2010), we want to use the max year // minus 27 instead, to ensure there is a range of 28 years that all years // can map to. - return std::min(msToYear(getCurrentUTCTime()), maximumYearForDST() - 27) ; + return std::min(msToYear(jsCurrentTime()), maximumYearForDST() - 27) ; } /* @@ -367,7 +379,11 @@ int equivalentYearForDST(int year) static int32_t calculateUTCOffset() { +#if PLATFORM(BREWMP) + time_t localTime = static_cast(currentTime()); +#else time_t localTime = time(0); +#endif tm localt; getLocalTime(&localTime, &localt); @@ -399,44 +415,10 @@ static int32_t calculateUTCOffset() return static_cast(utcOffset * 1000); } -#if PLATFORM(DARWIN) -static int32_t s_cachedUTCOffset; // In milliseconds. An assumption here is that access to an int32_t variable is atomic on platforms that take this code path. -static bool s_haveCachedUTCOffset; -static int s_notificationToken; -#endif - -/* - * Get the difference in milliseconds between this time zone and UTC (GMT) - * NOT including DST. - */ -double getUTCOffset() -{ -#if PLATFORM(DARWIN) - if (s_haveCachedUTCOffset) { - int notified; - uint32_t status = notify_check(s_notificationToken, ¬ified); - if (status == NOTIFY_STATUS_OK && !notified) - return s_cachedUTCOffset; - } -#endif - - int32_t utcOffset = calculateUTCOffset(); - -#if PLATFORM(DARWIN) - // Theoretically, it is possible that several threads will be executing this code at once, in which case we will have a race condition, - // and a newer value may be overwritten. In practice, time zones don't change that often. - s_cachedUTCOffset = utcOffset; -#endif - - return utcOffset; -} - /* - * Get the DST offset for the time passed in. Takes - * seconds (not milliseconds) and cannot handle dates before 1970 - * on some OS' + * Get the DST offset for the time passed in. */ -static double getDSTOffsetSimple(double localTimeSeconds, double utcOffset) +static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset) { if (localTimeSeconds > maxUnixTime) localTimeSeconds = maxUnixTime; @@ -465,9 +447,9 @@ static double getDSTOffsetSimple(double localTimeSeconds, double utcOffset) } // Get the DST offset, given a time in UTC -static double getDSTOffset(double ms, double utcOffset) +static double calculateDSTOffset(double ms, double utcOffset) { - // On Mac OS X, the call to localtime (see getDSTOffsetSimple) will return historically accurate + // On Mac OS X, the call to localtime (see calculateDSTOffsetSimple) will return historically accurate // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript // standard explicitly dictates that historical information should not be considered when // determining DST. For this reason we shift away from years that localtime can handle but would @@ -479,69 +461,22 @@ static double getDSTOffset(double ms, double utcOffset) int dayInYearLocal = dayInYear(ms, year); int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear); int month = monthFromDayInYear(dayInYearLocal, leapYear); - int day = dateToDayInYear(equivalentYear, month, dayInMonth); + double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth); ms = (day * msPerDay) + msToMilliseconds(ms); } - return getDSTOffsetSimple(ms / msPerSecond, utcOffset); -} - -double gregorianDateTimeToMS(const GregorianDateTime& t, double milliSeconds, bool inputIsUTC) -{ - int day = dateToDayInYear(t.year + 1900, t.month, t.monthDay); - double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds); - double result = (day * msPerDay) + ms; - - if (!inputIsUTC) { // convert to UTC - double utcOffset = getUTCOffset(); - result -= utcOffset; - result -= getDSTOffset(result, utcOffset); - } - - return result; -} - -// input is UTC -void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm) -{ - double dstOff = 0.0; - double utcOff = 0.0; - if (!outputIsUTC) { - utcOff = getUTCOffset(); - dstOff = getDSTOffset(ms, utcOff); - ms += dstOff + utcOff; - } - - const int year = msToYear(ms); - tm.second = msToSeconds(ms); - tm.minute = msToMinutes(ms); - tm.hour = msToHours(ms); - tm.weekDay = msToWeekDay(ms); - tm.yearDay = dayInYear(ms, year); - tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year)); - tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year)); - tm.year = year - 1900; - tm.isDST = dstOff != 0.0; - tm.utcOffset = static_cast((dstOff + utcOff) / msPerSecond); - tm.timeZone = NULL; + return calculateDSTOffsetSimple(ms / msPerSecond, utcOffset); } void initializeDates() { #ifndef NDEBUG static bool alreadyInitialized; - ASSERT(!alreadyInitialized++); + ASSERT(!alreadyInitialized); + alreadyInitialized = true; #endif equivalentYearForDST(2000); // Need to call once to initialize a static used in this function. -#if PLATFORM(DARWIN) - // Register for a notification whenever the time zone changes. - uint32_t status = notify_register_check("com.apple.system.timezone", &s_notificationToken); - if (status == NOTIFY_STATUS_OK) { - s_cachedUTCOffset = calculateUTCOffset(); - s_haveCachedUTCOffset = true; - } -#endif } static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, int second) @@ -557,7 +492,7 @@ static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int // We follow the recommendation of RFC 2822 to consider all // obsolete time zones not listed here equivalent to "-0000". static const struct KnownZone { -#if !PLATFORM(WIN_OS) +#if !OS(WINDOWS) const #endif char tzName[4]; @@ -622,8 +557,12 @@ static bool parseLong(const char* string, char** stopPosition, int base, long* r return true; } -double parseDateFromNullTerminatedCharacters(const char* dateString) +// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore. +static double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset) { + haveTZ = false; + offset = 0; + // This parses a date in the form: // Tuesday, 09-Nov-99 23:12:40 GMT // or @@ -824,9 +763,6 @@ double parseDateFromNullTerminatedCharacters(const char* dateString) } } - bool haveTZ = false; - int offset = 0; - // Don't fail if the time zone is missing. // Some websites omit the time zone (4275206). if (*dateString) { @@ -889,33 +825,172 @@ double parseDateFromNullTerminatedCharacters(const char* dateString) else year += 1900; } + + return ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond; +} + +double parseDateFromNullTerminatedCharacters(const char* dateString) +{ + bool haveTZ; + int offset; + double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); + if (isnan(ms)) + return NaN; // fall back to local timezone if (!haveTZ) { - GregorianDateTime t; - t.monthDay = day; - t.month = month; - t.year = year - 1900; - t.isDST = -1; - t.second = second; - t.minute = minute; - t.hour = hour; - - // Use our gregorianDateTimeToMS() rather than mktime() as the latter can't handle the full year range. - return gregorianDateTimeToMS(t, 0, false); + double utcOffset = calculateUTCOffset(); + double dstOffset = calculateDSTOffset(ms, utcOffset); + offset = static_cast((utcOffset + dstOffset) / msPerMinute); } - - return (ymdhmsToSeconds(year, month + 1, day, hour, minute, second) - (offset * 60.0)) * msPerSecond; + return ms - (offset * msPerMinute); } double timeClip(double t) { if (!isfinite(t)) return NaN; - if (fabs(t) > 8.64E15) + if (fabs(t) > maxECMAScriptTime) return NaN; return trunc(t); } +} // namespace WTF +#if USE(JSC) +namespace JSC { + +// Get the DST offset for the time passed in. +// +// NOTE: The implementation relies on the fact that no time zones have +// more than one daylight savings offset change per month. +// If this function is called with NaN it returns NaN. +static double getDSTOffset(ExecState* exec, double ms, double utcOffset) +{ + DSTOffsetCache& cache = exec->globalData().dstOffsetCache; + double start = cache.start; + double end = cache.end; + + if (start <= ms) { + // If the time fits in the cached interval, return the cached offset. + if (ms <= end) return cache.offset; + + // Compute a possible new interval end. + double newEnd = end + cache.increment; + + if (ms <= newEnd) { + double endOffset = calculateDSTOffset(newEnd, utcOffset); + if (cache.offset == endOffset) { + // If the offset at the end of the new interval still matches + // the offset in the cache, we grow the cached time interval + // and return the offset. + cache.end = newEnd; + cache.increment = msPerMonth; + return endOffset; + } else { + double offset = calculateDSTOffset(ms, utcOffset); + if (offset == endOffset) { + // The offset at the given time is equal to the offset at the + // new end of the interval, so that means that we've just skipped + // the point in time where the DST offset change occurred. Updated + // the interval to reflect this and reset the increment. + cache.start = ms; + cache.end = newEnd; + cache.increment = msPerMonth; + } else { + // The interval contains a DST offset change and the given time is + // before it. Adjust the increment to avoid a linear search for + // the offset change point and change the end of the interval. + cache.increment /= 3; + cache.end = ms; + } + // Update the offset in the cache and return it. + cache.offset = offset; + return offset; + } + } + } -} // namespace WTF + // Compute the DST offset for the time and shrink the cache interval + // to only contain the time. This allows fast repeated DST offset + // computations for the same time. + double offset = calculateDSTOffset(ms, utcOffset); + cache.offset = offset; + cache.start = ms; + cache.end = ms; + cache.increment = msPerMonth; + return offset; +} + +/* + * Get the difference in milliseconds between this time zone and UTC (GMT) + * NOT including DST. + */ +double getUTCOffset(ExecState* exec) +{ + double utcOffset = exec->globalData().cachedUTCOffset; + if (!isnan(utcOffset)) + return utcOffset; + exec->globalData().cachedUTCOffset = calculateUTCOffset(); + return exec->globalData().cachedUTCOffset; +} + +double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC) +{ + double day = dateToDaysFrom1970(t.year + 1900, t.month, t.monthDay); + double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds); + double result = (day * WTF::msPerDay) + ms; + + if (!inputIsUTC) { // convert to UTC + double utcOffset = getUTCOffset(exec); + result -= utcOffset; + result -= getDSTOffset(exec, result, utcOffset); + } + + return result; +} + +// input is UTC +void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, GregorianDateTime& tm) +{ + double dstOff = 0.0; + double utcOff = 0.0; + if (!outputIsUTC) { + utcOff = getUTCOffset(exec); + dstOff = getDSTOffset(exec, ms, utcOff); + ms += dstOff + utcOff; + } + + const int year = msToYear(ms); + tm.second = msToSeconds(ms); + tm.minute = msToMinutes(ms); + tm.hour = msToHours(ms); + tm.weekDay = msToWeekDay(ms); + tm.yearDay = dayInYear(ms, year); + tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year)); + tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year)); + tm.year = year - 1900; + tm.isDST = dstOff != 0.0; + tm.utcOffset = static_cast((dstOff + utcOff) / WTF::msPerSecond); + tm.timeZone = NULL; +} + +double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateString) +{ + ASSERT(exec); + bool haveTZ; + int offset; + double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); + if (isnan(ms)) + return NaN; + + // fall back to local timezone + if (!haveTZ) { + double utcOffset = getUTCOffset(exec); + double dstOffset = getDSTOffset(exec, ms, utcOffset); + offset = static_cast((utcOffset + dstOffset) / WTF::msPerMinute); + } + return ms - (offset * WTF::msPerMinute); +} + +} // namespace JSC +#endif // USE(JSC) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h index 6110f76..033d25e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h @@ -42,27 +42,27 @@ #ifndef DateMath_h #define DateMath_h -#include +#include #include +#include +#include #include +#include namespace WTF { - -struct GregorianDateTime; - void initializeDates(); -void msToGregorianDateTime(double, bool outputIsUTC, GregorianDateTime&); -double gregorianDateTimeToMS(const GregorianDateTime&, double, bool inputIsUTC); -double getUTCOffset(); int equivalentYearForDST(int year); -double getCurrentUTCTime(); -double getCurrentUTCTimeWithMicroseconds(); -void getLocalTime(const time_t*, tm*); // Not really math related, but this is currently the only shared place to put these. -double parseDateFromNullTerminatedCharacters(const char*); +double parseDateFromNullTerminatedCharacters(const char* dateString); double timeClip(double); +inline double jsCurrentTime() +{ + // JavaScript doesn't recognize fractions of a millisecond. + return floor(WTF::currentTimeMS()); +} + const char * const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; const char * const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -74,9 +74,39 @@ const double msPerSecond = 1000.0; const double msPerMinute = 60.0 * 1000.0; const double msPerHour = 60.0 * 60.0 * 1000.0; const double msPerDay = 24.0 * 60.0 * 60.0 * 1000.0; +const double msPerMonth = 2592000000.0; -// Intentionally overridding the default tm of the system -// Tee members of tm differ on various operating systems. +// Returns the number of days from 1970-01-01 to the specified date. +double dateToDaysFrom1970(int year, int month, int day); +int msToYear(double ms); +int dayInYear(double ms, int year); +int monthFromDayInYear(int dayInYear, bool leapYear); +int dayInMonthFromDayInYear(int dayInYear, bool leapYear); + +} // namespace WTF + +using WTF::dateToDaysFrom1970; +using WTF::dayInMonthFromDayInYear; +using WTF::dayInYear; +using WTF::minutesPerHour; +using WTF::monthFromDayInYear; +using WTF::msPerDay; +using WTF::msPerSecond; +using WTF::msToYear; +using WTF::secondsPerMinute; + +#if USE(JSC) +namespace JSC { +class ExecState; +struct GregorianDateTime; + +void msToGregorianDateTime(ExecState*, double, bool outputIsUTC, GregorianDateTime&); +double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&, double, bool inputIsUTC); +double getUTCOffset(ExecState*); +double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString); + +// Intentionally overridding the default tm of the system. +// The members of tm differ on various operating systems. struct GregorianDateTime : Noncopyable { GregorianDateTime() : second(0) @@ -98,7 +128,7 @@ struct GregorianDateTime : Noncopyable { delete [] timeZone; } - GregorianDateTime(const tm& inTm) + GregorianDateTime(ExecState* exec, const tm& inTm) : second(inTm.tm_sec) , minute(inTm.tm_min) , hour(inTm.tm_hour) @@ -109,10 +139,11 @@ struct GregorianDateTime : Noncopyable { , year(inTm.tm_year) , isDST(inTm.tm_isdst) { + UNUSED_PARAM(exec); #if HAVE(TM_GMTOFF) utcOffset = static_cast(inTm.tm_gmtoff); #else - utcOffset = static_cast(getUTCOffset() / msPerSecond + (isDST ? secondsPerHour : 0)); + utcOffset = static_cast(getUTCOffset(exec) / WTF::msPerSecond + (isDST ? WTF::secondsPerHour : 0)); #endif #if HAVE(TM_ZONE) @@ -186,7 +217,7 @@ static inline int gmtoffset(const GregorianDateTime& t) { return t.utcOffset; } - -} // namespace WTF +} // namespace JSC +#endif // USE(JSC) #endif // DateMath_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp index 6cd8ef0..90d1e3f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp @@ -114,11 +114,13 @@ static void initializeIsForbiddenKey() pthread_key_create(&isForbiddenKey, 0); } +#if !ASSERT_DISABLED static bool isForbidden() { pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey); return !!pthread_getspecific(isForbiddenKey); } +#endif void fastMallocForbid() { @@ -177,6 +179,17 @@ void* fastZeroedMalloc(size_t n) memset(result, 0, n); return result; } + +char* fastStrDup(const char* src) +{ + int len = strlen(src) + 1; + char* dup = static_cast(fastMalloc(len)); + + if (dup) + memcpy(dup, src, len); + + return dup; +} TryMallocReturnValue tryFastZeroedMalloc(size_t n) { @@ -191,13 +204,6 @@ TryMallocReturnValue tryFastZeroedMalloc(size_t n) #if FORCE_SYSTEM_MALLOC -#include -#if !PLATFORM(WIN_OS) - #include -#else - #include "windows.h" -#endif - namespace WTF { TryMallocReturnValue tryFastMalloc(size_t n) @@ -233,8 +239,16 @@ void* fastMalloc(size_t n) void* result = malloc(n); #endif - if (!result) + if (!result) { +#if PLATFORM(BREWMP) + // The behavior of malloc(0) is implementation defined. + // To make sure that fastMalloc never returns 0, retry with fastMalloc(1). + if (!n) + return fastMalloc(1); +#endif CRASH(); + } + return result; } @@ -273,8 +287,16 @@ void* fastCalloc(size_t n_elements, size_t element_size) void* result = calloc(n_elements, element_size); #endif - if (!result) + if (!result) { +#if PLATFORM(BREWMP) + // If either n_elements or element_size is 0, the behavior of calloc is implementation defined. + // To make sure that fastCalloc never returns 0, retry with fastCalloc(1, 1). + if (!n_elements || !element_size) + return fastCalloc(1, 1); +#endif CRASH(); + } + return result; } @@ -349,7 +371,7 @@ FastMallocStatistics fastMallocStatistics() } // namespace WTF -#if PLATFORM(DARWIN) +#if OS(DARWIN) // This symbol is present in the JavaScriptCore exports file even when FastMalloc is disabled. // It will never be used in this case, so it's type and value are less interesting than its presence. extern "C" const int jscore_fastmalloc_introspection = 0; @@ -379,7 +401,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #include #include #include -#if PLATFORM(UNIX) +#if OS(UNIX) #include #endif #if COMPILER(MSVC) @@ -391,11 +413,15 @@ extern "C" const int jscore_fastmalloc_introspection = 0; #if WTF_CHANGES -#if PLATFORM(DARWIN) +#if OS(DARWIN) #include "MallocZoneSupport.h" #include #include #endif +#if HAVE(DISPATCH_H) +#include +#endif + #ifndef PRIuS #define PRIuS "zu" @@ -405,7 +431,7 @@ extern "C" const int jscore_fastmalloc_introspection = 0; // call to the function on Mac OS X, and it's used in performance-critical code. So we // use a function pointer. But that's not necessarily faster on other platforms, and we had // problems with this technique on Windows, so we'll do this only on Mac OS X. -#if PLATFORM(DARWIN) +#if OS(DARWIN) static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific; #define pthread_getspecific(key) pthread_getspecific_function_pointer(key) #endif @@ -433,7 +459,7 @@ namespace WTF { #define MESSAGE LOG_ERROR #define CHECK_CONDITION ASSERT -#if PLATFORM(DARWIN) +#if OS(DARWIN) class Span; class TCMalloc_Central_FreeListPadded; class TCMalloc_PageHeap; @@ -990,7 +1016,7 @@ class PageHeapAllocator { int inuse() const { return inuse_; } -#if defined(WTF_CHANGES) && PLATFORM(DARWIN) +#if defined(WTF_CHANGES) && OS(DARWIN) template void recordAdministrativeRegions(Recorder& recorder, const RemoteMemoryReader& reader) { @@ -1172,7 +1198,7 @@ template class MapSelector { }; #if defined(WTF_CHANGES) -#if PLATFORM(X86_64) +#if CPU(X86_64) // On all known X86-64 platforms, the upper 16 bits are always unused and therefore // can be excluded from the PageMap key. // See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details @@ -1222,13 +1248,6 @@ static const int kScavengeTimerDelayInSeconds = 5; // Number of free committed pages that we want to keep around. static const size_t kMinimumFreeCommittedPageCount = 512; -// During a scavenge, we'll release up to a fraction of the free committed pages. -#if PLATFORM(WIN) -// We are slightly less aggressive in releasing memory on Windows due to performance reasons. -static const int kMaxScavengeAmountFactor = 3; -#else -static const int kMaxScavengeAmountFactor = 2; -#endif #endif class TCMalloc_PageHeap { @@ -1372,26 +1391,34 @@ class TCMalloc_PageHeap { // Index of last free list we scavenged size_t scavenge_index_; -#if defined(WTF_CHANGES) && PLATFORM(DARWIN) +#if defined(WTF_CHANGES) && OS(DARWIN) friend class FastMallocZone; #endif #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY - static NO_RETURN void* runScavengerThread(void*); + void initializeScavenger(); + ALWAYS_INLINE void signalScavenger(); + void scavenge(); + ALWAYS_INLINE bool shouldContinueScavenging() const; +#if !HAVE(DISPATCH_H) + static NO_RETURN void* runScavengerThread(void*); NO_RETURN void scavengerThread(); - void scavenge(); - - inline bool shouldContinueScavenging() const; + // Keeps track of whether the background thread is actively scavenging memory every kScavengeTimerDelayInSeconds, or + // it's blocked waiting for more pages to be deleted. + bool m_scavengeThreadActive; pthread_mutex_t m_scavengeMutex; - pthread_cond_t m_scavengeCondition; +#else // !HAVE(DISPATCH_H) + void periodicScavenge(); + + dispatch_queue_t m_scavengeQueue; + dispatch_source_t m_scavengeTimer; + bool m_scavengingScheduled; +#endif - // Keeps track of whether the background thread is actively scavenging memory every kScavengeTimerDelayInSeconds, or - // it's blocked waiting for more pages to be deleted. - bool m_scavengeThreadActive; #endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY }; @@ -1419,15 +1446,23 @@ void TCMalloc_PageHeap::init() } #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + initializeScavenger(); +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY +} + +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + +#if !HAVE(DISPATCH_H) + +void TCMalloc_PageHeap::initializeScavenger() +{ pthread_mutex_init(&m_scavengeMutex, 0); pthread_cond_init(&m_scavengeCondition, 0); m_scavengeThreadActive = true; pthread_t thread; pthread_create(&thread, 0, runScavengerThread, this); -#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY } -#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY void* TCMalloc_PageHeap::runScavengerThread(void* context) { static_cast(context)->scavengerThread(); @@ -1437,42 +1472,66 @@ void* TCMalloc_PageHeap::runScavengerThread(void* context) #endif } -void TCMalloc_PageHeap::scavenge() +ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger() { - // If we have to commit memory in the last 5 seconds, it means we don't have enough free committed pages - // for the amount of allocations that we do. So hold off on releasing memory back to the system. + if (!m_scavengeThreadActive && shouldContinueScavenging()) + pthread_cond_signal(&m_scavengeCondition); +} + +#else // !HAVE(DISPATCH_H) + +void TCMalloc_PageHeap::initializeScavenger() +{ + m_scavengeQueue = dispatch_queue_create("com.apple.JavaScriptCore.FastMallocSavenger", NULL); + m_scavengeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, m_scavengeQueue); + dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, kScavengeTimerDelayInSeconds * NSEC_PER_SEC); + dispatch_source_set_timer(m_scavengeTimer, startTime, kScavengeTimerDelayInSeconds * NSEC_PER_SEC, 1000 * NSEC_PER_USEC); + dispatch_source_set_event_handler(m_scavengeTimer, ^{ periodicScavenge(); }); + m_scavengingScheduled = false; +} + +ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger() +{ + if (!m_scavengingScheduled && shouldContinueScavenging()) { + m_scavengingScheduled = true; + dispatch_resume(m_scavengeTimer); + } +} + +#endif + +void TCMalloc_PageHeap::scavenge() +{ + // If we've recently commited pages, our working set is growing, so now is + // not a good time to free pages. if (pages_committed_since_last_scavenge_ > 0) { pages_committed_since_last_scavenge_ = 0; return; } - Length pagesDecommitted = 0; - for (int i = kMaxPages; i >= 0; i--) { + + for (int i = kMaxPages; i >= 0 && shouldContinueScavenging(); i--) { SpanList* slist = (static_cast(i) == kMaxPages) ? &large_ : &free_[i]; if (!DLL_IsEmpty(&slist->normal)) { // Release the last span on the normal portion of this list Span* s = slist->normal.prev; - // Only decommit up to a fraction of the free committed pages if pages_allocated_since_last_scavenge_ > 0. - if ((pagesDecommitted + s->length) * kMaxScavengeAmountFactor > free_committed_pages_) - continue; DLL_Remove(s); - TCMalloc_SystemRelease(reinterpret_cast(s->start << kPageShift), - static_cast(s->length << kPageShift)); + ASSERT(!s->decommitted); if (!s->decommitted) { - pagesDecommitted += s->length; + TCMalloc_SystemRelease(reinterpret_cast(s->start << kPageShift), + static_cast(s->length << kPageShift)); + ASSERT(free_committed_pages_ >= s->length); + free_committed_pages_ -= s->length; s->decommitted = true; } DLL_Prepend(&slist->returned, s); - // We can stop scavenging if the number of free committed pages left is less than or equal to the minimum number we want to keep around. - if (free_committed_pages_ <= kMinimumFreeCommittedPageCount + pagesDecommitted) - break; } } + + ASSERT(!shouldContinueScavenging()); pages_committed_since_last_scavenge_ = 0; - ASSERT(free_committed_pages_ >= pagesDecommitted); - free_committed_pages_ -= pagesDecommitted; } -inline bool TCMalloc_PageHeap::shouldContinueScavenging() const +ALWAYS_INLINE bool TCMalloc_PageHeap::shouldContinueScavenging() const { return free_committed_pages_ > kMinimumFreeCommittedPageCount; } @@ -1734,8 +1793,7 @@ inline void TCMalloc_PageHeap::Delete(Span* span) { } // Make sure the scavenge thread becomes active if we have enough freed pages to release some back to the system. - if (!m_scavengeThreadActive && shouldContinueScavenging()) - pthread_cond_signal(&m_scavengeCondition); + signalScavenger(); #else IncrementalScavenge(n); #endif @@ -2278,7 +2336,9 @@ static inline TCMalloc_PageHeap* getPageHeap() #define pageheap getPageHeap() #if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY -#if PLATFORM(WIN_OS) + +#if !HAVE(DISPATCH_H) +#if OS(WINDOWS) static void sleep(unsigned seconds) { ::Sleep(seconds * 1000); @@ -2307,6 +2367,23 @@ void TCMalloc_PageHeap::scavengerThread() } } } + +#else + +void TCMalloc_PageHeap::periodicScavenge() +{ + { + SpinLockHolder h(&pageheap_lock); + pageheap->scavenge(); + } + + if (!shouldContinueScavenging()) { + m_scavengingScheduled = false; + dispatch_suspend(m_scavengeTimer); + } +} +#endif // HAVE(DISPATCH_H) + #endif // If TLS is available, we also store a copy @@ -2816,7 +2893,7 @@ void TCMalloc_ThreadCache::InitModule() { } pageheap->init(); phinited = 1; -#if defined(WTF_CHANGES) && PLATFORM(DARWIN) +#if defined(WTF_CHANGES) && OS(DARWIN) FastMallocZone::init(); #endif } @@ -3795,7 +3872,7 @@ void* realloc(void* old_ptr, size_t new_size) { return new_ptr; } else { #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - old_ptr = pByte + sizeof(AllocAlignmentInteger); // Set old_ptr back to the user pointer. + old_ptr = static_cast(old_ptr) + 1; // Set old_ptr back to the user pointer. #endif return old_ptr; } @@ -4014,7 +4091,7 @@ void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; #endif -#if defined(WTF_CHANGES) && PLATFORM(DARWIN) +#if defined(WTF_CHANGES) && OS(DARWIN) class FreeObjectFinder { const RemoteMemoryReader& m_reader; @@ -4297,7 +4374,7 @@ extern "C" { malloc_introspection_t jscore_fastmalloc_introspection = { &FastMallocZone::enumerate, &FastMallocZone::goodSize, &FastMallocZone::check, &FastMallocZone::print, &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !OS(IPHONE_OS) , 0 // zone_locked will not be called on the zone unless it advertises itself as version five or higher. #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h index 541b05d..74d4307 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h @@ -26,19 +26,14 @@ #include #include -#if COMPILER(GCC) -#define WTF_FAST_MALLOC_EXPORT __attribute__((visibility("default"))) -#else -#define WTF_FAST_MALLOC_EXPORT -#endif - namespace WTF { // These functions call CRASH() if an allocation fails. - void* fastMalloc(size_t) WTF_FAST_MALLOC_EXPORT; + void* fastMalloc(size_t); void* fastZeroedMalloc(size_t); - void* fastCalloc(size_t numElements, size_t elementSize) WTF_FAST_MALLOC_EXPORT; - void* fastRealloc(void*, size_t) WTF_FAST_MALLOC_EXPORT; + void* fastCalloc(size_t numElements, size_t elementSize); + void* fastRealloc(void*, size_t); + char* fastStrDup(const char*); struct TryMallocReturnValue { TryMallocReturnValue(void* data) @@ -77,7 +72,7 @@ namespace WTF { TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size); TryMallocReturnValue tryFastRealloc(void* p, size_t n); - void fastFree(void*) WTF_FAST_MALLOC_EXPORT; + void fastFree(void*); #ifndef NDEBUG void fastMallocForbid(); @@ -194,17 +189,18 @@ using WTF::tryFastZeroedMalloc; using WTF::tryFastCalloc; using WTF::tryFastRealloc; using WTF::fastFree; +using WTF::fastStrDup; #ifndef NDEBUG using WTF::fastMallocForbid; using WTF::fastMallocAllow; #endif -#if COMPILER(GCC) && PLATFORM(DARWIN) +#if COMPILER(GCC) && OS(DARWIN) #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline)) #elif COMPILER(GCC) #define WTF_PRIVATE_INLINE inline __attribute__((always_inline)) -#elif COMPILER(MSVC) +#elif COMPILER(MSVC) || COMPILER(RVCT) #define WTF_PRIVATE_INLINE __forceinline #else #define WTF_PRIVATE_INLINE inline @@ -222,14 +218,21 @@ using WTF::fastMallocAllow; // We musn't customize the global operator new and delete for the Qt port. #if !PLATFORM(QT) -WTF_PRIVATE_INLINE void* operator new(size_t size) { return fastMalloc(size); } +#if COMPILER(MSVC) +#pragma warning(push) +#pragma warning(disable: 4290) // Disable the C++ exception specification ignored warning. +#endif +WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); } WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } -WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); } +WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); } WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); } -WTF_PRIVATE_INLINE void* operator new[](size_t size) { return fastMalloc(size); } +WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); } WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } -WTF_PRIVATE_INLINE void operator delete[](void* p) { fastFree(p); } +WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); } WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); } +#if COMPILER(MSVC) +#pragma warning(pop) +#endif #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp deleted file mode 100644 index 432885f..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2008 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "GOwnPtr.h" - -namespace WTF { - -template <> void freeOwnedGPtr(GError* ptr) -{ - if (ptr) - g_error_free(ptr); -} - -template <> void freeOwnedGPtr(GList* ptr) -{ - g_list_free(ptr); -} - -template <> void freeOwnedGPtr(GCond* ptr) -{ - if (ptr) - g_cond_free(ptr); -} - -template <> void freeOwnedGPtr(GMutex* ptr) -{ - if (ptr) - g_mutex_free(ptr); -} - -template <> void freeOwnedGPtr(GPatternSpec* ptr) -{ - if (ptr) - g_pattern_spec_free(ptr); -} - -template <> void freeOwnedGPtr(GDir* ptr) -{ - if (ptr) - g_dir_close(ptr); -} - -template <> void freeOwnedGPtr(GHashTable* ptr) -{ - if (ptr) - g_hash_table_unref(ptr); -} - -} // namespace WTF diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h deleted file mode 100644 index 4993348..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2008 Collabora Ltd. - * - * 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 GOwnPtr_h -#define GOwnPtr_h - -#include -#include -#include -#include - -namespace WTF { - template inline void freeOwnedGPtr(T* ptr) { g_free(reinterpret_cast(ptr)); } - template<> void freeOwnedGPtr(GError*); - template<> void freeOwnedGPtr(GList*); - template<> void freeOwnedGPtr(GCond*); - template<> void freeOwnedGPtr(GMutex*); - template<> void freeOwnedGPtr(GPatternSpec*); - template<> void freeOwnedGPtr(GDir*); - template<> void freeOwnedGPtr(GHashTable*); - - template class GOwnPtr : public Noncopyable { - public: - explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { } - ~GOwnPtr() { freeOwnedGPtr(m_ptr); } - - T* get() const { return m_ptr; } - T* release() { T* ptr = m_ptr; m_ptr = 0; return ptr; } - T*& outPtr() { ASSERT(!m_ptr); return m_ptr; } - - void set(T* ptr) { ASSERT(!ptr || m_ptr != ptr); freeOwnedGPtr(m_ptr); m_ptr = ptr; } - void clear() { freeOwnedGPtr(m_ptr); m_ptr = 0; } - - T& operator*() const { ASSERT(m_ptr); return *m_ptr; } - T* operator->() const { ASSERT(m_ptr); return m_ptr; } - - bool operator!() const { return !m_ptr; } - - // This conversion operator allows implicit conversion to bool but not to other integer types. - typedef T* GOwnPtr::*UnspecifiedBoolType; - operator UnspecifiedBoolType() const { return m_ptr ? &GOwnPtr::m_ptr : 0; } - - void swap(GOwnPtr& o) { std::swap(m_ptr, o.m_ptr); } - - private: - T* m_ptr; - }; - - template inline void swap(GOwnPtr& a, GOwnPtr& b) { a.swap(b); } - - template inline bool operator==(const GOwnPtr& a, U* b) - { - return a.get() == b; - } - - template inline bool operator==(T* a, const GOwnPtr& b) - { - return a == b.get(); - } - - template inline bool operator!=(const GOwnPtr& a, U* b) - { - return a.get() != b; - } - - template inline bool operator!=(T* a, const GOwnPtr& b) - { - return a != b.get(); - } - - template inline typename GOwnPtr::PtrType getPtr(const GOwnPtr& p) - { - return p.get(); - } - -} // namespace WTF - -using WTF::GOwnPtr; - -#endif // GOwnPtr_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h index 13afb72..2c66a2d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashFunctions.h @@ -173,9 +173,6 @@ namespace WTF { template struct DefaultHash > { typedef PtrHash > Hash; }; template struct DefaultHash > { typedef PairHash Hash; }; - - // Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's - static const unsigned stringHashingStartValue = 0x9e3779b9U; } // namespace WTF diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h index 3de5ee6..d63a8d4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h @@ -83,6 +83,25 @@ namespace WTF { MappedType take(const KeyType&); // efficient combination of get with remove + // An alternate version of find() that finds the object by hashing and comparing + // with some other type, to avoid the cost of type conversion. HashTranslator + // must have the following function members: + // static unsigned hash(const T&); + // static bool equal(const ValueType&, const T&); + template iterator find(const T&); + template const_iterator find(const T&) const; + template bool contains(const T&) const; + + // An alternate version of add() that finds the object by hashing and comparing + // with some other type, to avoid the cost of type conversion if the object is already + // in the table. HashTranslator must have the following function members: + // static unsigned hash(const T&); + // static bool equal(const ValueType&, const T&); + // static translate(ValueType&, const T&, unsigned hashCode); + template pair add(const T&, const MappedType&); + + void checkConsistency() const; + private: pair inlineAdd(const KeyType&, const MappedType&); @@ -107,6 +126,19 @@ namespace WTF { } }; + template + struct HashMapTranslatorAdapter { + typedef typename ValueType::first_type KeyType; + typedef typename ValueType::second_type MappedType; + + static unsigned hash(const T& key) { return Translator::hash(key); } + static bool equal(const KeyType& a, const T& b) { return Translator::equal(a, b); } + static void translate(ValueType& location, const T& key, const MappedType&, unsigned hashCode) + { + Translator::translate(location.first, key, hashCode); + } + }; + template inline void HashMap::swap(HashMap& other) { @@ -174,6 +206,33 @@ namespace WTF { } template + template + inline typename HashMap::iterator + HashMap::find(const TYPE& value) + { + typedef HashMapTranslatorAdapter Adapter; + return m_impl.template find(value); + } + + template + template + inline typename HashMap::const_iterator + HashMap::find(const TYPE& value) const + { + typedef HashMapTranslatorAdapter Adapter; + return m_impl.template find(value); + } + + template + template + inline bool + HashMap::contains(const TYPE& value) const + { + typedef HashMapTranslatorAdapter Adapter; + return m_impl.template contains(value); + } + + template inline pair::iterator, bool> HashMap::inlineAdd(const KeyType& key, const MappedType& mapped) { @@ -194,6 +253,15 @@ namespace WTF { } template + template + pair::iterator, bool> + HashMap::add(const TYPE& key, const MappedType& value) + { + typedef HashMapTranslatorAdapter Adapter; + return m_impl.template addPassingHashCode(key, value); + } + + template pair::iterator, bool> HashMap::add(const KeyType& key, const MappedType& mapped) { @@ -215,7 +283,7 @@ namespace WTF { { if (it.m_impl == m_impl.end()) return; - m_impl.checkTableConsistency(); + m_impl.internalCheckTableConsistency(); m_impl.removeWithoutEntryConsistencyCheck(it.m_impl); } @@ -245,6 +313,13 @@ namespace WTF { } template + inline void HashMap::checkConsistency() const + { + m_impl.checkTableConsistency(); + } + + + template bool operator==(const HashMap& a, const HashMap& b) { if (a.size() != b.size()) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h index f4e2cf7..4429490 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h @@ -81,7 +81,7 @@ namespace WTF { // An alternate version of add() that finds the object by hashing and comparing // with some other type, to avoid the cost of type conversion if the object is already - // in the table. HashTranslator must have the following methods: + // in the table. HashTranslator must have the following function members: // static unsigned hash(const T&); // static bool equal(const ValueType&, const T&); // static translate(ValueType&, const T&, unsigned hashCode); @@ -224,7 +224,7 @@ namespace WTF { { if (it.m_impl == m_impl.end()) return; - m_impl.checkTableConsistency(); + m_impl.internalCheckTableConsistency(); m_impl.removeWithoutEntryConsistencyCheck(it.m_impl); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h index 3b283f8..ceb8963 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashTable.h @@ -24,12 +24,14 @@ #include "FastMalloc.h" #include "HashTraits.h" +#include "ValueCheck.h" #include #include namespace WTF { #define DUMP_HASHTABLE_STATS 0 +// Enables internal WTF consistency checks that are invoked automatically. Non-WTF callers can call checkTableConsistency() even if internal checks are disabled. #define CHECK_HASHTABLE_CONSISTENCY 0 #ifdef NDEBUG @@ -197,7 +199,7 @@ namespace WTF { void checkValidity(const const_iterator& other) const { ASSERT(m_table); - ASSERT(other.m_table); + ASSERT_UNUSED(other, other.m_table); ASSERT(m_table == other.m_table); } #else @@ -340,11 +342,18 @@ namespace WTF { ValueType* lookup(const Key& key) { return lookup(key); } template ValueType* lookup(const T&); -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED void checkTableConsistency() const; #else static void checkTableConsistency() { } #endif +#if CHECK_HASHTABLE_CONSISTENCY + void internalCheckTableConsistency() const { checkTableConsistency(); } + void internalCheckTableConsistencyExceptSize() const { checkTableConsistencyExceptSize(); } +#else + static void internalCheckTableConsistencyExceptSize() { } + static void internalCheckTableConsistency() { } +#endif private: static ValueType* allocateTable(int size); @@ -383,7 +392,7 @@ namespace WTF { iterator makeKnownGoodIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); } const_iterator makeKnownGoodConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); } -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED void checkTableConsistencyExceptSize() const; #else static void checkTableConsistencyExceptSize() { } @@ -624,7 +633,7 @@ namespace WTF { if (!m_table) expand(); - checkTableConsistency(); + internalCheckTableConsistency(); ASSERT(m_table); @@ -693,7 +702,7 @@ namespace WTF { return p; } - checkTableConsistency(); + internalCheckTableConsistency(); return std::make_pair(makeKnownGoodIterator(entry), true); } @@ -709,7 +718,7 @@ namespace WTF { if (!m_table) expand(); - checkTableConsistency(); + internalCheckTableConsistency(); FullLookupType lookupResult = fullLookupForWriting(key); @@ -738,7 +747,7 @@ namespace WTF { return p; } - checkTableConsistency(); + internalCheckTableConsistency(); return std::make_pair(makeKnownGoodIterator(entry), true); } @@ -805,7 +814,7 @@ namespace WTF { void HashTable::removeAndInvalidate(ValueType* pos) { invalidateIterators(); - checkTableConsistency(); + internalCheckTableConsistency(); remove(pos); } @@ -823,7 +832,7 @@ namespace WTF { if (shouldShrink()) shrink(); - checkTableConsistency(); + internalCheckTableConsistency(); } template @@ -892,7 +901,7 @@ namespace WTF { template void HashTable::rehash(int newTableSize) { - checkTableConsistencyExceptSize(); + internalCheckTableConsistencyExceptSize(); int oldTableSize = m_tableSize; ValueType* oldTable = m_table; @@ -914,7 +923,7 @@ namespace WTF { deallocateTable(oldTable, oldTableSize); - checkTableConsistency(); + internalCheckTableConsistency(); } template @@ -981,13 +990,13 @@ namespace WTF { return *this; } -#if CHECK_HASHTABLE_CONSISTENCY +#if !ASSERT_DISABLED template void HashTable::checkTableConsistency() const { checkTableConsistencyExceptSize(); - ASSERT(!shouldExpand()); + ASSERT(!m_table || !shouldExpand()); ASSERT(!shouldShrink()); } @@ -1012,6 +1021,8 @@ namespace WTF { const_iterator it = find(Extractor::extract(*entry)); ASSERT(entry == it.m_position); ++count; + + ValueCheck::checkConsistency(it->first); } ASSERT(count == m_keyCount); @@ -1021,7 +1032,7 @@ namespace WTF { ASSERT(m_tableSize == m_tableSizeMask + 1); } -#endif // CHECK_HASHTABLE_CONSISTENCY +#endif // ASSERT_DISABLED #if CHECK_HASHTABLE_ITERATORS diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h index 38cc998..54ed36b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ListHashSet.h @@ -51,7 +51,7 @@ namespace WTF { template struct ListHashSetNodeAllocator; template struct ListHashSetNodeHashFunctions; - template::Hash> class ListHashSet { + template::Hash> class ListHashSet : public FastAllocBase { private: typedef ListHashSetNode Node; typedef ListHashSetNodeAllocator NodeAllocator; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp index e999094..40a4ae5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp @@ -39,10 +39,12 @@ namespace WTF { struct FunctionWithContext { MainThreadFunction* function; void* context; + ThreadCondition* syncFlag; - FunctionWithContext(MainThreadFunction* function = 0, void* context = 0) + FunctionWithContext(MainThreadFunction* function = 0, void* context = 0, ThreadCondition* syncFlag = 0) : function(function) , context(context) + , syncFlag(syncFlag) { } }; @@ -92,6 +94,8 @@ void dispatchFunctionsFromMainThread() } invocation.function(invocation.context); + if (invocation.syncFlag) + invocation.syncFlag->signal(); // If we are running accumulated functions for too long so UI may become unresponsive, we need to // yield so the user input can be processed. Otherwise user may not be able to even close the window. @@ -117,6 +121,24 @@ void callOnMainThread(MainThreadFunction* function, void* context) scheduleDispatchFunctionsOnMainThread(); } +void callOnMainThreadAndWait(MainThreadFunction* function, void* context) +{ + ASSERT(function); + + if (isMainThread()) { + function(context); + return; + } + + ThreadCondition syncFlag; + Mutex& functionQueueMutex = mainThreadFunctionQueueMutex(); + MutexLocker locker(functionQueueMutex); + functionQueue().append(FunctionWithContext(function, context, &syncFlag)); + if (functionQueue().size() == 1) + scheduleDispatchFunctionsOnMainThread(); + syncFlag.wait(functionQueueMutex); +} + void setMainThreadCallbacksPaused(bool paused) { ASSERT(isMainThread()); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h index 01ce804..8c0275b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h @@ -38,6 +38,9 @@ typedef void MainThreadFunction(void*); void callOnMainThread(MainThreadFunction*, void* context); +// Blocks the thread until the call finishes on the main thread. Misusing this can easily cause deadlocks. +void callOnMainThreadAndWait(MainThreadFunction*, void* context); + void setMainThreadCallbacksPaused(bool paused); // Must be called from the main thread (Darwin is an exception to this rule). @@ -52,6 +55,7 @@ void dispatchFunctionsFromMainThread(); } // namespace WTF using WTF::callOnMainThread; +using WTF::callOnMainThreadAndWait; using WTF::setMainThreadCallbacksPaused; #endif // MainThread_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h index 556230e..8666724 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MathExtras.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,28 +26,24 @@ #ifndef WTF_MathExtras_h #define WTF_MathExtras_h -#include +#include +#include #include -#if PLATFORM(SOLARIS) +#if OS(SOLARIS) #include #endif -#if PLATFORM(OPENBSD) +#if OS(OPENBSD) #include #include #endif #if COMPILER(MSVC) -#if PLATFORM(WINCE) +#if OS(WINCE) #include #endif #include - -#if HAVE(FLOAT_H) -#include -#endif - #endif #ifndef M_PI @@ -66,7 +62,7 @@ const double piOverFourDouble = M_PI_4; const float piOverFourFloat = static_cast(M_PI_4); #endif -#if PLATFORM(DARWIN) +#if OS(DARWIN) // Work around a bug in the Mac OS X libc where ceil(-0.1) return +0. inline double wtf_ceil(double x) { return copysign(ceil(x), x); } @@ -75,7 +71,7 @@ inline double wtf_ceil(double x) { return copysign(ceil(x), x); } #endif -#if PLATFORM(SOLARIS) +#if OS(SOLARIS) #ifndef isfinite inline bool isfinite(double x) { return finite(x) && !isnand(x); } @@ -89,7 +85,7 @@ inline bool signbit(double x) { return x < 0.0; } // FIXME: Wrong for negative 0 #endif -#if PLATFORM(OPENBSD) +#if OS(OPENBSD) #ifndef isfinite inline bool isfinite(double x) { return finite(x); } @@ -102,12 +98,25 @@ inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x #if COMPILER(MSVC) || COMPILER(RVCT) -inline long long llround(double num) { return static_cast(num > 0 ? num + 0.5 : ceil(num - 0.5)); } -inline long long llroundf(float num) { return static_cast(num > 0 ? num + 0.5f : ceil(num - 0.5f)); } -inline long lround(double num) { return static_cast(num > 0 ? num + 0.5 : ceil(num - 0.5)); } -inline long lroundf(float num) { return static_cast(num > 0 ? num + 0.5f : ceilf(num - 0.5f)); } -inline double round(double num) { return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); } -inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); } +// We must not do 'num + 0.5' or 'num - 0.5' because they can cause precision loss. +static double round(double num) +{ + double integer = ceil(num); + if (num > 0) + return integer - num > 0.5 ? integer - 1.0 : integer; + return integer - num >= 0.5 ? integer - 1.0 : integer; +} +static float roundf(float num) +{ + float integer = ceilf(num); + if (num > 0) + return integer - num > 0.5f ? integer - 1.0f : integer; + return integer - num >= 0.5f ? integer - 1.0f : integer; +} +inline long long llround(double num) { return static_cast(round(num)); } +inline long long llroundf(float num) { return static_cast(roundf(num)); } +inline long lround(double num) { return static_cast(round(num)); } +inline long lroundf(float num) { return static_cast(roundf(num)); } inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); } #endif @@ -177,4 +186,11 @@ inline float deg2turn(float d) { return d / 360.0f; } inline float rad2grad(float r) { return r * 200.0f / piFloat; } inline float grad2rad(float g) { return g * piFloat / 200.0f; } +#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(ANDROID) && !COMPILER(WINSCW) +using std::isfinite; +using std::isinf; +using std::isnan; +using std::signbit; +#endif + #endif // #ifndef WTF_MathExtras_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 9c9a4a7..48bd10a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -44,23 +44,27 @@ namespace WTF { MessageQueueMessageReceived, // A message was successfully received and returned. }; + // The queue takes ownership of messages and transfer it to the new owner + // when messages are fetched from the queue. + // Essentially, MessageQueue acts as a queue of OwnPtr. template class MessageQueue : public Noncopyable { public: MessageQueue() : m_killed(false) { } - - void append(const DataType&); - bool appendAndCheckEmpty(const DataType&); - void prepend(const DataType&); - bool waitForMessage(DataType&); + ~MessageQueue(); + + void append(PassOwnPtr); + bool appendAndCheckEmpty(PassOwnPtr); + void prepend(PassOwnPtr); + + PassOwnPtr waitForMessage(); + PassOwnPtr tryGetMessage(); template - MessageQueueWaitResult waitForMessageFilteredWithTimeout(DataType&, Predicate&, double absoluteTime); + PassOwnPtr waitForMessageFilteredWithTimeout(MessageQueueWaitResult&, Predicate&, double absoluteTime); template void removeIf(Predicate&); - bool tryGetMessage(DataType&); - void kill(); bool killed() const; @@ -70,86 +74,98 @@ namespace WTF { static double infiniteTime() { return std::numeric_limits::max(); } private: - static bool alwaysTruePredicate(DataType&) { return true; } + static bool alwaysTruePredicate(DataType*) { return true; } mutable Mutex m_mutex; ThreadCondition m_condition; - Deque m_queue; + Deque m_queue; bool m_killed; }; template - inline void MessageQueue::append(const DataType& message) + MessageQueue::~MessageQueue() + { + deleteAllValues(m_queue); + } + + template + inline void MessageQueue::append(PassOwnPtr message) { MutexLocker lock(m_mutex); - m_queue.append(message); + m_queue.append(message.release()); m_condition.signal(); } // Returns true if the queue was empty before the item was added. template - inline bool MessageQueue::appendAndCheckEmpty(const DataType& message) + inline bool MessageQueue::appendAndCheckEmpty(PassOwnPtr message) { MutexLocker lock(m_mutex); bool wasEmpty = m_queue.isEmpty(); - m_queue.append(message); + m_queue.append(message.release()); m_condition.signal(); return wasEmpty; } template - inline void MessageQueue::prepend(const DataType& message) + inline void MessageQueue::prepend(PassOwnPtr message) { MutexLocker lock(m_mutex); - m_queue.prepend(message); + m_queue.prepend(message.release()); m_condition.signal(); } template - inline bool MessageQueue::waitForMessage(DataType& result) + inline PassOwnPtr MessageQueue::waitForMessage() { - MessageQueueWaitResult exitReason = waitForMessageFilteredWithTimeout(result, MessageQueue::alwaysTruePredicate, infiniteTime()); + MessageQueueWaitResult exitReason; + PassOwnPtr result = waitForMessageFilteredWithTimeout(exitReason, MessageQueue::alwaysTruePredicate, infiniteTime()); ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived); - return exitReason == MessageQueueMessageReceived; + return result; } template template - inline MessageQueueWaitResult MessageQueue::waitForMessageFilteredWithTimeout(DataType& result, Predicate& predicate, double absoluteTime) + inline PassOwnPtr MessageQueue::waitForMessageFilteredWithTimeout(MessageQueueWaitResult& result, Predicate& predicate, double absoluteTime) { MutexLocker lock(m_mutex); bool timedOut = false; - DequeConstIterator found = m_queue.end(); + DequeConstIterator found = m_queue.end(); while (!m_killed && !timedOut && (found = m_queue.findIf(predicate)) == m_queue.end()) timedOut = !m_condition.timedWait(m_mutex, absoluteTime); ASSERT(!timedOut || absoluteTime != infiniteTime()); - if (m_killed) - return MessageQueueTerminated; + if (m_killed) { + result = MessageQueueTerminated; + return 0; + } - if (timedOut) - return MessageQueueTimeout; + if (timedOut) { + result = MessageQueueTimeout; + return 0; + } ASSERT(found != m_queue.end()); - result = *found; + DataType* message = *found; m_queue.remove(found); - return MessageQueueMessageReceived; + result = MessageQueueMessageReceived; + return message; } template - inline bool MessageQueue::tryGetMessage(DataType& result) + inline PassOwnPtr MessageQueue::tryGetMessage() { MutexLocker lock(m_mutex); if (m_killed) - return false; + return 0; if (m_queue.isEmpty()) - return false; + return 0; - result = m_queue.first(); + DataType* message = m_queue.first(); m_queue.removeFirst(); - return true; + return message; } template @@ -157,9 +173,15 @@ namespace WTF { inline void MessageQueue::removeIf(Predicate& predicate) { MutexLocker lock(m_mutex); - DequeConstIterator found = m_queue.end(); - while ((found = m_queue.findIf(predicate)) != m_queue.end()) { + // See bug 31657 for why this loop looks so weird + while (true) { + DequeConstIterator found = m_queue.findIf(predicate); + if (found == m_queue.end()) + break; + + DataType* message = *found; m_queue.remove(found); + delete message; } } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h index f56bc10..9c6e44fe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h @@ -28,28 +28,29 @@ namespace WTF { template class RefPtr; template class PassRefPtr; template PassRefPtr adoptRef(T*); - - // Remove inline for winscw compiler to prevent the compiler agressively resolving - // T::deref(), which will fail compiling when PassRefPtr is used as class member - // or function arguments before T is defined. - template + + + // Remove inline for WINSCW compiler to prevent the compiler agressively resolving + // T::ref() and T::deref(), which will fail compiling when PassRefPtr is used as + // a class member or function arguments before T is defined. + template #if !COMPILER(WINSCW) - inline + inline #endif - void derefIfNotNull(T* ptr) + void refIfNotNull(T* ptr) { if (UNLIKELY(ptr != 0)) - ptr->deref(); + ptr->ref(); } - template + template #if !COMPILER(WINSCW) - inline + inline #endif - void refIfNotNull(T* ptr) + void derefIfNotNull(T* ptr) { if (UNLIKELY(ptr != 0)) - ptr->ref(); + ptr->deref(); } template class PassRefPtr { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 4a008cc..efd96ca 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -27,431 +27,488 @@ #ifndef WTF_Platform_h #define WTF_Platform_h -/* PLATFORM handles OS, operating environment, graphics API, and CPU */ +/* ==== PLATFORM handles OS, operating environment, graphics API, and + CPU. This macro will be phased out in favor of platform adaptation + macros, policy decision macros, and top-level port definitions. ==== */ #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE) + + +/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ + +/* COMPILER() - the compiler being used to build the project */ #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE && WTF_COMPILER_##WTF_FEATURE) +/* CPU() - the target CPU architecture */ +#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE) +/* HAVE() - specific system features (headers, functions or similar) that are present or not */ #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) -#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) -#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) +/* OS() - underlying operating system; only to be used for mandated low-level services like + virtual memory, not to choose a GUI toolkit */ +#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) -/* Operating systems - low-level dependencies */ -/* PLATFORM(DARWIN) */ -/* Operating system level dependencies for Mac OS X / Darwin that should */ -/* be used regardless of operating environment */ -#ifdef __APPLE__ -#define WTF_PLATFORM_DARWIN 1 -#include -#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 -#define BUILDING_ON_TIGER 1 -#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -#define BUILDING_ON_LEOPARD 1 -#endif -#include -#endif +/* ==== Policy decision macros: these define policy choices for a particular port. ==== */ -/* PLATFORM(WIN_OS) */ -/* Operating system level dependencies for Windows that should be used */ -/* regardless of operating environment */ -#if defined(WIN32) || defined(_WIN32) -#define WTF_PLATFORM_WIN_OS 1 -#endif +/* USE() - use a particular third-party library or optional OS service */ +#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) +/* ENABLE() - turn on a specific feature of WebKit */ +#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) -/* PLATFORM(WINCE) */ -/* Operating system level dependencies for Windows CE that should be used */ -/* regardless of operating environment */ -/* Note that for this platform PLATFORM(WIN_OS) is also defined. */ -#if defined(_WIN32_WCE) -#define WTF_PLATFORM_WINCE 1 -#endif -/* PLATFORM(LINUX) */ -/* Operating system level dependencies for Linux-like systems that */ -/* should be used regardless of operating environment */ -#ifdef __linux__ -#define WTF_PLATFORM_LINUX 1 -#endif -/* PLATFORM(FREEBSD) */ -/* Operating system level dependencies for FreeBSD-like systems that */ -/* should be used regardless of operating environment */ -#ifdef __FreeBSD__ -#define WTF_PLATFORM_FREEBSD 1 -#endif +/* ==== COMPILER() - the compiler being used to build the project ==== */ -/* PLATFORM(OPENBSD) */ -/* Operating system level dependencies for OpenBSD systems that */ -/* should be used regardless of operating environment */ -#ifdef __OpenBSD__ -#define WTF_PLATFORM_OPENBSD 1 +/* COMPILER(MSVC) Microsoft Visual C++ */ +/* COMPILER(MSVC7) Microsoft Visual C++ v7 or lower*/ +#if defined(_MSC_VER) +#define WTF_COMPILER_MSVC 1 +#if _MSC_VER < 1400 +#define WTF_COMPILER_MSVC7 1 #endif - -/* PLATFORM(SOLARIS) */ -/* Operating system level dependencies for Solaris that should be used */ -/* regardless of operating environment */ -#if defined(sun) || defined(__sun) -#define WTF_PLATFORM_SOLARIS 1 #endif -#if defined (__SYMBIAN32__) -/* we are cross-compiling, it is not really windows */ -#undef WTF_PLATFORM_WIN_OS -#undef WTF_PLATFORM_WIN -#define WTF_PLATFORM_SYMBIAN 1 +/* COMPILER(RVCT) - ARM RealView Compilation Tools */ +#if defined(__CC_ARM) || defined(__ARMCC__) +#define WTF_COMPILER_RVCT 1 #endif - -/* PLATFORM(NETBSD) */ -/* Operating system level dependencies for NetBSD that should be used */ -/* regardless of operating environment */ -#if defined(__NetBSD__) -#define WTF_PLATFORM_NETBSD 1 +/* COMPILER(GCC) - GNU Compiler Collection */ +/* --gnu option of the RVCT compiler also defines __GNUC__ */ +#if defined(__GNUC__) && !COMPILER(RVCT) +#define WTF_COMPILER_GCC 1 +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif -/* PLATFORM(QNX) */ -/* Operating system level dependencies for QNX that should be used */ -/* regardless of operating environment */ -#if defined(__QNXNTO__) -#define WTF_PLATFORM_QNX 1 +/* COMPILER(MINGW) - MinGW GCC */ +#if defined(MINGW) || defined(__MINGW32__) +#define WTF_COMPILER_MINGW 1 #endif -/* PLATFORM(UNIX) */ -/* Operating system level dependencies for Unix-like systems that */ -/* should be used regardless of operating environment */ -#if PLATFORM(DARWIN) \ - || PLATFORM(FREEBSD) \ - || PLATFORM(SYMBIAN) \ - || PLATFORM(NETBSD) \ - || defined(unix) \ - || defined(__unix) \ - || defined(__unix__) \ - || defined(_AIX) \ - || defined(__HAIKU__) \ - || defined(__QNXNTO__) -#define WTF_PLATFORM_UNIX 1 +/* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */ +#if defined(__WINSCW__) +#define WTF_COMPILER_WINSCW 1 #endif -/* Operating environments */ -/* PLATFORM(CHROMIUM) */ -/* PLATFORM(QT) */ -/* PLATFORM(GTK) */ -/* PLATFORM(MAC) */ -/* PLATFORM(WIN) */ -#if defined(BUILDING_CHROMIUM__) -#define WTF_PLATFORM_CHROMIUM 1 -#elif defined(BUILDING_QT__) -#define WTF_PLATFORM_QT 1 -/* PLATFORM(KDE) */ -#if defined(BUILDING_KDE__) -#define WTF_PLATFORM_KDE 1 -#endif +/* ==== CPU() - the target CPU architecture ==== */ -#elif defined(BUILDING_WX__) -#define WTF_PLATFORM_WX 1 -#elif defined(BUILDING_GTK__) -#define WTF_PLATFORM_GTK 1 -#elif defined(BUILDING_HAIKU__) -#define WTF_PLATFORM_HAIKU 1 -#elif PLATFORM(DARWIN) -#define WTF_PLATFORM_MAC 1 -#elif PLATFORM(WIN_OS) -#define WTF_PLATFORM_WIN 1 -#endif +/* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */ -/* PLATFORM(IPHONE) */ -#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) -#define WTF_PLATFORM_IPHONE 1 +/* CPU(ALPHA) - DEC Alpha */ +#if defined(__alpha__) +#define WTF_CPU_ALPHA 1 #endif -/* PLATFORM(IPHONE_SIMULATOR) */ -#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR -#define WTF_PLATFORM_IPHONE 1 -#define WTF_PLATFORM_IPHONE_SIMULATOR 1 -#else -#define WTF_PLATFORM_IPHONE_SIMULATOR 0 +/* CPU(IA64) - Itanium / IA-64 */ +#if defined(__ia64__) +#define WTF_CPU_IA64 1 #endif -#if !defined(WTF_PLATFORM_IPHONE) -#define WTF_PLATFORM_IPHONE 0 +/* CPU(PPC) - PowerPC 32-bit */ +#if defined(__ppc__) \ + || defined(__PPC__) \ + || defined(__powerpc__) \ + || defined(__powerpc) \ + || defined(__POWERPC__) \ + || defined(_M_PPC) \ + || defined(__PPC) +#define WTF_CPU_PPC 1 +#define WTF_CPU_BIG_ENDIAN 1 #endif -/* Graphics engines */ - -/* PLATFORM(CG) and PLATFORM(CI) */ -#if PLATFORM(MAC) || PLATFORM(IPHONE) -#define WTF_PLATFORM_CG 1 -#endif -#if PLATFORM(MAC) && !PLATFORM(IPHONE) -#define WTF_PLATFORM_CI 1 +/* CPU(PPC64) - PowerPC 64-bit */ +#if defined(__ppc64__) \ + || defined(__PPC64__) +#define WTF_CPU_PPC64 1 +#define WTF_CPU_BIG_ENDIAN 1 #endif -/* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */ -#if PLATFORM(CHROMIUM) -#if PLATFORM(DARWIN) -#define WTF_PLATFORM_CG 1 -#define WTF_PLATFORM_CI 1 -#define WTF_USE_ATSUI 1 -#else -#define WTF_PLATFORM_SKIA 1 -#endif +/* CPU(SH4) - SuperH SH-4 */ +#if defined(__SH4__) +#define WTF_CPU_SH4 1 #endif -/* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */ -/* FIXME: This should be changed from a blacklist to a whitelist */ -#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) && !PLATFORM(HAIKU) -#define WTF_PLATFORM_CAIRO 1 +/* CPU(SPARC32) - SPARC 32-bit */ +#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) +#define WTF_CPU_SPARC32 1 +#define WTF_CPU_BIG_ENDIAN 1 #endif -/* CPU */ - -/* PLATFORM(PPC) */ -#if defined(__ppc__) \ - || defined(__PPC__) \ - || defined(__powerpc__) \ - || defined(__powerpc) \ - || defined(__POWERPC__) \ - || defined(_M_PPC) \ - || defined(__PPC) -#define WTF_PLATFORM_PPC 1 -#define WTF_PLATFORM_BIG_ENDIAN 1 +/* CPU(SPARC64) - SPARC 64-bit */ +#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) +#define WTF_CPU_SPARC64 1 +#define WTF_CPU_BIG_ENDIAN 1 #endif -/* PLATFORM(SPARC32) */ -#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) -#define WTF_PLATFORM_SPARC32 1 -#define WTF_PLATFORM_BIG_ENDIAN 1 +/* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ +#if CPU(SPARC32) || CPU(SPARC64) +#define WTF_CPU_SPARC #endif -#if PLATFORM(SPARC32) || PLATFORM(SPARC64) -#define WTF_PLATFORM_SPARC +/* CPU(X86) - i386 / x86 32-bit */ +#if defined(__i386__) \ + || defined(i386) \ + || defined(_M_IX86) \ + || defined(_X86_) \ + || defined(__THW_INTEL) +#define WTF_CPU_X86 1 #endif -/* PLATFORM(PPC64) */ -#if defined(__ppc64__) \ - || defined(__PPC64__) -#define WTF_PLATFORM_PPC64 1 -#define WTF_PLATFORM_BIG_ENDIAN 1 +/* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ +#if defined(__x86_64__) \ + || defined(_M_X64) +#define WTF_CPU_X86_64 1 #endif -/* PLATFORM(ARM) */ -#define PLATFORM_ARM_ARCH(N) (PLATFORM(ARM) && ARM_ARCH_VERSION >= N) - +/* CPU(ARM) - ARM, any version*/ #if defined(arm) \ - || defined(__arm__) -#define WTF_PLATFORM_ARM 1 + || defined(__arm__) +#define WTF_CPU_ARM 1 #if defined(__ARMEB__) -#define WTF_PLATFORM_BIG_ENDIAN 1 +#define WTF_CPU_BIG_ENDIAN 1 #elif !defined(__ARM_EABI__) \ - && !defined(__EABI__) \ - && !defined(__VFP_FP__) -#define WTF_PLATFORM_MIDDLE_ENDIAN 1 + && !defined(__EABI__) \ + && !defined(__VFP_FP__) \ + && !defined(ANDROID) +#define WTF_CPU_MIDDLE_ENDIAN 1 #endif -/* Set ARM_ARCH_VERSION */ +#define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) + +/* Set WTF_ARM_ARCH_VERSION */ #if defined(__ARM_ARCH_4__) \ - || defined(__ARM_ARCH_4T__) \ - || defined(__MARM_ARMV4__) \ - || defined(_ARMV4I_) -#define ARM_ARCH_VERSION 4 + || defined(__ARM_ARCH_4T__) \ + || defined(__MARM_ARMV4__) \ + || defined(_ARMV4I_) +#define WTF_ARM_ARCH_VERSION 4 #elif defined(__ARM_ARCH_5__) \ - || defined(__ARM_ARCH_5T__) \ - || defined(__ARM_ARCH_5E__) \ - || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) \ - || defined(__MARM_ARMV5__) -#define ARM_ARCH_VERSION 5 + || defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5E__) \ + || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) \ + || defined(__MARM_ARMV5__) +#define WTF_ARM_ARCH_VERSION 5 #elif defined(__ARM_ARCH_6__) \ - || defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6K__) \ - || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) \ - || defined(__ARM_ARCH_6T2__) \ - || defined(__ARMV6__) -#define ARM_ARCH_VERSION 6 + || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) \ + || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6T2__) \ + || defined(__ARMV6__) +#define WTF_ARM_ARCH_VERSION 6 #elif defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) -#define ARM_ARCH_VERSION 7 + || defined(__ARM_ARCH_7R__) +#define WTF_ARM_ARCH_VERSION 7 /* RVCT sets _TARGET_ARCH_ARM */ #elif defined(__TARGET_ARCH_ARM) -#define ARM_ARCH_VERSION __TARGET_ARCH_ARM +#define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM #else -#define ARM_ARCH_VERSION 0 +#define WTF_ARM_ARCH_VERSION 0 #endif -/* Set THUMB_ARM_VERSION */ +/* Set WTF_THUMB_ARCH_VERSION */ #if defined(__ARM_ARCH_4T__) -#define THUMB_ARCH_VERSION 1 +#define WTF_THUMB_ARCH_VERSION 1 #elif defined(__ARM_ARCH_5T__) \ - || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) -#define THUMB_ARCH_VERSION 2 + || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +#define WTF_THUMB_ARCH_VERSION 2 #elif defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6K__) \ - || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) \ - || defined(__ARM_ARCH_6M__) -#define THUMB_ARCH_VERSION 3 + || defined(__ARM_ARCH_6K__) \ + || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6M__) +#define WTF_THUMB_ARCH_VERSION 3 #elif defined(__ARM_ARCH_6T2__) \ - || defined(__ARM_ARCH_7__) \ - || defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) \ - || defined(__ARM_ARCH_7M__) -#define THUMB_ARCH_VERSION 4 + || defined(__ARM_ARCH_7__) \ + || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) \ + || defined(__ARM_ARCH_7M__) +#define WTF_THUMB_ARCH_VERSION 4 /* RVCT sets __TARGET_ARCH_THUMB */ #elif defined(__TARGET_ARCH_THUMB) -#define THUMB_ARCH_VERSION __TARGET_ARCH_THUMB +#define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB #else -#define THUMB_ARCH_VERSION 0 +#define WTF_THUMB_ARCH_VERSION 0 #endif -/* On ARMv5 and below the natural alignment is required. */ -#if !defined(ARM_REQUIRE_NATURAL_ALIGNMENT) && ARM_ARCH_VERSION <= 5 -#define ARM_REQUIRE_NATURAL_ALIGNMENT 1 + +/* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */ +/* On ARMv5 and below the natural alignment is required. + And there are some other differences for v5 or earlier. */ +#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6) +#define WTF_CPU_ARMV5_OR_LOWER 1 #endif -/* Defines two pseudo-platforms for ARM and Thumb-2 instruction set. */ -#if !defined(WTF_PLATFORM_ARM_TRADITIONAL) && !defined(WTF_PLATFORM_ARM_THUMB2) + +/* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */ +/* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ +/* Only one of these will be defined. */ +#if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) # if defined(thumb2) || defined(__thumb2__) \ - || ((defined(__thumb) || defined(__thumb__)) && THUMB_ARCH_VERSION == 4) -# define WTF_PLATFORM_ARM_TRADITIONAL 0 -# define WTF_PLATFORM_ARM_THUMB2 1 -# elif PLATFORM_ARM_ARCH(4) -# define WTF_PLATFORM_ARM_TRADITIONAL 1 -# define WTF_PLATFORM_ARM_THUMB2 0 + || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) +# define WTF_CPU_ARM_TRADITIONAL 0 +# define WTF_CPU_ARM_THUMB2 1 +# elif WTF_ARM_ARCH_AT_LEAST(4) +# define WTF_CPU_ARM_TRADITIONAL 1 +# define WTF_CPU_ARM_THUMB2 0 # else # error "Not supported ARM architecture" # endif -#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(ARM_THUMB2) /* Sanity Check */ -# error "Cannot use both of WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 platforms" -#endif // !defined(ARM_TRADITIONAL) && !defined(ARM_THUMB2) +#elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ +# error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" +#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ + #endif /* ARM */ -/* PLATFORM(X86) */ -#if defined(__i386__) \ - || defined(i386) \ - || defined(_M_IX86) \ - || defined(_X86_) \ - || defined(__THW_INTEL) -#define WTF_PLATFORM_X86 1 + + +/* ==== OS() - underlying operating system; only to be used for mandated low-level services like + virtual memory, not to choose a GUI toolkit ==== */ + +/* OS(ANDROID) - Android */ +#ifdef ANDROID +#define WTF_OS_ANDROID 1 #endif -/* PLATFORM(X86_64) */ -#if defined(__x86_64__) \ - || defined(_M_X64) -#define WTF_PLATFORM_X86_64 1 +/* OS(AIX) - AIX */ +#ifdef _AIX +#define WTF_OS_AIX 1 #endif -/* PLATFORM(IA64) */ -#if defined(__ia64__) -#define WTF_PLATFORM_IA64 1 +/* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ +#ifdef __APPLE__ +#define WTF_OS_DARWIN 1 + +/* FIXME: BUILDING_ON_.., and TARGETING... macros should be folded into the OS() system */ +#include +#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 +#define BUILDING_ON_TIGER 1 +#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 +#define BUILDING_ON_LEOPARD 1 +#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 +#define BUILDING_ON_SNOW_LEOPARD 1 +#endif +#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +#define TARGETING_TIGER 1 +#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 +#define TARGETING_LEOPARD 1 +#elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 +#define TARGETING_SNOW_LEOPARD 1 #endif +#include -/* PLATFORM(ALPHA) */ -#if defined(__alpha__) -#define WTF_PLATFORM_ALPHA 1 #endif -/* PLATFORM(SH4) */ -#if defined(__SH4__) -#define WTF_PLATFORM_SH4 1 +/* OS(IPHONE_OS) - iPhone OS */ +/* OS(MAC_OS_X) - Mac OS X (not including iPhone OS) */ +#if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ + || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \ + || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) +#define WTF_OS_IPHONE_OS 1 +#elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC +#define WTF_OS_MAC_OS_X 1 #endif -/* PLATFORM(SPARC64) */ -#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) -#define WTF_PLATFORM_SPARC64 1 -#define WTF_PLATFORM_BIG_ENDIAN 1 +/* OS(FREEBSD) - FreeBSD */ +#ifdef __FreeBSD__ +#define WTF_OS_FREEBSD 1 #endif -/* PLATFORM(WINCE) && PLATFORM(QT) - We can not determine the endianess at compile time. For - Qt for Windows CE the endianess is specified in the - device specific makespec -*/ -#if PLATFORM(WINCE) && PLATFORM(QT) -# include -# undef WTF_PLATFORM_BIG_ENDIAN -# undef WTF_PLATFORM_MIDDLE_ENDIAN -# if Q_BYTE_ORDER == Q_BIG_EDIAN -# define WTF_PLATFORM_BIG_ENDIAN 1 -# endif +/* OS(HAIKU) - Haiku */ +#ifdef __HAIKU__ +#define WTF_OS_HAIKU 1 +#endif -# include +/* OS(LINUX) - Linux */ +#ifdef __linux__ +#define WTF_OS_LINUX 1 #endif -#if PLATFORM(WINCE) && PLATFORM(QT) -# include +/* OS(NETBSD) - NetBSD */ +#if defined(__NetBSD__) +#define WTF_PLATFORM_NETBSD 1 #endif -/* Compiler */ +/* OS(OPENBSD) - OpenBSD */ +#ifdef __OpenBSD__ +#define WTF_OS_OPENBSD 1 +#endif -/* COMPILER(MSVC) */ -#if defined(_MSC_VER) -#define WTF_COMPILER_MSVC 1 -#if _MSC_VER < 1400 -#define WTF_COMPILER_MSVC7 1 +/* OS(QNX) - QNX */ +#if defined(__QNXNTO__) +#define WTF_OS_QNX 1 #endif + +/* OS(SOLARIS) - Solaris */ +#if defined(sun) || defined(__sun) +#define WTF_OS_SOLARIS 1 #endif -/* COMPILER(RVCT) */ -#if defined(__CC_ARM) || defined(__ARMCC__) -#define WTF_COMPILER_RVCT 1 +/* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */ +#if defined(_WIN32_WCE) +#define WTF_OS_WINCE 1 #endif -/* COMPILER(GCC) */ -/* --gnu option of the RVCT compiler also defines __GNUC__ */ -#if defined(__GNUC__) && !COMPILER(RVCT) -#define WTF_COMPILER_GCC 1 -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +/* OS(WINDOWS) - Any version of Windows */ +#if defined(WIN32) || defined(_WIN32) +#define WTF_OS_WINDOWS 1 #endif -/* COMPILER(MINGW) */ -#if defined(MINGW) || defined(__MINGW32__) -#define WTF_COMPILER_MINGW 1 +/* OS(SYMBIAN) - Symbian */ +#if defined (__SYMBIAN32__) +/* we are cross-compiling, it is not really windows */ +#undef WTF_OS_WINDOWS +#undef WTF_PLATFORM_WIN +#define WTF_OS_SYMBIAN 1 +#endif + +/* OS(UNIX) - Any Unix-like system */ +#if OS(AIX) \ + || OS(ANDROID) \ + || OS(DARWIN) \ + || OS(FREEBSD) \ + || OS(HAIKU) \ + || OS(LINUX) \ + || OS(NETBSD) \ + || OS(OPENBSD) \ + || OS(QNX) \ + || OS(SOLARIS) \ + || OS(SYMBIAN) \ + || defined(unix) \ + || defined(__unix) \ + || defined(__unix__) +#define WTF_OS_UNIX 1 +#endif + +/* Operating environments */ + +/* FIXME: these are all mixes of OS, operating environment and policy choices. */ +/* PLATFORM(CHROMIUM) */ +/* PLATFORM(QT) */ +/* PLATFORM(WX) */ +/* PLATFORM(GTK) */ +/* PLATFORM(HAIKU) */ +/* PLATFORM(MAC) */ +/* PLATFORM(WIN) */ +#if defined(BUILDING_CHROMIUM__) +#define WTF_PLATFORM_CHROMIUM 1 +#elif defined(BUILDING_QT__) +#define WTF_PLATFORM_QT 1 +#elif defined(BUILDING_WX__) +#define WTF_PLATFORM_WX 1 +#elif defined(BUILDING_GTK__) +#define WTF_PLATFORM_GTK 1 +#elif defined(BUILDING_HAIKU__) +#define WTF_PLATFORM_HAIKU 1 +#elif defined(BUILDING_BREWMP__) +#define WTF_PLATFORM_BREWMP 1 +#if defined(AEE_SIMULATOR) +#define WTF_PLATFORM_BREWMP_SIMULATOR 1 +#else +#define WTF_PLATFORM_BREWMP_SIMULATOR 0 +#endif +#undef WTF_OS_WINDOWS +#undef WTF_PLATFORM_WIN +#elif OS(DARWIN) +#define WTF_PLATFORM_MAC 1 +#elif OS(WINDOWS) +#define WTF_PLATFORM_WIN 1 +#endif + +/* PLATFORM(IPHONE) */ +/* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */ +#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) +#define WTF_PLATFORM_IPHONE 1 +#endif + +/* PLATFORM(IPHONE_SIMULATOR) */ +#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR +#define WTF_PLATFORM_IPHONE 1 +#define WTF_PLATFORM_IPHONE_SIMULATOR 1 +#else +#define WTF_PLATFORM_IPHONE_SIMULATOR 0 #endif -/* COMPILER(BORLAND) */ -/* not really fully supported - is this relevant any more? */ -#if defined(__BORLANDC__) -#define WTF_COMPILER_BORLAND 1 +#if !defined(WTF_PLATFORM_IPHONE) +#define WTF_PLATFORM_IPHONE 0 #endif -/* COMPILER(CYGWIN) */ -/* not really fully supported - is this relevant any more? */ -#if defined(__CYGWIN__) -#define WTF_COMPILER_CYGWIN 1 +/* PLATFORM(ANDROID) */ +/* FIXME: this is sometimes used as an OS() switch, and other times to drive + policy choices */ +#if defined(ANDROID) +#define WTF_PLATFORM_ANDROID 1 #endif -/* COMPILER(WINSCW) */ -#if defined(__WINSCW__) -#define WTF_COMPILER_WINSCW 1 +/* Graphics engines */ + +/* PLATFORM(CG) and PLATFORM(CI) */ +#if PLATFORM(MAC) || PLATFORM(IPHONE) +#define WTF_PLATFORM_CG 1 +#endif +#if PLATFORM(MAC) && !PLATFORM(IPHONE) +#define WTF_PLATFORM_CI 1 #endif -#if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS) +/* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */ +#if PLATFORM(CHROMIUM) +#define ENABLE_HISTORY_ALWAYS_ASYNC 1 +#if OS(DARWIN) +#define WTF_PLATFORM_CG 1 +#define WTF_PLATFORM_CI 1 +#define WTF_USE_ATSUI 1 +#define WTF_USE_CORE_TEXT 1 +#else +#define WTF_PLATFORM_SKIA 1 +#endif +#endif + +#if PLATFORM(GTK) +#define WTF_PLATFORM_CAIRO 1 +#endif + + +/* OS(WINCE) && PLATFORM(QT) + We can not determine the endianess at compile time. For + Qt for Windows CE the endianess is specified in the + device specific makespec +*/ +#if OS(WINCE) && PLATFORM(QT) +# include +# undef WTF_CPU_BIG_ENDIAN +# undef WTF_CPU_MIDDLE_ENDIAN +# if Q_BYTE_ORDER == Q_BIG_ENDIAN +# define WTF_CPU_BIG_ENDIAN 1 +# endif + +# include +#endif + +#if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || (PLATFORM(QT) && OS(DARWIN) && !ENABLE(SINGLE_THREADED))) && !defined(ENABLE_JSC_MULTIPLE_THREADS) #define ENABLE_JSC_MULTIPLE_THREADS 1 #endif /* On Windows, use QueryPerformanceCounter by default */ -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1 #endif -#if PLATFORM(WINCE) && !PLATFORM(QT) +#if OS(WINCE) && !PLATFORM(QT) #undef ENABLE_JSC_MULTIPLE_THREADS #define ENABLE_JSC_MULTIPLE_THREADS 0 #define USE_SYSTEM_MALLOC 0 @@ -462,26 +519,25 @@ #define ENABLE_WML 1 #define HAVE_ACCESSIBILITY 0 -#define NOMINMAX // Windows min and max conflict with standard macros -#define NOSHLWAPI // shlwapi.h not available on WinCe +#define NOMINMAX /* Windows min and max conflict with standard macros */ +#define NOSHLWAPI /* shlwapi.h not available on WinCe */ -// MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. -#define __usp10__ // disable "usp10.h" +/* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */ +#define __usp10__ /* disable "usp10.h" */ -#define _INC_ASSERT // disable "assert.h" +#define _INC_ASSERT /* disable "assert.h" */ #define assert(x) -// _countof is only included in CE6; for CE5 we need to define it ourself +/* _countof is only included in CE6; for CE5 we need to define it ourself */ #ifndef _countof #define _countof(x) (sizeof(x) / sizeof((x)[0])) #endif -#endif /* PLATFORM(WINCE) && !PLATFORM(QT) */ +#endif /* OS(WINCE) && !PLATFORM(QT) */ -/* for Unicode, KDE uses Qt */ -#if PLATFORM(KDE) || PLATFORM(QT) +#if PLATFORM(QT) #define WTF_USE_QT4_UNICODE 1 -#elif PLATFORM(WINCE) +#elif OS(WINCE) #define WTF_USE_WINCE_UNICODE 1 #elif PLATFORM(GTK) /* The GTK+ Unicode backend is configurable */ @@ -493,7 +549,7 @@ #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 #define HAVE_PTHREAD_RWLOCK 1 -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && defined(__x86_64__) +#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && CPU(X86_64) #define WTF_USE_PLUGIN_HOST_PROCESS 1 #endif #if !defined(ENABLE_MAC_JAVA_BRIDGE) @@ -506,12 +562,16 @@ #define HAVE_RUNLOOP_TIMER 1 #endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */ -#if PLATFORM(CHROMIUM) && PLATFORM(DARWIN) +#if PLATFORM(CHROMIUM) && OS(DARWIN) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 #define HAVE_PTHREAD_RWLOCK 1 #endif +#if PLATFORM(QT) && OS(DARWIN) +#define WTF_PLATFORM_CF 1 +#endif + #if PLATFORM(IPHONE) #define ENABLE_CONTEXT_MENUS 0 #define ENABLE_DRAG_SUPPORT 0 @@ -529,12 +589,27 @@ #define HAVE_PTHREAD_RWLOCK 1 #endif +#if PLATFORM(ANDROID) +#define WTF_USE_PTHREADS 1 +#define WTF_PLATFORM_SGL 1 +#define USE_SYSTEM_MALLOC 1 +#define ENABLE_MAC_JAVA_BRIDGE 1 +#define LOG_DISABLED 1 +/* Prevents Webkit from drawing the caret in textfields and textareas + This prevents unnecessary invals. */ +#define ENABLE_TEXT_CARET 1 +#define ENABLE_JAVASCRIPT_DEBUGGER 0 +#endif + #if PLATFORM(WIN) #define WTF_USE_WININET 1 #endif #if PLATFORM(WX) #define ENABLE_ASSEMBLER 1 +#if OS(DARWIN) +#define WTF_PLATFORM_CF 1 +#endif #endif #if PLATFORM(GTK) @@ -553,24 +628,29 @@ #define ENABLE_NETSCAPE_PLUGIN_API 0 #endif +#if PLATFORM(BREWMP) +#define USE_SYSTEM_MALLOC 1 +#endif + #if !defined(HAVE_ACCESSIBILITY) #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) #define HAVE_ACCESSIBILITY 1 #endif #endif /* !defined(HAVE_ACCESSIBILITY) */ -#if PLATFORM(UNIX) && !PLATFORM(SYMBIAN) +#if OS(UNIX) && !OS(SYMBIAN) #define HAVE_SIGNAL_H 1 #endif -#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !PLATFORM(HAIKU) && !COMPILER(RVCT) +#if !OS(WINDOWS) && !OS(SOLARIS) && !OS(QNX) \ + && !OS(SYMBIAN) && !OS(HAIKU) && !OS(RVCT) \ + && !OS(ANDROID) && !PLATFORM(BREWMP) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 -#endif +#endif -#if PLATFORM(DARWIN) +#if OS(DARWIN) #define HAVE_ERRNO_H 1 #define HAVE_LANGINFO_H 1 @@ -582,27 +662,32 @@ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMEB_H 1 -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) && !PLATFORM(QT) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) + +#define HAVE_DISPATCH_H 1 + +#if !PLATFORM(IPHONE) && !PLATFORM(QT) #define HAVE_MADV_FREE_REUSE 1 #define HAVE_MADV_FREE 1 #define HAVE_PTHREAD_SETNAME_NP 1 #endif +#endif + #if PLATFORM(IPHONE) #define HAVE_MADV_FREE 1 #endif -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) -#define HAVE_FLOAT_H 1 -#if PLATFORM(WINCE) +#if OS(WINCE) #define HAVE_ERRNO_H 0 #else #define HAVE_SYS_TIMEB_H 1 #endif #define HAVE_VIRTUALALLOC 1 -#elif PLATFORM(SYMBIAN) +#elif OS(SYMBIAN) #define HAVE_ERRNO_H 1 #define HAVE_MMAP 0 @@ -615,9 +700,23 @@ #define HAVE_SYS_PARAM_H 1 #endif -#elif PLATFORM(QNX) +#elif PLATFORM(BREWMP) + +#define HAVE_ERRNO_H 1 + +#elif OS(QNX) + +#define HAVE_ERRNO_H 1 +#define HAVE_MMAP 1 +#define HAVE_SBRK 1 +#define HAVE_STRINGS_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_TIME_H 1 + +#elif OS(ANDROID) #define HAVE_ERRNO_H 1 +#define HAVE_LANGINFO_H 0 #define HAVE_MMAP 1 #define HAVE_SBRK 1 #define HAVE_STRINGS_H 1 @@ -630,7 +729,7 @@ #define HAVE_ERRNO_H 1 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */ -#if !PLATFORM(HAIKU) +#if !OS(HAIKU) #define HAVE_LANGINFO_H 1 #endif #define HAVE_MMAP 1 @@ -729,11 +828,11 @@ #endif #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) -#if (PLATFORM(X86_64) && (PLATFORM(UNIX) || PLATFORM(WIN_OS))) || PLATFORM(IA64) || PLATFORM(ALPHA) +#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) || CPU(IA64) || CPU(ALPHA) #define WTF_USE_JSVALUE64 1 -#elif PLATFORM(ARM) || PLATFORM(PPC64) +#elif CPU(ARM) || CPU(PPC64) #define WTF_USE_JSVALUE32 1 -#elif PLATFORM(WIN_OS) && COMPILER(MINGW) +#elif OS(WINDOWS) && COMPILER(MINGW) /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define WTF_USE_JSVALUE32 1 @@ -749,40 +848,52 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if !defined(ENABLE_JIT) /* The JIT is tested & working on x86_64 Mac */ -#if PLATFORM(X86_64) && PLATFORM(MAC) +#if CPU(X86_64) && PLATFORM(MAC) #define ENABLE_JIT 1 /* The JIT is tested & working on x86 Mac */ -#elif PLATFORM(X86) && PLATFORM(MAC) +#elif CPU(X86) && PLATFORM(MAC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE) +#elif CPU(ARM_THUMB2) && PLATFORM(IPHONE) + #define ENABLE_JIT 1 +#elif PLATFORM(ARM_TRADITIONAL) && COMPILER(RVCT) #define ENABLE_JIT 1 - #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 /* The JIT is tested & working on x86 Windows */ -#elif PLATFORM(X86) && PLATFORM(WIN) +#elif CPU(X86) && PLATFORM(WIN) #define ENABLE_JIT 1 #endif -#if PLATFORM(QT) -#if PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100 +#if PLATFORM(QT) || PLATFORM(WX) +#if CPU(X86_64) && OS(DARWIN) + #define ENABLE_JIT 1 +#elif CPU(X86) && OS(DARWIN) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC) +#elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100 + #define ENABLE_JIT 1 + #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 +#elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 -#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100 +#elif CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX) +#elif CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100 + #define ENABLE_JIT 1 +#elif CPU(ARM_TRADITIONAL) && OS(LINUX) #define ENABLE_JIT 1 - #if PLATFORM(ARM_THUMB2) - #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 0 - #endif #endif #endif /* PLATFORM(QT) */ #endif /* !defined(ENABLE_JIT) */ +/* CPU architecture specific optimizations */ +#if CPU(ARM_TRADITIONAL) +#if ENABLE(JIT) && !defined(ENABLE_JIT_OPTIMIZE_MOD) && WTF_ARM_ARCH_AT_LEAST(5) +#define ENABLE_JIT_OPTIMIZE_MOD 1 +#endif +#endif + #if ENABLE(JIT) #ifndef ENABLE_JIT_OPTIMIZE_CALL #define ENABLE_JIT_OPTIMIZE_CALL 1 @@ -796,11 +907,14 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1 #endif +#ifndef ENABLE_JIT_OPTIMIZE_MOD +#define ENABLE_JIT_OPTIMIZE_MOD 0 +#endif #endif -#if PLATFORM(X86) && COMPILER(MSVC) +#if CPU(X86) && COMPILER(MSVC) #define JSC_HOST_CALL __fastcall -#elif PLATFORM(X86) && COMPILER(GCC) +#elif CPU(X86) && COMPILER(GCC) #define JSC_HOST_CALL __attribute__ ((fastcall)) #else #define JSC_HOST_CALL @@ -820,19 +934,22 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #if !defined(ENABLE_YARR_JIT) /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */ -#if (PLATFORM(X86) && PLATFORM(MAC)) \ - || (PLATFORM(X86_64) && PLATFORM(MAC)) \ - || (PLATFORM(ARM_THUMB2) && PLATFORM(IPHONE)) \ - || (PLATFORM(X86) && PLATFORM(WIN)) +#if (CPU(X86) && PLATFORM(MAC)) \ + || (CPU(X86_64) && PLATFORM(MAC)) \ + || (CPU(ARM_THUMB2) && PLATFORM(IPHONE)) \ + || (CPU(X86) && PLATFORM(WIN)) \ + || (CPU(X86) && PLATFORM(WX)) \ + || (CPU(ARM_TRADITIONAL) && COMPILER(RVCT)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif #if PLATFORM(QT) -#if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ - || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \ - || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \ - || (PLATFORM(ARM_TRADITIONAL) && PLATFORM(LINUX)) +#if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ + || (CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)) \ + || (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \ + || (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \ + || (CPU(ARM_TRADITIONAL) && OS(LINUX)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif @@ -856,7 +973,7 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0 #endif -#if !defined(ENABLE_PAN_SCROLLING) && PLATFORM(WIN_OS) +#if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS) #define ENABLE_PAN_SCROLLING 1 #endif @@ -882,17 +999,30 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ #define WTF_USE_ACCELERATED_COMPOSITING 1 #endif +/* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with + with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and + off in one place. */ +#if PLATFORM(WIN) +#include "QuartzCorePresent.h" +#if QUARTZCORE_PRESENT +#define WTF_USE_ACCELERATED_COMPOSITING 1 +#define ENABLE_3D_RENDERING 1 +#endif +#endif + #if COMPILER(GCC) #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result)) #else #define WARN_UNUSED_RETURN #endif -#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((PLATFORM(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK))) +#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK))) #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1 #endif /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */ #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK +#define ENABLE_JSC_ZOMBIES 0 + #endif /* WTF_Platform_h */ diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h deleted file mode 100644 index 5d0bd2a..0000000 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef PtrAndFlags_h -#define PtrAndFlags_h - -#include - -namespace WTF { - template class PtrAndFlagsBase { - public: - bool isFlagSet(FlagEnum flagNumber) const { ASSERT(flagNumber < 2); return m_ptrAndFlags & (1 << flagNumber); } - void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);} - void clearFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags &= ~(1 << flagNumber);} - T* get() const { return reinterpret_cast(m_ptrAndFlags & ~3); } - void set(T* ptr) - { - ASSERT(!(reinterpret_cast(ptr) & 3)); - m_ptrAndFlags = reinterpret_cast(ptr) | (m_ptrAndFlags & 3); -#ifndef NDEBUG - m_leaksPtr = ptr; -#endif - } - - bool operator!() const { return !get(); } - T* operator->() const { return reinterpret_cast(m_ptrAndFlags & ~3); } - - protected: - intptr_t m_ptrAndFlags; -#ifndef NDEBUG - void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced. -#endif - }; - - template class PtrAndFlags : public PtrAndFlagsBase { - public: - PtrAndFlags() - { - PtrAndFlagsBase::m_ptrAndFlags = 0; - } - PtrAndFlags(T* ptr) - { - PtrAndFlagsBase::m_ptrAndFlags = 0; - set(ptr); - } - }; -} // namespace WTF - -using WTF::PtrAndFlagsBase; -using WTF::PtrAndFlags; - -#endif // PtrAndFlags_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp index 52fb130..fc48263 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp @@ -34,12 +34,18 @@ #include #include -#if PLATFORM(WINCE) +#if OS(WINCE) extern "C" { #include "wince/mt19937ar.c" } #endif +#if PLATFORM(BREWMP) +#include +#include +#include +#endif + namespace WTF { double weakRandomNumber() @@ -47,6 +53,10 @@ double weakRandomNumber() #if COMPILER(MSVC) && defined(_CRT_RAND_S) // rand_s is incredibly slow on windows so we fall back on rand for Math.random return (rand() + (rand() / (RAND_MAX + 1.0))) / (RAND_MAX + 1.0); +#elif PLATFORM(BREWMP) + uint32_t bits; + GETRAND(reinterpret_cast(&bits), sizeof(uint32_t)); + return static_cast(bits) / (static_cast(std::numeric_limits::max()) + 1.0); #else return randomNumber(); #endif @@ -66,10 +76,10 @@ double randomNumber() uint32_t bits; rand_s(&bits); return static_cast(bits) / (static_cast(std::numeric_limits::max()) + 1.0); -#elif PLATFORM(DARWIN) +#elif OS(DARWIN) uint32_t bits = arc4random(); return static_cast(bits) / (static_cast(std::numeric_limits::max()) + 1.0); -#elif PLATFORM(UNIX) +#elif OS(UNIX) uint32_t part1 = random() & (RAND_MAX - 1); uint32_t part2 = random() & (RAND_MAX - 1); // random only provides 31 bits @@ -80,9 +90,9 @@ double randomNumber() // Mask off the low 53bits fullRandom &= (1LL << 53) - 1; return static_cast(fullRandom)/static_cast(1LL << 53); -#elif PLATFORM(WINCE) +#elif OS(WINCE) return genrand_res53(); -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) uint32_t part1 = rand() & (RAND_MAX - 1); uint32_t part2 = rand() & (RAND_MAX - 1); uint32_t part3 = rand() & (RAND_MAX - 1); @@ -99,6 +109,16 @@ double randomNumber() // Mask off the low 53bits fullRandom &= (1LL << 53) - 1; return static_cast(fullRandom)/static_cast(1LL << 53); +#elif PLATFORM(BREWMP) + uint32_t bits; + ISource* randomSource; + + IShell* shell = reinterpret_cast(GETAPPINSTANCE())->m_pIShell; + ISHELL_CreateInstance(shell, AEECLSID_RANDOM, reinterpret_cast(&randomSource)); + ISOURCE_Read(randomSource, reinterpret_cast(&bits), 4); + ISOURCE_Release(randomSource); + + return static_cast(bits) / (static_cast(std::numeric_limits::max()) + 1.0); #else uint32_t part1 = rand() & (RAND_MAX - 1); uint32_t part2 = rand() & (RAND_MAX - 1); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h index a66433e..ae414c0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h @@ -33,12 +33,12 @@ #include #endif -#if PLATFORM(UNIX) +#if OS(UNIX) #include #include #endif -#if PLATFORM(WINCE) +#if OS(WINCE) extern "C" { void init_by_array(unsigned long init_key[],int key_length); } @@ -49,9 +49,9 @@ namespace WTF { inline void initializeRandomNumberGenerator() { -#if PLATFORM(DARWIN) +#if OS(DARWIN) // On Darwin we use arc4random which initialises itself. -#elif PLATFORM(WINCE) +#elif OS(WINCE) // initialize rand() srand(static_cast(time(0))); @@ -64,7 +64,7 @@ inline void initializeRandomNumberGenerator() init_by_array(initializationBuffer, 4); #elif COMPILER(MSVC) && defined(_CRT_RAND_S) // On Windows we use rand_s which initialises itself -#elif PLATFORM(UNIX) +#elif OS(UNIX) // srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved timeval time; gettimeofday(&time, 0); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h index 8388715..14c08ae 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h @@ -24,6 +24,7 @@ #include #include "AlwaysInline.h" #include "FastAllocBase.h" +#include "PassRefPtr.h" namespace WTF { @@ -50,13 +51,13 @@ namespace WTF { RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } - ~RefPtr() { T* ptr = m_ptr; derefIfNotNull(ptr); } + ~RefPtr() { derefIfNotNull(m_ptr); } - template RefPtr(const RefPtr& o) : m_ptr(static_cast(o.get())) { if (T* ptr = static_cast(m_ptr)) ptr->ref(); } + template RefPtr(const RefPtr& o) : m_ptr(static_cast(o.get())) { T* ptr = m_ptr; refIfNotNull(ptr); } T* get() const { return m_ptr; } - void clear() { T* ptr = m_ptr; derefIfNotNull(ptr); m_ptr = 0; } + void clear() { derefIfNotNull(m_ptr); m_ptr = 0; } PassRefPtr release() { PassRefPtr tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; } T& operator*() const { return *m_ptr; } @@ -65,12 +66,8 @@ namespace WTF { bool operator!() const { return !m_ptr; } // This conversion operator allows implicit conversion to bool but not to other integer types. -#if COMPILER(WINSCW) - operator bool() const { return m_ptr; } -#else - typedef T* RefPtr::*UnspecifiedBoolType; + typedef T* (RefPtr::*UnspecifiedBoolType); operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; } -#endif RefPtr& operator=(const RefPtr&); RefPtr& operator=(T*); @@ -139,8 +136,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = o.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } @@ -156,8 +152,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = o.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h index 9433025..7f6ebfe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h @@ -285,7 +285,7 @@ namespace WTF { { if (it.m_impl == m_impl.end()) return; - m_impl.checkTableConsistency(); + m_impl.internalCheckTableConsistency(); m_impl.removeWithoutEntryConsistencyCheck(it.m_impl); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h index c9b5742..9dfb969 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h @@ -48,6 +48,10 @@ // NULL can cause compiler problems, especially in cases of multiple inheritance. #define OBJECT_OFFSETOF(class, field) (reinterpret_cast(&(reinterpret_cast(0x4000)->field)) - 0x4000) +// STRINGIZE: Can convert any value to quoted string, even expandable macros +#define STRINGIZE(exp) #exp +#define STRINGIZE_VALUE_OF(exp) STRINGIZE(exp) + namespace WTF { /* @@ -65,6 +69,14 @@ namespace WTF { return u.to; } + // Returns a count of the number of bits set in 'bits'. + inline size_t bitCount(unsigned bits) + { + bits = bits - ((bits >> 1) & 0x55555555); + bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333); + return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; + } + } // namespace WTF #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp new file mode 100644 index 0000000..1b96417 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Company 100, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if COMPILER(RVCT) && __ARMCC_VERSION < 400000 + +#include "StringExtras.h" + +#include "ASCIICType.h" + +int strcasecmp(const char* s1, const char* s2) +{ + while (toASCIIUpper(*s1) == toASCIIUpper(*s2)) { + if (*s1 == '\0') + return 0; + s1++; + s2++; + } + + return toASCIIUpper(*s1) - toASCIIUpper(*s2); +} + +int strncasecmp(const char* s1, const char* s2, size_t len) +{ + while (len > 0 && toASCIIUpper(*s1) == toASCIIUpper(*s2)) { + if (*s1 == '\0') + return 0; + s1++; + s2++; + len--; + } + + if (!len) + return 0; + + return toASCIIUpper(*s1) - toASCIIUpper(*s2); +} + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h index 1120d65..b1ec09f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h @@ -34,6 +34,7 @@ #endif #if COMPILER(MSVC) +// FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks inline int snprintf(char* buffer, size_t count, const char* format, ...) { @@ -45,7 +46,7 @@ inline int snprintf(char* buffer, size_t count, const char* format, ...) return result; } -#if COMPILER(MSVC7) || PLATFORM(WINCE) +#if COMPILER(MSVC7) || OS(WINCE) inline int vsnprintf(char* buffer, size_t count, const char* format, va_list args) { @@ -54,7 +55,7 @@ inline int vsnprintf(char* buffer, size_t count, const char* format, va_list arg #endif -#if PLATFORM(WINCE) +#if OS(WINCE) inline int strnicmp(const char* string1, const char* string2, size_t count) { @@ -85,7 +86,8 @@ inline int strcasecmp(const char* s1, const char* s2) #endif -#if PLATFORM(WIN_OS) || PLATFORM(LINUX) +#if OS(WINDOWS) || OS(LINUX) || OS(SOLARIS) +// FIXME: should check HAVE_STRNSTR inline char* strnstr(const char* buffer, const char* target, size_t bufferLength) { @@ -101,4 +103,11 @@ inline char* strnstr(const char* buffer, const char* target, size_t bufferLength #endif +#if COMPILER(RVCT) && __ARMCC_VERSION < 400000 + +int strcasecmp(const char* s1, const char* s2); +int strncasecmp(const char* s1, const char* s2, size_t len); + +#endif + #endif // WTF_StringExtras_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h new file mode 100644 index 0000000..07f117f --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StringHashFunctions.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2005, 2006, 2008, 2010 Apple Inc. All rights reserved. + * + * 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 WTF_StringHashFunctions_h +#define WTF_StringHashFunctions_h + +#include + +namespace WTF { + +// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's +static const unsigned stringHashingStartValue = 0x9e3779b9U; + +// stringHash methods based on Paul Hsieh's SuperFastHash. +// http://www.azillionmonkeys.com/qed/hash.html +// char* data is interpreted as latin-encoded (zero extended to 16 bits). + +inline unsigned stringHash(const UChar* data, unsigned length) +{ + unsigned hash = WTF::stringHashingStartValue; + unsigned rem = length & 1; + length >>= 1; + + // Main loop + for (; length > 0; length--) { + hash += data[0]; + unsigned tmp = (data[1] << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2; + hash += hash >> 11; + } + + // Handle end case + if (rem) { + hash += data[0]; + hash ^= hash << 11; + hash += hash >> 17; + } + + // Force "avalanching" of final 127 bits + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 2; + hash += hash >> 15; + hash ^= hash << 10; + + hash &= 0x7fffffff; + + // this avoids ever returning a hash code of 0, since that is used to + // signal "hash not computed yet", using a value that is likely to be + // effectively the same as 0 when the low bits are masked + if (hash == 0) + hash = 0x40000000; + + return hash; +} + +inline unsigned stringHash(const char* data, unsigned length) +{ + unsigned hash = WTF::stringHashingStartValue; + unsigned rem = length & 1; + length >>= 1; + + // Main loop + for (; length > 0; length--) { + hash += static_cast(data[0]); + unsigned tmp = (static_cast(data[1]) << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2; + hash += hash >> 11; + } + + // Handle end case + if (rem) { + hash += static_cast(data[0]); + hash ^= hash << 11; + hash += hash >> 17; + } + + // Force "avalanching" of final 127 bits + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 2; + hash += hash >> 15; + hash ^= hash << 10; + + hash &= 0x7fffffff; + + // this avoids ever returning a hash code of 0, since that is used to + // signal "hash not computed yet", using a value that is likely to be + // effectively the same as 0 when the low bits are masked + if (hash == 0) + hash = 0x40000000; + + return hash; +} + +inline unsigned stringHash(const char* data) +{ + unsigned hash = WTF::stringHashingStartValue; + + // Main loop + for (;;) { + unsigned char b0 = data[0]; + if (!b0) + break; + unsigned char b1 = data[1]; + if (!b1) { + hash += b0; + hash ^= hash << 11; + hash += hash >> 17; + break; + } + hash += b0; + unsigned tmp = (b1 << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2; + hash += hash >> 11; + } + + // Force "avalanching" of final 127 bits. + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 2; + hash += hash >> 15; + hash ^= hash << 10; + + hash &= 0x7fffffff; + + // This avoids ever returning a hash code of 0, since that is used to + // signal "hash not computed yet", using a value that is likely to be + // effectively the same as 0 when the low bits are masked. + if (hash == 0) + hash = 0x40000000; + + return hash; +} + +} // namespace WTF + +#endif // WTF_StringHashFunctions_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h index b8fce7e..70b3adc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSpinLock.h @@ -33,7 +33,7 @@ #ifndef TCMALLOC_INTERNAL_SPINLOCK_H__ #define TCMALLOC_INTERNAL_SPINLOCK_H__ -#if (PLATFORM(X86) || PLATFORM(PPC)) && (COMPILER(GCC) || COMPILER(MSVC)) +#if (CPU(X86) || CPU(X86_64) || CPU(PPC)) && (COMPILER(GCC) || COMPILER(MSVC)) #include /* For nanosleep() */ @@ -49,7 +49,7 @@ #include #endif -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif @@ -64,7 +64,7 @@ struct TCMalloc_SpinLock { inline void Lock() { int r; #if COMPILER(GCC) -#if PLATFORM(X86) +#if CPU(X86) || CPU(X86_64) __asm__ __volatile__ ("xchgl %0, %1" : "=r"(r), "=m"(lockword_) @@ -94,7 +94,7 @@ struct TCMalloc_SpinLock { inline void Unlock() { #if COMPILER(GCC) -#if PLATFORM(X86) +#if CPU(X86) || CPU(X86_64) __asm__ __volatile__ ("movl $0, %0" : "=m"(lockword_) @@ -105,7 +105,7 @@ struct TCMalloc_SpinLock { ("isync\n\t" "eieio\n\t" "stw %1, %0" -#if PLATFORM(DARWIN) || PLATFORM(PPC) +#if OS(DARWIN) || CPU(PPC) : "=o" (lockword_) #else : "=m" (lockword_) @@ -144,7 +144,7 @@ static void TCMalloc_SlowLock(volatile unsigned int* lockword) { while (true) { int r; #if COMPILER(GCC) -#if PLATFORM(X86) +#if CPU(X86) || CPU(X86_64) __asm__ __volatile__ ("xchgl %0, %1" : "=r"(r), "=m"(*lockword) @@ -184,7 +184,7 @@ static void TCMalloc_SlowLock(volatile unsigned int* lockword) { // from taking 30 seconds to 16 seconds. // Sleep for a few milliseconds -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) Sleep(2); #else struct timespec tm; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp index 659bb0e..4d02919 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp @@ -47,7 +47,7 @@ #include #endif -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #include "windows.h" #else #include diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp new file mode 100644 index 0000000..042d49e --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if USE(PTHREADS) + +#include "ThreadIdentifierDataPthreads.h" + +#include "Threading.h" + +namespace WTF { + +pthread_key_t ThreadIdentifierData::m_key; + +void clearPthreadHandleForIdentifier(ThreadIdentifier); + +ThreadIdentifierData::~ThreadIdentifierData() +{ + clearPthreadHandleForIdentifier(m_identifier); +} + +ThreadIdentifier ThreadIdentifierData::identifier() +{ + initializeKeyOnce(); + ThreadIdentifierData* threadIdentifierData = static_cast(pthread_getspecific(m_key)); + + return threadIdentifierData ? threadIdentifierData->m_identifier : 0; +} + +void ThreadIdentifierData::initialize(ThreadIdentifier id) +{ + ASSERT(!identifier()); + + initializeKeyOnce(); + pthread_setspecific(m_key, new ThreadIdentifierData(id)); +} + +void ThreadIdentifierData::destruct(void* data) +{ + ThreadIdentifierData* threadIdentifierData = static_cast(data); + ASSERT(threadIdentifierData); + + if (threadIdentifierData->m_isDestroyedOnce) { + delete threadIdentifierData; + return; + } + + threadIdentifierData->m_isDestroyedOnce = true; + // Re-setting the value for key causes another destruct() call after all other thread-specific destructors were called. + pthread_setspecific(m_key, threadIdentifierData); +} + +void ThreadIdentifierData::initializeKeyOnceHelper() +{ + if (pthread_key_create(&m_key, destruct)) + CRASH(); +} + +void ThreadIdentifierData::initializeKeyOnce() +{ + static pthread_once_t onceControl = PTHREAD_ONCE_INIT; + if (pthread_once(&onceControl, initializeKeyOnceHelper)) + CRASH(); +} + +} // namespace WTF + +#endif // USE(PTHREADS) + diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h new file mode 100644 index 0000000..3af87a8 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ThreadIdentifierDataPthreads_h +#define ThreadIdentifierDataPthreads_h + +#include +#include + +namespace WTF { + +// Holds ThreadIdentifier in the thread-specific storage and employs pthreads-specific 2-pass destruction to reliably remove +// ThreadIdentifier from threadMap. It assumes regular ThreadSpecific types don't use multiple-pass destruction. +class ThreadIdentifierData : public Noncopyable { +public: + ~ThreadIdentifierData(); + + // Creates and puts an instance of ThreadIdentifierData into thread-specific storage. + static void initialize(ThreadIdentifier identifier); + + // Returns 0 if thread-specific storage was not initialized. + static ThreadIdentifier identifier(); + +private: + ThreadIdentifierData(ThreadIdentifier identifier) + : m_identifier(identifier) + , m_isDestroyedOnce(false) + { + } + + // This thread-specific destructor is called 2 times when thread terminates: + // - first, when all the other thread-specific destructors are called, it simply remembers it was 'destroyed once' + // and re-sets itself into the thread-specific slot to make Pthreads to call it again later. + // - second, after all thread-specific destructors were invoked, it gets called again - this time, we remove the + // ThreadIdentifier from the threadMap, completing the cleanup. + static void destruct(void* data); + + static void initializeKeyOnceHelper(); + static void initializeKeyOnce(); + + ThreadIdentifier m_identifier; + bool m_isDestroyedOnce; + static pthread_key_t m_key; +}; + +} // namespace WTF + +#endif // ThreadIdentifierDataPthreads_h + + diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h index b6f5fd3..7e5679f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h @@ -47,13 +47,13 @@ #include #elif PLATFORM(QT) #include -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) #include #endif namespace WTF { -#if !USE(PTHREADS) && !PLATFORM(QT) && PLATFORM(WIN_OS) +#if !USE(PTHREADS) && !PLATFORM(QT) && OS(WINDOWS) // ThreadSpecificThreadExit should be called each time when a thread is detached. // This is done automatically for threads created with WTF::createThread. void ThreadSpecificThreadExit(); @@ -68,7 +68,7 @@ public: ~ThreadSpecific(); private: -#if !USE(PTHREADS) && !PLATFORM(QT) && PLATFORM(WIN_OS) +#if !USE(PTHREADS) && !PLATFORM(QT) && OS(WINDOWS) friend void ThreadSpecificThreadExit(); #endif @@ -76,7 +76,7 @@ private: void set(T*); void static destroy(void* ptr); -#if USE(PTHREADS) || PLATFORM(QT) || PLATFORM(WIN_OS) +#if USE(PTHREADS) || PLATFORM(QT) || OS(WINDOWS) struct Data : Noncopyable { Data(T* value, ThreadSpecific* owner) : value(value), owner(owner) {} #if PLATFORM(QT) @@ -91,15 +91,44 @@ private: }; #endif +#if ENABLE(SINGLE_THREADED) + T* m_value; +#else #if USE(PTHREADS) pthread_key_t m_key; #elif PLATFORM(QT) QThreadStorage m_key; -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) int m_index; #endif +#endif }; +#if ENABLE(SINGLE_THREADED) +template +inline ThreadSpecific::ThreadSpecific() + : m_value(0) +{ +} + +template +inline ThreadSpecific::~ThreadSpecific() +{ +} + +template +inline T* ThreadSpecific::get() +{ + return m_value; +} + +template +inline void ThreadSpecific::set(T* ptr) +{ + ASSERT(!get()); + m_value = ptr; +} +#else #if USE(PTHREADS) template inline ThreadSpecific::ThreadSpecific() @@ -157,7 +186,12 @@ inline void ThreadSpecific::set(T* ptr) m_key.setLocalData(data); } -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) + +// TLS_OUT_OF_INDEXES is not defined on WinCE. +#ifndef TLS_OUT_OF_INDEXES +#define TLS_OUT_OF_INDEXES 0xffffffff +#endif // The maximum number of TLS keys that can be created. For simplification, we assume that: // 1) Once the instance of ThreadSpecific<> is created, it will not be destructed until the program dies. @@ -171,14 +205,14 @@ template inline ThreadSpecific::ThreadSpecific() : m_index(-1) { - DWORD tls_key = TlsAlloc(); - if (tls_key == TLS_OUT_OF_INDEXES) + DWORD tlsKey = TlsAlloc(); + if (tlsKey == TLS_OUT_OF_INDEXES) CRASH(); m_index = InterlockedIncrement(&tlsKeyCount()) - 1; if (m_index >= kMaxTlsKeySize) CRASH(); - tlsKeys()[m_index] = tls_key; + tlsKeys()[m_index] = tlsKey; } template @@ -207,10 +241,12 @@ inline void ThreadSpecific::set(T* ptr) #else #error ThreadSpecific is not implemented for this platform. #endif +#endif template inline void ThreadSpecific::destroy(void* ptr) { +#if !ENABLE(SINGLE_THREADED) Data* data = static_cast(ptr); #if USE(PTHREADS) @@ -230,7 +266,7 @@ inline void ThreadSpecific::destroy(void* ptr) pthread_setspecific(data->owner->m_key, 0); #elif PLATFORM(QT) // Do nothing here -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) TlsSetValue(tlsKeys()[data->owner->m_index], 0); #else #error ThreadSpecific is not implemented for this platform. @@ -239,6 +275,7 @@ inline void ThreadSpecific::destroy(void* ptr) #if !PLATFORM(QT) delete data; #endif +#endif } template diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp index 1d4185c..49de59e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp @@ -49,13 +49,14 @@ static void* threadEntryPoint(void* contextData) { NewThreadContext* context = reinterpret_cast(contextData); - setThreadNameInternal(context->name); - - // Block until our creating thread has completed any extra setup work. + // Block until our creating thread has completed any extra setup work, including + // establishing ThreadIdentifier. { MutexLocker locker(context->creationMutex); } + initializeCurrentThreadInternal(context->name); + // Grab the info that we need out of the context, then deallocate it. ThreadFunction entryPoint = context->entryPoint; void* data = context->data; @@ -75,7 +76,7 @@ ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* NewThreadContext* context = new NewThreadContext(entryPoint, data, name); - // Prevent the thread body from executing until we've established the thread identifier + // Prevent the thread body from executing until we've established the thread identifier. MutexLocker locker(context->creationMutex); return createThreadInternal(threadEntryPoint, context, name); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 71c9402..1599562 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -61,7 +61,7 @@ #include "Platform.h" -#if PLATFORM(WINCE) +#if OS(WINCE) #include #endif @@ -69,10 +69,12 @@ #include #include -#if PLATFORM(WIN_OS) && !PLATFORM(WINCE) +#if OS(WINDOWS) && !OS(WINCE) #include -#elif PLATFORM(DARWIN) +#elif OS(DARWIN) #include +#elif OS(ANDROID) +#include #elif COMPILER(GCC) #if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) #include @@ -84,7 +86,7 @@ #if USE(PTHREADS) #include #elif PLATFORM(GTK) -#include +#include typedef struct _GMutex GMutex; typedef struct _GCond GCond; #endif @@ -119,7 +121,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char* threadN // Called in the thread during initialization. // Helpful for platforms where the thread name must be set from within the thread. -void setThreadNameInternal(const char* threadName); +void initializeCurrentThreadInternal(const char* threadName); ThreadIdentifier currentThread(); bool isMainThread(); @@ -142,7 +144,7 @@ typedef GOwnPtr PlatformCondition; typedef QT_PREPEND_NAMESPACE(QMutex)* PlatformMutex; typedef void* PlatformReadWriteLock; // FIXME: Implement. typedef QT_PREPEND_NAMESPACE(QWaitCondition)* PlatformCondition; -#elif PLATFORM(WIN_OS) +#elif OS(WINDOWS) struct PlatformMutex { CRITICAL_SECTION m_internalMutex; size_t m_recursionCount; @@ -215,10 +217,10 @@ private: PlatformCondition m_condition; }; -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 -#if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WINCE) +#if COMPILER(MINGW) || COMPILER(MSVC7) || OS(WINCE) inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast(addend)); } inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast(addend)); } #else @@ -226,13 +228,18 @@ inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(r inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast(addend)); } #endif -#elif PLATFORM(DARWIN) +#elif OS(DARWIN) #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast(addend)); } inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast(addend)); } -#elif COMPILER(GCC) && !PLATFORM(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc +#elif OS(ANDROID) + +inline int atomicIncrement(int volatile* addend) { return android_atomic_inc(addend); } +inline int atomicDecrement(int volatile* addend) { return android_atomic_dec(addend); } + +#elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp index 46f23d2..2e8a259 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingNone.cpp @@ -30,11 +30,13 @@ #include "config.h" #include "Threading.h" +#if ENABLE(SINGLE_THREADED) + namespace WTF { void initializeThreading() { } ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char*) { return ThreadIdentifier(); } -void setThreadNameInternal(const char*) { } +void initializeCurrentThreadInternal(const char*) { } int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; } void detachThread(ThreadIdentifier) { } ThreadIdentifier currentThread() { return ThreadIdentifier(); } @@ -57,3 +59,5 @@ void lockAtomicallyInitializedStaticMutex() { } void unlockAtomicallyInitializedStaticMutex() { } } // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp index 6cad5e3..2feb808 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -37,6 +37,8 @@ #include "MainThread.h" #include "RandomNumberSeed.h" #include "StdLibExtras.h" +#include "ThreadIdentifierDataPthreads.h" +#include "ThreadSpecific.h" #include "UnusedParam.h" #include @@ -45,7 +47,7 @@ #include #endif -#if PLATFORM(ANDROID) +#if OS(ANDROID) #include "jni_utility.h" #endif @@ -55,10 +57,12 @@ typedef HashMap ThreadMap; static Mutex* atomicallyInitializedStaticMutex; -#if !PLATFORM(DARWIN) || PLATFORM(CHROMIUM) -static ThreadIdentifier mainThreadIdentifier; // The thread that was the first to call initializeThreading(), which must be the main thread. +#if !OS(DARWIN) || PLATFORM(CHROMIUM) || USE(WEB_THREAD) +static pthread_t mainThread; // The thread that was the first to call initializeThreading(), which must be the main thread. #endif +void clearPthreadHandleForIdentifier(ThreadIdentifier); + static Mutex& threadMapMutex() { DEFINE_STATIC_LOCAL(Mutex, mutex, ()); @@ -71,8 +75,8 @@ void initializeThreading() atomicallyInitializedStaticMutex = new Mutex; threadMapMutex(); initializeRandomNumberGenerator(); -#if !PLATFORM(DARWIN) || PLATFORM(CHROMIUM) - mainThreadIdentifier = currentThread(); +#if !OS(DARWIN) || PLATFORM(CHROMIUM) || USE(WEB_THREAD) + mainThread = pthread_self(); #endif initializeMainThread(); } @@ -108,7 +112,7 @@ static ThreadIdentifier identifierByPthreadHandle(const pthread_t& pthreadHandle return 0; } -static ThreadIdentifier establishIdentifierForPthreadHandle(pthread_t& pthreadHandle) +static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle) { ASSERT(!identifierByPthreadHandle(pthreadHandle)); @@ -128,7 +132,7 @@ static pthread_t pthreadHandleForIdentifier(ThreadIdentifier id) return threadMap().get(id); } -static void clearPthreadHandleForIdentifier(ThreadIdentifier id) +void clearPthreadHandleForIdentifier(ThreadIdentifier id) { MutexLocker locker(threadMapMutex()); @@ -137,7 +141,7 @@ static void clearPthreadHandleForIdentifier(ThreadIdentifier id) threadMap().remove(id); } -#if PLATFORM(ANDROID) +#if OS(ANDROID) // On the Android platform, threads must be registered with the VM before they run. struct ThreadData { ThreadFunction entryPoint; @@ -185,13 +189,17 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con } #endif -void setThreadNameInternal(const char* threadName) +void initializeCurrentThreadInternal(const char* threadName) { #if HAVE(PTHREAD_SETNAME_NP) pthread_setname_np(threadName); #else UNUSED_PARAM(threadName); #endif + + ThreadIdentifier id = identifierByPthreadHandle(pthread_self()); + ASSERT(id); + ThreadIdentifierData::initialize(id); } int waitForThreadCompletion(ThreadIdentifier threadID, void** result) @@ -199,12 +207,13 @@ int waitForThreadCompletion(ThreadIdentifier threadID, void** result) ASSERT(threadID); pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID); + if (!pthreadHandle) + return 0; int joinResult = pthread_join(pthreadHandle, result); if (joinResult == EDEADLK) LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID); - clearPthreadHandleForIdentifier(threadID); return joinResult; } @@ -213,26 +222,30 @@ void detachThread(ThreadIdentifier threadID) ASSERT(threadID); pthread_t pthreadHandle = pthreadHandleForIdentifier(threadID); + if (!pthreadHandle) + return; pthread_detach(pthreadHandle); - - clearPthreadHandleForIdentifier(threadID); } ThreadIdentifier currentThread() { - pthread_t currentThread = pthread_self(); - if (ThreadIdentifier id = identifierByPthreadHandle(currentThread)) + ThreadIdentifier id = ThreadIdentifierData::identifier(); + if (id) return id; - return establishIdentifierForPthreadHandle(currentThread); + + // Not a WTF-created thread, ThreadIdentifier is not established yet. + id = establishIdentifierForPthreadHandle(pthread_self()); + ThreadIdentifierData::initialize(id); + return id; } bool isMainThread() { -#if PLATFORM(DARWIN) && !PLATFORM(CHROMIUM) +#if OS(DARWIN) && !PLATFORM(CHROMIUM) && !USE(WEB_THREAD) return pthread_main_np(); #else - return currentThread() == mainThreadIdentifier; + return pthread_equal(pthread_self(), mainThread); #endif } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp index cccbda1..73c3f0c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp @@ -87,10 +87,10 @@ #include "Threading.h" #include "MainThread.h" -#if !USE(PTHREADS) && PLATFORM(WIN_OS) +#if !USE(PTHREADS) && OS(WINDOWS) #include "ThreadSpecific.h" #endif -#if !PLATFORM(WINCE) +#if !OS(WINCE) #include #endif #if HAVE(ERRNO_H) @@ -118,7 +118,7 @@ typedef struct tagTHREADNAME_INFO { } THREADNAME_INFO; #pragma pack(pop) -void setThreadNameInternal(const char* szThreadName) +void initializeCurrentThreadInternal(const char* szThreadName) { THREADNAME_INFO info; info.dwType = 0x1000; @@ -161,7 +161,7 @@ void initializeThreading() initializeRandomNumberGenerator(); initializeMainThread(); mainThreadIdentifier = currentThread(); - setThreadNameInternal("Main Thread"); + initializeCurrentThreadInternal("Main Thread"); } } @@ -205,7 +205,7 @@ static unsigned __stdcall wtfThreadEntryPoint(void* param) void* result = invocation.function(invocation.data); -#if !USE(PTHREADS) && PLATFORM(WIN_OS) +#if !USE(PTHREADS) && OS(WINDOWS) // Do the TLS cleanup. ThreadSpecificThreadExit(); #endif @@ -218,7 +218,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con unsigned threadIdentifier = 0; ThreadIdentifier threadID = 0; ThreadFunctionInvocation* invocation = new ThreadFunctionInvocation(entryPoint, data); -#if PLATFORM(WINCE) +#if OS(WINCE) // This is safe on WINCE, since CRT is in the core and innately multithreaded. // On desktop Windows, need to use _beginthreadex (not available on WinCE) if using any CRT functions HANDLE threadHandle = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)wtfThreadEntryPoint, invocation, 0, (LPDWORD)&threadIdentifier); @@ -226,7 +226,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con HANDLE threadHandle = reinterpret_cast(_beginthreadex(0, 0, wtfThreadEntryPoint, invocation, 0, &threadIdentifier)); #endif if (!threadHandle) { -#if PLATFORM(WINCE) +#if OS(WINCE) LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, ::GetLastError()); #elif defined(NO_ERRNO) LOG_ERROR("Failed to create thread at entry point %p with data %p.", entryPoint, data); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp index 36fc6c6..9e51ad0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 2010 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -101,6 +101,20 @@ COMPILE_ASSERT((!IsSameType::value), WTF_IsSameType_int_int_pointer_f COMPILE_ASSERT((!IsSameType::value), WTF_IsSameType_const_change_false); COMPILE_ASSERT((!IsSameType::value), WTF_IsSameType_volatile_change_false); +template +class TestBaseClass { +}; + +class TestDerivedClass : public TestBaseClass { +}; + +COMPILE_ASSERT((IsSubclass >::value), WTF_Test_IsSubclass_Derived_From_Base); +COMPILE_ASSERT((!IsSubclass, TestDerivedClass>::value), WTF_Test_IsSubclass_Base_From_Derived); +COMPILE_ASSERT((IsSubclassOfTemplate::value), WTF_Test_IsSubclassOfTemplate_Base_From_Derived); +COMPILE_ASSERT((IsSameType, TestBaseClass>::Type, int>::value), WTF_Test_RemoveTemplate); +COMPILE_ASSERT((IsSameType::Type, int>::value), WTF_Test_RemoveTemplate_WithoutTemplate); + + COMPILE_ASSERT((IsSameType::Type>::value), WTF_test_RemoveConst_const_bool); COMPILE_ASSERT((!IsSameType::Type>::value), WTF_test_RemoveConst_volatile_bool); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 9e75e7a..62dbc49 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 2010 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -104,6 +104,40 @@ namespace WTF { static const bool value = true; }; + template class IsSubclass { + typedef char YesType; + struct NoType { + char padding[8]; + }; + + static YesType subclassCheck(U*); + static NoType subclassCheck(...); + static T* t; + public: + static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); + }; + + template class U> class IsSubclassOfTemplate { + typedef char YesType; + struct NoType { + char padding[8]; + }; + + template static YesType subclassCheck(U*); + static NoType subclassCheck(...); + static T* t; + public: + static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); + }; + + template class OuterTemplate> struct RemoveTemplate { + typedef T Type; + }; + + template class OuterTemplate> struct RemoveTemplate, OuterTemplate> { + typedef T Type; + }; + template struct RemoveConst { typedef T Type; }; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h index 519f518..1ec79d9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/VMTags.h @@ -30,7 +30,7 @@ // On Mac OS X, the VM subsystem allows tagging memory requested from mmap and vm_map // in order to aid tools that inspect system memory use. -#if PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) +#if OS(DARWIN) && !defined(BUILDING_ON_TIGER) #include @@ -44,12 +44,12 @@ #define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(65) #endif // defined(VM_MEMORY_JAVASCRIPT_CORE) && defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) && defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR) -#else // PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) +#else // OS(DARWIN) && !defined(BUILDING_ON_TIGER) #define VM_TAG_FOR_COLLECTOR_MEMORY -1 #define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1 #define VM_TAG_FOR_REGISTERFILE_MEMORY -1 -#endif // PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) +#endif // OS(DARWIN) && !defined(BUILDING_ON_TIGER) #endif // VMTags_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h new file mode 100644 index 0000000..cd321b8 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ValueCheck.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ValueCheck_h +#define ValueCheck_h + +// For malloc_size and _msize. +#if OS(DARWIN) +#include +#elif COMPILER(MSVC) +#include +#endif + +namespace WTF { + +template struct ValueCheck { + typedef T TraitType; + static void checkConsistency(const T&) { } +}; + +#if !ASSERT_DISABLED +template struct ValueCheck { + typedef P* TraitType; + static void checkConsistency(const P* p) + { + if (!p) + return; +#if (defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) || !defined(NDEBUG) +#if OS(DARWIN) + ASSERT(malloc_size(p)); +#elif COMPILER(MSVC) + ASSERT(_msize(const_cast(p))); +#endif +#endif + ValueCheck

::checkConsistency(*p); + } +}; +#endif + +} + +#endif // ValueCheck_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index e1fc5b4..81ea321 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -24,6 +24,7 @@ #include "FastAllocBase.h" #include "Noncopyable.h" #include "NotFound.h" +#include "ValueCheck.h" #include "VectorTraits.h" #include #include @@ -71,7 +72,7 @@ namespace WTF { } template - class VectorDestructor; + struct VectorDestructor; template struct VectorDestructor @@ -90,7 +91,7 @@ namespace WTF { }; template - class VectorInitializer; + struct VectorInitializer; template struct VectorInitializer @@ -118,7 +119,7 @@ namespace WTF { }; template - class VectorMover; + struct VectorMover; template struct VectorMover @@ -162,7 +163,7 @@ namespace WTF { }; template - class VectorCopier; + struct VectorCopier; template struct VectorCopier @@ -187,7 +188,7 @@ namespace WTF { }; template - class VectorFiller; + struct VectorFiller; template struct VectorFiller @@ -212,7 +213,7 @@ namespace WTF { }; template - class VectorComparer; + struct VectorComparer; template struct VectorComparer @@ -586,6 +587,8 @@ namespace WTF { m_buffer.swap(other.m_buffer); } + void checkConsistency(); + private: void expandCapacity(size_t newMinCapacity); const T* expandCapacity(size_t newMinCapacity, const T*); @@ -987,6 +990,15 @@ namespace WTF { } template + inline void Vector::checkConsistency() + { +#if !ASSERT_DISABLED + for (size_t i = 0; i < size(); ++i) + ValueCheck::checkConsistency(at(i)); +#endif + } + + template void deleteAllValues(const Vector& collection) { typedef typename Vector::const_iterator iterator; @@ -1016,6 +1028,15 @@ namespace WTF { return !(a == b); } +#if !ASSERT_DISABLED + template struct ValueCheck > { + typedef Vector TraitType; + static void checkConsistency(const Vector& v) + { + v.checkConsistency(); + } + }; +#endif } // namespace WTF diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h new file mode 100644 index 0000000..3c40b61 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector3.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Vector3_h +#define Vector3_h + +#include + +namespace WebCore { + +class Vector3 { +public: + Vector3() + : m_x(0.0) + , m_y(0.0) + , m_z(0.0) + { + } + + Vector3(double x, double y, double z) + : m_x(x) + , m_y(y) + , m_z(z) + { + } + + Vector3(const float p[3]) + : m_x(p[0]) + , m_y(p[1]) + , m_z(p[2]) + { + } + + Vector3(const double p[3]) + : m_x(p[0]) + , m_y(p[1]) + , m_z(p[2]) + { + } + + double abs() const + { + return sqrt(m_x * m_x + m_y * m_y + m_z * m_z); + } + + bool isZero() const + { + return !m_x && !m_y && !m_z; + } + + void normalize() + { + double absValue = abs(); + if (!absValue) + return; + + double k = 1.0 / absValue; + m_x *= k; + m_y *= k; + m_z *= k; + } + + double x() const { return m_x; } + double y() const { return m_y; } + double z() const { return m_z; } + +private: + double m_x; + double m_y; + double m_z; +}; + +inline Vector3 operator+(const Vector3& v1, const Vector3& v2) +{ + return Vector3(v1.x() + v2.x(), v1.y() + v2.y(), v1.z() + v2.z()); +} + +inline Vector3 operator-(const Vector3& v1, const Vector3& v2) +{ + return Vector3(v1.x() - v2.x(), v1.y() - v2.y(), v1.z() - v2.z()); +} + +inline Vector3 operator*(double k, const Vector3& v) +{ + return Vector3(k * v.x(), k * v.y(), k * v.z()); +} + +inline Vector3 operator*(const Vector3& v, double k) +{ + return Vector3(k * v.x(), k * v.y(), k * v.z()); +} + +inline double dot(const Vector3& v1, const Vector3& v2) +{ + return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() * v2.z(); +} + +inline Vector3 cross(const Vector3& v1, const Vector3& v2) +{ + double x3 = v1.y() * v2.z() - v1.z() * v2.y(); + double y3 = v1.z() * v2.x() - v1.x() * v2.z(); + double z3 = v1.x() * v2.y() - v1.y() * v2.x(); + return Vector3(x3, y3, z3); +} + +inline double distance(const Vector3& v1, const Vector3& v2) +{ + return (v1 - v2).abs(); +} + +} // WebCore + +#endif // Vector3_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h index eb4c279..bf77878 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h @@ -32,7 +32,7 @@ using std::pair; namespace WTF { template - class VectorTraitsBase; + struct VectorTraitsBase; template struct VectorTraitsBase diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp index d75c17a..6289d04 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp @@ -140,7 +140,6 @@ #else #define NO_ERRNO #endif -#include #include #include #include @@ -148,6 +147,7 @@ #include #include #include +#include #include #include @@ -159,9 +159,9 @@ #pragma warning(disable: 4554) #endif -#if PLATFORM(BIG_ENDIAN) +#if CPU(BIG_ENDIAN) #define IEEE_MC68k -#elif PLATFORM(MIDDLE_ENDIAN) +#elif CPU(MIDDLE_ENDIAN) #define IEEE_ARM #else #define IEEE_8087 @@ -262,7 +262,8 @@ typedef union { double d; uint32_t L[2]; } U; #define Pack_32 #endif -#if PLATFORM(PPC64) || PLATFORM(X86_64) +#if CPU(PPC64) || CPU(X86_64) +// FIXME: should we enable this on all 64-bit CPUs? // 64-bit emulation provided by the compiler is likely to be slower than dtoa own code on 32-bit hardware. #define USE_LONG_LONG #endif @@ -560,7 +561,7 @@ static void mult(BigInt& aRef, const BigInt& bRef) aRef = c; } -struct P5Node { +struct P5Node : Noncopyable { BigInt val; P5Node* next; }; @@ -1869,7 +1870,7 @@ static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S) * calculation. */ -void dtoa(char* result, double dd, int ndigits, int* decpt, int* sign, char** rve) +void dtoa(DtoaBuffer result, double dd, int ndigits, int* decpt, int* sign, char** rve) { /* Arguments ndigits, decpt, sign are similar to those @@ -1908,16 +1909,23 @@ void dtoa(char* result, double dd, int ndigits, int* decpt, int* sign, char** rv { /* Infinity or NaN */ *decpt = 9999; - if (!word1(&u) && !(word0(&u) & 0xfffff)) + if (!word1(&u) && !(word0(&u) & 0xfffff)) { strcpy(result, "Infinity"); - else + if (rve) + *rve = result + 8; + } else { strcpy(result, "NaN"); + if (rve) + *rve = result + 3; + } return; } if (!dval(&u)) { *decpt = 1; result[0] = '0'; result[1] = '\0'; + if (rve) + *rve = result + 1; return; } @@ -2376,4 +2384,83 @@ ret: *rve = s; } +static ALWAYS_INLINE void append(char*& next, const char* src, unsigned size) +{ + for (unsigned i = 0; i < size; ++i) + *next++ = *src++; +} + +void doubleToStringInJavaScriptFormat(double d, DtoaBuffer buffer, unsigned* resultLength) +{ + ASSERT(buffer); + + // avoid ever printing -NaN, in JS conceptually there is only one NaN value + if (isnan(d)) { + append(buffer, "NaN", 3); + if (resultLength) + *resultLength = 3; + return; + } + // -0 -> "0" + if (!d) { + buffer[0] = '0'; + if (resultLength) + *resultLength = 1; + return; + } + + int decimalPoint; + int sign; + + DtoaBuffer result; + char* resultEnd = 0; + WTF::dtoa(result, d, 0, &decimalPoint, &sign, &resultEnd); + int length = resultEnd - result; + + char* next = buffer; + if (sign) + *next++ = '-'; + + if (decimalPoint <= 0 && decimalPoint > -6) { + *next++ = '0'; + *next++ = '.'; + for (int j = decimalPoint; j < 0; j++) + *next++ = '0'; + append(next, result, length); + } else if (decimalPoint <= 21 && decimalPoint > 0) { + if (length <= decimalPoint) { + append(next, result, length); + for (int j = 0; j < decimalPoint - length; j++) + *next++ = '0'; + } else { + append(next, result, decimalPoint); + *next++ = '.'; + append(next, result + decimalPoint, length - decimalPoint); + } + } else if (result[0] < '0' || result[0] > '9') + append(next, result, length); + else { + *next++ = result[0]; + if (length > 1) { + *next++ = '.'; + append(next, result + 1, length - 1); + } + + *next++ = 'e'; + *next++ = (decimalPoint >= 0) ? '+' : '-'; + // decimalPoint can't be more than 3 digits decimal given the + // nature of float representation + int exponential = decimalPoint - 1; + if (exponential < 0) + exponential = -exponential; + if (exponential >= 100) + *next++ = static_cast('0' + exponential / 100); + if (exponential >= 10) + *next++ = static_cast('0' + (exponential % 100) / 10); + *next++ = static_cast('0' + exponential % 10); + } + if (resultLength) + *resultLength = next - buffer; +} + } // namespace WTF diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h index cbec7c7..6127f53 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.h @@ -30,8 +30,18 @@ namespace WTF { extern WTF::Mutex* s_dtoaP5Mutex; double strtod(const char* s00, char** se); - void dtoa(char* result, double d, int ndigits, int* decpt, int* sign, char** rve); + + typedef char DtoaBuffer[80]; + void dtoa(DtoaBuffer result, double d, int ndigits, int* decpt, int* sign, char** rve); + + // dtoa() for ECMA-262 'ToString Applied to the Number Type.' + // The *resultLength will have the length of the resultant string in bufer. + // The resultant string isn't terminated by 0. + void doubleToStringInJavaScriptFormat(double, DtoaBuffer, unsigned* resultLength); } // namespace WTF +using WTF::DtoaBuffer; +using WTF::doubleToStringInJavaScriptFormat; + #endif // WTF_dtoa_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp index 1fdd2bb..dc04a68 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "Threading.h" +#if !ENABLE(SINGLE_THREADED) + #include "CurrentTime.h" #include "HashMap.h" #include "MainThread.h" @@ -64,6 +66,21 @@ void ThreadPrivate::run() m_returnValue = m_entryPoint(m_data); } +class ThreadMonitor : public QObject { + Q_OBJECT +public: + static ThreadMonitor * instance() + { + static ThreadMonitor *instance = new ThreadMonitor(); + return instance; + } + +public Q_SLOTS: + void threadFinished() + { + sender()->deleteLater(); + } +}; static Mutex* atomicallyInitializedStaticMutex; @@ -155,6 +172,9 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con LOG_ERROR("Failed to create thread at entry point %p with data %p", entryPoint, data); return 0; } + + QObject::connect(thread, SIGNAL(finished()), ThreadMonitor::instance(), SLOT(threadFinished())); + thread->start(); QThread* threadRef = static_cast(thread); @@ -162,7 +182,7 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con return establishIdentifierForThread(threadRef); } -void setThreadNameInternal(const char*) +void initializeCurrentThreadInternal(const char*) { } @@ -181,8 +201,10 @@ int waitForThreadCompletion(ThreadIdentifier threadID, void** result) return !res; } -void detachThread(ThreadIdentifier) +void detachThread(ThreadIdentifier threadID) { + ASSERT(threadID); + clearThreadForIdentifier(threadID); } ThreadIdentifier currentThread() @@ -267,3 +289,7 @@ void ThreadCondition::broadcast() } } // namespace WebCore + +#include "ThreadingQt.moc" + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp index 9e713fe..21d5856 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/UTF8.cpp @@ -23,6 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "UTF8.h" namespace WTF { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp index a779b36..e20c376 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp @@ -19,6 +19,7 @@ * */ +#include "config.h" #include "UnicodeGLib.h" namespace WTF { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h index c03d3ec..d72e707 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h @@ -26,7 +26,7 @@ #define UnicodeGLib_h #include "UnicodeMacrosFromICU.h" -#include +#include #include #include @@ -152,6 +152,11 @@ inline bool isArabicChar(UChar32 c) return c >= 0x0600 && c <= 0x06FF; } +inline bool isAlphanumeric(UChar32 c) +{ + return g_unichar_isalnum(c); +} + inline bool isFormatChar(UChar32 c) { return g_unichar_type(c) == G_UNICODE_FORMAT; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp index 6376bb3..a1753a4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp @@ -36,7 +36,7 @@ #include #include -#if PLATFORM(DARWIN) +#if OS(DARWIN) #include "RetainPtr.h" #include #endif @@ -59,9 +59,9 @@ Collator::Collator(const char* locale) std::auto_ptr Collator::userDefault() { -#if PLATFORM(DARWIN) && PLATFORM(CF) +#if OS(DARWIN) && PLATFORM(CF) // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work. -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !OS(IPHONE_OS) RetainPtr currentLocale(AdoptCF, CFLocaleCopyCurrent()); CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get(), kCFLocaleCollatorIdentifier); #else diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h index 35c6fbf..a2a5c0a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h @@ -164,6 +164,11 @@ inline bool isArabicChar(UChar32 c) return ublock_getCode(c) == UBLOCK_ARABIC; } +inline bool isAlphanumeric(UChar32 c) +{ + return u_isalnum(c); +} + inline bool isSeparatorSpace(UChar32 c) { return u_charType(c) == U_SPACE_SEPARATOR; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h index bdf2028..9b1754a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h @@ -30,7 +30,6 @@ #include -#if QT_VERSION >= 0x040300 QT_BEGIN_NAMESPACE namespace QUnicodeTables { struct Properties { @@ -55,10 +54,9 @@ namespace QUnicodeTables { Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2); } QT_END_NAMESPACE -#endif // ugly hack to make UChar compatible with JSChar in API/JSStringRef.h -#if defined(Q_OS_WIN) || COMPILER(WINSCW) +#if defined(Q_OS_WIN) || COMPILER(WINSCW) || COMPILER(RVCT) typedef wchar_t UChar; #else typedef uint16_t UChar; @@ -186,8 +184,6 @@ enum CharCategory { }; -#if QT_VERSION >= 0x040300 - // FIXME: handle surrogates correctly in all methods inline UChar32 toLower(UChar32 ch) @@ -406,138 +402,6 @@ inline CharCategory category(UChar32 c) return (CharCategory) U_MASK(QChar::category(c)); } -#else - -inline UChar32 toLower(UChar32 ch) -{ - if (ch > 0xffff) - return ch; - return QChar((unsigned short)ch).toLower().unicode(); -} - -inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) -{ - *error = false; - if (resultLength < srcLength) { - *error = true; - return srcLength; - } - for (int i = 0; i < srcLength; ++i) - result[i] = QChar(src[i]).toLower().unicode(); - return srcLength; -} - -inline UChar32 toUpper(UChar32 ch) -{ - if (ch > 0xffff) - return ch; - return QChar((unsigned short)ch).toUpper().unicode(); -} - -inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) -{ - *error = false; - if (resultLength < srcLength) { - *error = true; - return srcLength; - } - for (int i = 0; i < srcLength; ++i) - result[i] = QChar(src[i]).toUpper().unicode(); - return srcLength; -} - -inline int toTitleCase(UChar32 c) -{ - if (c > 0xffff) - return c; - return QChar((unsigned short)c).toUpper().unicode(); -} - -inline UChar32 foldCase(UChar32 c) -{ - if (c > 0xffff) - return c; - return QChar((unsigned short)c).toLower().unicode(); -} - -inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) -{ - return toLower(result, resultLength, src, srcLength, error); -} - -inline bool isPrintableChar(UChar32 c) -{ - return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint(); -} - -inline bool isArabicChar(UChar32 c) -{ - return c >= 0x0600 && c <= 0x06FF; -} - -inline bool isSeparatorSpace(UChar32 c) -{ - return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Separator_Space; -} - -inline bool isPunct(UChar32 c) -{ - return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPunct(); -} - -inline bool isLower(UChar32 c) -{ - return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase; -} - -inline UChar32 mirroredChar(UChar32 c) -{ - if (c > 0xffff) - return c; - return QChar(c).mirroredChar().unicode(); -} - -inline uint8_t combiningClass(UChar32 c) -{ - if (c > 0xffff) - return 0; - return QChar((unsigned short)c).combiningClass(); -} - -inline DecompositionType decompositionType(UChar32 c) -{ - if (c > 0xffff) - return DecompositionNone; - return (DecompositionType)QChar(c).decompositionTag(); -} - -inline int umemcasecmp(const UChar* a, const UChar* b, int len) -{ - for (int i = 0; i < len; ++i) { - QChar c1 = QChar(a[i]).toLower(); - QChar c2 = QChar(b[i]).toLower(); - if (c1 != c2) - return c1.unicode() - c2.unicode(); - } - return 0; -} - -inline Direction direction(UChar32 c) -{ - if (c > 0xffff) - return LeftToRight; - return (Direction)QChar(c).direction(); -} - -inline CharCategory category(UChar32 c) -{ - if (c > 0xffff) - return NoCategory; - return (CharCategory) U_MASK(QChar(c).category()); -} - -#endif - } } #endif // WTF_UNICODE_QT4_H diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp index 966f2a1..2df44f8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp @@ -19,6 +19,7 @@ * Boston, MA 02110-1301, USA. */ +#include "config.h" #include "UnicodeWince.h" #include diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h index 93d9f75..37174f0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h @@ -1,5 +1,4 @@ /* - * This file is part of the KDE libraries * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile, Inc. All rights reserved * diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp index b65b368..81d4f80 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp @@ -139,25 +139,25 @@ void* fastZeroedMalloc(size_t n) return p; } -void* tryFastMalloc(size_t n) +TryMallocReturnValue tryFastMalloc(size_t n) { MemoryAllocationCanFail canFail; return fastMalloc(n); } -void* tryFastZeroedMalloc(size_t n) +TryMallocReturnValue tryFastZeroedMalloc(size_t n) { MemoryAllocationCanFail canFail; return fastZeroedMalloc(n); } -void* tryFastCalloc(size_t n_elements, size_t element_size) +TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size) { MemoryAllocationCanFail canFail; return fastCalloc(n_elements, element_size); } -void* tryFastRealloc(void* p, size_t n) +TryMallocReturnValue tryFastRealloc(void* p, size_t n) { MemoryAllocationCanFail canFail; return fastRealloc(p, n); diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp index c7b3c81..9cd3d12 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexCompiler.cpp @@ -708,7 +708,7 @@ const char* compileRegex(const UString& patternString, RegexPattern& pattern) unsigned numSubpatterns = pattern.m_numSubpatterns; constructor.reset(); -#ifndef NDEBUG +#if !ASSERT_DISABLED const char* error = #endif parse(constructor, patternString, numSubpatterns); diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp index 5ce579a..fcb8d86 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.cpp @@ -44,7 +44,7 @@ namespace JSC { namespace Yarr { class RegexGenerator : private MacroAssembler { friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline); -#if PLATFORM(ARM) +#if CPU(ARM) static const RegisterID input = ARMRegisters::r0; static const RegisterID index = ARMRegisters::r1; static const RegisterID length = ARMRegisters::r2; @@ -54,7 +54,7 @@ class RegexGenerator : private MacroAssembler { static const RegisterID regT1 = ARMRegisters::r6; static const RegisterID returnRegister = ARMRegisters::r0; -#elif PLATFORM(X86) +#elif CPU(X86) static const RegisterID input = X86Registers::eax; static const RegisterID index = X86Registers::edx; static const RegisterID length = X86Registers::ecx; @@ -64,7 +64,7 @@ class RegexGenerator : private MacroAssembler { static const RegisterID regT1 = X86Registers::esi; static const RegisterID returnRegister = X86Registers::eax; -#elif PLATFORM(X86_64) +#elif CPU(X86_64) static const RegisterID input = X86Registers::edi; static const RegisterID index = X86Registers::esi; static const RegisterID length = X86Registers::edx; @@ -1288,11 +1288,11 @@ class RegexGenerator : private MacroAssembler { void generateEnter() { -#if PLATFORM(X86_64) +#if CPU(X86_64) push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); push(X86Registers::ebx); -#elif PLATFORM(X86) +#elif CPU(X86) push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); // TODO: do we need spill registers to fill the output pointer if there are no sub captures? @@ -1308,7 +1308,7 @@ class RegexGenerator : private MacroAssembler { #else loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif -#elif PLATFORM(ARM) +#elif CPU(ARM) push(ARMRegisters::r4); push(ARMRegisters::r5); push(ARMRegisters::r6); @@ -1318,15 +1318,15 @@ class RegexGenerator : private MacroAssembler { void generateReturn() { -#if PLATFORM(X86_64) +#if CPU(X86_64) pop(X86Registers::ebx); pop(X86Registers::ebp); -#elif PLATFORM(X86) +#elif CPU(X86) pop(X86Registers::esi); pop(X86Registers::edi); pop(X86Registers::ebx); pop(X86Registers::ebp); -#elif PLATFORM(ARM) +#elif CPU(ARM) pop(ARMRegisters::r6); pop(ARMRegisters::r5); pop(ARMRegisters::r4); diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h index 1872f21..935b9a3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h @@ -37,7 +37,7 @@ #include struct JSRegExp; // temporary, remove when fallback is removed. -#if PLATFORM(X86) && !COMPILER(MSVC) +#if CPU(X86) && !COMPILER(MSVC) #define YARR_CALL __attribute__ ((regparm (3))) #else #define YARR_CALL diff --git a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h index a451131..dd7512d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h +++ b/src/3rdparty/webkit/JavaScriptCore/yarr/RegexPattern.h @@ -137,7 +137,7 @@ struct PatternTerm { PatternTerm(unsigned spatternId) : type(TypeBackReference) - , invertOrCapture(invertOrCapture) + , invertOrCapture(false) { subpatternId = spatternId; quantityType = QuantifierFixedCount; diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index cc0e04f..35511fb 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - qtwebkit/qtwebkit-4.6 branch/tag + qtwebkit-4.7-merged branch/tag and has the sha1 checksum - ffae5e11181a3961193fa21ea405851cad714d4b + 5381ceeb37d97365cfb2f037650dbb4e495bca4e diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 61c2227..362834e 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,59782 +1,9619 @@ -2010-01-14 Diego Gonzalez - - Reviewed by Kenneth Christiansen. +2010-01-07 Laszlo Gombos - [Qt] Missing fileSystemPath() method in Qt KURL implementation - https://bugs.webkit.org/show_bug.cgi?id=33614 + Reviewed by NOBODY (OOPS!). - No new tests. + [RVCT] ACID3 test crash + https://bugs.webkit.org/show_bug.cgi?id=33280 - * platform/qt/KURLQt.cpp: - (WebCore::KURL::fileSystemPath): + Workaround developed by Yongjun Zhang. -2010-02-01 Andreas Kling + * dom/Element.cpp: + (WebCore::Element::setAttribute): - Reviewed by Kenneth Rohde Christiansen. +2009-10-30 Tor Arne Vestbø - [Qt] In the StyledPainter determine the style from the Render and Scrollbar theme instead of from the paint device - https://bugs.webkit.org/show_bug.cgi?id=34054 + Reviewed by NOBODY (OOPS!). - Getting the style from the painter's paint device is a hack that breaks when - the paint device's style is different than the style that is used when - calculating the metries earlier when there is no painter available. + [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() - This change moves us closer to always using the same style. + This ensures that long-running JavaScript (for example due to a modal alert() dialog), + will not trigger a deferred load after only 500ms (the default tokenizer delay) while + still giving a reasonable timeout (10 seconds) to prevent deadlock. - * platform/qt/RenderThemeQt.cpp: - (WebCore::StylePainter::StylePainter): - (WebCore::StylePainter::init): - (WebCore::RenderThemeQt::paintButton): - (WebCore::RenderThemeQt::paintTextField): - (WebCore::RenderThemeQt::paintMenuList): - (WebCore::RenderThemeQt::paintMenuListButton): - (WebCore::RenderThemeQt::paintSliderTrack): - (WebCore::RenderThemeQt::paintMediaMuteButton): - (WebCore::RenderThemeQt::paintMediaPlayButton): - (WebCore::RenderThemeQt::paintMediaSliderTrack): - (WebCore::RenderThemeQt::paintMediaSliderThumb): - * platform/qt/RenderThemeQt.h: - * platform/qt/ScrollbarThemeQt.cpp: - (WebCore::ScrollbarThemeQt::paint): - (WebCore::ScrollbarThemeQt::hitTest): - (WebCore::ScrollbarThemeQt::shouldCenterOnThumb): - (WebCore::ScrollbarThemeQt::scrollbarThickness): - (WebCore::ScrollbarThemeQt::thumbLength): - (WebCore::ScrollbarThemeQt::trackPosition): - (WebCore::ScrollbarThemeQt::trackLength): - (WebCore::ScrollbarThemeQt::paintScrollCorner): - (WebCore::ScrollbarThemeQt::style): - * platform/qt/ScrollbarThemeQt.h: - -2010-01-25 Simon Hausmann + https://bugs.webkit.org/show_bug.cgi?id=29381 - Reviewed by Kenneth Rohde Christiansen. + * html/HTMLTokenizer.cpp: Change debug output to print the actual tokenizer delay - [Qt] Use the fallback style on Maemo 5 +2009-10-30 Tor Arne Vestbø - https://bugs.webkit.org/show_bug.cgi?id=34376 + Reviewed by NOBODY (OOPS!). - * platform/qt/RenderThemeQt.cpp: - (WebCore::RenderThemeQt::RenderThemeQt): - (WebCore::RenderThemeQt::fallbackStyle): - (WebCore::RenderThemeQt::qStyle): - (WebCore::RenderThemeQt::setPaletteFromPageClientIfExists): - * platform/qt/RenderThemeQt.h: + Clear the initial request when loading synchronously to prevent duplicate loads -2010-01-29 Oswald Buddenhagen + MainResourceLoader uses the member m_initialRequest to store a request for future + deferred loads. When doing a synchronous load, in handleDataLoadNow(), we therefore + have to clear this request so that subsequent entries into the loader will not start + yet another load. - Reviewed by Simon Hausmann. + This can for example happen in setDefersLoading() as a result of a PageGroupLoadDeferrer + going out of scope when returning from Chrome::runJavaScriptAlert(), where the alert() + came from a script executed as part of the first/original load. - [Qt] Speed up the WebCore::String -> QString conversion + https://bugs.webkit.org/show_bug.cgi?id=30879 - Use QString(const QChar *, int len) constructor instead of QString::fromUtf16 to - avoid BOM checks and byteswapping. + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::handleDataLoadNow): clear m_initialRequest - * bridge/qt/qt_class.cpp: - (JSC::Bindings::QtClass::fieldNamed): - * bridge/qt/qt_runtime.cpp: - (JSC::Bindings::convertValueToQVariant): +2010-02-20 Laszlo Gombos -2010-01-14 Andreas Kling + Reviewed by Darin Adler. - Reviewed by Kenneth Rohde Christiansen. + Fix compiler warning "suggest parentheses around" + https://bugs.webkit.org/show_bug.cgi?id=35197 - [Qt] Enable scrolling optimization for pages with embedded widgets + No new tests as there is no new functionality. - https://bugs.webkit.org/show_bug.cgi?id=33373 + * html/DateComponents.cpp: + (WebCore::beforeGregorianStartDate): + * plugins/PluginDatabase.cpp: + (WebCore::PluginDatabase::findPlugin): - Added a basic manual test for scrolling of embedded QWidgets. +2010-02-20 Noam Rosenthal - * manual-tests/qt/qtplugin-scrolling.html: Added. - * platform/ScrollView.cpp: - (WebCore::ScrollView::scrollContents): - (WebCore::ScrollView::setParent): - * platform/ScrollView.h: - * platform/qt/ScrollViewQt.cpp: - (WebCore::ScrollView::platformInit): - (WebCore::ScrollView::platformAddChild): - (WebCore::ScrollView::platformRemoveChild): - * plugins/qt/PluginViewQt.cpp: - (WebCore::PluginView::updatePluginWidget): - (WebCore::PluginView::invalidateRect): + Reviewed by Laszlo Gombos. -2010-01-29 Laszlo Gombos + [Qt] ENABLE_3D_RENDERING should be optional + https://bugs.webkit.org/show_bug.cgi?id=35100 - Reviewed by Simon Hausmann. + No new tests: this is a build fix. - [Qt] Turn off websocket support by default for Qt 4.6.x - https://bugs.webkit.org/show_bug.cgi?id=34284 + * WebCore.pri: ENABLE_3D_RENDERING is now a proper feature test - * WebCore.pro: +2010-02-20 Alexey Proskuryakov -2010-01-26 Holger Hans Peter Freyther + Reviewed by Maciej Stachowiak. - Reviewed by Simon Hausmann. + https://bugs.webkit.org/show_bug.cgi?id=23742 + Applet methods can not return arrays to JS - [Qt] JavaScript prompt is currently broken. - https://bugs.webkit.org/show_bug.cgi?id=30914 + * bridge/jni/jsc/JNIBridgeJSC.cpp: (JavaArray::JavaArray): Don't accidentally zero out + m_rootObject (that's how PassRefPtr works). Without m_rootObject, we crash quickly. - Remove the manual test case in favor of an automated - test case in WebKit/qt/tests/qwebpage. + * bridge/jni/jsc/JavaInstanceJSC.cpp: (JavaInstance::invokeMethod): Do handle returned arrays. + Also, added an ifdef around code that's only needed on Tiger, and removed a comment saying + it can be removed when "new" plugin ships. I doubt that anyone can remember what "new" + could refer to back then. - * manual-tests/qt/java-script-prompt.html: Removed. +2010-02-20 Pavel Feldman -2010-01-25 Janne Koskinen + Reviewed by Timothy Hatcher. - Reviewed by Simon Hausmann. + Web Inspector: re-creating view in ResourcesPanel confuses ScriptsPanel's visibleView logic. - [Qt] Phone backup support for QtWebkit for Symbian devices. - https://bugs.webkit.org/show_bug.cgi?id=34077 + https://bugs.webkit.org/show_bug.cgi?id=35192 - * WebCore.pro: + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.show): + (WebInspector.ScriptsPanel.prototype.viewRecreated): -2010-01-21 Thiago Macieira +2010-02-20 Pavel Feldman - Reviewed by Simon Hausmann. + Reviewed by Timothy Hatcher. - [Qt] Fix incorrect dependency to QtXmlPatterns in generated include/QtWebKit/QtWebKit header + Web Inspector: need to highlight the evaluated expression used for popovers. - The generated file includes QtXmlPatterns/QtXmlPatterns, which is neither used/required by - the public QtWebKit API nor will it be available if Qt is configured with -no-xmlpatterns. + https://bugs.webkit.org/show_bug.cgi?id=35126 - * WebCore.pro: Trick syncqt to believe that xmlpatterns is not a dependency, so that it's not - included in the generated file. It'll still be used and linked to with this trick. + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._mouseMove): + (WebInspector.SourceFrame.prototype._hidePopup): + (WebInspector.SourceFrame.prototype._mouseHover): + (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup): + (WebInspector.SourceFrame.prototype._showPopup): + * inspector/front-end/inspector.css: -2010-01-17 Srinidhi Shreedhara +2010-02-20 Gustavo Noronha Silva - Reviewed by Simon Hausmann. + Roll out 55047 because it causes layout, and API tests to fail - [Qt] [Symbian] SetWindow call in npapi plugin does not happen when the cooridnates are negative - https://bugs.webkit.org/show_bug.cgi?id=33573 +2010-02-19 Gustavo Noronha Silva - * plugins/symbian/PluginViewSymbian.cpp: - (WebCore::PluginView::setNPWindowIfNeeded): Remove tests for negative - coordinates for early return. + Reviewed by Xan Lopez. -2010-01-14 Norbert Leser + [Soup] loses information related to message flags when converting from/to Resource{Request,Response} + https://bugs.webkit.org/show_bug.cgi?id=35093 - Reviewed by Laszlo Gombos. + Refactor updating of ResourceResponse objects from soup message + objects, to avoid code duplication. - Platform Symbian specific: - Added time-based optimization (-Otime) and increased optimization level to -O3, - conditionally for RVCT compiler (for ARM), for increasing performance - (primarily affecting JavaScript execution). - Default settings are -Ospace and -O2. + No behaviour change. - No new tests needed because no new funtionality is introduced, - only potential regression on existing tests needs to be evaluated. + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::fillResponseFromMessage): + * platform/network/soup/ResourceResponseSoup.cpp: + (WebCore::ResourceResponse::updateFromSoupMessage): - * WebCore.pro: +2010-02-20 Alexey Proskuryakov -2010-01-13 Girish Ramakrishnan + Reviewed by Maciej Stachowiak. - Reviewed by Simon Hausmann. + https://bugs.webkit.org/show_bug.cgi?id=35190 + Don't use system malloc in Java bindings - [Qt/Win] Flash in QGraphicsWebView does not process hover correctly. - - https://bugs.webkit.org/show_bug.cgi?id=33591 - - Mouse hover does not work as expected with the flash in some sites. - - http://www.bbc.co.uk/ Hover over the map - - http://www.barbie.com/ Hover over the menu items (Games, Videos) - The problem appears to be that Flash queries NPNVnetscapeWindow on every - mouse hover. I do not how flash uses this value but returning 0 when flash - is in windowless mode solves the problem (When using QGraphicsWebView we - inject wmode opaque, thereby putting the plugin in windowless mode). + * bridge/jni/jsc/JavaInstanceJSC.cpp: (JavaInstance::invokeMethod): Switched to WTF::Vector. - * plugins/win/PluginViewWin.cpp: - (windowHandleForPageClient): +2010-02-20 Alexey Proskuryakov -2010-01-13 Miikka Heikkinen + Reviewed by Maciej Stachowiak. - Reviewed by Simon Hausmann. + https://bugs.webkit.org/show_bug.cgi?id=9761 + LiveConnect string conversion fails for java.lang.Object - [Qt/Symbian] Added missing vendor information to qtwebkit.sis + Can't test Java in DRT (I wonder why). - This information is necessary to Symbian sign the package. + * bridge/jni/jsc/JNIUtilityPrivate.cpp: (JSC::Bindings::convertValueToJValue): + Added the necessary conversion. Also, removed CONVERT_NULL_TO_EMPTY_STRING dead code. - http://bugreports.qt.nokia.com/browse/QTBUG-7290 +2010-02-19 Maciej Stachowiak - * WebCore.pro: + Reviewed by David Levin. -2010-01-12 Jakub Wieczorek + Add an ENABLE flag for sandboxed iframes to make it possible to disable it in releases + https://bugs.webkit.org/show_bug.cgi?id=35147 - Reviewed by Adam Barth. + I made ENABLE(SANDBOX) only control the sandbox attribute itself; + I did not ifdef the infrastructure to make sandboxing + switchable. This is because the likely concerns about sandboxing + are not stability of the infrastructure code, but rather the fact + that the security model exposed to authors is still evolving. - [Qt] XSL stylesheets can load documents from a different origin + * Configurations/FeatureDefines.xcconfig: + * GNUmakefile.am: + * WebCore.pri: + * html/HTMLIFrameElement.cpp: + (WebCore::HTMLIFrameElement::parseMappedAttribute): - https://bugs.webkit.org/show_bug.cgi?id=33423 +2010-02-19 Alexey Proskuryakov - * xml/XSLTProcessorQt.cpp: - (WebCore::XSLTUriResolver::XSLTUriResolver): - (WebCore::XSLTUriResolver::resolve): - (WebCore::XSLTProcessor::transformToString): + Reviewed by Maciej Stachowiak. -2010-01-07 Yael Aharon + https://bugs.webkit.org/show_bug.cgi?id=35132 + Mouse cursor sometimes flickers over Flash content (35132) - Reviewed by Kenneth Rohde Christiansen. + * page/EventHandler.cpp: (WebCore::EventHandler::handleMouseMoveEvent): Don't set mouse + pointer when above a plug-in or applet to prevent flicker. - [Qt] Allow the application to override online/offline network status - https://bugs.webkit.org/show_bug.cgi?id=32684 +2010-02-18 Peter Kasting - Added API to NetworkStateNotifier for forcing network status. + Reviewed by Adam Barth. - * platform/network/NetworkStateNotifier.h: - * platform/network/qt/NetworkStateNotifierPrivate.h: - * platform/network/qt/NetworkStateNotifierQt.cpp: - (WebCore::NetworkStateNotifierPrivate::NetworkStateNotifierPrivate): - (WebCore::NetworkStateNotifierPrivate::onlineStateChanged): - (WebCore::NetworkStateNotifierPrivate::networkAccessPermissionChanged): - (WebCore::NetworkStateNotifier::updateState): - (WebCore::NetworkStateNotifier::NetworkStateNotifier): - (WebCore::NetworkStateNotifier::setNetworkAccessAllowed): + Fix regression in calculating an animated image's start time. + https://bugs.webkit.org/show_bug.cgi?id=35115 -2010-01-07 Simon Hausmann + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::startAnimation): - Reviewed by Tor Arne Vestbø. +2010-02-19 Alexey Proskuryakov - [Qt] Fix linkage against Qt mobility API bearer management module + Reviewed by Geoffrey Garen. - Use the documented .pro file syntax to link against the correct - library and (more importantly) get the include paths correct. + https://bugs.webkit.org/show_bug.cgi?id=35178 + LiveConnect code uses hand-rolled fprintf logging - * WebCore.pro: + Changed to use LOG, LOG_ERROR and ASSERT. -2010-01-07 Laszlo Gombos + * platform/Logging.cpp: + (WebCore::getChannelFromName): + * platform/Logging.h: + * platform/mac/LoggingMac.mm: + (WebCore::InitializeLoggingChannelsIfNecessary): + * platform/win/LoggingWin.cpp: + (WebCore::InitializeLoggingChannelsIfNecessary): + TextConversion channel was (almost) unused, renamed to LiveConnect. + + * platform/text/gtk/TextCodecGtk.cpp: (WebCore::TextCodecGtk::registerEncodingNames): + The only use of this channel was in platform specific code, commandeered it for cross-platform + needs. + + * bridge/jni/JNIBridge.cpp: + * bridge/jni/JNIUtility.cpp: + (JSC::Bindings::getJavaVM): + (JSC::Bindings::getJNIEnv): + (JSC::Bindings::getJNIField): + * bridge/jni/JNIUtility.h: + (JSC::Bindings::callJNIMethodV): + (JSC::Bindings::callJNIStaticMethod): + * bridge/jni/jni_jsobject.mm: + (completedJavaScriptAccess): + (dispatchToJavaScriptThread): + (performJavaScriptAccess): + (JavaJSObject::invoke): + (JavaJSObject::call): + (JavaJSObject::eval): + (JavaJSObject::getMember): + (JavaJSObject::setMember): + (JavaJSObject::removeMember): + (JavaJSObject::getSlot): + (JavaJSObject::setSlot): + (JavaJSObject::toString): + (JavaJSObject::createNative): + * bridge/jni/jsc/JNIBridgeJSC.cpp: + (JavaField::valueFromInstance): + (JavaField::setValueToInstance): + * bridge/jni/jsc/JavaClassJSC.cpp: + (JavaClass::JavaClass): + * bridge/jni/jsc/JavaInstanceJSC.cpp: + (JavaInstance::invokeMethod): + (JObjectWrapper::JObjectWrapper): + (JObjectWrapper::~JObjectWrapper): - Reviewed by NOBODY (OOPS!). +2010-02-19 Dirk Schulze - [RVCT] ACID3 test crash - https://bugs.webkit.org/show_bug.cgi?id=33280 + Reviewed by Nikolas Zimmermann. - Workaround developed by Yongjun Zhang. + RenderSVGResourceMasker causes an Assert on Wind builds during DRT + https://bugs.webkit.org/show_bug.cgi?id=35182 - * dom/Element.cpp: - (WebCore::Element::setAttribute): + We remove the Assert for now and return earlier, if the HashMap of the Masker + does not contain the RenderObject. The RenderObject is an identifiert to get + a already calculated mask. + A race condition during parsing can cause the invalidation call, before the mask + got calculated (only during DRT on Win build bots). + The real bug will be fixed with: https://bugs.webkit.org/show_bug.cgi?id=35181 -2010-01-06 Simon Hausmann + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::invalidateClient): - Unreviewed trivial Qt build fix. +2010-02-18 Peter Kasting - Prefix the phonon includes with phonon/ to avoid conflicts with the S60 - audio routing API ( http://wiki.forum.nokia.com/index.php/Audio_Routing_API ). + Reviewed by Darin Fisher. - * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: + Make Pasteboard::writeImage() safe against NULL cachedImages, and clean + up some code. + https://bugs.webkit.org/show_bug.cgi?id=35136 -2009-12-31 Laszlo Gombos + * loader/ImageLoader.cpp: + (WebCore::ImageLoader::updateRenderer): Shorten some code. + * page/DragController.cpp: + (WebCore::getImage): Shorten some code. + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeImage): NULL-check cachedImage(). + * platform/gtk/PasteboardGtk.cpp: + (WebCore::Pasteboard::writeImage): NULL-check cachedImage(). + * platform/mac/PasteboardMac.mm: + (WebCore::Pasteboard::writeImage): NULL-check cachedImage(). + * platform/qt/PasteboardQt.cpp: + (WebCore::Pasteboard::writeImage): NULL-check cachedImage(). + * platform/win/PasteboardWin.cpp: + (WebCore::Pasteboard::writeImage): NULL-check cachedImage(). - Reviewed by Kenneth Rohde Christiansen. +2010-02-19 Kenneth Rohde Christiansen - Do not include Frame.h under WebCore/html/canvas - https://bugs.webkit.org/show_bug.cgi?id=33082 + Rubberstamped by Noam Rosenthal, who wrote the original code. - No new tests, as there is no new functionality. + Make mouse wheel scrolling work when using the GraphicsLayer. - * html/canvas/CanvasRenderingContext2D.cpp: + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): -2009-12-30 Janne Koskinen +2010-02-19 Nate Chapin - Reviewed by Simon Hausmann. + Reviewed by Dimitri Glazkov. - [Qt] Add support for Symbian def files + [V8] Fix Worker crash regression in r54972 - * WebCore.pro: + https://bugs.webkit.org/show_bug.cgi?id=35166 -2009-12-30 Simon Hausmann + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::instantiateV8Object): Properly unwrap global objects when inside a WorkerContext. - Unreviewed Qt/Symbian build fix. +2010-02-19 Steve Block - Don't build network state notifier support when building inside of Qt. - Otherwise the Qt build depends on an external module that itself depends - on Qt again. + Not reviewed. Reverts r55020 which causes crashes in Chromium LayoutTests - * WebCore.pro: + * bindings/generic/RuntimeEnabledFeatures.cpp: + * storage/Database.cpp: -2009-12-30 Laszlo Gombos +2010-02-19 Steve Block - Reviewed by Simon Hausmann. + Reviewed by David Levin. - Turn off DataGrid support by default. + Sets default values of V8 runtime enabler flags to match behavior with JSC + https://bugs.webkit.org/show_bug.cgi?id=35095 - No new tests, as there is no new functionality. + No new tests, modifies a Chromium feature only. - * WebCore.pro: + * bindings/generic/RuntimeEnabledFeatures.cpp: Modified. Sets appcache and geolocation flag defaults to 'on' + * storage/Database.cpp: Modified. Sets database flag default to 'on'. -2009-12-17 Yael Aharon +2010-02-19 Alexander Pavlov - Reviewed by Kenneth Rohde Christiansen. + Reviewed by Pavel Feldman. - [Qt] support navigator.onLine and ononline/onoffline events. - https://bugs.webkit.org/show_bug.cgi?id=32555 + WebInspector: Elements panel: Correctly show empty elements' ending tags + for XML and HTML documents. + https://bugs.webkit.org/show_bug.cgi?id=26315 - Hooked up Bearer Management to NetworkStateNotifier. This solution is available - only if QtMobility's Bearer Management is installed. + Test: inspector/elements-panel-xhtml-structure.xhtml - * WebCore.pro: - * platform/network/NetworkStateNotifier.h: - * platform/network/qt/NetworkStateNotifierPrivate.h: Added. - * platform/network/qt/NetworkStateNotifierQt.cpp: Added. - (WebCore::NetworkStateNotifierPrivate::NetworkStateNotifierPrivate): - (WebCore::NetworkStateNotifierPrivate::onlineStateChanged): - (WebCore::NetworkStateNotifierPrivate::~NetworkStateNotifierPrivate): - (WebCore::NetworkStateNotifier::updateState): - (WebCore::NetworkStateNotifier::NetworkStateNotifier): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::populateScriptObjects): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype.set rootDOMNode): + (WebInspector.ElementsTreeOutline.prototype.get isXMLMimeType): + (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired): + (WebInspector.ElementsTreeElement.prototype.onexpand): + (WebInspector.ElementsTreeElement.prototype.oncollapse): + (WebInspector.ElementsTreeElement.prototype.updateTitle.callback): + (WebInspector.ElementsTreeElement.prototype.updateTitle): + (WebInspector.ElementsTreeElement.prototype._nodeTitleInfo): -2009-12-17 Simon Hausmann +2010-02-19 Pavel Feldman - Reviewed by Tor Arne Vestbø. + Not reviewed. Chromium build fix: reverting r54997 and r54998. - [Qt] Symbian build fix: Don't include QtXml/qxmlstream.h but omit the prefix, to - make sure we pick up the header file from QtCore. That is where the implementation - is compiled. + * bindings/v8/custom/V8LocationCustom.cpp: + (WebCore::V8Location::protocolAccessorSetter): + * platform/KURLGoogle.cpp: + (WebCore::KURL::setProtocol): + (WebCore::KURL::isHierarchical): - * dom/XMLTokenizer.h: +2010-02-17 Philippe Normand -2009-12-14 Holger Hans Peter Freyther + Reviewed by Eric Seidel. - Reviewed by Kenneth Rohde Christiansen. + [GTK] RTP/RTSP streams playback support + https://bugs.webkit.org/show_bug.cgi?id=33662 - [Qt] Add manual test for JavaScript prompt corner case - https://bugs.webkit.org/show_bug.cgi?id=30914 + Added live pipelines support in updateStates(). - The patch is based on the work done by Gupta Manish. + * manual-tests/video-rtsp.html: Added. + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::MediaPlayerPrivate::seek): + (WebCore::MediaPlayerPrivate::updateStates): - Verify behavior of the JavaScript prompt function. Currently - Qt is not behaving like other WebKit ports and Firefox in - regards to accepting the prompt but not entering a text. +2010-02-18 Yaar Schnitman - * manual-tests/qt/java-script-prompt.html: Added. + Reviewed by Darin Adler. -2009-12-21 Andreas Kling + Normalize custom ctors for Image, Option, Audio + https://bugs.webkit.org/show_bug.cgi?id=34782 - Reviewed by Darin Adler. + Test: fast/js/custom-constructors.html - Fix assertion failure when dragging an SVG image. - https://bugs.webkit.org/show_bug.cgi?id=32511 + * bindings/js/JSAudioConstructor.cpp: + (WebCore::JSAudioConstructor::JSAudioConstructor): + (WebCore::constructAudio): + * bindings/js/JSImageConstructor.cpp: + (WebCore::constructImage): + * bindings/js/JSOptionConstructor.cpp: + (WebCore::constructHTMLOptionElement): + * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp: + (WebCore::v8HTMLAudioElementConstructorCallback): + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + (WebCore::v8HTMLImageElementConstructorCallback): + * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp: + (WebCore::v8HTMLOptionElementConstructorCallback): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::HTMLAudioElement): + (WebCore::HTMLAudioElement::createForJSConstructor): + * html/HTMLAudioElement.h: + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::createForJSConstructor): + (WebCore::HTMLImageElement::mapToEntry): + (WebCore::HTMLImageElement::createRenderer): + (WebCore::HTMLImageElement::attach): + (WebCore::HTMLImageElement::width): + (WebCore::HTMLImageElement::height): + (WebCore::HTMLImageElement::naturalHeight): + * html/HTMLImageElement.h: + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::HTMLOptionElement): + (WebCore::HTMLOptionElement::createForJSConstructor): + (WebCore::HTMLOptionElement::ownerSelectElement): + (WebCore::HTMLOptionElement::nonRendererRenderStyle): + (WebCore::HTMLOptionElement::disabled): + (WebCore::HTMLOptionElement::insertedIntoTree): + * html/HTMLOptionElement.h: - Test: fast/images/drag-svg-as-image.html +2010-02-12 Brett Wilson - * svg/graphics/SVGImage.cpp: - (WebCore::SVGImage::filenameExtension): Return "svg" - * svg/graphics/SVGImage.h: + Reviewed by Adam Barth. -2009-11-23 Simon Hausmann + Update the Google-URL version of KURL and the V8 bindings to the new + behavior of KURL.IsStandard. - Reviewed by Kenneth Rohde Christiansen. + https://bugs.webkit.org/show_bug.cgi?id=34859 - [Qt] Wrong runtime instance objects of wrapped QObjects may be used if - the wrapped object died before the gc removed the instance. + This is covered by fast/dom/Window/invalid-protocol.html - https://bugs.webkit.org/show_bug.cgi?id=31681 + * bindings/v8/custom/V8LocationCustom.cpp: + (WebCore::V8Location::protocolAccessorSetter): + * platform/KURLGoogle.cpp: + (WebCore::KURL::setProtocol): + (WebCore::KURL::isHierarchical): - Before using a cached instance, verify that its wrapped QObject is - still alive. +2010-02-18 Simon Fraser - * bridge/qt/qt_instance.cpp: - (JSC::Bindings::QtInstance::getQtInstance): - * bridge/qt/qt_instance.h: - (JSC::Bindings::QtInstance::hashKey): + No Review. -2009-11-25 Jocelyn Turcotte + Remove a couple of extraneous spaces that got added to the project file + by hand-ending. - Reviewed by Simon Hausmann. + * WebCore.xcodeproj/project.pbxproj: - [Qt] Fix crash of QtWebKit on any page with Flash when compiled with MinGW. +2010-02-18 Simon Fraser - Fix inline assembly, don't dereference the function pointer twice. + Reviewed by Dan Bernstein. - * plugins/win/PluginViewWin.cpp: - (WebCore::PluginView::hookedBeginPaint): - (WebCore::PluginView::hookedEndPaint): + Page contents missing from snapshot on Newsweek.com article + + Add logic to determine when painting via the software rendering path will give an equivalent + result to the accelerated compositing presentation. This tests for the presence of 3D transforms + via the existing RenderLayerCompositor::has3DContent() method. + + * WebCore.base.exp: Export FrameView's isSoftwareRenderable(), paintBehavior() and setPaintBehavior(). + * page/FrameView.h: + * page/FrameView.cpp: + (WebCore::FrameView::isSoftwareRenderable): New method. + (WebCore::FrameView::paintBehavior): Make this non-inline so that we can reliably export it. -2009-11-22 Jakub Wieczorek +2010-02-18 Dan Bernstein - Reviewed by Adam Barth. + Reviewed by John Sullivan. - [Qt] Remove the Referer header when redirecting to a non-secure site - https://bugs.webkit.org/show_bug.cgi?id=31785 + Multiple style recalcs due to getComputedStyle() on “display: none;” element + when there are pending style sheets - This makes Qt pass two tests introduced in r50226. + Test: fast/css/getComputedStyle/pending-stylesheet.html - * platform/network/qt/QNetworkReplyHandler.cpp: - (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + When querying a property of a computed style declaration for a non-rendered element, + CSSStyleSelector::styleForElement() was called, and if there were pending style sheet, it + would behave as if the lack of renderer is due to FOUC suppression, and set a flag on + the document causing it to recalculate style. On the next computed style property access, + style would be recalculated for the document, but then the flag would get set again if the + element did not have a renderer. -2009-11-19 Olivier Goffart + * dom/Document.cpp: + (WebCore::Document::styleForElementIgnoringPendingStylesheets): Added. Temporarily sets + m_ignorePendingStylesheets around the call to CSSStyleSelector::styleForElement(). + * dom/Document.h: + * dom/Element.cpp: + (WebCore::Element::computedStyle): Use Document::styleForElementIgnoringPendingStylesheets(). - Reviewed by Simon Hausmann. +2010-02-18 Dirk Schulze - [Qt] Normalize signal and slot signatures. + Reviewed by Nikolas Zimmermann. - * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: - (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): + Move SVGResources to Renderers, starting with Masker + https://bugs.webkit.org/show_bug.cgi?id=35020 -2009-11-18 Benjamin Poulain + We have rendering specific code in WebCore/svg/graphics. The goal is to move + this code into suitable Renderers. This helps us to clean up the code and makes + maintenance easier. It also makes it possible to remove rendering specific code + from SVG*Elements into this renderers. So the Renderer contains everything that + is needed to use the resource. + RenderSVGResource will be the base class for all new resource render classes like + RenderSVGResourceMasker, RenderSVGResourceClipper and the other resources. - Reviewed by Simon Hausmann. + This patch starts moving SVGResourceMasker to RenderSVGResourceMasker. + Another benefit is the much more useful result in DRT on using masker. - [Qt] WebKit crashes when loading certain SVG images + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::toRenderSVGResource): Conversion to RenderSVGResource base class. + * rendering/RenderObject.h: + (WebCore::RenderObject::isSVGResource): Check if renderer is a resource. + * rendering/RenderPath.cpp: + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGImage.h: Some code clean up according to the webkit style. + (WebCore::RenderSVGImage::toSVGRenderBase): + (WebCore::RenderSVGImage::renderName): + (WebCore::RenderSVGImage::isSVGImage): + (WebCore::RenderSVGImage::localToParentTransform): + (WebCore::RenderSVGImage::strokeBoundingBox): + (WebCore::RenderSVGImage::requiresLayer): + (WebCore::RenderSVGImage::localTransform): + * rendering/RenderSVGInlineText.h: + (WebCore::RenderSVGInlineText::objectBoundingBox): Needed for SVGRenderTreeAsText + * rendering/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGModelObject.h: + * rendering/RenderSVGResource.h: Added. + (WebCore::): Base class for all Resource renderers like masker, clipper and others. + (WebCore::RenderSVGResource::RenderSVGResource): + (WebCore::RenderSVGResource::cast): + (WebCore::RenderSVGResource::toRenderSVGResource): + (WebCore::RenderSVGResource::isSVGResource): + (WebCore::RenderSVGResource::drawsContents): + (WebCore::getRenderSVGResourceById): + * rendering/RenderSVGResourceMasker.cpp: Added. + (WebCore::RenderSVGResourceMasker::RenderSVGResourceMasker): + (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker): + (WebCore::RenderSVGResourceMasker::invalidateClients): Status of masker changed, remove all clients. + (WebCore::RenderSVGResourceMasker::invalidateClient): Status of an object changed, remove pending client. + (WebCore::RenderSVGResourceMasker::applyResource): Apply masker to object. + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): boundingBox of the resource, depending on the object. + (WebCore::RenderSVGResourceMasker::createMaskImage): Creates the mask image, the context gets clipped with. + * rendering/RenderSVGResourceMasker.h: Added. + (WebCore::MaskerData::MaskerData): + (WebCore::RenderSVGResourceMasker::renderName): + (WebCore::RenderSVGResourceMasker::maskUnits): Unit of mask for DRT. + (WebCore::RenderSVGResourceMasker::maskContentUnits): Unit of childs from mask for DRT. + (WebCore::RenderSVGResourceMasker::resourceType): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGRoot.h: + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::destroy): dito. + * rendering/RenderSVGText.h: + * rendering/RenderTreeAsText.cpp: + (WebCore::write): + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + (WebCore::SVGRenderBase::maskerBoundingBoxForRenderer): + (WebCore::SVGRenderBase::deregisterFromResources): Unregister object from all it's resources after status changed. + * rendering/SVGRenderSupport.h: + (WebCore::SVGRenderBase::toSVGRenderBase): + (WebCore::SVGRenderBase::strokeBoundingBox): + (WebCore::SVGRenderBase::markerBoundingBox): + * rendering/SVGRenderTreeAsText.cpp: Update TreeAsText to dump maskers correctly. + (WebCore::operator<<): + (WebCore::writeSVGResource): + (WebCore::writeSVGContainer): + (WebCore::writeSVGText): + (WebCore::writeSVGInlineText): + (WebCore::writeSVGImage): + (WebCore::write): + (WebCore::writeResourcesToObject): + * rendering/SVGRenderTreeAsText.h: + * svg/SVGMaskElement.cpp: Update Masker to use the new renderer. + (WebCore::SVGMaskElement::svgAttributeChanged): + (WebCore::SVGMaskElement::childrenChanged): + (WebCore::SVGMaskElement::maskBoundingBox): + (WebCore::SVGMaskElement::createRenderer): + * svg/SVGMaskElement.h: + * svg/SVGStyledElement.cpp: We need to tell the renderer to unregister object, after the status changed. + (WebCore::SVGStyledElement::invalidateResources): + (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain): + * svg/SVGUnitTypes.h: Conversion of integer to SVGUnitType. + (WebCore::toUnitType): + * svg/graphics/SVGResource.h: + (WebCore::): + (WebCore::SVGResource::isMarker): + * svg/graphics/SVGResourceMasker.cpp: Removed. + * svg/graphics/SVGResourceMasker.h: Removed. - Check if the familly exist before creating the PlatformData from it. +2010-02-18 Dumitru Daniliuc - https://bugs.webkit.org/show_bug.cgi?id=29443 + Reviewed by Dimitri Glazkov. - Test: svg/text/text-font-invalid.html + Allow creating/dropping virtual tables when the module is FTS2. - * platform/graphics/qt/FontFallbackListQt.cpp: - (WebCore::FontFallbackList::fontDataAt): + https://bugs.webkit.org/show_bug.cgi?id=34867 -2009-11-14 Antonio Gomes + * storage/DatabaseAuthorizer.cpp: + (WebCore::DatabaseAuthorizer::createVTable): + (WebCore::DatabaseAuthorizer::dropVTable): - Reviewed by Antti Koivisto. +2010-02-18 Peter Kasting - [Qt] Broken back/forward after using ErrorPageExtension to set error page - https://bugs.webkit.org/show_bug.cgi?id=30573 + Not reviewed, Chromium build fix. - Make FrameLoader::checkLoadCompleteForThisFrame method - to check for any working DocumentLoader instance (through - activeDocumentLoader()) instead of only checking for - 'm_provisionalDocumentLoader' in order to decide to if - it is going to reset of not the back and forward history. - after an error page has been loaded. + r54963 had a typo in the WebCore.gypi change. + https://bugs.webkit.org/show_bug.cgi?id=35003 - Test: LayoutTests/fast/history/back-forward-reset-after-error-handling.html + * WebCore.gypi: - * loader/FrameLoader.cpp: - (WebCore::FrameLoader::checkLoadCompleteForThisFrame): +2010-02-18 Vangelis Kokkevis -2009-11-09 Laszlo Gombos + Reviewed by Simon Fraser. - Reviewed by Kenneth Rohde Christiansen. + Changing forward declaration of TimingFunction in GraphicsLayer.h from + class to struct to match its actual definition in TimingFunction.h - [Qt] Few classes have virtual functions but non-virtual destructor - https://bugs.webkit.org/show_bug.cgi?id=31269 + https://bugs.webkit.org/show_bug.cgi?id=35069 - No new tests as there is no functional change. - * platform/qt/QWebPageClient.h: - (QWebPageClient::~QWebPageClient): Add virtual destructor. + * platform/graphics/GraphicsLayer.h: + Change forward declaration from: class TimingFunction to: + struct TimingFunction -2009-11-09 Yael Aharon +2010-02-18 Noam Rosenthal Reviewed by Kenneth Rohde Christiansen. - [Qt] Allow setting HTTP headers with empty value in XMLHTTPRequest - https://bugs.webkit.org/show_bug.cgi?id=31140 + [Qt] Minor improvement to hybrid QPixmap + https://bugs.webkit.org/show_bug.cgi?id=34507 + Instead of having toHTMLImageElement which creates a new element, + assignToHTMLImageElement would set an existing HTML element to + contain the native QPixmap/QImge. + Also made some style fixes. - QtNetwork interprets null string as request to remove the header, not add it. - Replace null values with empty values before passing them to QtNetwork. + Additions to existing tests: see WebKit/qt/tests - Test: http/tests/xmlhttprequest/xmlhttprequest-setrequestheader-no-value.html + * bridge/qt/qt_pixmapruntime.cpp: + (JSC::Bindings::QtPixmapWidthField::valueFromInstance): style + (JSC::Bindings::QtPixmapHeightField::valueFromInstance): style + (JSC::Bindings::QtPixmapAssignToElementMethod::name): assignTo + (JSC::Bindings::QtPixmapAssignToElementMethod::invoke): new function + (JSC::Bindings::QtPixmapAssignToElementMethod::numParameters): 1 + (JSC::Bindings::QtPixmapToDataUrlMethod::invoke): style + (JSC::Bindings::QtPixmapToStringMethod::invoke): style + (JSC::Bindings::QtPixmapInstance::invokeMethod): style + (JSC::Bindings::QtPixmapClass::methodsNamed): new func, removed old + (JSC::Bindings::QtPixmapInstance::getPropertyNames): ditto + (JSC::Bindings::QtPixmapInstance::defaultValue): style + (JSC::Bindings::QtPixmapInstance::valueOf): style + (JSC::Bindings::QtPixmapInstance::toPixmap): style + (JSC::Bindings::QtPixmapInstance::variantFromObject): style - * platform/network/qt/ResourceRequestQt.cpp: - (WebCore::ResourceRequest::toNetworkRequest): +2010-02-18 Peter Kasting -2009-11-05 Jakub Wieczorek + Not reviewed, bustage fix. - Reviewed by Holger Freyther. + An extraneous line in r54839 broke GIF animation. - [Qt] The XML tokenizer reports a parse error twice if it occurs before the document element is found. - https://bugs.webkit.org/show_bug.cgi?id=31144 + * platform/image-decoders/gif/GIFImageReader.cpp: + (GIFImageReader::read): - XMLTokenizer::doEnd() uses an additional logic to report a parse failure in - documents that end prematurely but are not considered invalid by QXmlStream. - This is to stay compatible with the libxml2 implementation. - However, that code path would be also hit in situations when it should not, - i.e. the error would have already been caught and handled. As a result, the - same error would be reported twice. +2010-02-18 Dan Bernstein - No new tests, because the problem is already covered by - fast/parser/xml-declaration-missing-ending-mark.html. + Reviewed by Simon Fraser. - * dom/XMLTokenizerQt.cpp: - (WebCore::XMLTokenizer::doEnd): + REGRESSION: Selection painting issue in bug review textbox + https://bugs.webkit.org/show_bug.cgi?id=34946 -2009-11-05 Yuta Kitamura + Test: fast/repaint/selection-gap-overflow-scroll-2.html - Reviewed by Eric Seidel. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintSelection): localToContainerQuad() adjusts for + overflow scroll, but RenderLayer::addBlockSelectionGapsBounds() takes + non-scrolled coordinates, so account for that. - Fix ASSERT(currentStyle = renderStyle()). - https://bugs.webkit.org/show_bug.cgi?id=31152 +2010-02-17 Dumitru Daniliuc - * dom/Element.cpp: - (WebCore::Element::pseudoStyleCacheIsInvalid): We should have used "==" instead of "=". + Reviewed by Darin Adler. -2009-11-04 Yael Aharon + Change the V8 and JSC SQLStatementErrorCallback to interpret + 'undefined' return values as 'true', as required by the spec. - Reviewed by Tor Arne Vestbø. + https://bugs.webkit.org/show_bug.cgi?id=35048 - [Qt] ASSERT failure when receiving 401 HTTP Authentication response. - https://bugs.webkit.org/show_bug.cgi?id=31077 + * bindings/js/JSCustomSQLStatementErrorCallback.cpp: + (WebCore::JSCustomSQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8CustomSQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomVoidCallback.cpp: + (WebCore::invokeCallbackHelper): + (WebCore::invokeCallback): + (WebCore::invokeCallbackTreatUndefinedAsTrue): + * bindings/v8/custom/V8CustomVoidCallback.h: - Allow sending the response body under the same conditions that we - allow it to finish without reporting an error. +2010-02-17 Ojan Vafai - * platform/network/qt/QNetworkReplyHandler.cpp: - (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + Reviewed by Adam Barth. -2009-11-03 Evan Martin + keyboard selection sometimes moves the wrong end of the selection for Win/Linux + https://bugs.webkit.org/show_bug.cgi?id=35066 - Reviewed by Darin Adler. + On Windows/Linux keyboard based selections should always move the same + end of the seleciton. On Mac, lineboundary and documentboundary changes + move different ends of the selection depending on which direction your + extending. - Fix an off-by-one in the CSS lexer that causes memory corruption in - hard-to-trigger circumstances. + Test: editing/selection/extend-after-mouse-selection.html - https://bugs.webkit.org/show_bug.cgi?id=30827 + * editing/SelectionController.cpp: + (WebCore::SelectionController::positionForPlatform): + (WebCore::SelectionController::startForPlatform): + (WebCore::SelectionController::endForPlatform): + (WebCore::SelectionController::modifyExtendingRight): + (WebCore::SelectionController::modifyExtendingForward): + (WebCore::SelectionController::modifyMovingForward): + (WebCore::SelectionController::modifyExtendingBackward): + (WebCore::SelectionController::modifyMovingBackward): + * editing/SelectionController.h: - Test: fast/css/end-of-buffer-crash.html +2010-02-18 Timothy Hatcher - * css/maketokenizer: Add comments, fix off-by-one. + Add "with" to the list of keywords to syntax highlight. -2009-11-02 Darin Adler + http://webkit.org/b/35123 - Reviewed by Dan Bernstein. + Reviewed by Pavel Feldman. - Crash due to double-destroy related to CSS run-in property - https://bugs.webkit.org/show_bug.cgi?id=31034 - rdar://problem/7328458 + * inspector/front-end/SourceJavaScriptTokenizer.js: + (WebInspector.SourceJavaScriptTokenizer): Add "width" to _keywords. + * inspector/front-end/SourceJavaScriptTokenizer.re2js: + (WebInspector.SourceJavaScriptTokenizer): Ditto. - Test: fast/css/run-in-crash.html +2010-02-17 Peter Kasting - * rendering/RenderBlock.cpp: - (WebCore::RenderBlock::destroy): Reorder destruction so the - continuation is destroyed after anonymous children. See comment - in the code for more details of why this is right. - * rendering/RenderInline.cpp: - (WebCore::RenderInline::destroy): Ditto. + Reviewed by Adam Barth. -2009-10-30 Kenneth Rohde Christiansen + Rework PNG-in-ICO decoding to copy the decoded framebuffer into the ICO + decoder, making the logic less crazy and more like the other decoders. + https://bugs.webkit.org/show_bug.cgi?id=28751 - Reviewed by Holger Hans Peter Freyther. + * platform/image-decoders/ImageDecoder.cpp: + (WebCore::RGBA32Buffer::operator=): + * platform/image-decoders/ImageDecoder.h: + (WebCore::RGBA32Buffer::RGBA32Buffer): + * platform/image-decoders/ico/ICOImageDecoder.cpp: + (WebCore::ICOImageDecoder::frameBufferAtIndex): + (WebCore::ICOImageDecoder::decodeAtIndex): + * platform/image-decoders/ico/ICOImageDecoder.h: + * platform/image-decoders/qt/RGBA32BufferQt.cpp: + (WebCore::RGBA32Buffer::operator=): + * platform/image-decoders/skia/ImageDecoderSkia.cpp: + (WebCore::RGBA32Buffer::operator=): - If the owner widget of the page has a palette set, we - should use that one. This was only working when the - owner was a QWebView. This patch fixes that. +2010-02-18 Pavel Feldman - * platform/qt/RenderThemeQt.cpp: - (WebCore::RenderThemeQt::applyTheme): - -2009-10-29 Xan Lopez + Reviewed by Timothy Hatcher. - Reviewed by Oliver Hunt. + Web Inspector: multiple popovers on screen at the same time. - [GTK] Threading problems with some of the tests - https://bugs.webkit.org/show_bug.cgi?id=30814 + https://bugs.webkit.org/show_bug.cgi?id=35105 - Create strings shared among threads with crossThreadString - constructor method. + * inspector/front-end/Popover.js: + (WebInspector.Popover.prototype.show): + (WebInspector.Popover.prototype.hide): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._showPopup): - * storage/Database.cpp: - (WebCore::Database::Database): +2010-02-18 Pavel Feldman -2009-10-30 Tor Arne Vestbø + Reviewed by Timothy Hatcher. - Reviewed by NOBODY (OOPS!). + Web Inspector: Expand Object.__proto__ properly. - [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml() + https://bugs.webkit.org/show_bug.cgi?id=35113 - This ensures that long-running JavaScript (for example due to a modal alert() dialog), - will not trigger a deferred load after only 500ms (the default tokenizer delay) while - still giving a reasonable timeout (10 seconds) to prevent deadlock. + * inspector/front-end/EventListenersSidebarPane.js: + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/ObjectProxy.js: + (WebInspector.ObjectProxy): + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + * inspector/front-end/inspector.js: + (WebInspector.log.logMessage): + (WebInspector.log): - https://bugs.webkit.org/show_bug.cgi?id=29381 +2010-02-18 Nate Chapin - * html/HTMLTokenizer.cpp: Change debug output to print the actual tokenizer delay + Reviewed by Adam Barth. -2009-10-30 Tor Arne Vestbø + [V8] Merge the DOMWindow and WorkerContext object wrapping code paths, + and use a faster method of disambiguating between the types of contexts. - Reviewed by NOBODY (OOPS!). + https://bugs.webkit.org/show_bug.cgi?id=35009 - Clear the initial request when loading synchronously to prevent duplicate loads + * bindings/scripts/CodeGeneratorV8.pm: Remove logic determining whether we need to + handle the WorkerContext case. + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::globalObjectPrototypeIsDOMWindow): + (WebCore::V8DOMWrapper::instantiateV8Object): Merge instantiateV8Object paths. + * bindings/v8/V8DOMWrapper.h: - MainResourceLoader uses the member m_initialRequest to store a request for future - deferred loads. When doing a synchronous load, in handleDataLoadNow(), we therefore - have to clear this request so that subsequent entries into the loader will not start - yet another load. +2010-02-18 Xan Lopez - This can for example happen in setDefersLoading() as a result of a PageGroupLoadDeferrer - going out of scope when returning from Chrome::runJavaScriptAlert(), where the alert() - came from a script executed as part of the first/original load. + Reviewed by Gustavo Noronha. - https://bugs.webkit.org/show_bug.cgi?id=30879 + Remove some duplication between PluginView and Widget methods, and + move the setSelfVisible calls to the parent class. - * loader/MainResourceLoader.cpp: - (WebCore::MainResourceLoader::handleDataLoadNow): clear m_initialRequest + * platform/gtk/WidgetGtk.cpp: + (WebCore::Widget::show): + (WebCore::Widget::hide): + * plugins/gtk/PluginViewGtk.cpp: + (WebCore::PluginView::setFocus): + (WebCore::PluginView::show): + (WebCore::PluginView::hide): -2009-11-04 Jocelyn Turcotte +2010-02-18 Simon Fraser - Reviewed by Timothy Hatcher. + Reviewed by Darin Adler. - WebInspector: Use a different method to identify the webkit port in - InspectorBackent::platform(). - This corrects the inspector expected behavior with Qt on Windows. - https://bugs.webkit.org/show_bug.cgi?id=31116 + Switch Leopard back to using CGShading to avoid CGGradient leaks - * inspector/InspectorBackend.cpp: - (WebCore::InspectorBackend::platform): - (WebCore::InspectorBackend::port): - * inspector/InspectorBackend.h: - * inspector/InspectorBackend.idl: - * inspector/front-end/InspectorControllerStub.js: - (.WebInspector.InspectorControllerStub.prototype.port): - * inspector/front-end/inspector.css: - * inspector/front-end/inspector.js: - (WebInspector.loaded): - (WebInspector.toolbarDragStart): + Define USE_CG_SHADING on for Tiger and Leopard, and use it to toggle the methods + used for Core Graphics gradient drawing. -2009-11-12 Benjamin Poulain + * platform/graphics/Gradient.h: + * platform/graphics/cg/GradientCG.cpp: + (WebCore::Gradient::platformDestroy): + (WebCore::Gradient::paint): - Reviewed by Kenneth Rohde Christiansen. +2010-02-18 Pavel Feldman - Custom printing shrink factors - https://bugs.webkit.org/show_bug.cgi?id=29042 + Reviewed by Timothy Hatcher. - This reverts commit r49769. The public API for this needs to be reviewed - before its inclusion in Qt. + Web Inspector: on-hover evaluation renders nodes and arrays as strings. - * page/PrintContext.cpp: - (WebCore::PrintContext::begin): - * page/Settings.cpp: - (WebCore::Settings::Settings): - * page/Settings.h: + https://bugs.webkit.org/show_bug.cgi?id=35103 -2009-11-09 Norbert Leser + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup): - Reviewed by Kenneth Rohde Christiansen. +2010-02-18 Brady Eidson - Moved macro MMP_RULES (LINKEROPTION) into symbian instead of symbian-sbsv2, - since adjustment of RW-section base address will be needed for all new symbian - tool chains, specifically for arm and gcc compilation targets. - Also, change target address to 0xE00000 to be sufficient for all targets. + Reviewed by Sam Weinig. - * WebCore.pro: + Particularly constructed WebFrames can try to access a null HistoryItem + and https://bugs.webkit.org/show_bug.cgi?id=35063 -2009-11-11 Jocelyn Turcotte + Test: fast/loader/api-test-new-window-data-load-base-url.html - Reviewed by Eric Seidel. + * loader/HistoryController.cpp: + (WebCore::HistoryController::updateBackForwardListForFragmentScroll): We have a known case where a fragment scroll + might take place with a null m_currentItem. updateBackForwardListClippedAtTarget() will either move m_currentItem + to m_previousItem then create a new m_currentItem... or it will do nothing. So we either have both an m_currentItem + and m_previousItem, or we have neither. In the case where we have no m_previousItem, return early. - [Qt] Make the default style background color valid. - Currently the color is transparent but invalid, this causes - list boxes in QtWebKit to be drawn with a black background - since r49242. - https://bugs.webkit.org/show_bug.cgi?id=31295 +2010-02-18 Nate Chapin - * rendering/style/RenderStyle.h: - (WebCore::InheritedFlags::initialBackgroundColor): - * rendering/style/StyleBackgroundData.cpp: - (WebCore::StyleBackgroundData::StyleBackgroundData): + Reviewed by Eric Seidel. -2009-11-11 Simon Hausmann + [V8] Correctly handle the case where the event field on the + global object is a v8::Object, but not a DOM wrapper. - Reviewed by Tor Arne Vestbø. + https://bugs.webkit.org/show_bug.cgi?id=34899 - Introduce a function for querying the input method status - in QWebPageClient. + Test: fast/dom/Window/window-event-override-no-crash.html - * platform/qt/QWebPageClient.h: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::V8DOMWrapper::isValidDOMObject): + (WebCore::V8DOMWrapper::isWrapperOfType): + * bindings/v8/V8DOMWrapper.h: -2009-11-09 Yael Aharon +2010-02-18 Pavel Feldman - Reviewed by Kenneth Rohde Christiansen. + Not reviewed, Qt build fix. - [Qt] Pass credentials provided by XMLHTTPRequest to the network request. - https://bugs.webkit.org/show_bug.cgi?id=31208 + * inspector/front-end/WebKit.qrc: - After r42483, the credentials are no longer passed to the network request - in the URL of the request. - Pass the credentials from XMLHTTPRequest to the network request, the same - way that other ports do. +2010-02-18 Pavel Feldman - After this patch LayoutTests/http/xmlhttprequest/basic-auth.html passes. + Reviewed by Timothy Hatcher. - * platform/network/qt/ResourceHandleQt.cpp: - (WebCore::ResourceHandle::start): - (WebCore::ResourceHandle::loadResourceSynchronously): + Web Inspector: Implement evaluate-on-hover for scripts panel. -2009-11-03 Simon Hausmann + https://bugs.webkit.org/show_bug.cgi?id=35003 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/Images/gearButtonGlyph.png: Added. + * inspector/front-end/Images/popoverArrows.png: Added. + * inspector/front-end/Images/popoverBackground.png: Added. + * inspector/front-end/Images/thumbActiveHoriz.png: Added. + * inspector/front-end/Images/thumbActiveVert.png: Added. + * inspector/front-end/Images/thumbHoriz.png: Added. + * inspector/front-end/Images/thumbHoverHoriz.png: Added. + * inspector/front-end/Images/thumbHoverVert.png: Added. + * inspector/front-end/Images/thumbVert.png: Added. + * inspector/front-end/Images/trackHoriz.png: Added. + * inspector/front-end/Images/trackVert.png: Added. + * inspector/front-end/Popup.js: + (WebInspector.Popup): + (WebInspector.Popup.prototype.show): + (WebInspector.Popup.prototype.hide): + (WebInspector.Popup.prototype._positionElement): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._createViewerIfNeeded): + (WebInspector.SourceFrame.prototype._scroll): + (WebInspector.SourceFrame.prototype._mouseDown): + (WebInspector.SourceFrame.prototype._mouseUp): + (WebInspector.SourceFrame.prototype._mouseMove): + (WebInspector.SourceFrame.prototype._mouseOut): + (WebInspector.SourceFrame.prototype._resetHoverTimer): + (WebInspector.SourceFrame.prototype._hidePopup): + (WebInspector.SourceFrame.prototype._mouseHover): + (WebInspector.SourceFrame.prototype._showPopup.showTextPopup): + (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup): + (WebInspector.SourceFrame.prototype._showPopup.evaluateCallback): + (WebInspector.SourceFrame.prototype._showPopup): + (WebInspector.HoverPropertiesSection): + (WebInspector.HoverPropertiesSection.prototype.update): + * inspector/front-end/TextEditorHighlighter.js: + (WebInspector.TextEditorHighlighter): + (WebInspector.TextEditorHighlighter.prototype._lex): + * inspector/front-end/TextViewer.js: + (WebInspector.TextViewer.prototype._paintLine): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.html: + * inspector/front-end/inspectorSyntaxHighlight.css: + * inspector/front-end/popover.css: Added. - Unreviewed build fix for WebInspector with Qt build. +2010-02-18 Ben Murdoch - Simply re-generate the Qt resource file by running - WebKitTools/Scripts/generate-qt-inspector-resource + Reviewed by Jeremy Orlow. - * inspector/front-end/WebKit.qrc: + [v8] Complete upstreaming of V8 Touch Event bindings + https://bugs.webkit.org/show_bug.cgi?id=35094 -2009-11-03 Simon Hausmann + No new tests required. - Reviewed by Tor Arne Vestbø. + * bindings/v8/V8Index.cpp: Add generated touch event headers. - Make QWebPluginDatabase private API for now. +2010-02-18 Steve Block - https://bugs.webkit.org/show_bug.cgi?id=30775 + Reviewed by Jeremy Orlow. - * WebCore.pro: + Updates Android V8 build to use DerivedSourcesAllInOne.cpp + https://bugs.webkit.org/show_bug.cgi?id=35083 -2009-11-03 Simon Hausmann + No new tests, build fix only. - Reviewed by Tor Arne Vestbø. + * Android.derived.v8bindings.mk: + * Android.v8bindings.mk: - Extended the conversion of the WebCore ResourceRequest to the - QNetworkRequest with a mandatory originating object argument, - which is meant to be the QWebFrame the request belongs to. +2010-02-18 Gustavo Noronha Silva - https://bugs.webkit.org/show_bug.cgi?id=29975 + Reviewed by Xan Lopez. - * platform/network/qt/QNetworkReplyHandler.cpp: - (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): - (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): - (WebCore::QNetworkReplyHandler::start): - * platform/network/qt/ResourceRequest.h: - * platform/network/qt/ResourceRequestQt.cpp: - (WebCore::ResourceRequest::toNetworkRequest): + fast/frames/iframe-reparenting.html crashing on GTK Debug bots + https://bugs.webkit.org/show_bug.cgi?id=35081 -2009-11-02 Jedrzej Nowacki + Check that the client is alive after every call to it, since any + of them could cause the load to be cancelled, and the client to go + away. - Reviewed by Adam Barth. + This is much better than protecting a specific subclass of + ResourceHandleClient (ResourceLoader), which makes us fail when + any other client is used. - QWebView crash fix. + Test: fast/frames/iframe-reparenting.html - The QWebView should not crash if the stop() method is called from - a function triggered by the loadProgress signal. + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::parseDataUrl): - A null pointer protection was added in the ProgressTracker::incrementProgress. +2010-02-18 Ben Murdoch - New autotest was created. + Reviewed by Nate Chapin. - https://bugs.webkit.org/show_bug.cgi?id=29425 + [v8] [Android] V8 bindings for touch events are missing. + https://bugs.webkit.org/show_bug.cgi?id=33795 - * loader/ProgressTracker.cpp: - (WebCore::ProgressTracker::incrementProgress): + No new tests as this just enables touch events in V8. Existing touch tests suffice. -2009-11-02 Kai Koehne + * WebCore.gypi: Add Touch idl files. + * bindings/scripts/CodeGeneratorV8.pm: Add TouchList to typeCanFailConversion map. + * bindings/v8/DOMObjectsInclude.h: Add touch headers. + * bindings/v8/DerivedSourcesAllInOne.cpp: Add touch generated bindings. + * bindings/v8/V8Index.h: Add touch DOM object types. + * bindings/v8/custom/V8EventCustom.cpp: Add conversion of event to touch event. + * Android.derived.jscbindings.mk: Add the touch derived sources to the makefile. + * Android.derived.v8bindings.mk: Add the touch derived sources to the makefile. - Reviewed by Holger Freyther. +2010-02-18 William Chan - Remove implementation of ImageDecocerQt::clearFrameBufferCache. - The implementation was buggy, and will visually break repeating - animations anyway. + Reviewed by Adam Barth. - https://bugs.webkit.org/show_bug.cgi?id=31009 + https://bugs.webkit.org/show_bug.cgi?id=35071 + Disable loader limiting of requests per host for the chromium port. - * platform/graphics/qt/ImageDecoderQt.cpp: - (WebCore::ImageDecoderQt::clearFrameBufferCache): + No tests because we're only changing a constant. -2009-11-01 Yael Aharon + * platform/network/chromium/ResourceRequest.cpp: + (WebCore::initializeMaximumHTTPConnectionCountPerHost): - Reviewed by Darin Adler. +2010-02-18 Xan Lopez - Don't add '/' to the URL path if the it does not include '/' after the protocol component - https://bugs.webkit.org/show_bug.cgi?id=30971 + Reviewed by Eric Seidel. - Match IE8 behaviour, that does not add '/' if there is none after the protocol component. + [Linux] Webkit incompatible with Java plugins + https://bugs.webkit.org/show_bug.cgi?id=24912 - * platform/KURL.cpp: - (WebCore::KURL::parse): + The NP Version supported by WebKit is at the moment hardcoded in + PluginPackage.cpp (to 24), but not all backends actually implement + the methods needed to claim this. Introduce a new method to be + implemented by each backend where the maximum supported version + can be specified, and set the GTK+ port NPVersion to 19. This + fixes an instantaneous crasher in the Sun Java NPAPI plugin. -2009-10-30 Kenneth Rohde Christiansen + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::initializeBrowserFuncs): + * plugins/PluginPackage.h: + * plugins/gtk/PluginPackageGtk.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/mac/PluginPackageMac.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/qt/PluginPackageQt.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/symbian/PluginPackageSymbian.cpp: + (WebCore::PluginPackage::NPVersion): + * plugins/win/PluginPackageWin.cpp: + (WebCore::PluginPackage::NPVersion): - Reviewed by Holger Hans Peter Freyther. +2010-02-17 Dmitry Titov - If the owner widget of the page has a palette set, we - should use that one. This was only working when the - owner was a QWebView. This patch fixes that. + Reviewed by David Levin, Darin Fisher, Simon Hausmann. - * platform/qt/RenderThemeQt.cpp: - (WebCore::RenderThemeQt::applyTheme): + When a live iframe element is moved between pages, it still depends on the old page. + https://bugs.webkit.org/show_bug.cgi?id=34382 -2009-10-29 Laszlo Gombos + Test: fast/frames/iframe-reparenting-new-page.html - Reviewed by Tor Arne Vestbø. + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::setName): + Move the code setting the frame name into a separate function. - [Qt] Implement DELETE HTTP method for XmlHttpRequest - https://bugs.webkit.org/show_bug.cgi?id=30894 + (WebCore::HTMLFrameElementBase::setNameAndOpenURL): + (WebCore::HTMLFrameElementBase::updateOnReparenting): + Called on the frame that was just re-parented and inserted into another Document. + Simply invoke Frame::transferChildFrameToNewDocument(...); - No new tests as this functionality is already tested by the - xmlhttprequest LayoutTests. As this patch depends on an unreleased - version of the dependent QtNetwork library and the tests will be - enabled later once the dependent library is released (and the - buildbot is updated). + (WebCore::HTMLFrameElementBase::insertedIntoDocument): + * html/HTMLFrameElementBase.h: + * html/HTMLFrameOwnerElement.h: + (WebCore::HTMLFrameOwnerElement::setName): + Make this a virtual function, to be able to reach it via Frame::m_ownerElement. - * platform/network/qt/QNetworkReplyHandler.cpp: - (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): - (WebCore::QNetworkReplyHandler::start): + * loader/EmptyClients.h: + (WebCore::EmptyFrameLoaderClient::adoptFrame): + * loader/FrameLoaderClient.h: + Add a new method, didTransferChildFrameToNewDocument(). + It compliments createFrame() in that a frame which was re-parented + in DOM and potentially changes Page, should notify the WebKit + implementation about potential ownership change. + Many embedders assume that Page owns all the Frames, or at least + all Frames are destroyed before 'their' Page is destroyed. Obviously, if Frame + can be transferred to another Page, the embedders should be notified. -2009-11-02 Tor Arne Vestbø + * page/Frame.cpp: + (WebCore::Frame::transferChildFrameToNewDocument): + Added, makes actual adjustments for Frame - resets the Page, + updates the frame tree and frame name, calls to FrameLoaderClient + to update external objects and recurses into children. + Can only be used on child frames. - Rubber-stamped by Antti Koivisto. + * page/Frame.h: - [Qt] Build fix for Windows CE +2010-02-17 Tony Chang - * plugins/PluginDatabase.cpp: + Reviewed by Eric Seidel. -2009-11-02 Jocelyn Turcotte + Copying and pasting into a contenteditable area can create

s surrounded by s + https://bugs.webkit.org/show_bug.cgi?id=26937 - Reviewed by Tor Arne Vestbø. + This happens because of a span added when we copy that is used to + preserve styles. To avoid this, when we paste, make sure to apply + the styles to the span's children and then remove the style span. - [Qt] Fix Qt build on Windows. - https://bugs.webkit.org/show_bug.cgi?id=30905 + This change is covered by existing layout tests. - * WebCore.pro: - * platform/graphics/BitmapImage.h: - * platform/graphics/qt/ImageQt.cpp: - (WebCore::BitmapImage::BitmapImage): - (WebCore::BitmapImage::create): + * editing/ReplaceSelectionCommand.cpp: + (WebCore::ReplaceSelectionCommand::handleStyleSpans): + (WebCore::ReplaceSelectionCommand::copyStyleToChildren): + * editing/ReplaceSelectionCommand.h: -2009-10-28 Adam Barth +2010-02-17 Tony Chang Reviewed by Eric Seidel. - Don't run JavaScript URLs in view source mode - https://bugs.webkit.org/show_bug.cgi?id=30881 + https://bugs.webkit.org/show_bug.cgi?id=34914 + When pasting absolute font sizes into a content editable area with + page zoom, adjust the font sizes to be the same after page zoom is + applied. - Just say no. + Test: editing/pasteboard/page-zoom.html - Test: http/tests/security/view-source-no-javascript-url.html - - * bindings/ScriptControllerBase.cpp: - (WebCore::ScriptController::executeIfJavaScriptURL): + * editing/ReplaceSelectionCommand.cpp: + (WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance): -2009-10-29 Gustavo Noronha Silva +2010-02-17 Tony Chang - Unreviewed. Fixes style problems pointed out by Evan Martin. + Reviewed by Eric Seidel. - * platform/gtk/Language.cpp: - (WebCore::defaultLanguage): + https://bugs.webkit.org/show_bug.cgi?id=34737 + Copying styled list items then pasting into a list + should work the same as copying unstyle list items: + it shouldn't indent an extra level, but styles should + be copied. -2009-10-29 Dan Bernstein + Small cleanups to insertAsListItems to make variable names + more descriptive. - Rubber-stamped by Mark Rowe. + Test: editing/pasteboard/paste-list-003.html - 64-bit Leopard build fix after r50259 - - * platform/graphics/mac/ComplexTextControllerATSUI.cpp: - Declared ATSUTextInserted in 64-bit. - (WebCore::fontHasMirroringInfo): Use %d format and cast to int. - (WebCore::disableLigatures): Ditto. - (WebCore::initializeATSUStyle): Ditto. - (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Ditto. + * editing/ReplaceSelectionCommand.cpp: + (WebCore::ReplaceSelectionCommand::doApply): + (WebCore::ReplaceSelectionCommand::insertAsListItems): -2009-10-29 Dan Bernstein +2010-02-17 Kwang Yul Seo - Tiger build fix after r50259 + Reviewed by Eric Seidel. - * platform/graphics/mac/ComplexTextController.h: - * platform/graphics/mac/ComplexTextControllerATSUI.cpp: + [BREWMP] Port PlatformKeyboardEvent + https://bugs.webkit.org/show_bug.cgi?id=34794 -2009-10-29 Dan Bernstein + Retrieve the type, key code, text and modifiers from BREW's keyboard event. - Attempted Tiger build fix after r50259 + * platform/PlatformKeyboardEvent.h: + * platform/brew/PlatformKeyboardEventBrew.cpp: Added. + (WebCore::keyIdentifierForBrewKeyCode): + (WebCore::windowsKeyCodeForKeyEvent): + (WebCore::singleCharacterString): + (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): + (WebCore::PlatformKeyboardEvent::disambiguateKeyDownEvent): + (WebCore::PlatformKeyboardEvent::currentCapsLockState): - * platform/graphics/mac/ComplexTextControllerATSUI.cpp: +2010-02-17 Hayato Ito -2009-10-28 Steve Falkenburg + Reviewed by Eric Seidel. - Rubber stamped by Mark Rowe. + Support CSS page-break-inside with a value of 'avoid'. - https://bugs.webkit.org/show_bug.cgi?id=30899 - WebKit fails to build release on 32-bit Windows systems + https://bugs.webkit.org/show_bug.cgi?id=34080 - * WebCore.vcproj/WebCore.vcproj: Excluded files from project. - * bindings/js/JSBindingsAllInOne.cpp: Added. + Test: printing/page-break-inside.html -2009-10-28 Dan Bernstein + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::paintChildren): - Reviewed by Jon Honeycutt. +2010-02-17 Fumitoshi Ukai - Fixed typos in color names. + Reviewed by Alexey Proskuryakov. - * inspector/front-end/Color.js: + WebSocket bufferedAmount should not be 0 when send after close. + https://bugs.webkit.org/show_bug.cgi?id=34633 -2009-10-28 Dan Bernstein + Fixed bug in webkit r54694. check m_client after it calls user + callback, because user callback may call close(), which would + call onclose event handler. + + Test: websocket/tests/bufferedAmount-after-close.html - Reviewed by Sam Weinig. + * websockets/ThreadableWebSocketChannelClientWrapper.h: + (WebCore::ThreadableWebSocketChannelClientWrapper::didClose): + * websockets/WebSocket.cpp: + (WebCore::WebSocket::WebSocket): + (WebCore::WebSocket::send): + (WebCore::WebSocket::close): + (WebCore::WebSocket::bufferedAmount): + (WebCore::WebSocket::didConnect): + (WebCore::WebSocket::didClose): + * websockets/WebSocket.h: + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::WebSocketChannel): + (WebCore::WebSocketChannel::send): + (WebCore::WebSocketChannel::bufferedAmount): + (WebCore::WebSocketChannel::didClose): + (WebCore::WebSocketChannel::didReceiveData): + * websockets/WebSocketChannel.h: + * websockets/WebSocketChannelClient.h: + (WebCore::WebSocketChannelClient::didClose): + * websockets/WorkerThreadableWebSocketChannel.cpp: + (WebCore::workerContextDidClose): + (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose): + * websockets/WorkerThreadableWebSocketChannel.h: - Share code between the ATSUI- and Core Text-based Font implementations by doing the - following: - - Generalize CoreTextController as ComplexTextController, keeping the Core Text-specific - parts in ComplexTextControllerCoreText.cpp. - - Generalize FontMacCoreText as FontComplexTextMac using ComplexTextController - - Implement ATSUI-specific parts of ComplexTextController in ComplexTextControllerATSUI. - - Remove FontMacATSUI. - - * WebCore.xcodeproj/project.pbxproj: Removed CoreTextController.{cpp,h}, FontMacATSUI.mm, - and FontMacCoreText.cpp, and added ComplexTextController.{cpp,h}, - ComplexTextControllerATSUI.cpp, ComplexTextControllerCoreText.cpp, and - FontComplexTextMac.cpp. - - * platform/graphics/mac/ComplexTextController.cpp: Copied from CoreTextController.cpp and - kept the non-Core Text-specific bits. - (WebCore::ComplexTextController::ComplexTextController): Updated for renames, including - its own. - (WebCore::ComplexTextController::offsetForPosition): Updated for renames and for - m_complexTextRuns holding references instead of objects. - (WebCore::ComplexTextController::collectComplexTextRuns): Updated for renames, including - its own. - (WebCore::ComplexTextController::advance): Updated for renames. - (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Updated for renames and for - m_complexTextRuns holding references instead of objects, and changed to use the glyphs() - and advances() accessors. - - * platform/graphics/mac/ComplexTextController.h: Copied from CoreTextController.h and - renamed CoreTextController to ComplexTextController and CoreTextRun to ComplexTextRun. Made - the latter RefCounted, added ATSUI-specific members to it, and made some other members - Core Text-specific. Renamed m_coreTextRuns to m_complexTextRuns and made it hold references - rather than objects. - (WebCore::ComplexTextController::ComplexTextRun::create): - (WebCore::ComplexTextController::ComplexTextRun::glyphs): - (WebCore::ComplexTextController::ComplexTextRun::advances): - - * platform/graphics/mac/ComplexTextControllerATSUI.cpp: Added. Includes ATSUI-specific - parts of the ComplexTextController implementation. - (WebCore::ComplexTextController::ComplexTextRun::overrideLayoutOperation): This ATSUI - callback populates the ComplexTextRun’s glyphs, advances and indices vectors. It is invoked - when the ComplexTextRun constructor calls ATSUGetGlyphBounds(). - (WebCore::isArabicLamWithAlefLigature): Helper function, copied from FontMacATSUI.mm. - (WebCore::shapeArabic): Helper function, adapted from FontMacATSUI.mm. - (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Sets up the - ATSUTextLayout, substituting the text buffer if necessary for things like shaping Arabic, - mirroring glyphs or directionality overrides, then calls ATSUGetGlyphBounds() in order to - get the glyphs, advances and indices vectors populated. - (WebCore::fontHasMirroringInfo): Helper function, copied from FontMacATSUI.mm. - (WebCore::disableLigatures): Ditto. - (WebCore::initializeATSUStyle): Ditto, somewhat cleaned up and simplified. - (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Constructs - ComplexTextRuns, either missing-glyphs ones or ATSUTextLayout-based ones. - - * platform/graphics/mac/ComplexTextControllerCoreText.cpp: Copied from - CoreTextController.cpp and kept the Core Text-specific bits. - (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Updated for renames, - including its own, and moved the code to initialize m_glyphs and m_advances here. Previously - this was done in adjustGlyphsAndAdvances(). - (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Updated for renames, - including its own. - * platform/graphics/mac/CoreTextController.cpp: Removed. - * platform/graphics/mac/CoreTextController.h: Removed. - * platform/graphics/mac/FontComplexTextMac.cpp: Renamed FontMacCoreText.cpp to this. - (WebCore::Font::selectionRectForComplexText): Changed to use ComplexTextController instead - of CoreTextController. - (WebCore::Font::drawComplexText): Ditto. - (WebCore::Font::floatWidthForComplexText): Ditto. - (WebCore::Font::offsetForPositionForComplexText): Ditto. - * platform/graphics/mac/FontMacATSUI.mm: Removed. - * platform/graphics/mac/FontMacCoreText.cpp: Removed. - -2009-10-27 Chris Fleizach +2010-02-17 Yuzo Fujishima - Reviewed by Darin Adler. + Reviewed by Eric Seidel. - WAI-ARIA: add support for 'option' role - https://bugs.webkit.org/show_bug.cgi?id=30843 + In diffing render styles, consider all pseudo style changes. + Without this patch, only :before and :after are considered. This is the cause of the following bug. + https://bugs.webkit.org/show_bug.cgi?id=32187 - Test: accessibility/aria-option-role.html + Test: fast/css/first-letter-first-line-hover.html - * accessibility/AccessibilityListBoxOption.h: - (WebCore::AccessibilityListBoxOption::canHaveChildren): - * accessibility/AccessibilityRenderObject.cpp: - (WebCore::RoleEntry::): - (WebCore::AccessibilityRenderObject::canHaveChildren): + * dom/Node.cpp: + (WebCore::Node::diff): + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::hasAnyPublicPseudoStyles): + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyleConstants.h: + (WebCore::): -2009-10-28 Jens Alfke +2010-02-17 Kwang Yul Seo Reviewed by Eric Seidel. - Fix GCC compiler warnings in WebCore, and enable -Wall and -Werror for Chromium build. - https://bugs.webkit.org/show_bug.cgi?id=30716 + [BREWMP] Add WebCore::prefetchDNS + https://bugs.webkit.org/show_bug.cgi?id=34873 - * WebCore.gyp/WebCore.gyp: Enable "chromium_code" flag, just on Mac build for now. - * accessibility/AccessibilityRenderObject.cpp: - (WebCore::createARIARoleMap): Fix struct visibiity warning. - * bindings/v8/ScriptCallStack.h: Fix out-of-order member initialization warning. - * bindings/v8/V8Collection.h: - (WebCore::getV8Object): Function in header should not be 'static' (fixes unused-static warning.) - * bindings/v8/V8DOMWrapper.cpp: - (WebCore::V8DOMWrapper::convertNewNodeToV8Object): Fix signed/unsigned comparison warning. - * bindings/v8/V8GCController.cpp: - (WebCore::ObjectGrouperVisitor::applyGrouping): Fix unused-variable warning. - * css/CSSPrimitiveValueMappings.h: - (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Enable ListButtonPart case to avoid - warning about missing cases in 'switch' statement. - * editing/EditorCommand.cpp: - (WebCore::createCommandMap): Fix struct visibiity warning. - * platform/graphics/skia/PlatformContextSkia.cpp: - (PlatformContextSkia::State::State): Fix out-of-order member initialization warning. - * rendering/RenderMediaControlsChromium.cpp: - (WebCore::RenderMediaControlsChromium::shouldRenderMediaControlPart): Add empty 'default' case in - 'switch' statement to avoid missing-case warning. - (WebCore::RenderMediaControlsChromium::paintMediaControlsPart): Ditto. - * xml/XPathFunctions.cpp: - (WebCore::XPath::createFunctionMap): Fix struct visibiity warning. + DNS prefetching is not implemented because the maximum number + of UDP sockets is quite small in most BREW devices. -2009-10-29 Adam Barth + * platform/network/brew/DNSBrew.cpp: Added. + (WebCore::prefetchDNS): - Reviewed by Darin Adler. +2010-02-17 Kent Tamura - REGRESSION: crashes in WebCore::RedirectScheduler::timerFired(WebCore::Timer*) - https://bugs.webkit.org/show_bug.cgi?id=30839 + Reviewed by Eric Seidel. - Added null check for the case when the frame is detached from the page. + Introduces new Icon loading interface in order to support + asynchronous loading. + https://bugs.webkit.org/show_bug.cgi?id=32054 - * loader/RedirectScheduler.cpp: - (WebCore::RedirectScheduler::timerFired): + It's hard for Chromium port to load an icon inside + Icon::createIconForFiles() because of sanbox and multi-process + architecture. So this change adds a method to request an icon to + Chrome class, and makes FileChooser receives an Icon instance + asynchronously. Synchronous loading also works with the new interface. -2009-10-28 Joanmarie Diggs + Because all ports don't have implementations of Chrome::iconForFiles() + yet, FileChooser tries to load an Icon synchronously with + Icon::createIconForFiles(), then tries to load an Icon asynchronously + with Chrome::iconForFiles() if Icon::createIconForFiles() returns 0. - Reviewed by Xan Lopez. + The existing Icon::createIconForFiles() implementations should be + moved to Chrome::iconForFiles(). We're going to remove + Icon::createIconForFiles(). - https://bugs.webkit.org/show_bug.cgi?id=30817 - Use parentObjectUnignored instead of parentObject in webkit_accessible_get_parent + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::iconForFiles): Add an empty implementation. + * page/Chrome.cpp: + (WebCore::Chrome::iconForFiles): Delegate to ChromeClient::iconForFiles(). + * page/Chrome.h: + * page/ChromeClient.h: + (WebCore::ChromeClient::iconForFiles): Add a declaration as a pure virtual method. + * platform/FileChooser.cpp: + (WebCore::FileChooser::FileChooser): Use loadIcon(). + (WebCore::FileChooser::chooseFiles): ditto. + (WebCore::FileChooser::loadIcon): Added. + (WebCore::FileChooser::iconLoaded): Added. + * platform/FileChooser.h: Add two methods to FileChooserClient; repaint() and iconForFiles(). + * platform/graphics/Icon.h: Add a FIXME comment. + * platform/graphics/gtk/IconGtk.cpp: ditto. + * platform/graphics/mac/IconMac.mm: ditto. + * platform/graphics/qt/IconQt.cpp: ditto. + * platform/graphics/win/IconWin.cpp: ditto. + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::iconForFiles): Delegate to Chrome::iconForFiles(). + (WebCore::RenderFileUploadControl::click): Use chrome(). + (WebCore::RenderFileUploadControl::chrome): + * rendering/RenderFileUploadControl.h: + (WebCore::RenderFileUploadControl::repaint): - Also removes the hack I had originally added to solve bug 25411, because - the fix here is what I should have done in the first place. +2010-02-17 Mark Rowe - * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: - (webkit_accessible_get_parent): + Reviewed by Darin Adler. -2009-10-28 Dmitry Titov + Bug 35065: Delay between page loading and animated GIF playing + / - Reviewed by David Levin. + BitmapImage::startAnimation was adding the current frame duration to the desired start time + of the frame for every time it was called. If the function then bailed out due to not having + sufficient data to render the frame, this would lead to the desired start time of the frame + being pushed out multiple times. On an animated GIF that took mulitple seconds to load this + could happen many times for a single frame, resulting in the start time of the second frame + of the animation being pushed out by as much as five seconds. - https://bugs.webkit.org/show_bug.cgi?id=30805 - Add MessageQueue::removeIf(Predicate&) to remove certain tasks without pulling them from the queue. - Existing Database tests cover this, no change in functionality. + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::startAnimation): Change the order of the code slightly so that the + desired start time is only updated after determining that we have sufficient data to handle + the next frame. - * storage/DatabaseThread.cpp: - (WebCore::SameDatabasePredicate::SameDatabasePredicate): Added predicate that flags the tasks belonging to a specified database. - (WebCore::SameDatabasePredicate::operator()): - (WebCore::DatabaseThread::unscheduleDatabaseTasks): changed to use the new removeIf method. +2010-02-17 Stephan Aßmus -2009-10-28 Pavel Feldman + Reviewed by Eric Seidel. - Reviewed by Timothy Hatcher. + Implemented homeDirectoryPath() and listDirectory() on the Haiku platform. + https://bugs.webkit.org/show_bug.cgi?id=34687 - Web Inspector: Glue subsequent timeline records with same category - and title together. + Covered by existing tests. - https://bugs.webkit.org/show_bug.cgi?id=30885 + * platform/haiku/FileSystemHaiku.cpp: + (WebCore::homeDirectoryPath): Implemented + (WebCore::listDirectory): Implemented - * English.lproj/localizedStrings.js: - * inspector/front-end/TimelinePanel.js: - (WebInspector.TimelinePanel.prototype.addRecordToTimeline): - (WebInspector.TimelinePanel.prototype._formatRecord): - (WebInspector.TimelineRecordTreeElement.prototype.onattach): - (WebInspector.TimelineRecordTreeElement.prototype.refresh): +2010-02-17 Kwang Yul Seo -2009-10-28 Gustavo Noronha Silva + Reviewed by Eric Seidel. - Reviewed by Xan Lopez. + [BREWMP] Port userIdleTime + https://bugs.webkit.org/show_bug.cgi?id=34259 - [GTK] Fails new test fast/js/navigator-language.html - https://bugs.webkit.org/show_bug.cgi?id=30440 + Return an arbitrarily high userIdleTime so that releasing pages from the page + cache isn't postponed. - Reimplement WebCore::defaultLanguage to account for changes in - locale done by setLocale. + * platform/brew/SystemTimeBrew.cpp: Added. + (WebCore::userIdleTime): - Already existing test: fast/js/navigator-language.html +2010-02-17 Dirk Schulze - * platform/gtk/Language.cpp: - (WebCore::defaultLanguage): + Rolling out r54909. Breaks SL and Win. -2009-10-28 Eric Carlson +2010-02-17 Dumitru Daniliuc - Reviewed by Simon Fraser. + Reviewed by Dimitri Glazkov. - - Can't exit full screen mode or restart movie after pressing command -R. + Fix Chromium's bindings for Database.transaction(): a 'null' + callback should be treated as no callback. - * html/HTMLMediaElement.cpp: - (WebCore::HTMLMediaElement::removedFromDocument): - (WebCore::HTMLMediaElement::documentWillBecomeInactive): - Exit from fullscreen if necessary. - * html/HTMLMediaElement.h: + Test: storage/null-callbacks.html -2009-10-28 Alexey Proskuryakov + https://bugs.webkit.org/show_bug.cgi?id=35047 - Unreviewed - a trivial fix to get Windows bots running. + * bindings/v8/custom/V8DatabaseCustom.cpp: + (WebCore::createTransaction): - https://bugs.webkit.org/show_bug.cgi?id=30841 - WebKit should not pass Referer header through a redirect to a non-secure site +2010-02-17 Dirk Schulze - * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::setHeaderFields): Don't try to - access empty vector's data. + Reviewed by Nikolas Zimmermann. -2009-10-28 Joanmarie Diggs + Move SVGResources to Renderers, starting with Masker + https://bugs.webkit.org/show_bug.cgi?id=35020 - Reviewed by Xan Lopez. + We have rendering specific code in WebCore/svg/graphics. The goal is to move + this code into suitable Renderers. This helps us to clean up the code and makes + maintenance easier. It also makes it possible to remove rendering specific code + from SVG*Elements into this renderers. So the Renderer contains everything that + is needed to use the resource. + RenderSVGResource will be the base class for all new resource render classes like + RenderSVGResourceMasker, RenderSVGResourceClipper and the other resources. - https://bugs.webkit.org/show_bug.cgi?id=25897 - [Gtk] Extraneous object of ROLE_PANEL in hierarchy for entries + This patch starts moving SVGResourceMasker to RenderSVGResourceMasker. + Another benefit is the much more useful result in DRT on using masker. - Remove the extraneous object of ROLE_PANEL. + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::toRenderSVGResource): Conversion to RenderSVGResource base class. + * rendering/RenderObject.h: + (WebCore::RenderObject::isSVGResource): Check if renderer is a resource. + * rendering/RenderPath.cpp: + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGImage.h: Some code clean up according to the webkit style. + (WebCore::RenderSVGImage::toSVGRenderBase): + (WebCore::RenderSVGImage::renderName): + (WebCore::RenderSVGImage::isSVGImage): + (WebCore::RenderSVGImage::localToParentTransform): + (WebCore::RenderSVGImage::strokeBoundingBox): + (WebCore::RenderSVGImage::requiresLayer): + (WebCore::RenderSVGImage::localTransform): + * rendering/RenderSVGInlineText.h: + (WebCore::RenderSVGInlineText::objectBoundingBox): Needed for SVGRenderTreeAsText + * rendering/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGModelObject.h: + * rendering/RenderSVGResource.h: Added. + (WebCore::): Base class for all Resource renderers like masker, clipper and others. + (WebCore::RenderSVGResource::RenderSVGResource): + (WebCore::RenderSVGResource::cast): + (WebCore::RenderSVGResource::toRenderSVGResource): + (WebCore::RenderSVGResource::isSVGResource): + (WebCore::RenderSVGResource::drawsContents): + (WebCore::getRenderSVGResourceById): + * rendering/RenderSVGResourceMasker.cpp: Added. + (WebCore::RenderSVGResourceMasker::RenderSVGResourceMasker): + (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker): + (WebCore::RenderSVGResourceMasker::invalidateClients): Status of masker changed, remove all clients. + (WebCore::RenderSVGResourceMasker::invalidateClient): Status of an object changed, remove pending client. + (WebCore::RenderSVGResourceMasker::applyResource): Apply masker to object. + (WebCore::RenderSVGResourceMasker::resourceBoundingBox): boundingBox of the resource, depending on the object. + (WebCore::RenderSVGResourceMasker::createMaskImage): Creates the mask image, the context gets clipped with. + * rendering/RenderSVGResourceMasker.h: Added. + (WebCore::MaskerData::MaskerData): + (WebCore::RenderSVGResourceMasker::renderName): + (WebCore::RenderSVGResourceMasker::maskUnits): Unit of mask for DRT. + (WebCore::RenderSVGResourceMasker::maskContentUnits): Unit of childs from mask for DRT. + (WebCore::RenderSVGResourceMasker::resourceType): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::destroy): Renderer gets destroyed, unregister it from it's resources. + * rendering/RenderSVGRoot.h: + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::destroy): dito. + * rendering/RenderSVGText.h: + * rendering/RenderTreeAsText.cpp: + (WebCore::write): + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderBase::prepareToRenderSVGContent): + (WebCore::SVGRenderBase::maskerBoundingBoxForRenderer): + (WebCore::SVGRenderBase::deregisterFromResources): Unregister object from all it's resources after status changed. + * rendering/SVGRenderSupport.h: + (WebCore::SVGRenderBase::toSVGRenderBase): + (WebCore::SVGRenderBase::strokeBoundingBox): + (WebCore::SVGRenderBase::markerBoundingBox): + * rendering/SVGRenderTreeAsText.cpp: Update TreeAsText to dump maskers correctly. + (WebCore::operator<<): + (WebCore::writeSVGResource): + (WebCore::writeSVGContainer): + (WebCore::writeSVGText): + (WebCore::writeSVGInlineText): + (WebCore::writeSVGImage): + (WebCore::write): + (WebCore::writeResourcesToObject): + * rendering/SVGRenderTreeAsText.h: + * svg/SVGMaskElement.cpp: Update Masker to use the new renderer. + (WebCore::SVGMaskElement::svgAttributeChanged): + (WebCore::SVGMaskElement::childrenChanged): + (WebCore::SVGMaskElement::maskBoundingBox): + (WebCore::SVGMaskElement::createRenderer): + * svg/SVGMaskElement.h: + * svg/SVGStyledElement.cpp: We need to tell the renderer to unregister object, after the status changed. + (WebCore::SVGStyledElement::invalidateResources): + (WebCore::SVGStyledElement::invalidateResourcesInAncestorChain): + * svg/SVGUnitTypes.h: Conversion of integer to SVGUnitType. + (WebCore::toUnitType): + * svg/graphics/SVGResource.h: + (WebCore::): + (WebCore::SVGResource::isMarker): + * svg/graphics/SVGResourceMasker.cpp: Removed. + * svg/graphics/SVGResourceMasker.h: Removed. - * accessibility/gtk/AccessibilityObjectAtk.cpp: - (AccessibilityObject::accessibilityPlatformIncludesObject): +2010-02-17 Kenneth Russell -2009-10-28 Jonathan Dixon + Reviewed by Oliver Hunt. - Reviewed by Eric Seidel. + Refactor texImage2D and texSubImage2D taking Image to use common code + https://bugs.webkit.org/show_bug.cgi?id=34458 - Bug 30547: (Chromium) searchbox not rendered properly due to the css property -webkit-border-radius - https://bugs.webkit.org/show_bug.cgi?id=30547 + Merged the Safari and Chromium code which extracts the data from + Image objects into common entry points on GraphicsContext3D. This + immediately fixes the following three problems: + - Chromium not implementing texSubImage2D taking Image. + - Safari not obeying the flipY parameter to texImage2D or + texSubImage2D taking Image. + - Safari not obeying the premultipyAlpha parameter to texImage2D + or texSubImage2D taking Image. + Added new test verifying the behavior of texImage2D and + texSubImage2D and the flipY parameter. The premultiplyAlpha + parameter can not be tested yet as the implementation is not yet + spec compliant. This will be fixed in a follow-on bug. - Test: fast/css/text-input-with-webkit-border-radius.html + Ran all WebGL demos in demo repository on Safari and Chromium; + textures are now the right way up in both browsers, and + transparent textures in Particles demo now look correct in Safari. - * rendering/RenderThemeChromiumWin.cpp: - (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): - Implemented rounded border rendering in Chromium Windows theme renderer. + Test: fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html -2009-10-28 Pavel Feldman + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/GraphicsContext3D.cpp: Added. + (WebCore::GraphicsContext3D::extractImageData): + (WebCore::GraphicsContext3D::processImageData): + (WebCore::GraphicsContext3D::premultiplyAlpha): + (WebCore::GraphicsContext3D::unmultiplyAlpha): + * platform/graphics/GraphicsContext3D.h: + (WebCore::GraphicsContext3D::): + * platform/graphics/cg/GraphicsContext3DCG.cpp: Added. + (WebCore::GraphicsContext3D::getImageData): + * platform/graphics/mac/GraphicsContext3DMac.cpp: + (WebCore::GraphicsContext3D::texImage2D): + (WebCore::GraphicsContext3D::texSubImage2D): + * platform/graphics/skia/GraphicsContext3DSkia.cpp: Added. + (WebCore::GraphicsContext3D::getImageData): - Reviewed by Timothy Hatcher. +2010-02-17 Noam Rosenthal - Web Inspector: Pull items collections from resources panel and - timeline panel into AbstractTimelinePanel. - - https://bugs.webkit.org/show_bug.cgi?id=30875 - - * inspector/front-end/AbstractTimelinePanel.js: - (WebInspector.AbstractTimelinePanel): - (WebInspector.AbstractTimelinePanel.prototype.populateSidebar): - (WebInspector.AbstractTimelinePanel.prototype.createItemTreeElement): - (WebInspector.AbstractTimelinePanel.prototype.createItemGraph): - (WebInspector.AbstractTimelinePanel.prototype._showCategory): - (WebInspector.AbstractTimelinePanel.prototype._hideCategory): - (WebInspector.AbstractTimelinePanel.prototype.filter): - (WebInspector.AbstractTimelinePanel.prototype._createGraph): - (WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth): - (WebInspector.AbstractTimelinePanel.prototype.refresh): - (WebInspector.AbstractTimelinePanel.prototype.reset): - (WebInspector.AbstractTimelinePanel.prototype.get calculator): - (WebInspector.AbstractTimelinePanel.prototype.set calculator): - (WebInspector.AbstractTimelinePanel.prototype.addItem): - (WebInspector.AbstractTimelinePanel.prototype.removeItem): - (WebInspector.AbstractTimelinePanel.prototype.refreshItem): - (WebInspector.AbstractTimelinePanel.prototype.revealAndSelectItem): - (WebInspector.AbstractTimelinePanel.prototype.sortItems): - (WebInspector.AbstractTimelinePanel.prototype.adjustScrollPosition): - (WebInspector.AbstractTimelineCategory): - (WebInspector.AbstractTimelineCategory.prototype.toString): - * inspector/front-end/ResourceCategory.js: - (WebInspector.ResourceCategory): - * inspector/front-end/ResourcesPanel.js: - (WebInspector.ResourcesPanel): - (WebInspector.ResourcesPanel.prototype.createItemTreeElement): - (WebInspector.ResourcesPanel.prototype.createItemGraph): - (WebInspector.ResourcesPanel.prototype.isCategoryVisible): - (WebInspector.ResourcesPanel.prototype.populateSidebar): - (WebInspector.ResourcesPanel.prototype.get searchableViews): - (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction.sortFuction): - (WebInspector.ResourcesPanel.prototype.get searchResultsSortFunction): - (WebInspector.ResourcesPanel.prototype.searchMatchFound): - (WebInspector.ResourcesPanel.prototype.searchCanceled): - (WebInspector.ResourcesPanel.prototype.performSearch): - (WebInspector.ResourcesPanel.prototype.refresh): - (WebInspector.ResourcesPanel.prototype.reset): - (WebInspector.ResourcesPanel.prototype.removeResource): - (WebInspector.ResourcesPanel.prototype.addMessageToResource): - (WebInspector.ResourcesPanel.prototype.clearMessages): - (WebInspector.ResourcesPanel.prototype.refreshResource): - (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): - (WebInspector.ResourcesPanel.prototype.showResource): - (WebInspector.ResourcesPanel.prototype._sortResourcesIfNeeded): - (WebInspector.ResourcesPanel.prototype._toggleLargerResources): - (WebInspector.ResourcesPanel.prototype._toggleResourceTracking): - (WebInspector.ResourcesPanel.prototype.get _resources): - (WebInspector.ResourceTimeCalculator.prototype._upperBound): - * inspector/front-end/TimelinePanel.js: - (WebInspector.TimelinePanel): - (WebInspector.TimelinePanel.prototype.get categories): - (WebInspector.TimelinePanel.prototype.populateSidebar): - (WebInspector.TimelinePanel.prototype.addRecordToTimeline): - (WebInspector.TimelinePanel.prototype.createItemTreeElement): - (WebInspector.TimelinePanel.prototype.createItemGraph): - (WebInspector.TimelinePanel.prototype._formatRecord): - (WebInspector.TimelineCategory): - * inspector/front-end/inspector.css: - * inspector/front-end/inspector.html: + Reviewed by Ariya Hidayat. -2009-10-28 Kelly Norton + [Qt] GraphicsLayer: support perspective and 3D transforms + https://bugs.webkit.org/show_bug.cgi?id=34960 - Reviewed by Pavel Feldman. + New tests: http://webkit.org/blog-files/3d-transforms/perspective-by-example.html - Resets InspectorFrontend in InspectorTimelineAgent instead of removing it so - that it remains active on refreshs and page transitions. - https://bugs.webkit.org/show_bug.cgi?id=30874 + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::updateTransform): + (WebCore::GraphicsLayerQtImpl::setBaseTransform): + (WebCore::GraphicsLayerQtImpl::computeTransform): + (WebCore::GraphicsLayerQtImpl::flushChanges): + (WebCore::TransformAnimationQt::~TransformAnimationQt): - * inspector/InspectorController.cpp: - (WebCore::InspectorController::setFrontendProxyObject): - * inspector/InspectorTimelineAgent.cpp: - (WebCore::InspectorTimelineAgent::resetFrontendProxyObject): - * inspector/InspectorTimelineAgent.h: +2010-02-17 Peter Kasting -2009-10-27 Shinichiro Hamaji + Unreviewed, build fix. - Reviewed by Darin Adler. + Fix crashes due to an omitted line in r54839. - Provide a way to get counter values with layoutTestContoller - https://bugs.webkit.org/show_bug.cgi?id=30555 + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::decodingFailed): - Expose WebCore::counterValueForElement as a WebCore API. +2010-02-17 Alok Priyadarshi - * WebCore.base.exp: - * rendering/RenderTreeAsText.cpp: - (WebCore::writeCounterValuesFromChildren): - (WebCore::counterValueForElement): - * rendering/RenderTreeAsText.h: + Reviewed by Ariya Hidayat. -2009-10-28 Nate Chapin + Bug 34900: Implement accelerated compositing for chromium. + https://bugs.webkit.org/show_bug.cgi?id=34900 - Unreviewed, Chromium build fix for r50225. + Do not exclude files needed for accelerated compositing. In fact there is no need to exclude these files. + These files are already guarded with WTF_USE_ACCELERATED_COMPOSITING flag. - * loader/FrameLoader.cpp: - (WebCore::FrameLoader::defaultObjectContentType): - -2009-10-28 Eric Z. Ayers - - Reviewed by Pavel Feldman. + * WebCore.gyp/WebCore.gyp: Removed GraphicsLayer.cpp, RenderLayerBacking.cpp, + and RenderLayerCompositor.cpp from excluded list. - Adds InspectorTimelineAgent instrumentation for encountering a - . Check if it has the @@ -117,10 +117,20 @@ ScriptValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode RefPtr protect = m_frame; +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) + timelineAgent->willEvaluateScript(sourceURL, sourceCode.startLine()); +#endif + exec->globalData().timeoutChecker.start(); - Completion comp = WebCore::evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell, world); + Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, shell); exec->globalData().timeoutChecker.stop(); +#if ENABLE(INSPECTOR) + if (InspectorTimelineAgent* timelineAgent = m_frame->page() ? m_frame->page()->inspectorTimelineAgent() : 0) + timelineAgent->didEvaluateScript(); +#endif + // Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here. m_frame->keepAlive(); @@ -145,53 +155,26 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode) // An DOMWrapperWorld other than the thread's normal world. class IsolatedWorld : public DOMWrapperWorld { public: + static PassRefPtr create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); } + +protected: IsolatedWorld(JSGlobalData* globalData) - : DOMWrapperWorld(globalData) + : DOMWrapperWorld(globalData, false) { JSGlobalData::ClientData* clientData = globalData->clientData; ASSERT(clientData); static_cast(clientData)->rememberWorld(this); } - - static PassRefPtr create(JSGlobalData* globalData) { return adoptRef(new IsolatedWorld(globalData)); } }; -static PassRefPtr findWorld(unsigned worldID) +PassRefPtr ScriptController::createWorld() { - if (!worldID) - return IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); - - typedef HashMap > WorldMap; - DEFINE_STATIC_LOCAL(WorldMap, isolatedWorlds, ()); - - WorldMap::iterator iter = isolatedWorlds.find(worldID); - if (iter != isolatedWorlds.end()) - return iter->second; - - RefPtr newWorld = IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); - isolatedWorlds.add(worldID, newWorld); - return newWorld; + return IsolatedWorld::create(JSDOMWindow::commonJSGlobalData()); } -JSDOMWindow* ScriptController::globalObject(unsigned worldID) +void ScriptController::getAllWorlds(Vector& worlds) { - RefPtr world = findWorld(worldID); - return windowShell(world.get())->window(); -} - -ScriptValue ScriptController::evaluateInIsolatedWorld(unsigned worldID, const ScriptSourceCode& sourceCode) -{ - RefPtr world = findWorld(worldID); - return evaluateInWorld(sourceCode, world.get()); -} - -void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector& sourceCode) -{ - RefPtr world = findWorld(worldID); - - unsigned size = sourceCode.size(); - for (unsigned i = 0; i < size; ++i) - evaluateInWorld(sourceCode[i], world.get()); + static_cast(JSDOMWindow::commonJSGlobalData()->clientData)->getAllWorlds(worlds); } void ScriptController::clearWindowShell() @@ -201,19 +184,17 @@ void ScriptController::clearWindowShell() JSLock lock(SilenceAssertionsOnly); - // Clear the debugger from the current window before setting the new window. - DOMWrapperWorld* debugWorld = debuggerWorld(); - attachDebugger(0); - for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) { - DOMWrapperWorld* world = iter->first; JSDOMWindowShell* windowShell = iter->second; + + // Clear the debugger from the current window before setting the new window. + attachDebugger(windowShell, 0); + windowShell->window()->willRemoveFromWindowShell(); windowShell->setWindow(m_frame->domWindow()); if (Page* page = m_frame->page()) { - if (world == debugWorld) - attachDebugger(page->debugger()); + attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } } @@ -228,53 +209,33 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) JSLock lock(SilenceAssertionsOnly); - JSDOMWindowShell* windowShell = new JSDOMWindowShell(m_frame->domWindow()); + JSDOMWindowShell* windowShell = new JSDOMWindowShell(m_frame->domWindow(), world); m_windowShells.add(world, windowShell); - world->rememberScriptController(this); - windowShell->window()->updateDocument(world); + windowShell->window()->updateDocument(); if (Page* page = m_frame->page()) { - if (world == debuggerWorld()) - attachDebugger(page->debugger()); + attachDebugger(windowShell, page->debugger()); windowShell->window()->setProfileGroup(page->group().identifier()); } - { - EnterDOMWrapperWorld worldEntry(*JSDOMWindow::commonJSGlobalData(), world); - m_frame->loader()->dispatchWindowObjectAvailable(); - } + m_frame->loader()->dispatchDidClearWindowObjectInWorld(world); return windowShell; } -bool ScriptController::processingUserGesture() const +bool ScriptController::processingUserGesture(DOMWrapperWorld* world) const { - return m_allowPopupsFromPlugin || processingUserGestureEvent() || isJavaScriptAnchorNavigation(); + return m_allowPopupsFromPlugin || processingUserGestureEvent(world) || isJavaScriptAnchorNavigation(); } -bool ScriptController::processingUserGestureEvent() const +bool ScriptController::processingUserGestureEvent(DOMWrapperWorld* world) const { - JSDOMWindowShell* shell = existingWindowShell(mainThreadNormalWorld()); + JSDOMWindowShell* shell = existingWindowShell(world); if (!shell) return false; - if (Event* event = shell->window()->currentEvent()) { - if (event->createdByDOM()) - return false; - - const AtomicString& type = event->type(); - if ( // mouse events - type == eventNames().clickEvent || type == eventNames().mousedownEvent || - type == eventNames().mouseupEvent || type == eventNames().dblclickEvent || - // keyboard events - type == eventNames().keydownEvent || type == eventNames().keypressEvent || - type == eventNames().keyupEvent || - // other accepted events - type == eventNames().selectEvent || type == eventNames().changeEvent || - type == eventNames().focusEvent || type == eventNames().blurEvent || - type == eventNames().submitEvent) - return true; - } + if (Event* event = shell->window()->currentEvent()) + return event->fromUserGesture(); return false; } @@ -300,7 +261,20 @@ bool ScriptController::anyPageIsProcessingUserGesture() const HashSet::const_iterator end = pages.end(); for (HashSet::const_iterator it = pages.begin(); it != end; ++it) { for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->script()->processingUserGesture()) + ScriptController* script = frame->script(); + + if (script->m_allowPopupsFromPlugin) + return true; + + const ShellMap::const_iterator iterEnd = m_windowShells.end(); + for (ShellMap::const_iterator iter = m_windowShells.begin(); iter != iterEnd; ++iter) { + JSDOMWindowShell* shell = iter->second.get(); + Event* event = shell->window()->currentEvent(); + if (event && event->fromUserGesture()) + return true; + } + + if (isJavaScriptAnchorNavigation()) return true; } } @@ -308,16 +282,14 @@ bool ScriptController::anyPageIsProcessingUserGesture() const return false; } -bool ScriptController::isEnabled() +void ScriptController::attachDebugger(JSC::Debugger* debugger) { - Settings* settings = m_frame->settings(); - return (settings && settings->isJavaScriptEnabled()); + for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) + attachDebugger(iter->second, debugger); } -void ScriptController::attachDebugger(JSC::Debugger* debugger) +void ScriptController::attachDebugger(JSDOMWindowShell* shell, JSC::Debugger* debugger) { - // FIXME: Should be able to debug isolated worlds. - JSDOMWindowShell* shell = existingWindowShell(debuggerWorld()); if (!shell) return; @@ -335,7 +307,7 @@ void ScriptController::updateDocument() JSLock lock(SilenceAssertionsOnly); for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) - iter->second->window()->updateDocument(iter->first); + iter->second->window()->updateDocument(); } void ScriptController::updateSecurityOrigin() @@ -345,7 +317,7 @@ void ScriptController::updateSecurityOrigin() Bindings::RootObject* ScriptController::bindingRootObject() { - if (!isEnabled()) + if (!canExecuteScripts()) return 0; if (!m_bindingRootObject) { @@ -372,7 +344,7 @@ PassRefPtr ScriptController::createRootObject(void* native NPObject* ScriptController::windowScriptNPObject() { if (!m_windowScriptNPObject) { - if (isEnabled()) { + if (canExecuteScripts()) { // JavaScript is enabled, so there is a JavaScript window object. // Return an NPObject bound to the window object. JSC::JSLock lock(SilenceAssertionsOnly); @@ -405,7 +377,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin) { // Can't create JSObjects when JavaScript is disabled - if (!isEnabled()) + if (!canExecuteScripts()) return 0; // Create a JSObject bound to this element @@ -468,31 +440,11 @@ void ScriptController::clearScriptObjects() #endif } -ScriptValue ScriptController::executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture) -{ - ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); - - if (!isEnabled() || isPaused()) - return ScriptValue(); - - bool wasInExecuteScript = m_inExecuteScript; - m_inExecuteScript = true; - - ScriptValue result = evaluateInIsolatedWorld(worldID, sourceCode); - - if (!wasInExecuteScript) { - m_inExecuteScript = false; - Document::updateStyleForAllDocuments(); - } - - return result; -} - -ScriptValue ScriptController::executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture) +ScriptValue ScriptController::executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture) { ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()); - if (!isEnabled() || isPaused()) + if (!canExecuteScripts() || isPaused()) return ScriptValue(); bool wasInExecuteScript = m_inExecuteScript; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h index f2a497d..1cbb56d 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptController.h @@ -63,12 +63,15 @@ class XSSAuditor; typedef HashMap > RootObjectMap; class ScriptController { - typedef WTF::HashMap > ShellMap; + friend class ScriptCachedFrameData; + typedef WTF::HashMap< RefPtr, JSC::ProtectedPtr > ShellMap; public: ScriptController(Frame*); ~ScriptController(); + static PassRefPtr createWorld(); + JSDOMWindowShell* windowShell(DOMWrapperWorld* world) { ShellMap::iterator iter = m_windowShells.find(world); @@ -83,17 +86,12 @@ public: { return windowShell(world)->window(); } - JSDOMWindow* globalObject(unsigned worldID); - void forgetWorld(DOMWrapperWorld* world) - { - m_windowShells.remove(world); - } + static void getAllWorlds(Vector&); ScriptValue executeScript(const ScriptSourceCode&); ScriptValue executeScript(const String& script, bool forceUserGesture = false); - ScriptValue executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture = false); - ScriptValue executeScriptInIsolatedWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false); + ScriptValue executeScriptInWorld(DOMWrapperWorld* world, const String& script, bool forceUserGesture = false); // Returns true if argument is a JavaScript URL. bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true); @@ -104,19 +102,19 @@ public: ScriptValue evaluate(const ScriptSourceCode&); ScriptValue evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*); - ScriptValue evaluateInIsolatedWorld(unsigned /*worldID*/, const ScriptSourceCode&); - void evaluateInIsolatedWorld(unsigned /*worldID*/, const Vector&); void setEventHandlerLineNumber(int lineno) { m_handlerLineNumber = lineno; } int eventHandlerLineNumber() { return m_handlerLineNumber; } void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } - bool processingUserGesture() const; + bool processingUserGesture(DOMWrapperWorld*) const; bool anyPageIsProcessingUserGesture() const; - bool isEnabled(); + bool canExecuteScripts(); - void attachDebugger(JSC::Debugger*); + // Debugger can be 0 to detach any existing Debugger. + void attachDebugger(JSC::Debugger*); // Attaches/detaches in all worlds/window shells. + void attachDebugger(JSDOMWindowShell*, JSC::Debugger*); void setPaused(bool b) { m_paused = b; } bool isPaused() const { return m_paused; } @@ -166,7 +164,7 @@ private: void disconnectPlatformScriptObjects(); - bool processingUserGestureEvent() const; + bool processingUserGestureEvent(DOMWrapperWorld*) const; bool isJavaScriptAnchorNavigation() const; ShellMap m_windowShells; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerGtk.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerGtk.cpp index c906034..6ffae69 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerGtk.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerGtk.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "ScriptController.h" +#include "Bridge.h" #include "PluginView.h" #include "runtime_root.h" -#include "runtime.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerHaiku.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerHaiku.cpp index 3fe471d..a1f1590 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerHaiku.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerHaiku.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "ScriptController.h" +#include "Bridge.h" #include "PluginView.h" -#include "runtime.h" #include "runtime_root.h" diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm index 21ec0f2..208aae8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerMac.mm @@ -29,6 +29,7 @@ #import "config.h" #import "ScriptController.h" +#import "Bridge.h" #import "DOMAbstractViewFrame.h" #import "DOMWindow.h" #import "Frame.h" @@ -37,6 +38,8 @@ #import "JSDOMWindow.h" #import "WebScriptObjectPrivate.h" #import "Widget.h" +#import "objc_instance.h" +#import "runtime_root.h" #import #import @@ -46,12 +49,8 @@ #import "npruntime_impl.h" #endif -#import "objc_instance.h" -#import "runtime_root.h" -#import "runtime.h" - #if ENABLE(MAC_JAVA_BRIDGE) -#import "jni_instance.h" +#import "JavaInstanceJSC.h" #endif @interface NSObject (WebPlugin) @@ -108,7 +107,7 @@ PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widge WebScriptObject* ScriptController::windowScriptObject() { - if (!isEnabled()) + if (!canExecuteScripts()) return 0; if (!m_windowScriptObject) { diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp index 6b14190..55d4ba4 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerQt.cpp @@ -36,11 +36,11 @@ #include "config.h" #include "ScriptController.h" +#include "Bridge.h" #include "DOMWindow.h" #include "PluginView.h" #include "qt_instance.h" #include "runtime_root.h" -#include "runtime.h" #include diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWin.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWin.cpp index 703cf7c..e0a959e 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWin.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWin.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "ScriptController.h" +#include "Bridge.h" #include "PluginView.h" -#include "runtime.h" using namespace JSC::Bindings; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWx.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWx.cpp index 1c14928..1d7b4ca 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWx.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptControllerWx.cpp @@ -27,9 +27,9 @@ #include "config.h" #include "ScriptController.h" +#include "Bridge.h" #include "PluginView.h" #include "runtime_root.h" -#include "runtime.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp new file mode 100644 index 0000000..9869775 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(JAVASCRIPT_DEBUGGER) + +#include "ScriptDebugServer.h" + +#include "JavaScriptDebugServer.h" + +namespace WebCore { + +void ScriptDebugServer::recompileAllJSFunctions() +{ + JavaScriptDebugServer::shared().recompileAllJSFunctions(); +} + +void ScriptDebugServer::recompileAllJSFunctionsSoon() +{ + JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon(); +} + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h new file mode 100644 index 0000000..027ffa5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptDebugServer.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptDebugServer_h +#define ScriptDebugServer_h + +#if ENABLE(JAVASCRIPT_DEBUGGER) + +#include + +namespace WebCore { + +class ScriptDebugServer : public Noncopyable { +public: + static void recompileAllJSFunctions(); + static void recompileAllJSFunctionsSoon(); +}; + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) + +#endif // ScriptDebugServer_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp index 8399c7a..fd45546 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptEventListener.cpp @@ -37,6 +37,7 @@ #include "JSNode.h" #include "Frame.h" #include "XSSAuditor.h" +#include using namespace JSC; @@ -52,14 +53,18 @@ static const String& eventParameterName(bool isSVGEvent) PassRefPtr createAttributeEventListener(Node* node, Attribute* attr) { ASSERT(node); + ASSERT(attr); + if (attr->isNull()) + return 0; int lineNumber = 1; String sourceURL; + JSObject* wrapper = 0; // FIXME: We should be able to provide accurate source information for frameless documents, too (e.g. for importing nodes from XMLHttpRequest.responseXML). if (Frame* frame = node->document()->frame()) { ScriptController* scriptController = frame->script(); - if (!scriptController->isEnabled()) + if (!scriptController->canExecuteScripts()) return 0; if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) { @@ -69,9 +74,13 @@ PassRefPtr createAttributeEventListener(Node* node, Attribu lineNumber = scriptController->eventHandlerLineNumber(); sourceURL = node->document()->url().string(); + + JSC::JSLock lock(SilenceAssertionsOnly); + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(node->document(), mainThreadNormalWorld()); + wrapper = asObject(toJS(globalObject->globalExec(), globalObject, node)); } - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, mainThreadNormalWorld()); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, lineNumber, wrapper, mainThreadNormalWorld()); } PassRefPtr createAttributeEventListener(Frame* frame, Attribute* attr) @@ -79,11 +88,15 @@ PassRefPtr createAttributeEventListener(Frame* frame, Attri if (!frame) return 0; + ASSERT(attr); + if (attr->isNull()) + return 0; + int lineNumber = 1; String sourceURL; ScriptController* scriptController = frame->script(); - if (!scriptController->isEnabled()) + if (!scriptController->canExecuteScripts()) return 0; if (!scriptController->xssAuditor()->canCreateInlineEventListener(attr->localName().string(), attr->value())) { @@ -93,15 +106,19 @@ PassRefPtr createAttributeEventListener(Frame* frame, Attri lineNumber = scriptController->eventHandlerLineNumber(); sourceURL = frame->document()->url().string(); - return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, mainThreadNormalWorld()); + JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld()); + return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, lineNumber, wrapper, mainThreadNormalWorld()); } String getEventListenerHandlerBody(ScriptExecutionContext* context, ScriptState* scriptState, EventListener* eventListener) { - JSC::JSObject* functionObject = eventListener->jsFunction(context); - if (!functionObject) + const JSEventListener* jsListener = JSEventListener::cast(eventListener); + if (!jsListener) + return ""; + JSC::JSObject* jsFunction = jsListener->jsFunction(context); + if (!jsFunction) return ""; - return functionObject->toString(scriptState); + return jsFunction->toString(scriptState); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp index 91b2a57..5001d3c 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.cpp @@ -42,8 +42,8 @@ using namespace JSC; namespace WebCore { -ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name) - : m_exec(exec) +ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const String& name) + : m_exec(thisObject.scriptState()) , m_thisObject(thisObject) , m_name(name) { @@ -51,6 +51,10 @@ ScriptFunctionCall::ScriptFunctionCall(ScriptState* exec, const ScriptObject& th void ScriptFunctionCall::appendArgument(const ScriptObject& argument) { + if (argument.scriptState() != m_exec) { + ASSERT_NOT_REACHED(); + return; + } m_arguments.append(argument.jsObject()); } @@ -72,14 +76,27 @@ void ScriptFunctionCall::appendArgument(const String& argument) void ScriptFunctionCall::appendArgument(const JSC::UString& argument) { + JSLock lock(SilenceAssertionsOnly); m_arguments.append(jsString(m_exec, argument)); } +void ScriptFunctionCall::appendArgument(const char* argument) +{ + JSLock lock(SilenceAssertionsOnly); + m_arguments.append(jsString(m_exec, UString(argument))); +} + void ScriptFunctionCall::appendArgument(JSC::JSValue argument) { m_arguments.append(argument); } +void ScriptFunctionCall::appendArgument(long argument) +{ + JSLock lock(SilenceAssertionsOnly); + m_arguments.append(jsNumber(m_exec, argument)); +} + void ScriptFunctionCall::appendArgument(long long argument) { JSLock lock(SilenceAssertionsOnly); @@ -92,6 +109,12 @@ void ScriptFunctionCall::appendArgument(unsigned int argument) m_arguments.append(jsNumber(m_exec, argument)); } +void ScriptFunctionCall::appendArgument(unsigned long argument) +{ + JSLock lock(SilenceAssertionsOnly); + m_arguments.append(jsNumber(m_exec, argument)); +} + void ScriptFunctionCall::appendArgument(int argument) { JSLock lock(SilenceAssertionsOnly); @@ -123,8 +146,7 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) if (callType == CallTypeNone) return ScriptValue(); - // FIXME: Should this function take a worldID? - only used by inspector? - JSValue result = callInWorld(m_exec, function, callType, callData, thisObject, m_arguments, debuggerWorld()); + JSValue result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); @@ -162,8 +184,7 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept if (constructType == ConstructTypeNone) return ScriptObject(); - // FIXME: Currently this method constructs objects in debuggerWorld(). We could use the current world, or pass a worldID to this function? - JSValue result = constructInWorld(m_exec, constructor, constructType, constructData, m_arguments, debuggerWorld()); + JSValue result = JSC::construct(m_exec, constructor, constructType, constructData, m_arguments); if (m_exec->hadException()) { if (reportExceptions) reportException(m_exec, m_exec->exception()); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.h index 079ac21..9742e8f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptFunctionCall.h @@ -48,17 +48,20 @@ namespace WebCore { class ScriptFunctionCall { public: - ScriptFunctionCall(ScriptState* exec, const ScriptObject& thisObject, const String& name); + ScriptFunctionCall(const ScriptObject& thisObject, const String& name); virtual ~ScriptFunctionCall() {}; void appendArgument(const ScriptObject&); void appendArgument(const ScriptString&); void appendArgument(const ScriptValue&); void appendArgument(const String&); + void appendArgument(const char*); void appendArgument(const JSC::UString&); void appendArgument(JSC::JSValue); + void appendArgument(long); void appendArgument(long long); void appendArgument(unsigned int); + void appendArgument(unsigned long); void appendArgument(int); void appendArgument(bool); ScriptValue call(bool& hadException, bool reportExceptions = true); @@ -70,6 +73,12 @@ namespace WebCore { ScriptObject m_thisObject; String m_name; JSC::MarkedArgumentBuffer m_arguments; + + private: + // MarkedArgumentBuffer must be stack allocated, so prevent heap + // alloc of ScriptFunctionCall as well. + void* operator new(size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast(0xbadbeef); } + void* operator new[](size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast(0xbadbeef); } }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptInstance.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptInstance.h index 3095df9..0b3b59f 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptInstance.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptInstance.h @@ -31,8 +31,8 @@ #ifndef ScriptInstance_h #define ScriptInstance_h +#include "Bridge.h" #include -#include "runtime.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.cpp index 1172e8e..7948219 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.cpp @@ -32,10 +32,15 @@ #include "ScriptObject.h" #include "JSDOMBinding.h" -#include "JSInspectorBackend.h" #include +#if ENABLE(INSPECTOR) +#include "JSInjectedScriptHost.h" +#include "JSInspectorBackend.h" +#include "JSInspectorFrontendHost.h" +#endif + using namespace JSC; namespace WebCore { @@ -65,6 +70,10 @@ bool ScriptObject::set(const String& name, const String& value) bool ScriptObject::set(const char* name, const ScriptObject& value) { + if (value.scriptState() != m_scriptState) { + ASSERT_NOT_REACHED(); + return false; + } JSLock lock(SilenceAssertionsOnly); PutPropertySlot slot; jsObject()->put(m_scriptState, Identifier(m_scriptState, name), value.jsObject(), slot); @@ -87,6 +96,14 @@ bool ScriptObject::set(const char* name, double value) return handleException(m_scriptState); } +bool ScriptObject::set(const char* name, long value) +{ + JSLock lock(SilenceAssertionsOnly); + PutPropertySlot slot; + jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot); + return handleException(m_scriptState); +} + bool ScriptObject::set(const char* name, long long value) { JSLock lock(SilenceAssertionsOnly); @@ -111,6 +128,14 @@ bool ScriptObject::set(const char* name, unsigned value) return handleException(m_scriptState); } +bool ScriptObject::set(const char* name, unsigned long value) +{ + JSLock lock(SilenceAssertionsOnly); + PutPropertySlot slot; + jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot); + return handleException(m_scriptState); +} + bool ScriptObject::set(const char* name, bool value) { JSLock lock(SilenceAssertionsOnly); @@ -140,6 +165,22 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value)); return handleException(scriptState); } + +bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value) +{ + JSLock lock(SilenceAssertionsOnly); + JSDOMGlobalObject* globalObject = static_cast(scriptState->lexicalGlobalObject()); + globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value)); + return handleException(scriptState); +} + +bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value) +{ + JSLock lock(SilenceAssertionsOnly); + JSDOMGlobalObject* globalObject = static_cast(scriptState->lexicalGlobalObject()); + globalObject->putDirect(Identifier(scriptState, name), toJS(scriptState, globalObject, value)); + return handleException(scriptState); +} #endif // ENABLE(INSPECTOR) bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptObject& value) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.h index 31381f3..0c993e1 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObject.h @@ -38,21 +38,26 @@ #include namespace WebCore { + class InjectedScriptHost; class InspectorBackend; + class InspectorFrontendHost; class ScriptObject : public ScriptValue { public: ScriptObject(ScriptState*, JSC::JSObject*); ScriptObject() {} JSC::JSObject* jsObject() const { return asObject(jsValue()); } + ScriptState* scriptState() const { return m_scriptState; } bool set(const String& name, const String&); bool set(const char* name, const ScriptObject&); bool set(const char* name, const String&); bool set(const char* name, double); + bool set(const char* name, long); bool set(const char* name, long long); bool set(const char* name, int); bool set(const char* name, unsigned); + bool set(const char* name, unsigned long); bool set(const char* name, bool); static ScriptObject createNew(ScriptState*); @@ -66,6 +71,8 @@ namespace WebCore { static bool set(ScriptState*, const char* name, const ScriptObject&); #if ENABLE(INSPECTOR) static bool set(ScriptState*, const char* name, InspectorBackend*); + static bool set(ScriptState*, const char* name, InspectorFrontendHost*); + static bool set(ScriptState*, const char* name, InjectedScriptHost*); #endif static bool get(ScriptState*, const char* name, ScriptObject&); static bool remove(ScriptState*, const char* name); diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp deleted file mode 100644 index 313530f..0000000 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ScriptObjectQuarantine.h" - -#if ENABLE(INSPECTOR) - -#include "Document.h" -#include "Frame.h" -#include "JSDOMBinding.h" -#include "JSInspectedObjectWrapper.h" -#include "JSNode.h" -#include "ScriptObject.h" -#include "ScriptValue.h" -#include "Storage.h" - -#include - -#if ENABLE(DATABASE) -#include "Database.h" -#include "JSDatabase.h" -#endif - -#if ENABLE(DOM_STORAGE) -#include "JSStorage.h" -#endif - -using namespace JSC; - -namespace WebCore { - -ScriptValue quarantineValue(ScriptState* scriptState, const ScriptValue& value) -{ - JSLock lock(SilenceAssertionsOnly); - return ScriptValue(JSInspectedObjectWrapper::wrap(scriptState, value.jsValue())); -} - -#if ENABLE(DATABASE) -bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject) -{ - ASSERT(database); - - Frame* frame = database->document()->frame(); - if (!frame) - return false; - - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); - ExecState* exec = globalObject->globalExec(); - - JSLock lock(SilenceAssertionsOnly); - quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, globalObject, database)))); - - return true; -} -#endif - -#if ENABLE(DOM_STORAGE) -bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) -{ - ASSERT(storage); - Frame* frame = storage->frame(); - ASSERT(frame); - - JSDOMGlobalObject* globalObject = toJSDOMWindow(frame, debuggerWorld()); - ExecState* exec = globalObject->globalExec(); - - JSLock lock(SilenceAssertionsOnly); - quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, globalObject, storage)))); - - return true; -} -#endif - -bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject) -{ - ExecState* exec = scriptStateFromNode(node); - if (!exec) - return false; - - JSLock lock(SilenceAssertionsOnly); - // FIXME: Should use some sort of globalObjectFromNode() - quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, toJS(exec, deprecatedGlobalObjectForPrototype(exec), node)))); - - return true; -} - -bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject) -{ - ASSERT(domWindow); - - JSDOMWindow* window = toJSDOMWindow(domWindow->frame(), debuggerWorld()); - ExecState* exec = window->globalExec(); - - JSLock lock(SilenceAssertionsOnly); - quarantinedObject = ScriptObject(exec, asObject(JSInspectedObjectWrapper::wrap(exec, window))); - - return true; -} - - -} // namespace WebCore - -#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.h deleted file mode 100644 index df52379..0000000 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptObjectQuarantine.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ScriptObjectQuarantine_h -#define ScriptObjectQuarantine_h - -#include "ScriptState.h" - -namespace WebCore { - - class Database; - class DOMWindow; - class Node; - class ScriptObject; - class ScriptValue; - class Storage; - - ScriptValue quarantineValue(ScriptState*, const ScriptValue&); - -#if ENABLE(DATABASE) - bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); -#endif -#if ENABLE(DOM_STORAGE) - bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); -#endif - bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); - bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); - -} - -#endif // ScriptObjectQuarantine_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h new file mode 100644 index 0000000..32095e3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfile.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptProfile_h +#define ScriptProfile_h + +#if ENABLE(JAVASCRIPT_DEBUGGER) +#include + +namespace WebCore { + +typedef JSC::Profile ScriptProfile; + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) + +#endif // ScriptProfile_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp new file mode 100644 index 0000000..789e3d3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(JAVASCRIPT_DEBUGGER) + +#include "ScriptProfiler.h" + +#include + +namespace WebCore { + +void ScriptProfiler::start(ScriptState* state, const String& title) +{ + JSC::Profiler::profiler()->startProfiling(state, title); +} + +PassRefPtr ScriptProfiler::stop(ScriptState* state, const String& title) +{ + return JSC::Profiler::profiler()->stopProfiling(state, title); +} + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h new file mode 100644 index 0000000..a86bcfb --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptProfiler.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptProfiler_h +#define ScriptProfiler_h + +#if ENABLE(JAVASCRIPT_DEBUGGER) +#include "ScriptProfile.h" +#include "ScriptState.h" + +#include + +namespace WebCore { + +class ScriptProfiler : public Noncopyable { +public: + static void start(ScriptState* state, const String& title); + static PassRefPtr stop(ScriptState* state, const String& title); +}; + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) + +#endif // ScriptProfiler_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp index 60ba2a0..b9f334a 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.cpp @@ -38,7 +38,13 @@ namespace WebCore { -ScriptState* scriptStateFromNode(Node* node) +ScriptState* mainWorldScriptState(Frame* frame) +{ + JSDOMWindowShell* shell = frame->script()->windowShell(mainThreadNormalWorld()); + return shell->window()->globalExec(); +} + +ScriptState* scriptStateFromNode(DOMWrapperWorld* world, Node* node) { if (!node) return 0; @@ -48,14 +54,14 @@ ScriptState* scriptStateFromNode(Node* node) Frame* frame = document->frame(); if (!frame) return 0; - if (!frame->script()->isEnabled()) + if (!frame->script()->canExecuteScripts()) return 0; - return frame->script()->globalObject(mainThreadCurrentWorld())->globalExec(); + return frame->script()->globalObject(world)->globalExec(); } -ScriptState* scriptStateFromPage(Page* page) +ScriptState* scriptStateFromPage(DOMWrapperWorld* world, Page* page) { - return page->mainFrame()->script()->globalObject(mainThreadCurrentWorld())->globalExec(); + return page->mainFrame()->script()->globalObject(world)->globalExec(); } } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h index 279234e..0c7c575 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptState.h @@ -36,6 +36,7 @@ namespace WebCore { class DOMWrapperWorld; + class Frame; class Node; class Page; @@ -45,8 +46,10 @@ namespace WebCore { // For now, the separation is purely by convention. typedef JSC::ExecState ScriptState; - ScriptState* scriptStateFromNode(Node*); - ScriptState* scriptStateFromPage(Page*); + ScriptState* mainWorldScriptState(Frame*); + + ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*); + ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page*); } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptString.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptString.h index 6dab9a0..18964b8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptString.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptString.h @@ -33,6 +33,7 @@ #include "PlatformString.h" #include +#include namespace WebCore { @@ -57,7 +58,10 @@ public: ScriptString& operator+=(const String& s) { - m_str += s; + JSC::StringBuilder buffer; + buffer.append(m_str); + buffer.append(s); + m_str = buffer.build(); return *this; } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.cpp b/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.cpp index 6eac102..005c329 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "ScriptValue.h" +#include "SerializedScriptValue.h" + #include #include @@ -40,13 +42,13 @@ using namespace JSC; namespace WebCore { -bool ScriptValue::getString(String& result) const +bool ScriptValue::getString(ScriptState* scriptState, String& result) const { if (!m_value) return false; JSLock lock(SilenceAssertionsOnly); UString ustring; - if (!m_value.get().getString(ustring)) + if (!m_value.get().getString(scriptState, ustring)) return false; result = ustring; return true; @@ -81,4 +83,14 @@ bool ScriptValue::isObject() const return m_value.get().isObject(); } +PassRefPtr ScriptValue::serialize(ScriptState* scriptState) +{ + return SerializedScriptValue::create(scriptState, jsValue()); +} + +ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptValue* value) +{ + return ScriptValue(value->deserialize(scriptState, scriptState->lexicalGlobalObject())); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.h index 19bb693..9ccb7ac 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptValue.h @@ -34,10 +34,12 @@ #include "PlatformString.h" #include "ScriptState.h" #include +#include namespace WebCore { class String; +class SerializedScriptValue; class ScriptValue { public: @@ -45,7 +47,7 @@ public: virtual ~ScriptValue() {} JSC::JSValue jsValue() const { return m_value.get(); } - bool getString(String& result) const; + bool getString(ScriptState*, String& result) const; String toString(ScriptState* scriptState) const { return m_value.get().toString(scriptState); } bool isEqual(ScriptState*, const ScriptValue&) const; bool isNull() const; @@ -53,6 +55,9 @@ public: bool isObject() const; bool hasNoValue() const { return m_value == JSC::JSValue(); } + PassRefPtr serialize(ScriptState*); + static ScriptValue deserialize(ScriptState*, SerializedScriptValue*); + private: JSC::ProtectedJSValue m_value; }; diff --git a/src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h b/src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h new file mode 100644 index 0000000..d70cab7 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bindings/js/ScriptWrappable.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptWrappable_h +#define ScriptWrappable_h + +namespace WebCore { + +class ScriptWrappable { +public: + ScriptWrappable() { } +}; + +} // namespace WebCore + +#endif // ScriptWrappable_h diff --git a/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp b/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp index 48cd92d..fbf8899 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp @@ -27,9 +27,19 @@ #include "config.h" #include "SerializedScriptValue.h" +#include "File.h" +#include "FileList.h" +#include "ImageData.h" +#include "JSDOMGlobalObject.h" +#include "JSFile.h" +#include "JSFileList.h" +#include "JSImageData.h" +#include #include #include +#include #include +#include #include #include @@ -136,6 +146,52 @@ private: unsigned m_length; }; +class SerializedFileList : public SharedSerializedData { +public: + static PassRefPtr create(const FileList* list) + { + return adoptRef(new SerializedFileList(list)); + } + + unsigned length() const { return m_files.size(); } + const String& item(unsigned idx) { return m_files[idx]; } + +private: + SerializedFileList(const FileList* list) + { + unsigned length = list->length(); + m_files.reserveCapacity(length); + for (unsigned i = 0; i < length; i++) + m_files.append(list->item(i)->path().crossThreadString()); + } + + Vector m_files; +}; + +class SerializedImageData : public SharedSerializedData { +public: + static PassRefPtr create(const ImageData* imageData) + { + return adoptRef(new SerializedImageData(imageData)); + } + + unsigned width() const { return m_width; } + unsigned height() const { return m_height; } + WTF::ByteArray* data() const { return m_storage.get(); } +private: + SerializedImageData(const ImageData* imageData) + : m_width(imageData->width()) + , m_height(imageData->height()) + { + WTF::ByteArray* array = imageData->data()->data(); + m_storage = WTF::ByteArray::create(array->length()); + memcpy(m_storage->data(), array->data(), array->length()); + } + unsigned m_width; + unsigned m_height; + RefPtr m_storage; +}; + SerializedScriptValueData::SerializedScriptValueData(RefPtr data) : m_type(ObjectType) , m_sharedData(data) @@ -148,6 +204,24 @@ SerializedScriptValueData::SerializedScriptValueData(RefPtr dat { } +SerializedScriptValueData::SerializedScriptValueData(const FileList* fileList) + : m_type(FileListType) + , m_sharedData(SerializedFileList::create(fileList)) +{ +} + +SerializedScriptValueData::SerializedScriptValueData(const ImageData* imageData) + : m_type(ImageDataType) + , m_sharedData(SerializedImageData::create(imageData)) +{ +} + +SerializedScriptValueData::SerializedScriptValueData(const File* file) + : m_type(FileType) + , m_string(file->path().crossThreadString()) +{ +} + SerializedArray* SharedSerializedData::asArray() { return static_cast(this); @@ -158,6 +232,16 @@ SerializedObject* SharedSerializedData::asObject() return static_cast(this); } +SerializedFileList* SharedSerializedData::asFileList() +{ + return static_cast(this); +} + +SerializedImageData* SharedSerializedData::asImageData() +{ + return static_cast(this); +} + static const unsigned maximumFilterRecursion = 40000; enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember, ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember }; @@ -470,7 +554,7 @@ struct SerializingTreeWalker : public BaseWalker { return SerializedScriptValueData(value); if (value.isString()) - return SerializedScriptValueData(asString(value)->value()); + return SerializedScriptValueData(asString(value)->value(m_exec)); if (value.isNumber()) return SerializedScriptValueData(SerializedScriptValueData::NumberType, value.uncheckedGetNumber()); @@ -481,10 +565,19 @@ struct SerializingTreeWalker : public BaseWalker { if (isArray(value)) return SerializedScriptValueData(); - CallData unusedData; - if (value.isObject() && value.getCallData(unusedData) == CallTypeNone) - return SerializedScriptValueData(); - + if (value.isObject()) { + JSObject* obj = asObject(value); + if (obj->inherits(&JSFile::s_info)) + return SerializedScriptValueData(toFile(obj)); + if (obj->inherits(&JSFileList::s_info)) + return SerializedScriptValueData(toFileList(obj)); + if (obj->inherits(&JSImageData::s_info)) + return SerializedScriptValueData(toImageData(obj)); + + CallData unusedData; + if (value.getCallData(unusedData) == CallTypeNone) + return SerializedScriptValueData(); + } // Any other types are expected to serialize as null. return SerializedScriptValueData(jsNull()); } @@ -559,8 +652,10 @@ struct DeserializingTreeWalker : public BaseWalker { typedef JSObject* OutputObject; typedef SerializedObject::PropertyNameList PropertyList; - DeserializingTreeWalker(ExecState* exec, bool mustCopy) + DeserializingTreeWalker(ExecState* exec, JSGlobalObject* globalObject, bool mustCopy) : BaseWalker(exec) + , m_globalObject(globalObject) + , m_isDOMGlobalObject(globalObject->inherits(&JSDOMGlobalObject::s_info)) , m_mustCopy(mustCopy) { } @@ -589,14 +684,14 @@ struct DeserializingTreeWalker : public BaseWalker { JSArray* createOutputArray(unsigned length) { - JSArray* array = constructEmptyArray(m_exec); + JSArray* array = constructEmptyArray(m_exec, m_globalObject); array->setLength(length); return array; } JSObject* createOutputObject() { - return constructEmptyObject(m_exec); + return constructEmptyObject(m_exec, m_globalObject); } uint32_t length(RefPtr array) @@ -639,11 +734,35 @@ struct DeserializingTreeWalker : public BaseWalker { case SerializedScriptValueData::NumberType: return jsNumber(m_exec, value.asDouble()); case SerializedScriptValueData::DateType: - return new (m_exec) DateInstance(m_exec, value.asDouble()); - default: + return new (m_exec) DateInstance(m_exec, m_globalObject->dateStructure(), value.asDouble()); + case SerializedScriptValueData::FileType: + if (!m_isDOMGlobalObject) + return jsNull(); + return toJS(m_exec, static_cast(m_globalObject), File::create(value.asString().crossThreadString())); + case SerializedScriptValueData::FileListType: { + if (!m_isDOMGlobalObject) + return jsNull(); + RefPtr result = FileList::create(); + SerializedFileList* serializedFileList = value.asFileList(); + unsigned length = serializedFileList->length(); + for (unsigned i = 0; i < length; i++) + result->append(File::create(serializedFileList->item(i))); + return toJS(m_exec, static_cast(m_globalObject), result.get()); + } + case SerializedScriptValueData::ImageDataType: { + if (!m_isDOMGlobalObject) + return jsNull(); + SerializedImageData* serializedImageData = value.asImageData(); + RefPtr result = ImageData::create(serializedImageData->width(), serializedImageData->height()); + memcpy(result->data()->data()->data(), serializedImageData->data()->data(), serializedImageData->data()->length()); + return toJS(m_exec, static_cast(m_globalObject), result.get()); + } + case SerializedScriptValueData::EmptyType: ASSERT_NOT_REACHED(); - return JSValue(); + return jsNull(); } + ASSERT_NOT_REACHED(); + return jsNull(); } void getPropertyNames(RefPtr object, Vector& properties) @@ -681,12 +800,15 @@ struct DeserializingTreeWalker : public BaseWalker { } private: + void* operator new(size_t); + JSGlobalObject* m_globalObject; + bool m_isDOMGlobalObject; bool m_mustCopy; }; -JSValue SerializedScriptValueData::deserialize(ExecState* exec, bool mustCopy) const +JSValue SerializedScriptValueData::deserialize(ExecState* exec, JSGlobalObject* global, bool mustCopy) const { - DeserializingTreeWalker context(exec, mustCopy); + DeserializingTreeWalker context(exec, global, mustCopy); return walk(context, *this); } @@ -790,11 +912,15 @@ struct TeardownTreeWalker { case SerializedScriptValueData::StringType: case SerializedScriptValueData::ImmediateType: case SerializedScriptValueData::NumberType: + case SerializedScriptValueData::DateType: + case SerializedScriptValueData::EmptyType: + case SerializedScriptValueData::FileType: + case SerializedScriptValueData::FileListType: + case SerializedScriptValueData::ImageDataType: return true; - default: - ASSERT_NOT_REACHED(); - return JSValue(); } + ASSERT_NOT_REACHED(); + return true; } void getPropertyNames(RefPtr object, Vector& properties) @@ -836,4 +962,38 @@ void SerializedScriptValueData::tearDownSerializedData() walk(context, *this); } +SerializedScriptValue::~SerializedScriptValue() +{ +} + +PassRefPtr SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue, JSValueRef* exception) +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(originContext); + JSValue value = toJS(exec, apiValue); + PassRefPtr serializedValue = SerializedScriptValue::create(exec, value); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + return 0; + } + + return serializedValue; +} + +JSValueRef SerializedScriptValue::deserialize(JSContextRef destinationContext, JSValueRef* exception) +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(destinationContext); + JSValue value = deserialize(exec, exec->lexicalGlobalObject()); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + return 0; + } + return toRef(exec, value); +} + } diff --git a/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h b/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h index f8a126f..93bd0de 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h @@ -29,15 +29,25 @@ #include "ScriptValue.h" +typedef const struct OpaqueJSContext* JSContextRef; +typedef const struct OpaqueJSValue* JSValueRef; + namespace WebCore { - class SerializedObject; + class File; + class FileList; + class ImageData; class SerializedArray; + class SerializedFileList; + class SerializedImageData; + class SerializedObject; class SharedSerializedData : public RefCounted { public: virtual ~SharedSerializedData() { } SerializedArray* asArray(); SerializedObject* asObject(); + SerializedFileList* asFileList(); + SerializedImageData* asImageData(); }; class SerializedScriptValue; @@ -51,12 +61,15 @@ namespace WebCore { ImmediateType, ObjectType, ArrayType, - StringType + StringType, + FileType, + FileListType, + ImageDataType }; SerializedType type() const { return m_type; } static SerializedScriptValueData serialize(JSC::ExecState*, JSC::JSValue); - JSC::JSValue deserialize(JSC::ExecState*, bool mustCopy) const; + JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, bool mustCopy) const; ~SerializedScriptValueData() { @@ -74,6 +87,10 @@ namespace WebCore { , m_string(string.crossThreadString()) // FIXME: Should be able to just share the Rep { } + + explicit SerializedScriptValueData(const File*); + explicit SerializedScriptValueData(const FileList*); + explicit SerializedScriptValueData(const ImageData*); explicit SerializedScriptValueData(JSC::JSValue value) : m_type(ImmediateType) @@ -105,7 +122,7 @@ namespace WebCore { String asString() const { - ASSERT(m_type == StringType); + ASSERT(m_type == StringType || m_type == FileType); return m_string; } @@ -123,6 +140,20 @@ namespace WebCore { return m_sharedData->asArray(); } + SerializedFileList* asFileList() const + { + ASSERT(m_type == FileListType); + ASSERT(m_sharedData); + return m_sharedData->asFileList(); + } + + SerializedImageData* asImageData() const + { + ASSERT(m_type == ImageDataType); + ASSERT(m_sharedData); + return m_sharedData->asImageData(); + } + operator bool() const { return m_type != EmptyType; } SerializedScriptValueData release() @@ -150,6 +181,8 @@ namespace WebCore { return adoptRef(new SerializedScriptValue(SerializedScriptValueData::serialize(exec, value))); } + static PassRefPtr create(JSContextRef, JSValueRef value, JSValueRef* exception); + static PassRefPtr create(String string) { return adoptRef(new SerializedScriptValue(SerializedScriptValueData(string))); @@ -175,14 +208,15 @@ namespace WebCore { return m_value.asString(); } - JSC::JSValue deserialize(JSC::ExecState* exec) + JSC::JSValue deserialize(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject) { if (!m_value) return JSC::jsNull(); - return m_value.deserialize(exec, m_mustCopy); + return m_value.deserialize(exec, globalObject, m_mustCopy); } - ~SerializedScriptValue() {} + JSValueRef deserialize(JSContextRef, JSValueRef* exception); + ~SerializedScriptValue(); private: SerializedScriptValue(SerializedScriptValueData value) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp index b66b0e8..adcc089 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/WorkerScriptController.cpp @@ -58,9 +58,6 @@ WorkerScriptController::WorkerScriptController(WorkerContext* workerContext) WorkerScriptController::~WorkerScriptController() { m_workerContextWrapper = 0; // Unprotect the global object. - - ASSERT(!m_globalData->heap.protectedObjectCount()); - ASSERT(!m_globalData->heap.isBusy()); m_globalData->heap.destroy(); } @@ -123,7 +120,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, ExecState* exec = m_workerContextWrapper->globalExec(); m_workerContextWrapper->globalData()->timeoutChecker.start(); - Completion comp = evaluateInWorld(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper, currentWorld(exec)); + Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper); m_workerContextWrapper->globalData()->timeoutChecker.stop(); if (comp.complType() == Normal || comp.complType() == ReturnValue) diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGenerator.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGenerator.pm index c1cb0a0..506e8ea 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGenerator.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGenerator.pm @@ -1,26 +1,26 @@ # # WebKit IDL parser -# +# # Copyright (C) 2005 Nikolas Zimmermann # Copyright (C) 2006 Samuel Weinig # Copyright (C) 2007 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack -# +# # 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 # aint 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. -# +# package CodeGenerator; @@ -39,14 +39,15 @@ my $codeGenerator = 0; my $verbose = 0; -my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1, +my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1, "unsigned int" => 1, "unsigned short" => 1, - "unsigned long" => 1, "unsigned long long" => 1, - "float" => 1, "double" => 1, - "boolean" => 1, "void" => 1); + "unsigned long" => 1, "unsigned long long" => 1, + "float" => 1, "double" => 1, + "boolean" => 1, "void" => 1, + "Date" => 1); my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1); -my %podTypesWithWritablePropertiesHash = ("SVGLength" => 1, "SVGMatrix" => 1, "SVGPoint" => 1, "SVGRect" => 1); +my %podTypesWithWritablePropertiesHash = ("SVGAngle" => 1, "SVGLength" => 1, "SVGMatrix" => 1, "SVGPoint" => 1, "SVGPreserveAspectRatio" => 1, "SVGRect" => 1); my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1); my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1); @@ -327,10 +328,10 @@ sub IsSVGAnimatedType my $type = shift; return 1 if $svgAnimatedTypeHash{$type}; - return 0; + return 0; } -# Uppercase the first letter while respecting WebKit style guidelines. +# Uppercase the first letter while respecting WebKit style guidelines. # E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang. sub WK_ucfirst { @@ -340,12 +341,13 @@ sub WK_ucfirst return $ret; } -# Lowercase the first letter while respecting WebKit style guidelines. +# Lowercase the first letter while respecting WebKit style guidelines. # URL becomes url, but SetURL becomes setURL. sub WK_lcfirst { my ($object, $param) = @_; my $ret = lcfirst($param); + $ret =~ s/hTML/html/ if $ret =~ /^hTML/; $ret =~ s/uRL/url/ if $ret =~ /^uRL/; $ret =~ s/jS/js/ if $ret =~ /^jS/; $ret =~ s/xML/xml/ if $ret =~ /^xML/; diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm deleted file mode 100644 index 4ca441b..0000000 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorCOM.pm +++ /dev/null @@ -1,1319 +0,0 @@ -# -# Copyright (C) 2005, 2006 Nikolas Zimmermann -# Copyright (C) 2006 Anders Carlsson -# Copyright (C) 2006, 2007 Samuel Weinig -# Copyright (C) 2006 Alexey Proskuryakov -# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. -# -# 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 -# aint with this library; see the file COPYING.LIB. If not, write to -# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -package CodeGeneratorCOM; - -use File::stat; - -# Global Variables -my $module = ""; -my $outputDir = ""; - -my @IDLHeader = (); -my @IDLContent = (); -my %IDLIncludes = (); -my %IDLForwardDeclarations = (); -my %IDLDontForwardDeclare = (); -my %IDLImports = (); -my %IDLDontImport = (); - -my @CPPInterfaceHeader = (); - -my @CPPHeaderHeader = (); -my @CPPHeaderContent = (); -my %CPPHeaderIncludes = (); -my %CPPHeaderIncludesAngle = (); -my %CPPHeaderForwardDeclarations = (); -my %CPPHeaderDontForwardDeclarations = (); - -my @CPPImplementationHeader = (); -my @CPPImplementationContent = (); -my %CPPImplementationIncludes = (); -my %CPPImplementationWebCoreIncludes = (); -my %CPPImplementationIncludesAngle = (); -my %CPPImplementationDontIncludes = (); - -my @additionalInterfaceDefinitions = (); - -my $DASHES = "----------------------------------------"; -my $TEMP_PREFIX = "GEN_"; - -# Hashes - -my %includeCorrector = map {($_, 1)} qw{UIEvent KeyboardEvent MouseEvent - MutationEvent OverflowEvent WheelEvent}; - -my %conflictMethod = ( - # FIXME: Add C language keywords? -); - -# Default License Templates -my @licenseTemplate = split(/\r/, << "EOF"); -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -EOF - -# Default constructor -sub new -{ - my $object = shift; - my $reference = { }; - - $codeGenerator = shift; - $outputDir = shift; - - bless($reference, $object); - return $reference; -} - -sub finish -{ - my $object = shift; -} - -# Params: 'domClass' struct -sub GenerateInterface -{ - my $object = shift; - my $dataNode = shift; - my $defines = shift; - - my $name = $dataNode->name; - - my $pureInterface = $dataNode->extendedAttributes->{"PureInterface"}; - - # Start actual generation.. - $object->GenerateIDL($dataNode, $pureInterface); - if ($pureInterface) { - $object->GenerateInterfaceHeader($dataNode); - } else { - $object->GenerateCPPHeader($dataNode); - $object->GenerateCPPImplementation($dataNode); - } - - # Write changes. - $object->WriteData($name, $pureInterface); -} - -# Params: 'idlDocument' struct -sub GenerateModule -{ - my $object = shift; - my $dataNode = shift; - - $module = $dataNode->module; -} - -sub GetInterfaceName -{ - my $name = $codeGenerator->StripModule(shift); - - die "GetInterfaceName should only be used on interfaces." if ($codeGenerator->IsStringType($name) or $codeGenerator->IsPrimitiveType($name)); - - # special cases - return "I" . $TEMP_PREFIX . "DOMAbstractView" if $name eq "DOMWindow"; - return "I" . $TEMP_PREFIX . $name if $name eq "DOMImplementation" or $name eq "DOMTimeStamp"; - - # Default, assume COM type has the same type name as - # idl type prefixed with "IDOM". - return "I" . $TEMP_PREFIX . "DOM" . $name; -} - -sub GetClassName -{ - my $name = $codeGenerator->StripModule(shift); - - # special cases - return "BSTR" if $codeGenerator->IsStringType($name); - return "BOOL" if $name eq "boolean"; - return "unsigned" if $name eq "unsigned long"; - return "int" if $name eq "long"; - return $name if $codeGenerator->IsPrimitiveType($name); - return $TEMP_PREFIX . "DOMAbstractView" if $name eq "DOMWindow"; - return $TEMP_PREFIX . $name if $name eq "DOMImplementation" or $name eq "DOMTimeStamp"; - - # Default, assume COM type has the same type name as - # idl type prefixed with "DOM". - return $TEMP_PREFIX . "DOM" . $name; -} - -sub GetCOMType -{ - my ($type) = @_; - - die "Don't use GetCOMType for string types, use one of In/Out variants instead." if $codeGenerator->IsStringType($type); - - return "BOOL" if $type eq "boolean"; - return "UINT" if $type eq "unsigned long"; - return "INT" if $type eq "long"; - return $type if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp"; - # return "unsigned short" if $type eq "CompareHow" or $type eq "SVGPaintType"; - - return GetInterfaceName($type) . "*"; -} - -sub GetCOMTypeIn -{ - my ($type) = @_; - return "LPCTSTR" if $codeGenerator->IsStringType($type); - return GetCOMType($type); -} - -sub GetCOMTypeOut -{ - my ($type) = @_; - return "BSTR" if $codeGenerator->IsStringType($type); - return GetCOMType($type); -} - -sub IDLTypeToImplementationType -{ - my $type = $codeGenerator->StripModule(shift); - - return "bool" if $type eq "boolean"; - return "unsigned" if $type eq "unsigned long"; - return "int" if $type eq "long"; - return $type if $codeGenerator->IsPrimitiveType($type); - - return "WebCore::String" if $codeGenerator->IsStringType($type); - return "WebCore::${type}"; -} - -sub StripNamespace -{ - my ($type) = @_; - - $type =~ s/^WebCore:://; - - return $type; -} - -sub GetParentInterface -{ - my ($dataNode) = @_; - return "I" . $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0); - return GetInterfaceName($codeGenerator->StripModule($dataNode->parents(0))); -} - -sub GetParentClass -{ - my ($dataNode) = @_; - return $TEMP_PREFIX . "DOMObject" if (@{$dataNode->parents} == 0); - return GetClassName($codeGenerator->StripModule($dataNode->parents(0))); -} - -sub AddForwardDeclarationsForTypeInIDL -{ - my $type = $codeGenerator->StripModule(shift); - - return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type); - - my $interface = GetInterfaceName($type); - $IDLForwardDeclarations{$interface} = 1; - $IDLImports{$interface} = 1; -} - -sub AddIncludesForTypeInCPPHeader -{ - my $type = $codeGenerator->StripModule(shift); - my $useAngleBrackets = shift; - - return if $codeGenerator->IsNonPointerType($type); - - # Add special Cases HERE - - if ($type =~ m/^I/) { - $type = "WebKit"; - } - - if ($useAngleBrackets) { - $CPPHeaderIncludesAngle{"$type.h"} = 1; - return; - } - - if ($type eq "GEN_DOMImplementation") { - $CPPHeaderIncludes{"GEN_DOMDOMImplementation.h"} = 1; - return; - } - - if ($type eq "IGEN_DOMImplementation") { - $CPPHeaderIncludes{"IGEN_DOMDOMImplementation.h"} = 1; - return; - } - - $CPPHeaderIncludes{"$type.h"} = 1; -} - -sub AddForwardDeclarationsForTypeInCPPHeader -{ - my $type = $codeGenerator->StripModule(shift); - - return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type); - - my $interface = GetInterfaceName($type); - $CPPHeaderForwardDeclarations{$interface} = 1; -} - -sub AddIncludesForTypeInCPPImplementation -{ - my $type = $codeGenerator->StripModule(shift); - - die "Include type not supported!" if $includeCorrector{$type}; - - return if $codeGenerator->IsNonPointerType($type); - - if ($codeGenerator->IsStringType($type)) { - $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1; - $CPPImplementationWebCoreIncludes{"BString.h"} = 1; - $CPPImplementationWebCoreIncludes{"KURL.h"} = 1; - return; - } - - # Special casing - $CPPImplementationWebCoreIncludes{"NameNodeList.h"} = 1 if $type eq "NodeList"; - $CPPImplementationWebCoreIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; - - # Add implementation type - $CPPImplementationWebCoreIncludes{StripNamespace(IDLTypeToImplementationType($type)) . ".h"} = 1; - - my $COMClassName = GetClassName($type); - $CPPImplementationIncludes{"${COMClassName}.h"} = 1; -} - -sub GetAdditionalInterfaces -{ - # This function does nothing, but it stays here for future multiple inheritance support. - my $type = $codeGenerator->StripModule(shift); - return (); -} - -sub GenerateIDL -{ - my ($object, $dataNode, $pureInterface) = @_; - - my $inInterfaceName = $dataNode->name; - my $outInterfaceName = GetInterfaceName($inInterfaceName); - my $uuid = $dataNode->extendedAttributes->{"InterfaceUUID"} || die "All classes require an InterfaceUUID extended attribute."; - - my $parentInterfaceName = ($pureInterface) ? "IUnknown" : GetParentInterface($dataNode); - - my $numConstants = @{$dataNode->constants}; - my $numAttributes = @{$dataNode->attributes}; - my $numFunctions = @{$dataNode->functions}; - - # - Add default header template - @IDLHeader = @licenseTemplate; - push(@IDLHeader, "\n"); - - # - INCLUDES - - push(@IDLHeader, "#ifndef DO_NO_IMPORTS\n"); - push(@IDLHeader, "import \"oaidl.idl\";\n"); - push(@IDLHeader, "import \"ocidl.idl\";\n"); - push(@IDLHeader, "#endif\n\n"); - - unless ($pureInterface) { - push(@IDLHeader, "#ifndef DO_NO_IMPORTS\n"); - push(@IDLHeader, "import \"${parentInterfaceName}.idl\";\n"); - push(@IDLHeader, "#endif\n\n"); - - $IDLDontForwardDeclare{$outInterfaceName} = 1; - $IDLDontImport{$outInterfaceName} = 1; - $IDLDontForwardDeclare{$parentInterfaceName} = 1; - $IDLDontImport{$parentInterfaceName} = 1; - } - - # - Begin - # -- Attributes - push(@IDLContent, "[\n"); - push(@IDLContent, " object,\n"); - push(@IDLContent, " oleautomation,\n"); - push(@IDLContent, " uuid(" . $uuid . "),\n"); - push(@IDLContent, " pointer_default(unique)\n"); - push(@IDLContent, "]\n"); - - # -- Interface - push(@IDLContent, "interface " . $outInterfaceName . " : " . $parentInterfaceName . "\n"); - push(@IDLContent, "{\n"); - - - # - FIXME: Add constants. - - - # - Add attribute getters/setters. - if ($numAttributes > 0) { - foreach my $attribute (@{$dataNode->attributes}) { - my $attributeName = $attribute->signature->name; - my $attributeIDLType = $attribute->signature->type; - my $attributeTypeIn = GetCOMTypeIn($attributeIDLType); - my $attributeTypeOut = GetCOMTypeOut($attributeIDLType); - my $attributeIsReadonly = ($attribute->type =~ /^readonly/); - - AddForwardDeclarationsForTypeInIDL($attributeIDLType); - - unless ($attributeIsReadonly) { - # Setter - my $setterName = "set" . $codeGenerator->WK_ucfirst($attributeName); - my $setter = " HRESULT " . $setterName . "([in] " . $attributeTypeIn . ");\n"; - push(@IDLContent, $setter); - } - - # Getter - my $getter = " HRESULT " . $attributeName . "([out, retval] " . $attributeTypeOut . "*);\n\n"; - push(@IDLContent, $getter); - } - } - - # - Add functions. - if ($numFunctions > 0) { - foreach my $function (@{$dataNode->functions}) { - my $functionName = $function->signature->name; - my $returnIDLType = $function->signature->type; - my $returnType = GetCOMTypeOut($returnIDLType); - my $noReturn = ($returnType eq "void"); - - AddForwardDeclarationsForTypeInIDL($returnIDLType); - - my @paramArgList = (); - foreach my $param (@{$function->parameters}) { - my $paramName = $param->name; - my $paramIDLType = $param->type; - my $paramType = GetCOMTypeIn($param->type); - - AddForwardDeclarationsForTypeInIDL($paramIDLType); - - # Form parameter - my $parameter = "[in] ${paramType} ${paramName}"; - - # Add parameter to function signature - push(@paramArgList, $parameter); - } - - unless ($noReturn) { - my $resultParameter = "[out, retval] " . $returnType . "* result"; - push(@paramArgList, $resultParameter); - } - - my $functionSig = " HRESULT " . $functionName . "("; - $functionSig .= join(", ", @paramArgList); - $functionSig .= ");\n\n"; - push(@IDLContent, $functionSig); - } - } - - # - End - push(@IDLContent, "}\n\n"); -} - -sub GenerateInterfaceHeader -{ - my ($object, $dataNode) = @_; - - my $IDLType = $dataNode->name; - my $implementationClass = IDLTypeToImplementationType($IDLType); - my $implementationClassWithoutNamespace = StripNamespace($implementationClass); - my $className = GetClassName($IDLType); - my $interfaceName = GetInterfaceName($IDLType); - - # - Add default header template - @CPPInterfaceHeader = @licenseTemplate; - push(@CPPInterfaceHeader, "\n"); - - # - Header guards - - push(@CPPInterfaceHeader, "#ifndef " . $className . "_h\n"); - push(@CPPInterfaceHeader, "#define " . $className . "_h\n\n"); - - # - Forward Declarations - - push(@CPPInterfaceHeader, "interface ${interfaceName};\n\n"); - push(@CPPInterfaceHeader, "namespace WebCore {\n"); - push(@CPPInterfaceHeader, " class ${implementationClassWithoutNamespace};\n"); - push(@CPPInterfaceHeader, "}\n\n"); - - # - Default Interface Creator - - push(@CPPInterfaceHeader, "${interfaceName}* to${interfaceName}(${implementationClass}*) { return 0; }\n\n"); - - push(@CPPInterfaceHeader, "#endif // " . $className . "_h\n"); -} - -# ----------------------------------------------------------------------------- -# CPP Helper Functions -# ----------------------------------------------------------------------------- - -sub GenerateCPPAttributeSignature -{ - my ($attribute, $className, $options) = @_; - - my $attributeName = $attribute->signature->name; - my $isReadonly = ($attribute->type =~ /^readonly/); - - my $newline = $$options{"NewLines"} ? "\n" : ""; - my $indent = $$options{"Indent"} ? " " x $$options{"Indent"} : ""; - my $semicolon = $$options{"IncludeSemiColon"} ? ";" : ""; - my $virtual = $$options{"AddVirtualKeyword"} ? "virtual " : ""; - my $class = $$options{"UseClassName"} ? "${className}::" : ""; - my $forwarder = $$options{"Forwarder"} ? 1 : 0; - my $joiner = ($$options{"NewLines"} ? "\n" . $indent . " " : ""); - - my %attributeSignatures = (); - - unless ($isReadonly) { - my $attributeTypeIn = GetCOMTypeIn($attribute->signature->type); - my $setterName = "set" . $codeGenerator->WK_ucfirst($attributeName); - my $setter = $indent . $virtual . "HRESULT STDMETHODCALLTYPE ". $class . $setterName . "("; - $setter .= $joiner . "/* [in] */ ${attributeTypeIn} ${attributeName})" . $semicolon . $newline; - if ($forwarder) { - $setter .= " { return " . $$options{"Forwarder"} . "::" . $setterName . "(${attributeName}); }\n"; - } - $attributeSignatures{"Setter"} = $setter; - } - - my $attributeTypeOut = GetCOMTypeOut($attribute->signature->type); - my $getter = $indent . $virtual . "HRESULT STDMETHODCALLTYPE " . $class . $attributeName . "("; - $getter .= $joiner . "/* [retval][out] */ ${attributeTypeOut}* result)" . $semicolon . $newline; - if ($forwarder) { - $getter .= " { return " . $$options{"Forwarder"} . "::" . $attributeName . "(result); }\n"; - } - $attributeSignatures{"Getter"} = $getter; - - return %attributeSignatures; -} - - -sub GenerateCPPAttribute -{ - my ($attribute, $className, $implementationClass, $IDLType) = @_; - - my $implementationClassWithoutNamespace = StripNamespace($implementationClass); - - my $attributeName = $attribute->signature->name; - my $attributeIDLType = $attribute->signature->type; - my $hasSetterException = @{$attribute->setterExceptions}; - my $hasGetterException = @{$attribute->getterExceptions}; - my $isReadonly = ($attribute->type =~ /^readonly/); - my $attributeTypeIsPrimitive = $codeGenerator->IsPrimitiveType($attributeIDLType); - my $attributeTypeIsString = $codeGenerator->IsStringType($attributeIDLType); - my $attributeImplementationType = IDLTypeToImplementationType($attributeIDLType); - my $attributeImplementationTypeWithoutNamespace = StripNamespace($attributeImplementationType); - my $attributeTypeCOMClassName = GetClassName($attributeIDLType); - - $CPPImplementationWebCoreIncludes{"ExceptionCode.h"} = 1 if $hasSetterException or $hasGetterException; - - my %signatures = GenerateCPPAttributeSignature($attribute, $className, { "NewLines" => 1, - "Indent" => 0, - "IncludeSemiColon" => 0, - "UseClassName" => 1, - "AddVirtualKeyword" => 0 }); - - my %attrbutesToReturn = (); - - unless ($isReadonly) { - my @setterImplementation = (); - push(@setterImplementation, $signatures{"Setter"}); - push(@setterImplementation, "{\n"); - - my $setterName = "set" . $codeGenerator->WK_ucfirst($attributeName); - - my @setterParams = (); - if ($attributeTypeIsString) { - push(@setterParams, $attributeName); - if ($hasSetterException) { - push(@setterImplementation, " WebCore::ExceptionCode ec = 0;\n"); - push(@setterParams, "ec"); - } - } elsif ($attributeTypeIsPrimitive) { - if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - push(@setterParams, "WebCore::String::number(${attributeName})"); - } elsif ($attributeIDLType eq "boolean") { - push(@setterParams, "!!${attributeName}"); - } else { - my $primitiveImplementationType = IDLTypeToImplementationType($attributeIDLType); - push(@setterParams, "static_cast<${primitiveImplementationType}>(${attributeName})"); - } - - if ($hasSetterException) { - push(@setterImplementation, " WebCore::ExceptionCode ec = 0;\n"); - push(@setterParams, "ec"); - } - } else { - $CPPImplementationWebCoreIncludes{"COMPtr.h"} = 1; - - push(@setterImplementation, " if (!${attributeName})\n"); - push(@setterImplementation, " return E_POINTER;\n\n"); - push(@setterImplementation, " COMPtr<${attributeTypeCOMClassName}> ptr(Query, ${attributeName});\n"); - push(@setterImplementation, " if (!ptr)\n"); - push(@setterImplementation, " return E_NOINTERFACE;\n"); - - push(@setterParams, "ptr->impl${attributeImplementationTypeWithoutNamespace}()"); - if ($hasSetterException) { - push(@setterImplementation, " WebCore::ExceptionCode ec = 0;\n"); - push(@setterParams, "ec"); - } - } - - # FIXME: CHECK EXCEPTION AND DO SOMETHING WITH IT - - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($IDLType, $contentAttributeName); - $CPPImplementationWebCoreIncludes{"${namespace}.h"} = 1; - push(@setterImplementation, " impl${implementationClassWithoutNamespace}()->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, " . join(", ", @setterParams) . ");\n"); - } else { - push(@setterImplementation, " impl${implementationClassWithoutNamespace}()->${setterName}(" . join(", ", @setterParams) . ");\n"); - } - push(@setterImplementation, " return S_OK;\n"); - push(@setterImplementation, "}\n\n"); - - $attrbutesToReturn{"Setter"} = join("", @setterImplementation); - } - - my @getterImplementation = (); - push(@getterImplementation, $signatures{"Getter"}); - push(@getterImplementation, "{\n"); - push(@getterImplementation, " if (!result)\n"); - push(@getterImplementation, " return E_POINTER;\n\n"); - - my $implementationGetter; - my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; - my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; - if ($reflect || $reflectURL) { - my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); - my $namespace = $codeGenerator->NamespaceForAttributeName($IDLType, $contentAttributeName); - $implIncludes{"${namespace}.h"} = 1; - my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; - $implementationGetter = "impl${implementationClassWithoutNamespace}()->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr)"; - } else { - $implementationGetter = "impl${implementationClassWithoutNamespace}()->" . $codeGenerator->WK_lcfirst($attributeName) . "(" . ($hasGetterException ? "ec" : ""). ")"; - } - - push(@getterImplementation, " WebCore::ExceptionCode ec = 0;\n") if $hasGetterException; - - if ($attributeTypeIsString) { - push(@getterImplementation, " *result = WebCore::BString(${implementationGetter}).release();\n"); - } elsif ($attributeTypeIsPrimitive) { - if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { - push(@getterImplementation, " *result = static_cast<${attributeTypeCOMClassName}>(${implementationGetter}.toInt());\n"); - } else { - push(@getterImplementation, " *result = static_cast<${attributeTypeCOMClassName}>(${implementationGetter});\n"); - } - } else { - $CPPImplementationIncludesAngle{"wtf/GetPtr.h"} = 1; - my $attributeTypeCOMInterfaceName = GetInterfaceName($attributeIDLType); - push(@getterImplementation, " *result = 0;\n"); - push(@getterImplementation, " ${attributeImplementationType}* resultImpl = WTF::getPtr(${implementationGetter});\n"); - push(@getterImplementation, " if (!resultImpl)\n"); - push(@getterImplementation, " return E_POINTER;\n\n"); - push(@getterImplementation, " *result = to${attributeTypeCOMInterfaceName}(resultImpl);\n"); - } - - # FIXME: CHECK EXCEPTION AND DO SOMETHING WITH IT - - push(@getterImplementation, " return S_OK;\n"); - push(@getterImplementation, "}\n\n"); - - $attrbutesToReturn{"Getter"} = join("", @getterImplementation); - - return %attrbutesToReturn; -} - -sub GenerateCPPFunctionSignature -{ - my ($function, $className, $options) = @_; - - my $functionName = $function->signature->name; - my $returnIDLType = $function->signature->type; - my $returnType = GetCOMTypeOut($returnIDLType); - my $noReturn = ($returnType eq "void"); - - my $newline = $$options{"NewLines"} ? "\n" : ""; - my $indent = $$options{"Indent"} ? " " x $$options{"Indent"} : ""; - my $semicolon = $$options{"IncludeSemiColon"} ? ";" : ""; - my $virtual = $$options{"AddVirtualKeyword"} ? "virtual " : ""; - my $class = $$options{"UseClassName"} ? "${className}::" : ""; - my $forwarder = $$options{"Forwarder"} ? 1 : 0; - my $joiner = ($$options{"NewLines"} ? "\n" . $indent . " " : " "); - - my @paramArgList = (); - foreach my $param (@{$function->parameters}) { - my $paramName = $param->name; - my $paramType = GetCOMTypeIn($param->type); - my $parameter = "/* [in] */ ${paramType} ${paramName}"; - push(@paramArgList, $parameter); - } - - unless ($noReturn) { - my $resultParameter .= "/* [out, retval] */ ${returnType}* result"; - push(@paramArgList, $resultParameter); - } - - my $functionSig = $indent . $virtual . "HRESULT STDMETHODCALLTYPE " . $class . $functionName . "("; - $functionSig .= $joiner . join("," . $joiner, @paramArgList) if @paramArgList > 0; - $functionSig .= ")" . $semicolon . $newline; - if ($forwarder) { - my @paramNameList = (); - push(@paramNameList, $_->name) foreach (@{$function->parameters}); - push(@paramNameList, "result") unless $noReturn; - $functionSig .= " { return " . $$options{"Forwarder"} . "::" . $functionName . "(" . join(", ", @paramNameList) . "); }\n"; - } - - return $functionSig -} - -sub GenerateCPPFunction -{ - my ($function, $className, $implementationClass) = @_; - - my @functionImplementation = (); - - my $signature = GenerateCPPFunctionSignature($function, $className, { "NewLines" => 1, - "Indent" => 0, - "IncludeSemiColon" => 0, - "UseClassName" => 1, - "AddVirtualKeyword" => 0 }); - - my $implementationClassWithoutNamespace = StripNamespace($implementationClass); - - my $functionName = $function->signature->name; - my $returnIDLType = $function->signature->type; - my $noReturn = ($returnIDLType eq "void"); - my $raisesExceptions = @{$function->raisesExceptions}; - - AddIncludesForTypeInCPPImplementation($returnIDLType); - $CPPImplementationWebCoreIncludes{"ExceptionCode.h"} = 1 if $raisesExceptions; - - my %needsCustom = (); - my @parameterInitialization = (); - my @parameterList = (); - foreach my $param (@{$function->parameters}) { - my $paramName = $param->name; - my $paramIDLType = $param->type; - - my $paramTypeIsPrimitive = $codeGenerator->IsPrimitiveType($paramIDLType); - my $paramTypeIsString = $codeGenerator->IsStringType($paramIDLType); - - $needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"Return"}; - - AddIncludesForTypeInCPPImplementation($paramIDLType); - - # FIXME: We may need to null check the arguments as well - - if ($paramTypeIsString) { - push(@parameterList, $paramName); - } elsif ($paramTypeIsPrimitive) { - if ($paramIDLType eq "boolean") { - push(@parameterList, "!!${paramName}"); - } else { - my $primitiveImplementationType = IDLTypeToImplementationType($paramIDLType); - push(@parameterList, "static_cast<${primitiveImplementationType}>(${paramName})"); - } - } else { - $CPPImplementationWebCoreIncludes{"COMPtr.h"} = 1; - - $needsCustom{"CanReturnEarly"} = 1; - - my $paramTypeCOMClassName = GetClassName($paramIDLType); - my $paramTypeImplementationWithoutNamespace = StripNamespace(IDLTypeToImplementationType($paramIDLType)); - my $ptrName = "ptrFor" . $codeGenerator->WK_ucfirst($paramName); - my $paramInit = " COMPtr<${paramTypeCOMClassName}> ${ptrName}(Query, ${paramName});\n"; - $paramInit .= " if (!${ptrName})\n"; - $paramInit .= " return E_NOINTERFACE;"; - push(@parameterInitialization, $paramInit); - push(@parameterList, "${ptrName}->impl${paramTypeImplementationWithoutNamespace}()"); - } - } - - push(@parameterList, "ec") if $raisesExceptions; - - my $implementationGetter = "impl${implementationClassWithoutNamespace}()"; - - my $callSigBegin = " "; - my $callSigMiddle = "${implementationGetter}->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterList) . ")"; - my $callSigEnd = ";\n"; - - if (defined $needsCustom{"NodeToReturn"}) { - my $nodeToReturn = $needsCustom{"NodeToReturn"}; - $callSigBegin .= "if ("; - $callSigEnd = ")\n"; - $callSigEnd .= " *result = ${nodeToReturn};"; - } elsif (!$noReturn) { - my $returnTypeIsString = $codeGenerator->IsStringType($returnIDLType); - my $returnTypeIsPrimitive = $codeGenerator->IsPrimitiveType($returnIDLType); - - if ($returnTypeIsString) { - $callSigBegin .= "*result = WebCore::BString("; - $callSigEnd = ").release();\n"; - } elsif ($returnTypeIsPrimitive) { - my $primitiveCOMType = GetClassName($returnIDLType); - $callSigBegin .= "*result = static_cast<${primitiveCOMType}>("; - $callSigEnd = ");"; - } else { - $CPPImplementationIncludesAngle{"wtf/GetPtr.h"} = 1; - my $returnImplementationType = IDLTypeToImplementationType($returnIDLType); - my $returnTypeCOMInterfaceName = GetInterfaceName($returnIDLType); - $callSigBegin .= "${returnImplementationType}* resultImpl = WTF::getPtr("; - $callSigEnd = ");\n"; - $callSigEnd .= " if (!resultImpl)\n"; - $callSigEnd .= " return E_POINTER;\n\n"; - $callSigEnd .= " *result = to${returnTypeCOMInterfaceName}(resultImpl);"; - } - } - - push(@functionImplementation, $signature); - push(@functionImplementation, "{\n"); - unless ($noReturn) { - push(@functionImplementation, " if (!result)\n"); - push(@functionImplementation, " return E_POINTER;\n\n"); - push(@functionImplementation, " *result = 0;\n\n") if $needsCustom{"CanReturnEarly"}; - } - push(@functionImplementation, " WebCore::ExceptionCode ec = 0;\n") if $raisesExceptions; # FIXME: CHECK EXCEPTION AND DO SOMETHING WITH IT - push(@functionImplementation, join("\n", @parameterInitialization) . (@parameterInitialization > 0 ? "\n" : "")); - push(@functionImplementation, $callSigBegin . $callSigMiddle . $callSigEnd . "\n"); - push(@functionImplementation, " return S_OK;\n"); - push(@functionImplementation, "}\n\n"); - - return join("", @functionImplementation); -} - - -# ----------------------------------------------------------------------------- -# CPP Header -# ----------------------------------------------------------------------------- - -sub GenerateCPPHeader -{ - my ($object, $dataNode) = @_; - - my $IDLType = $dataNode->name; - my $implementationClass = IDLTypeToImplementationType($IDLType); - my $implementationClassWithoutNamespace = StripNamespace($implementationClass); - my $className = GetClassName($IDLType); - my $interfaceName = GetInterfaceName($IDLType); - - my $parentClassName = GetParentClass($dataNode); - my @otherInterfacesImplemented = GetAdditionalInterfaces($IDLType); - foreach my $otherInterface (@otherInterfacesImplemented) { - push(@additionalInterfaceDefinitions, $codeGenerator->ParseInterface($otherInterface)); - } - - # FIXME: strip whitespace from UUID - my $uuid = $dataNode->extendedAttributes->{"ImplementationUUID"} || die "All classes require an ImplementationUUID extended attribute."; - - my $numAttributes = @{$dataNode->attributes}; - my $numFunctions = @{$dataNode->functions}; - - # - Add default header template - @CPPHeaderHeader = @licenseTemplate; - push(@CPPHeaderHeader, "\n"); - - # - Header guards - - push(@CPPHeaderHeader, "#ifndef " . $className . "_h\n"); - push(@CPPHeaderHeader, "#define " . $className . "_h\n\n"); - - AddIncludesForTypeInCPPHeader($interfaceName); - AddIncludesForTypeInCPPHeader($parentClassName); - $CPPHeaderDontForwardDeclarations{$className} = 1; - $CPPHeaderDontForwardDeclarations{$interfaceName} = 1; - $CPPHeaderDontForwardDeclarations{$parentClassName} = 1; - - # -- Forward declare implementation type - push(@CPPHeaderContent, "namespace WebCore {\n"); - push(@CPPHeaderContent, " class ". StripNamespace($implementationClass) . ";\n"); - push(@CPPHeaderContent, "}\n\n"); - - # -- Start Class -- - my @parentsClasses = ($parentClassName, $interfaceName); - push(@parentsClasses, map { GetInterfaceName($_) } @otherInterfacesImplemented); - push(@CPPHeaderContent, "class __declspec(uuid(\"$uuid\")) ${className} : " . join(", ", map { "public $_" } @parentsClasses) . " {\n"); - - # Add includes for all additional interfaces to implement - map { AddIncludesForTypeInCPPHeader(GetInterfaceName($_)) } @otherInterfacesImplemented; - - # -- BASICS -- - # FIXME: The constructor and destructor should be protected, but the current design of - # createInstance requires them to be public. One solution is to friend the constructor - # of the top-level-class with every one of its child classes, but that requires information - # this script currently does not have, though possibly could determine. - push(@CPPHeaderContent, "public:\n"); - push(@CPPHeaderContent, " ${className}(${implementationClass}*);\n"); - push(@CPPHeaderContent, " virtual ~${className}();\n\n"); - - push(@CPPHeaderContent, "public:\n"); - push(@CPPHeaderContent, " static ${className}* createInstance(${implementationClass}*);\n\n"); - - push(@CPPHeaderContent, " // IUnknown\n"); - push(@CPPHeaderContent, " virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);\n"); - push(@CPPHeaderContent, " virtual ULONG STDMETHODCALLTYPE AddRef() { return ${parentClassName}::AddRef(); }\n"); - push(@CPPHeaderContent, " virtual ULONG STDMETHODCALLTYPE Release() { return ${parentClassName}::Release(); }\n\n"); - - - # -- Parent Class Forwards -- - if (@{$dataNode->parents}) { - my %attributeNameSet = map {($_->signature->name, 1)} @{$dataNode->attributes}; - my %functionNameSet = map {($_->signature->name, 1)} @{$dataNode->functions}; - - my @parentLists = $codeGenerator->GetMethodsAndAttributesFromParentClasses($dataNode); - push(@CPPHeaderContent, "\n"); - foreach my $parentHash (@parentLists) { - - push(@CPPHeaderContent, " // " . GetInterfaceName($parentHash->{'name'}) . $DASHES . "\n"); - - my @attributeList = @{$parentHash->{'attributes'}}; - push(@CPPHeaderContent, " // Attributes\n"); - foreach my $attribute (@attributeList) { - # Don't forward an attribute that this class redefines. - next if $attributeNameSet{$attribute->signature->name}; - - AddForwardDeclarationsForTypeInCPPHeader($attribute->signature->type); - - my %attributes = GenerateCPPAttributeSignature($attribute, $className, { "NewLines" => 0, - "Indent" => 4, - "IncludeSemiColon" => 0, - "AddVirtualKeyword" => 1, - "UseClassName" => 0, - "Forwarder" => $parentClassName }); - push(@CPPHeaderContent, values(%attributes)); - } - - # Add attribute names to attribute names set in case other ancestors - # also define them. - $attributeNameSet{$_->signature->name} = 1 foreach @attributeList; - - push(@CPPHeaderContent, "\n"); - - my @functionList = @{$parentHash->{'functions'}}; - push(@CPPHeaderContent, " // Functions\n"); - foreach my $function (@functionList) { - # Don't forward a function that this class redefines. - next if $functionNameSet{$function->signature->name}; - - AddForwardDeclarationsForTypeInCPPHeader($function->signature->type); - AddForwardDeclarationsForTypeInCPPHeader($_->type) foreach (@{$function->parameters}); - - my $functionSig = GenerateCPPFunctionSignature($function, $className, { "NewLines" => 0, - "Indent" => 4, - "IncludeSemiColon" => 0, - "AddVirtualKeyword" => 1, - "UseClassName" => 0, - "Forwarder" => $parentClassName }); - - push(@CPPHeaderContent, $functionSig); - } - # Add functions names to functions names set in case other ancestors - # also define them. - $functionNameSet{$_->signature->name} = 1 foreach @functionList; - - push(@CPPHeaderContent, "\n"); - } - } - - # - Additional interfaces to implement - - foreach my $interfaceToImplement (@additionalInterfaceDefinitions) { - my $IDLTypeOfInterfaceToImplement = $interfaceToImplement->name; - my $nameOfInterfaceToImplement = GetInterfaceName($IDLTypeOfInterfaceToImplement); - my $numAttributesInInterface = @{$interfaceToImplement->attributes}; - my $numFunctionsInInterface = @{$interfaceToImplement->functions}; - - push(@CPPHeaderContent, " // ${nameOfInterfaceToImplement} ${DASHES}\n\n"); - - # - Add attribute getters/setters. - if ($numAttributesInInterface > 0) { - push(@CPPHeaderContent, " // Attributes\n\n"); - foreach my $attribute (@{$interfaceToImplement->attributes}) { - AddForwardDeclarationsForTypeInCPPHeader($attribute->signature->type); - - my %attributeSigs = GenerateCPPAttributeSignature($attribute, $className, { "NewLines" => 1, - "Indent" => 4, - "IncludeSemiColon" => 1, - "AddVirtualKeyword" => 1, - "UseClassName" => 0 }); - - push(@CPPHeaderContent, values(%attributeSigs)); - push(@CPPHeaderContent, "\n"); - } - } - - # - Add functions. - if ($numFunctionsInInterface > 0) { - push(@CPPHeaderContent, " // Functions\n\n"); - foreach my $function (@{$interfaceToImplement->functions}) { - AddForwardDeclarationsForTypeInCPPHeader($function->signature->type); - AddForwardDeclarationsForTypeInCPPHeader($_->type) foreach (@{$function->parameters}); - - my $functionSig = GenerateCPPFunctionSignature($function, $className, { "NewLines" => 1, - "Indent" => 4, - "IncludeSemiColon" => 1, - "AddVirtualKeyword" => 1, - "UseClassName" => 0 }); - - push(@CPPHeaderContent, $functionSig); - push(@CPPHeaderContent, "\n"); - } - } - } - - if ($numAttributes > 0 || $numFunctions > 0) { - push(@CPPHeaderContent, " // ${interfaceName} ${DASHES}\n\n"); - } - - # - Add constants COMING SOON - - # - Add attribute getters/setters. - if ($numAttributes > 0) { - push(@CPPHeaderContent, " // Attributes\n\n"); - foreach my $attribute (@{$dataNode->attributes}) { - AddForwardDeclarationsForTypeInCPPHeader($attribute->signature->type); - - my %attributeSigs = GenerateCPPAttributeSignature($attribute, $className, { "NewLines" => 1, - "Indent" => 4, - "IncludeSemiColon" => 1, - "AddVirtualKeyword" => 1, - "UseClassName" => 0 }); - - push(@CPPHeaderContent, values(%attributeSigs)); - push(@CPPHeaderContent, "\n"); - } - } - - # - Add functions. - if ($numFunctions > 0) { - push(@CPPHeaderContent, " // Functions\n\n"); - foreach my $function (@{$dataNode->functions}) { - AddForwardDeclarationsForTypeInCPPHeader($function->signature->type); - AddForwardDeclarationsForTypeInCPPHeader($_->type) foreach (@{$function->parameters}); - - my $functionSig = GenerateCPPFunctionSignature($function, $className, { "NewLines" => 1, - "Indent" => 4, - "IncludeSemiColon" => 1, - "AddVirtualKeyword" => 1, - "UseClassName" => 0 }); - - push(@CPPHeaderContent, $functionSig); - push(@CPPHeaderContent, "\n"); - } - } - - push(@CPPHeaderContent, " ${implementationClass}* impl${implementationClassWithoutNamespace}() const;\n"); - - if (@{$dataNode->parents} == 0) { - AddIncludesForTypeInCPPHeader("wtf/RefPtr", 1); - push(@CPPHeaderContent, "\n"); - push(@CPPHeaderContent, " ${implementationClass}* impl() const { return m_impl.get(); }\n\n"); - push(@CPPHeaderContent, "private:\n"); - push(@CPPHeaderContent, " RefPtr<${implementationClass}> m_impl;\n"); - } - - # -- End Class -- - push(@CPPHeaderContent, "};\n\n"); - - # -- Default Interface Creator -- - push(@CPPHeaderContent, "${interfaceName}* to${interfaceName}(${implementationClass}*);\n\n"); - - push(@CPPHeaderContent, "#endif // " . $className . "_h\n"); -} - - -# ----------------------------------------------------------------------------- -# CPP Implementation -# ----------------------------------------------------------------------------- - -sub GenerateCPPImplementation -{ - my ($object, $dataNode) = @_; - - my $IDLType = $dataNode->name; - my $implementationClass = IDLTypeToImplementationType($IDLType); - my $implementationClassWithoutNamespace = StripNamespace($implementationClass); - my $className = GetClassName($IDLType); - my $interfaceName = GetInterfaceName($IDLType); - - my $parentClassName = GetParentClass($dataNode); - my $isBaseClass = (@{$dataNode->parents} == 0); - - my $uuid = $dataNode->extendedAttributes->{"ImplementationUUID"} || die "All classes require an ImplementationUUID extended attribute."; - - my $numAttributes = @{$dataNode->attributes}; - my $numFunctions = @{$dataNode->functions}; - - # - Add default header template - @CPPImplementationHeader = @licenseTemplate; - push(@CPPImplementationHeader, "\n"); - - push(@CPPImplementationHeader, "#include \"config.h\"\n"); - push(@CPPImplementationHeader, "#include \"WebKitDLL.h\"\n"); - push(@CPPImplementationHeader, "#include " . ($className eq "GEN_DOMImplementation" ? "\"GEN_DOMDOMImplementation.h\"" : "\"${className}.h\"") . "\n"); - $CPPImplementationDontIncludes{"${className}.h"} = 1; - $CPPImplementationWebCoreIncludes{"${implementationClassWithoutNamespace}.h"} = 1; - - # -- Constructor -- - push(@CPPImplementationContent, "${className}::${className}(${implementationClass}* impl)\n"); - if ($isBaseClass) { - push(@CPPImplementationContent, " : m_impl(impl)\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, " ASSERT_ARG(impl, impl);\n"); - push(@CPPImplementationContent, "}\n\n"); - } else { - push(@CPPImplementationContent, " : ${parentClassName}(impl)\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, "}\n\n"); - } - - # -- Destructor -- - push(@CPPImplementationContent, "${className}::~${className}()\n"); - push(@CPPImplementationContent, "{\n"); - if ($isBaseClass) { - $CPPImplementationIncludes{"DOMCreateInstance.h"} = 1; - push(@CPPImplementationContent, " removeDOMWrapper(impl());\n"); - } - push(@CPPImplementationContent, "}\n\n"); - - push(@CPPImplementationContent, "${implementationClass}* ${className}::impl${implementationClassWithoutNamespace}() const\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, " return static_cast<${implementationClass}*>(impl());\n"); - push(@CPPImplementationContent, "}\n\n"); - - # Base classes must implement the createInstance method externally. - if (@{$dataNode->parents} != 0) { - push(@CPPImplementationContent, "${className}* ${className}::createInstance(${implementationClass}* impl)\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, " return static_cast<${className}*>(${parentClassName}::createInstance(impl));\n"); - push(@CPPImplementationContent, "}\n"); - } - - push(@CPPImplementationContent, "// IUnknown $DASHES\n\n"); - - # -- QueryInterface -- - push(@CPPImplementationContent, "HRESULT STDMETHODCALLTYPE ${className}::QueryInterface(REFIID riid, void** ppvObject)\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, " *ppvObject = 0;\n"); - push(@CPPImplementationContent, " if (IsEqualGUID(riid, IID_${interfaceName}))\n"); - push(@CPPImplementationContent, " *ppvObject = reinterpret_cast<${interfaceName}*>(this);\n"); - push(@CPPImplementationContent, " else if (IsEqualGUID(riid, __uuidof(${className})))\n"); - push(@CPPImplementationContent, " *ppvObject = reinterpret_cast<${className}*>(this);\n"); - push(@CPPImplementationContent, " else\n"); - push(@CPPImplementationContent, " return ${parentClassName}::QueryInterface(riid, ppvObject);\n\n"); - push(@CPPImplementationContent, " AddRef();\n"); - push(@CPPImplementationContent, " return S_OK;\n"); - push(@CPPImplementationContent, "}\n\n"); - - # - Additional interfaces to implement - - foreach my $interfaceToImplement (@additionalInterfaceDefinitions) { - my $IDLTypeOfInterfaceToImplement = $interfaceToImplement->name; - my $nameOfInterfaceToImplement = GetInterfaceName($IDLTypeOfInterfaceToImplement); - my $numAttributesInInterface = @{$interfaceToImplement->attributes}; - my $numFunctionsInInterface = @{$interfaceToImplement->functions}; - - push(@CPPImplementationContent, " // ${nameOfInterfaceToImplement} ${DASHES}\n\n"); - - if ($numAttributesInInterface > 0) { - push(@CPPImplementationContent, "// Attributes\n\n"); - foreach my $attribute (@{$interfaceToImplement->attributes}) { - # FIXME: Do this in one step. - # FIXME: Implement exception handling. - - AddIncludesForTypeInCPPImplementation($attribute->signature->type); - - my %attributes = GenerateCPPAttribute($attribute, $className, $implementationClass, $IDLType); - push(@CPPImplementationContent, values(%attributes)); - } - } - - # - Add functions. - if ($numFunctionsInInterface > 0) { - push(@CPPImplementationContent, "// Functions\n\n"); - - foreach my $function (@{$interfaceToImplement->functions}) { - my $functionImplementation = GenerateCPPFunction($function, $className, $implementationClass); - push(@CPPImplementationContent, $functionImplementation); - } - } - } - - push(@CPPImplementationContent, "// ${interfaceName} $DASHES\n\n"); - - # - Add attribute getters/setters. - if ($numAttributes > 0) { - push(@CPPImplementationContent, "// Attributes\n\n"); - foreach my $attribute (@{$dataNode->attributes}) { - # FIXME: do this in one step - my $hasSetterException = @{$attribute->setterExceptions}; - my $hasGetterException = @{$attribute->getterExceptions}; - - AddIncludesForTypeInCPPImplementation($attribute->signature->type); - - my %attributes = GenerateCPPAttribute($attribute, $className, $implementationClass, $IDLType); - push(@CPPImplementationContent, values(%attributes)); - } - } - - # - Add functions. - if ($numFunctions > 0) { - push(@CPPImplementationContent, "// Functions\n\n"); - - foreach my $function (@{$dataNode->functions}) { - my $functionImplementation = GenerateCPPFunction($function, $className, $implementationClass); - push(@CPPImplementationContent, $functionImplementation); - } - } - - # - Default implementation for interface creator. - # FIXME: add extended attribute to add custom implementation if necessary. - push(@CPPImplementationContent, "${interfaceName}* to${interfaceName}(${implementationClass}* impl)\n"); - push(@CPPImplementationContent, "{\n"); - push(@CPPImplementationContent, " return ${className}::createInstance(impl);\n"); - push(@CPPImplementationContent, "}\n"); -} - -sub WriteData -{ - my ($object, $name, $pureInterface) = @_; - - # -- IDL -- - my $IDLFileName = "$outputDir/I" . $TEMP_PREFIX . "DOM" . $name . ".idl"; - unlink($IDLFileName); - - # Write to output IDL. - open(OUTPUTIDL, ">$IDLFileName") or die "Couldn't open file $IDLFileName"; - - # Add header - print OUTPUTIDL @IDLHeader; - - # Add forward declarations and imorts - delete $IDLForwardDeclarations{keys(%IDLDontForwardDeclare)}; - delete $IDLImports{keys(%IDLDontImport)}; - - print OUTPUTIDL map { "cpp_quote(\"interface $_;\")\n" } sort keys(%IDLForwardDeclarations); - print OUTPUTIDL "\n"; - - print OUTPUTIDL map { "interface $_;\n" } sort keys(%IDLForwardDeclarations); - print OUTPUTIDL "\n"; - print OUTPUTIDL "#ifndef DO_NO_IMPORTS\n"; - print OUTPUTIDL map { ($_ eq "IGEN_DOMImplementation") ? "import \"IGEN_DOMDOMImplementation.idl\";\n" : "import \"$_.idl\";\n" } sort keys(%IDLImports); - print OUTPUTIDL "#endif\n"; - print OUTPUTIDL "\n"; - - # Add content - print OUTPUTIDL @IDLContent; - - close(OUTPUTIDL); - - @IDLHeader = (); - @IDLContent = (); - - if ($pureInterface) { - my $CPPInterfaceHeaderFileName = "$outputDir/" . $TEMP_PREFIX . "DOM" . $name . ".h"; - unlink($CPPInterfaceHeaderFileName); - - open(OUTPUTCPPInterfaceHeader, ">$CPPInterfaceHeaderFileName") or die "Couldn't open file $CPPInterfaceHeaderFileName"; - - print OUTPUTCPPInterfaceHeader @CPPInterfaceHeader; - - close(OUTPUTCPPInterfaceHeader); - - @CPPInterfaceHeader = (); - } else { - my $CPPHeaderFileName = "$outputDir/" . $TEMP_PREFIX . "DOM" . $name . ".h"; - unlink($CPPHeaderFileName); - - # -- CPP Header -- - open(OUTPUTCPPHeader, ">$CPPHeaderFileName") or die "Couldn't open file $CPPHeaderFileName"; - - # Add header - print OUTPUTCPPHeader @CPPHeaderHeader; - - # Add includes - print OUTPUTCPPHeader map { ($_ eq "GEN_DOMImplementation.h") ? "#include \"GEN_DOMDOMImplementation.h\"\n" : "#include \"$_\"\n" } sort keys(%CPPHeaderIncludes); - print OUTPUTCPPHeader map { "#include <$_>\n" } sort keys(%CPPHeaderIncludesAngle); - - foreach my $dontDeclare (keys(%CPPHeaderDontForwardDeclarations)) { - delete $CPPHeaderForwardDeclarations{$dontDeclare} if ($CPPHeaderForwardDeclarations{$dontDeclare}); - } - print OUTPUTCPPHeader "\n"; - print OUTPUTCPPHeader map { "interface $_;\n" } sort keys(%CPPHeaderForwardDeclarations); - print OUTPUTCPPHeader "\n"; - - # Add content - print OUTPUTCPPHeader @CPPHeaderContent; - - close(OUTPUTCPPHeader); - - @CPPHeaderHeader = (); - @CPPHeaderContent = (); - - - # -- CPP Implementation -- - my $CPPImplementationFileName = "$outputDir/" . $TEMP_PREFIX . "DOM" . $name . ".cpp"; - unlink($CPPImplementationFileName); - - open(OUTPUTCPPImplementation, ">$CPPImplementationFileName") or die "Couldn't open file $CPPImplementationFileName"; - - # Add header - print OUTPUTCPPImplementation @CPPImplementationHeader; - print OUTPUTCPPImplementation "\n"; - - # Add includes - foreach my $dontInclude (keys(%CPPImplementationDontIncludes)) { - delete $CPPImplementationIncludes{$dontInclude} if ($CPPImplementationIncludes{$dontInclude}); - } - print OUTPUTCPPImplementation map { ($_ eq "GEN_DOMImplementation.h") ? "#include \"GEN_DOMDOMImplementation.h\"\n" : "#include \"$_\"\n" } sort keys(%CPPImplementationIncludes); - print OUTPUTCPPImplementation map { "#include <$_>\n" } sort keys(%CPPImplementationIncludesAngle); - print OUTPUTCPPImplementation "\n"; - - print OUTPUTCPPImplementation "#pragma warning(push, 0)\n"; - print OUTPUTCPPImplementation map { "#include \n" } sort keys(%CPPImplementationWebCoreIncludes); - print OUTPUTCPPImplementation "#pragma warning(pop)\n"; - - # Add content - print OUTPUTCPPImplementation @CPPImplementationContent; - - close(OUTPUTCPPImplementation); - - @CPPImplementationHeader = (); - @CPPImplementationContent = (); - } -} - -1; diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm index d8367ac..94fc2b8 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -37,6 +37,8 @@ my @implContentHeader = (); my @implContent = (); my %implIncludes = (); my @depsContent = (); +my $numCachedAttributes = 0; +my $currentCachedAttribute = 0; # Default .h template my $headerTemplate = << "EOF"; @@ -132,15 +134,7 @@ sub GetParentClassName my $dataNode = shift; return $dataNode->extendedAttributes->{"LegacyParent"} if $dataNode->extendedAttributes->{"LegacyParent"}; - if (@{$dataNode->parents} eq 0) { - # FIXME: SVG types requiring a context() pointer do not have enough - # space to hold a globalObject pointer as well w/o hitting the CELL_SIZE limit. - # This could be fixed by moving context() into the various impl() classes. - # Until then, we special case these SVG bindings and allow them to return - # the wrong prototypes and constructors during x-frame access. See bug 27088. - return "DOMObjectWithSVGContext" if IsSVGTypeNeedingContextParameter($dataNode->name); - return "DOMObjectWithGlobalPointer"; - } + return "DOMObjectWithGlobalPointer" if (@{$dataNode->parents} eq 0); return "JS" . $codeGenerator->StripModule($dataNode->parents(0)); } @@ -169,16 +163,6 @@ sub IndexGetterReturnsStrings return 0; } -sub CreateSVGContextInterfaceName -{ - my $type = shift; - - return $type if $codeGenerator->IsSVGAnimatedType($type); - return "SVGPathSeg" if $type =~ /^SVGPathSeg/ and $type ne "SVGPathSegList"; - - return ""; -} - sub AddIncludesForType { my $type = $codeGenerator->StripModule(shift); @@ -316,7 +300,14 @@ sub GenerateGetOwnPropertySlotBody if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertySlotImpl, " bool ok;\n"); push(@getOwnPropertySlotImpl, " unsigned index = propertyName.toUInt32(&ok, false);\n"); - push(@getOwnPropertySlotImpl, " if (ok && index < static_cast<$implClassName*>(impl())->length()) {\n"); + + # If the item function returns a string then we let the ConvertNullStringTo handle the cases + # where the index is out of range. + if (IndexGetterReturnsStrings($implClassName)) { + push(@getOwnPropertySlotImpl, " if (ok) {\n"); + } else { + push(@getOwnPropertySlotImpl, " if (ok && index < static_cast<$implClassName*>(impl())->length()) {\n"); + } if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertySlotImpl, " slot.setValue(getByIndex(exec, index));\n"); } else { @@ -368,6 +359,14 @@ sub GenerateGetOwnPropertyDescriptorBody my $namespaceMaybe = ($inlined ? "JSC::" : ""); my @getOwnPropertyDescriptorImpl = (); + if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + if ($interfaceName eq "DOMWindow") { + push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); + } else { + push(@implContent, " if (!allowsAccessFromFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); + } + push(@implContent, " return false;\n"); + } if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") { push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}JSValue proto = prototype();\n"); @@ -476,7 +475,6 @@ sub GenerateHeader my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); my $conditional = $dataNode->extendedAttributes->{"Conditional"}; - my $needsSVGContext = IsSVGTypeNeedingContextParameter($interfaceName); my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; @@ -496,8 +494,7 @@ sub GenerateHeader if ($hasParent) { $headerIncludes{"$parentClassName.h"} = 1; } else { - $headerIncludes{"DOMObjectWithSVGContext.h"} = $needsSVGContext; - $headerIncludes{"JSDOMBinding.h"} = !$needsSVGContext; + $headerIncludes{"JSDOMBinding.h"} = 1; $headerIncludes{""} = 1; $headerIncludes{""} = 1; } @@ -544,14 +541,12 @@ sub GenerateHeader push(@headerContent, " $className(NonNullPassRefPtr, PassRefPtr<$implType>, JSDOMWindowShell*);\n"); } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { push(@headerContent, " $className(NonNullPassRefPtr, PassRefPtr<$implType>);\n"); - } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@headerContent, " $className(NonNullPassRefPtr, JSDOMGlobalObject*, PassRefPtr<$implType>, SVGElement* context);\n"); } else { push(@headerContent, " $className(NonNullPassRefPtr, JSDOMGlobalObject*, PassRefPtr<$implType>);\n"); } # Destructor - push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $eventTarget or $interfaceName eq "Document" or $interfaceName eq "DOMWindow"); + push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $eventTarget or $interfaceName eq "DOMWindow"); # Prototype push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}); @@ -559,7 +554,8 @@ sub GenerateHeader $implIncludes{"${className}Custom.h"} = 1 if $dataNode->extendedAttributes->{"CustomHeader"} || $dataNode->extendedAttributes->{"CustomPutFunction"} || $dataNode->extendedAttributes->{"DelegatingPutFunction"}; my $hasGetter = $numAttributes > 0 - || $dataNode->extendedAttributes->{"GenerateConstructor"} + || !($dataNode->extendedAttributes->{"OmitConstructor"} + || $dataNode->extendedAttributes->{"CustomConstructor"}) || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} @@ -610,7 +606,7 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . " }\n\n"); # markChildren function @@ -630,7 +626,7 @@ sub GenerateHeader # Custom getPropertyNames function exists on DOMWindow if ($interfaceName eq "DOMWindow") { - push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n"); + push(@headerContent, " virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n"); $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; } @@ -639,13 +635,10 @@ sub GenerateHeader # Custom getOwnPropertyNames function if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { - push(@headerContent, " virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&);\n"); + push(@headerContent, " virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n"); $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; } - # Custom getPropertyAttributes function - push(@headerContent, " virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier&, unsigned& attributes) const;\n") if $dataNode->extendedAttributes->{"CustomGetPropertyAttributes"}; - # Custom defineGetter function push(@headerContent, " virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"}; @@ -665,7 +658,7 @@ sub GenerateHeader } # Constructor object getter - push(@headerContent, " static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if $dataNode->extendedAttributes->{"GenerateConstructor"}; + push(@headerContent, " static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);\n") if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})); my $numCustomFunctions = 0; my $numCustomAttributes = 0; @@ -677,9 +670,17 @@ sub GenerateHeader $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"}; $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}; $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}; + if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { + push(@headerContent, " static const unsigned " . $attribute->signature->name . "Slot = $numCachedAttributes + Base::AnonymousSlotCount;\n"); + $numCachedAttributes++; + } } } + if ($numCachedAttributes > 0) { + push(@headerContent, " using $parentClassName" . "::putAnonymousValue;\n"); + push(@headerContent, " using $parentClassName" . "::getAnonymousValue;\n"); + } if ($numCustomAttributes > 0) { push(@headerContent, "\n // Custom attributes\n"); @@ -726,6 +727,12 @@ sub GenerateHeader push(@headerContent, " }\n"); } + # anonymous slots + if ($numCachedAttributes) { + push(@headerContent, "public:\n"); + push(@headerContent, " static const unsigned AnonymousSlotCount = $numCachedAttributes + Base::AnonymousSlotCount;\n"); + } + # structure flags push(@headerContent, "protected:\n"); push(@headerContent, " static const unsigned StructureFlags = "); @@ -769,7 +776,7 @@ sub GenerateHeader if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) { if ($podType) { - push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSSVGPODTypeWrapper<$podType>*, SVGElement* context);\n"); + push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSSVGPODTypeWrapper<$podType>*, SVGElement*);\n"); } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*, SVGElement* context);\n"); } else { @@ -818,7 +825,7 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr createStructure(JSC::JSValue prototype)\n" . " {\n" . - " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags));\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n" . " }\n"); if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) { push(@headerContent, " virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); @@ -848,7 +855,7 @@ sub GenerateHeader } } - if ($numAttributes > 0 || $dataNode->extendedAttributes->{"GenerateConstructor"}) { + if ($numAttributes > 0 || !($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { push(@headerContent,"// Attributes\n\n"); foreach my $attribute (@{$dataNode->attributes}) { my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : ""); @@ -859,7 +866,7 @@ sub GenerateHeader } } - if ($dataNode->extendedAttributes->{"GenerateConstructor"}) { + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { my $getter = "js" . $interfaceName . "Constructor"; push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n"); } @@ -928,7 +935,7 @@ sub GenerateImplementation # - Add all attributes in a hashtable definition my $numAttributes = @{$dataNode->attributes}; - $numAttributes++ if $dataNode->extendedAttributes->{"GenerateConstructor"}; + $numAttributes++ if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})); if ($numAttributes > 0) { my $hashSize = $numAttributes; @@ -969,7 +976,7 @@ sub GenerateImplementation } } - if ($dataNode->extendedAttributes->{"GenerateConstructor"}) { + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { push(@hashKeys, "constructor"); my $getter = "js" . $interfaceName . "Constructor"; push(@hashValue1, $getter); @@ -987,7 +994,7 @@ sub GenerateImplementation my $numFunctions = @{$dataNode->functions}; # - Add all constants - if ($dataNode->extendedAttributes->{"GenerateConstructor"}) { + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { $hashSize = $numConstants; $hashName = $className . "ConstructorTable"; @@ -1159,9 +1166,6 @@ sub GenerateImplementation my $podType = $dataNode->extendedAttributes->{"PODType"}; my $implType = $podType ? "JSSVGPODTypeWrapper<$podType> " : $implClassName; - my $needsSVGContext = IsSVGTypeNeedingContextParameter($implClassName); - my $parentNeedsSVGContext = ($needsSVGContext and $parentClassName =~ /SVG/); - # Constructor if ($interfaceName eq "DOMWindow") { AddIncludesForType("JSDOMWindowShell"); @@ -1172,16 +1176,19 @@ sub GenerateImplementation push(@implContent, "${className}::$className(NonNullPassRefPtr structure, PassRefPtr<$implType> impl)\n"); push(@implContent, " : $parentClassName(structure, impl)\n"); } else { - my $contextArg = $needsSVGContext ? ", SVGElement* context" : ""; - push(@implContent, "${className}::$className(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl$contextArg)\n"); + push(@implContent, "${className}::$className(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); if ($hasParent) { - push(@implContent, " : $parentClassName(structure, globalObject, impl" . ($parentNeedsSVGContext ? ", context" : "") . ")\n"); + push(@implContent, " : $parentClassName(structure, globalObject, impl)\n"); } else { - push(@implContent, " : $parentClassName(structure, globalObject" . ($needsSVGContext ? ", context" : "") . ")\n"); + push(@implContent, " : $parentClassName(structure, globalObject)\n"); push(@implContent, " , m_impl(impl)\n"); } } push(@implContent, "{\n"); + if ($numCachedAttributes > 0) { + push(@implContent, " for (unsigned i = Base::AnonymousSlotCount; i < AnonymousSlotCount; i++)\n"); + push(@implContent, " putAnonymousValue(i, JSValue());\n"); + } push(@implContent, "}\n\n"); # Destructor @@ -1191,41 +1198,27 @@ sub GenerateImplementation if ($eventTarget) { $implIncludes{"RegisteredEventListener.h"} = 1; - push(@implContent, " impl()->invalidateEventListeners();\n"); + push(@implContent, " impl()->invalidateJSEventListeners(this);\n"); } if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { if ($interfaceName eq "Node") { push(@implContent, " forgetDOMNode(this, impl(), impl()->document());\n"); } else { - if ($podType) { - my $animatedType = $implClassName; - $animatedType =~ s/SVG/SVGAnimated/; - - # Special case for JSSVGNumber - if ($codeGenerator->IsSVGAnimatedType($animatedType) and $podType ne "float") { - push(@implContent, " JSSVGDynamicPODTypeWrapperCache<$podType, $animatedType>::forgetWrapper(m_impl.get());\n"); - } - } push(@implContent, " forgetDOMObject(this, impl());\n"); } + + push(@implContent, " JSSVGContextCache::forgetWrapper(this);\n") if IsSVGTypeNeedingContextParameter($implClassName); } push(@implContent, "}\n\n"); } - # Document needs a special destructor because it's a special case for caching. It needs - # its own special handling rather than relying on the caching that Node normally does. - if ($interfaceName eq "Document") { - push(@implContent, "${className}::~$className()\n"); - push(@implContent, "{\n forgetDOMObject(this, static_cast<${implClassName}*>(impl()));\n}\n\n"); - } - if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { push(@implContent, "void ${className}::markChildren(MarkStack& markStack)\n"); push(@implContent, "{\n"); push(@implContent, " Base::markChildren(markStack);\n"); - push(@implContent, " impl()->markEventListeners(markStack);\n"); + push(@implContent, " impl()->markJSEventListeners(markStack);\n"); push(@implContent, "}\n\n"); } @@ -1241,7 +1234,8 @@ sub GenerateImplementation } my $hasGetter = $numAttributes > 0 - || $dataNode->extendedAttributes->{"GenerateConstructor"} + || !($dataNode->extendedAttributes->{"OmitConstructor"} + || $dataNode->extendedAttributes->{"CustomConstructor"}) || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} @@ -1324,12 +1318,14 @@ sub GenerateImplementation push(@implContent, " UNUSED_PARAM(exec);\n"); push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n"); push(@implContent, " if (EventListener* listener = imp->$implGetterFunctionName()) {\n"); + push(@implContent, " if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n"); if ($implClassName eq "Document" || $implClassName eq "WorkerContext" || $implClassName eq "SharedWorkerContext" || $implClassName eq "DedicatedWorkerContext") { - push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp))\n"); + push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp))\n"); } else { - push(@implContent, " if (JSObject* jsFunction = listener->jsFunction(imp->scriptExecutionContext()))\n"); + push(@implContent, " if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))\n"); } - push(@implContent, " return jsFunction;\n"); + push(@implContent, " return jsFunction;\n"); + push(@implContent, " }\n"); push(@implContent, " }\n"); push(@implContent, " return jsNull();\n"); } elsif ($attribute->signature->type =~ /Constructor$/) { @@ -1340,12 +1336,19 @@ sub GenerateImplementation push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n"); } elsif (!@{$attribute->getterExceptions}) { push(@implContent, " UNUSED_PARAM(exec);\n"); + my $cacheIndex = 0; + if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { + $cacheIndex = $currentCachedAttribute; + $currentCachedAttribute++; + push(@implContent, " if (JSValue cachedValue = castedThis->getAnonymousValue(" . $className . "::" . $attribute->signature->name . "Slot))\n"); + push(@implContent, " return cachedValue;\n"); + } if ($podType) { push(@implContent, " $podType imp(*castedThis->impl());\n"); if ($podType eq "float") { # Special case for JSSVGNumber - push(@implContent, " return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp", "castedThis") . ";\n"); + push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp", "castedThis") . ";\n"); } else { - push(@implContent, " return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "castedThis") . ";\n"); + push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "castedThis") . ";\n"); } } else { push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThis->impl());\n"); @@ -1364,11 +1367,15 @@ sub GenerateImplementation my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, $value, "castedThis"); if ($codeGenerator->IsSVGAnimatedType($type)) { push(@implContent, " RefPtr<$type> obj = $jsType;\n"); - push(@implContent, " return toJS(exec, castedThis->globalObject(), obj.get(), imp);\n"); + push(@implContent, " JSValue result = toJS(exec, castedThis->globalObject(), obj.get(), imp);\n"); } else { - push(@implContent, " return $jsType;\n"); + push(@implContent, " JSValue result = $jsType;\n"); } } + + push(@implContent, " castedThis->putAnonymousValue(" . $className . "::" . $attribute->signature->name . "Slot, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"}); + push(@implContent, " return result;\n"); + } else { push(@implContent, " ExceptionCode ec = 0;\n"); if ($podType) { @@ -1392,20 +1399,13 @@ sub GenerateImplementation push(@implContent, "\n"); } - if ($dataNode->extendedAttributes->{"GenerateConstructor"}) { + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { my $constructorFunctionName = "js" . $interfaceName . "Constructor"; push(@implContent, "JSValue ${constructorFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n"); push(@implContent, "{\n"); - if (IsSVGTypeNeedingContextParameter($interfaceName)) { - # FIXME: SVG bindings with a context pointer have no space to store a globalObject - # so we use deprecatedGlobalObjectForPrototype instead. - push(@implContent, " UNUSED_PARAM(slot);\n"); - push(@implContent, " return ${className}::getConstructor(exec, deprecatedGlobalObjectForPrototype(exec));\n"); - } else { - push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slot.slotBase()));\n"); - push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n"); - } + push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slot.slotBase()));\n"); + push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n"); push(@implContent, "}\n"); } } @@ -1479,16 +1479,7 @@ sub GenerateImplementation $implIncludes{"JSEventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n"); - if ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) { - push(@implContent, " JSDOMGlobalObject* globalObject = static_cast<$className*>(thisObject);\n"); - } else { - $implIncludes{"Frame.h"} = 1; - $implIncludes{"JSDOMGlobalObject.h"} = 1; - push(@implContent, " JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(imp->scriptExecutionContext(), exec);\n"); - push(@implContent, " if (!globalObject)\n"); - push(@implContent, " return;\n"); - } - push(@implContent, " imp->set$implSetterFunctionName(globalObject->createJSAttributeEventListener(value));\n"); + push(@implContent, " imp->set$implSetterFunctionName(createJSAttributeEventListener(exec, value, thisObject));\n"); } elsif ($attribute->signature->type =~ /Constructor$/) { my $constructorType = $attribute->signature->type; $constructorType =~ s/Constructor$//; @@ -1499,16 +1490,17 @@ sub GenerateImplementation push(@implContent, " // Shadowing a built-in object\n"); push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n"); } else { + push(@implContent, " $className* castedThisObj = static_cast<$className*>(thisObject);\n"); + push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n"); if ($podType) { - push(@implContent, " $podType imp(*static_cast<$className*>(thisObject)->impl());\n"); + push(@implContent, " $podType podImp(*imp);\n"); if ($podType eq "float") { # Special case for JSSVGNumber - push(@implContent, " imp = " . JSValueToNative($attribute->signature, "value") . ";\n"); + push(@implContent, " podImp = " . JSValueToNative($attribute->signature, "value") . ";\n"); } else { - push(@implContent, " imp.set$implSetterFunctionName(" . JSValueToNative($attribute->signature, "value") . ");\n"); + push(@implContent, " podImp.set$implSetterFunctionName(" . JSValueToNative($attribute->signature, "value") . ");\n"); } - push(@implContent, " static_cast<$className*>(thisObject)->impl()->commitChange(imp, static_cast<$className*>(thisObject)->context());\n"); + push(@implContent, " imp->commitChange(podImp, castedThisObj);\n"); } else { - push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n"); my $nativeValue = JSValueToNative($attribute->signature, "value"); push(@implContent, " ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; @@ -1524,10 +1516,8 @@ sub GenerateImplementation push(@implContent, ", ec") if @{$attribute->setterExceptions}; push(@implContent, ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; - if (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, " if (static_cast<$className*>(thisObject)->context())\n"); - push(@implContent, " static_cast<$className*>(thisObject)->context()->svgAttributeChanged(static_cast<$className*>(thisObject)->impl()->associatedAttributeName());\n"); + push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThisObj, imp->associatedAttributeName());\n"); } } } @@ -1540,17 +1530,17 @@ sub GenerateImplementation } if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { - push(@implContent, "void ${className}::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)\n"); + push(@implContent, "void ${className}::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)\n"); push(@implContent, "{\n"); if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@implContent, " for (unsigned i = 0; i < static_cast<${implClassName}*>(impl())->length(); ++i)\n"); push(@implContent, " propertyNames.add(Identifier::from(exec, i));\n"); } - push(@implContent, " Base::getOwnPropertyNames(exec, propertyNames);\n"); + push(@implContent, " Base::getOwnPropertyNames(exec, propertyNames, mode);\n"); push(@implContent, "}\n\n"); } - if ($dataNode->extendedAttributes->{"GenerateConstructor"}) { + if (!($dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { push(@implContent, "JSValue ${className}::getConstructor(ExecState* exec, JSGlobalObject* globalObject)\n{\n"); push(@implContent, " return getDOMConstructor<${className}Constructor>(exec, static_cast(globalObject));\n"); push(@implContent, "}\n\n"); @@ -1590,15 +1580,31 @@ sub GenerateImplementation push(@implContent, " return jsUndefined();\n"); } + # Special case for JSSVGLengthList / JSSVGTransformList / JSSVGPointList / JSSVGNumberList + # Instead of having JSSVG*Custom.cpp implementations for the SVGList interface for all of these + # classes, we directly forward the calls to JSSVGPODListCustom, which centralizes the otherwise + # duplicated code for the JSSVG*List classes mentioned above. + my $svgPODListType; + if ($implClassName =~ /SVG.*List/) { + $svgPODListType = $implClassName; + $svgPODListType =~ s/List$//; + $svgPODListType = "" unless $codeGenerator->IsPodType($svgPODListType); + + # Ignore additional (non-SVGList) SVGTransformList methods, that are not handled through JSSVGPODListCustom + $svgPODListType = "" if $functionImplementationName =~ /createSVGTransformFromMatrix/; + $svgPODListType = "" if $functionImplementationName =~ /consolidate/; + } + if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { push(@implContent, " return castedThisObj->" . $functionImplementationName . "(exec, args);\n"); + } elsif ($svgPODListType) { + $implIncludes{"JS${svgPODListType}.h"} = 1; + $implIncludes{"JSSVGPODListCustom.h"} = 1; + push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) + . ">(castedThisObj, exec, args, to" . $svgPODListType . ");\n"); } else { - if ($podType) { - push(@implContent, " JSSVGPODTypeWrapper<$podType>* wrapper = castedThisObj->impl();\n"); - push(@implContent, " $podType imp(*wrapper);\n"); - } else { - push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThisObj->impl());\n"); - } + push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n"); + push(@implContent, " $podType podImp(*imp);\n") if $podType; my $numParameters = @{$function->parameters}; @@ -1618,7 +1624,7 @@ sub GenerateImplementation } my $paramIndex = 0; - my $functionString = "imp" . ($podType ? "." : "->") . $functionImplementationName . "("; + my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; my $hasOptionalArguments = 0; @@ -1672,7 +1678,12 @@ sub GenerateImplementation } else { $functionString .= $name; } + $paramIndex++; + } + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionString .= ", " if $paramIndex; + $functionString .= "processingUserGesture(exec)"; $paramIndex++; } @@ -1729,11 +1740,10 @@ sub GenerateImplementation if ($podType) { push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JSSVGPODTypeWrapper<$podType>* object, SVGElement* context)\n"); } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n"); + push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n"); } else { push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n"); } - push(@implContent, "{\n"); if ($podType) { push(@implContent, " return getDOMObjectWrapper<$className, JSSVGPODTypeWrapper<$podType> >(exec, globalObject, object, context);\n"); @@ -1791,11 +1801,7 @@ sub GenerateImplementationFunctionCall() if ($function->signature->type eq "void") { push(@implContent, $indent . "$functionString;\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; - - if ($podType) { - push(@implContent, $indent . "wrapper->commitChange(imp, castedThisObj->context());\n"); - } - + push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n") if $podType; push(@implContent, $indent . "return jsUndefined();\n"); } else { push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n"); @@ -1804,7 +1810,7 @@ sub GenerateImplementationFunctionCall() if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) { # Immutable methods do not commit changes back to the instance, thus producing # a new instance rather than mutating existing one. - push(@implContent, $indent . "wrapper->commitChange(imp, castedThisObj->context());\n"); + push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n"); } push(@implContent, $indent . "return result;\n"); @@ -1828,10 +1834,12 @@ my %nativeType = ( "CompareHow" => "Range::CompareHow", "DOMString" => "const UString&", "NodeFilter" => "RefPtr", + "SVGAngle" => "SVGAngle", "SVGLength" => "SVGLength", - "SVGMatrix" => "TransformationMatrix", + "SVGMatrix" => "AffineTransform", "SVGNumber" => "float", "SVGPaintType" => "SVGPaint::SVGPaintType", + "SVGPreserveAspectRatio" => "SVGPreserveAspectRatio", "SVGPoint" => "FloatPoint", "SVGRect" => "FloatRect", "SVGTransform" => "SVGTransform", @@ -1841,6 +1849,8 @@ my %nativeType = ( "long" => "int", "unsigned long" => "unsigned", "unsigned short" => "unsigned short", + "long long" => "long long", + "unsigned long long" => "unsigned long long", ); sub GetNativeType @@ -1864,7 +1874,9 @@ sub JSValueToNative return "$value.toNumber(exec)" if $type eq "double"; return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber"; return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short"; + return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long"; + return "valueToDate(exec, $value)" if $type eq "Date"; return "static_cast($value.toInt32(exec))" if $type eq "CompareHow"; return "static_cast($value.toInt32(exec))" if $type eq "SVGPaintType"; @@ -1874,7 +1886,7 @@ sub JSValueToNative return "$value.toString(exec)"; } - if ($type eq "SerializedScriptValue") { + if ($type eq "SerializedScriptValue" or $type eq "any") { $implIncludes{"SerializedScriptValue.h"} = 1; return "SerializedScriptValue::create(exec, $value)"; } @@ -1902,7 +1914,11 @@ sub NativeToJSValue my $type = $codeGenerator->StripModule($signature->type); return "jsBoolean($value)" if $type eq "boolean"; - + + # Need to check Date type before IsPrimitiveType(). + if ($type eq "Date") { + return "jsDateOrNull(exec, $value)"; + } if ($codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType" or $type eq "DOMTimeStamp") { $implIncludes{""} = 1; return "jsNumber(exec, $value)"; @@ -1922,9 +1938,7 @@ sub NativeToJSValue return "jsString(exec, $value)"; } - # Some SVG bindings don't have space to store a globalObject pointer, for those, we use the deprecatedGlobalObjectForPrototype hack for now. - my $globalObject = IsSVGTypeNeedingContextParameter($implClassName) ? "deprecatedGlobalObjectForPrototype(exec)" : "$thisValue->globalObject()"; - + my $globalObject = "$thisValue->globalObject()"; if ($codeGenerator->IsPodType($type)) { $implIncludes{"JS$type.h"} = 1; @@ -1942,25 +1956,16 @@ sub NativeToJSValue and $codeGenerator->IsPodTypeWithWriteableProperties($type) and not defined $signature->extendedAttributes->{"Immutable"}) { if ($codeGenerator->IsPodType($implClassName)) { - return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>::create($value, $thisValue->impl()).get(), $thisValue->context())"; + return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>::create($value, $thisValue->impl()).get(), JSSVGContextCache::svgContextForDOMObject(castedThis))"; } else { return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithParent<$nativeType, $implClassName>::create(imp, &${implClassName}::$getter, &${implClassName}::$setter).get(), imp)"; } } if ($implClassNameForValueConversion eq "") { - # SVGZoomEvent has no context() pointer, and is also not an SVGElement. - # This is not a problem, because SVGZoomEvent has no read/write properties. - return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), 0)" if $implClassName eq "SVGZoomEvent"; - - if (IsSVGTypeNeedingContextParameter($implClassName)) { - return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), castedThisObj->context())" if $inFunctionCall; - return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), $thisValue->context())"; - } else { - return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), imp)"; - } - } else { # These classes, always have a m_context pointer! - return "toJS(exec, $globalObject, JSSVGDynamicPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter).get(), $thisValue->context())"; + return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), 0 /* no context on purpose */)"; + } else { + return "toJS(exec, $globalObject, JSSVGDynamicPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter).get(), JSSVGContextCache::svgContextForDOMObject(castedThis));" } } @@ -1986,9 +1991,9 @@ sub NativeToJSValue $joinedName = $type; $joinedName =~ s/Abs|Rel//; $implIncludes{"$joinedName.h"} = 1; - } elsif ($type eq "SerializedScriptValue") { - $implIncludes{"$type.h"} = 1; - return "$value->deserialize(exec)"; + } elsif ($type eq "SerializedScriptValue" or $type eq "any") { + $implIncludes{"SerializedScriptValue.h"} = 1; + return "$value ? $value->deserialize(exec, castedThis->globalObject()) : jsNull()"; } else { # Default, include header with same name. $implIncludes{"JS$type.h"} = 1; @@ -1998,7 +2003,7 @@ sub NativeToJSValue return $value if $codeGenerator->IsSVGAnimatedType($type); if (IsSVGTypeNeedingContextParameter($type)) { - my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "$thisValue->context()" : "imp"; + my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "JSSVGContextCache::svgContextForDOMObject(castedThis)" : "imp"; return "toJS(exec, $globalObject, WTF::getPtr($value), $contextPtr)"; } @@ -2283,7 +2288,7 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } protected: diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 91248c5..dcb22a7 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -66,7 +66,7 @@ my %nativeObjCTypeHash = ("URL" => 1, "Color" => 1); my %baseTypeHash = ("Object" => 1, "Node" => 1, "NodeList" => 1, "NamedNodeMap" => 1, "DOMImplementation" => 1, "Event" => 1, "CSSRule" => 1, "CSSValue" => 1, "StyleSheet" => 1, "MediaList" => 1, "Counter" => 1, "Rect" => 1, "RGBColor" => 1, "XPathExpression" => 1, "XPathResult" => 1, - "NodeIterator" => 1, "TreeWalker" => 1, "AbstractView" => 1, + "NodeIterator" => 1, "TreeWalker" => 1, "AbstractView" => 1, "Blob" => 1, "SVGAngle" => 1, "SVGAnimatedAngle" => 1, "SVGAnimatedBoolean" => 1, "SVGAnimatedEnumeration" => 1, "SVGAnimatedInteger" => 1, "SVGAnimatedLength" => 1, "SVGAnimatedLengthList" => 1, "SVGAnimatedNumber" => 1, "SVGAnimatedNumberList" => 1, "SVGAnimatedPoints" => 1, @@ -316,6 +316,7 @@ sub GetClassName return "BOOL" if $name eq "boolean"; return "unsigned" if $name eq "unsigned long"; return "int" if $name eq "long"; + return "NSTimeInterval" if $name eq "Date"; return "DOMAbstractView" if $name eq "DOMWindow"; return $name if $codeGenerator->IsPrimitiveType($name) or $name eq "DOMImplementation" or $name eq "DOMTimeStamp"; @@ -577,7 +578,7 @@ sub AddIncludesForType } if ($type eq "SVGMatrix") { - $implIncludes{"TransformationMatrix.h"} = 1; + $implIncludes{"AffineTransform.h"} = 1; $implIncludes{"DOMSVGMatrixInternal.h"} = 1; $implIncludes{"SVGException.h"} = 1; return; @@ -1040,6 +1041,7 @@ sub GenerateImplementation $implIncludes{$classHeaderName . "Internal.h"} = 1; # FIXME: These includes are only needed when the class is a subclass of one of these polymorphic classes. + $implIncludes{"DOMBlobInternal.h"} = 1; $implIncludes{"DOMCSSRuleInternal.h"} = 1; $implIncludes{"DOMCSSValueInternal.h"} = 1; $implIncludes{"DOMEventInternal.h"} = 1; @@ -1221,7 +1223,7 @@ sub GenerateImplementation $getterContentTail .= ")"; } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { $getterContentTail .= ".toInt()"; - } elsif ($codeGenerator->IsPodType($idlType)) { + } elsif ($codeGenerator->IsPodType($idlType) or $idlType eq "Date") { $getterContentHead = "kit($getterContentHead"; $getterContentTail .= ")"; } elsif (IsProtocolType($idlType) and $idlType ne "EventTarget") { @@ -1292,6 +1294,10 @@ sub GenerateImplementation push(@implContent, " ASSERT($argName);\n\n"); } + if ($idlType eq "Date") { + $arg = "core(" . $arg . ")"; + } + if ($podType) { # Special case for DOMSVGNumber if ($podType eq "float") { @@ -1420,8 +1426,8 @@ sub GenerateImplementation } # FIXME! We need [Custom] support for ObjC, to move these hacks into DOMSVGLength/MatrixCustom.mm - my $svgMatrixRotateFromVector = ($podType and $podType eq "TransformationMatrix" and $functionName eq "rotateFromVector"); - my $svgMatrixInverse = ($podType and $podType eq "TransformationMatrix" and $functionName eq "inverse"); + my $svgMatrixRotateFromVector = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector"); + my $svgMatrixInverse = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse"); my $svgLengthConvertToSpecifiedUnits = ($podType and $podType eq "SVGLength" and $functionName eq "convertToSpecifiedUnits"); push(@parameterNames, "ec") if $raisesExceptions and !($svgMatrixRotateFromVector || $svgMatrixInverse); diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm index 95b2aa2..ee51ec3 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -7,8 +7,6 @@ # Copyright (C) 2007, 2008, 2009 Google Inc. # Copyright (C) 2009 Cameron McCormack # -# This file is part of the KDE project -# # 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 @@ -158,14 +156,15 @@ sub AddIncludesForType # When we're finished with the one-file-per-class # reorganization, we won't need these special cases. - if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type)) { - } elsif ($type =~ /SVGPathSeg/) { - $joinedName = $type; - $joinedName =~ s/Abs|Rel//; - $implIncludes{"${joinedName}.h"} = 1; - } else { + if (!$codeGenerator->IsPrimitiveType($type) and !AvoidInclusionOfType($type) and $type ne "Date") { # default, include the same named file - $implIncludes{GetImplementationFileName(${type})} = 1; + $implIncludes{GetV8HeaderName(${type})} = 1; + + if ($type =~ /SVGPathSeg/) { + $joinedName = $type; + $joinedName =~ s/Abs|Rel//; + $implIncludes{"${joinedName}.h"} = 1; + } } # additional includes (things needed to compile the bindings but not the header) @@ -212,17 +211,6 @@ sub AddClassForwardIfNeeded push(@headerContent, "class $implClassName;\n\n") unless $codeGenerator->IsSVGAnimatedType($implClassName); } -sub GetImplementationFileName -{ - my $iface = shift; - return "Event.h" if $iface eq "DOMTimeStamp"; - return "NamedAttrMap.h" if $iface eq "NamedNodeMap"; - return "NameNodeList.h" if $iface eq "NodeList"; - return "XMLHttpRequest.h" if $iface eq "XMLHttpRequest"; - - return "${iface}.h"; -} - # If the node has a [Conditional=XXX] attribute, returns an "ENABLE(XXX)" string for use in an #if. sub GenerateConditionalString { @@ -260,22 +248,33 @@ sub GenerateHeader # Get correct pass/store types respecting PODType flag my $podType = $dataNode->extendedAttributes->{"PODType"}; - my $passType = $podType ? "JSSVGPODTypeWrapper<$podType>*" : "$implClassName*"; push(@headerContent, "#include \"$podType.h\"\n") if $podType and ($podType ne "double" and $podType ne "float" and $podType ne "RGBA32"); push(@headerContent, "#include \n"); push(@headerContent, "#include \n"); push(@headerContent, "#include \"StringHash.h\"\n"); - - push(@headerContent, "\nnamespace WebCore {\n\n"); - push(@headerContent, "class V8ClassIndex;\n"); + push(@headerContent, "#include \"V8Index.h\"\n"); + push(@headerContent, GetHeaderClassInclude($implClassName)); + push(@headerContent, "\nnamespace WebCore {\n"); + if ($podType) { + push(@headerContent, "\ntemplate class V8SVGPODTypeWrapper;\n"); + } push(@headerContent, "\nclass $className {\n"); + + my $nativeType = GetNativeTypeForConversions($interfaceName); + if ($podType) { + $nativeType = "V8SVGPODTypeWrapper<${nativeType} >"; + } + my $forceNewObjectParameter = IsDOMNodeType($interfaceName) ? ", bool forceNewObject = false" : ""; push(@headerContent, < value); static v8::Persistent GetRawTemplate(); + static v8::Persistent GetTemplate(); + static ${nativeType}* toNative(v8::Handle); + static v8::Handle wrap(${nativeType}*${forceNewObjectParameter}); END if ($implClassName eq "DOMWindow") { @@ -284,15 +283,68 @@ END END } - push(@headerContent, <functions}) { + my $name = $function->signature->name; + my $attrExt = $function->signature->extendedAttributes; - private: - static v8::Persistent GetTemplate(); + # FIXME: We should only be generating callback declarations for functions labeled [Custom] or [V8Custom], + # but we can't do that due to some mislabeled functions in the idl's (https://bugs.webkit.org/show_bug.cgi?id=33066). + push(@headerContent, < ${name}Callback(const v8::Arguments&); +END + if ($attrExt->{"EnabledAtRuntime"}) { + push(@enabledAtRuntime, $function); + } + } + + if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { + push(@headerContent, < constructorCallback(const v8::Arguments& args); +END + } + + foreach my $attribute (@{$dataNode->attributes}) { + my $name = $attribute->signature->name; + my $attrExt = $attribute->signature->extendedAttributes; + if ($attrExt->{"V8CustomGetter"} || $attrExt->{"CustomGetter"} + || $attrExt->{"V8Custom"} || $attrExt->{"Custom"}) { + push(@headerContent, < ${name}AccessorGetter(v8::Local name, const v8::AccessorInfo& info); +END + } + if ($attrExt->{"V8CustomSetter"} || $attrExt->{"CustomSetter"} + || $attrExt->{"V8Custom"} || $attrExt->{"Custom"}) { + push(@headerContent, < name, v8::Local value, const v8::AccessorInfo& info); +END + } + if ($attrExt->{"EnabledAtRuntime"}) { + push(@enabledAtRuntime, $attribute); + } + } - friend class V8ClassIndex; + GenerateHeaderNamedAndIndexedPropertyAccessors($dataNode); + GenerateHeaderCustomCall($dataNode); + GenerateHeaderCustomInternalFieldIndices($dataNode); + + if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + push(@headerContent, < host, v8::Local key, v8::AccessType, v8::Local data); + static bool indexedSecurityCheck(v8::Local host, uint32_t index, v8::AccessType, v8::Local data); +END + } + + push(@headerContent, < toV8(${nativeType}*${forceNewObjectParameter}); +END + if (IsRefPtrType($implClassName)) { + push(@headerContent, < toV8(PassRefPtr<${nativeType} >${forceNewObjectParameter}); END + } push(@headerContent, "}\n\n"); push(@headerContent, "#endif // $className" . "_H\n"); @@ -300,6 +352,153 @@ END push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; } +sub GetInternalFields +{ + my $dataNode = shift; + my $name = $dataNode->name; + + # FIXME: I am hideous and hard-coded. Make me beautiful. + return ("cacheIndex", "implementationIndex") if ($name eq "Document") || ($name eq "SVGDocument"); + return ("cacheIndex", "implementationIndex", "markerIndex", "shadowIndex") if $name eq "HTMLDocument"; + return ("cacheIndex") if IsNodeSubType($dataNode); + return ("cacheIndex") if $name eq "EventSource"; + return ("cacheIndex") if $name eq "XMLHttpRequest"; + return ("cacheIndex") if $name eq "XMLHttpRequestUpload"; + return ("cacheIndex") if $name eq "MessagePort"; + return ("port1Index", "port2Index") if ($name eq "MessageChannel"); + return ("cacheIndex") if $name eq "AbstractWorker"; + return ("abstractWorkerCacheIndex", "cacheIndex") if $name eq "Worker"; + return ("abstractWorkerCacheIndex", "cacheIndex") if $name eq "WorkerContext"; + return ("abstractWorkerCacheIndex", "workerContextCacheIndex", "cacheIndex") if $name eq "DedicatedWorkerContext"; + return ("abstractWorkerCacheIndex", "cacheIndex") if $name eq "SharedWorker"; + return ("abstractWorkerCacheIndex", "workerContextCacheIndex", "cacheIndex") if $name eq "SharedWorkerContext"; + return ("cacheIndex") if $name eq "Notification"; + return ("cacheIndex") if $name eq "IDBRequest"; + return ("cacheIndex") if $name eq "SVGElementInstance"; + return ("consoleIndex", "historyIndex", "locationbarIndex", "menubarIndex", "navigatorIndex", "personalbarIndex", + "screenIndex", "scrollbarsIndex", "selectionIndex", "statusbarIndex", "toolbarIndex", "locationIndex", + "domSelectionIndex", "cacheIndex", "enteredIsolatedWorldIndex") if $name eq "DOMWindow"; + return ("cacheIndex") if $name eq "DOMApplicationCache"; + return ("cacheIndex") if $name eq "WebSocket"; + return ("ownerNodeIndex") if ($name eq "StyleSheet") || ($name eq "CSSStyleSheet"); + return ("ownerNodeIndex") if ($name eq "NamedNodeMap"); + return (); +} + +sub GetHeaderClassInclude +{ + my $className = shift; + if ($className =~ /SVGPathSeg/) { + $className =~ s/Abs|Rel//; + } + return "" if (AvoidInclusionOfType($className)); + return "#include \"SVGAnimatedTemplate.h\"\n" if ($codeGenerator->IsSVGAnimatedType($className)); + return "#include \"${className}.h\"\n"; +} + +sub GenerateHeaderCustomInternalFieldIndices +{ + my $dataNode = shift; + my @customInternalFields = GetInternalFields($dataNode); + my $customFieldCounter = 0; + foreach my $customInternalField (@customInternalFields) { + push(@headerContent, < 1, + "HTMLAppletElement" => 1, + "HTMLDocument" => 1, + "HTMLEmbedElement" => 1, + "HTMLObjectElement" => 1 +); + +sub GenerateHeaderNamedAndIndexedPropertyAccessors +{ + my $dataNode = shift; + my $interfaceName = $dataNode->name; + my $hasCustomIndexedGetter = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + my $hasCustomIndexedSetter = $dataNode->extendedAttributes->{"HasCustomIndexSetter"} && !$dataNode->extendedAttributes->{"HasNumericIndexGetter"}; + my $hasCustomNamedGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; + my $hasCustomDeleters = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; + my $hasCustomEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; + if ($interfaceName eq "HTMLOptionsCollection") { + $interfaceName = "HTMLCollection"; + $hasCustomIndexedGetter = 1; + $hasCustomNamedGetter = 1; + } + if ($interfaceName eq "DOMWindow") { + $hasCustomDeleterr = 0; + $hasEnumerator = 0; + } + if ($interfaceName eq "HTMLSelectElement") { + $hasCustomNamedGetter = 1; + } + my $isIndexerSpecialCase = exists $indexerSpecialCases{$interfaceName}; + + if ($hasCustomIndexedGetter || $isIndexerSpecialCase) { + push(@headerContent, < indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info); +END + } + + if ($isIndexerSpecialCase || $hasCustomIndexedSetter) { + push(@headerContent, < indexedPropertySetter(uint32_t index, v8::Local value, const v8::AccessorInfo& info); +END + } + if ($hasCustomDeleters) { + push(@headerContent, < indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info); +END + } + if ($hasCustomNamedGetter) { + push(@headerContent, < namedPropertyGetter(v8::Local name, const v8::AccessorInfo& info); +END + } + if ($hasCustomNamedSetter) { + push(@headerContent, < namedPropertySetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info); +END + } + if ($hasCustomDeleters || $interfaceName eq "HTMLDocument") { + push(@headerContent, < namedPropertyDeleter(v8::Local name, const v8::AccessorInfo& info); +END + } + if ($hasCustomEnumerator) { + push(@headerContent, < namedPropertyEnumerator(const v8::AccessorInfo& info); +END + } +} + +sub GenerateHeaderCustomCall +{ + my $dataNode = shift; + + if ($dataNode->extendedAttributes->{"CustomCall"}) { + push(@headerContent, " static v8::Handle callAsFunctionCallback(const v8::Arguments&);\n"); + } + if ($dataNode->name eq "Event") { + push(@headerContent, " static v8::Handle dataTransferAccessorGetter(v8::Local name, const v8::AccessorInfo& info);\n"); + push(@headerContent, " static void valueAccessorSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info);\n"); + } + if ($dataNode->name eq "Location") { + push(@headerContent, " static v8::Handle assignAccessorGetter(v8::Local name, const v8::AccessorInfo& info);\n"); + push(@headerContent, " static v8::Handle reloadAccessorGetter(v8::Local name, const v8::AccessorInfo& info);\n"); + push(@headerContent, " static v8::Handle replaceAccessorGetter(v8::Local name, const v8::AccessorInfo& info);\n"); + } +} sub GenerateSetDOMException { @@ -314,63 +513,34 @@ sub GenerateSetDOMException return $result; } -sub IsNodeSubType +sub IsSubType { my $dataNode = shift; - return 1 if ($dataNode->name eq "Node"); + my $parentType = shift; + return 1 if ($dataNode->name eq $parentType); foreach (@allParents) { my $parent = $codeGenerator->StripModule($_); - return 1 if $parent eq "Node"; + return 1 if $parent eq $parentType; } return 0; } -sub GetHiddenDependencyIndex +sub IsNodeSubType { my $dataNode = shift; - my $attribute = shift; - my $name = $dataNode->name; - return "V8Custom::kNodeEventListenerCacheIndex" if IsNodeSubType($dataNode); - return "V8Custom::kSVGElementInstanceEventListenerCacheIndex" if $name eq "SVGElementInstance"; - return "V8Custom::kAbstractWorkerRequestCacheIndex" if $name eq "AbstractWorker"; - return "V8Custom::kWorkerRequestCacheIndex" if $name eq "Worker"; - return "V8Custom::kDedicatedWorkerContextRequestCacheIndex" if $name eq "DedicatedWorkerContext"; - return "V8Custom::kWorkerContextRequestCacheIndex" if $name eq "WorkerContext"; - return "V8Custom::kWorkerContextRequestCacheIndex" if $name eq "SharedWorkerContext"; - return "V8Custom::kMessagePortRequestCacheIndex" if $name eq "MessagePort"; - return "V8Custom::kWebSocketCacheIndex" if $name eq "WebSocket"; - return "V8Custom::kXMLHttpRequestCacheIndex" if $name eq "XMLHttpRequest"; - return "V8Custom::kXMLHttpRequestCacheIndex" if $name eq "XMLHttpRequestUpload"; - return "V8Custom::kDOMApplicationCacheCacheIndex" if $name eq "DOMApplicationCache"; - return "V8Custom::kNotificationRequestCacheIndex" if $name eq "Notification"; - return "V8Custom::kDOMWindowEventListenerCacheIndex" if $name eq "DOMWindow"; - die "Unexpected name " . $name . " when generating " . $attribute; -} - -sub HolderToNative + return IsSubType($dataNode, "Node"); +} + +sub IsEventSubType { my $dataNode = shift; - my $implClassName = shift; - my $classIndex = shift; - - if (IsNodeSubType($dataNode)) { - push(@implContentDecls, <(holder); -END - - } else { - push(@implContentDecls, <(V8ClassIndex::$classIndex, holder); -END - - } + return IsSubType($dataNode, "Event"); } sub GenerateDomainSafeFunctionGetter { my $function = shift; my $dataNode = shift; - my $classIndex = shift; my $implClassName = shift; my $className = "V8" . $dataNode->name; @@ -383,26 +553,19 @@ sub GenerateDomainSafeFunctionGetter my $newTemplateString = GenerateNewFunctionTemplate($function, $dataNode, $signature); - $implIncludes{"V8Proxy.h"} = 1; - push(@implContentDecls, < ${funcName}AttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(\"DOM.$implClassName.$funcName._get\"); static v8::Persistent private_template = v8::Persistent::New($newTemplateString); - v8::Handle holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This()); + v8::Handle holder = V8DOMWrapper::lookupDOMWrapper(${className}::GetTemplate(), info.This()); if (holder.IsEmpty()) { // can only reach here by 'object.__proto__.func', and it should passed // domain security check already - return private_template->GetFunction(); } -END - - HolderToNative($dataNode, $implClassName, $classIndex); - - push(@implContentDecls, <frame(), false)) { + ${implClassName}* imp = ${className}::toNative(holder); + if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false)) { static v8::Persistent shared_template = v8::Persistent::New($newTemplateString); return shared_template->GetFunction(); @@ -430,20 +593,17 @@ END if ($classIndex eq "DOMWINDOW") { push(@implContentDecls, <(V8ClassIndex::DOMWINDOW, info.Holder()); // Get the proxy corresponding to the DOMWindow if possible to // make sure that the constructor function is constructed in the // context of the DOMWindow and not in the context of the caller. - return V8DOMWrapper::getConstructor(type, window); + return V8DOMWrapper::getConstructor(type, V8DOMWindow::toNative(info.Holder())); END } elsif ($classIndex eq "DEDICATEDWORKERCONTEXT" or $classIndex eq "WORKERCONTEXT" or $classIndex eq "SHAREDWORKERCONTEXT") { - $implIncludes{"WorkerContextExecutionProxy.h"} = 1; push(@implContentDecls, <(V8ClassIndex::WORKERCONTEXT, info.Holder()); - return V8DOMWrapper::getConstructor(type, workerContext); + return V8DOMWrapper::getConstructor(type, V8WorkerContext::toNative(info.Holder())); END } else { - push(@implContentDecls, " return v8::Undefined();"); + push(@implContentDecls, " return v8::Handle();"); } push(@implContentDecls, <signature->extendedAttributes; my $attrName = $attribute->signature->name; - $implIncludes{"V8Proxy.h"} = 1; my $attrType = GetTypeFromSignature($attribute->signature); my $attrIsPodType = IsPodType($attrType); - my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); + my $nativeType = GetNativeTypeFromSignature($attribute->signature, -1); my $isPodType = IsPodType($implClassName); my $skipContext = 0; @@ -496,7 +654,7 @@ sub GenerateNormalAttrGetter $attrIsPodType = 0; } - my $getterStringUsesImp = $implClassName ne "double"; + my $getterStringUsesImp = $implClassName ne "float"; # Getter push(@implContentDecls, <* imp_wrapper = V8DOMWrapper::convertToNativeObject >(V8ClassIndex::$classIndex, info.Holder()); + V8SVGPODTypeWrapper<$implClassName>* imp_wrapper = V8SVGPODTypeWrapper<$implClassName>::toNative(info.Holder()); $implClassName imp_instance = *imp_wrapper; END if ($getterStringUsesImp) { @@ -516,30 +674,42 @@ END } } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) { - if ($classIndex eq "DOMWINDOW") { + if ($interfaceName eq "DOMWindow") { push(@implContentDecls, < holder = info.Holder(); END } else { # perform lookup first push(@implContentDecls, < holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This()); - if (holder.IsEmpty()) return v8::Undefined(); + v8::Handle holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This()); + if (holder.IsEmpty()) return v8::Handle(); END } - HolderToNative($dataNode, $implClassName, $classIndex); + push(@implContentDecls, <signature->extendedAttributes->{"Reflect"}; + if ($getterStringUsesImp && $reflect && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) { + # Generate super-compact call for regular attribute getter: + my $contentAttributeName = $reflect eq "1" ? $attrName : $reflect; + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + push(@implContentDecls, " return getElementStringAttr(info, ${namespace}::${contentAttributeName}Attr);\n"); + push(@implContentDecls, " }\n\n"); + return; + # Skip the rest of the function! + } push(@implContentDecls, < holder = info.Holder(); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END - HolderToNative($dataNode, $implClassName, $classIndex); } # Generate security checks if necessary if ($attribute->signature->extendedAttributes->{"CheckNodeSecurity"}) { - push(@implContentDecls, " if (!V8Proxy::checkNodeSecurity(imp->$attrName())) return v8::Undefined();\n\n"); + push(@implContentDecls, " if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->$attrName())) return v8::Handle();\n\n"); } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) { - push(@implContentDecls, " if (!V8Proxy::checkNodeSecurity(imp->contentDocument())) return v8::Undefined();\n\n"); + push(@implContentDecls, " if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->contentDocument())) return v8::Handle();\n\n"); } my $useExceptions = 1 if @{$attribute->getterExceptions} and !($isPodType); @@ -553,7 +723,12 @@ END } my $getterFunc = $codeGenerator->WK_lcfirst($attrName); - $getterFunc .= "Animated" if $codeGenerator->IsSVGAnimatedType($attribute->signature->type); + + if ($codeGenerator->IsSVGAnimatedType($attribute->signature->type)) { + # Some SVGFE*Element.idl use 'operator' as attribute name; rewrite as '_operator' to avoid clashes with C/C++ + $getterFunc = "_" . $getterFunc if ($attrName =~ /operator/); + $getterFunc .= "Animated"; + } my $returnType = GetTypeFromSignature($attribute->signature); @@ -579,10 +754,6 @@ END $getterString = "imp_instance"; } - if ($nativeType eq "String") { - $getterString = "toString($getterString)"; - } - my $result; my $wrapper; @@ -619,7 +790,7 @@ END } else { if ($attribute->signature->type eq "EventListener" && $dataNode->name eq "DOMWindow") { push(@implContentDecls, " if (!imp->document())\n"); - push(@implContentDecls, " return v8::Undefined();\n"); + push(@implContentDecls, " return v8::Handle();\n"); } if ($useExceptions) { @@ -635,17 +806,20 @@ END } if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) { - my $resultObject = $result; if ($attrIsPodType) { - $resultObject = "wrapper"; + push(@implContentDecls, GenerateSVGContextAssignment($implClassName, "wrapper.get()", " ")); + } else { + push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, " ")); + # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused, + # so just manually set the return value to a PassRefPtr of the expected type. + push(@implContentDecls, " PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n"); + $result = "resultAsPassRefPtr"; } - $resultObject = "WTF::getPtr(" . $resultObject . ")"; - push(@implContentDecls, GenerateSVGContextAssignment($implClassName, $resultObject, " ")); } if ($attrIsPodType) { - my $classIndex = uc($attrType); - push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"); + $implIncludes{"V8${attrType}.h"} = 1; + push(@implContentDecls, " return toV8(wrapper.release().get());\n"); } else { push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); } @@ -658,8 +832,6 @@ sub GenerateReplaceableAttrSetter { my $implClassName = shift; - $implIncludes{"V8Proxy.h"} = 1; - push(@implContentDecls, " static void ${attrName}AttrSetter(v8::Local name," . " v8::Local value, const v8::AccessorInfo& info) {\n"); @@ -677,14 +849,11 @@ sub GenerateNormalAttrSetter { my $attribute = shift; my $dataNode = shift; - my $classIndex = shift; my $implClassName = shift; my $interfaceName = shift; my $attrExt = $attribute->signature->extendedAttributes; - $implIncludes{"V8Proxy.h"} = 1; - push(@implContentDecls, " static void ${attrName}AttrSetter(v8::Local name," . " v8::Local value, const v8::AccessorInfo& info) {\n"); @@ -696,28 +865,43 @@ sub GenerateNormalAttrSetter if ($isPodType) { $implClassName = GetNativeType($implClassName); $implIncludes{"V8SVGPODTypeWrapper.h"} = 1; - push(@implContentDecls, " V8SVGPODTypeWrapper<$implClassName>* wrapper = V8DOMWrapper::convertToNativeObject >(V8ClassIndex::$classIndex, info.Holder());\n"); + push(@implContentDecls, " V8SVGPODTypeWrapper<$implClassName>* wrapper = V8SVGPODTypeWrapper<$implClassName>::toNative(info.Holder());\n"); push(@implContentDecls, " $implClassName imp_instance = *wrapper;\n"); push(@implContentDecls, " $implClassName* imp = &imp_instance;\n"); } elsif ($attrExt->{"v8OnProto"}) { - if ($classIndex eq "DOMWINDOW") { + if ($interfaceName eq "DOMWindow") { push(@implContentDecls, < holder = info.Holder(); END } else { # perform lookup first push(@implContentDecls, < holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::$classIndex, info.This()); + v8::Handle holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This()); if (holder.IsEmpty()) return; END } - HolderToNative($dataNode, $implClassName, $classIndex); + push(@implContentDecls, <signature); + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + if (($reflect || $reflectURL) && IsNodeSubType($dataNode) && $codeGenerator->IsStringType($attrType)) { + # Generate super-compact call for regular attribute setter: + my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + push(@implContentDecls, " setElementStringAttr(info, ${namespace}::${contentAttributeName}Attr, value);\n"); + push(@implContentDecls, " }\n\n"); + return; + # Skip the rest of the function! + } + push(@implContentDecls, < holder = info.Holder(); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END - HolderToNative($dataNode, $implClassName, $classIndex); } my $nativeType = GetNativeTypeFromSignature($attribute->signature, 0); @@ -726,7 +910,6 @@ END push(@implContentDecls, " if (!imp->document())\n"); push(@implContentDecls, " return;\n"); } - push(@implContentDecls, " $nativeType v = V8DOMWrapper::getEventListener(imp, value, true, ListenerFindOrCreate);\n"); } else { push(@implContentDecls, " $nativeType v = " . JSValueToNative($attribute->signature, "value") . ";\n"); } @@ -751,7 +934,7 @@ END push(@implContentDecls, " ExceptionCode ec = 0;\n"); } - if ($implClassName eq "double") { + if ($implClassName eq "float") { push(@implContentDecls, " *imp = $result;\n"); } else { my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); @@ -764,20 +947,10 @@ END push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $result"); } elsif ($attribute->signature->type eq "EventListener") { $implIncludes{"V8AbstractEventListener.h"} = 1; - $implIncludes{"V8CustomBinding.h"} = 1; - $cacheIndex = GetHiddenDependencyIndex($dataNode, $attrName); - push(@implContentDecls, " $nativeType old = imp->$attrName();\n"); - push(@implContentDecls, " V8AbstractEventListener* oldListener = old ? V8AbstractEventListener::cast(old.get()) : 0;\n"); - push(@implContentDecls, " if (oldListener) {\n"); - push(@implContentDecls, " v8::Local oldListenerObject = oldListener->getExistingListenerObject();\n"); - push(@implContentDecls, " if (!oldListenerObject.IsEmpty())\n"); - push(@implContentDecls, " removeHiddenDependency(holder, oldListenerObject, $cacheIndex);\n"); - push(@implContentDecls, " }\n"); - push(@implContentDecls, " imp->set$implSetterFunctionName($result);\n"); - push(@implContentDecls, " if ($result)\n"); - push(@implContentDecls, " createHiddenDependency(holder, value, $cacheIndex"); + push(@implContentDecls, " transferHiddenDependency(info.Holder(), imp->$attrName(), value, V8${interfaceName}::cacheIndex);\n"); + push(@implContentDecls, " imp->set$implSetterFunctionName(V8DOMWrapper::getEventListener(imp, value, true, ListenerFindOrCreate)"); } else { - push(@implContentDecls, " imp->set$implSetterFunctionName(" . $result); + push(@implContentDecls, " imp->set$implSetterFunctionName($result"); } push(@implContentDecls, ", ec") if $useExceptions; push(@implContentDecls, ");\n"); @@ -807,11 +980,10 @@ END push(@implContentDecls, " }\n\n"); # end of setter } -sub GenerateNewFunctionTemplate +sub GetFunctionTemplateCallbackName { $function = shift; $dataNode = shift; - $signature = shift; my $interfaceName = $dataNode->name; my $name = $function->signature->name; @@ -822,17 +994,22 @@ sub GenerateNewFunctionTemplate $function->signature->extendedAttributes->{"V8Custom"}) { die "Custom and V8Custom should be mutually exclusive!" } - my $customFunc = $function->signature->extendedAttributes->{"Custom"} || - $function->signature->extendedAttributes->{"V8Custom"}; - if ($customFunc eq 1) { - $customFunc = $interfaceName . $codeGenerator->WK_ucfirst($name); - } - return "v8::FunctionTemplate::New(V8Custom::v8${customFunc}Callback, v8::Handle(), $signature)"; + return "V8${interfaceName}::${name}Callback"; } else { - return "v8::FunctionTemplate::New(${interfaceName}Internal::${name}Callback, v8::Handle(), $signature)"; + return "${interfaceName}Internal::${name}Callback"; } } +sub GenerateNewFunctionTemplate +{ + $function = shift; + $dataNode = shift; + $signature = shift; + + my $callback = GetFunctionTemplateCallbackName($function, $dataNode); + return "v8::FunctionTemplate::New($callback, v8::Handle(), $signature)"; +} + sub GenerateFunctionCallback { my $function = shift; @@ -851,19 +1028,18 @@ sub GenerateFunctionCallback if ($function->signature->extendedAttributes->{"RequiresAllArguments"}) { push(@implContentDecls, - " if (args.Length() < $numParameters) return v8::Undefined();\n"); + " if (args.Length() < $numParameters) return v8::Handle();\n"); } if (IsPodType($implClassName)) { my $nativeClassName = GetNativeType($implClassName); - push(@implContentDecls, " V8SVGPODTypeWrapper<$nativeClassName>* imp_wrapper = V8DOMWrapper::convertToNativeObject >(V8ClassIndex::$classIndex, args.Holder());\n"); + push(@implContentDecls, " V8SVGPODTypeWrapper<$nativeClassName>* imp_wrapper = V8SVGPODTypeWrapper<$nativeClassName>::toNative(args.Holder());\n"); push(@implContentDecls, " $nativeClassName imp_instance = *imp_wrapper;\n"); push(@implContentDecls, " $nativeClassName* imp = &imp_instance;\n"); } else { push(@implContentDecls, < holder = args.Holder(); + ${implClassName}* imp = V8${implClassName}::toNative(args.Holder()); END - HolderToNative($dataNode, $implClassName, $classIndex); } # Check domain security if needed @@ -872,25 +1048,40 @@ END && !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { # We have not find real use cases yet. push(@implContentDecls, -" if (!V8Proxy::canAccessFrame(imp->frame(), true)) {\n". -" return v8::Undefined();\n" . +" if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) {\n". +" return v8::Handle();\n" . " }\n"); } + my $raisesExceptions = @{$function->raisesExceptions}; + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if (TypeCanFailConversion($parameter) or $parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } - if (@{$function->raisesExceptions}) { + if ($raisesExceptions) { $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, " ExceptionCode ec = 0;\n"); + push(@implContentDecls, " {\n"); + # The brace here is needed to prevent the ensuing 'goto fail's from jumping past constructors + # of objects (like Strings) declared later, causing compile errors. The block scope ends + # right before the label 'fail:'. } if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - push(@implContentDecls, " ScriptCallStack callStack(args, $numParameters);\n"); + push(@implContentDecls, +" OwnPtr callStack(ScriptCallStack::create(args, $numParameters));\n". +" if (!callStack)\n". +" return v8::Undefined();\n"); $implIncludes{"ScriptCallStack.h"} = 1; } if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) { push(@implContentDecls, -" if (!V8Proxy::checkNodeSecurity(imp->getSVGDocument(ec)))\n" . -" return v8::Undefined();\n"); +" if (!V8BindingSecurity::checkNodeSecurity(V8BindingState::Only(), imp->getSVGDocument(ec)))\n" . +" return v8::Handle();\n"); } my $paramIndex = 0; @@ -911,7 +1102,7 @@ END push(@implContentDecls, " bool ${parameterName}Ok;\n"); } - push(@implContentDecls, " " . GetNativeTypeFromSignature($parameter, 1) . " $parameterName = "); + push(@implContentDecls, " " . GetNativeTypeFromSignature($parameter, $paramIndex) . " $parameterName = "); push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); @@ -919,8 +1110,8 @@ END $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . -" V8Proxy::setDOMException(TYPE_MISMATCH_ERR);\n" . -" return v8::Handle();\n" . +" ec = TYPE_MISMATCH_ERR;\n" . +" goto fail;\n" . " }\n"); } @@ -928,8 +1119,8 @@ END $implIncludes{"ExceptionCode.h"} = 1; push(@implContentDecls, " if (UNLIKELY($parameterName < 0)) {\n" . -" V8Proxy::setDOMException(INDEX_SIZE_ERR);\n" . -" return v8::Handle();\n" . +" ec = INDEX_SIZE_ERR;\n" . +" goto fail;\n" . " }\n"); } @@ -939,6 +1130,14 @@ END # Build the function call string. my $callString = GenerateFunctionCallString($function, $paramIndex, " ", $implClassName); push(@implContentDecls, "$callString"); + + if ($raisesExceptions) { + push(@implContentDecls, " }\n"); + push(@implContentDecls, " fail:\n"); + push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); + push(@implContentDecls, " return v8::Handle();\n"); + } + push(@implContentDecls, " }\n\n"); } @@ -991,7 +1190,7 @@ sub GenerateSingleBatchedAttribute ""; if ($customAccessor eq 1) { # use the naming convension, interface + (capitalize) attr name - $customAccessor = $interfaceName . $codeGenerator->WK_ucfirst($attrName); + $customAccessor = $interfaceName . "::" . $attrName; } my $getter; @@ -1016,7 +1215,7 @@ sub GenerateSingleBatchedAttribute $constructorType =~ s/Constructor$//; my $constructorIndex = uc($constructorType); if ($customAccessor) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; + $getter = "V8${customAccessor}AccessorGetter"; } else { $data = "V8ClassIndex::${constructorIndex}"; $getter = "${interfaceName}Internal::${interfaceName}ConstructorGetter"; @@ -1032,12 +1231,12 @@ sub GenerateSingleBatchedAttribute # Custom Setter if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { $hasCustomSetter = 1; - $setter = "V8Custom::v8${customAccessor}AccessorSetter"; + $setter = "V8${customAccessor}AccessorSetter"; } # Custom Getter - if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; + if ($attrExt->{"CustomGetter"} || $attrExt->{"V8CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { + $getter = "V8${customAccessor}AccessorGetter"; } } @@ -1078,6 +1277,174 @@ sub GenerateSingleBatchedAttribute END } +sub GenerateImplementationIndexer +{ + my $dataNode = shift; + my $indexer = shift; + my $interfaceName = $dataNode->name; + + # FIXME: Figure out what HasNumericIndexGetter is really supposed to do. Right now, it's only set on WebGL-related files. + my $hasCustomSetter = $dataNode->extendedAttributes->{"HasCustomIndexSetter"} && !$dataNode->extendedAttributes->{"HasNumericIndexGetter"}; + my $hasGetter = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + + # FIXME: Find a way to not have to special-case HTMLOptionsCollection. + if ($interfaceName eq "HTMLOptionsCollection") { + $hasGetter = 1; + } + # FIXME: If the parent interface of $dataNode already has + # HasIndexGetter, we don't need to handle the getter here. + if ($interfaceName eq "WebKitCSSTransformValue") { + $hasGetter = 0; + } + + # FIXME: Investigate and remove this nastinesss. In V8, named property handling and indexer handling are apparently decoupled, + # which means that object[X] where X is a number doesn't reach named property indexer. So we need to provide + # simplistic, mirrored indexer handling in addition to named property handling. + my $isSpecialCase = exists $indexerSpecialCases{$interfaceName}; + if ($isSpecialCase) { + $hasGetter = 1; + if ($dataNode->extendedAttributes->{"DelegatingPutFunction"}) { + $hasCustomSetter = 1; + } + } + + if (!$hasGetter) { + return; + } + + $implIncludes{"V8Collection.h"} = 1; + + my $indexerType = $indexer ? $indexer->type : 0; + + # FIXME: Remove this once toV8 helper methods are implemented (see https://bugs.webkit.org/show_bug.cgi?id=32563). + if ($interfaceName eq "WebKitCSSKeyframesRule") { + $indexerType = "WebKitCSSKeyframeRule"; + } + + if ($indexerType && !$hasCustomSetter) { + if ($indexerType eq "DOMString") { + my $conversion = $indexer->extendedAttributes->{"ConvertNullStringTo"}; + if ($conversion && $conversion eq "Null") { + push(@implContent, <(desc); +END + } else { + push(@implContent, <(desc); +END + } + } else { + my $indexerClassIndex = uc($indexerType); + push(@implContent, <(desc, V8ClassIndex::${indexerClassIndex}); +END + # Include the header for this indexer type, because setCollectionIndexedGetter() requires toV8() for this type. + $implIncludes{"V8${indexerType}.h"} = 1; + } + + return; + } + + my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; + my $hasEnumerator = !$isSpecialCase && IsNodeSubType($dataNode); + my $setOn = "Instance"; + + # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallbacks) and it's used on DOMWindow + # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to + # get implementation straight out of the DOMWindow prototype regardless of what prototype is actually set + # on the object. + if ($interfaceName eq "DOMWindow") { + $setOn = "Prototype"; + $hasDeleter = 0; + } + + push(@implContent, " desc->${setOn}Template()->SetIndexedPropertyHandler(V8${interfaceName}::indexedPropertyGetter"); + push(@implContent, $hasCustomSetter ? ", V8${interfaceName}::indexedPropertySetter" : ", 0"); + push(@implContent, ", 0"); # IndexedPropertyQuery -- not being used at the moment. + push(@implContent, $hasDeleter ? ", V8${interfaceName}::indexedPropertyDeleter" : ", 0"); + push(@implContent, ", nodeCollectionIndexedPropertyEnumerator<${interfaceName}>, v8::Integer::New(V8ClassIndex::NODE)") if $hasEnumerator; + push(@implContent, ");\n"); +} + +sub GenerateImplementationNamedPropertyGetter +{ + my $dataNode = shift; + my $namedPropertyGetter = shift; + my $interfaceName = $dataNode->name; + my $hasCustomGetter = $dataNode->extendedAttributes->{"HasOverridingNameGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + + # FIXME: Remove hard-coded HTMLOptionsCollection reference by changing HTMLOptionsCollection to not inherit + # from HTMLCollection per W3C spec (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#HTMLOptionsCollection). + if ($interfaceName eq "HTMLOptionsCollection") { + $interfaceName = "HTMLCollection"; + $hasCustomGetter = 1; + } + + my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter; + if (!$hasGetter) { + return; + } + + if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"} && !$hasCustomGetter) { + $implIncludes{"V8Collection.h"} = 1; + my $type = $namedPropertyGetter->type; + my $classIndex = uc($type); + push(@implContent, <(desc, V8ClassIndex::${classIndex}); +END + return; + } + + my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; + # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings. + my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument"; + my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; + my $setOn = "Instance"; + + # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallbacks) and it's used on DOMWindow + # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to + # get implementation straight out of the DOMWindow prototype regardless of what prototype is actually set + # on the object. + if ($interfaceName eq "DOMWindow") { + $setOn = "Prototype"; + $hasDeleter = 0; + $hasEnumerator = 0; + } + + push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, "); + push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, "); + push(@implContent, "0, "); # NamedPropertyQuery -- not being used at the moment. + push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, "); + push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyEnumerator" : "0"); + push(@implContent, ");\n"); +} + +sub GenerateImplementationCustomCall +{ + my $dataNode = shift; + my $interfaceName = $dataNode->name; + my $hasCustomCall = $dataNode->extendedAttributes->{"CustomCall"}; + + # FIXME: Remove hard-coded HTMLOptionsCollection reference. + if ($interfaceName eq "HTMLOptionsCollection") { + $interfaceName = "HTMLCollection"; + $hasCustomCall = 1; + } + + if ($hasCustomCall) { + push(@implContent, " desc->InstanceTemplate()->SetCallAsFunctionHandler(V8${interfaceName}::callAsFunctionCallback);\n"); + } +} + +sub GenerateImplementationMasqueradesAsUndefined +{ + my $dataNode = shift; + if ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) + { + push(@implContent, " desc->InstanceTemplate()->MarkAsUndetectable();\n"); + } +} + sub GenerateImplementation { my $object = shift; @@ -1095,8 +1462,12 @@ sub GenerateImplementation push(@implFixedHeader, "#include \"config.h\"\n" . + "#include \"RuntimeEnabledFeatures.h\"\n" . "#include \"V8Proxy.h\"\n" . - "#include \"V8Binding.h\"\n\n" . + "#include \"V8Binding.h\"\n" . + "#include \"V8BindingState.h\"\n" . + "#include \"V8DOMWrapper.h\"\n" . + "#include \"V8IsolatedContext.h\"\n\n" . "#undef LOG\n\n"); push(@implFixedHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; @@ -1108,14 +1479,12 @@ sub GenerateImplementation $implIncludes{"${className}.h"} = 1; AddIncludesForType($interfaceName); - $implIncludes{"V8Proxy.h"} = 1; push(@implContentDecls, "namespace WebCore {\n"); push(@implContentDecls, "namespace ${interfaceName}Internal {\n\n"); push(@implContentDecls, "template void V8_USE(T) { }\n\n"); my $hasConstructors = 0; - # Generate property accessors for attributes. for ($index = 0; $index < @{$dataNode->attributes}; $index++) { $attribute = @{$dataNode->attributes}[$index]; @@ -1124,9 +1493,8 @@ sub GenerateImplementation # Generate special code for the constructor attributes. if ($attrType =~ /Constructor$/) { - if ($attribute->signature->extendedAttributes->{"CustomGetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { + if (!($attribute->signature->extendedAttributes->{"CustomGetter"} || + $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { $hasConstructors = 1; } next; @@ -1141,24 +1509,22 @@ sub GenerateImplementation # implementation. if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"V8Custom"}) { - $implIncludes{"V8CustomBinding.h"} = 1; next; } # Generate the accessor. - if ($attribute->signature->extendedAttributes->{"CustomGetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { - GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName); + if (!($attribute->signature->extendedAttributes->{"CustomGetter"} || + $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { + GenerateNormalAttrGetter($attribute, $dataNode, $implClassName, $interfaceName); } - if ($attribute->signature->extendedAttributes->{"CustomSetter"} || - $attribute->signature->extendedAttributes->{"V8CustomSetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) { - $dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!"; - # GenerateReplaceableAttrSetter($implClassName); - } elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { - GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName); + if (!($attribute->signature->extendedAttributes->{"CustomSetter"} || + $attribute->signature->extendedAttributes->{"V8CustomSetter"})) { + if ($attribute->signature->extendedAttributes->{"Replaceable"}) { + $dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!"; + # GenerateReplaceableAttrSetter($implClassName); + } elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { + GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName); + } } } @@ -1166,21 +1532,29 @@ sub GenerateImplementation GenerateConstructorGetter($implClassName, $classIndex); } + my $indexer; + my $namedPropertyGetter; # Generate methods for functions. foreach my $function (@{$dataNode->functions}) { # hack for addEventListener/RemoveEventListener # FIXME: avoid naming conflict - if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { + if (!($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"})) { GenerateFunctionCallback($function, $dataNode, $classIndex, $implClassName); } + if ($function->signature->name eq "item") { + $indexer = $function->signature; + } + + if ($function->signature->name eq "namedItem") { + $namedPropertyGetter = $function->signature; + } + # If the function does not need domain security check, we need to # generate an access getter that returns different function objects # for different calling context. if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { - GenerateDomainSafeFunctionGetter($function, $dataNode, $classIndex, $implClassName); + GenerateDomainSafeFunctionGetter($function, $dataNode, $implClassName); } } @@ -1194,6 +1568,7 @@ sub GenerateImplementation my @enabledAtRuntime; my @normal; foreach my $attribute (@$attributes) { + if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8DisallowShadowing"}) { push(@disallowsShadowing, $attribute); } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}) { @@ -1218,6 +1593,38 @@ sub GenerateImplementation push(@implContent, "};\n"); } + # Setup table of standard callback functions + $num_callbacks = 0; + $has_callbacks = 0; + foreach my $function (@{$dataNode->functions}) { + my $attrExt = $function->signature->extendedAttributes; + # Don't put any nonstandard functions into this table: + if ($attrExt->{"V8OnInstance"}) { + next; + } + if ($attrExt->{"EnabledAtRuntime"} || RequiresCustomSignature($function) || $attrExt->{"V8DoNotCheckSignature"}) { + next; + } + if ($attrExt->{"DoNotCheckDomainSecurity"} && + ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { + next; + } + if ($attrExt->{"DontEnum"} || $attrExt->{"V8ReadOnly"}) { + next; + } + if (!$has_callbacks) { + $has_callbacks = 1; + push(@implContent, "static const BatchedCallback ${interfaceName}_callbacks[] = {\n"); + } + my $name = $function->signature->name; + my $callback = GetFunctionTemplateCallbackName($function, $dataNode); + push(@implContent, <constants}) { @@ -1240,9 +1647,20 @@ END push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n"); - my $access_check = "/* no access check */"; + # In namespace WebCore, add generated implementation for 'CanBeConstructed'. + if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"}) { + push(@implContent, < ${className}::constructorCallback(const v8::Arguments& args) + { + INC_STATS("DOM.${interfaceName}.Contructor"); + return V8Proxy::constructDOMObject(args); + } +END + } + + my $access_check = ""; if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !($interfaceName eq "DOMWindow")) { - $access_check = "instance->SetAccessCheckCallbacks(V8Custom::v8${interfaceName}NamedSecurityCheck, V8Custom::v8${interfaceName}IndexedSecurityCheck, v8::Integer::New(V8ClassIndex::ToInt(V8ClassIndex::${classIndex})));"; + $access_check = "instance->SetAccessCheckCallbacks(V8${interfaceName}::namedSecurityCheck, V8${interfaceName}::indexedSecurityCheck, v8::Integer::New(V8ClassIndex::ToInt(V8ClassIndex::${classIndex})));"; } # For the DOMWindow interface, generate the shadow object template @@ -1254,46 +1672,77 @@ static v8::Persistent ConfigureShadowObjectTemplate(v8::Pers v8::Handle(), shadow_attrs, sizeof(shadow_attrs)/sizeof(*shadow_attrs)); + + // Install a security handler with V8. + templ->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::Integer::New(V8ClassIndex::DOMWINDOW)); + templ->SetInternalFieldCount(V8DOMWindow::internalFieldCount); return templ; } END } + # find the super descriptor + my $parentClassTemplate = ""; + foreach (@{$dataNode->parents}) { + my $parent = $codeGenerator->StripModule($_); + if ($parent eq "EventTarget") { next; } + $implIncludes{"V8${parent}.h"} = 1; + $parentClassTemplate = "V8" . $parent . "::GetTemplate()"; + last; + } + if (!$parentClassTemplate) { + $parentClassTemplate = "v8::Persistent()"; + } + # Generate the template configuration method push(@implContent, < Configure${className}Template(v8::Persistent desc) { - v8::Local instance = desc->InstanceTemplate(); + v8::Local default_signature = configureTemplate(desc, \"${interfaceName}\", + $parentClassTemplate, V8${interfaceName}::internalFieldCount, END - if (IsNodeSubType($dataNode)) { + # Set up our attributes if we have them + if ($has_attributes) { push(@implContent, <SetInternalFieldCount(V8Custom::kNodeMinimumInternalFieldCount); + ${interfaceName}_attrs, sizeof(${interfaceName}_attrs)/sizeof(*${interfaceName}_attrs), END } else { push(@implContent, <SetInternalFieldCount(V8Custom::kDefaultWrapperInternalFieldCount); + NULL, 0, END } - push(@implContent, < default_signature = v8::Signature::New(desc); - v8::Local proto = desc->PrototypeTemplate(); - $access_check + if ($has_callbacks) { + push(@implContent, <extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { push(@implContent, <SetCallHandler(V8${interfaceName}::constructorCallback); +END + } + + if ($access_check or @enabledAtRuntime or @{$dataNode->functions} or $has_constants) { + push(@implContent, < instance = desc->InstanceTemplate(); + v8::Local proto = desc->PrototypeTemplate(); END } + push(@implContent, " $access_check\n"); + # Setup the enable-at-runtime attrs if we have them foreach my $runtime_attr (@enabledAtRuntime) { - $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($runtime_attr->signature->name); + # A function named RuntimeEnabledFeatures::{methodName}Enabled() need to be written by hand. + $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($runtime_attr->signature->name) . "Enabled"; my $conditionalString = GenerateConditionalString($runtime_attr->signature); push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString; - push(@implContent, " if (V8Custom::v8${enable_function}Enabled()) {\n"); + push(@implContent, " if (${enable_function}()) {\n"); push(@implContent, " static const BatchedAttribute attrData =\\\n"); GenerateSingleBatchedAttribute($interfaceName, $runtime_attr, ";", " "); push(@implContent, <functions}) { + $total_functions++; my $attrExt = $function->signature->extendedAttributes; my $name = $function->signature->name; @@ -1326,8 +1782,8 @@ END my $conditional = ""; if ($attrExt->{"EnabledAtRuntime"}) { # Only call Set()/SetAccessor() if this method should be enabled - $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($function->signature->name); - $conditional = "if (V8Custom::v8${enable_function}Enabled())\n"; + $enable_function = "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($function->signature->name) . "Enabled"; + $conditional = "if (${enable_function}())\n"; } if ($attrExt->{"DoNotCheckDomainSecurity"} && @@ -1358,6 +1814,7 @@ END v8::ALL_CAN_READ, static_cast($property_attributes)); END + $num_callbacks++; next; } @@ -1372,31 +1829,26 @@ END } # Normal function call is a template - my $templateFunction = GenerateNewFunctionTemplate($function, $dataNode, $signature); + my $callback = GetFunctionTemplateCallbackName($function, $dataNode); + if ($property_attributes eq "v8::DontDelete") { + $property_attributes = ""; + } else { + $property_attributes = ", static_cast($property_attributes)"; + } - push(@implContent, <Set( - v8::String::New("$name"), - $templateFunction, - static_cast($property_attributes)); + push(@implContent, <Set(v8::String::New("$name"), v8::FunctionTemplate::New($callback, v8::Handle(), ${signature})$property_attributes); END + $num_callbacks++; } - # set the super descriptor - foreach (@{$dataNode->parents}) { - my $parent = $codeGenerator->StripModule($_); - if ($parent eq "EventTarget") { next; } - $implIncludes{"V8${parent}.h"} = 1; - my $parentClassIndex = uc($codeGenerator->StripModule($parent)); - push(@implContent, " desc->Inherit(V8DOMWrapper::getTemplate(V8ClassIndex::${parentClassIndex}));\n"); - last; - } - - # Set the class name. This is used when printing objects. - push(@implContent, " desc->SetClassName(v8::String::New(\"${interfaceName}\"));\n"); + die "Wrong number of callbacks generated for $interfaceName ($num_callbacks, should be $total_functions)" if $num_callbacks != $total_functions; if ($has_constants) { push(@implContent, <SetInternalFieldCount(V8DOMWindow::internalFieldCount); + desc->SetHiddenPrototype(true); + instance->SetInternalFieldCount(V8DOMWindow::internalFieldCount); + // Set access check callbacks, but turned off initially. + // When a context is detached from a frame, turn on the access check. + // Turning on checks also invalidates inline caches of the object. + instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::Integer::New(V8ClassIndex::DOMWINDOW), false); +END + } + if ($interfaceName eq "Location") { + push(@implContent, <SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8::Handle(), v8::ALL_CAN_READ, static_cast(v8::DontDelete | v8::ReadOnly)); + instance->SetAccessor(v8::String::New("replace"), V8Location::replaceAccessorGetter, 0, v8::Handle(), v8::ALL_CAN_READ, static_cast(v8::DontDelete | v8::ReadOnly)); + instance->SetAccessor(v8::String::New("assign"), V8Location::assignAccessorGetter, 0, v8::Handle(), v8::ALL_CAN_READ, static_cast(v8::DontDelete | v8::ReadOnly)); +END + } + + my $nativeType = GetNativeTypeForConversions($interfaceName); + if ($dataNode->extendedAttributes->{"PODType"}) { + $nativeType = "V8SVGPODTypeWrapper<${nativeType}>"; + } push(@implContent, <Set(getToStringName(), getToStringTemplate()); return desc; } v8::Persistent ${className}::GetRawTemplate() { - static v8::Persistent ${className}_raw_cache_; - if (${className}_raw_cache_.IsEmpty()) { - v8::HandleScope scope; - v8::Local result = v8::FunctionTemplate::New(V8Proxy::checkNewLegal); - ${className}_raw_cache_ = v8::Persistent::New(result); - } + static v8::Persistent ${className}_raw_cache_ = createRawTemplate(); return ${className}_raw_cache_; } v8::Persistent ${className}::GetTemplate() { - static v8::Persistent ${className}_cache_; - if (${className}_cache_.IsEmpty()) - ${className}_cache_ = Configure${className}Template(GetRawTemplate()); + static v8::Persistent ${className}_cache_ = Configure${className}Template(GetRawTemplate()); return ${className}_cache_; } +${nativeType}* ${className}::toNative(v8::Handle object) { + return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); +} + bool ${className}::HasInstance(v8::Handle value) { return GetRawTemplate()->HasInstance(value); } @@ -1444,6 +1924,8 @@ v8::Persistent V8DOMWindow::GetShadowObjectTemplate() { END } + GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType); + push(@implContent, < ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) { + v8::Handle wrapper; + V8Proxy* proxy = 0; +END + + if (IsNodeSubType($dataNode)) { + push(@implContent, <document()) { + proxy = V8Proxy::retrieve(impl->document()->frame()); + if (proxy && static_cast(impl->document()) == static_cast(impl)) + proxy->windowShell()->initContextIfNeeded(); + } + +END + } + + if ($domMapFunction) { + push(@implContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); + if (IsNodeSubType($dataNode)) { + push(@implContent, " wrapper = V8DOMWrapper::getWrapper(impl);\n"); + } else { + push(@implContent, " wrapper = ${domMapFunction}.get(impl);\n"); + } + push(@implContent, < context; + if (proxy) + context = proxy->context(); + + // Enter the node's context and create the wrapper in that context. + if (!context.IsEmpty()) + context->Enter(); +END + } + + push(@implContent, <Exit(); +END + } + + push(@implContent, <ref();\n") if IsRefPtrType($interfaceName); + + if ($domMapFunction) { + push(@implContent, <::New(wrapper)); +END + } + + push(@implContent, < toV8(PassRefPtr<${nativeType} > impl${forceNewObjectInput}) { + return toV8(impl.get()${forceNewObjectCall}); +} +END + } + + if (!HasCustomToV8Implementation($dataNode, $interfaceName)) { + push(@implContent, < toV8(${nativeType}* impl${forceNewObjectInput}) { + if (!impl) + return v8::Null(); + return ${className}::wrap(impl${forceNewObjectCall}); +} +END + } +} + +sub HasCustomToV8Implementation { + # FIXME: This subroutine is lame. Probably should be an .idl attribute (CustomToV8)? + $dataNode = shift; + $interfaceName = shift; + + # We generate a custom converter (but JSC doesn't) for the following: + return 1 if $interfaceName eq "BarInfo"; + return 1 if $interfaceName eq "CSSStyleSheet"; + return 1 if $interfaceName eq "CanvasPixelArray"; + return 1 if $interfaceName eq "DOMSelection"; + return 1 if $interfaceName eq "DOMWindow"; + return 1 if $interfaceName eq "Element"; + return 1 if $interfaceName eq "Location"; + return 1 if $interfaceName eq "HTMLDocument"; + return 1 if $interfaceName eq "HTMLElement"; + return 1 if $interfaceName eq "History"; + return 1 if $interfaceName eq "NamedNodeMap"; + return 1 if $interfaceName eq "Navigator"; + return 1 if $interfaceName eq "SVGDocument"; + return 1 if $interfaceName eq "SVGElement"; + return 1 if $interfaceName eq "Screen"; + return 1 if $interfaceName eq "WorkerContext"; + # We don't generate a custom converter (but JSC does) for the following: + return 0 if $interfaceName eq "AbstractWorker"; + return 0 if $interfaceName eq "CanvasRenderingContext"; + return 0 if $interfaceName eq "ImageData"; + return 0 if $interfaceName eq "SVGElementInstance"; + + # For everything else, do what JSC does. + return $dataNode->extendedAttributes->{"CustomToJS"}; +} + +sub GetDomMapFunction +{ + my $dataNode = shift; + my $type = shift; + return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance"; + return "getDOMNodeMap()" if IsNodeSubType($dataNode); + # Only use getDOMSVGObjectWithContextMap() for non-node svg objects + return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/; + return "" if $type eq "DOMImplementation"; + return "getActiveDOMObjectMap()" if IsActiveDomType($type); + return "getDOMObjectMap()"; +} + +sub IsActiveDomType +{ + # FIXME: Consider making this an .idl attribute. + my $type = shift; + return 1 if $type eq "MessagePort"; + return 1 if $type eq "XMLHttpRequest"; + return 1 if $type eq "WebSocket"; + return 1 if $type eq "Worker"; + return 1 if $type eq "SharedWorker"; + return 0; +} + +sub GetNativeTypeForConversions +{ + my $type = shift; + return "FloatRect" if $type eq "SVGRect"; + return "FloatPoint" if $type eq "SVGPoint"; + return "AffineTransform" if $type eq "SVGMatrix"; + return "float" if $type eq "SVGNumber"; + return $type; +} sub GenerateFunctionCallString() { @@ -1497,7 +2151,6 @@ sub GenerateFunctionCallString() my $first = 1; my $index = 0; - my $nodeToReturn = 0; foreach my $parameter (@{$function->parameters}) { if ($index eq $numberOfParameters) { @@ -1519,16 +2172,20 @@ sub GenerateFunctionCallString() } else { $functionString .= $paramName; } - - if ($parameter->extendedAttributes->{"Return"}) { - $nodeToReturn = $parameter->name; - } $index++; } if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { $functionString .= ", " if not $first; - $functionString .= "&callStack"; + $functionString .= "callStack.get()"; + if ($first) { $first = 0; } + } + + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionString .= ", " if not $first; + # FIXME: We need to pass DOMWrapperWorld as a parameter. + # See http://trac.webkit.org/changeset/54182 + $functionString .= "processingUserGesture()"; if ($first) { $first = 0; } } @@ -1541,19 +2198,7 @@ sub GenerateFunctionCallString() my $return = "result"; my $returnIsRef = IsRefPtrType($returnType); - if ($nodeToReturn) { - # Special case for insertBefore, replaceChild, removeChild and - # appendChild functions from Node. - $result .= $indent . "bool success = $functionString;\n"; - if (@{$function->raisesExceptions}) { - $result .= GenerateSetDOMException($indent); - } - $result .= $indent . "if (success)\n"; - $result .= $indent . " " . - "return V8DOMWrapper::convertNodeToV8Object($nodeToReturn);\n"; - $result .= $indent . "return v8::Null();\n"; - return $result; - } elsif ($returnType eq "void") { + if ($returnType eq "void") { $result .= $indent . "$functionString;\n"; } elsif ($copyFirst) { $result .= @@ -1570,7 +2215,7 @@ sub GenerateFunctionCallString() } if (@{$function->raisesExceptions}) { - $result .= GenerateSetDOMException($indent); + $result .= $indent . "if (UNLIKELY(ec)) goto fail;\n"; } # If the return type is a POD type, separate out the wrapper generation @@ -1612,8 +2257,8 @@ sub GenerateFunctionCallString() } if ($returnsPodType) { - my $classIndex = uc($returnType); - $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"; + $implIncludes{"V8${returnType}.h"} = 1; + $result .= $indent . "return toV8(wrapper.release());\n"; } else { $return .= ".release()" if ($returnIsRef); $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n"; @@ -1627,19 +2272,14 @@ sub GetTypeFromSignature { my $signature = shift; - my $type = $codeGenerator->StripModule($signature->type); - if (($type eq "DOMString") && $signature->extendedAttributes->{"HintAtomic"}) { - $type = "AtomicString"; - } - - return $type; + return $codeGenerator->StripModule($signature->type); } sub GetNativeTypeFromSignature { my $signature = shift; - my $isParameter = shift; + my $parameterIndex = shift; my $type = GetTypeFromSignature($signature); @@ -1648,117 +2288,39 @@ sub GetNativeTypeFromSignature return "int"; } - return GetNativeType($type, $isParameter); -} - -sub IsRefPtrType -{ - my $type = shift; - return 1 if $type eq "Attr"; - return 1 if $type eq "CanvasActiveInfo"; - return 1 if $type eq "CanvasArray"; - return 1 if $type eq "CanvasArrayBuffer"; - return 1 if $type eq "CanvasBooleanArray"; - return 1 if $type eq "CanvasByteArray"; - return 1 if $type eq "CanvasBuffer"; - return 1 if $type eq "CanvasFloatArray"; - return 1 if $type eq "CanvasFramebuffer"; - return 1 if $type eq "CanvasGradient"; - return 1 if $type eq "CanvasIntArray"; - return 1 if $type eq "CanvasObject"; - return 1 if $type eq "CanvasProgram"; - return 1 if $type eq "CanvasRenderbuffer"; - return 1 if $type eq "CanvasShader"; - return 1 if $type eq "CanvasShortArray"; - return 1 if $type eq "CanvasTexture"; - return 1 if $type eq "CanvasUnsignedByteArray"; - return 1 if $type eq "CanvasUnsignedIntArray"; - return 1 if $type eq "CanvasUnsignedShortArray"; - return 1 if $type eq "ClientRect"; - return 1 if $type eq "ClientRectList"; - return 1 if $type eq "CDATASection"; - return 1 if $type eq "Comment"; - return 1 if $type eq "CSSRule"; - return 1 if $type eq "CSSStyleRule"; - return 1 if $type eq "CSSCharsetRule"; - return 1 if $type eq "CSSImportRule"; - return 1 if $type eq "CSSMediaRule"; - return 1 if $type eq "CSSFontFaceRule"; - return 1 if $type eq "CSSPageRule"; - return 1 if $type eq "CSSPrimitiveValue"; - return 1 if $type eq "CSSStyleSheet"; - return 1 if $type eq "CSSStyleDeclaration"; - return 1 if $type eq "CSSValue"; - return 1 if $type eq "CSSRuleList"; - return 1 if $type eq "Database"; - return 1 if $type eq "Document"; - return 1 if $type eq "DocumentFragment"; - return 1 if $type eq "DocumentType"; - return 1 if $type eq "Element"; - return 1 if $type eq "EntityReference"; - return 1 if $type eq "Event"; - return 1 if $type eq "EventListener"; - return 1 if $type eq "FileList"; - return 1 if $type eq "HTMLCollection"; - return 1 if $type eq "HTMLAllCollection"; - return 1 if $type eq "HTMLDocument"; - return 1 if $type eq "HTMLElement"; - return 1 if $type eq "HTMLOptionsCollection"; - return 1 if $type eq "ImageData"; - return 1 if $type eq "Media"; - return 1 if $type eq "MediaError"; - return 1 if $type eq "MimeType"; - return 1 if $type eq "Node"; - return 1 if $type eq "NodeList"; - return 1 if $type eq "NodeFilter"; - return 1 if $type eq "NodeIterator"; - return 1 if $type eq "NSResolver"; - return 1 if $type eq "Plugin"; - return 1 if $type eq "ProcessingInstruction"; - return 1 if $type eq "Range"; - return 1 if $type eq "RGBColor"; - return 1 if $type eq "Text"; - return 1 if $type eq "TextMetrics"; - return 1 if $type eq "TimeRanges"; - return 1 if $type eq "TreeWalker"; - return 1 if $type eq "WebKitCSSMatrix"; - return 1 if $type eq "WebKitPoint"; - return 1 if $type eq "XPathExpression"; - return 1 if $type eq "XPathNSResolver"; - return 1 if $type eq "XPathResult"; - - return 1 if $type eq "SVGAngle"; - return 1 if $type eq "SVGElementInstance"; - return 1 if $type eq "SVGElementInstanceList"; - return 1 if $type =~ /^SVGPathSeg/; - - return 1 if $type =~ /^SVGAnimated/; + $type = GetNativeType($type, $parameterIndex >= 0 ? 1 : 0); - return 0; -} - -sub IsVideoClassName -{ - my $class = shift; - return 1 if $class eq "V8HTMLAudioElement"; - return 1 if $class eq "V8HTMLMediaElement"; - return 1 if $class eq "V8HTMLSourceElement"; - return 1 if $class eq "V8HTMLVideoElement"; - return 1 if $class eq "V8MediaError"; - return 1 if $class eq "V8TimeRanges"; + if ($parameterIndex >= 0 && $type eq "V8Parameter") { + my $mode = ""; + if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) { + $mode = "WithUndefinedOrNullCheck"; + } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"}) { + $mode = "WithNullCheck"; + } + $type .= "<$mode>"; + } - return 0; + return $type; } -sub IsWorkerClassName +sub IsRefPtrType { - my $class = shift; - return 1 if $class eq "V8Worker"; - return 1 if $class eq "V8WorkerContext"; - return 1 if $class eq "V8WorkerLocation"; - return 1 if $class eq "V8WorkerNavigator"; + my $type = shift; - return 0; + return 0 if $type eq "boolean"; + return 0 if $type eq "float"; + return 0 if $type eq "int"; + return 0 if $type eq "Date"; + return 0 if $type eq "DOMString"; + return 0 if $type eq "double"; + return 0 if $type eq "short"; + return 0 if $type eq "long"; + return 0 if $type eq "unsigned"; + return 0 if $type eq "unsigned long"; + return 0 if $type eq "unsigned short"; + return 0 if $type eq "SVGAnimatedPoints"; + + return 1; } sub GetNativeType @@ -1766,28 +2328,33 @@ sub GetNativeType my $type = shift; my $isParameter = shift; - if ($type eq "float" or $type eq "AtomicString" or $type eq "double") { + if ($type eq "float" or $type eq "double") { return $type; } + return "V8Parameter" if ($type eq "DOMString" or $type eq "DOMUserData") and $isParameter; return "int" if $type eq "int"; return "int" if $type eq "short" or $type eq "unsigned short"; return "unsigned" if $type eq "unsigned long"; return "int" if $type eq "long"; + return "long long" if $type eq "long long"; return "unsigned long long" if $type eq "unsigned long long"; return "bool" if $type eq "boolean"; return "String" if $type eq "DOMString"; return "Range::CompareHow" if $type eq "CompareHow"; return "FloatRect" if $type eq "SVGRect"; return "FloatPoint" if $type eq "SVGPoint"; - return "TransformationMatrix" if $type eq "SVGMatrix"; + return "AffineTransform" if $type eq "SVGMatrix"; return "SVGTransform" if $type eq "SVGTransform"; return "SVGLength" if $type eq "SVGLength"; - return "double" if $type eq "SVGNumber"; + return "SVGAngle" if $type eq "SVGAngle"; + return "float" if $type eq "SVGNumber"; + return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio"; return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType"; return "DOMTimeStamp" if $type eq "DOMTimeStamp"; return "unsigned" if $type eq "unsigned int"; return "Node*" if $type eq "EventTarget" and $isParameter; + return "double" if $type eq "Date"; return "String" if $type eq "DOMUserData"; # FIXME: Temporary hack? @@ -1805,21 +2372,23 @@ sub GetNativeType my %typeCanFailConversion = ( - "AtomicString" => 0, "Attr" => 1, - "CanvasArray" => 0, - "CanvasBuffer" => 0, - "CanvasByteArray" => 0, - "CanvasFloatArray" => 0, - "CanvasFramebuffer" => 0, + "WebGLArray" => 0, + "WebGLBuffer" => 0, + "WebGLByteArray" => 0, + "WebGLUnsignedByteArray" => 0, + "WebGLContextAttributes" => 0, + "WebGLFloatArray" => 0, + "WebGLFramebuffer" => 0, "CanvasGradient" => 0, - "CanvasIntArray" => 0, + "WebGLIntArray" => 0, "CanvasPixelArray" => 0, - "CanvasProgram" => 0, - "CanvasRenderbuffer" => 0, - "CanvasShader" => 0, - "CanvasShortArray" => 0, - "CanvasTexture" => 0, + "WebGLProgram" => 0, + "WebGLRenderbuffer" => 0, + "WebGLShader" => 0, + "WebGLShortArray" => 0, + "WebGLTexture" => 0, + "WebGLUniformLocation" => 0, "CompareHow" => 0, "DataGridColumn" => 0, "DOMString" => 0, @@ -1841,7 +2410,7 @@ my %typeCanFailConversion = ( "Range" => 0, "SQLResultSet" => 0, "Storage" => 0, - "SVGAngle" => 0, + "SVGAngle" => 1, "SVGElement" => 0, "SVGLength" => 1, "SVGMatrix" => 1, @@ -1849,8 +2418,10 @@ my %typeCanFailConversion = ( "SVGPaintType" => 0, "SVGPathSeg" => 0, "SVGPoint" => 1, + "SVGPreserveAspectRatio" => 1, "SVGRect" => 1, "SVGTransform" => 1, + "TouchList" => 0, "VoidCallback" => 1, "WebKitCSSMatrix" => 0, "WebKitPoint" => 0, @@ -1863,6 +2434,8 @@ my %typeCanFailConversion = ( "long" => 0, "unsigned long" => 0, "unsigned short" => 0, + "long long" => 0, + "unsigned long long" => 0 ); @@ -1881,9 +2454,11 @@ sub BasicTypeCanFailConversion my $signature = shift; my $type = GetTypeFromSignature($signature); + return 1 if $type eq "SVGAngle"; return 1 if $type eq "SVGLength"; return 1 if $type eq "SVGMatrix"; return 1 if $type eq "SVGPoint"; + return 1 if $type eq "SVGPreserveAspectRatio"; return 1 if $type eq "SVGRect"; return 1 if $type eq "SVGTransform"; return 0; @@ -1917,19 +2492,13 @@ sub JSValueToNative return "$value->NumberValue()" if $type eq "SVGNumber"; return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long"; + return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long"; return "static_cast($value->Int32Value())" if $type eq "CompareHow"; return "static_cast($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType"; + return "toWebCoreDate($value)" if $type eq "Date"; - if ($type eq "AtomicString") { - return "v8ValueToAtomicWebCoreStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"}; - return "v8ValueToAtomicWebCoreString($value)"; - } - - return "toWebCoreString($value)" if $type eq "DOMUserData"; - if ($type eq "DOMString") { - return "toWebCoreStringWithNullCheck($value)" if $signature->extendedAttributes->{"ConvertNullToNullString"}; - return "toWebCoreStringWithNullOrUndefinedCheck($value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}; - return "toWebCoreString($value)"; + if ($type eq "DOMString" or $type eq "DOMUserData") { + return $value; } if ($type eq "SerializedScriptValue") { @@ -1950,12 +2519,11 @@ sub JSValueToNative } # Default, assume autogenerated type conversion routines - $implIncludes{"V8Proxy.h"} = 1; if ($type eq "EventTarget") { $implIncludes{"V8Node.h"} = 1; # EventTarget is not in DOM hierarchy, but all Nodes are EventTarget. - return "V8Node::HasInstance($value) ? V8DOMWrapper::convertDOMWrapperToNode(v8::Handle::Cast($value)) : 0"; + return "V8Node::HasInstance($value) ? V8Node::toNative(v8::Handle::Cast($value)) : 0"; } if ($type eq "XPathNSResolver") { @@ -1963,14 +2531,13 @@ sub JSValueToNative } AddIncludesForType($type); - # $implIncludes{"$type.h"} = 1 unless AvoidInclusionOfType($type); if (IsDOMNodeType($type)) { $implIncludes{"V8${type}.h"} = 1; # Perform type checks on the parameter, if it is expected Node type, # return NULL. - return "V8${type}::HasInstance($value) ? V8DOMWrapper::convertDOMWrapperToNode<${type}>(v8::Handle::Cast($value)) : 0"; + return "V8${type}::HasInstance($value) ? V8${type}::toNative(v8::Handle::Cast($value)) : 0"; } else { # TODO: Temporary to avoid Window name conflict. my $classIndex = uc($type); @@ -1989,7 +2556,7 @@ sub JSValueToNative # Perform type checks on the parameter, if it is expected Node type, # return NULL. - return "V8${type}::HasInstance($value) ? V8DOMWrapper::convertToNativeObject<${implClassName}>(V8ClassIndex::${classIndex}, v8::Handle::Cast($value)) : 0"; + return "V8${type}::HasInstance($value) ? V8${type}::toNative(v8::Handle::Cast($value)) : 0"; } } @@ -1997,7 +2564,11 @@ sub JSValueToNative sub GetV8HeaderName { my $type = shift; - return "V8" . GetImplementationFileName($type); + return "V8Event.h" if $type eq "DOMTimeStamp"; + return "EventListener.h" if $type eq "EventListener"; + return "EventTarget.h" if $type eq "EventTarget"; + return "SerializedScriptValue.h" if $type eq "SerializedScriptValue"; + return "V8${type}.h"; } @@ -2053,17 +2624,20 @@ sub RequiresCustomSignature my %non_wrapper_types = ( 'float' => 1, - 'AtomicString' => 1, 'double' => 1, 'short' => 1, 'unsigned short' => 1, 'long' => 1, 'unsigned long' => 1, 'boolean' => 1, + 'long long' => 1, + 'unsigned long long' => 1, 'DOMString' => 1, 'CompareHow' => 1, + 'SVGAngle' => 1, 'SVGRect' => 1, 'SVGPoint' => 1, + 'SVGPreserveAspectRatio' => 1, 'SVGMatrix' => 1, 'SVGTransform' => 1, 'SVGLength' => 1, @@ -2119,11 +2693,10 @@ sub ReturnNativeToJSValue my $value = shift; my $indent = shift; my $type = GetTypeFromSignature($signature); - my $className= "V8$type"; return "return v8::Date::New(static_cast($value))" if $type eq "DOMTimeStamp"; - return "return $value ? v8::True() : v8::False()" if $type eq "boolean"; - return "return v8::Undefined()" if $type eq "void"; + return "return v8Boolean($value)" if $type eq "boolean"; + return "return v8::Handle()" if $type eq "void"; # equivalent to v8::Undefined() # For all the types where we use 'int' as the representation type, # we use Integer::New which has a fast Smi conversion check. @@ -2131,6 +2704,7 @@ sub ReturnNativeToJSValue return "return v8::Integer::New($value)" if $nativeType eq "int"; return "return v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned"; + return "return v8DateOrNull($value);" if $type eq "Date"; return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; if ($codeGenerator->IsStringType($type)) { @@ -2145,61 +2719,36 @@ sub ReturnNativeToJSValue return "return v8String($value)"; } - # V8 specific. - my $implClassName = $type; AddIncludesForType($type); - # $implIncludes{GetImplementationFileName($type)} = 1 unless AvoidInclusionOfType($type); # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - if ($signature->extendedAttributes->{"ReturnsNew"}) { - return "return V8DOMWrapper::convertNewNodeToV8Object($value)"; - } else { - return "return V8DOMWrapper::convertNodeToV8Object($value)"; - } + return "return toV8(${value}" . ($signature->extendedAttributes->{"ReturnsNew"} ? ", true)" : ")"); } - if ($type eq "EventTarget" or $type eq "SVGElementInstance") { + if ($type eq "EventTarget") { return "return V8DOMWrapper::convertEventTargetToV8Object($value)"; } - if ($type eq "Event") { - return "return V8DOMWrapper::convertEventToV8Object($value)"; - } - if ($type eq "EventListener") { - return "return V8DOMWrapper::convertEventListenerToV8Object(imp->scriptExecutionContext(), $value)"; + $implIncludes{"V8AbstractEventListener.h"} = 1; + return "return ${value} ? v8::Handle(static_cast(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle(v8::Null())"; } if ($type eq "SerializedScriptValue") { $implIncludes{"$type.h"} = 1; - return "return v8String($value->toString())"; - } - - if ($type eq "DedicatedWorkerContext" or $type eq "WorkerContext" or $type eq "SharedWorkerContext") { - $implIncludes{"WorkerContextExecutionProxy.h"} = 1; - return "return WorkerContextExecutionProxy::convertWorkerContextToV8Object($value)"; + return "return $value->deserialize()"; } - if ($type eq "WorkerLocation" or $type eq "WorkerNavigator" or $type eq "NotificationCenter") { - $implIncludes{"WorkerContextExecutionProxy.h"} = 1; - my $classIndex = uc($type); + $implIncludes{"wtf/RefCounted.h"} = 1; + $implIncludes{"wtf/RefPtr.h"} = 1; + $implIncludes{"wtf/GetPtr.h"} = 1; - return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)"; + if (IsPodType($type)) { + $value = GenerateSVGStaticPodTypeWrapper($type, $value) . ".get()"; } - else { - $implIncludes{"wtf/RefCounted.h"} = 1; - $implIncludes{"wtf/RefPtr.h"} = 1; - $implIncludes{"wtf/GetPtr.h"} = 1; - my $classIndex = uc($type); - - if (IsPodType($type)) { - $value = GenerateSVGStaticPodTypeWrapper($type, $value); - } - - return "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, $value)"; - } + return "return toV8($value)"; } sub GenerateSVGStaticPodTypeWrapper { diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/IDLParser.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/IDLParser.pm index 4abdb45..b2577d2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/IDLParser.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/IDLParser.pm @@ -3,8 +3,6 @@ # # Copyright (C) 2005 Nikolas Zimmermann # -# This file is part of the KDE project -# # 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 @@ -160,6 +158,7 @@ sub parseExtendedAttributes # Attributes with no value are set to be true $value = 1 unless defined $value; $attrs{$name} = $value; + die("Invalid extended attribute name: '$name'\n") if $name =~ /\s/; } return \%attrs; @@ -372,7 +371,9 @@ sub DetermineParseMode $mode = MODE_INTERFACE; } elsif ($_ =~ /exception/) { $mode = MODE_EXCEPTION; - } elsif ($_ =~ /alias/) { + } elsif ($_ =~ /(\A|\b)alias/) { + # The (\A|\b) above is needed so we don't match attributes + # whose names contain the substring "alias". $mode = MODE_ALIAS; } diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/IDLStructure.pm b/src/3rdparty/webkit/WebCore/bindings/scripts/IDLStructure.pm index 5a59ff1..f5970b4 100644 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/IDLStructure.pm +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/IDLStructure.pm @@ -3,8 +3,6 @@ # # Copyright (C) 2005 Nikolas Zimmermann # -# This file is part of the KDE project -# # 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 diff --git a/src/3rdparty/webkit/WebCore/bindings/scripts/generate-bindings.pl b/src/3rdparty/webkit/WebCore/bindings/scripts/generate-bindings.pl index c7adeb3..ad29dc5 100755 --- a/src/3rdparty/webkit/WebCore/bindings/scripts/generate-bindings.pl +++ b/src/3rdparty/webkit/WebCore/bindings/scripts/generate-bindings.pl @@ -56,7 +56,6 @@ my $idlFile = $ARGV[0]; die('Must specify input file.') unless defined($idlFile); die('Must specify IDL search path.') unless @idlDirectories; die('Must specify generator') unless defined($generator); -die('Must specify input file.') unless defined($idlFile); die('Must specify output directory.') unless defined($outputDirectory); die('Must specify defines') unless defined($defines); diff --git a/src/3rdparty/webkit/WebCore/bridge/Bridge.h b/src/3rdparty/webkit/WebCore/bridge/Bridge.h new file mode 100644 index 0000000..50efc64 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/Bridge.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Bridge_h +#define Bridge_h + +#include "BridgeJSC.h" +#include + +namespace JSC { + +namespace Bindings { + +class Method : public Noncopyable { +public: + virtual int numParameters() const = 0; + + virtual ~Method() { } +}; + +} // namespace Bindings + +} // namespace JSC + +#endif diff --git a/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h index 8128bf8..99bae0b 100644 --- a/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h +++ b/src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h @@ -28,6 +28,7 @@ #include #include +#include #include namespace WebCore { @@ -54,7 +55,7 @@ private: IdentifierRep(const char* name) : m_isString(true) { - m_value.m_string = strdup(name); + m_value.m_string = fastStrDup(name); } ~IdentifierRep() diff --git a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp index 6a89652..2b1d17f 100644 --- a/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/NP_jsobject.cpp @@ -30,6 +30,7 @@ #include "NP_jsobject.h" #include "PlatformString.h" +#include "PluginView.h" #include "StringSourceProvider.h" #include "c_utility.h" #include "c_instance.h" @@ -50,6 +51,64 @@ using namespace JSC; using namespace JSC::Bindings; using namespace WebCore; +class ObjectMap { +public: + NPObject* get(RootObject* rootObject, JSObject* jsObject) + { + return m_map.get(rootObject).get(jsObject); + } + + void add(RootObject* rootObject, JSObject* jsObject, NPObject* npObject) + { + HashMap::iterator iter = m_map.find(rootObject); + if (iter == m_map.end()) { + rootObject->addInvalidationCallback(&m_invalidationCallback); + iter = m_map.add(rootObject, JSToNPObjectMap()).first; + } + + ASSERT(iter->second.find(jsObject) == iter->second.end()); + iter->second.add(jsObject, npObject); + } + + void remove(RootObject* rootObject) + { + HashMap::iterator iter = m_map.find(rootObject); + ASSERT(iter != m_map.end()); + m_map.remove(iter); + } + + void remove(RootObject* rootObject, JSObject* jsObject) + { + HashMap::iterator iter = m_map.find(rootObject); + ASSERT(iter != m_map.end()); + ASSERT(iter->second.find(jsObject) != iter->second.end()); + + iter->second.remove(jsObject); + } + +private: + struct RootObjectInvalidationCallback : public RootObject::InvalidationCallback { + virtual void operator()(RootObject*); + }; + RootObjectInvalidationCallback m_invalidationCallback; + + // JSObjects are protected by RootObject. + typedef HashMap JSToNPObjectMap; + HashMap m_map; +}; + + +static ObjectMap& objectMap() +{ + DEFINE_STATIC_LOCAL(ObjectMap, map, ()); + return map; +} + +void ObjectMap::RootObjectInvalidationCallback::operator()(RootObject* rootObject) +{ + objectMap().remove(rootObject); +} + static void getListFromVariantArgs(ExecState* exec, const NPVariant* args, unsigned argCount, RootObject* rootObject, MarkedArgumentBuffer& aList) { for (unsigned i = 0; i < argCount; ++i) @@ -65,8 +124,10 @@ static void jsDeallocate(NPObject* npObj) { JavaScriptObject* obj = reinterpret_cast(npObj); - if (obj->rootObject && obj->rootObject->isValid()) + if (obj->rootObject && obj->rootObject->isValid()) { + objectMap().remove(obj->rootObject, obj->imp); obj->rootObject->gcUnprotect(obj->imp); + } if (obj->rootObject) obj->rootObject->deref(); @@ -82,12 +143,18 @@ static NPClass* NPNoScriptObjectClass = &noScriptClass; NPObject* _NPN_CreateScriptObject(NPP npp, JSObject* imp, PassRefPtr rootObject) { + if (NPObject* object = objectMap().get(rootObject.get(), imp)) + return _NPN_RetainObject(object); + JavaScriptObject* obj = reinterpret_cast(_NPN_CreateObject(npp, NPScriptObjectClass)); obj->rootObject = rootObject.releaseRef(); - if (obj->rootObject) + if (obj->rootObject) { obj->rootObject->gcProtect(imp); + objectMap().add(obj->rootObject, imp, reinterpret_cast(obj)); + } + obj->imp = imp; return reinterpret_cast(obj); @@ -124,7 +191,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = callInWorld(exec, function, callType, callData, function, argList, pluginWorld()); + JSValue resultV = JSC::call(exec, function, callType, callData, function, argList); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -174,7 +241,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = callInWorld(exec, function, callType, callData, obj->imp, argList, pluginWorld()); + JSValue resultV = JSC::call(exec, function, callType, callData, obj->imp, argList); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result of the function call. @@ -190,7 +257,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* return true; } -bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) +bool _NPN_Evaluate(NPP instance, NPObject* o, NPString* s, NPVariant* variant) { if (o->_class == NPScriptObjectClass) { JavaScriptObject* obj = reinterpret_cast(o); @@ -199,12 +266,16 @@ bool _NPN_Evaluate(NPP, NPObject* o, NPString* s, NPVariant* variant) if (!rootObject || !rootObject->isValid()) return false; + // There is a crash in Flash when evaluating a script that destroys the + // PluginView, so we destroy it asynchronously. + PluginView::keepAlive(instance); + ExecState* exec = rootObject->globalObject()->globalExec(); JSLock lock(SilenceAssertionsOnly); String scriptString = convertNPStringToUTF16(s); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - Completion completion = evaluateInWorld(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString), JSC::JSValue(), pluginWorld()); + Completion completion = JSC::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(scriptString), JSC::JSValue()); globalObject->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); @@ -379,7 +450,7 @@ bool _NPN_HasMethod(NPP, NPObject* o, NPIdentifier methodName) void _NPN_SetException(NPObject*, const NPUTF8* message) { - // Ignorning the NPObject param is consistent with the Mozilla implementation. + // Ignoring the NPObject param is consistent with the Mozilla implementation. UString exception(message); CInstance::setGlobalException(exception); } @@ -444,7 +515,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, getListFromVariantArgs(exec, args, argCount, rootObject, argList); ProtectedPtr globalObject = rootObject->globalObject(); globalObject->globalData()->timeoutChecker.start(); - JSValue resultV = constructInWorld(exec, constructor, constructType, constructData, argList, pluginWorld()); + JSValue resultV = JSC::construct(exec, constructor, constructType, constructData, argList); globalObject->globalData()->timeoutChecker.stop(); // Convert and return the result. diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_class.h b/src/3rdparty/webkit/WebCore/bridge/c/c_class.h index 7f20af4..52db2b9 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_class.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_class.h @@ -28,8 +28,8 @@ #if ENABLE(NETSCAPE_PLUGIN_API) +#include "Bridge.h" #include "npruntime_internal.h" -#include "runtime.h" #include namespace JSC { diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp index 77b5966..1b05259 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.cpp @@ -138,7 +138,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, const MethodList& methodList, c for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, m_rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } @@ -173,7 +173,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args) for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, m_rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } @@ -212,7 +212,7 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args) for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); - JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, _rootObject.get()); + JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, m_rootObject.get()); _NPN_ReleaseVariantValue(&resultVariant); return resultValue; } diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h index f9e9de3..abbabad 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_instance.h @@ -28,9 +28,9 @@ #if ENABLE(NETSCAPE_PLUGIN_API) -#include "runtime.h" -#include +#include "Bridge.h" #include "runtime_root.h" +#include typedef struct NPObject NPObject; @@ -50,6 +50,7 @@ public: } static void setGlobalException(JSC::UString exception); + static void moveGlobalExceptionToExecState(ExecState*); ~CInstance (); @@ -74,7 +75,6 @@ public: NPObject *getObject() const { return _object; } private: - static void moveGlobalExceptionToExecState(ExecState* exec); CInstance(NPObject*, PassRefPtr); mutable CClass *_class; diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp index e9a7bb6..e038cd4 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.cpp @@ -49,6 +49,7 @@ JSValue CField::valueFromInstance(ExecState* exec, const Instance* inst) const { JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); result = obj->_class->getProperty(obj, _fieldIdentifier, &property); + CInstance::moveGlobalExceptionToExecState(exec); } if (result) { JSValue result = convertNPVariantToValue(exec, &property, instance->rootObject()); @@ -70,6 +71,7 @@ void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue a { JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); obj->_class->setProperty(obj, _fieldIdentifier, &variant); + CInstance::moveGlobalExceptionToExecState(exec); } _NPN_ReleaseVariantValue(&variant); diff --git a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h index e797342..5355934 100644 --- a/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/c/c_runtime.h @@ -28,8 +28,8 @@ #if ENABLE(NETSCAPE_PLUGIN_API) +#include "Bridge.h" #include "npruntime_internal.h" -#include "runtime.h" namespace JSC { namespace Bindings { diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp new file mode 100644 index 0000000..778d4c3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIBridge.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "CString.h" +#include "StringBuilder.h" + + +using namespace JSC; +using namespace JSC::Bindings; +using namespace WebCore; + + +JavaParameter::JavaParameter(JNIEnv* env, jstring type) +{ + m_type = JavaString(env, type); + m_JNIType = JNITypeFromClassName(m_type.UTF8String()); +} + +JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod) +{ + // Get return type name + jstring returnTypeName = 0; + if (jobject returnType = callJNIMethod(aMethod, "getReturnType", "()Ljava/lang/Class;")) { + returnTypeName = static_cast(callJNIMethod(returnType, "getName", "()Ljava/lang/String;")); + if (!returnTypeName) + returnTypeName = env->NewStringUTF(""); + env->DeleteLocalRef(returnType); + } + m_returnType = JavaString(env, returnTypeName); + m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String()); + env->DeleteLocalRef(returnTypeName); + + // Get method name + jstring methodName = static_cast(callJNIMethod(aMethod, "getName", "()Ljava/lang/String;")); + if (!returnTypeName) + returnTypeName = env->NewStringUTF(""); + m_name = JavaString(env, methodName); + env->DeleteLocalRef(methodName); + + // Get parameters + if (jarray jparameters = static_cast(callJNIMethod(aMethod, "getParameterTypes", "()[Ljava/lang/Class;"))) { + m_numParameters = env->GetArrayLength(jparameters); + m_parameters = new JavaParameter[m_numParameters]; + + for (int i = 0; i < m_numParameters; i++) { + jobject aParameter = env->GetObjectArrayElement(static_cast(jparameters), i); + jstring parameterName = static_cast(callJNIMethod(aParameter, "getName", "()Ljava/lang/String;")); + if (!parameterName) + parameterName = env->NewStringUTF(""); + m_parameters[i] = JavaParameter(env, parameterName); + env->DeleteLocalRef(aParameter); + env->DeleteLocalRef(parameterName); + } + env->DeleteLocalRef(jparameters); + } else { + m_numParameters = 0; + m_parameters = 0; + } + + // Created lazily. + m_signature = 0; + m_methodID = 0; + + jclass modifierClass = env->FindClass("java/lang/reflect/Modifier"); + int modifiers = callJNIMethod(aMethod, "getModifiers", "()I"); + m_isStatic = static_cast(callJNIStaticMethod(modifierClass, "isStatic", "(I)Z", modifiers)); + env->DeleteLocalRef(modifierClass); +} + +JavaMethod::~JavaMethod() +{ + if (m_signature) + fastFree(m_signature); + delete[] m_parameters; +}; + +// JNI method signatures use '/' between components of a class name, but +// we get '.' between components from the reflection API. +static void appendClassName(StringBuilder& builder, const char* className) +{ +#if USE(JSC) + ASSERT(JSLock::lockCount() > 0); +#endif + + char* c = fastStrDup(className); + + char* result = c; + while (*c) { + if (*c == '.') + *c = '/'; + c++; + } + + builder.append(result); + + fastFree(result); +} + +const char* JavaMethod::signature() const +{ + if (!m_signature) { +#if USE(JSC) + JSLock lock(SilenceAssertionsOnly); +#endif + + StringBuilder signatureBuilder; + signatureBuilder.append("("); + for (int i = 0; i < m_numParameters; i++) { + JavaParameter* aParameter = parameterAt(i); + JNIType type = aParameter->getJNIType(); + if (type == array_type) + appendClassName(signatureBuilder, aParameter->type()); + else { + signatureBuilder.append(signatureFromPrimitiveType(type)); + if (type == object_type) { + appendClassName(signatureBuilder, aParameter->type()); + signatureBuilder.append(";"); + } + } + } + signatureBuilder.append(")"); + + const char* returnType = m_returnType.UTF8String(); + if (m_JNIReturnType == array_type) + appendClassName(signatureBuilder, returnType); + else { + signatureBuilder.append(signatureFromPrimitiveType(m_JNIReturnType)); + if (m_JNIReturnType == object_type) { + appendClassName(signatureBuilder, returnType); + signatureBuilder.append(";"); + } + } + + String signatureString = signatureBuilder.toString(); + m_signature = fastStrDup(signatureString.utf8().data()); + } + + return m_signature; +} + +JNIType JavaMethod::JNIReturnType() const +{ + return m_JNIReturnType; +} + +jmethodID JavaMethod::methodID(jobject obj) const +{ + if (!m_methodID) + m_methodID = getMethodID(obj, m_name.UTF8String(), signature()); + return m_methodID; +} + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h b/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h new file mode 100644 index 0000000..5d482a7 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/JNIBridge.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIBridge_h +#define JNIBridge_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "Bridge.h" +#include "JNIUtility.h" + +#if USE(JSC) +#include "JavaStringJSC.h" +#elif USE(V8) +#include "JavaStringV8.h" +#endif + +namespace JSC { + +namespace Bindings { + +typedef const char* RuntimeType; + +class JavaString { +public: + JavaString() + { + m_impl.init(); + } + + JavaString(JNIEnv* e, jstring s) + { + m_impl.init(e, s); + } + + JavaString(jstring s) + { + m_impl.init(getJNIEnv(), s); + } + + const char* UTF8String() const { return m_impl.UTF8String(); } + const jchar* uchars() const { return m_impl.uchars(); } + int length() const { return m_impl.length(); } +#if USE(JSC) + operator UString() const { return m_impl.uString(); } +#endif + +private: + JavaStringImpl m_impl; +}; + +class JavaParameter { +public: + JavaParameter() : m_JNIType(invalid_type) { } + JavaParameter(JNIEnv*, jstring type); + virtual ~JavaParameter() { } + + RuntimeType type() const { return m_type.UTF8String(); } + JNIType getJNIType() const { return m_JNIType; } + +private: + JavaString m_type; + JNIType m_JNIType; +}; + +class JavaMethod : public Method { +public: + JavaMethod(JNIEnv*, jobject aMethod); + ~JavaMethod(); + + const JavaString& name() const { return m_name; } + RuntimeType returnType() const { return m_returnType.UTF8String(); } + JavaParameter* parameterAt(int i) const { return &m_parameters[i]; } + int numParameters() const { return m_numParameters; } + + const char* signature() const; + JNIType JNIReturnType() const; + + jmethodID methodID(jobject obj) const; + + bool isStatic() const { return m_isStatic; } + +private: + JavaParameter* m_parameters; + int m_numParameters; + JavaString m_name; + mutable char* m_signature; + JavaString m_returnType; + JNIType m_JNIReturnType; + mutable jmethodID m_methodID; + bool m_isStatic; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JNIBridge_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp new file mode 100644 index 0000000..c5501b8 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.cpp @@ -0,0 +1,343 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIUtility.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include + +namespace JSC { + +namespace Bindings { + +static jint KJSGetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs) +{ + static void* javaVMFramework = 0; + if (!javaVMFramework) + javaVMFramework = dlopen("/System/Library/Frameworks/JavaVM.framework/JavaVM", RTLD_LAZY); + if (!javaVMFramework) + return JNI_ERR; + + typedef jint(*FunctionPointerType)(JavaVM**, jsize, jsize*); + static FunctionPointerType functionPointer = 0; + if (!functionPointer) + functionPointer = reinterpret_cast(dlsym(javaVMFramework, "JNI_GetCreatedJavaVMs")); + if (!functionPointer) + return JNI_ERR; + return functionPointer(vmBuf, bufLen, nVMs); +} + +static JavaVM* jvm = 0; + +// Provide the ability for an outside component to specify the JavaVM to use +// If the jvm value is set, the getJavaVM function below will just return. +// In getJNIEnv(), if AttachCurrentThread is called to a VM that is already +// attached, the result is a no-op. +void setJavaVM(JavaVM* javaVM) +{ + jvm = javaVM; +} + +JavaVM* getJavaVM() +{ + if (jvm) + return jvm; + + JavaVM* jvmArray[1]; + jsize bufLen = 1; + jsize nJVMs = 0; + jint jniError = 0; + + // Assumes JVM is already running ..., one per process + jniError = KJSGetCreatedJavaVMs(jvmArray, bufLen, &nJVMs); + if (jniError == JNI_OK && nJVMs > 0) + jvm = jvmArray[0]; + else + LOG_ERROR("JNI_GetCreatedJavaVMs failed, returned %ld", static_cast(jniError)); + + return jvm; +} + +JNIEnv* getJNIEnv() +{ + union { + JNIEnv* env; + void* dummy; + } u; + jint jniError = 0; + + jniError = getJavaVM()->AttachCurrentThread(&u.dummy, 0); + if (jniError == JNI_OK) + return u.env; + LOG_ERROR("AttachCurrentThread failed, returned %ld", static_cast(jniError)); + return 0; +} + +jmethodID getMethodID(jobject obj, const char* name, const char* sig) +{ + JNIEnv* env = getJNIEnv(); + jmethodID mid = 0; + + if (env) { + jclass cls = env->GetObjectClass(obj); + if (cls) { + mid = env->GetMethodID(cls, name, sig); + if (!mid) { + env->ExceptionClear(); + mid = env->GetStaticMethodID(cls, name, sig); + if (!mid) + env->ExceptionClear(); + } + } + env->DeleteLocalRef(cls); + } + return mid; +} + +const char* getCharactersFromJString(jstring aJString) +{ + return getCharactersFromJStringInEnv(getJNIEnv(), aJString); +} + +void releaseCharactersForJString(jstring aJString, const char* s) +{ + releaseCharactersForJStringInEnv(getJNIEnv(), aJString, s); +} + +const char* getCharactersFromJStringInEnv(JNIEnv* env, jstring aJString) +{ + jboolean isCopy; + const char* s = env->GetStringUTFChars(aJString, &isCopy); + if (!s) { + env->ExceptionDescribe(); + env->ExceptionClear(); + fprintf(stderr, "\n"); + } + return s; +} + +void releaseCharactersForJStringInEnv(JNIEnv* env, jstring aJString, const char* s) +{ + env->ReleaseStringUTFChars(aJString, s); +} + +const jchar* getUCharactersFromJStringInEnv(JNIEnv* env, jstring aJString) +{ + jboolean isCopy; + const jchar* s = env->GetStringChars(aJString, &isCopy); + if (!s) { + env->ExceptionDescribe(); + env->ExceptionClear(); + fprintf(stderr, "\n"); + } + return s; +} + +void releaseUCharactersForJStringInEnv(JNIEnv* env, jstring aJString, const jchar* s) +{ + env->ReleaseStringChars(aJString, s); +} + +JNIType JNITypeFromClassName(const char* name) +{ + JNIType type; + + if (!strcmp("byte", name)) + type = byte_type; + else if (!strcmp("short", name)) + type = short_type; + else if (!strcmp("int", name)) + type = int_type; + else if (!strcmp("long", name)) + type = long_type; + else if (!strcmp("float", name)) + type = float_type; + else if (!strcmp("double", name)) + type = double_type; + else if (!strcmp("char", name)) + type = char_type; + else if (!strcmp("boolean", name)) + type = boolean_type; + else if (!strcmp("void", name)) + type = void_type; + else if ('[' == name[0]) + type = array_type; + else + type = object_type; + + return type; +} + +const char* signatureFromPrimitiveType(JNIType type) +{ + switch (type) { + case void_type: + return "V"; + + case array_type: + return "["; + + case object_type: + return "L"; + + case boolean_type: + return "Z"; + + case byte_type: + return "B"; + + case char_type: + return "C"; + + case short_type: + return "S"; + + case int_type: + return "I"; + + case long_type: + return "J"; + + case float_type: + return "F"; + + case double_type: + return "D"; + + case invalid_type: + default: + break; + } + return ""; +} + +JNIType JNITypeFromPrimitiveType(char type) +{ + switch (type) { + case 'V': + return void_type; + + case 'L': + return object_type; + + case '[': + return array_type; + + case 'Z': + return boolean_type; + + case 'B': + return byte_type; + + case 'C': + return char_type; + + case 'S': + return short_type; + + case 'I': + return int_type; + + case 'J': + return long_type; + + case 'F': + return float_type; + + case 'D': + return double_type; + + default: + break; + } + return invalid_type; +} + +jvalue getJNIField(jobject obj, JNIType type, const char* name, const char* signature) +{ + JavaVM* jvm = getJavaVM(); + JNIEnv* env = getJNIEnv(); + jvalue result; + + bzero(&result, sizeof(jvalue)); + if (obj && jvm && env) { + jclass cls = env->GetObjectClass(obj); + if (cls) { + jfieldID field = env->GetFieldID(cls, name, signature); + if (field) { + switch (type) { + case array_type: + case object_type: + result.l = env->functions->GetObjectField(env, obj, field); + break; + case boolean_type: + result.z = env->functions->GetBooleanField(env, obj, field); + break; + case byte_type: + result.b = env->functions->GetByteField(env, obj, field); + break; + case char_type: + result.c = env->functions->GetCharField(env, obj, field); + break; + case short_type: + result.s = env->functions->GetShortField(env, obj, field); + break; + case int_type: + result.i = env->functions->GetIntField(env, obj, field); + break; + case long_type: + result.j = env->functions->GetLongField(env, obj, field); + break; + case float_type: + result.f = env->functions->GetFloatField(env, obj, field); + break; + case double_type: + result.d = env->functions->GetDoubleField(env, obj, field); + break; + default: + LOG_ERROR("Invalid field type (%d)", static_cast(type)); + } + } else { + LOG_ERROR("Could not find field: %s", name); + env->ExceptionDescribe(); + env->ExceptionClear(); + fprintf(stderr, "\n"); + } + + env->DeleteLocalRef(cls); + } else + LOG_ERROR("Could not find class for object"); + } + + return result; +} + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h b/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h new file mode 100644 index 0000000..0eb889c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/JNIUtility.h @@ -0,0 +1,275 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIUtility_h +#define JNIUtility_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include + +// The order of these items can not be modified as they are tightly +// bound with the JVM on Mac OSX. If new types need to be added, they +// should be added to the end. It is used in jni_obc.mm when calling +// through to the JVM. Newly added items need to be made compatible +// in that file. +typedef enum { + invalid_type = 0, + void_type, + object_type, + boolean_type, + byte_type, + char_type, + short_type, + int_type, + long_type, + float_type, + double_type, + array_type +} JNIType; + +namespace JSC { + +namespace Bindings { + +class JavaParameter; + +const char* getCharactersFromJString(jstring); +void releaseCharactersForJString(jstring, const char*); + +const char* getCharactersFromJStringInEnv(JNIEnv*, jstring); +void releaseCharactersForJStringInEnv(JNIEnv*, jstring, const char*); +const jchar* getUCharactersFromJStringInEnv(JNIEnv*, jstring); +void releaseUCharactersForJStringInEnv(JNIEnv*, jstring, const jchar*); + +JNIType JNITypeFromClassName(const char* name); +JNIType JNITypeFromPrimitiveType(char type); +const char* signatureFromPrimitiveType(JNIType); + +jvalue getJNIField(jobject, JNIType, const char* name, const char* signature); + +jmethodID getMethodID(jobject, const char* name, const char* sig); +JNIEnv* getJNIEnv(); +JavaVM* getJavaVM(); +void setJavaVM(JavaVM*); + + +template struct JNICaller; + +template<> struct JNICaller { + static void callA(jobject obj, jmethodID mid, jvalue* args) + { + getJNIEnv()->CallVoidMethodA(obj, mid, args); + } + static void callV(jobject obj, jmethodID mid, va_list args) + { + getJNIEnv()->CallVoidMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jobject callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallObjectMethodA(obj, mid, args); + } + static jobject callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallObjectMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jboolean callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallBooleanMethodA(obj, mid, args); + } + static jboolean callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallBooleanMethodV(obj, mid, args); + } + static jboolean callStaticV(jclass cls, jmethodID mid, va_list args) + { + return getJNIEnv()->CallStaticBooleanMethod(cls, mid, args); + } +}; + +template<> struct JNICaller { + static jbyte callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallByteMethodA(obj, mid, args); + } + static jbyte callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallByteMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jchar callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallCharMethodA(obj, mid, args); + } + static jchar callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallCharMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jshort callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallShortMethodA(obj, mid, args); + } + static jshort callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallShortMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jint callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallIntMethodA(obj, mid, args); + } + static jint callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallIntMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jlong callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallLongMethodA(obj, mid, args); + } + static jlong callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallLongMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jfloat callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallFloatMethodA(obj, mid, args); + } + static jfloat callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallFloatMethodV(obj, mid, args); + } +}; + +template<> struct JNICaller { + static jdouble callA(jobject obj, jmethodID mid, jvalue* args) + { + return getJNIEnv()->CallDoubleMethodA(obj, mid, args); + } + static jdouble callV(jobject obj, jmethodID mid, va_list args) + { + return getJNIEnv()->CallDoubleMethodV(obj, mid, args); + } +}; + +template T callJNIMethodIDA(jobject obj, jmethodID mid, jvalue *args) +{ + return JNICaller::callA(obj, mid, args); +} + +template +static T callJNIMethodV(jobject obj, const char* name, const char* sig, va_list args) +{ + JavaVM* jvm = getJavaVM(); + JNIEnv* env = getJNIEnv(); + + if (obj && jvm && env) { + jclass cls = env->GetObjectClass(obj); + if (cls) { + jmethodID mid = env->GetMethodID(cls, name, sig); + if (mid) { + // Avoids references to cls without popping the local frame. + env->DeleteLocalRef(cls); + return JNICaller::callV(obj, mid, args); + } + LOG_ERROR("Could not find method: %s for %p", name, obj); + env->ExceptionDescribe(); + env->ExceptionClear(); + fprintf(stderr, "\n"); + + env->DeleteLocalRef(cls); + } else + LOG_ERROR("Could not find class for %p", obj); + } + + return 0; +} + +template +T callJNIMethod(jobject obj, const char* methodName, const char* methodSignature, ...) +{ + va_list args; + va_start(args, methodSignature); + + T result = callJNIMethodV(obj, methodName, methodSignature, args); + + va_end(args); + + return result; +} + +template +T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSignature, ...) +{ + JavaVM* jvm = getJavaVM(); + JNIEnv* env = getJNIEnv(); + va_list args; + + va_start(args, methodSignature); + + T result = 0; + + if (cls && jvm && env) { + jmethodID mid = env->GetStaticMethodID(cls, methodName, methodSignature); + if (mid) + result = JNICaller::callStaticV(cls, mid, args); + else { + LOG_ERROR("Could not find method: %s for %p", methodName, cls); + env->ExceptionDescribe(); + env->ExceptionClear(); + fprintf(stderr, "\n"); + } + } + + va_end(args); + + return result; +} + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JNIUtility_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp deleted file mode 100644 index 012b047..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "jni_class.h" - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include "JSDOMWindow.h" -#include -#include -#include "jni_utility.h" -#include "jni_runtime.h" - -using namespace JSC::Bindings; - -JavaClass::JavaClass(jobject anInstance) -{ - jobject aClass = callJNIMethod(anInstance, "getClass", "()Ljava/lang/Class;"); - - if (!aClass) { - fprintf(stderr, "%s: unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance); - return; - } - - jstring className = (jstring)callJNIMethod(aClass, "getName", "()Ljava/lang/String;"); - const char *classNameC = getCharactersFromJString(className); - _name = strdup(classNameC); - releaseCharactersForJString(className, classNameC); - - int i; - JNIEnv *env = getJNIEnv(); - - // Get the fields - jarray fields = (jarray)callJNIMethod(aClass, "getFields", "()[Ljava/lang/reflect/Field;"); - int numFields = env->GetArrayLength(fields); - for (i = 0; i < numFields; i++) { - jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i); - JavaField *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor - { - JSLock lock(SilenceAssertionsOnly); - _fields.set(aField->name(), aField); - } - env->DeleteLocalRef(aJField); - } - - // Get the methods - jarray methods = (jarray)callJNIMethod(aClass, "getMethods", "()[Ljava/lang/reflect/Method;"); - int numMethods = env->GetArrayLength(methods); - for (i = 0; i < numMethods; i++) { - jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i); - JavaMethod *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor - MethodList* methodList; - { - JSLock lock(SilenceAssertionsOnly); - - methodList = _methods.get(aMethod->name()); - if (!methodList) { - methodList = new MethodList(); - _methods.set(aMethod->name(), methodList); - } - } - methodList->append(aMethod); - env->DeleteLocalRef(aJMethod); - } -} - -JavaClass::~JavaClass() { - free((void *)_name); - - JSLock lock(SilenceAssertionsOnly); - - deleteAllValues(_fields); - _fields.clear(); - - MethodListMap::const_iterator end = _methods.end(); - for (MethodListMap::const_iterator it = _methods.begin(); it != end; ++it) { - const MethodList* methodList = it->second; - deleteAllValues(*methodList); - delete methodList; - } - _methods.clear(); -} - -MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const -{ - MethodList *methodList = _methods.get(identifier.ustring().rep()); - - if (methodList) - return *methodList; - return MethodList(); -} - -Field *JavaClass::fieldNamed(const Identifier& identifier, Instance*) const -{ - return _fields.get(identifier.ustring().rep()); -} - -bool JavaClass::isNumberClass() const -{ - return ((strcmp(_name, "java.lang.Byte") == 0 || - strcmp(_name, "java.lang.Short") == 0 || - strcmp(_name, "java.lang.Integer") == 0 || - strcmp(_name, "java.lang.Long") == 0 || - strcmp(_name, "java.lang.Float") == 0 || - strcmp(_name, "java.lang.Double") == 0) ); -} - -bool JavaClass::isBooleanClass() const -{ - return strcmp(_name, "java.lang.Boolean") == 0; -} - -bool JavaClass::isStringClass() const -{ - return strcmp(_name, "java.lang.String") == 0; -} - -#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h deleted file mode 100644 index 890b4d3..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_class.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JNI_CLASS_H_ -#define JNI_CLASS_H_ - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include -#include - -namespace JSC { - -namespace Bindings { - -class JavaClass : public Class { -public: - JavaClass (jobject anInstance); - ~JavaClass (); - - virtual MethodList methodsNamed(const Identifier&, Instance* instance) const; - virtual Field *fieldNamed(const Identifier&, Instance* instance) const; - - bool isNumberClass() const; - bool isBooleanClass() const; - bool isStringClass() const; - -private: - const char *_name; - FieldMap _fields; - MethodListMap _methods; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(MAC_JAVA_BRIDGE) - -#endif // JNI_CLASS_H_ diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp deleted file mode 100644 index 2ef0c1d..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "jni_instance.h" - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include "jni_class.h" -#include "jni_runtime.h" -#include "jni_utility.h" -#include "runtime_object.h" -#include "runtime_root.h" -#include -#include -#include - -#ifdef NDEBUG -#define JS_LOG(formatAndArgs...) ((void)0) -#else -#define JS_LOG(formatAndArgs...) { \ - fprintf (stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \ - fprintf(stderr, formatAndArgs); \ -} -#endif - -using namespace JSC::Bindings; -using namespace JSC; - -JavaInstance::JavaInstance (jobject instance, PassRefPtr rootObject) - : Instance(rootObject) -{ - _instance = new JObjectWrapper (instance); - _class = 0; -} - -JavaInstance::~JavaInstance () -{ - delete _class; -} - -#define NUM_LOCAL_REFS 64 - -void JavaInstance::virtualBegin() -{ - getJNIEnv()->PushLocalFrame (NUM_LOCAL_REFS); -} - -void JavaInstance::virtualEnd() -{ - getJNIEnv()->PopLocalFrame (NULL); -} - -Class *JavaInstance::getClass() const -{ - if (_class == 0) - _class = new JavaClass (_instance->_instance); - return _class; -} - -JSValue JavaInstance::stringValue(ExecState* exec) const -{ - JSLock lock(SilenceAssertionsOnly); - - jstring stringValue = (jstring)callJNIMethod(_instance->_instance, "toString", "()Ljava/lang/String;"); - JNIEnv *env = getJNIEnv(); - const jchar *c = getUCharactersFromJStringInEnv(env, stringValue); - UString u((const UChar *)c, (int)env->GetStringLength(stringValue)); - releaseUCharactersForJStringInEnv(env, stringValue, c); - return jsString(exec, u); -} - -JSValue JavaInstance::numberValue(ExecState* exec) const -{ - jdouble doubleValue = callJNIMethod(_instance->_instance, "doubleValue", "()D"); - return jsNumber(exec, doubleValue); -} - -JSValue JavaInstance::booleanValue() const -{ - jboolean booleanValue = callJNIMethod(_instance->_instance, "booleanValue", "()Z"); - return jsBoolean(booleanValue); -} - -JSValue JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args) -{ - int i, count = args.size(); - jvalue *jArgs; - JSValue resultValue; - Method *method = 0; - size_t numMethods = methodList.size(); - - // Try to find a good match for the overloaded method. The - // fundamental problem is that JavaScript doesn have the - // notion of method overloading and Java does. We could - // get a bit more sophisticated and attempt to does some - // type checking as we as checking the number of parameters. - Method *aMethod; - for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) { - aMethod = methodList[methodIndex]; - if (aMethod->numParameters() == count) { - method = aMethod; - break; - } - } - if (method == 0) { - JS_LOG ("unable to find an appropiate method\n"); - return jsUndefined(); - } - - const JavaMethod *jMethod = static_cast(method); - JS_LOG ("call %s %s on %p\n", UString(jMethod->name()).UTF8String().c_str(), jMethod->signature(), _instance->_instance); - - if (count > 0) { - jArgs = (jvalue *)malloc (count * sizeof(jvalue)); - } - else - jArgs = 0; - - for (i = 0; i < count; i++) { - JavaParameter* aParameter = jMethod->parameterAt(i); - jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type()); - JS_LOG("arg[%d] = %s\n", i, args.at(i).toString(exec).ascii()); - } - - jvalue result; - - // Try to use the JNI abstraction first, otherwise fall back to - // nornmal JNI. The JNI dispatch abstraction allows the Java plugin - // to dispatch the call on the appropriate internal VM thread. - RootObject* rootObject = this->rootObject(); - if (!rootObject) - return jsUndefined(); - - bool handled = false; - if (rootObject->nativeHandle()) { - jobject obj = _instance->_instance; - JSValue exceptionDescription; - const char *callingURL = 0; // FIXME, need to propagate calling URL to Java - handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription); - if (exceptionDescription) { - throwError(exec, GeneralError, exceptionDescription.toString(exec)); - free (jArgs); - return jsUndefined(); - } - } - - // The following code can be conditionally removed once we have a Tiger update that - // contains the new Java plugin. It is needed for builds prior to Tiger. - if (!handled) { - jobject obj = _instance->_instance; - switch (jMethod->JNIReturnType()){ - case void_type: - callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case object_type: - result.l = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case boolean_type: - result.z = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case byte_type: - result.b = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case char_type: - result.c = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case short_type: - result.s = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case int_type: - result.i = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - - case long_type: - result.j = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case float_type: - result.f = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case double_type: - result.d = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); - break; - case invalid_type: - default: - break; - } - } - - switch (jMethod->JNIReturnType()){ - case void_type: { - resultValue = jsUndefined(); - } - break; - - case object_type: { - if (result.l != 0) { - const char *arrayType = jMethod->returnType(); - if (arrayType[0] == '[') { - resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject); - } - else { - resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec); - } - } - else { - resultValue = jsUndefined(); - } - } - break; - - case boolean_type: { - resultValue = jsBoolean(result.z); - } - break; - - case byte_type: { - resultValue = jsNumber(exec, result.b); - } - break; - - case char_type: { - resultValue = jsNumber(exec, result.c); - } - break; - - case short_type: { - resultValue = jsNumber(exec, result.s); - } - break; - - case int_type: { - resultValue = jsNumber(exec, result.i); - } - break; - - case long_type: { - resultValue = jsNumber(exec, result.j); - } - break; - - case float_type: { - resultValue = jsNumber(exec, result.f); - } - break; - - case double_type: { - resultValue = jsNumber(exec, result.d); - } - break; - - case invalid_type: - default: { - resultValue = jsUndefined(); - } - break; - } - - free (jArgs); - - return resultValue; -} - -JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const -{ - if (hint == PreferString) - return stringValue(exec); - if (hint == PreferNumber) - return numberValue(exec); - JavaClass *aClass = static_cast(getClass()); - if (aClass->isStringClass()) - return stringValue(exec); - if (aClass->isNumberClass()) - return numberValue(exec); - if (aClass->isBooleanClass()) - return booleanValue(); - return valueOf(exec); -} - -JSValue JavaInstance::valueOf(ExecState* exec) const -{ - return stringValue(exec); -} - -JObjectWrapper::JObjectWrapper(jobject instance) -: _refCount(0) -{ - assert (instance != 0); - - // Cache the JNIEnv used to get the global ref for this java instanace. - // It'll be used to delete the reference. - _env = getJNIEnv(); - - _instance = _env->NewGlobalRef (instance); - - JS_LOG ("new global ref %p for %p\n", _instance, instance); - - if (_instance == NULL) { - fprintf (stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance); - } -} - -JObjectWrapper::~JObjectWrapper() { - JS_LOG ("deleting global ref %p\n", _instance); - _env->DeleteGlobalRef (_instance); -} - -#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h deleted file mode 100644 index 0dcab3e..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_instance.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _JNI_INSTANCE_H_ -#define _JNI_INSTANCE_H_ - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include "runtime.h" -#include "runtime_root.h" - -#include - -namespace JSC { - -namespace Bindings { - -class JavaClass; - -class JObjectWrapper -{ -friend class RefPtr; -friend class JavaArray; -friend class JavaField; -friend class JavaInstance; -friend class JavaMethod; - -protected: - JObjectWrapper(jobject instance); - ~JObjectWrapper(); - - void ref() { _refCount++; } - void deref() - { - if (--_refCount == 0) - delete this; - } - - jobject _instance; - -private: - JNIEnv *_env; - unsigned int _refCount; -}; - -class JavaInstance : public Instance -{ -public: - static PassRefPtr create(jobject instance, PassRefPtr rootObject) - { - return adoptRef(new JavaInstance(instance, rootObject)); - } - - ~JavaInstance(); - - virtual Class *getClass() const; - - virtual JSValue valueOf(ExecState*) const; - virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; - - virtual JSValue invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args); - - jobject javaInstance() const { return _instance->_instance; } - - JSValue stringValue(ExecState*) const; - JSValue numberValue(ExecState*) const; - JSValue booleanValue() const; - -protected: - virtual void virtualBegin(); - virtual void virtualEnd(); - -private: - JavaInstance(jobject instance, PassRefPtr); - - RefPtr _instance; - mutable JavaClass *_class; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(MAC_JAVA_BRIDGE) - -#endif // _JNI_INSTANCE_H_ diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm index cc28a75..68682bb 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_jsobject.mm @@ -29,33 +29,26 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "Frame.h" +#include "JNIBridge.h" +#include "JNIUtility.h" +#include "JNIUtilityPrivate.h" #include "JSDOMBinding.h" +#include "Logging.h" #include "ScriptController.h" #include "StringSourceProvider.h" #include "WebCoreFrameView.h" -#include "jni_runtime.h" -#include "jni_utility.h" #include "runtime_object.h" #include "runtime_root.h" #include #include #include #include -#include using WebCore::Frame; using namespace JSC::Bindings; using namespace JSC; - -#ifdef NDEBUG -#define JS_LOG(formatAndArgs...) ((void)0) -#else -#define JS_LOG(formatAndArgs...) { \ - fprintf (stderr, "%s(%p,%p): ", __PRETTY_FUNCTION__, _performJavaScriptRunLoop, CFRunLoopGetCurrent()); \ - fprintf(stderr, formatAndArgs); \ -} -#endif +using namespace WebCore; #define UndefinedHandle 1 @@ -67,12 +60,12 @@ static CFRunLoopSourceRef completionSource; static void completedJavaScriptAccess (void *i) { - assert (CFRunLoopGetCurrent() != _performJavaScriptRunLoop); + ASSERT(CFRunLoopGetCurrent() != _performJavaScriptRunLoop); JSObjectCallContext *callContext = (JSObjectCallContext *)i; CFRunLoopRef runLoop = (CFRunLoopRef)callContext->originatingLoop; - assert (CFRunLoopGetCurrent() == runLoop); + ASSERT(CFRunLoopGetCurrent() == runLoop); CFRunLoopStop(runLoop); } @@ -114,7 +107,7 @@ static void dispatchToJavaScriptThread(JSObjectCallContext *context) CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent(); - assert (currentRunLoop != _performJavaScriptRunLoop); + ASSERT(currentRunLoop != _performJavaScriptRunLoop); // Setup a source to signal once the invocation of the JavaScript // call completes. @@ -127,7 +120,7 @@ static void dispatchToJavaScriptThread(JSObjectCallContext *context) completionSource = CFRunLoopSourceCreate(NULL, 0, &sourceContext); CFRunLoopAddSource(currentRunLoop, completionSource, kCFRunLoopDefaultMode); - // Wakeup JavaScript access thread and make it do it's work. + // Wakeup JavaScript access thread and make it do its work. CFRunLoopSourceSignal(_performJavaScriptSource); if (CFRunLoopIsWaiting(_performJavaScriptRunLoop)) CFRunLoopWakeUp(_performJavaScriptRunLoop); @@ -143,7 +136,7 @@ static void dispatchToJavaScriptThread(JSObjectCallContext *context) static void performJavaScriptAccess(void*) { - assert (CFRunLoopGetCurrent() == _performJavaScriptRunLoop); + ASSERT(CFRunLoopGetCurrent() == _performJavaScriptRunLoop); // Dispatch JavaScript calls here. CFRunLoopSourceContext sourceContext; @@ -204,7 +197,7 @@ jvalue JavaJSObject::invoke(JSObjectCallContext *context) else { JSObject *imp = jlong_to_impptr(nativeHandle); if (!findProtectingRootObject(imp)) { - fprintf (stderr, "%s:%d: Attempt to access JavaScript from destroyed applet, type %d.\n", __FILE__, __LINE__, context->type); + LOG_ERROR("Attempt to access JavaScript from destroyed applet, type %d.", context->type); return result; } @@ -255,7 +248,7 @@ jvalue JavaJSObject::invoke(JSObjectCallContext *context) } default: { - fprintf (stderr, "%s: invalid JavaScript call\n", __PRETTY_FUNCTION__); + LOG_ERROR("invalid JavaScript call"); } } } @@ -282,7 +275,7 @@ RootObject* JavaJSObject::rootObject() const jobject JavaJSObject::call(jstring methodName, jobjectArray args) const { - JS_LOG ("methodName = %s\n", JavaString(methodName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).UTF8String()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -303,7 +296,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const MarkedArgumentBuffer argList; getListFromJArray(exec, args, argList); rootObject->globalObject()->globalData()->timeoutChecker.start(); - JSValue result = WebCore::callInWorld(exec, function, callType, callData, _imp, argList, WebCore::pluginWorld()); + JSValue result = JSC::call(exec, function, callType, callData, _imp, argList); rootObject->globalObject()->globalData()->timeoutChecker.stop(); return convertValueToJObject(result); @@ -311,7 +304,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const jobject JavaJSObject::eval(jstring script) const { - JS_LOG ("script = %s\n", JavaString(script).UTF8String()); + LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).UTF8String()); JSValue result; @@ -322,7 +315,7 @@ jobject JavaJSObject::eval(jstring script) const return 0; rootObject->globalObject()->globalData()->timeoutChecker.start(); - Completion completion = WebCore::evaluateInWorld(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script)), JSC::JSValue(), WebCore::pluginWorld()); + Completion completion = JSC::evaluate(rootObject->globalObject()->globalExec(), rootObject->globalObject()->globalScopeChain(), makeSource(JavaString(script)), JSC::JSValue()); rootObject->globalObject()->globalData()->timeoutChecker.stop(); ComplType type = completion.complType(); @@ -338,7 +331,7 @@ jobject JavaJSObject::eval(jstring script) const jobject JavaJSObject::getMember(jstring memberName) const { - JS_LOG ("(%p) memberName = %s\n", _imp, JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).UTF8String()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -354,7 +347,7 @@ jobject JavaJSObject::getMember(jstring memberName) const void JavaJSObject::setMember(jstring memberName, jobject value) const { - JS_LOG ("memberName = %s, value = %p\n", JavaString(memberName).UTF8String(), value); + LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).UTF8String(), value); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -370,7 +363,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const void JavaJSObject::removeMember(jstring memberName) const { - JS_LOG ("memberName = %s\n", JavaString(memberName).UTF8String()); + LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).UTF8String()); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -384,11 +377,7 @@ void JavaJSObject::removeMember(jstring memberName) const jobject JavaJSObject::getSlot(jint index) const { -#ifdef __LP64__ - JS_LOG ("index = %d\n", index); -#else - JS_LOG ("index = %ld\n", index); -#endif + LOG(LiveConnect, "JavaJSObject::getSlot index = %ld", static_cast(index)); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -405,11 +394,7 @@ jobject JavaJSObject::getSlot(jint index) const void JavaJSObject::setSlot(jint index, jobject value) const { -#ifdef __LP64__ - JS_LOG ("index = %d, value = %p\n", index, value); -#else - JS_LOG ("index = %ld, value = %p\n", index, value); -#endif + LOG(LiveConnect, "JavaJSObject::setSlot index = %ld, value = %p", static_cast(index), value); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -423,7 +408,7 @@ void JavaJSObject::setSlot(jint index, jobject value) const jstring JavaJSObject::toString() const { - JS_LOG ("\n"); + LOG(LiveConnect, "JavaJSObject::toString"); RootObject* rootObject = this->rootObject(); if (!rootObject) @@ -461,7 +446,7 @@ static PassRefPtr createRootObject(void* nativeHandle) // another JavaJSObject. jlong JavaJSObject::createNative(jlong nativeHandle) { - JS_LOG ("nativeHandle = %d\n", (int)nativeHandle); + LOG(LiveConnect, "JavaJSObject::createNative nativeHandle = %d", static_cast(nativeHandle)); if (nativeHandle == UndefinedHandle) return nativeHandle; @@ -532,7 +517,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const // We either have a wrapper around a Java instance or a JavaScript // object. If we have a wrapper around a Java instance, return that // instance, otherwise create a new Java JavaJSObject with the JSObject* - // as it's nativeHandle. + // as its nativeHandle. if (imp->classInfo() && strcmp(imp->classInfo()->className, "RuntimeObject") == 0) { RuntimeObjectImp* runtimeImp = static_cast(imp); JavaInstance *runtimeInstance = static_cast(runtimeImp->getInternalInstance()); @@ -551,7 +536,7 @@ jobject JavaJSObject::convertValueToJObject(JSValue value) const nativeHandle = UndefinedHandle; } - // Now create the Java JavaJSObject. Look for the JavaJSObject in it's new (Tiger) + // Now create the Java JavaJSObject. Look for the JavaJSObject in its new (Tiger) // location and in the original Java 1.4.2 location. jclass JSObjectClass; @@ -579,30 +564,31 @@ JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject) // See section 22.7 of 'JavaScript: The Definitive Guide, 4th Edition', // figure 22-4. jobject classOfInstance = callJNIMethod(theObject, "getClass", "()Ljava/lang/Class;"); - jstring className = (jstring)callJNIMethod(classOfInstance, "getName", "()Ljava/lang/String;"); - + if (!classOfInstance) { + JSLock lock(SilenceAssertionsOnly); + return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); + } + // Only the sun.plugin.javascript.webkit.JSObject has a member called nativeJSObject. This class is // created above to wrap internal browser objects. The constructor of this class takes the native // pointer and stores it in this object, so that it can be retrieved below. - if (strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject") == 0) { - // Pull the nativeJSObject value from the Java instance. This is a - // pointer to the JSObject. - JNIEnv *env = getJNIEnv(); - jfieldID fieldID = env->GetFieldID((jclass)classOfInstance, "nativeJSObject", "J"); - if (fieldID == NULL) { - return jsUndefined(); - } - jlong nativeHandle = env->GetLongField(theObject, fieldID); - if (nativeHandle == UndefinedHandle) { - return jsUndefined(); - } - JSObject *imp = static_cast(jlong_to_impptr(nativeHandle)); - return imp; + jstring className = (jstring)callJNIMethod(classOfInstance, "getName", "()Ljava/lang/String;"); + if (!className || (strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject") != 0)) { + JSLock lock(SilenceAssertionsOnly); + return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); } - JSLock lock(SilenceAssertionsOnly); - - return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec); + // Pull the nativeJSObject value from the Java instance. This is a + // pointer to the JSObject. + JNIEnv *env = getJNIEnv(); + jfieldID fieldID = env->GetFieldID((jclass)classOfInstance, "nativeJSObject", "J"); + if (fieldID == NULL) + return jsUndefined(); + jlong nativeHandle = env->GetLongField(theObject, fieldID); + if (nativeHandle == UndefinedHandle) + return jsUndefined(); + JSObject *imp = static_cast(jlong_to_impptr(nativeHandle)); + return imp; } void JavaJSObject::getListFromJArray(ExecState* exec, jobjectArray jArray, MarkedArgumentBuffer& list) const diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm b/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm index 0306bfd..e2e71c5 100644 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jni_objc.mm @@ -28,7 +28,8 @@ #if ENABLE(MAC_JAVA_BRIDGE) #import -#import "jni_utility.h" +#import "JNIUtility.h" +#import "JNIUtilityPrivate.h" #import "objc_utility.h" #include diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp deleted file mode 100644 index cc48037..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.cpp +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include - -#include "runtime_array.h" -#include "runtime_object.h" -#include "runtime_root.h" -#include -#include - -#ifdef NDEBUG -#define JS_LOG(formatAndArgs...) ((void)0) -#else -#define JS_LOG(formatAndArgs...) { \ - fprintf (stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \ - fprintf(stderr, formatAndArgs); \ -} -#endif - -using namespace JSC; -using namespace JSC::Bindings; - - -JavaParameter::JavaParameter (JNIEnv *env, jstring type) -{ - _type = JavaString (env, type); - _JNIType = JNITypeFromClassName (_type.UTF8String()); -} - -JavaField::JavaField (JNIEnv *env, jobject aField) -{ - // Get field type - jobject fieldType = callJNIMethod(aField, "getType", "()Ljava/lang/Class;"); - jstring fieldTypeName = (jstring)callJNIMethod(fieldType, "getName", "()Ljava/lang/String;"); - _type = JavaString(env, fieldTypeName); - _JNIType = JNITypeFromClassName (_type.UTF8String()); - - // Get field name - jstring fieldName = (jstring)callJNIMethod(aField, "getName", "()Ljava/lang/String;"); - _name = JavaString(env, fieldName); - - _field = new JObjectWrapper(aField); -} - -JSValue JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr rootObject) -{ - if (type[0] != '[') - return jsUndefined(); - - return new (exec) RuntimeArray(exec, new JavaArray((jobject)anObject, type, rootObject)); -} - -jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const -{ - jobject jinstance = instance->javaInstance(); - jobject fieldJInstance = _field->_instance; - JNIEnv *env = getJNIEnv(); - jvalue result; - - bzero (&result, sizeof(jvalue)); - jclass cls = env->GetObjectClass(fieldJInstance); - if ( cls != NULL ) { - jmethodID mid = env->GetMethodID(cls, name, sig); - if ( mid != NULL ) - { - RootObject* rootObject = instance->rootObject(); - if (rootObject && rootObject->nativeHandle()) { - JSValue exceptionDescription; - jvalue args[1]; - - args[0].l = jinstance; - dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription); - if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); - } - } - } - return result; -} - -JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const -{ - const JavaInstance *instance = static_cast(i); - - JSValue jsresult = jsUndefined(); - - switch (_JNIType) { - case array_type: - case object_type: { - jvalue result = dispatchValueFromInstance (exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type); - jobject anObject = result.l; - - const char *arrayType = type(); - if (arrayType[0] == '[') { - jsresult = JavaArray::convertJObjectToArray(exec, anObject, arrayType, instance->rootObject()); - } - else if (anObject != 0){ - jsresult = JavaInstance::create(anObject, instance->rootObject())->createRuntimeObject(exec); - } - } - break; - - case boolean_type: - jsresult = jsBoolean(dispatchValueFromInstance(exec, instance, "getBoolean", "(Ljava/lang/Object;)Z", boolean_type).z); - break; - - case byte_type: - case char_type: - case short_type: - - case int_type: { - jint value; - jvalue result = dispatchValueFromInstance (exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type); - value = result.i; - jsresult = jsNumber(exec, (int)value); - } - break; - - case long_type: - case float_type: - case double_type: { - jdouble value; - jvalue result = dispatchValueFromInstance (exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type); - value = result.i; - jsresult = jsNumber(exec, (double)value); - } - break; - default: - break; - } - - JS_LOG ("getting %s = %s\n", UString(name()).UTF8String().c_str(), jsresult.toString(exec).ascii()); - - return jsresult; -} - -void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const -{ - jobject jinstance = instance->javaInstance(); - jobject fieldJInstance = _field->_instance; - JNIEnv *env = getJNIEnv(); - - jclass cls = env->GetObjectClass(fieldJInstance); - if ( cls != NULL ) { - jmethodID mid = env->GetMethodID(cls, name, sig); - if ( mid != NULL ) - { - RootObject* rootObject = instance->rootObject(); - if (rootObject && rootObject->nativeHandle()) { - JSValue exceptionDescription; - jvalue args[2]; - jvalue result; - - args[0].l = jinstance; - args[1] = javaValue; - dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription); - if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); - } - } - } -} - -void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const -{ - const JavaInstance *instance = static_cast(i); - jvalue javaValue = convertValueToJValue (exec, aValue, _JNIType, type()); - - JS_LOG ("setting value %s to %s\n", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii()); - - switch (_JNIType) { - case array_type: - case object_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V"); - } - break; - - case boolean_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V"); - } - break; - - case byte_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V"); - } - break; - - case char_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V"); - } - break; - - case short_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V"); - } - break; - - case int_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V"); - } - break; - - case long_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V"); - } - break; - - case float_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V"); - } - break; - - case double_type: { - dispatchSetValueToInstance (exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V"); - } - break; - default: - break; - } -} - -JavaMethod::JavaMethod (JNIEnv *env, jobject aMethod) -{ - // Get return type - jobject returnType = callJNIMethod(aMethod, "getReturnType", "()Ljava/lang/Class;"); - jstring returnTypeName = (jstring)callJNIMethod(returnType, "getName", "()Ljava/lang/String;"); - _returnType =JavaString (env, returnTypeName); - _JNIReturnType = JNITypeFromClassName (_returnType.UTF8String()); - env->DeleteLocalRef (returnType); - env->DeleteLocalRef (returnTypeName); - - // Get method name - jstring methodName = (jstring)callJNIMethod(aMethod, "getName", "()Ljava/lang/String;"); - _name = JavaString (env, methodName); - env->DeleteLocalRef (methodName); - - // Get parameters - jarray jparameters = (jarray)callJNIMethod(aMethod, "getParameterTypes", "()[Ljava/lang/Class;"); - _numParameters = env->GetArrayLength (jparameters); - _parameters = new JavaParameter[_numParameters]; - - int i; - for (i = 0; i < _numParameters; i++) { - jobject aParameter = env->GetObjectArrayElement ((jobjectArray)jparameters, i); - jstring parameterName = (jstring)callJNIMethod(aParameter, "getName", "()Ljava/lang/String;"); - _parameters[i] = JavaParameter(env, parameterName); - env->DeleteLocalRef (aParameter); - env->DeleteLocalRef (parameterName); - } - env->DeleteLocalRef (jparameters); - - // Created lazily. - _signature = 0; - _methodID = 0; - - jclass modifierClass = env->FindClass("java/lang/reflect/Modifier"); - int modifiers = callJNIMethod(aMethod, "getModifiers", "()I"); - _isStatic = (bool)callJNIStaticMethod(modifierClass, "isStatic", "(I)Z", modifiers); -} - -JavaMethod::~JavaMethod() -{ - if (_signature) - free(_signature); - delete [] _parameters; -}; - -// JNI method signatures use '/' between components of a class name, but -// we get '.' between components from the reflection API. -static void appendClassName(UString& aString, const char* className) -{ - ASSERT(JSLock::lockCount() > 0); - - char *result, *cp = strdup(className); - - result = cp; - while (*cp) { - if (*cp == '.') - *cp = '/'; - cp++; - } - - aString.append(result); - - free (result); -} - -const char *JavaMethod::signature() const -{ - if (!_signature) { - JSLock lock(SilenceAssertionsOnly); - - UString signatureBuilder("("); - for (int i = 0; i < _numParameters; i++) { - JavaParameter* aParameter = parameterAt(i); - JNIType _JNIType = aParameter->getJNIType(); - if (_JNIType == array_type) - appendClassName(signatureBuilder, aParameter->type()); - else { - signatureBuilder.append(signatureFromPrimitiveType(_JNIType)); - if (_JNIType == object_type) { - appendClassName(signatureBuilder, aParameter->type()); - signatureBuilder.append(";"); - } - } - } - signatureBuilder.append(")"); - - const char *returnType = _returnType.UTF8String(); - if (_JNIReturnType == array_type) { - appendClassName(signatureBuilder, returnType); - } else { - signatureBuilder.append(signatureFromPrimitiveType(_JNIReturnType)); - if (_JNIReturnType == object_type) { - appendClassName(signatureBuilder, returnType); - signatureBuilder.append(";"); - } - } - - _signature = strdup(signatureBuilder.ascii()); - } - - return _signature; -} - -JNIType JavaMethod::JNIReturnType() const -{ - return _JNIReturnType; -} - -jmethodID JavaMethod::methodID (jobject obj) const -{ - if (_methodID == 0) { - _methodID = getMethodID (obj, _name.UTF8String(), signature()); - } - return _methodID; -} - - -JavaArray::JavaArray(jobject array, const char* type, PassRefPtr rootObject) - : Array(rootObject) -{ - _array = new JObjectWrapper(array); - // Java array are fixed length, so we can cache length. - JNIEnv *env = getJNIEnv(); - _length = env->GetArrayLength((jarray)_array->_instance); - _type = strdup(type); - _rootObject = rootObject; -} - -JavaArray::~JavaArray () -{ - free ((void *)_type); -} - -RootObject* JavaArray::rootObject() const -{ - return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; -} - -void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const -{ - JNIEnv *env = getJNIEnv(); - char *javaClassName = 0; - - JNIType arrayType = JNITypeFromPrimitiveType(_type[1]); - if (_type[1] == 'L'){ - // The type of the array will be something like: - // "[Ljava.lang.string;". This is guaranteed, so no need - // for extra sanity checks. - javaClassName = strdup(&_type[2]); - javaClassName[strchr(javaClassName, ';')-javaClassName] = 0; - } - jvalue aJValue = convertValueToJValue (exec, aValue, arrayType, javaClassName); - - switch (arrayType) { - case object_type: { - env->SetObjectArrayElement((jobjectArray)javaArray(), index, aJValue.l); - break; - } - - case boolean_type: { - env->SetBooleanArrayRegion((jbooleanArray)javaArray(), index, 1, &aJValue.z); - break; - } - - case byte_type: { - env->SetByteArrayRegion((jbyteArray)javaArray(), index, 1, &aJValue.b); - break; - } - - case char_type: { - env->SetCharArrayRegion((jcharArray)javaArray(), index, 1, &aJValue.c); - break; - } - - case short_type: { - env->SetShortArrayRegion((jshortArray)javaArray(), index, 1, &aJValue.s); - break; - } - - case int_type: { - env->SetIntArrayRegion((jintArray)javaArray(), index, 1, &aJValue.i); - break; - } - - case long_type: { - env->SetLongArrayRegion((jlongArray)javaArray(), index, 1, &aJValue.j); - } - - case float_type: { - env->SetFloatArrayRegion((jfloatArray)javaArray(), index, 1, &aJValue.f); - break; - } - - case double_type: { - env->SetDoubleArrayRegion((jdoubleArray)javaArray(), index, 1, &aJValue.d); - break; - } - default: - break; - } - - if (javaClassName) - free ((void *)javaClassName); -} - - -JSValue JavaArray::valueAt(ExecState* exec, unsigned index) const -{ - JNIEnv *env = getJNIEnv(); - JNIType arrayType = JNITypeFromPrimitiveType(_type[1]); - switch (arrayType) { - case object_type: { - jobjectArray objectArray = (jobjectArray)javaArray(); - jobject anObject; - anObject = env->GetObjectArrayElement(objectArray, index); - - // No object? - if (!anObject) { - return jsNull(); - } - - // Nested array? - if (_type[1] == '[') { - return JavaArray::convertJObjectToArray(exec, anObject, _type+1, rootObject()); - } - // or array of other object type? - return JavaInstance::create(anObject, rootObject())->createRuntimeObject(exec); - } - - case boolean_type: { - jbooleanArray booleanArray = (jbooleanArray)javaArray(); - jboolean aBoolean; - env->GetBooleanArrayRegion(booleanArray, index, 1, &aBoolean); - return jsBoolean(aBoolean); - } - - case byte_type: { - jbyteArray byteArray = (jbyteArray)javaArray(); - jbyte aByte; - env->GetByteArrayRegion(byteArray, index, 1, &aByte); - return jsNumber(exec, aByte); - } - - case char_type: { - jcharArray charArray = (jcharArray)javaArray(); - jchar aChar; - env->GetCharArrayRegion(charArray, index, 1, &aChar); - return jsNumber(exec, aChar); - break; - } - - case short_type: { - jshortArray shortArray = (jshortArray)javaArray(); - jshort aShort; - env->GetShortArrayRegion(shortArray, index, 1, &aShort); - return jsNumber(exec, aShort); - } - - case int_type: { - jintArray intArray = (jintArray)javaArray(); - jint anInt; - env->GetIntArrayRegion(intArray, index, 1, &anInt); - return jsNumber(exec, anInt); - } - - case long_type: { - jlongArray longArray = (jlongArray)javaArray(); - jlong aLong; - env->GetLongArrayRegion(longArray, index, 1, &aLong); - return jsNumber(exec, aLong); - } - - case float_type: { - jfloatArray floatArray = (jfloatArray)javaArray(); - jfloat aFloat; - env->GetFloatArrayRegion(floatArray, index, 1, &aFloat); - return jsNumber(exec, aFloat); - } - - case double_type: { - jdoubleArray doubleArray = (jdoubleArray)javaArray(); - jdouble aDouble; - env->GetDoubleArrayRegion(doubleArray, index, 1, &aDouble); - return jsNumber(exec, aDouble); - } - default: - break; - } - return jsUndefined(); -} - -unsigned int JavaArray::getLength() const -{ - return _length; -} - -#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h deleted file mode 100644 index 81484ff..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_runtime.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _JNI_RUNTIME_H_ -#define _JNI_RUNTIME_H_ - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include -#include -#include - - -namespace JSC -{ - -namespace Bindings -{ - -typedef const char* RuntimeType; - -class JavaString -{ -public: - JavaString() - { - JSLock lock(SilenceAssertionsOnly); - _rep = UString().rep(); - } - - void _commonInit (JNIEnv *e, jstring s) - { - int _size = e->GetStringLength (s); - const jchar *uc = getUCharactersFromJStringInEnv (e, s); - { - JSLock lock(SilenceAssertionsOnly); - _rep = UString(reinterpret_cast(uc), _size).rep(); - } - releaseUCharactersForJStringInEnv (e, s, uc); - } - - JavaString (JNIEnv *e, jstring s) { - _commonInit (e, s); - } - - JavaString (jstring s) { - _commonInit (getJNIEnv(), s); - } - - ~JavaString() - { - JSLock lock(SilenceAssertionsOnly); - _rep = 0; - } - - const char *UTF8String() const { - if (_utf8String.c_str() == 0) { - JSLock lock(SilenceAssertionsOnly); - _utf8String = UString(_rep).UTF8String(); - } - return _utf8String.c_str(); - } - const jchar *uchars() const { return (const jchar *)_rep->data(); } - int length() const { return _rep->size(); } - operator UString() const { return UString(_rep); } - -private: - RefPtr _rep; - mutable CString _utf8String; -}; - -class JavaParameter -{ -public: - JavaParameter () : _JNIType(invalid_type) {}; - JavaParameter (JNIEnv *env, jstring type); - virtual ~JavaParameter() { } - - RuntimeType type() const { return _type.UTF8String(); } - JNIType getJNIType() const { return _JNIType; } - -private: - JavaString _type; - JNIType _JNIType; -}; - - -class JavaField : public Field -{ -public: - JavaField (JNIEnv *env, jobject aField); - - virtual JSValue valueFromInstance(ExecState *exec, const Instance *instance) const; - virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValue aValue) const; - - UString::Rep* name() const { return ((UString)_name).rep(); } - virtual RuntimeType type() const { return _type.UTF8String(); } - - JNIType getJNIType() const { return _JNIType; } - -private: - void dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const; - jvalue dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const; - - JavaString _name; - JavaString _type; - JNIType _JNIType; - RefPtr _field; -}; - - -class JavaMethod : public Method -{ -public: - JavaMethod(JNIEnv* env, jobject aMethod); - ~JavaMethod(); - - UString::Rep* name() const { return ((UString)_name).rep(); } - RuntimeType returnType() const { return _returnType.UTF8String(); }; - JavaParameter* parameterAt(int i) const { return &_parameters[i]; }; - int numParameters() const { return _numParameters; }; - - const char *signature() const; - JNIType JNIReturnType() const; - - jmethodID methodID (jobject obj) const; - - bool isStatic() const { return _isStatic; } - -private: - JavaParameter* _parameters; - int _numParameters; - JavaString _name; - mutable char* _signature; - JavaString _returnType; - JNIType _JNIReturnType; - mutable jmethodID _methodID; - bool _isStatic; -}; - -class JavaArray : public Array -{ -public: - JavaArray(jobject array, const char* type, PassRefPtr); - virtual ~JavaArray(); - - RootObject* rootObject() const; - - virtual void setValueAt(ExecState *exec, unsigned int index, JSValue aValue) const; - virtual JSValue valueAt(ExecState *exec, unsigned int index) const; - virtual unsigned int getLength() const; - - jobject javaArray() const { return _array->_instance; } - - static JSValue convertJObjectToArray (ExecState* exec, jobject anObject, const char* type, PassRefPtr); - -private: - RefPtr _array; - unsigned int _length; - const char *_type; -}; - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(MAC_JAVA_BRIDGE) - -#endif // _JNI_RUNTIME_H_ diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp deleted file mode 100644 index 86075c9..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.cpp +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "jni_utility.h" - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include "jni_runtime.h" -#include "runtime_array.h" -#include "runtime_object.h" -#include -#include -#include - -namespace JSC { - -namespace Bindings { - -static jint KJS_GetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs) -{ - static void* javaVMFramework = 0; - if (!javaVMFramework) - javaVMFramework = dlopen("/System/Library/Frameworks/JavaVM.framework/JavaVM", RTLD_LAZY); - if (!javaVMFramework) - return JNI_ERR; - - static jint(*functionPointer)(JavaVM**, jsize, jsize *) = 0; - if (!functionPointer) - functionPointer = (jint(*)(JavaVM**, jsize, jsize *))dlsym(javaVMFramework, "JNI_GetCreatedJavaVMs"); - if (!functionPointer) - return JNI_ERR; - return functionPointer(vmBuf, bufLen, nVMs); -} - -static JavaVM *jvm = 0; - -// Provide the ability for an outside component to specify the JavaVM to use -// If the jvm value is set, the getJavaVM function below will just return. -// In getJNIEnv(), if AttachCurrentThread is called to a VM that is already -// attached, the result is a no-op. -void setJavaVM(JavaVM *javaVM) -{ - jvm = javaVM; -} - -JavaVM *getJavaVM() -{ - if (jvm) - return jvm; - - JavaVM *jvmArray[1]; - jsize bufLen = 1; - jsize nJVMs = 0; - jint jniError = 0; - - // Assumes JVM is already running ..., one per process - jniError = KJS_GetCreatedJavaVMs(jvmArray, bufLen, &nJVMs); - if ( jniError == JNI_OK && nJVMs > 0 ) { - jvm = jvmArray[0]; - } - else - fprintf(stderr, "%s: JNI_GetCreatedJavaVMs failed, returned %ld\n", __PRETTY_FUNCTION__, (long)jniError); - - return jvm; -} - -JNIEnv* getJNIEnv() -{ - union { - JNIEnv* env; - void* dummy; - } u; - jint jniError = 0; - - jniError = (getJavaVM())->AttachCurrentThread(&u.dummy, NULL); - if (jniError == JNI_OK) - return u.env; - else - fprintf(stderr, "%s: AttachCurrentThread failed, returned %ld\n", __PRETTY_FUNCTION__, (long)jniError); - return NULL; -} - -jmethodID getMethodID (jobject obj, const char *name, const char *sig) -{ - JNIEnv *env = getJNIEnv(); - jmethodID mid = 0; - - if ( env != NULL) { - jclass cls = env->GetObjectClass(obj); - if ( cls != NULL ) { - mid = env->GetMethodID(cls, name, sig); - if (!mid) { - env->ExceptionClear(); - mid = env->GetStaticMethodID(cls, name, sig); - if (!mid) { - env->ExceptionClear(); - } - } - } - env->DeleteLocalRef(cls); - } - return mid; -} - -const char *getCharactersFromJString (jstring aJString) -{ - return getCharactersFromJStringInEnv (getJNIEnv(), aJString); -} - -void releaseCharactersForJString (jstring aJString, const char *s) -{ - releaseCharactersForJStringInEnv (getJNIEnv(), aJString, s); -} - -const char *getCharactersFromJStringInEnv (JNIEnv *env, jstring aJString) -{ - jboolean isCopy; - const char *s = env->GetStringUTFChars((jstring)aJString, &isCopy); - if (!s) { - env->ExceptionDescribe(); - env->ExceptionClear(); - fprintf (stderr, "\n"); - } - return s; -} - -void releaseCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const char *s) -{ - env->ReleaseStringUTFChars (aJString, s); -} - -const jchar *getUCharactersFromJStringInEnv (JNIEnv *env, jstring aJString) -{ - jboolean isCopy; - const jchar *s = env->GetStringChars((jstring)aJString, &isCopy); - if (!s) { - env->ExceptionDescribe(); - env->ExceptionClear(); - fprintf (stderr, "\n"); - } - return s; -} - -void releaseUCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const jchar *s) -{ - env->ReleaseStringChars (aJString, s); -} - -JNIType JNITypeFromClassName(const char *name) -{ - JNIType type; - - if (strcmp("byte",name) == 0) - type = byte_type; - else if (strcmp("short",name) == 0) - type = short_type; - else if (strcmp("int",name) == 0) - type = int_type; - else if (strcmp("long",name) == 0) - type = long_type; - else if (strcmp("float",name) == 0) - type = float_type; - else if (strcmp("double",name) == 0) - type = double_type; - else if (strcmp("char",name) == 0) - type = char_type; - else if (strcmp("boolean",name) == 0) - type = boolean_type; - else if (strcmp("void",name) == 0) - type = void_type; - else if ('[' == name[0]) - type = array_type; - else - type = object_type; - - return type; -} - -const char *signatureFromPrimitiveType(JNIType type) -{ - switch (type){ - case void_type: - return "V"; - - case array_type: - return "["; - - case object_type: - return "L"; - - case boolean_type: - return "Z"; - - case byte_type: - return "B"; - - case char_type: - return "C"; - - case short_type: - return "S"; - - case int_type: - return "I"; - - case long_type: - return "J"; - - case float_type: - return "F"; - - case double_type: - return "D"; - - case invalid_type: - default: - break; - } - return ""; -} - -JNIType JNITypeFromPrimitiveType(char type) -{ - switch (type){ - case 'V': - return void_type; - - case 'L': - return object_type; - - case '[': - return array_type; - - case 'Z': - return boolean_type; - - case 'B': - return byte_type; - - case 'C': - return char_type; - - case 'S': - return short_type; - - case 'I': - return int_type; - - case 'J': - return long_type; - - case 'F': - return float_type; - - case 'D': - return double_type; - - default: - break; - } - return invalid_type; -} - -jvalue getJNIField( jobject obj, JNIType type, const char *name, const char *signature) -{ - JavaVM *jvm = getJavaVM(); - JNIEnv *env = getJNIEnv(); - jvalue result; - - bzero (&result, sizeof(jvalue)); - if ( obj != NULL && jvm != NULL && env != NULL) { - jclass cls = env->GetObjectClass(obj); - if ( cls != NULL ) { - jfieldID field = env->GetFieldID(cls, name, signature); - if ( field != NULL ) { - switch (type) { - case array_type: - case object_type: - result.l = env->functions->GetObjectField(env, obj, field); - break; - case boolean_type: - result.z = env->functions->GetBooleanField(env, obj, field); - break; - case byte_type: - result.b = env->functions->GetByteField(env, obj, field); - break; - case char_type: - result.c = env->functions->GetCharField(env, obj, field); - break; - case short_type: - result.s = env->functions->GetShortField(env, obj, field); - break; - case int_type: - result.i = env->functions->GetIntField(env, obj, field); - break; - case long_type: - result.j = env->functions->GetLongField(env, obj, field); - break; - case float_type: - result.f = env->functions->GetFloatField(env, obj, field); - break; - case double_type: - result.d = env->functions->GetDoubleField(env, obj, field); - break; - default: - fprintf(stderr, "%s: invalid field type (%d)\n", __PRETTY_FUNCTION__, (int)type); - } - } - else - { - fprintf(stderr, "%s: Could not find field: %s\n", __PRETTY_FUNCTION__, name); - env->ExceptionDescribe(); - env->ExceptionClear(); - fprintf (stderr, "\n"); - } - - env->DeleteLocalRef(cls); - } - else { - fprintf(stderr, "%s: Could not find class for object\n", __PRETTY_FUNCTION__); - } - } - - return result; -} - -static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray, const char* javaClassName) -{ - JNIEnv *env = getJNIEnv(); - // As JS Arrays can contain a mixture of objects, assume we can convert to - // the requested Java Array type requested, unless the array type is some object array - // other than a string. - unsigned length = jsArray->length(); - jobjectArray jarray = 0; - - // Build the correct array type - switch (JNITypeFromPrimitiveType(javaClassName[1])) { - case object_type: { - // Only support string object types - if (0 == strcmp("[Ljava.lang.String;", javaClassName)) { - jarray = (jobjectArray)env->NewObjectArray(length, - env->FindClass("java/lang/String"), - env->NewStringUTF("")); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - UString stringValue = item.toString(exec); - env->SetObjectArrayElement(jarray,i, - env->functions->NewString(env, (const jchar *)stringValue.data(), stringValue.size())); - } - } - break; - } - - case boolean_type: { - jarray = (jobjectArray)env->NewBooleanArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jboolean value = (jboolean)item.toNumber(exec); - env->SetBooleanArrayRegion((jbooleanArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case byte_type: { - jarray = (jobjectArray)env->NewByteArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jbyte value = (jbyte)item.toNumber(exec); - env->SetByteArrayRegion((jbyteArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case char_type: { - jarray = (jobjectArray)env->NewCharArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - UString stringValue = item.toString(exec); - jchar value = 0; - if (stringValue.size() > 0) - value = ((const jchar*)stringValue.data())[0]; - env->SetCharArrayRegion((jcharArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case short_type: { - jarray = (jobjectArray)env->NewShortArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jshort value = (jshort)item.toNumber(exec); - env->SetShortArrayRegion((jshortArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case int_type: { - jarray = (jobjectArray)env->NewIntArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jint value = (jint)item.toNumber(exec); - env->SetIntArrayRegion((jintArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case long_type: { - jarray = (jobjectArray)env->NewLongArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jlong value = (jlong)item.toNumber(exec); - env->SetLongArrayRegion((jlongArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case float_type: { - jarray = (jobjectArray)env->NewFloatArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jfloat value = (jfloat)item.toNumber(exec); - env->SetFloatArrayRegion((jfloatArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case double_type: { - jarray = (jobjectArray)env->NewDoubleArray(length); - for(unsigned i = 0; i < length; i++) { - JSValue item = jsArray->get(exec, i); - jdouble value = (jdouble)item.toNumber(exec); - env->SetDoubleArrayRegion((jdoubleArray)jarray, (jsize)i, (jsize)1, &value); - } - break; - } - - case array_type: // don't handle embedded arrays - case void_type: // Don't expect arrays of void objects - case invalid_type: // Array of unknown objects - break; - } - - // if it was not one of the cases handled, then null is returned - return jarray; -} - - -jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType _JNIType, const char* javaClassName) -{ - JSLock lock(SilenceAssertionsOnly); - - jvalue result; - - switch (_JNIType){ - case array_type: - case object_type: { - result.l = (jobject)0; - - // First see if we have a Java instance. - if (value.isObject()){ - JSObject* objectImp = asObject(value); - if (objectImp->classInfo() == &RuntimeObjectImp::s_info) { - RuntimeObjectImp* imp = static_cast(objectImp); - JavaInstance *instance = static_cast(imp->getInternalInstance()); - if (instance) - result.l = instance->javaInstance(); - } - else if (objectImp->classInfo() == &RuntimeArray::s_info) { - // Input is a JavaScript Array that was originally created from a Java Array - RuntimeArray* imp = static_cast(objectImp); - JavaArray *array = static_cast(imp->getConcreteArray()); - result.l = array->javaArray(); - } - else if (objectImp->classInfo() == &JSArray::info) { - // Input is a Javascript Array. We need to create it to a Java Array. - result.l = convertArrayInstanceToJavaArray(exec, asArray(value), javaClassName); - } - } - - // Now convert value to a string if the target type is a java.lang.string, and we're not - // converting from a Null. - if (result.l == 0 && strcmp(javaClassName, "java.lang.String") == 0) { -#ifdef CONVERT_NULL_TO_EMPTY_STRING - if (value->isNull()) { - JNIEnv *env = getJNIEnv(); - jchar buf[2]; - jobject javaString = env->functions->NewString (env, buf, 0); - result.l = javaString; - } - else -#else - if (!value.isNull()) -#endif - { - UString stringValue = value.toString(exec); - JNIEnv *env = getJNIEnv(); - jobject javaString = env->functions->NewString (env, (const jchar *)stringValue.data(), stringValue.size()); - result.l = javaString; - } - } else if (result.l == 0) - bzero (&result, sizeof(jvalue)); // Handle it the same as a void case - } - break; - - case boolean_type: { - result.z = (jboolean)value.toNumber(exec); - } - break; - - case byte_type: { - result.b = (jbyte)value.toNumber(exec); - } - break; - - case char_type: { - result.c = (jchar)value.toNumber(exec); - } - break; - - case short_type: { - result.s = (jshort)value.toNumber(exec); - } - break; - - case int_type: { - result.i = (jint)value.toNumber(exec); - } - break; - - case long_type: { - result.j = (jlong)value.toNumber(exec); - } - break; - - case float_type: { - result.f = (jfloat)value.toNumber(exec); - } - break; - - case double_type: { - result.d = (jdouble)value.toNumber(exec); - } - break; - - break; - - case invalid_type: - default: - case void_type: { - bzero (&result, sizeof(jvalue)); - } - break; - } - return result; -} - -} // end of namespace Bindings - -} // end of namespace JSC - -#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h b/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h deleted file mode 100644 index c315b1f..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/jni/jni_utility.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _JNI_UTILITY_H_ -#define _JNI_UTILITY_H_ - -#if ENABLE(MAC_JAVA_BRIDGE) - -#include -#include - -// The order of these items can not be modified as they are tightly -// bound with the JVM on Mac OSX. If new types need to be added, they -// should be added to the end. It is used in jni_obc.mm when calling -// through to the JVM. Newly added items need to be made compatible -// in that file. -typedef enum { - invalid_type = 0, - void_type, - object_type, - boolean_type, - byte_type, - char_type, - short_type, - int_type, - long_type, - float_type, - double_type, - array_type -} JNIType; - -namespace JSC { - -class ExecState; -class JSObject; - -namespace Bindings { - -class JavaParameter; - -const char *getCharactersFromJString(jstring aJString); -void releaseCharactersForJString(jstring aJString, const char *s); - -const char *getCharactersFromJStringInEnv(JNIEnv *env, jstring aJString); -void releaseCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const char *s); -const jchar *getUCharactersFromJStringInEnv(JNIEnv *env, jstring aJString); -void releaseUCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const jchar *s); - -JNIType JNITypeFromClassName(const char *name); -JNIType JNITypeFromPrimitiveType(char type); -const char *signatureFromPrimitiveType(JNIType type); - -jvalue convertValueToJValue(ExecState*, JSValue, JNIType, const char* javaClassName); - -jvalue getJNIField(jobject obj, JNIType type, const char *name, const char *signature); - -jmethodID getMethodID(jobject obj, const char *name, const char *sig); -JNIEnv* getJNIEnv(); -JavaVM* getJavaVM(); -void setJavaVM(JavaVM*); - - -template struct JNICaller; - -template<> struct JNICaller { - static void callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallVoidMethodA(obj, mid, args); - } - static void callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallVoidMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jobject callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallObjectMethodA(obj, mid, args); - } - static jobject callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallObjectMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jboolean callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallBooleanMethodA(obj, mid, args); - } - static jboolean callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallBooleanMethodV(obj, mid, args); - } - static jboolean callStaticV(jclass cls, jmethodID mid, va_list args) - { - return getJNIEnv()->CallStaticBooleanMethod(cls, mid, args); - } - -}; - -template<> struct JNICaller { - static jbyte callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallByteMethodA(obj, mid, args); - } - static jbyte callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallByteMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jchar callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallCharMethodA(obj, mid, args); - } - static jchar callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallCharMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jshort callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallShortMethodA(obj, mid, args); - } - static jshort callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallShortMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jint callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallIntMethodA(obj, mid, args); - } - static jint callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallIntMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jlong callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallLongMethodA(obj, mid, args); - } - static jlong callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallLongMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jfloat callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallFloatMethodA(obj, mid, args); - } - static jfloat callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallFloatMethodV(obj, mid, args); - } -}; - -template<> struct JNICaller { - static jdouble callA(jobject obj, jmethodID mid, jvalue* args) - { - return getJNIEnv()->CallDoubleMethodA(obj, mid, args); - } - static jdouble callV(jobject obj, jmethodID mid, va_list args) - { - return getJNIEnv()->CallDoubleMethodV(obj, mid, args); - } -}; - -template T callJNIMethodIDA(jobject obj, jmethodID mid, jvalue *args) -{ - return JNICaller::callA(obj, mid, args); -} - -template -static T callJNIMethodV(jobject obj, const char *name, const char *sig, va_list args) -{ - JavaVM *jvm = getJavaVM(); - JNIEnv *env = getJNIEnv(); - - if ( obj != NULL && jvm != NULL && env != NULL) { - jclass cls = env->GetObjectClass(obj); - if ( cls != NULL ) { - jmethodID mid = env->GetMethodID(cls, name, sig); - if ( mid != NULL ) - { - return JNICaller::callV(obj, mid, args); - } - else - { - fprintf(stderr, "%s: Could not find method: %s for %p\n", __PRETTY_FUNCTION__, name, obj); - env->ExceptionDescribe(); - env->ExceptionClear(); - fprintf (stderr, "\n"); - } - - env->DeleteLocalRef(cls); - } - else { - fprintf(stderr, "%s: Could not find class for %p\n", __PRETTY_FUNCTION__, obj); - } - } - - return 0; -} - -template -T callJNIMethod(jobject obj, const char* methodName, const char* methodSignature, ...) -{ - va_list args; - va_start(args, methodSignature); - - T result= callJNIMethodV(obj, methodName, methodSignature, args); - - va_end(args); - - return result; -} - -template -T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSignature, ...) -{ - JavaVM *jvm = getJavaVM(); - JNIEnv *env = getJNIEnv(); - va_list args; - - va_start(args, methodSignature); - - T result = 0; - - if (cls != NULL && jvm != NULL && env != NULL) { - jmethodID mid = env->GetStaticMethodID(cls, methodName, methodSignature); - if (mid != NULL) - result = JNICaller::callStaticV(cls, mid, args); - else { - fprintf(stderr, "%s: Could not find method: %s for %p\n", __PRETTY_FUNCTION__, methodName, cls); - env->ExceptionDescribe(); - env->ExceptionClear(); - fprintf (stderr, "\n"); - } - } - - va_end(args); - - return result; -} - -bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription); - -} // namespace Bindings - -} // namespace JSC - -#endif // ENABLE(MAC_JAVA_BRIDGE) - -#endif // _JNI_UTILITY_H_ diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp new file mode 100644 index 0000000..b598263 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -0,0 +1,442 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIBridgeJSC.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIUtilityPrivate.h" +#include "Logging.h" +#include "runtime_array.h" +#include "runtime_object.h" +#include + +using namespace JSC; +using namespace JSC::Bindings; +using namespace WebCore; + +JavaField::JavaField(JNIEnv* env, jobject aField) +{ + // Get field type name + jstring fieldTypeName = 0; + if (jobject fieldType = callJNIMethod(aField, "getType", "()Ljava/lang/Class;")) + fieldTypeName = static_cast(callJNIMethod(fieldType, "getName", "()Ljava/lang/String;")); + if (!fieldTypeName) + fieldTypeName = env->NewStringUTF(""); + m_type = JavaString(env, fieldTypeName); + + m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + + // Get field name + jstring fieldName = static_cast(callJNIMethod(aField, "getName", "()Ljava/lang/String;")); + if (!fieldName) + fieldName = env->NewStringUTF(""); + m_name = JavaString(env, fieldName); + + m_field = new JObjectWrapper(aField); +} + +JSValue JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr rootObject) +{ + if (type[0] != '[') + return jsUndefined(); + + return new (exec) RuntimeArray(exec, new JavaArray(anObject, type, rootObject)); +} + +jvalue JavaField::dispatchValueFromInstance(ExecState* exec, const JavaInstance* instance, const char* name, const char* sig, JNIType returnType) const +{ + jobject jinstance = instance->javaInstance(); + jobject fieldJInstance = m_field->m_instance; + JNIEnv* env = getJNIEnv(); + jvalue result; + + bzero(&result, sizeof(jvalue)); + jclass cls = env->GetObjectClass(fieldJInstance); + if (cls) { + jmethodID mid = env->GetMethodID(cls, name, sig); + if (mid) { + RootObject* rootObject = instance->rootObject(); + if (rootObject && rootObject->nativeHandle()) { + JSValue exceptionDescription; + jvalue args[1]; + + args[0].l = jinstance; + dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription); + if (exceptionDescription) + throwError(exec, GeneralError, exceptionDescription.toString(exec)); + } + } + } + return result; +} + +JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const +{ + const JavaInstance* instance = static_cast(i); + + JSValue jsresult = jsUndefined(); + + switch (m_JNIType) { + case array_type: + case object_type: + { + jvalue result = dispatchValueFromInstance(exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type); + jobject anObject = result.l; + + const char* arrayType = type(); + if (arrayType[0] == '[') + jsresult = JavaArray::convertJObjectToArray(exec, anObject, arrayType, instance->rootObject()); + else if (anObject) + jsresult = JavaInstance::create(anObject, instance->rootObject())->createRuntimeObject(exec); + } + break; + + case boolean_type: + jsresult = jsBoolean(dispatchValueFromInstance(exec, instance, "getBoolean", "(Ljava/lang/Object;)Z", boolean_type).z); + break; + + case byte_type: + case char_type: + case short_type: + + case int_type: + { + jint value; + jvalue result = dispatchValueFromInstance(exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type); + value = result.i; + jsresult = jsNumber(exec, static_cast(value)); + } + break; + + case long_type: + case float_type: + case double_type: + { + jdouble value; + jvalue result = dispatchValueFromInstance(exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type); + value = result.i; + jsresult = jsNumber(exec, static_cast(value)); + } + break; + default: + break; + } + + LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).UTF8String().c_str(), jsresult.toString(exec).ascii()); + + return jsresult; +} + +void JavaField::dispatchSetValueToInstance(ExecState* exec, const JavaInstance* instance, jvalue javaValue, const char* name, const char* sig) const +{ + jobject jinstance = instance->javaInstance(); + jobject fieldJInstance = m_field->m_instance; + JNIEnv* env = getJNIEnv(); + + jclass cls = env->GetObjectClass(fieldJInstance); + if (cls) { + jmethodID mid = env->GetMethodID(cls, name, sig); + if (mid) { + RootObject* rootObject = instance->rootObject(); + if (rootObject && rootObject->nativeHandle()) { + JSValue exceptionDescription; + jvalue args[2]; + jvalue result; + + args[0].l = jinstance; + args[1] = javaValue; + dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription); + if (exceptionDescription) + throwError(exec, GeneralError, exceptionDescription.toString(exec)); + } + } + } +} + +void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const +{ + const JavaInstance* instance = static_cast(i); + jvalue javaValue = convertValueToJValue(exec, aValue, m_JNIType, type()); + + LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii()); + + switch (m_JNIType) { + case array_type: + case object_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V"); + } + break; + + case boolean_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V"); + } + break; + + case byte_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V"); + } + break; + + case char_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V"); + } + break; + + case short_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V"); + } + break; + + case int_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V"); + } + break; + + case long_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V"); + } + break; + + case float_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V"); + } + break; + + case double_type: + { + dispatchSetValueToInstance(exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V"); + } + break; + default: + break; + } +} + +JavaArray::JavaArray(jobject array, const char* type, PassRefPtr rootObject) + : Array(rootObject) +{ + m_array = new JObjectWrapper(array); + // Java array are fixed length, so we can cache length. + JNIEnv* env = getJNIEnv(); + m_length = env->GetArrayLength(static_cast(m_array->m_instance)); + m_type = strdup(type); +} + +JavaArray::~JavaArray() +{ + free(const_cast(m_type)); +} + +RootObject* JavaArray::rootObject() const +{ + return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0; +} + +void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const +{ + JNIEnv* env = getJNIEnv(); + char* javaClassName = 0; + + JNIType arrayType = JNITypeFromPrimitiveType(m_type[1]); + if (m_type[1] == 'L') { + // The type of the array will be something like: + // "[Ljava.lang.string;". This is guaranteed, so no need + // for extra sanity checks. + javaClassName = strdup(&m_type[2]); + javaClassName[strchr(javaClassName, ';')-javaClassName] = 0; + } + jvalue aJValue = convertValueToJValue(exec, aValue, arrayType, javaClassName); + + switch (arrayType) { + case object_type: + { + env->SetObjectArrayElement(static_cast(javaArray()), index, aJValue.l); + break; + } + + case boolean_type: + { + env->SetBooleanArrayRegion(static_cast(javaArray()), index, 1, &aJValue.z); + break; + } + + case byte_type: + { + env->SetByteArrayRegion(static_cast(javaArray()), index, 1, &aJValue.b); + break; + } + + case char_type: + { + env->SetCharArrayRegion(static_cast(javaArray()), index, 1, &aJValue.c); + break; + } + + case short_type: + { + env->SetShortArrayRegion(static_cast(javaArray()), index, 1, &aJValue.s); + break; + } + + case int_type: + { + env->SetIntArrayRegion(static_cast(javaArray()), index, 1, &aJValue.i); + break; + } + + case long_type: + { + env->SetLongArrayRegion(static_cast(javaArray()), index, 1, &aJValue.j); + } + + case float_type: + { + env->SetFloatArrayRegion(static_cast(javaArray()), index, 1, &aJValue.f); + break; + } + + case double_type: + { + env->SetDoubleArrayRegion(static_cast(javaArray()), index, 1, &aJValue.d); + break; + } + default: + break; + } + + if (javaClassName) + free(const_cast(javaClassName)); +} + + +JSValue JavaArray::valueAt(ExecState* exec, unsigned index) const +{ + JNIEnv* env = getJNIEnv(); + JNIType arrayType = JNITypeFromPrimitiveType(m_type[1]); + switch (arrayType) { + case object_type: + { + jobjectArray objectArray = static_cast(javaArray()); + jobject anObject; + anObject = env->GetObjectArrayElement(objectArray, index); + + // No object? + if (!anObject) + return jsNull(); + + // Nested array? + if (m_type[1] == '[') + return JavaArray::convertJObjectToArray(exec, anObject, m_type + 1, rootObject()); + // or array of other object type? + return JavaInstance::create(anObject, rootObject())->createRuntimeObject(exec); + } + + case boolean_type: + { + jbooleanArray booleanArray = static_cast(javaArray()); + jboolean aBoolean; + env->GetBooleanArrayRegion(booleanArray, index, 1, &aBoolean); + return jsBoolean(aBoolean); + } + + case byte_type: + { + jbyteArray byteArray = static_cast(javaArray()); + jbyte aByte; + env->GetByteArrayRegion(byteArray, index, 1, &aByte); + return jsNumber(exec, aByte); + } + + case char_type: + { + jcharArray charArray = static_cast(javaArray()); + jchar aChar; + env->GetCharArrayRegion(charArray, index, 1, &aChar); + return jsNumber(exec, aChar); + break; + } + + case short_type: + { + jshortArray shortArray = static_cast(javaArray()); + jshort aShort; + env->GetShortArrayRegion(shortArray, index, 1, &aShort); + return jsNumber(exec, aShort); + } + + case int_type: + { + jintArray intArray = static_cast(javaArray()); + jint anInt; + env->GetIntArrayRegion(intArray, index, 1, &anInt); + return jsNumber(exec, anInt); + } + + case long_type: + { + jlongArray longArray = static_cast(javaArray()); + jlong aLong; + env->GetLongArrayRegion(longArray, index, 1, &aLong); + return jsNumber(exec, aLong); + } + + case float_type: + { + jfloatArray floatArray = static_cast(javaArray()); + jfloat aFloat; + env->GetFloatArrayRegion(floatArray, index, 1, &aFloat); + return jsNumber(exec, aFloat); + } + + case double_type: + { + jdoubleArray doubleArray = static_cast(javaArray()); + jdouble aDouble; + env->GetDoubleArrayRegion(doubleArray, index, 1, &aDouble); + return jsNumber(exec, aDouble); + } + default: + break; + } + return jsUndefined(); +} + +unsigned int JavaArray::getLength() const +{ + return m_length; +} + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h new file mode 100644 index 0000000..902bd4e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIBridgeJSC.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIBridgeJSC_h +#define JNIBridgeJSC_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "Bridge.h" +#include "JNIBridge.h" +#include + +namespace JSC { + +namespace Bindings { + +class JavaField : public Field { +public: + JavaField(JNIEnv*, jobject aField); + + virtual JSValue valueFromInstance(ExecState*, const Instance*) const; + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const; + + const JavaString& name() const { return m_name; } + virtual RuntimeType type() const { return m_type.UTF8String(); } + + JNIType getJNIType() const { return m_JNIType; } + +private: + void dispatchSetValueToInstance(ExecState*, const JavaInstance*, jvalue, const char* name, const char* sig) const; + jvalue dispatchValueFromInstance(ExecState*, const JavaInstance*, const char* name, const char* sig, JNIType returnType) const; + + JavaString m_name; + JavaString m_type; + JNIType m_JNIType; + RefPtr m_field; +}; + +class JavaArray : public Array { +public: + JavaArray(jobject array, const char* type, PassRefPtr); + virtual ~JavaArray(); + + RootObject* rootObject() const; + + virtual void setValueAt(ExecState*, unsigned int index, JSValue) const; + virtual JSValue valueAt(ExecState*, unsigned int index) const; + virtual unsigned int getLength() const; + + jobject javaArray() const { return m_array->m_instance; } + + static JSValue convertJObjectToArray(ExecState*, jobject, const char* type, PassRefPtr); + +private: + RefPtr m_array; + unsigned int m_length; + const char* m_type; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JNIBridge_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp new file mode 100644 index 0000000..33c79ce --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2003, 2010 Apple, Inc. All rights reserved. + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIUtilityPrivate.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIBridgeJSC.h" +#include "runtime_array.h" +#include "runtime_object.h" +#include +#include + +namespace JSC { + +namespace Bindings { + +static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray, const char* javaClassName) +{ + JNIEnv* env = getJNIEnv(); + // As JS Arrays can contain a mixture of objects, assume we can convert to + // the requested Java Array type requested, unless the array type is some object array + // other than a string. + unsigned length = jsArray->length(); + jobjectArray jarray = 0; + + // Build the correct array type + switch (JNITypeFromPrimitiveType(javaClassName[1])) { + case object_type: + { + // Only support string object types + if (!strcmp("[Ljava.lang.String;", javaClassName)) { + jarray = (jobjectArray)env->NewObjectArray(length, + env->FindClass("java/lang/String"), + env->NewStringUTF("")); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + UString stringValue = item.toString(exec); + env->SetObjectArrayElement(jarray, i, + env->functions->NewString(env, (const jchar *)stringValue.data(), stringValue.size())); + } + } + break; + } + + case boolean_type: + { + jarray = (jobjectArray)env->NewBooleanArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jboolean value = (jboolean)item.toNumber(exec); + env->SetBooleanArrayRegion((jbooleanArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case byte_type: + { + jarray = (jobjectArray)env->NewByteArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jbyte value = (jbyte)item.toNumber(exec); + env->SetByteArrayRegion((jbyteArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case char_type: + { + jarray = (jobjectArray)env->NewCharArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + UString stringValue = item.toString(exec); + jchar value = 0; + if (stringValue.size() > 0) + value = ((const jchar*)stringValue.data())[0]; + env->SetCharArrayRegion((jcharArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case short_type: + { + jarray = (jobjectArray)env->NewShortArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jshort value = (jshort)item.toNumber(exec); + env->SetShortArrayRegion((jshortArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case int_type: + { + jarray = (jobjectArray)env->NewIntArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jint value = (jint)item.toNumber(exec); + env->SetIntArrayRegion((jintArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case long_type: + { + jarray = (jobjectArray)env->NewLongArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jlong value = (jlong)item.toNumber(exec); + env->SetLongArrayRegion((jlongArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case float_type: + { + jarray = (jobjectArray)env->NewFloatArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jfloat value = (jfloat)item.toNumber(exec); + env->SetFloatArrayRegion((jfloatArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case double_type: + { + jarray = (jobjectArray)env->NewDoubleArray(length); + for (unsigned i = 0; i < length; i++) { + JSValue item = jsArray->get(exec, i); + jdouble value = (jdouble)item.toNumber(exec); + env->SetDoubleArrayRegion((jdoubleArray)jarray, (jsize)i, (jsize)1, &value); + } + break; + } + + case array_type: // don't handle embedded arrays + case void_type: // Don't expect arrays of void objects + case invalid_type: // Array of unknown objects + break; + } + + // if it was not one of the cases handled, then null is returned + return jarray; +} + +jvalue convertValueToJValue(ExecState* exec, JSValue value, JNIType jniType, const char* javaClassName) +{ + JSLock lock(SilenceAssertionsOnly); + + jvalue result; + + switch (jniType) { + case array_type: + case object_type: + { + result.l = (jobject)0; + + // First see if we have a Java instance. + if (value.isObject()) { + JSObject* objectImp = asObject(value); + if (objectImp->classInfo() == &RuntimeObjectImp::s_info) { + RuntimeObjectImp* imp = static_cast(objectImp); + JavaInstance* instance = static_cast(imp->getInternalInstance()); + if (instance) + result.l = instance->javaInstance(); + } else if (objectImp->classInfo() == &RuntimeArray::s_info) { + // Input is a JavaScript Array that was originally created from a Java Array + RuntimeArray* imp = static_cast(objectImp); + JavaArray* array = static_cast(imp->getConcreteArray()); + result.l = array->javaArray(); + } else if (objectImp->classInfo() == &JSArray::info) { + // Input is a Javascript Array. We need to create it to a Java Array. + result.l = convertArrayInstanceToJavaArray(exec, asArray(value), javaClassName); + } + } + + if (!result.l) { + // Convert value to a string if the target type is a java.lang.string, and we're not + // converting from a null. + if (!strcmp(javaClassName, "java.lang.String")) { + if (!value.isNull()) { + UString stringValue = value.toString(exec); + JNIEnv* env = getJNIEnv(); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + result.l = javaString; + } + // JS strings are converted to Java strings if argument type is Object. + } else if (!strcmp(javaClassName, "java.lang.Object")) { + if (value.isString()) { + UString stringValue = asString(value)->value(exec); + JNIEnv* env = getJNIEnv(); + jobject javaString = env->functions->NewString(env, (const jchar*)stringValue.data(), stringValue.size()); + result.l = javaString; + } + } else + bzero(&result, sizeof(jvalue)); // Handle it the same as a void case + } + } + break; + + case boolean_type: + { + result.z = (jboolean)value.toNumber(exec); + } + break; + + case byte_type: + { + result.b = (jbyte)value.toNumber(exec); + } + break; + + case char_type: + { + result.c = (jchar)value.toNumber(exec); + } + break; + + case short_type: + { + result.s = (jshort)value.toNumber(exec); + } + break; + + case int_type: + { + result.i = (jint)value.toNumber(exec); + } + break; + + case long_type: + { + result.j = (jlong)value.toNumber(exec); + } + break; + + case float_type: + { + result.f = (jfloat)value.toNumber(exec); + } + break; + + case double_type: + { + result.d = (jdouble)value.toNumber(exec); + } + break; + + break; + + case invalid_type: + default: + case void_type: + { + bzero(&result, sizeof(jvalue)); + } + break; + } + return result; +} + +} // end of namespace Bindings + +} // end of namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h new file mode 100644 index 0000000..0297f97 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JNIUtilityPrivate.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. + * Copyright 2009, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIUtilityPrivate_h +#define JNIUtilityPrivate_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIUtility.h" +#include + +namespace JSC { + +class ExecState; +class JSObject; + +namespace Bindings { + +jvalue convertValueToJValue(ExecState*, JSValue, JNIType, const char* javaClassName); +bool dispatchJNICall(ExecState*, const void* targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue* args, jvalue& result, const char* callingURL, JSValue& exceptionDescription); + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JNIUtilityPrivate_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp new file mode 100644 index 0000000..e1b8b4c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JavaClassJSC.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIUtility.h" +#include "JSDOMWindow.h" +#include +#include + +using namespace JSC::Bindings; + +JavaClass::JavaClass(jobject anInstance) +{ + jobject aClass = callJNIMethod(anInstance, "getClass", "()Ljava/lang/Class;"); + + if (!aClass) { + LOG_ERROR("Unable to call getClass on instance %p", anInstance); + m_name = fastStrDup(""); + return; + } + + if (jstring className = (jstring)callJNIMethod(aClass, "getName", "()Ljava/lang/String;")) { + const char* classNameC = getCharactersFromJString(className); + m_name = fastStrDup(classNameC); + releaseCharactersForJString(className, classNameC); + } else + m_name = fastStrDup(""); + + int i; + JNIEnv* env = getJNIEnv(); + + // Get the fields + if (jarray fields = (jarray)callJNIMethod(aClass, "getFields", "()[Ljava/lang/reflect/Field;")) { + int numFields = env->GetArrayLength(fields); + for (i = 0; i < numFields; i++) { + jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i); + JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor + { + JSLock lock(SilenceAssertionsOnly); + m_fields.set(((UString)aField->name()).rep(), aField); + } + env->DeleteLocalRef(aJField); + } + env->DeleteLocalRef(fields); + } + + // Get the methods + if (jarray methods = (jarray)callJNIMethod(aClass, "getMethods", "()[Ljava/lang/reflect/Method;")) { + int numMethods = env->GetArrayLength(methods); + for (i = 0; i < numMethods; i++) { + jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i); + JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor + MethodList* methodList; + { + JSLock lock(SilenceAssertionsOnly); + + methodList = m_methods.get(((UString)aMethod->name()).rep()); + if (!methodList) { + methodList = new MethodList(); + m_methods.set(((UString)aMethod->name()).rep(), methodList); + } + } + methodList->append(aMethod); + env->DeleteLocalRef(aJMethod); + } + env->DeleteLocalRef(methods); + } + + env->DeleteLocalRef(aClass); +} + +JavaClass::~JavaClass() +{ + fastFree(const_cast(m_name)); + + JSLock lock(SilenceAssertionsOnly); + + deleteAllValues(m_fields); + m_fields.clear(); + + MethodListMap::const_iterator end = m_methods.end(); + for (MethodListMap::const_iterator it = m_methods.begin(); it != end; ++it) { + const MethodList* methodList = it->second; + deleteAllValues(*methodList); + delete methodList; + } + m_methods.clear(); +} + +MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const +{ + MethodList* methodList = m_methods.get(identifier.ustring().rep()); + + if (methodList) + return *methodList; + return MethodList(); +} + +Field* JavaClass::fieldNamed(const Identifier& identifier, Instance*) const +{ + return m_fields.get(identifier.ustring().rep()); +} + +bool JavaClass::isNumberClass() const +{ + return (!strcmp(m_name, "java.lang.Byte") + || !strcmp(m_name, "java.lang.Short") + || !strcmp(m_name, "java.lang.Integer") + || !strcmp(m_name, "java.lang.Long") + || !strcmp(m_name, "java.lang.Float") + || !strcmp(m_name, "java.lang.Double")); +} + +bool JavaClass::isBooleanClass() const +{ + return !strcmp(m_name, "java.lang.Boolean"); +} + +bool JavaClass::isStringClass() const +{ + return !strcmp(m_name, "java.lang.String"); +} + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h new file mode 100644 index 0000000..09b93e9 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaClassJSC.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaClassJSC_h +#define JavaClassJSC_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIBridgeJSC.h" +#include + +namespace JSC { + +namespace Bindings { + +class JavaClass : public Class { +public: + JavaClass(jobject); + ~JavaClass(); + + virtual MethodList methodsNamed(const Identifier&, Instance*) const; + virtual Field* fieldNamed(const Identifier&, Instance*) const; + + bool isNumberClass() const; + bool isBooleanClass() const; + bool isStringClass() const; + +private: + const char* m_name; + FieldMap m_fields; + MethodListMap m_methods; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JavaClassJSC_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp new file mode 100644 index 0000000..4fc7e8e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -0,0 +1,335 @@ +/* + * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JavaInstanceJSC.h" + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "JNIBridgeJSC.h" +#include "JNIUtility.h" +#include "JNIUtilityPrivate.h" +#include "JavaClassJSC.h" +#include "Logging.h" +#include "runtime_object.h" +#include "runtime_root.h" +#include +#include +#include + +using namespace JSC::Bindings; +using namespace JSC; +using namespace WebCore; + +JavaInstance::JavaInstance(jobject instance, PassRefPtr rootObject) + : Instance(rootObject) +{ + m_instance = new JObjectWrapper(instance); + m_class = 0; +} + +JavaInstance::~JavaInstance() +{ + delete m_class; +} + +#define NUM_LOCAL_REFS 64 + +void JavaInstance::virtualBegin() +{ + getJNIEnv()->PushLocalFrame(NUM_LOCAL_REFS); +} + +void JavaInstance::virtualEnd() +{ + getJNIEnv()->PopLocalFrame(0); +} + +Class* JavaInstance::getClass() const +{ + if (!m_class) + m_class = new JavaClass (m_instance->m_instance); + return m_class; +} + +JSValue JavaInstance::stringValue(ExecState* exec) const +{ + JSLock lock(SilenceAssertionsOnly); + + jstring stringValue = (jstring)callJNIMethod(m_instance->m_instance, "toString", "()Ljava/lang/String;"); + + // Should throw a JS exception, rather than returning ""? - but better than a null dereference. + if (!stringValue) + return jsString(exec, UString()); + + JNIEnv* env = getJNIEnv(); + const jchar* c = getUCharactersFromJStringInEnv(env, stringValue); + UString u((const UChar*)c, (int)env->GetStringLength(stringValue)); + releaseUCharactersForJStringInEnv(env, stringValue, c); + return jsString(exec, u); +} + +JSValue JavaInstance::numberValue(ExecState* exec) const +{ + jdouble doubleValue = callJNIMethod(m_instance->m_instance, "doubleValue", "()D"); + return jsNumber(exec, doubleValue); +} + +JSValue JavaInstance::booleanValue() const +{ + jboolean booleanValue = callJNIMethod(m_instance->m_instance, "booleanValue", "()Z"); + return jsBoolean(booleanValue); +} + +JSValue JavaInstance::invokeMethod(ExecState* exec, const MethodList& methodList, const ArgList &args) +{ + int i; + int count = args.size(); + JSValue resultValue; + Method* method = 0; + size_t numMethods = methodList.size(); + + // Try to find a good match for the overloaded method. The + // fundamental problem is that JavaScript doesn't have the + // notion of method overloading and Java does. We could + // get a bit more sophisticated and attempt to does some + // type checking as we as checking the number of parameters. + for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) { + Method* aMethod = methodList[methodIndex]; + if (aMethod->numParameters() == count) { + method = aMethod; + break; + } + } + if (!method) { + LOG(LiveConnect, "JavaInstance::invokeMethod unable to find an appropiate method"); + return jsUndefined(); + } + + const JavaMethod* jMethod = static_cast(method); + LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).UTF8String().c_str(), jMethod->signature(), m_instance->m_instance); + + Vector jArgs(count); + + for (i = 0; i < count; i++) { + JavaParameter* aParameter = jMethod->parameterAt(i); + jArgs[i] = convertValueToJValue(exec, args.at(i), aParameter->getJNIType(), aParameter->type()); + LOG(LiveConnect, "JavaInstance::invokeMethod arg[%d] = %s", i, args.at(i).toString(exec).ascii()); + } + + jvalue result; + + // Try to use the JNI abstraction first, otherwise fall back to + // normal JNI. The JNI dispatch abstraction allows the Java plugin + // to dispatch the call on the appropriate internal VM thread. + RootObject* rootObject = this->rootObject(); + if (!rootObject) + return jsUndefined(); + + bool handled = false; + if (rootObject->nativeHandle()) { + jobject obj = m_instance->m_instance; + JSValue exceptionDescription; + const char *callingURL = 0; // FIXME, need to propagate calling URL to Java + handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs.data(), result, callingURL, exceptionDescription); + if (exceptionDescription) { + throwError(exec, GeneralError, exceptionDescription.toString(exec)); + return jsUndefined(); + } + } + +#ifdef BUILDING_ON_TIGER + if (!handled) { + jobject obj = m_instance->m_instance; + switch (jMethod->JNIReturnType()) { + case void_type: + callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case object_type: + result.l = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case boolean_type: + result.z = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case byte_type: + result.b = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case char_type: + result.c = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case short_type: + result.s = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case int_type: + result.i = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case long_type: + result.j = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case float_type: + result.f = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case double_type: + result.d = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs.data()); + break; + case array_type: + case invalid_type: + break; + } + } +#endif + + switch (jMethod->JNIReturnType()) { + case void_type: + { + resultValue = jsUndefined(); + } + break; + + case object_type: + { + if (result.l) { + // FIXME: array_type return type is handled below, can we actually get an array here? + const char* arrayType = jMethod->returnType(); + if (arrayType[0] == '[') + resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject); + else + resultValue = JavaInstance::create(result.l, rootObject)->createRuntimeObject(exec); + } else + resultValue = jsUndefined(); + } + break; + + case boolean_type: + { + resultValue = jsBoolean(result.z); + } + break; + + case byte_type: + { + resultValue = jsNumber(exec, result.b); + } + break; + + case char_type: + { + resultValue = jsNumber(exec, result.c); + } + break; + + case short_type: + { + resultValue = jsNumber(exec, result.s); + } + break; + + case int_type: + { + resultValue = jsNumber(exec, result.i); + } + break; + + case long_type: + { + resultValue = jsNumber(exec, result.j); + } + break; + + case float_type: + { + resultValue = jsNumber(exec, result.f); + } + break; + + case double_type: + { + resultValue = jsNumber(exec, result.d); + } + break; + + case array_type: + { + const char* arrayType = jMethod->returnType(); + ASSERT(arrayType[0] == '['); + resultValue = JavaArray::convertJObjectToArray(exec, result.l, arrayType, rootObject); + } + break; + + case invalid_type: + { + resultValue = jsUndefined(); + } + break; + } + + return resultValue; +} + +JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const +{ + if (hint == PreferString) + return stringValue(exec); + if (hint == PreferNumber) + return numberValue(exec); + JavaClass* aClass = static_cast(getClass()); + if (aClass->isStringClass()) + return stringValue(exec); + if (aClass->isNumberClass()) + return numberValue(exec); + if (aClass->isBooleanClass()) + return booleanValue(); + return valueOf(exec); +} + +JSValue JavaInstance::valueOf(ExecState* exec) const +{ + return stringValue(exec); +} + +JObjectWrapper::JObjectWrapper(jobject instance) + : m_refCount(0) +{ + ASSERT(instance); + + // Cache the JNIEnv used to get the global ref for this java instance. + // It'll be used to delete the reference. + m_env = getJNIEnv(); + + m_instance = m_env->NewGlobalRef(instance); + + LOG(LiveConnect, "JObjectWrapper ctor new global ref %p for %p", m_instance, instance); + + if (!m_instance) + LOG_ERROR("Could not get GlobalRef for %p", instance); +} + +JObjectWrapper::~JObjectWrapper() +{ + LOG(LiveConnect, "JObjectWrapper dtor deleting global ref %p", m_instance); + m_env->DeleteGlobalRef(m_instance); +} + +#endif // ENABLE(MAC_JAVA_BRIDGE) diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h new file mode 100644 index 0000000..a46c6d3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaInstanceJSC.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2003 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaInstanceJSC_h +#define JavaInstanceJSC_h + +#if ENABLE(MAC_JAVA_BRIDGE) + +#include "Bridge.h" +#include "runtime_root.h" + +#include + +namespace JSC { + +namespace Bindings { + +class JavaClass; + +class JObjectWrapper { +friend class RefPtr; +friend class JavaArray; +friend class JavaField; +friend class JavaInstance; +friend class JavaMethod; + +public: + jobject instance() const { return m_instance; } + void setInstance(jobject instance) { m_instance = instance; } + + void ref() { m_refCount++; } + void deref() + { + if (!(--m_refCount)) + delete this; + } + +protected: + JObjectWrapper(jobject instance); + ~JObjectWrapper(); + + jobject m_instance; + +private: + JNIEnv* m_env; + unsigned int m_refCount; +}; + +class JavaInstance : public Instance { +public: + static PassRefPtr create(jobject instance, PassRefPtr rootObject) + { + return adoptRef(new JavaInstance(instance, rootObject)); + } + + ~JavaInstance(); + + virtual Class* getClass() const; + + virtual JSValue valueOf(ExecState*) const; + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; + + virtual JSValue invokeMethod(ExecState* exec, const MethodList& method, const ArgList& args); + + jobject javaInstance() const { return m_instance->m_instance; } + + JSValue stringValue(ExecState*) const; + JSValue numberValue(ExecState*) const; + JSValue booleanValue() const; + +protected: + JavaInstance(jobject instance, PassRefPtr); + virtual void virtualBegin(); + virtual void virtualEnd(); + + RefPtr m_instance; + mutable JavaClass* m_class; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // ENABLE(MAC_JAVA_BRIDGE) + +#endif // JavaInstanceJSC_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h new file mode 100644 index 0000000..7c37f70 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/jsc/JavaStringJSC.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaStringJSC_h +#define JavaStringJSC_h + +#include "JNIUtility.h" +#include "JavaInstanceJSC.h" +#include + + +namespace JSC { + +namespace Bindings { + +class JavaStringImpl { +public: + ~JavaStringImpl() + { + JSLock lock(SilenceAssertionsOnly); + m_rep = 0; + } + + void init() + { + JSLock lock(SilenceAssertionsOnly); + m_rep = UString().rep(); + } + + void init(JNIEnv* e, jstring s) + { + int size = e->GetStringLength(s); + const jchar* uc = getUCharactersFromJStringInEnv(e, s); + { + JSLock lock(SilenceAssertionsOnly); + m_rep = UString(reinterpret_cast(uc), size).rep(); + } + releaseUCharactersForJStringInEnv(e, s, uc); + } + + const char* UTF8String() const + { + if (!m_utf8String.c_str()) { + JSLock lock(SilenceAssertionsOnly); + m_utf8String = UString(m_rep).UTF8String(); + } + return m_utf8String.c_str(); + } + const jchar* uchars() const { return (const jchar*)m_rep->data(); } + int length() const { return m_rep->length(); } + UString uString() const { return UString(m_rep); } + +private: + RefPtr m_rep; + mutable CString m_utf8String; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // JavaStringJSC_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp new file mode 100644 index 0000000..9fb1bf3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.cpp @@ -0,0 +1,44 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIBridgeV8.h" + +using namespace JSC::Bindings; + +JavaField::JavaField(JNIEnv* env, jobject aField) +{ + // Get field type + jobject fieldType = callJNIMethod(aField, "getType", "()Ljava/lang/Class;"); + jstring fieldTypeName = static_cast(callJNIMethod(fieldType, "getName", "()Ljava/lang/String;")); + m_type = JavaString(env, fieldTypeName); + m_JNIType = JNITypeFromClassName(m_type.UTF8String()); + + // Get field name + jstring fieldName = static_cast(callJNIMethod(aField, "getName", "()Ljava/lang/String;")); + m_name = JavaString(env, fieldName); + + m_field = new JObjectWrapper(aField); +} diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h new file mode 100644 index 0000000..23989ce --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIBridgeV8.h @@ -0,0 +1,56 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIBridgeV8_h +#define JNIBridgeV8_h + +#include "JNIBridge.h" // For JavaString +#include "JavaInstanceV8.h" // For JObjectWrapper + +namespace JSC { + +namespace Bindings { + +class JavaField { +public: + JavaField(JNIEnv*, jobject aField); + + const JavaString& name() const { return m_name; } + const char* type() const { return m_type.UTF8String(); } + + JNIType getJNIType() const { return m_JNIType; } + +private: + JavaString m_name; + JavaString m_type; + JNIType m_JNIType; + RefPtr m_field; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // JNIBridgeV8_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp new file mode 100644 index 0000000..9352983 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp @@ -0,0 +1,255 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JNIUtilityPrivate.h" + +#include "JavaInstanceV8.h" +#include "JavaNPObjectV8.h" + +namespace JSC { + +namespace Bindings { + +jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* javaClassName) +{ + jvalue result; + NPVariantType type = value.type; + + switch (jniType) { + case array_type: + case object_type: + { + result.l = static_cast(0); + + // First see if we have a Java instance. + if (type == NPVariantType_Object) { + NPObject* objectImp = NPVARIANT_TO_OBJECT(value); + if (JavaInstance* instance = ExtractJavaInstance(objectImp)) + result.l = instance->javaInstance(); + } + + // Now convert value to a string if the target type is a java.lang.string, and we're not + // converting from a Null. + if (!result.l && !strcmp(javaClassName, "java.lang.String")) { +#ifdef CONVERT_NULL_TO_EMPTY_STRING + if (type == NPVariantType_Null) { + JNIEnv* env = getJNIEnv(); + jchar buf[2]; + jobject javaString = env->functions->NewString(env, buf, 0); + result.l = javaString; + } else +#else + if (type == NPVariantType_String) +#endif + { + NPString src = NPVARIANT_TO_STRING(value); + JNIEnv* env = getJNIEnv(); + jobject javaString = env->NewStringUTF(src.UTF8Characters); + result.l = javaString; + } + } else if (!result.l) + bzero(&result, sizeof(jvalue)); // Handle it the same as a void case + } + break; + + case boolean_type: + { + if (type == NPVariantType_Bool) + result.z = NPVARIANT_TO_BOOLEAN(value); + else + bzero(&result, sizeof(jvalue)); // as void case + } + break; + + case byte_type: + { + if (type == NPVariantType_Int32) + result.b = static_cast(NPVARIANT_TO_INT32(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case char_type: + { + if (type == NPVariantType_Int32) + result.c = static_cast(NPVARIANT_TO_INT32(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case short_type: + { + if (type == NPVariantType_Int32) + result.s = static_cast(NPVARIANT_TO_INT32(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case int_type: + { + if (type == NPVariantType_Int32) + result.i = static_cast(NPVARIANT_TO_INT32(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case long_type: + { + if (type == NPVariantType_Int32) + result.j = static_cast(NPVARIANT_TO_INT32(value)); + else if (type == NPVariantType_Double) + result.j = static_cast(NPVARIANT_TO_DOUBLE(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case float_type: + { + if (type == NPVariantType_Int32) + result.f = static_cast(NPVARIANT_TO_INT32(value)); + else if (type == NPVariantType_Double) + result.f = static_cast(NPVARIANT_TO_DOUBLE(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + case double_type: + { + if (type == NPVariantType_Int32) + result.d = static_cast(NPVARIANT_TO_INT32(value)); + else if (type == NPVariantType_Double) + result.d = static_cast(NPVARIANT_TO_DOUBLE(value)); + else + bzero(&result, sizeof(jvalue)); + } + break; + + break; + + case invalid_type: + default: + case void_type: + { + bzero(&result, sizeof(jvalue)); + } + break; + } + return result; +} + + +void convertJValueToNPVariant(jvalue value, JNIType jniType, const char* javaTypeName, NPVariant* result) +{ + switch (jniType) { + case void_type: + { + VOID_TO_NPVARIANT(*result); + } + break; + + case object_type: + { + if (value.l) { + if (!strcmp(javaTypeName, "java.lang.String")) { + const char* v = getCharactersFromJString(static_cast(value.l)); + // s is freed in NPN_ReleaseVariantValue (see npruntime.cpp) + const char* s = strdup(v); + releaseCharactersForJString(static_cast(value.l), v); + STRINGZ_TO_NPVARIANT(s, *result); + } else + OBJECT_TO_NPVARIANT(JavaInstanceToNPObject(new JavaInstance(value.l)), *result); + } else + VOID_TO_NPVARIANT(*result); + } + break; + + case boolean_type: + { + BOOLEAN_TO_NPVARIANT(value.z, *result); + } + break; + + case byte_type: + { + INT32_TO_NPVARIANT(value.b, *result); + } + break; + + case char_type: + { + INT32_TO_NPVARIANT(value.c, *result); + } + break; + + case short_type: + { + INT32_TO_NPVARIANT(value.s, *result); + } + break; + + case int_type: + { + INT32_TO_NPVARIANT(value.i, *result); + } + break; + + // TODO: Check if cast to double is needed. + case long_type: + { + DOUBLE_TO_NPVARIANT(value.j, *result); + } + break; + + case float_type: + { + DOUBLE_TO_NPVARIANT(value.f, *result); + } + break; + + case double_type: + { + DOUBLE_TO_NPVARIANT(value.d, *result); + } + break; + + case invalid_type: + default: + { + VOID_TO_NPVARIANT(*result); + } + break; + } +} + +} // end of namespace Bindings + +} // end of namespace JSC diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.h new file mode 100644 index 0000000..951c1e8 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JNIUtilityPrivate.h @@ -0,0 +1,43 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JNIUtilityPrivate_h +#define JNIUtilityPrivate_h + +#include "JNIUtility.h" +#include "npruntime.h" + +namespace JSC { + +namespace Bindings { + +jvalue convertNPVariantToJValue(NPVariant, JNIType, const char* javaClassName); +void convertJValueToNPVariant(jvalue, JNIType, const char* javaClassName, NPVariant*); + +} // namespace Bindings + +} // namespace JSC + +#endif // JNIUtilityPrivate_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp new file mode 100644 index 0000000..02a57ea --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.cpp @@ -0,0 +1,111 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JavaClassV8.h" + + +using namespace JSC::Bindings; + +JavaClass::JavaClass(jobject anInstance) +{ + jobject aClass = callJNIMethod(anInstance, "getClass", "()Ljava/lang/Class;"); + + if (!aClass) { + fprintf(stderr, "%s: unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance); + return; + } + + jstring className = static_cast(callJNIMethod(aClass, "getName", "()Ljava/lang/String;")); + const char* classNameC = getCharactersFromJString(className); + m_name = strdup(classNameC); + releaseCharactersForJString(className, classNameC); + + int i; + JNIEnv* env = getJNIEnv(); + + // Get the fields + jarray fields = static_cast(callJNIMethod(aClass, "getFields", "()[Ljava/lang/reflect/Field;")); + int numFields = env->GetArrayLength(fields); + for (i = 0; i < numFields; i++) { + jobject aJField = env->GetObjectArrayElement(static_cast(fields), i); + JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor + { + m_fields.set(aField->name().UTF8String(), aField); + } + env->DeleteLocalRef(aJField); + } + + // Get the methods + jarray methods = static_cast(callJNIMethod(aClass, "getMethods", "()[Ljava/lang/reflect/Method;")); + int numMethods = env->GetArrayLength(methods); + for (i = 0; i < numMethods; i++) { + jobject aJMethod = env->GetObjectArrayElement(static_cast(methods), i); + JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor + MethodList* methodList; + { + methodList = m_methods.get(aMethod->name().UTF8String()); + if (!methodList) { + methodList = new MethodList(); + m_methods.set(aMethod->name().UTF8String(), methodList); + } + } + methodList->append(aMethod); + env->DeleteLocalRef(aJMethod); + } + env->DeleteLocalRef(fields); + env->DeleteLocalRef(methods); + env->DeleteLocalRef(aClass); +} + +JavaClass::~JavaClass() +{ + free(const_cast(m_name)); + + deleteAllValues(m_fields); + m_fields.clear(); + + MethodListMap::const_iterator end = m_methods.end(); + for (MethodListMap::const_iterator it = m_methods.begin(); it != end; ++it) { + const MethodList* methodList = it->second; + deleteAllValues(*methodList); + delete methodList; + } + m_methods.clear(); +} + +MethodList JavaClass::methodsNamed(const char* name) const +{ + MethodList* methodList = m_methods.get(name); + + if (methodList) + return *methodList; + return MethodList(); +} + +JavaField* JavaClass::fieldNamed(const char* name) const +{ + return m_fields.get(name); +} diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.h new file mode 100644 index 0000000..ae4806a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaClassV8.h @@ -0,0 +1,61 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaClassV8_h +#define JavaClassV8_h + +#include "JNIBridgeV8.h" +#include "PlatformString.h" +#include "StringHash.h" +#include +#include + +namespace JSC { + +namespace Bindings { + +typedef Vector MethodList; +typedef HashMap MethodListMap; +typedef HashMap FieldMap; + +class JavaClass { +public: + JavaClass(jobject anInstance); + ~JavaClass(); + + MethodList methodsNamed(const char* name) const; + JavaField* fieldNamed(const char* name) const; + +private: + const char* m_name; + MethodListMap m_methods; + FieldMap m_fields; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // JavaClassV8_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.cpp new file mode 100644 index 0000000..a926704 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.cpp @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "JavaInstanceV8.h" + +#include "JNIBridge.h" +#include "JNIUtilityPrivate.h" +#include "JavaClassV8.h" + +#include +#include + +#define LOG_TAG "v8binding" + +using namespace JSC::Bindings; + +JavaInstance::JavaInstance(jobject instance) +{ + m_instance = new JObjectWrapper(instance); + m_class = 0; +} + +JavaInstance::~JavaInstance() +{ + m_instance = 0; + delete m_class; +} + +JavaClass* JavaInstance::getClass() const +{ + if (!m_class) + m_class = new JavaClass(javaInstance()); + return m_class; +} + +bool JavaInstance::invokeMethod(const char* methodName, const NPVariant* args, int count, NPVariant* resultValue) +{ + VOID_TO_NPVARIANT(*resultValue); + + MethodList methodList = getClass()->methodsNamed(methodName); + + size_t numMethods = methodList.size(); + + // Try to find a good match for the overloaded method. The + // fundamental problem is that JavaScript doesn't have the + // notion of method overloading and Java does. We could + // get a bit more sophisticated and attempt to does some + // type checking as we as checking the number of parameters. + JavaMethod* aMethod; + JavaMethod* method = 0; + for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) { + aMethod = methodList[methodIndex]; + if (aMethod->numParameters() == count) { + method = aMethod; + break; + } + } + if (!method) { + LOGW("unable to find an appropiate method\n"); + return false; + } + + const JavaMethod* jMethod = static_cast(method); + + jvalue* jArgs = 0; + if (count > 0) + jArgs = static_cast(malloc(count * sizeof(jvalue))); + + for (int i = 0; i < count; i++) { + JavaParameter* aParameter = jMethod->parameterAt(i); + jArgs[i] = convertNPVariantToJValue(args[i], aParameter->getJNIType(), aParameter->type()); + } + + jvalue result; + + // The following code can be conditionally removed once we have a Tiger update that + // contains the new Java plugin. It is needed for builds prior to Tiger. + { + jobject obj = javaInstance(); + switch (jMethod->JNIReturnType()) { + case void_type: + callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case object_type: + result.l = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case boolean_type: + result.z = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case byte_type: + result.b = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case char_type: + result.c = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case short_type: + result.s = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case int_type: + result.i = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + + case long_type: + result.j = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case float_type: + result.f = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case double_type: + result.d = callJNIMethodIDA(obj, jMethod->methodID(obj), jArgs); + break; + case invalid_type: + default: + break; + } + } + + convertJValueToNPVariant(result, jMethod->JNIReturnType(), jMethod->returnType(), resultValue); + free(jArgs); + + return true; +} + +JObjectWrapper::JObjectWrapper(jobject instance) + : m_refCount(0) +{ + assert(instance); + + // Cache the JNIEnv used to get the global ref for this java instanace. + // It'll be used to delete the reference. + m_env = getJNIEnv(); + + m_instance = m_env->NewGlobalRef(instance); + + LOGV("new global ref %p for %p\n", m_instance, instance); + + if (!m_instance) + fprintf(stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance); +} + +JObjectWrapper::~JObjectWrapper() +{ + LOGV("deleting global ref %p\n", m_instance); + m_env->DeleteGlobalRef(m_instance); +} diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h new file mode 100644 index 0000000..c928c05 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaInstanceV8.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaInstanceV8_h +#define JavaInstanceV8_h + +#include "npruntime.h" + +#include +#include +#include + +using namespace WTF; + +namespace JSC { + +namespace Bindings { + +class JavaClass; + +class JObjectWrapper { +friend class RefPtr; +friend class JavaField; +friend class JavaInstance; + +public: + jobject instance() const { return m_instance; } + void setInstance(jobject instance) { m_instance = instance; } + + void ref() { m_refCount++; } + void deref() + { + if (!(--m_refCount)) + delete this; + } + +protected: + JObjectWrapper(jobject); + ~JObjectWrapper(); + + jobject m_instance; + +private: + JNIEnv* m_env; + unsigned int m_refCount; +}; + +class JavaInstance : public RefCounted { +public: + JavaInstance(jobject instance); + virtual ~JavaInstance(); + + JavaClass* getClass() const; + + bool invokeMethod(const char* name, const NPVariant* args, int argsCount, NPVariant* result); + + jobject javaInstance() const { return m_instance->m_instance; } + + // These functions are called before and after the main entry points into + // the native implementations. They can be used to establish and cleanup + // any needed state. + void begin() { virtualBegin(); } + void end() { virtualEnd(); } + +protected: + RefPtr m_instance; + mutable JavaClass* m_class; + + virtual void virtualBegin() {} + virtual void virtualEnd() {} +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // JavaInstanceV8_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp new file mode 100644 index 0000000..808de03 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp @@ -0,0 +1,168 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "config.h" +#include "JavaNPObjectV8.h" + +#include "JNIUtilityPrivate.h" +#include "JavaClassV8.h" +#include "JavaInstanceV8.h" +#include "npruntime_impl.h" + +namespace JSC { + +namespace Bindings { + +static NPObject* AllocJavaNPObject(NPP, NPClass*) +{ + JavaNPObject* obj = static_cast(malloc(sizeof(JavaNPObject))); + if (!obj) + return 0; + bzero(obj, sizeof(JavaNPObject)); + return reinterpret_cast(obj); +} + +static void FreeJavaNPObject(NPObject* npobj) +{ + JavaNPObject* obj = reinterpret_cast(npobj); + obj->m_instance = 0; // free does not call the destructor + free(obj); +} + +static NPClass JavaNPObjectClass = { + NP_CLASS_STRUCT_VERSION, + AllocJavaNPObject, // allocate, + FreeJavaNPObject, // free, + 0, // invalidate + JavaNPObjectHasMethod, + JavaNPObjectInvoke, + 0, // invokeDefault, + JavaNPObjectHasProperty, + JavaNPObjectGetProperty, + 0, // setProperty + 0, // removeProperty + 0, // enumerate + 0 // construct +}; + +NPObject* JavaInstanceToNPObject(JavaInstance* instance) +{ + JavaNPObject* object = reinterpret_cast(_NPN_CreateObject(0, &JavaNPObjectClass)); + object->m_instance = instance; + return reinterpret_cast(object); +} + +// Returns null if obj is not a wrapper of JavaInstance +JavaInstance* ExtractJavaInstance(NPObject* obj) +{ + if (obj->_class == &JavaNPObjectClass) + return reinterpret_cast(obj)->m_instance.get(); + return 0; +} + +bool JavaNPObjectHasMethod(NPObject* obj, NPIdentifier identifier) +{ + JavaInstance* instance = ExtractJavaInstance(obj); + if (!instance) + return false; + NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); + if (!name) + return false; + + instance->begin(); + bool result = (instance->getClass()->methodsNamed(name).size() > 0); + instance->end(); + + // TODO: use NPN_MemFree + free(name); + + return result; +} + +bool JavaNPObjectInvoke(NPObject* obj, NPIdentifier identifier, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + JavaInstance* instance = ExtractJavaInstance(obj); + if (!instance) + return false; + NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); + if (!name) + return false; + + instance->begin(); + bool r = instance->invokeMethod(name, args, argCount, result); + instance->end(); + + // TODO: use NPN_MemFree + free(name); + return r; +} + +bool JavaNPObjectHasProperty(NPObject* obj, NPIdentifier identifier) +{ + JavaInstance* instance = ExtractJavaInstance(obj); + if (!instance) + return false; + NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); + if (!name) + return false; + instance->begin(); + bool result = instance->getClass()->fieldNamed(name); + instance->end(); + free(name); + return result; +} + +bool JavaNPObjectGetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* result) +{ + VOID_TO_NPVARIANT(*result); + JavaInstance* instance = ExtractJavaInstance(obj); + if (!instance) + return false; + NPUTF8* name = _NPN_UTF8FromIdentifier(identifier); + if (!name) + return false; + + instance->begin(); + JavaField* field = instance->getClass()->fieldNamed(name); + instance->end(); + free(name); // TODO: use NPN_MemFree + + if (!field) + return false; + + jvalue value = getJNIField(instance->javaInstance(), + field->getJNIType(), + field->name().UTF8String(), + field->type()); + + convertJValueToNPVariant(value, field->getJNIType(), field->type(), result); + + return true; +} + +} // namespace Bindings + +} // namespace JSC diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h new file mode 100644 index 0000000..31b0ac7 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaNPObjectV8.h @@ -0,0 +1,56 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaNPObjectV8_h +#define JavaNPObjectV8_h + +#include "npruntime.h" +#include + + +namespace JSC { + +namespace Bindings { + +class JavaInstance; + +struct JavaNPObject { + NPObject m_object; + RefPtr m_instance; +}; + +NPObject* JavaInstanceToNPObject(JavaInstance*); +JavaInstance* ExtractJavaInstance(NPObject*); + +bool JavaNPObjectHasMethod(NPObject*, NPIdentifier name); +bool JavaNPObjectInvoke(NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result); +bool JavaNPObjectHasProperty(NPObject*, NPIdentifier name); +bool JavaNPObjectGetProperty(NPObject*, NPIdentifier name, NPVariant* result); + +} // namespace Bindings + +} // namespace JSC + +#endif // JavaNPObjectV8_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaStringV8.h b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaStringV8.h new file mode 100644 index 0000000..08d4b95 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jni/v8/JavaStringV8.h @@ -0,0 +1,61 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef JavaStringV8_h +#define JavaStringV8_h + +#include "CString.h" +#include "JNIUtility.h" + + +namespace JSC { + +namespace Bindings { + +class JavaStringImpl { +public: + void init() {} + + void init(JNIEnv* e, jstring s) + { + int size = e->GetStringLength(s); + const char* cs = getCharactersFromJStringInEnv(e, s); + m_utf8String = WebCore::CString(cs, size); + releaseCharactersForJStringInEnv(e, s, cs); + } + + const char* UTF8String() const { return m_utf8String.data(); } + const jchar* uchars() const { return 0; } // Not implemented + int length() const { return m_utf8String.length(); } + +private: + WebCore::CString m_utf8String; +}; + +} // namespace Bindings + +} // namespace JSC + +#endif // JavaStringV8_h diff --git a/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp b/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp new file mode 100644 index 0000000..ed582d3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "BridgeJSC.h" + +#include "runtime_object.h" +#include "runtime_root.h" +#include + +#if PLATFORM(QT) +#include "qt_instance.h" +#endif + +namespace JSC { + +namespace Bindings { + +Array::Array(PassRefPtr rootObject) + : m_rootObject(rootObject) +{ + ASSERT(m_rootObject); +} + +Array::~Array() +{ +} + +Instance::Instance(PassRefPtr rootObject) + : m_rootObject(rootObject) + , m_runtimeObject(0) +{ + ASSERT(m_rootObject); +} + +Instance::~Instance() +{ + ASSERT(!m_runtimeObject); +} + +static KJSDidExecuteFunctionPtr s_didExecuteFunction; + +void Instance::setDidExecuteFunction(KJSDidExecuteFunctionPtr func) +{ + s_didExecuteFunction = func; +} + +KJSDidExecuteFunctionPtr Instance::didExecuteFunction() +{ + return s_didExecuteFunction; +} + +void Instance::begin() +{ + virtualBegin(); +} + +void Instance::end() +{ + virtualEnd(); +} + +RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec) +{ + ASSERT(m_rootObject); + ASSERT(m_rootObject->isValid()); + if (m_runtimeObject) + return m_runtimeObject; + JSLock lock(SilenceAssertionsOnly); + m_runtimeObject = newRuntimeObject(exec); + m_rootObject->addRuntimeObject(m_runtimeObject); + return m_runtimeObject; +} + +RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec) +{ + JSLock lock(SilenceAssertionsOnly); + return new (exec)RuntimeObjectImp(exec, this); +} + +void Instance::willDestroyRuntimeObject() +{ + ASSERT(m_rootObject); + ASSERT(m_rootObject->isValid()); + ASSERT(m_runtimeObject); + m_rootObject->removeRuntimeObject(m_runtimeObject); + m_runtimeObject = 0; +} + +void Instance::willInvalidateRuntimeObject() +{ + ASSERT(m_runtimeObject); + m_runtimeObject = 0; +} + +RootObject* Instance::rootObject() const +{ + return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0; +} + +} // namespace Bindings + +} // namespace JSC diff --git a/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h b/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h new file mode 100644 index 0000000..8e2cb2b --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/jsc/BridgeJSC.h @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BridgeJSC_h +#define BridgeJSC_h + +#if USE(JSC) + +#include +#include +#include +#include + +namespace JSC { + +class ArgList; +class Identifier; +class JSGlobalObject; +class PropertyNameArray; +class RuntimeObjectImp; + +namespace Bindings { + +class Instance; +class Method; +class RootObject; + +typedef Vector MethodList; + +class Field { +public: + virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0; + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0; + + virtual ~Field() { } +}; + +class Class : public Noncopyable { +public: + virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0; + virtual Field* fieldNamed(const Identifier&, Instance*) const = 0; + virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); } + + virtual ~Class() { } +}; + +typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject); + +class Instance : public RefCounted { +public: + Instance(PassRefPtr); + + static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func); + static KJSDidExecuteFunctionPtr didExecuteFunction(); + + // These functions are called before and after the main entry points into + // the native implementations. They can be used to establish and cleanup + // any needed state. + void begin(); + void end(); + + virtual Class* getClass() const = 0; + RuntimeObjectImp* createRuntimeObject(ExecState*); + void willInvalidateRuntimeObject(); + void willDestroyRuntimeObject(); + + // Returns false if the value was not set successfully. + virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; } + + virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0; + + virtual bool supportsInvokeDefaultMethod() const { return false; } + virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); } + + virtual bool supportsConstruct() const { return false; } + virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); } + + virtual void getPropertyNames(ExecState*, PropertyNameArray&) { } + + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0; + + virtual JSValue valueOf(ExecState* exec) const = 0; + + RootObject* rootObject() const; + + virtual ~Instance(); + + virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; } + virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; } + virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { } + +protected: + virtual void virtualBegin() { } + virtual void virtualEnd() { } + virtual RuntimeObjectImp* newRuntimeObject(ExecState*); + + RefPtr m_rootObject; + +private: + RuntimeObjectImp* m_runtimeObject; +}; + +class Array : public Noncopyable { +public: + Array(PassRefPtr); + virtual ~Array(); + + virtual void setValueAt(ExecState*, unsigned index, JSValue) const = 0; + virtual JSValue valueAt(ExecState*, unsigned index) const = 0; + virtual unsigned int getLength() const = 0; + +protected: + RefPtr m_rootObject; +}; + +const char* signatureForParameters(const ArgList&); + +typedef HashMap, MethodList*> MethodListMap; +typedef HashMap, Method*> MethodMap; +typedef HashMap, Field*> FieldMap; + +} // namespace Bindings + +} // namespace JSC + +#endif // USE(JSC) + +#endif diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h index dc6b130..b7a04cf 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_class.h @@ -20,8 +20,7 @@ #ifndef BINDINGS_QT_CLASS_H_ #define BINDINGS_QT_CLASS_H_ -#include "runtime.h" - +#include "Bridge.h" #include "qglobal.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index ec362ec..fcfe1cd 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -58,6 +58,14 @@ public: instance->markAggregate(markStack); } + static PassRefPtr createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + } + +protected: + static const unsigned StructureFlags = RuntimeObjectImp::StructureFlags | OverridesMarkChildren; + private: virtual const ClassInfo* classInfo() const { return &s_info; } }; diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 0afc6c7..1fc253a 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -20,11 +20,11 @@ #ifndef BINDINGS_QT_INSTANCE_H_ #define BINDINGS_QT_INSTANCE_H_ -#include -#include "runtime.h" +#include "Bridge.h" #include "runtime_root.h" -#include +#include #include +#include #include namespace JSC { diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp new file mode 100644 index 0000000..5978804 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.cpp @@ -0,0 +1,353 @@ +/* + * 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 Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "config.h" +#include "qt_pixmapruntime.h" + +#include "CachedImage.h" +#include "HTMLImageElement.h" +#include "JSGlobalObject.h" +#include "JSHTMLImageElement.h" +#include "JSLock.h" +#include "ObjectPrototype.h" +#include "StillImageQt.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace WebCore; +namespace JSC { + +namespace Bindings { + +class QtPixmapClass : public Class { +public: + QtPixmapClass(); + virtual MethodList methodsNamed(const Identifier&, Instance*) const; + virtual Field* fieldNamed(const Identifier&, Instance*) const; +}; + + +class QtPixmapWidthField : public Field { +public: + static const char* name() { return "width"; } + virtual JSValue valueFromInstance(ExecState* exec, const Instance* instance) const + { + return jsNumber(exec, static_cast(instance)->width()); + } + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const {} +}; + +class QtPixmapHeightField : public Field { +public: + static const char* name() { return "height"; } + virtual JSValue valueFromInstance(ExecState* exec, const Instance* instance) const + { + return jsNumber(exec, static_cast(instance)->height()); + } + virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const {} +}; + +class QtPixmapRuntimeMethod : public Method { +public: + virtual int numParameters() const + { + return 0; + } + virtual JSValue invoke(ExecState* exec, QtPixmapInstance*, const ArgList&) = 0; + +}; + +// this function receives an HTML image element as a parameter, makes it display the pixmap/image from Qt +class QtPixmapAssignToElementMethod : public QtPixmapRuntimeMethod { +public: + static const char* name() { return "assignToHTMLImageElement"; } + JSValue invoke(ExecState* exec, QtPixmapInstance* instance, const ArgList& args) + { + if (!args.size()) + return jsUndefined(); + + JSObject* objectArg = args.at(0).toObject(exec); + if (!objectArg) + return jsUndefined(); + + if (!objectArg->inherits(&JSHTMLImageElement::s_info)) + return jsUndefined(); + + // we now know that we have a valid element as the argument, we can attach the pixmap to it. + PassRefPtr stillImage = WebCore::StillImage::create(instance->toPixmap()); + HTMLImageElement* imageElement = static_cast(static_cast(objectArg)->impl()); + imageElement->setCachedImage(new CachedImage(stillImage.get())); + JSDOMGlobalObject* global = static_cast(instance->rootObject()->globalObject()); + toJS(exec, global, imageElement->document()); + return jsUndefined(); + } + + virtual int numParameters() const + { + return 1; + } +}; + +// this function encodes the image to a dataUrl, to be used in background etc. Note: very slow. +class QtPixmapToDataUrlMethod : public QtPixmapRuntimeMethod { +public: + static const char* name() { return "toDataUrl"; } + JSValue invoke(ExecState* exec, QtPixmapInstance* instance, const ArgList&) + { + QByteArray byteArray; + QBuffer buffer(&byteArray); + instance->toImage().save(&buffer, "PNG"); + const QString encodedString = QString("data:image/png;base64,") + byteArray.toBase64(); + const UString ustring((UChar*)encodedString.utf16(), encodedString.length()); + return jsString(exec, ustring); + } +}; + +class QtPixmapToStringMethod : public QtPixmapRuntimeMethod { + public: + static const char* name() { return "toString"; } + JSValue invoke(ExecState* exec, QtPixmapInstance* instance, const ArgList&) + { + return instance->valueOf(exec); + } +}; + +struct QtPixmapMetaData { + QtPixmapToDataUrlMethod toDataUrlMethod; + QtPixmapAssignToElementMethod assignToElementMethod; + QtPixmapToStringMethod toStringMethod; + QtPixmapHeightField heightField; + QtPixmapWidthField widthField; + QtPixmapClass cls; +} qt_pixmap_metaData; + +// Derived RuntimeObject +class QtPixmapRuntimeObjectImp : public RuntimeObjectImp { +public: + QtPixmapRuntimeObjectImp(ExecState*, PassRefPtr); + + static const ClassInfo s_info; + + static PassRefPtr createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); + } + +protected: + static const unsigned StructureFlags = RuntimeObjectImp::StructureFlags | OverridesMarkChildren; + +private: + virtual const ClassInfo* classInfo() const { return &s_info; } +}; + +QtPixmapRuntimeObjectImp::QtPixmapRuntimeObjectImp(ExecState* exec, PassRefPtr instance) + : RuntimeObjectImp(exec, WebCore::deprecatedGetDOMStructure(exec), instance) +{ +} + +const ClassInfo QtPixmapRuntimeObjectImp::s_info = { "QtPixmapRuntimeObject", &RuntimeObjectImp::s_info, 0, 0 }; + +QtPixmapClass::QtPixmapClass() +{ +} + + +Class* QtPixmapInstance::getClass() const +{ + return &qt_pixmap_metaData.cls; +} + +JSValue QtPixmapInstance::invokeMethod(ExecState* exec, const MethodList& methods, const ArgList& args) +{ + if (methods.size() == 1) { + QtPixmapRuntimeMethod* method = static_cast(methods[0]); + return method->invoke(exec, this, args); + } + return jsUndefined(); +} + +MethodList QtPixmapClass::methodsNamed(const Identifier& identifier, Instance*) const +{ + MethodList methods; + if (identifier == QtPixmapToDataUrlMethod::name()) + methods.append(&qt_pixmap_metaData.toDataUrlMethod); + else if (identifier == QtPixmapAssignToElementMethod::name()) + methods.append(&qt_pixmap_metaData.assignToElementMethod); + else if (identifier == QtPixmapToStringMethod::name()) + methods.append(&qt_pixmap_metaData.toStringMethod); + return methods; +} + +Field* QtPixmapClass::fieldNamed(const Identifier& identifier, Instance*) const +{ + if (identifier == QtPixmapWidthField::name()) + return &qt_pixmap_metaData.widthField; + if (identifier == QtPixmapHeightField::name()) + return &qt_pixmap_metaData.heightField; + return 0; +} + +void QtPixmapInstance::getPropertyNames(ExecState*exec, PropertyNameArray& arr) +{ + arr.add(Identifier(exec, UString(QtPixmapToDataUrlMethod::name()))); + arr.add(Identifier(exec, UString(QtPixmapAssignToElementMethod::name()))); + arr.add(Identifier(exec, UString(QtPixmapToStringMethod::name()))); + arr.add(Identifier(exec, UString(QtPixmapWidthField::name()))); + arr.add(Identifier(exec, UString(QtPixmapHeightField::name()))); +} + +JSValue QtPixmapInstance::defaultValue(ExecState* exec, PreferredPrimitiveType ptype) const +{ + if (ptype == PreferNumber) { + return jsBoolean( + (data.type() == static_cast(qMetaTypeId()) && !(data.value()).isNull()) + || (data.type() == static_cast(qMetaTypeId()) && !data.value().isNull())); + } + + if (ptype == PreferString) + return valueOf(exec); + + return jsUndefined(); +} + +JSValue QtPixmapInstance::valueOf(ExecState* exec) const +{ + const QString stringValue = QString("[Qt Native Pixmap %1,%2]").arg(width()).arg(height()); + UString ustring((UChar*)stringValue.utf16(), stringValue.length()); + return jsString(exec, ustring); +} + +QtPixmapInstance::QtPixmapInstance(PassRefPtr rootObj, const QVariant& d) + :Instance(rootObj), data(d) +{ +} + +int QtPixmapInstance::width() const +{ + if (data.type() == static_cast(qMetaTypeId())) + return data.value().width(); + if (data.type() == static_cast(qMetaTypeId())) + return data.value().width(); + return 0; +} + +int QtPixmapInstance::height() const +{ + if (data.type() == static_cast(qMetaTypeId())) + return data.value().height(); + if (data.type() == static_cast(qMetaTypeId())) + return data.value().height(); + return 0; +} + +QPixmap QtPixmapInstance::toPixmap() +{ + if (data.type() == static_cast(qMetaTypeId())) + return data.value(); + + if (data.type() == static_cast(qMetaTypeId())) { + const QPixmap pixmap = QPixmap::fromImage(data.value()); + data = QVariant::fromValue(pixmap); + return pixmap; + } + + return QPixmap(); +} + +QImage QtPixmapInstance::toImage() +{ + if (data.type() == static_cast(qMetaTypeId())) + return data.value(); + + if (data.type() == static_cast(qMetaTypeId())) { + const QImage image = data.value().toImage(); + data = QVariant::fromValue(image); + return image; + } + + return QImage(); +} + +QVariant QtPixmapInstance::variantFromObject(JSObject* object, QMetaType::Type hint) +{ + if (!object) + goto returnEmptyVariant; + + if (object->inherits(&JSHTMLImageElement::s_info)) { + JSHTMLImageElement* elementJSWrapper = static_cast(object); + HTMLImageElement* imageElement = static_cast(elementJSWrapper->impl()); + + if (!imageElement) + goto returnEmptyVariant; + + CachedImage* cachedImage = imageElement->cachedImage(); + if (!cachedImage) + goto returnEmptyVariant; + + Image* image = cachedImage->image(); + if (!image) + goto returnEmptyVariant; + + QPixmap* pixmap = image->nativeImageForCurrentFrame(); + if (!pixmap) + goto returnEmptyVariant; + + return (hint == static_cast(qMetaTypeId())) + ? QVariant::fromValue(*pixmap) + : QVariant::fromValue(pixmap->toImage()); + } + + if (object->inherits(&QtPixmapRuntimeObjectImp::s_info)) { + QtPixmapRuntimeObjectImp* imp = static_cast(object); + QtPixmapInstance* instance = static_cast(imp->getInternalInstance()); + if (!instance) + goto returnEmptyVariant; + + if (hint == qMetaTypeId()) + return QVariant::fromValue(instance->toPixmap()); + + if (hint == qMetaTypeId()) + return QVariant::fromValue(instance->toImage()); + } + +returnEmptyVariant: + if (hint == qMetaTypeId()) + return QVariant::fromValue(QPixmap()); + if (hint == qMetaTypeId()) + return QVariant::fromValue(QImage()); + return QVariant(); +} +JSObject* QtPixmapInstance::createRuntimeObject(ExecState* exec, PassRefPtr root, const QVariant& data) +{ + JSLock lock(SilenceAssertionsOnly); + return new(exec) QtPixmapRuntimeObjectImp(exec, new QtPixmapInstance(root, data)); +} + +bool QtPixmapInstance::canHandle(QMetaType::Type hint) +{ + return hint == qMetaTypeId() || hint == qMetaTypeId(); +} + +} + +} diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h new file mode 100644 index 0000000..5455298 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_pixmapruntime.h @@ -0,0 +1,52 @@ +/* + * 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 Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef qt_pixmapruntime_h +#define qt_pixmapruntime_h + +#include "Bridge.h" +#include + +namespace JSC { + +namespace Bindings { + +class QtPixmapInstance : public Instance { + QVariant data; +public: + QtPixmapInstance(PassRefPtr rootObj, const QVariant& newData); + virtual Class* getClass() const; + virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args); + virtual void getPropertyNames(ExecState*, PropertyNameArray&); + + virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; + virtual JSValue valueOf(ExecState* exec) const; + int width() const; + int height() const; + QPixmap toPixmap(); + QImage toImage(); + static JSObject* createRuntimeObject(ExecState*, PassRefPtr, const QVariant&); + static QVariant variantFromObject(JSObject*, QMetaType::Type hint); + static bool canHandle(QMetaType::Type hint); +}; + +} + +} +#endif diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index ee7aa1a..ada9f01 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -29,7 +29,10 @@ #include "JSArray.h" #include "JSByteArray.h" #include "JSDOMBinding.h" +#include "JSDOMWindow.h" +#include #include "JSGlobalObject.h" +#include "JSHTMLElement.h" #include "JSLock.h" #include "JSObject.h" #include "ObjectPrototype.h" @@ -43,10 +46,10 @@ #include "qobject.h" #include "qstringlist.h" #include "qt_instance.h" +#include "qt_pixmapruntime.h" #include "qvarlengtharray.h" -#include +#include "qwebelement.h" #include -#include #include #include #include @@ -114,6 +117,21 @@ QDebug operator<<(QDebug dbg, const JSRealType &c) } #endif +// this is here as a proxy, so we'd have a class to friend in QWebElement, +// as getting/setting a WebCore in QWebElement is private +class QtWebElementRuntime { +public: + static QWebElement create(Element* element) + { + return QWebElement(element); + } + + static Element* get(const QWebElement& element) + { + return element.m_element; + } +}; + static JSRealType valueRealType(ExecState* exec, JSValue val) { if (val.isNumber()) @@ -457,8 +475,8 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type case QMetaType::QTime: if (type == Date) { DateInstance* date = static_cast(object); - WTF::GregorianDateTime gdt; - WTF::msToGregorianDateTime(date->internalNumber(), true, gdt); + GregorianDateTime gdt; + msToGregorianDateTime(exec, date->internalNumber(), true, gdt); if (hint == QMetaType::QDateTime) { ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC); dist = 0; @@ -471,8 +489,8 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } else if (type == Number) { double b = value.toNumber(exec); - WTF::GregorianDateTime gdt; - msToGregorianDateTime(b, true, gdt); + GregorianDateTime gdt; + msToGregorianDateTime(exec, b, true, gdt); if (hint == QMetaType::QDateTime) { ret = QDateTime(QDate(gdt.year + 1900, gdt.month + 1, gdt.monthDay), QTime(gdt.hour, gdt.minute, gdt.second), Qt::UTC); dist = 6; @@ -720,6 +738,13 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } } break; + } else if (QtPixmapInstance::canHandle(static_cast(hint))) { + ret = QtPixmapInstance::variantFromObject(object, static_cast(hint)); + } else if (hint == (QMetaType::Type) qMetaTypeId()) { + if (object && object->inherits(&JSHTMLElement::s_info)) + ret = QVariant::fromValue(QtWebElementRuntime::create((static_cast(object))->impl())); + else + ret = QVariant::fromValue(QWebElement()); } else if (hint == (QMetaType::Type) qMetaTypeId()) { if (value.isUndefinedOrNull()) { if (distance) @@ -824,7 +849,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr root, con } // Dates specified this way are in local time (we convert DateTimes above) - WTF::GregorianDateTime dt; + GregorianDateTime dt; dt.year = date.year() - 1900; dt.month = date.month() - 1; dt.monthDay = date.day(); @@ -832,7 +857,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr root, con dt.minute = time.minute(); dt.second = time.second(); dt.isDST = -1; - double ms = WTF::gregorianDateTimeToMS(dt, time.msec(), /*inputIsUTC*/ false); + double ms = gregorianDateTimeToMS(exec, dt, time.msec(), /*inputIsUTC*/ false); return new (exec) DateInstance(exec, trunc(ms)); } @@ -849,6 +874,20 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr root, con return QtInstance::getQtInstance(obj, root, QScriptEngine::QtOwnership)->createRuntimeObject(exec); } + if (QtPixmapInstance::canHandle(static_cast(variant.type()))) + return QtPixmapInstance::createRuntimeObject(exec, root, variant); + + if (type == qMetaTypeId()) { + if (!root->globalObject()->inherits(&JSDOMWindow::s_info)) + return jsUndefined(); + + Document* document = (static_cast(root->globalObject()))->impl()->document(); + if (!document) + return jsUndefined(); + + return toJS(exec, toJSDOMGlobalObject(document, exec), QtWebElementRuntime::get(variant.value())); + } + if (type == QMetaType::QVariantMap) { // create a new object, and stuff properties into it JSObject* ret = constructEmptyObject(exec); @@ -1395,6 +1434,43 @@ bool QtRuntimeMetaMethod::getOwnPropertySlot(ExecState* exec, const Identifier& return QtRuntimeMethod::getOwnPropertySlot(exec, propertyName, slot); } +bool QtRuntimeMetaMethod::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + if (propertyName == "connect") { + PropertySlot slot; + slot.setCustom(this, connectGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly | DontEnum); + return true; + } + + if (propertyName == "disconnect") { + PropertySlot slot; + slot.setCustom(this, disconnectGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly | DontEnum); + return true; + } + + if (propertyName == exec->propertyNames().length) { + PropertySlot slot; + slot.setCustom(this, lengthGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly | DontEnum); + return true; + } + + return QtRuntimeMethod::getOwnPropertyDescriptor(exec, propertyName, descriptor); +} + +void QtRuntimeMetaMethod::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +{ + if (mode == IncludeDontEnumProperties) { + propertyNames.add(Identifier(exec, "connect")); + propertyNames.add(Identifier(exec, "disconnect")); + propertyNames.add(exec->propertyNames().length); + } + + QtRuntimeMethod::getOwnPropertyNames(exec, propertyNames, mode); +} + JSValue QtRuntimeMetaMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) { // QtScript always returns 0 @@ -1581,6 +1657,26 @@ bool QtRuntimeConnectionMethod::getOwnPropertySlot(ExecState* exec, const Identi return QtRuntimeMethod::getOwnPropertySlot(exec, propertyName, slot); } +bool QtRuntimeConnectionMethod::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + if (propertyName == exec->propertyNames().length) { + PropertySlot slot; + slot.setCustom(this, lengthGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly | DontEnum); + return true; + } + + return QtRuntimeMethod::getOwnPropertyDescriptor(exec, propertyName, descriptor); +} + +void QtRuntimeConnectionMethod::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +{ + if (mode == IncludeDontEnumProperties) + propertyNames.add(exec->propertyNames().length); + + QtRuntimeMethod::getOwnPropertyNames(exec, propertyNames, mode); +} + JSValue QtRuntimeConnectionMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot&) { // we have one formal argument, and one optional @@ -1744,7 +1840,7 @@ template QtArray::~QtArray () template RootObject* QtArray::rootObject() const { - return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; + return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0; } template void QtArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h index f2ce954..c3fa8b4 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h @@ -20,9 +20,9 @@ #ifndef BINDINGS_QT_RUNTIME_H_ #define BINDINGS_QT_RUNTIME_H_ +#include "Bridge.h" #include "Completion.h" #include "Protect.h" -#include "runtime.h" #include "runtime_method.h" #include @@ -151,10 +151,12 @@ public: static PassRefPtr createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren)); + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | InternalFunction::StructureFlags | OverridesMarkChildren; + QtRuntimeMethodData *d_func() const {return d_ptr;} QtRuntimeMethod(QtRuntimeMethodData *dd, ExecState *exec, const Identifier &n, PassRefPtr inst); QtRuntimeMethodData *d_ptr; @@ -166,6 +168,8 @@ public: QtRuntimeMetaMethod(ExecState *exec, const Identifier &n, PassRefPtr inst, int index, const QByteArray& signature, bool allowPrivate); virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); virtual void markChildren(MarkStack& markStack); @@ -187,6 +191,8 @@ public: QtRuntimeConnectionMethod(ExecState *exec, const Identifier &n, bool isConnect, PassRefPtr inst, int index, const QByteArray& signature ); virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); protected: QtRuntimeConnectionMethodData* d_func() const {return reinterpret_cast(d_ptr);} diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime.cpp deleted file mode 100644 index eac8586..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "runtime.h" - -#include "runtime_object.h" -#include "runtime_root.h" -#include - -#if PLATFORM(QT) -#include "qt_instance.h" -#endif - -namespace JSC { namespace Bindings { - -Array::Array(PassRefPtr rootObject) - : _rootObject(rootObject) -{ - ASSERT(_rootObject); -} - -Array::~Array() -{ -} - -Instance::Instance(PassRefPtr rootObject) - : _rootObject(rootObject) - , m_runtimeObject(0) -{ - ASSERT(_rootObject); -} - -Instance::~Instance() -{ - ASSERT(!m_runtimeObject); -} - -static KJSDidExecuteFunctionPtr s_didExecuteFunction; - -void Instance::setDidExecuteFunction(KJSDidExecuteFunctionPtr func) -{ - s_didExecuteFunction = func; -} - -KJSDidExecuteFunctionPtr Instance::didExecuteFunction() -{ - return s_didExecuteFunction; -} - -void Instance::begin() -{ - virtualBegin(); -} - -void Instance::end() -{ - virtualEnd(); -} - -RuntimeObjectImp* Instance::createRuntimeObject(ExecState* exec) -{ - ASSERT(_rootObject); - ASSERT(_rootObject->isValid()); - if (m_runtimeObject) - return m_runtimeObject; - JSLock lock(SilenceAssertionsOnly); - m_runtimeObject = newRuntimeObject(exec); - _rootObject->addRuntimeObject(m_runtimeObject); - return m_runtimeObject; -} - -RuntimeObjectImp* Instance::newRuntimeObject(ExecState* exec) -{ - JSLock lock(SilenceAssertionsOnly); - return new (exec) RuntimeObjectImp(exec, this); -} - -void Instance::willDestroyRuntimeObject() -{ - ASSERT(_rootObject); - ASSERT(_rootObject->isValid()); - ASSERT(m_runtimeObject); - _rootObject->removeRuntimeObject(m_runtimeObject); - m_runtimeObject = 0; -} - -void Instance::willInvalidateRuntimeObject() -{ - ASSERT(m_runtimeObject); - m_runtimeObject = 0; -} - -RootObject* Instance::rootObject() const -{ - return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0; -} - -} } // namespace JSC::Bindings diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime.h b/src/3rdparty/webkit/WebCore/bridge/runtime.h deleted file mode 100644 index 6682a97..0000000 --- a/src/3rdparty/webkit/WebCore/bridge/runtime.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JAVASCRIPTCORE_BINDINGS_RUNTIME_H -#define JAVASCRIPTCORE_BINDINGS_RUNTIME_H - -#include -#include -#include -#include - -namespace JSC { - -class ArgList; -class Identifier; -class JSGlobalObject; -class PropertyNameArray; -class RuntimeObjectImp; - -namespace Bindings { - -class Instance; -class Method; -class RootObject; - -typedef Vector MethodList; - -class Field { -public: - virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0; - virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0; - - virtual ~Field() { } -}; - -class Method : public Noncopyable { -public: - virtual int numParameters() const = 0; - - virtual ~Method() { } -}; - -class Class : public Noncopyable { -public: - virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0; - virtual Field* fieldNamed(const Identifier&, Instance*) const = 0; - virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); } - - virtual ~Class() { } -}; - -typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject); - -class Instance : public RefCounted { -public: - Instance(PassRefPtr); - - static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func); - static KJSDidExecuteFunctionPtr didExecuteFunction(); - - // These functions are called before and after the main entry points into - // the native implementations. They can be used to establish and cleanup - // any needed state. - void begin(); - void end(); - - virtual Class* getClass() const = 0; - RuntimeObjectImp* createRuntimeObject(ExecState*); - void willInvalidateRuntimeObject(); - void willDestroyRuntimeObject(); - - // Returns false if the value was not set successfully. - virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; } - - virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0; - - virtual bool supportsInvokeDefaultMethod() const { return false; } - virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); } - - virtual bool supportsConstruct() const { return false; } - virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); } - - virtual void getPropertyNames(ExecState*, PropertyNameArray&) { } - - virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0; - - virtual JSValue valueOf(ExecState* exec) const = 0; - - RootObject* rootObject() const; - - virtual ~Instance(); - - virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; } - virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; } - virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { } - -protected: - virtual void virtualBegin() { } - virtual void virtualEnd() { } - virtual RuntimeObjectImp* newRuntimeObject(ExecState*); - - RefPtr _rootObject; - -private: - RuntimeObjectImp* m_runtimeObject; -}; - -class Array : public Noncopyable { -public: - Array(PassRefPtr); - virtual ~Array(); - - virtual void setValueAt(ExecState *, unsigned index, JSValue) const = 0; - virtual JSValue valueAt(ExecState *, unsigned index) const = 0; - virtual unsigned int getLength() const = 0; - -protected: - RefPtr _rootObject; -}; - -const char *signatureForParameters(const ArgList&); - -typedef HashMap, MethodList*> MethodListMap; -typedef HashMap, Method*> MethodMap; -typedef HashMap, Field*> FieldMap; - -} // namespace Bindings - -} // namespace JSC - -#endif diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp index feadb07..9e8da85 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_array.cpp @@ -28,6 +28,7 @@ #include #include +#include #include "JSDOMBinding.h" using namespace WebCore; @@ -56,6 +57,18 @@ JSValue RuntimeArray::indexGetter(ExecState* exec, const Identifier&, const Prop return thisObj->getConcreteArray()->valueAt(exec, slot.index()); } +void RuntimeArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) +{ + unsigned length = getLength(); + for (unsigned i = 0; i < length; ++i) + propertyNames.add(Identifier::from(exec, i)); + + if (mode == IncludeDontEnumProperties) + propertyNames.add(exec->propertyNames().length); + + JSObject::getOwnPropertyNames(exec, propertyNames, mode); +} + bool RuntimeArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().length) { diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_array.h b/src/3rdparty/webkit/WebCore/bridge/runtime_array.h index 1218b8c..6c6cacd 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_array.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_array.h @@ -26,7 +26,7 @@ #ifndef RUNTIME_ARRAY_H_ #define RUNTIME_ARRAY_H_ -#include "runtime.h" +#include "Bridge.h" #include namespace JSC { @@ -34,7 +34,8 @@ namespace JSC { class RuntimeArray : public JSObject { public: RuntimeArray(ExecState*, Bindings::Array*); - + + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState *, const Identifier&, PropertyDescriptor&); @@ -59,7 +60,7 @@ public: static PassRefPtr createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } private: diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_method.h b/src/3rdparty/webkit/WebCore/bridge/runtime_method.h index 9676048..914ab00 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_method.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_method.h @@ -26,7 +26,7 @@ #ifndef RUNTIME_FUNCTION_H_ #define RUNTIME_FUNCTION_H_ -#include "runtime.h" +#include "Bridge.h" #include #include #include @@ -47,7 +47,7 @@ public: static PassRefPtr createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } private: diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp index 9583fb2..26b85f9 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.cpp @@ -302,7 +302,7 @@ ConstructType RuntimeObjectImp::getConstructData(ConstructData& constructData) return ConstructTypeHost; } -void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +void RuntimeObjectImp::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode) { if (!m_instance) { throwInvalidAccessError(exec); @@ -316,11 +316,6 @@ void RuntimeObjectImp::getPropertyNames(ExecState* exec, PropertyNameArray& prop instance->end(); } -void RuntimeObjectImp::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) -{ - getOwnPropertyNames(exec, propertyNames); -} - JSObject* RuntimeObjectImp::throwInvalidAccessError(ExecState* exec) { return throwError(exec, ReferenceError, "Trying to access object from destroyed plug-in."); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h index 391e078..ef5a2f7 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_object.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_object.h @@ -26,7 +26,7 @@ #ifndef KJS_RUNTIME_OBJECT_H #define KJS_RUNTIME_OBJECT_H -#include "runtime.h" +#include "Bridge.h" #include namespace JSC { @@ -44,8 +44,7 @@ public: virtual CallType getCallData(CallData&); virtual ConstructType getConstructData(ConstructData&); - virtual void getPropertyNames(ExecState*, PropertyNameArray&); - virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&); + virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); void invalidate(); @@ -62,7 +61,7 @@ public: static PassRefPtr createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); } protected: diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp b/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp index 0e9bf74..b179d56 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_root.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "runtime_root.h" -#include "runtime.h" +#include "Bridge.h" #include "runtime_object.h" #include #include @@ -71,6 +71,10 @@ RootObject* findRootObject(JSGlobalObject* globalObject) return 0; } +RootObject::InvalidationCallback::~InvalidationCallback() +{ +} + PassRefPtr RootObject::create(const void* nativeHandle, JSGlobalObject* globalObject) { return adoptRef(new RootObject(nativeHandle, globalObject)); @@ -109,6 +113,14 @@ void RootObject::invalidate() m_nativeHandle = 0; m_globalObject = 0; + { + HashSet::iterator end = m_invalidationCallbacks.end(); + for (HashSet::iterator iter = m_invalidationCallbacks.begin(); iter != end; ++iter) + (**iter)(this); + + m_invalidationCallbacks.clear(); + } + ProtectCountSet::iterator end = m_protectCountSet.end(); for (ProtectCountSet::iterator it = m_protectCountSet.begin(); it != end; ++it) JSC::gcUnprotect(it->first); diff --git a/src/3rdparty/webkit/WebCore/bridge/runtime_root.h b/src/3rdparty/webkit/WebCore/bridge/runtime_root.h index fdd73c4..a81afb8 100644 --- a/src/3rdparty/webkit/WebCore/bridge/runtime_root.h +++ b/src/3rdparty/webkit/WebCore/bridge/runtime_root.h @@ -72,6 +72,13 @@ public: void addRuntimeObject(RuntimeObjectImp*); void removeRuntimeObject(RuntimeObjectImp*); + + struct InvalidationCallback { + virtual void operator()(RootObject*) = 0; + virtual ~InvalidationCallback(); + }; + void addInvalidationCallback(InvalidationCallback* callback) { m_invalidationCallbacks.add(callback); } + private: RootObject(const void* nativeHandle, JSGlobalObject*); @@ -79,9 +86,11 @@ private: const void* m_nativeHandle; ProtectedPtr m_globalObject; - ProtectCountSet m_protectCountSet; + ProtectCountSet m_protectCountSet; HashSet m_runtimeObjects; + + HashSet m_invalidationCallbacks; }; } // namespace Bindings diff --git a/src/3rdparty/webkit/WebCore/bridge/testbindings.cpp b/src/3rdparty/webkit/WebCore/bridge/testbindings.cpp index e4bbc7e..bcba115 100644 --- a/src/3rdparty/webkit/WebCore/bridge/testbindings.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/testbindings.cpp @@ -19,19 +19,17 @@ * */ #include "config.h" -#include -#include -#include -#include "JSValue.h" +#include "Bridge.h" #include "JSObject.h" -#include "types.h" +#include "JSValue.h" #include "interpreter.h" - #include "npruntime_internal.h" - -#include "runtime.h" #include "runtime_object.h" +#include "types.h" +#include +#include +#include #define LOG(formatAndArgs...) { \ diff --git a/src/3rdparty/webkit/WebCore/bridge/testbindings.mm b/src/3rdparty/webkit/WebCore/bridge/testbindings.mm index ca70e17..31564a8 100644 --- a/src/3rdparty/webkit/WebCore/bridge/testbindings.mm +++ b/src/3rdparty/webkit/WebCore/bridge/testbindings.mm @@ -24,20 +24,18 @@ */ #include "config.h" -#include +#include "Bridge.h" +#include +#include "JSObject.h" +#include "JSValue.h" #import - +#include "interpreter.h" +#include "runtime_object.h" #include #include - -#include "JSValue.h" -#include "JSObject.h" #include "types.h" -#include "interpreter.h" -#include "runtime.h" -#include "runtime_object.h" #define LOG(formatAndArgs...) { \ fprintf (stderr, "%s: ", __PRETTY_FUNCTION__); \ diff --git a/src/3rdparty/webkit/WebCore/bridge/testqtbindings.cpp b/src/3rdparty/webkit/WebCore/bridge/testqtbindings.cpp index 41a9a3a..73df155 100644 --- a/src/3rdparty/webkit/WebCore/bridge/testqtbindings.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/testqtbindings.cpp @@ -23,21 +23,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include -#include -#include -#include "JSValue.h" +#include "Bridge.h" #include "JSObject.h" -#include "types.h" +#include "JSValue.h" #include "interpreter.h" - -#include "qobject.h" #include "qdebug.h" - -#include "runtime.h" +#include "qobject.h" #include "runtime_object.h" - +#include "types.h" +#include +#include +#include class MyObject : public QObject diff --git a/src/3rdparty/webkit/WebCore/config.h b/src/3rdparty/webkit/WebCore/config.h index 62a7f60a..2805a89 100644 --- a/src/3rdparty/webkit/WebCore/config.h +++ b/src/3rdparty/webkit/WebCore/config.h @@ -25,7 +25,7 @@ #include -#if PLATFORM(WIN_OS) && !defined(BUILDING_WX__) && !COMPILER(GCC) +#if OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) #define JS_EXPORTDATA __declspec(dllexport) #else @@ -36,8 +36,10 @@ #else #define WEBKIT_EXPORTDATA __declspec(dllimport) #endif +#define JS_EXPORTCLASS JS_EXPORTDATA #else #define JS_EXPORTDATA +#define JS_EXPORTCLASS #define WEBKIT_EXPORTDATA #endif @@ -47,7 +49,7 @@ #define HAVE_FUNC_USLEEP 1 #endif /* __APPLE__ */ -#if PLATFORM(WIN_OS) +#if OS(WINDOWS) #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 @@ -73,7 +75,36 @@ #endif #endif -#endif /* PLATFORM(WIN_OS) */ +#endif /* OS(WINDOWS) */ + +#if PLATFORM(ANDROID) +#define WEBCORE_NAVIGATOR_VENDOR "Google Inc." +// This must be defined before we include FastMalloc.h, below. +#define USE_SYSTEM_MALLOC 1 +#define LOG_DISABLED 1 +#include +// Central place to set which optional features Android uses. +#define ENABLE_CHANNEL_MESSAGING 1 +#define ENABLE_DOM_STORAGE 1 +#undef ENABLE_FTPDIR // Enabled by default in Platform.h +#define ENABLE_FTPDIR 0 +#ifndef ENABLE_SVG +#define ENABLE_SVG 0 +#endif +#define ENABLE_VIDEO 1 +#define ENABLE_WORKERS 1 +#define ENABLE_XBL 0 +#define ENABLE_XHTMLMP 0 +#define ENABLE_XPATH 0 +#define ENABLE_XSLT 0 +#define ENABLE_ARCHIVE 0 +#define ENABLE_OFFLINE_WEB_APPLICATIONS 1 +#undef ENABLE_GEOLOCATION // Disabled by default in Platform.h +#define ENABLE_GEOLOCATION 1 +#undef ENABLE_INSPECTOR // Enabled by default in Platform.h +#define ENABLE_INSPECTOR 0 +#define ENABLE_EVENT_SOURCE 0 +#endif /* PLATFORM(ANDROID) */ #ifdef __cplusplus @@ -141,7 +172,7 @@ #define WTF_USE_NEW_THEME 1 #endif // PLATFORM(MAC) -#if PLATFORM(SYMBIAN) +#if OS(SYMBIAN) #undef WIN32 #undef _WIN32 #undef SKIP_STATIC_CONSTRUCTORS_ON_GCC @@ -159,10 +190,10 @@ #if PLATFORM(CHROMIUM) -#if !PLATFORM(DARWIN) +#if !OS(DARWIN) // Define SKIA on non-Mac. #define WTF_PLATFORM_SKIA 1 -#endif /* !PLATFORM(DARWIN) */ +#endif /* !OS(DARWIN) */ // Chromium uses this file instead of JavaScriptCore/config.h to compile // JavaScriptCore/wtf (chromium doesn't compile the rest of JSC). Therefore, diff --git a/src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl b/src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl index db0333a..2b158ff 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSCharsetRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=94180bad-a74e-4df9-adbc-6ce4e5b96155, - ImplementationUUID=354aa39e-ad53-4e9a-a927-80c3966c47f2 - ] CSSCharsetRule : CSSRule { + interface CSSCharsetRule : CSSRule { #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C readonly attribute [ConvertNullStringTo=Null] DOMString encoding; #else diff --git a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp index b8769f9..8039e35 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -33,10 +33,8 @@ #include "CSSReflectValue.h" #include "CSSTimingFunctionValue.h" #include "CSSValueList.h" -#include "CachedImage.h" #include "Document.h" #include "ExceptionCode.h" -#include "Pair.h" #include "Rect.h" #include "RenderBox.h" #include "RenderLayer.h" @@ -173,6 +171,7 @@ static const int computedProperties[] = { CSSPropertyWebkitBoxReflect, CSSPropertyWebkitBoxShadow, CSSPropertyWebkitBoxSizing, + CSSPropertyWebkitColorCorrection, CSSPropertyWebkitColumnBreakAfter, CSSPropertyWebkitColumnBreakBefore, CSSPropertyWebkitColumnBreakInside, @@ -262,7 +261,7 @@ static const int computedProperties[] = { CSSPropertyWritingMode, CSSPropertyGlyphOrientationHorizontal, CSSPropertyGlyphOrientationVertical, - CSSPropertyWebkitShadow + CSSPropertyWebkitSvgShadow #endif }; @@ -899,9 +898,9 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return CSSPrimitiveValue::createIdentifier(CSSValueNormal); return CSSPrimitiveValue::create(style->letterSpacing(), CSSPrimitiveValue::CSS_PX); case CSSPropertyWebkitLineClamp: - if (style->lineClamp() == -1) + if (style->lineClamp().isNone()) return CSSPrimitiveValue::createIdentifier(CSSValueNone); - return CSSPrimitiveValue::create(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE); + return CSSPrimitiveValue::create(style->lineClamp().value(), style->lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyLineHeight: { Length length = style->lineHeight(); if (length.isNegative()) @@ -911,8 +910,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper // for how high to be in pixels does include things like minimum font size and the zoom factor. // On the other hand, since font-size doesn't include the zoom factor, we really can't do // that here either. - // The line height returned is rounded to the nearest integer. - return CSSPrimitiveValue::create(length.calcMinValue(style->fontDescription().specifiedSize(), true), CSSPrimitiveValue::CSS_PX); + return CSSPrimitiveValue::create(static_cast(length.percent() * style->fontDescription().specifiedSize()) / 100, CSSPrimitiveValue::CSS_PX); return CSSPrimitiveValue::create(length.value(), CSSPrimitiveValue::CSS_PX); } case CSSPropertyListStyleImage: @@ -1348,6 +1346,8 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(int proper return getTimingFunctionValue(style->transitions()); case CSSPropertyPointerEvents: return CSSPrimitiveValue::create(style->pointerEvents()); + case CSSPropertyWebkitColorCorrection: + return CSSPrimitiveValue::create(style->colorSpace()); /* Shorthand properties, currently not supported see bug 13658*/ case CSSPropertyBackground: @@ -1475,7 +1475,7 @@ unsigned CSSComputedStyleDeclaration::length() const String CSSComputedStyleDeclaration::item(unsigned i) const { if (i >= length()) - return String(); + return ""; return getPropertyName(static_cast(computedProperties[i])); } diff --git a/src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.cpp index c1a517c..fe10cf3 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSCursorImageValue.cpp @@ -25,7 +25,6 @@ #include "DocLoader.h" #include "Document.h" #include "PlatformString.h" -#include "RenderStyle.h" #include #include diff --git a/src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp b/src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp index 4d8da59..70cd9bb 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSFontFace.cpp @@ -77,8 +77,11 @@ void CSSFontFace::addSource(CSSFontFaceSource* source) source->setFontFace(this); } -void CSSFontFace::fontLoaded(CSSFontFaceSource*) +void CSSFontFace::fontLoaded(CSSFontFaceSource* source) { + if (source != m_activeSource) + return; + // FIXME: Can we assert that m_segmentedFontFaces is not empty? That may // require stopping in-progress font loading when the last // CSSSegmentedFontFace is removed. @@ -97,17 +100,22 @@ void CSSFontFace::fontLoaded(CSSFontFaceSource*) SimpleFontData* CSSFontFace::getFontData(const FontDescription& fontDescription, bool syntheticBold, bool syntheticItalic) { + m_activeSource = 0; if (!isValid()) return 0; - + ASSERT(!m_segmentedFontFaces.isEmpty()); CSSFontSelector* fontSelector = (*m_segmentedFontFaces.begin())->fontSelector(); - SimpleFontData* result = 0; - unsigned size = m_sources.size(); - for (unsigned i = 0; i < size && !result; i++) - result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector); - return result; + size_t size = m_sources.size(); + for (size_t i = 0; i < size; ++i) { + if (SimpleFontData* result = m_sources[i]->getFontData(fontDescription, syntheticBold, syntheticItalic, fontSelector)) { + m_activeSource = m_sources[i]; + return result; + } + } + + return 0; } } diff --git a/src/3rdparty/webkit/WebCore/css/CSSFontFace.h b/src/3rdparty/webkit/WebCore/css/CSSFontFace.h index 41c9c55..4e2fee5 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSFontFace.h +++ b/src/3rdparty/webkit/WebCore/css/CSSFontFace.h @@ -82,6 +82,7 @@ public: private: CSSFontFace(FontTraitsMask traitsMask) : m_traitsMask(traitsMask) + , m_activeSource(0) { } @@ -89,6 +90,7 @@ private: Vector m_ranges; HashSet m_segmentedFontFaces; Vector m_sources; + CSSFontFaceSource* m_activeSource; }; } diff --git a/src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.idl b/src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.idl index 514c7dd..bd38a61 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSFontFaceRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=8afa4b1a-39fe-49fb-be6d-4d56e81d9b4a, - ImplementationUUID=5a7971d9-5aad-4ed7-be67-3a1644560256 - ] CSSFontFaceRule : CSSRule { + interface CSSFontFaceRule : CSSRule { readonly attribute CSSStyleDeclaration style; }; diff --git a/src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.cpp b/src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.cpp index 111cea2..1354e68 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSFontFaceSource.cpp @@ -107,8 +107,7 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri #else if (!m_font) { #endif - FontPlatformData* data = fontCache()->getCachedFontPlatformData(fontDescription, m_string); - SimpleFontData* fontData = fontCache()->getCachedFontData(data); + SimpleFontData* fontData = fontCache()->getCachedFontData(fontDescription, m_string); // We're local. Just return a SimpleFontData from the normal cache. return fontData; @@ -179,10 +178,11 @@ SimpleFontData* CSSFontFaceSource::getFontData(const FontDescription& fontDescri if (DocLoader* docLoader = fontSelector->docLoader()) m_font->beginLoadIfNeeded(docLoader); // FIXME: m_string is a URL so it makes no sense to pass it as a family name. - FontPlatformData* tempData = fontCache()->getCachedFontPlatformData(fontDescription, m_string); + SimpleFontData* tempData = fontCache()->getCachedFontData(fontDescription, m_string); if (!tempData) tempData = fontCache()->getLastResortFallbackFont(fontDescription); - fontData.set(new SimpleFontData(*tempData, true, true)); + + fontData.set(new SimpleFontData(tempData->platformData(), true, true)); } m_fontDataTable.set(hashKey, fontData.get()); diff --git a/src/3rdparty/webkit/WebCore/css/CSSFontSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSFontSelector.cpp index 35bc876..56ee261 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSFontSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSFontSelector.cpp @@ -45,7 +45,6 @@ #include "FontCache.h" #include "FontFamilyValue.h" #include "Frame.h" -#include "NodeList.h" #include "RenderObject.h" #include "Settings.h" #include "SimpleFontData.h" @@ -395,7 +394,7 @@ static FontData* fontDataForGenericFamily(Document* document, const FontDescript genericFamily = settings->standardFontFamily(); if (!genericFamily.isEmpty()) - return fontCache()->getCachedFontData(fontCache()->getCachedFontPlatformData(fontDescription, genericFamily)); + return fontCache()->getCachedFontData(fontDescription, genericFamily); return 0; } diff --git a/src/3rdparty/webkit/WebCore/css/CSSGradientValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSGradientValue.cpp index 3f45e47..5946d7a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSGradientValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSGradientValue.cpp @@ -29,9 +29,7 @@ #include "CSSStyleSelector.h" #include "GeneratedImage.h" #include "Gradient.h" -#include "GraphicsContext.h" #include "Image.h" -#include "ImageBuffer.h" #include "IntSize.h" #include "IntSizeHash.h" #include "PlatformString.h" diff --git a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y index 0530e91..9d5eb6e 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y +++ b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y @@ -97,7 +97,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %} -%expect 51 +%expect 54 %nonassoc LOWEST_PREC @@ -184,18 +184,15 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %type charset %type ruleset -%type valid_rule_or_import %type media %type import +%type namespace %type page %type font_face %type keyframes %type invalid_rule %type save_block %type invalid_at -%type invalid_at_list -%type invalid_import -%type invalid_media %type rule %type valid_rule %type block_rule_list @@ -268,7 +265,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %% stylesheet: - maybe_space maybe_charset maybe_sgml import_list variables_list namespace_list rule_list + maybe_space maybe_charset maybe_sgml rule_list | webkit_rule maybe_space | webkit_decls maybe_space | webkit_value maybe_space @@ -278,13 +275,8 @@ stylesheet: | webkit_keyframe_rule maybe_space ; -valid_rule_or_import: - valid_rule - | import - ; - webkit_rule: - WEBKIT_RULE_SYM '{' maybe_space valid_rule_or_import maybe_space '}' { + WEBKIT_RULE_SYM '{' maybe_space valid_rule maybe_space '}' { static_cast(parser)->m_rule = $4; } ; @@ -373,31 +365,6 @@ charset: } ; -import_list: - /* empty */ - | import_list import maybe_sgml { - CSSParser* p = static_cast(parser); - if ($2 && p->m_styleSheet) - p->m_styleSheet->append($2); - } - | invalid_at_list { - } - ; - -variables_list: -/* empty */ -| variables_list variables_rule maybe_sgml { - CSSParser* p = static_cast(parser); - if ($2 && p->m_styleSheet) - p->m_styleSheet->append($2); -} -; - -namespace_list: -/* empty */ -| namespace_list namespace maybe_sgml -; - rule_list: /* empty */ | rule_list rule maybe_sgml { @@ -413,13 +380,17 @@ valid_rule: | page | font_face | keyframes + | namespace + | import + | variables_rule ; rule: - valid_rule + valid_rule { + static_cast(parser)->m_hadSyntacticallyValidCSSRule = true; + } | invalid_rule | invalid_at - | invalid_import ; block_rule_list: @@ -445,8 +416,10 @@ block_rule: block_valid_rule | invalid_rule | invalid_at - | invalid_import - | invalid_media + | namespace + | import + | variables_rule + | media ; @@ -570,17 +543,23 @@ variable_name: namespace: NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space ';' { - CSSParser* p = static_cast(parser); - if (p->m_styleSheet) - p->m_styleSheet->addNamespace(p, $3, $4); + static_cast(parser)->addNamespace($3, $4); + $$ = 0; +} +| NAMESPACE_SYM maybe_space maybe_ns_prefix string_or_uri maybe_space invalid_block { + $$ = 0; +} +| NAMESPACE_SYM error invalid_block { + $$ = 0; +} +| NAMESPACE_SYM error ';' { + $$ = 0; } -| NAMESPACE_SYM error invalid_block -| NAMESPACE_SYM error ';' ; maybe_ns_prefix: /* empty */ { $$.characters = 0; } -| IDENT WHITESPACE { $$ = $1; } +| IDENT maybe_space { $$ = $1; } ; string_or_uri: @@ -1130,11 +1109,11 @@ pseudo: } } // used by :nth-*(ax+b) - | ':' FUNCTION NTH ')' { + | ':' FUNCTION maybe_space NTH maybe_space ')' { CSSParser *p = static_cast(parser); $$ = p->createFloatingSelector(); $$->m_match = CSSSelector::PseudoClass; - $$->setArgument($3); + $$->setArgument($4); $$->m_value = $2; CSSSelector::PseudoType type = $$->pseudoType(); if (type == CSSSelector::PseudoUnknown) @@ -1148,11 +1127,11 @@ pseudo: } } // used by :nth-* - | ':' FUNCTION INTEGER ')' { + | ':' FUNCTION maybe_space INTEGER maybe_space ')' { CSSParser *p = static_cast(parser); $$ = p->createFloatingSelector(); $$->m_match = CSSSelector::PseudoClass; - $$->setArgument(String::number($3)); + $$->setArgument(String::number($4)); $$->m_value = $2; CSSSelector::PseudoType type = $$->pseudoType(); if (type == CSSSelector::PseudoUnknown) @@ -1166,11 +1145,11 @@ pseudo: } } // used by :nth-*(odd/even) and :lang - | ':' FUNCTION IDENT ')' { + | ':' FUNCTION maybe_space IDENT maybe_space ')' { CSSParser *p = static_cast(parser); $$ = p->createFloatingSelector(); $$->m_match = CSSSelector::PseudoClass; - $$->setArgument($3); + $$->setArgument($4); $2.lower(); $$->m_value = $2; CSSSelector::PseudoType type = $$->pseudoType(); @@ -1229,6 +1208,9 @@ decl_list: declaration ';' maybe_space { $$ = $1; } + | declaration invalid_block_list maybe_space { + $$ = false; + } | declaration invalid_block_list ';' maybe_space { $$ = false; } @@ -1346,6 +1328,12 @@ expr: $$->addValue(p->sinkFloatingValue($3)); } } + | expr invalid_block_list { + $$ = 0; + } + | expr invalid_block_list error { + $$ = 0; + } | expr error { $$ = 0; } @@ -1481,23 +1469,6 @@ invalid_at: } ; -invalid_at_list: - invalid_at maybe_sgml - | invalid_at_list invalid_at maybe_sgml - ; - -invalid_import: - import { - $$ = 0; - } - ; - -invalid_media: - media { - $$ = 0; - } - ; - invalid_rule: error invalid_block { $$ = 0; @@ -1517,8 +1488,12 @@ invalid_rule: ; invalid_block: - '{' error invalid_block_list error closing_brace - | '{' error closing_brace + '{' error invalid_block_list error closing_brace { + static_cast(parser)->invalidBlockHit(); + } + | '{' error closing_brace { + static_cast(parser)->invalidBlockHit(); + } ; invalid_block_list: diff --git a/src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp index 3432a4e..96a8dec 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSImageValue.cpp @@ -25,7 +25,6 @@ #include "Cache.h" #include "CachedImage.h" #include "DocLoader.h" -#include "RenderStyle.h" #include "StyleCachedImage.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp b/src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp index 6e62f6d..6259a9b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSImportRule.cpp @@ -25,7 +25,7 @@ #include "CachedCSSStyleSheet.h" #include "DocLoader.h" #include "Document.h" -#include "MediaList.h" +#include "SecurityOrigin.h" #include "Settings.h" #include @@ -54,22 +54,41 @@ CSSImportRule::~CSSImportRule() m_cachedSheet->removeClient(this); } -void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet) +void CSSImportRule::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet) { if (m_styleSheet) m_styleSheet->setParent(0); - m_styleSheet = CSSStyleSheet::create(this, url, charset); + m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset); + bool crossOriginCSS = false; + bool validMIMEType = false; CSSStyleSheet* parent = parentStyleSheet(); bool strict = !parent || parent->useStrictParsing(); - String sheetText = sheet->sheetText(strict); + bool enforceMIMEType = strict; + bool needsSiteSpecificQuirks = parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks(); + +#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD) + if (enforceMIMEType && needsSiteSpecificQuirks) { + // Covers both http and https, with or without "www." + if (baseURL.string().contains("mcafee.com/japan/", false)) + enforceMIMEType = false; + } +#endif + + String sheetText = sheet->sheetText(enforceMIMEType, &validMIMEType); m_styleSheet->parseString(sheetText, strict); - if (strict && parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks()) { + if (!parent || !parent->doc() || !parent->doc()->securityOrigin()->canRequest(baseURL)) + crossOriginCSS = true; + + if (crossOriginCSS && !validMIMEType && !m_styleSheet->hasSyntacticallyValidCSSHeader()) + m_styleSheet = CSSStyleSheet::create(this, href, baseURL, charset); + + if (strict && needsSiteSpecificQuirks) { // Work around . DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css")); DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n")); - if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) { + if (baseURL.string().endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) { ASSERT(m_styleSheet->length() == 1); ExceptionCode ec; m_styleSheet->deleteRule(0, ec); @@ -98,15 +117,16 @@ void CSSImportRule::insertedIntoParent() return; String absHref = m_strHref; - if (!parentSheet->href().isNull()) + if (!parentSheet->finalURL().isNull()) // use parent styleheet's URL as the base URL - absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string(); + absHref = KURL(parentSheet->finalURL(), m_strHref).string(); // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. StyleBase* root = this; for (StyleBase* curr = parent(); curr; curr = curr->parent()) { - if (curr->isCSSStyleSheet() && absHref == static_cast(curr)->href()) + // FIXME: This is wrong if the finalURL was updated via document::updateBaseURL. + if (curr->isCSSStyleSheet() && absHref == static_cast(curr)->finalURL().string()) return; root = curr; } diff --git a/src/3rdparty/webkit/WebCore/css/CSSImportRule.h b/src/3rdparty/webkit/WebCore/css/CSSImportRule.h index f546006..10d3026 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSImportRule.h +++ b/src/3rdparty/webkit/WebCore/css/CSSImportRule.h @@ -63,7 +63,7 @@ private: virtual unsigned short type() const { return IMPORT_RULE; } // from CachedResourceClient - virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); + virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*); String m_strHref; RefPtr m_lstMedia; diff --git a/src/3rdparty/webkit/WebCore/css/CSSImportRule.idl b/src/3rdparty/webkit/WebCore/css/CSSImportRule.idl index 454553e..8e60905 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSImportRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSImportRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=8f60b3a2-ebf0-484d-a714-47a9974a6a9e, - ImplementationUUID=437ea93c-68e5-4897-85fe-e161653801eb - ] CSSImportRule : CSSRule { + interface CSSImportRule : CSSRule { readonly attribute [ConvertNullStringTo=Null] DOMString href; readonly attribute stylesheets::MediaList media; readonly attribute CSSStyleSheet styleSheet; diff --git a/src/3rdparty/webkit/WebCore/css/CSSInheritedValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSInheritedValue.cpp index 08d3db3..20b73e2 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSInheritedValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSInheritedValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/CSSInitialValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSInitialValue.cpp index 9c2bb23..cbe776b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSInitialValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSInitialValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp b/src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp index 610e988..d1c220b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSMediaRule.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. diff --git a/src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl b/src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl index 1347171..813bd70 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSMediaRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=9c623c09-2677-4d28-ba90-826da0ae316a, - ImplementationUUID=30493ec9-e139-4e9e-ae24-cc8f532006d9 - ] CSSMediaRule : CSSRule { + interface CSSMediaRule : CSSRule { readonly attribute stylesheets::MediaList media; readonly attribute CSSRuleList cssRules; diff --git a/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp index 2dd2f5d..31c7507 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -23,7 +23,6 @@ #include "CSSImageValue.h" #include "CSSParser.h" -#include "CSSProperty.h" #include "CSSPropertyLonghand.h" #include "CSSPropertyNames.h" #include "CSSRule.h" @@ -259,20 +258,28 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const String CSSMutableStyleDeclaration::get4Values(const int* properties) const { - String res; - for (int i = 0; i < 4; ++i) { - if (!isPropertyImplicit(properties[i])) { - RefPtr value = getPropertyCSSValue(properties[i]); + // Assume the properties are in the usual order top, right, bottom, left. + RefPtr topValue = getPropertyCSSValue(properties[0]); + RefPtr rightValue = getPropertyCSSValue(properties[1]); + RefPtr bottomValue = getPropertyCSSValue(properties[2]); + RefPtr leftValue = getPropertyCSSValue(properties[3]); - // apparently all 4 properties must be specified. - if (!value) - return String(); + // All 4 properties must be specified. + if (!topValue || !rightValue || !bottomValue || !leftValue) + return String(); + + bool showLeft = rightValue->cssText() != leftValue->cssText(); + bool showBottom = (topValue->cssText() != bottomValue->cssText()) || showLeft; + bool showRight = (topValue->cssText() != rightValue->cssText()) || showBottom; + + String res = topValue->cssText(); + if (showRight) + res += " " + rightValue->cssText(); + if (showBottom) + res += " " + bottomValue->cssText(); + if (showLeft) + res += " " + leftValue->cssText(); - if (!res.isNull()) - res += " "; - res += value->cssText(); - } - } return res; } @@ -306,7 +313,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie RefPtr value; if (values[j]) { if (values[j]->isValueList()) - value = static_cast(values[j].get())->itemWithoutBoundsCheck(i); + value = static_cast(values[j].get())->item(i); else { value = values[j]; @@ -628,7 +635,7 @@ unsigned CSSMutableStyleDeclaration::length() const String CSSMutableStyleDeclaration::item(unsigned i) const { if (i >= m_properties.size()) - return String(); + return ""; return getPropertyName(static_cast(m_properties[i].id())); } diff --git a/src/3rdparty/webkit/WebCore/css/CSSNamespace.h b/src/3rdparty/webkit/WebCore/css/CSSNamespace.h index 9194be8..0a1119d 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSNamespace.h +++ b/src/3rdparty/webkit/WebCore/css/CSSNamespace.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) * 1999 Waldo Bastian (bastian@kde.org) * Copyright (C) 2004, 2006 Apple Computer, Inc. @@ -28,7 +26,7 @@ namespace WebCore { - struct CSSNamespace { + struct CSSNamespace : Noncopyable { AtomicString m_prefix; AtomicString m_uri; CSSNamespace* m_parent; diff --git a/src/3rdparty/webkit/WebCore/css/CSSPageRule.idl b/src/3rdparty/webkit/WebCore/css/CSSPageRule.idl index 3ad570e..6b50b6d 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPageRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSPageRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=4e8d9d26-65ca-483f-a6d4-be1a25905056, - ImplementationUUID=d8e40379-8b0e-4dce-b1f8-636dcf055a5f - ] CSSPageRule : CSSRule { + interface CSSPageRule : CSSRule { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText setter raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp index 6024a5b..ec59055 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.cpp @@ -139,9 +139,13 @@ CSSParser::CSSParser(bool strictParsing) , m_currentShorthand(0) , m_implicitShorthand(false) , m_hasFontFaceOnlyValues(false) + , m_hadSyntacticallyValidCSSRule(false) , m_defaultNamespace(starAtom) , m_data(0) , yy_start(1) + , m_allowImportRules(true) + , m_allowVariablesRules(true) + , m_allowNamespaceDeclarations(true) , m_floatingMediaQuery(0) , m_floatingMediaQueryExp(0) , m_floatingMediaQueryExpList(0) @@ -229,6 +233,7 @@ void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string) PassRefPtr CSSParser::parseRule(CSSStyleSheet* sheet, const String& string) { m_styleSheet = sheet; + m_allowNamespaceDeclarations = false; setupParser("@-webkit-rule{", string, "} "); cssyyparse(this); return m_rule.release(); @@ -566,7 +571,7 @@ bool CSSParser::parseValue(int propId, bool important) return true; } - bool valid_primitive = false; + bool validPrimitive = false; RefPtr parsedValue; switch (static_cast(propId)) { @@ -582,13 +587,13 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertySize: // {1,2} | auto | portrait | landscape | inherit case CSSPropertyQuotes: // [ ]+ | none | inherit if (id) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | inherit if (id == CSSValueNormal || id == CSSValueEmbed || id == CSSValueBidiOverride) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyPosition: // static | relative | absolute | fixed | inherit @@ -596,7 +601,7 @@ bool CSSParser::parseValue(int propId, bool important) id == CSSValueRelative || id == CSSValueAbsolute || id == CSSValueFixed) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyPageBreakAfter: // auto | always | avoid | left | right | inherit @@ -608,19 +613,19 @@ bool CSSParser::parseValue(int propId, bool important) id == CSSValueAvoid || id == CSSValueLeft || id == CSSValueRight) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyPageBreakInside: // avoid | auto | inherit case CSSPropertyWebkitColumnBreakInside: if (id == CSSValueAuto || id == CSSValueAvoid) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyEmptyCells: // show | hide | inherit if (id == CSSValueShow || id == CSSValueHide) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyContent: // [ | | | attr(X) | open-quote | @@ -633,12 +638,12 @@ bool CSSParser::parseValue(int propId, bool important) id == CSSValuePreWrap || id == CSSValuePreLine || id == CSSValueNowrap) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyClip: // | auto | inherit if (id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; else if (value->unit == CSSParserValue::Function) return parseShape(propId, important); break; @@ -649,17 +654,17 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyCaptionSide: // top | bottom | left | right | inherit if (id == CSSValueLeft || id == CSSValueRight || id == CSSValueTop || id == CSSValueBottom) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyBorderCollapse: // collapse | separate | inherit if (id == CSSValueCollapse || id == CSSValueSeparate) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyVisibility: // visible | hidden | collapse | inherit if (id == CSSValueVisible || id == CSSValueHidden || id == CSSValueCollapse) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyOverflow: { @@ -674,21 +679,19 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyOverflowY: // visible | hidden | scroll | auto | marquee | overlay | inherit if (id == CSSValueVisible || id == CSSValueHidden || id == CSSValueScroll || id == CSSValueAuto || id == CSSValueOverlay || id == CSSValueWebkitMarquee) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyListStylePosition: // inside | outside | inherit if (id == CSSValueInside || id == CSSValueOutside) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyListStyleType: - // disc | circle | square | decimal | decimal-leading-zero | lower-roman | - // upper-roman | lower-greek | lower-alpha | lower-latin | upper-alpha | - // upper-latin | hebrew | armenian | georgian | cjk-ideographic | hiragana | - // katakana | hiragana-iroha | katakana-iroha | none | inherit + // See section CSS_PROP_LIST_STYLE_TYPE of file CSSValueKeywords.in + // for the list of supported list-style-types. if ((id >= CSSValueDisc && id <= CSSValueKatakanaIroha) || id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyDisplay: @@ -700,41 +703,41 @@ bool CSSParser::parseValue(int propId, bool important) #else if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone) #endif - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyDirection: // ltr | rtl | inherit if (id == CSSValueLtr || id == CSSValueRtl) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none | inherit if ((id >= CSSValueCapitalize && id <= CSSValueLowercase) || id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyFloat: // left | right | none | inherit + center for buggy CSS if (id == CSSValueLeft || id == CSSValueRight || id == CSSValueNone || id == CSSValueCenter) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyClear: // none | left | right | both | inherit if (id == CSSValueNone || id == CSSValueLeft || id == CSSValueRight|| id == CSSValueBoth) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextAlign: // left | right | center | justify | webkit_left | webkit_right | webkit_center | start | end | | inherit if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitCenter) || id == CSSValueStart || id == CSSValueEnd || value->unit == CSSPrimitiveValue::CSS_STRING) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyOutlineStyle: // ( except hidden) | auto | inherit if (id == CSSValueAuto || id == CSSValueNone || (id >= CSSValueInset && id <= CSSValueDouble)) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyBorderTopStyle: //// | inherit @@ -743,7 +746,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBorderLeftStyle: case CSSPropertyWebkitColumnRuleStyle: if (id >= CSSValueNone && id <= CSSValueDouble) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyFontWeight: // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit @@ -770,13 +773,13 @@ bool CSSParser::parseValue(int propId, bool important) } case CSSPropertyWebkitBorderHorizontalSpacing: case CSSPropertyWebkitBorderVerticalSpacing: - valid_primitive = validUnit(value, FLength|FNonNeg, m_strict); + validPrimitive = validUnit(value, FLength | FNonNeg, m_strict); break; case CSSPropertyOutlineColor: // | invert | inherit // Outline color has "invert" as additional keyword. // Also, we want to allow the special focus color even in strict parsing mode. if (propId == CSSPropertyOutlineColor && (id == CSSValueInvert || id == CSSValueWebkitFocusRingColor)) { - valid_primitive = true; + validPrimitive = true; break; } /* nobreak */ @@ -793,13 +796,13 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitTextFillColor: case CSSPropertyWebkitTextStrokeColor: if (id == CSSValueWebkitText) - valid_primitive = true; // Always allow this, even when strict parsing is on, + validPrimitive = true; // Always allow this, even when strict parsing is on, // since we use this in our UA sheets. else if (id == CSSValueCurrentcolor) - valid_primitive = true; + validPrimitive = true; else if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu || (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && !m_strict)) { - valid_primitive = true; + validPrimitive = true; } else { parsedValue = parseColor(); if (parsedValue) @@ -856,9 +859,9 @@ bool CSSParser::parseValue(int propId, bool important) id = value->id; if (!m_strict && value->id == CSSValueHand) { // MSIE 5 compatibility :/ id = CSSValuePointer; - valid_primitive = true; + validPrimitive = true; } else if ((value->id >= CSSValueAuto && value->id <= CSSValueWebkitGrabbing) || value->id == CSSValueCopy || value->id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; } @@ -936,27 +939,27 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBorderLeftWidth: case CSSPropertyWebkitColumnRuleWidth: if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FLength, m_strict); + validPrimitive = validUnit(value, FLength, m_strict); break; case CSSPropertyLetterSpacing: // normal | | inherit case CSSPropertyWordSpacing: // normal | | inherit if (id == CSSValueNormal) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FLength, m_strict); + validPrimitive = validUnit(value, FLength, m_strict); break; case CSSPropertyWordBreak: // normal | break-all | break-word (this is a custom extension) if (id == CSSValueNormal || id == CSSValueBreakAll || id == CSSValueBreakWord) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWordWrap: // normal | break-word if (id == CSSValueNormal || id == CSSValueBreakWord) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextIndent: // | | inherit @@ -965,30 +968,30 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyPaddingBottom: // | case CSSPropertyPaddingLeft: //// case CSSPropertyWebkitPaddingStart: - valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict)); break; case CSSPropertyMaxHeight: // | | none | inherit case CSSPropertyMaxWidth: // | | none | inherit if (id == CSSValueNone || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) { - valid_primitive = true; + validPrimitive = true; break; } /* nobreak */ case CSSPropertyMinHeight: // | | inherit case CSSPropertyMinWidth: // | | inherit if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict)); break; case CSSPropertyFontSize: // | | | | inherit if (id >= CSSValueXxSmall && id <= CSSValueLarger) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (validUnit(value, FLength|FPercent|FNonNeg, m_strict)); + validPrimitive = (validUnit(value, FLength | FPercent | FNonNeg, m_strict)); break; case CSSPropertyFontStyle: // normal | italic | oblique | inherit @@ -1002,18 +1005,18 @@ bool CSSParser::parseValue(int propId, bool important) // | | inherit if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict)); break; case CSSPropertyHeight: // | | auto | inherit case CSSPropertyWidth: // | | auto | inherit if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) - valid_primitive = true; + validPrimitive = true; else // ### handle multilength case where we allow relative units - valid_primitive = (!id && validUnit(value, FLength|FPercent|FNonNeg, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict)); break; case CSSPropertyBottom: // | | auto | inherit @@ -1026,38 +1029,38 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyMarginLeft: //// case CSSPropertyWebkitMarginStart: if (id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (!id && validUnit(value, FLength|FPercent, m_strict)); + validPrimitive = (!id && validUnit(value, FLength | FPercent, m_strict)); break; case CSSPropertyZIndex: // auto | | inherit if (id == CSSValueAuto) { - valid_primitive = true; + validPrimitive = true; break; } /* nobreak */ case CSSPropertyOrphans: // | inherit case CSSPropertyWidows: // | inherit // ### not supported later on - valid_primitive = (!id && validUnit(value, FInteger, false)); + validPrimitive = (!id && validUnit(value, FInteger, false)); break; case CSSPropertyLineHeight: // normal | | | | inherit if (id == CSSValueNormal) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (!id && validUnit(value, FNumber|FLength|FPercent|FNonNeg, m_strict)); + validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent | FNonNeg, m_strict)); break; case CSSPropertyCounterIncrement: // [ ? ]+ | none | inherit if (id != CSSValueNone) return parseCounter(propId, 1, important); - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyCounterReset: // [ ? ]+ | none | inherit if (id != CSSValueNone) return parseCounter(propId, 0, important); - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyFontFamily: // [[ | ],]* [ | ] | inherit @@ -1070,11 +1073,11 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitTextDecorationsInEffect: // none | [ underline || overline || line-through || blink ] | inherit if (id == CSSValueNone) { - valid_primitive = true; + validPrimitive = true; } else { RefPtr list = CSSValueList::createSpaceSeparated(); - bool is_valid = true; - while (is_valid && value) { + bool isValid = true; + while (isValid && value) { switch (value->id) { case CSSValueBlink: break; @@ -1084,11 +1087,11 @@ bool CSSParser::parseValue(int propId, bool important) list->append(CSSPrimitiveValue::createIdentifier(value->id)); break; default: - is_valid = false; + isValid = false; } value = m_valueList->next(); } - if (list->length() && is_valid) { + if (list->length() && isValid) { parsedValue = list.release(); m_valueList->next(); } @@ -1097,14 +1100,14 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyZoom: // normal | reset | document | | | inherit if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocument) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg, true)); + validPrimitive = (!id && validUnit(value, FNumber | FPercent | FNonNeg, true)); break; case CSSPropertyTableLayout: // auto | fixed | inherit if (id == CSSValueAuto || id == CSSValueFixed) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertySrc: // Only used within @font-face, so cannot use inherit | initial or be !important. This is a list of urls or local references. @@ -1116,13 +1119,13 @@ bool CSSParser::parseValue(int propId, bool important) /* CSS3 properties */ case CSSPropertyWebkitAppearance: if ((id >= CSSValueCheckbox && id <= CSSValueTextarea) || id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBinding: #if ENABLE(XBL) if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else { RefPtr values = CSSValueList::createCommaSeparated(); CSSParserValue* val; @@ -1156,7 +1159,7 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitBorderImage: case CSSPropertyWebkitMaskBoxImage: if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else { RefPtr result; if (parseBorderImage(propId, important, result)) { @@ -1171,15 +1174,15 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyBorderBottomRightRadius: { if (num != 1 && num != 2) return false; - valid_primitive = validUnit(value, FLength, m_strict); - if (!valid_primitive) + validPrimitive = validUnit(value, FLength, m_strict); + if (!validPrimitive) return false; RefPtr parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); RefPtr parsedValue2; if (num == 2) { value = m_valueList->next(); - valid_primitive = validUnit(value, FLength, m_strict); - if (!valid_primitive) + validPrimitive = validUnit(value, FLength, m_strict); + if (!validPrimitive) return false; parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } else @@ -1194,56 +1197,59 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitBorderRadius: return parseBorderRadius(propId, important); case CSSPropertyOutlineOffset: - valid_primitive = validUnit(value, FLength, m_strict); + validPrimitive = validUnit(value, FLength, m_strict); break; case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS3, so treat as CSS3 case CSSPropertyWebkitBoxShadow: if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else return parseShadow(propId, important); break; case CSSPropertyWebkitBoxReflect: if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else return parseReflect(propId, important); break; case CSSPropertyOpacity: - valid_primitive = validUnit(value, FNumber, m_strict); + validPrimitive = validUnit(value, FNumber, m_strict); break; case CSSPropertyWebkitBoxAlign: if (id == CSSValueStretch || id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueBaseline) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBoxDirection: if (id == CSSValueNormal || id == CSSValueReverse) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBoxLines: if (id == CSSValueSingle || id == CSSValueMultiple) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBoxOrient: if (id == CSSValueHorizontal || id == CSSValueVertical || id == CSSValueInlineAxis || id == CSSValueBlockAxis) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBoxPack: if (id == CSSValueStart || id == CSSValueEnd || id == CSSValueCenter || id == CSSValueJustify) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBoxFlex: - valid_primitive = validUnit(value, FNumber, m_strict); + validPrimitive = validUnit(value, FNumber, m_strict); break; case CSSPropertyWebkitBoxFlexGroup: case CSSPropertyWebkitBoxOrdinalGroup: - valid_primitive = validUnit(value, FInteger|FNonNeg, true); + validPrimitive = validUnit(value, FInteger | FNonNeg, true); break; case CSSPropertyWebkitBoxSizing: - valid_primitive = id == CSSValueBorderBox || id == CSSValueContentBox; + validPrimitive = id == CSSValueBorderBox || id == CSSValueContentBox; + break; + case CSSPropertyWebkitColorCorrection: + validPrimitive = id == CSSValueSrgb || id == CSSValueDefault; break; case CSSPropertyWebkitMarquee: { const int properties[5] = { CSSPropertyWebkitMarqueeDirection, CSSPropertyWebkitMarqueeIncrement, @@ -1255,71 +1261,71 @@ bool CSSParser::parseValue(int propId, bool important) if (id == CSSValueForwards || id == CSSValueBackwards || id == CSSValueAhead || id == CSSValueReverse || id == CSSValueLeft || id == CSSValueRight || id == CSSValueDown || id == CSSValueUp || id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitMarqueeIncrement: if (id == CSSValueSmall || id == CSSValueLarge || id == CSSValueMedium) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FLength|FPercent, m_strict); + validPrimitive = validUnit(value, FLength | FPercent, m_strict); break; case CSSPropertyWebkitMarqueeStyle: if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitMarqueeRepetition: if (id == CSSValueInfinite) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FInteger|FNonNeg, m_strict); + validPrimitive = validUnit(value, FInteger | FNonNeg, m_strict); break; case CSSPropertyWebkitMarqueeSpeed: if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FTime|FInteger|FNonNeg, m_strict); + validPrimitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); break; #if ENABLE(WCSS) case CSSPropertyWapMarqueeDir: if (id == CSSValueLtr || id == CSSValueRtl) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWapMarqueeStyle: if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWapMarqueeLoop: if (id == CSSValueInfinite) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FInteger | FNonNeg, m_strict); + validPrimitive = validUnit(value, FInteger | FNonNeg, m_strict); break; case CSSPropertyWapMarqueeSpeed: if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); + validPrimitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); break; #endif case CSSPropertyWebkitUserDrag: // auto | none | element if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitUserModify: // read-only | read-write if (id == CSSValueReadOnly || id == CSSValueReadWrite || id == CSSValueReadWritePlaintextOnly) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitUserSelect: // auto | none | text if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueText) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextOverflow: // clip | ellipsis if (id == CSSValueClip || id == CSSValueEllipsis) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitTransform: if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else { PassRefPtr val = parseTransform(); if (val) { @@ -1349,18 +1355,18 @@ bool CSSParser::parseValue(int propId, bool important) } case CSSPropertyWebkitTransformStyle: if (value->id == CSSValueFlat || value->id == CSSValuePreserve3d) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBackfaceVisibility: if (value->id == CSSValueVisible || value->id == CSSValueHidden) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitPerspective: if (id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; else { // Accepting valueless numbers is a quirk of the -webkit prefixed version of the property. - if (validUnit(value, FNumber|FLength|FNonNeg, m_strict)) { + if (validUnit(value, FNumber | FLength | FNonNeg, m_strict)) { RefPtr val = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); if (val) { addProperty(propId, val.release(), important); @@ -1424,13 +1430,13 @@ bool CSSParser::parseValue(int propId, bool important) case CSSPropertyWebkitMarginTopCollapse: case CSSPropertyWebkitMarginBottomCollapse: if (id == CSSValueCollapse || id == CSSValueSeparate || id == CSSValueDiscard) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextLineThroughMode: case CSSPropertyTextOverlineMode: case CSSPropertyTextUnderlineMode: if (id == CSSValueContinuous || id == CSSValueSkipWhiteSpace) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextLineThroughStyle: case CSSPropertyTextOverlineStyle: @@ -1438,50 +1444,50 @@ bool CSSParser::parseValue(int propId, bool important) if (id == CSSValueNone || id == CSSValueSolid || id == CSSValueDouble || id == CSSValueDashed || id == CSSValueDotDash || id == CSSValueDotDotDash || id == CSSValueWave) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision if (id == CSSValueAuto || id == CSSValueOptimizespeed || id == CSSValueOptimizelegibility || id == CSSValueGeometricprecision) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyTextLineThroughWidth: case CSSPropertyTextOverlineWidth: case CSSPropertyTextUnderlineWidth: if (id == CSSValueAuto || id == CSSValueNormal || id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = !id && validUnit(value, FNumber|FLength|FPercent, m_strict); + validPrimitive = !id && validUnit(value, FNumber | FLength | FPercent, m_strict); break; case CSSPropertyResize: // none | both | horizontal | vertical | auto if (id == CSSValueNone || id == CSSValueBoth || id == CSSValueHorizontal || id == CSSValueVertical || id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitColumnCount: if (id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = !id && validUnit(value, FInteger | FNonNeg, false); + validPrimitive = !id && validUnit(value, FInteger | FNonNeg, false); break; case CSSPropertyWebkitColumnGap: // normal | if (id == CSSValueNormal) - valid_primitive = true; + validPrimitive = true; else - valid_primitive = validUnit(value, FLength | FNonNeg, m_strict); + validPrimitive = validUnit(value, FLength | FNonNeg, m_strict); break; case CSSPropertyWebkitColumnWidth: // auto | if (id == CSSValueAuto) - valid_primitive = true; + validPrimitive = true; else // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property. - valid_primitive = validUnit(value, FLength, true); + validPrimitive = validUnit(value, FLength, true); break; case CSSPropertyPointerEvents: // none | visiblePainted | visibleFill | visibleStroke | visible | // painted | fill | stroke | auto | all | inherit if (id == CSSValueVisible || id == CSSValueNone || id == CSSValueAll || id == CSSValueAuto || (id >= CSSValueVisiblepainted && id <= CSSValueStroke)) - valid_primitive = true; + validPrimitive = true; break; // End of CSS3 properties @@ -1489,56 +1495,58 @@ bool CSSParser::parseValue(int propId, bool important) // Apple specific properties. These will never be standardized and are purely to // support custom WebKit-based Apple applications. case CSSPropertyWebkitLineClamp: - valid_primitive = (!id && validUnit(value, FPercent, false)); + // When specifying number of lines, don't allow 0 as a valid value + // When specifying either type of unit, require non-negative integers + validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTAGE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg, false)); break; case CSSPropertyWebkitTextSizeAdjust: if (id == CSSValueAuto || id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitRtlOrdering: if (id == CSSValueLogical || id == CSSValueVisual) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitFontSizeDelta: // - valid_primitive = validUnit(value, FLength, m_strict); + validPrimitive = validUnit(value, FLength, m_strict); break; case CSSPropertyWebkitNbspMode: // normal | space if (id == CSSValueNormal || id == CSSValueSpace) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitLineBreak: // normal | after-white-space if (id == CSSValueNormal || id == CSSValueAfterWhiteSpace) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitMatchNearestMailBlockquoteColor: // normal | match if (id == CSSValueNormal || id == CSSValueMatch) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitHighlight: if (id == CSSValueNone || value->unit == CSSPrimitiveValue::CSS_STRING) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitBorderFit: if (id == CSSValueBorder || id == CSSValueLines) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitTextSecurity: // disc | circle | square | none | inherit if (id == CSSValueDisc || id == CSSValueCircle || id == CSSValueSquare|| id == CSSValueNone) - valid_primitive = true; + validPrimitive = true; break; case CSSPropertyWebkitFontSmoothing: if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueAntialiased || id == CSSValueSubpixelAntialiased) - valid_primitive = true; + validPrimitive = true; break; #if ENABLE(DASHBOARD_SUPPORT) @@ -1646,7 +1654,7 @@ bool CSSParser::parseValue(int propId, bool important) // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit if (id >= CSSValueCaption && id <= CSSValueStatusBar) - valid_primitive = true; + validPrimitive = true; else return parseFont(important); break; @@ -1688,7 +1696,7 @@ bool CSSParser::parseValue(int propId, bool important) #endif } - if (valid_primitive) { + if (validPrimitive) { if (id != 0) parsedValue = CSSPrimitiveValue::createIdentifier(id); else if (value->unit == CSSPrimitiveValue::CSS_STRING) @@ -2235,7 +2243,7 @@ PassRefPtr CSSParser::parseFillPositionXY(bool& xFound, bool& yFound) percent = 50; return CSSPrimitiveValue::create(percent, CSSPrimitiveValue::CSS_PERCENTAGE); } - if (validUnit(m_valueList->current(), FPercent|FLength, m_strict)) + if (validUnit(m_valueList->current(), FPercent | FLength, m_strict)) return CSSPrimitiveValue::create(m_valueList->current()->fValue, (CSSPrimitiveValue::UnitTypes)m_valueList->current()->unit); @@ -2343,7 +2351,7 @@ PassRefPtr CSSParser::parseFillSize(int propId, bool& allowComma) if (value->id == CSSValueAuto) parsedValue1 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN); else { - if (!validUnit(value, FLength|FPercent, m_strict)) + if (!validUnit(value, FLength | FPercent, m_strict)) return 0; parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } @@ -2356,7 +2364,7 @@ PassRefPtr CSSParser::parseFillSize(int propId, bool& allowComma) else if (value->unit == CSSParserValue::Operator && value->iValue == ',') allowComma = false; else { - if (!validUnit(value, FLength|FPercent, m_strict)) + if (!validUnit(value, FLength | FPercent, m_strict)) return 0; parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); } @@ -2558,7 +2566,7 @@ PassRefPtr CSSParser::parseAnimationDirection() PassRefPtr CSSParser::parseAnimationDuration() { CSSParserValue* value = m_valueList->current(); - if (validUnit(value, FTime|FNonNeg, m_strict)) + if (validUnit(value, FTime | FNonNeg, m_strict)) return CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); return 0; } @@ -2568,7 +2576,7 @@ PassRefPtr CSSParser::parseAnimationIterationCount() CSSParserValue* value = m_valueList->current(); if (value->id == CSSValueInfinite) return CSSPrimitiveValue::createIdentifier(value->id); - if (validUnit(value, FInteger|FNonNeg, m_strict)) + if (validUnit(value, FInteger | FNonNeg, m_strict)) return CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit); return 0; } @@ -3039,7 +3047,7 @@ bool CSSParser::parseFont(bool important) } else { valid = false; } - } else if (!font->weight && validUnit(value, FInteger|FNonNeg, true)) { + } else if (!font->weight && validUnit(value, FInteger | FNonNeg, true)) { int weight = (int)value->fValue; int val = 0; if (weight == 100) @@ -3087,7 +3095,7 @@ bool CSSParser::parseFont(bool important) // | | | | inherit if (value->id >= CSSValueXxSmall && value->id <= CSSValueLarger) font->size = CSSPrimitiveValue::createIdentifier(value->id); - else if (validUnit(value, FLength|FPercent|FNonNeg, m_strict)) + else if (validUnit(value, FLength | FPercent | FNonNeg, m_strict)) font->size = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit); value = m_valueList->next(); if (!font->size || !value) @@ -3100,7 +3108,7 @@ bool CSSParser::parseFont(bool important) return false; if (value->id == CSSValueNormal) { // default value, nothing to do - } else if (validUnit(value, FNumber|FLength|FPercent|FNonNeg, m_strict)) + } else if (validUnit(value, FNumber | FLength | FPercent | FNonNeg, m_strict)) font->lineHeight = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes) value->unit); else return false; @@ -3328,6 +3336,12 @@ bool CSSParser::parseFontWeight(bool important) return false; } +static bool isValidFormatFunction(CSSParserValue* val) +{ + CSSParserValueList* args = val->function->args; + return equalIgnoringCase(val->function->name, "format(") && (args->current()->unit == CSSPrimitiveValue::CSS_STRING || args->current()->unit == CSSPrimitiveValue::CSS_IDENT); +} + bool CSSParser::parseFontFaceSrc() { RefPtr values(CSSValueList::createCommaSeparated()); @@ -3355,7 +3369,7 @@ bool CSSParser::parseFontFaceSrc() CSSParserValue* a = args->current(); uriValue.clear(); parsedValue = CSSFontFaceSrcValue::createLocal(a->string); - } else if (equalIgnoringCase(val->function->name, "format(") && allowFormat && uriValue) { + } else if (allowFormat && uriValue && isValidFormatFunction(val)) { expectComma = true; allowFormat = false; uriValue->setFormat(args->current()->string); @@ -3754,8 +3768,8 @@ bool CSSParser::parseShadow(int propId, bool important) // value. Treat as invalid. return false; #if ENABLE(SVG) - // -webkit-shadow does not support multiple values. - if (static_cast(propId) == CSSPropertyWebkitShadow) + // -webkit-svg-shadow does not support multiple values. + if (static_cast(propId) == CSSPropertyWebkitSvgShadow) return false; #endif // The value is good. Commit it. @@ -4015,7 +4029,7 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr& r return false; while ((val = m_valueList->next())) { - if (context.allowNumber() && validUnit(val, FInteger|FNonNeg|FPercent, true)) { + if (context.allowNumber() && validUnit(val, FInteger | FNonNeg | FPercent, true)) { context.commitNumber(val); } else if (propId == CSSPropertyWebkitBorderImage && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/') { context.commitSlash(); @@ -4613,11 +4627,13 @@ static inline int yyerror(const char*) { return 1; } int CSSParser::lex(void* yylvalWithoutType) { YYSTYPE* yylval = static_cast(yylvalWithoutType); - int token = lex(); int length; + + lex(); + UChar* t = text(&length); - switch (token) { + switch (token()) { case WHITESPACE: case SGML_CD: case INCLUDES: @@ -4683,7 +4699,7 @@ int CSSParser::lex(void* yylvalWithoutType) break; } - return token; + return token(); } static inline bool isCSSWhitespace(UChar c) @@ -4691,6 +4707,28 @@ static inline bool isCSSWhitespace(UChar c) return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'; } +void CSSParser::recheckAtKeyword(const UChar* str, int len) +{ + String ruleName(str, len); + if (equalIgnoringCase(ruleName, "@import")) + yyTok = IMPORT_SYM; + else if (equalIgnoringCase(ruleName, "@page")) + yyTok = PAGE_SYM; + else if (equalIgnoringCase(ruleName, "@media")) + yyTok = MEDIA_SYM; + else if (equalIgnoringCase(ruleName, "@font-face")) + yyTok = FONT_FACE_SYM; + else if (equalIgnoringCase(ruleName, "@charset")) + yyTok = CHARSET_SYM; + else if (equalIgnoringCase(ruleName, "@namespace")) + yyTok = NAMESPACE_SYM; + else if (equalIgnoringCase(ruleName, "@-webkit-keyframes")) + yyTok = WEBKIT_KEYFRAMES_SYM; + else if (equalIgnoringCase(ruleName, "@-webkit-mediaquery")) + yyTok = WEBKIT_MEDIAQUERY_SYM; + // FIXME: Add CSS Variables if we ever decide to turn it back on. +} + UChar* CSSParser::text(int *length) { UChar* start = yytext; @@ -4744,6 +4782,8 @@ UChar* CSSParser::text(int *length) UChar* out = start; UChar* escape = 0; + bool sawEscape = false; + for (int i = 0; i < l; i++) { UChar* current = start + i; if (escape == current - 1) { @@ -4788,6 +4828,7 @@ UChar* CSSParser::text(int *length) } if (!escape && *current == '\\') { escape = current; + sawEscape = true; continue; } *out++ = *current; @@ -4808,6 +4849,12 @@ UChar* CSSParser::text(int *length) } *length = out - start; + + // If we have an unrecognized @-keyword, and if we handled any escapes at all, then + // we should attempt to adjust yyTok to the correct type. + if (yyTok == ATKEYWORD && sawEscape) + recheckAtKeyword(start, *length); + return start; } @@ -4938,7 +4985,7 @@ CSSRule* CSSParser::createCharsetRule(const CSSParserString& charset) CSSRule* CSSParser::createImportRule(const CSSParserString& url, MediaList* media) { - if (!media || !m_styleSheet) + if (!media || !m_styleSheet || !m_allowImportRules) return 0; RefPtr rule = CSSImportRule::create(m_styleSheet, url, media); CSSImportRule* result = rule.get(); @@ -4950,6 +4997,7 @@ CSSRule* CSSParser::createMediaRule(MediaList* media, CSSRuleList* rules) { if (!media || !rules || !m_styleSheet) return 0; + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr rule = CSSMediaRule::create(m_styleSheet, media, rules); CSSMediaRule* result = rule.get(); m_parsedStyleObjects.append(rule.release()); @@ -4967,6 +5015,7 @@ CSSRuleList* CSSParser::createRuleList() WebKitCSSKeyframesRule* CSSParser::createKeyframesRule() { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr rule = WebKitCSSKeyframesRule::create(m_styleSheet); WebKitCSSKeyframesRule* rulePtr = rule.get(); m_parsedStyleObjects.append(rule.release()); @@ -4975,6 +5024,7 @@ WebKitCSSKeyframesRule* CSSParser::createKeyframesRule() CSSRule* CSSParser::createStyleRule(Vector* selectors) { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; CSSStyleRule* result = 0; if (selectors) { RefPtr rule = CSSStyleRule::create(m_styleSheet); @@ -4991,6 +5041,7 @@ CSSRule* CSSParser::createStyleRule(Vector* selectors) CSSRule* CSSParser::createFontFaceRule() { + m_allowImportRules = m_allowNamespaceDeclarations = m_allowVariablesRules = false; RefPtr rule = CSSFontFaceRule::create(m_styleSheet); for (unsigned i = 0; i < m_numParsedProperties; ++i) { CSSProperty* property = m_parsedProperties[i]; @@ -5008,6 +5059,15 @@ CSSRule* CSSParser::createFontFaceRule() return result; } +void CSSParser::addNamespace(const AtomicString& prefix, const AtomicString& uri) +{ + if (!m_styleSheet || !m_allowNamespaceDeclarations) + return; + m_allowImportRules = false; + m_allowVariablesRules = false; + m_styleSheet->addNamespace(this, prefix, uri); +} + #if !ENABLE(CSS_VARIABLES) CSSRule* CSSParser::createVariablesRule(MediaList*, bool) @@ -5029,6 +5089,9 @@ bool CSSParser::addVariableDeclarationBlock(const CSSParserString&) CSSRule* CSSParser::createVariablesRule(MediaList* mediaList, bool variablesKeyword) { + if (!m_allowVariablesRules) + return 0; + m_allowImportRules = false; RefPtr rule = CSSVariablesRule::create(m_styleSheet, mediaList, variablesKeyword); rule->setDeclaration(CSSVariablesDeclaration::create(rule.get(), m_variableNames, m_variableValues)); clearVariables(); @@ -5169,6 +5232,12 @@ WebKitCSSKeyframeRule* CSSParser::createKeyframeRule(CSSParserValueList* keys) return keyframePtr; } +void CSSParser::invalidBlockHit() +{ + if (m_styleSheet && !m_hadSyntacticallyValidCSSRule) + m_styleSheet->setHasSyntacticallyValidCSSHeader(false); +} + static int cssPropertyID(const UChar* propertyName, unsigned length) { if (!length) diff --git a/src/3rdparty/webkit/WebCore/css/CSSParser.h b/src/3rdparty/webkit/WebCore/css/CSSParser.h index 6d1bb32..3922a2a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSParser.h +++ b/src/3rdparty/webkit/WebCore/css/CSSParser.h @@ -187,13 +187,16 @@ namespace WebCore { MediaQuery* createFloatingMediaQuery(Vector*); MediaQuery* sinkFloatingMediaQuery(MediaQuery*); + void addNamespace(const AtomicString& prefix, const AtomicString& uri); + bool addVariable(const CSSParserString&, CSSParserValueList*); bool addVariableDeclarationBlock(const CSSParserString&); bool checkForVariables(CSSParserValueList*); void addUnresolvedProperty(int propId, bool important); + void invalidBlockHit(); Vector* reusableSelectorVector() { return &m_reusableSelectorVector; } - + bool m_strict; bool m_important; int m_id; @@ -212,6 +215,7 @@ namespace WebCore { bool m_implicitShorthand; bool m_hasFontFaceOnlyValues; + bool m_hadSyntacticallyValidCSSRule; Vector m_variableNames; Vector > m_variableValues; @@ -225,6 +229,8 @@ namespace WebCore { int lex(); private: + void recheckAtKeyword(const UChar* str, int len); + void clearProperties(); void setupParser(const char* prefix, const String&, const char* suffix); @@ -247,6 +253,10 @@ namespace WebCore { int yyTok; int yy_start; + bool m_allowImportRules; + bool m_allowVariablesRules; + bool m_allowNamespaceDeclarations; + Vector > m_parsedStyleObjects; Vector > m_parsedRuleLists; HashSet m_floatingSelectors; @@ -287,7 +297,7 @@ namespace WebCore { int cssPropertyID(const String&); int cssValueKeywordID(const CSSParserString&); - class ShorthandScope { + class ShorthandScope : public FastAllocBase { public: ShorthandScope(CSSParser* parser, int propId) : m_parser(parser) { diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.cpp b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.cpp index d2286bb..1f2c9ca 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.cpp @@ -34,8 +34,6 @@ #include "Rect.h" #include "RenderStyle.h" #include -#include -#include #include #if ENABLE(DASHBOARD_SUPPORT) @@ -686,71 +684,6 @@ int CSSPrimitiveValue::getIdent() return m_value.ident; } -static void appendCSSDouble(Vector& vector, double value) -{ - // From the CSS specification section titled "Integers and real numbers", - // real numbers are only formatted as [sign] [digits] "." [digits]. - // This differs from printf-style formatting in that exponents (e.g. 1.3e06) - // are not allowed. Since NaN/inf are also not valid CSS values this - // function doesn't handle them. - - // For compatibility with what was returned by older versions of - // WebKit, we target 6 digits of precision. - const int digitsAfterDecimalPoint = 6; - long long rounded = llround(fabs(value) * 1000000.0); - if (rounded == 0) { - vector.append('0'); - return; - } - - char buf[24]; - int length = snprintf(buf, sizeof(buf), "%lld", rounded); - int decimalPoint = length - digitsAfterDecimalPoint; - - // We are matching printf("%g")'s behavior and must trim trailing zeros, - // regardless of whether they're significant. - while (length > 0 && length > decimalPoint && buf[length - 1] == '0') - length--; - - // Reserve an estimate of space for the number of digits we anticipate - // along with a minus sign/initial zero/decimal point. - vector.reserveCapacity(vector.size() + 3 + length); - - if (value < 0) - vector.append('-'); - - if (decimalPoint <= 0) { - // Only digits after the decimal point. - vector.append('0'); - vector.append('.'); - for (int i = decimalPoint; i < 0; i++) - vector.append('0'); - for (int i = 0; i < length; i++) - vector.append(buf[i]); - } else if (length <= decimalPoint) { - // Only digits before the decimal point. - for (int i = 0; i < length; i++) - vector.append(buf[i]); - } else { - // Digits before and after the decimal point. - for (int i = 0; i < decimalPoint; i++) - vector.append(buf[i]); - vector.append('.'); - for (int i = decimalPoint; i < length; i++) - vector.append(buf[i]); - } -} - -static String formatWithUnits(double value, const char* units) -{ - Vector result; - appendCSSDouble(result, value); - result.reserveCapacity(result.size() + strlen(units)); - for (int i = 0; units[i]; i++) - result.append(units[i]); - return String::adopt(result); -} - String CSSPrimitiveValue::cssText() const { // FIXME: return the original value instead of a generated one (e.g. color @@ -762,61 +695,61 @@ String CSSPrimitiveValue::cssText() const break; case CSS_NUMBER: case CSS_PARSER_INTEGER: - text = formatWithUnits(m_value.num, ""); + text = String::number(m_value.num); break; case CSS_PERCENTAGE: - text = formatWithUnits(m_value.num, "%"); + text = String::format("%.6lg%%", m_value.num); break; case CSS_EMS: - text = formatWithUnits(m_value.num, "em"); + text = String::format("%.6lgem", m_value.num); break; case CSS_EXS: - text = formatWithUnits(m_value.num, "ex"); + text = String::format("%.6lgex", m_value.num); break; case CSS_REMS: - text = formatWithUnits(m_value.num, "rem"); + text = String::format("%.6lgrem", m_value.num); break; case CSS_PX: - text = formatWithUnits(m_value.num, "px"); + text = String::format("%.6lgpx", m_value.num); break; case CSS_CM: - text = formatWithUnits(m_value.num, "cm"); + text = String::format("%.6lgcm", m_value.num); break; case CSS_MM: - text = formatWithUnits(m_value.num, "mm"); + text = String::format("%.6lgmm", m_value.num); break; case CSS_IN: - text = formatWithUnits(m_value.num, "in"); + text = String::format("%.6lgin", m_value.num); break; case CSS_PT: - text = formatWithUnits(m_value.num, "pt"); + text = String::format("%.6lgpt", m_value.num); break; case CSS_PC: - text = formatWithUnits(m_value.num, "pc"); + text = String::format("%.6lgpc", m_value.num); break; case CSS_DEG: - text = formatWithUnits(m_value.num, "deg"); + text = String::format("%.6lgdeg", m_value.num); break; case CSS_RAD: - text = formatWithUnits(m_value.num, "rad"); + text = String::format("%.6lgrad", m_value.num); break; case CSS_GRAD: - text = formatWithUnits(m_value.num, "grad"); + text = String::format("%.6lggrad", m_value.num); break; case CSS_MS: - text = formatWithUnits(m_value.num, "ms"); + text = String::format("%.6lgms", m_value.num); break; case CSS_S: - text = formatWithUnits(m_value.num, "s"); + text = String::format("%.6lgs", m_value.num); break; case CSS_HZ: - text = formatWithUnits(m_value.num, "hz"); + text = String::format("%.6lghz", m_value.num); break; case CSS_KHZ: - text = formatWithUnits(m_value.num, "khz"); + text = String::format("%.6lgkhz", m_value.num); break; case CSS_TURN: - text = formatWithUnits(m_value.num, "turn"); + text = String::format("%.6lgturn", m_value.num); break; case CSS_DIMENSION: // FIXME diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.idl b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.idl index befe5ac..8580664 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValue.idl @@ -19,11 +19,7 @@ module css { - interface [ - GenerateConstructor, - InterfaceUUID=a286b0cb-4ff0-4482-aa6e-7c5fb39afaba, - ImplementationUUID=c310c84d-480f-4bbb-9187-28e00956ac47 - ] CSSPrimitiveValue : CSSValue { + interface CSSPrimitiveValue : CSSValue { // UnitTypes const unsigned short CSS_UNKNOWN = 0; @@ -69,11 +65,8 @@ module css { raises(DOMException); Rect getRectValue() raises(DOMException); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM RGBColor getRGBColorValue() raises(DOMException); -#endif - }; } diff --git a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h index 6f89df9..c20448e 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h +++ b/src/3rdparty/webkit/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2007 Alexey Proskuryakov . - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Redistribution and use in source and binary forms, with or without @@ -28,6 +28,7 @@ #ifndef CSSPrimitiveValueMappings_h #define CSSPrimitiveValueMappings_h +#include "ColorSpace.h" #include "CSSPrimitiveValue.h" #include "CSSValueKeywords.h" #include "FontSmoothingMode.h" @@ -197,6 +198,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case DefaultButtonPart: m_value.ident = CSSValueDefaultButton; break; + case InnerSpinButtonPart: + m_value.ident = CSSValueInnerSpinButton; + break; case ListboxPart: m_value.ident = CSSValueListbox; break; @@ -229,6 +233,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MediaReturnToRealtimeButtonPart: m_value.ident = CSSValueMediaReturnToRealtimeButton; break; + case MediaToggleClosedCaptionsButtonPart: + m_value.ident = CSSValueMediaToggleClosedCaptionsButton; + break; case MediaSliderPart: m_value.ident = CSSValueMediaSlider; break; @@ -265,6 +272,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e) case MenulistTextFieldPart: m_value.ident = CSSValueMenulistTextfield; break; + case OuterSpinButtonPart: + m_value.ident = CSSValueOuterSpinButton; + break; case SliderHorizontalPart: m_value.ident = CSSValueSliderHorizontal; break; @@ -926,69 +936,237 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e) : m_type(CSS_IDENT) { switch (e) { - case LNONE: - m_value.ident = CSSValueNone; - break; - case DISC: - m_value.ident = CSSValueDisc; - break; - case CIRCLE: - m_value.ident = CSSValueCircle; - break; - case SQUARE: - m_value.ident = CSSValueSquare; - break; - case LDECIMAL: - m_value.ident = CSSValueDecimal; - break; - case DECIMAL_LEADING_ZERO: - m_value.ident = CSSValueDecimalLeadingZero; - break; - case LOWER_ROMAN: - m_value.ident = CSSValueLowerRoman; - break; - case UPPER_ROMAN: - m_value.ident = CSSValueUpperRoman; - break; - case LOWER_GREEK: - m_value.ident = CSSValueLowerGreek; - break; - case LOWER_ALPHA: - m_value.ident = CSSValueLowerAlpha; - break; - case LOWER_LATIN: - m_value.ident = CSSValueLowerLatin; - break; - case UPPER_ALPHA: - m_value.ident = CSSValueUpperAlpha; - break; - case UPPER_LATIN: - m_value.ident = CSSValueUpperLatin; - break; - case HEBREW: - m_value.ident = CSSValueHebrew; - break; - case ARMENIAN: - m_value.ident = CSSValueArmenian; - break; - case GEORGIAN: - m_value.ident = CSSValueGeorgian; - break; - case CJK_IDEOGRAPHIC: - m_value.ident = CSSValueCjkIdeographic; - break; - case HIRAGANA: - m_value.ident = CSSValueHiragana; - break; - case KATAKANA: - m_value.ident = CSSValueKatakana; - break; - case HIRAGANA_IROHA: - m_value.ident = CSSValueHiraganaIroha; - break; - case KATAKANA_IROHA: - m_value.ident = CSSValueKatakanaIroha; - break; + case Afar: + m_value.ident = CSSValueAfar; + break; + case Amharic: + m_value.ident = CSSValueAmharic; + break; + case AmharicAbegede: + m_value.ident = CSSValueAmharicAbegede; + break; + case ArabicIndic: + m_value.ident = CSSValueArabicIndic; + break; + case Armenian: + m_value.ident = CSSValueArmenian; + break; + case BinaryListStyle: + m_value.ident = CSSValueBinary; + break; + case Bengali: + m_value.ident = CSSValueBengali; + break; + case Cambodian: + m_value.ident = CSSValueCambodian; + break; + case Circle: + m_value.ident = CSSValueCircle; + break; + case CjkEarthlyBranch: + m_value.ident = CSSValueCjkEarthlyBranch; + break; + case CjkHeavenlyStem: + m_value.ident = CSSValueCjkHeavenlyStem; + break; + case CJKIdeographic: + m_value.ident = CSSValueCjkIdeographic; + break; + case DecimalLeadingZero: + m_value.ident = CSSValueDecimalLeadingZero; + break; + case DecimalListStyle: + m_value.ident = CSSValueDecimal; + break; + case Devanagari: + m_value.ident = CSSValueDevanagari; + break; + case Disc: + m_value.ident = CSSValueDisc; + break; + case Ethiopic: + m_value.ident = CSSValueEthiopic; + break; + case EthiopicAbegede: + m_value.ident = CSSValueEthiopicAbegede; + break; + case EthiopicAbegedeAmEt: + m_value.ident = CSSValueEthiopicAbegedeAmEt; + break; + case EthiopicAbegedeGez: + m_value.ident = CSSValueEthiopicAbegedeGez; + break; + case EthiopicAbegedeTiEr: + m_value.ident = CSSValueEthiopicAbegedeTiEr; + break; + case EthiopicAbegedeTiEt: + m_value.ident = CSSValueEthiopicAbegedeTiEt; + break; + case EthiopicHalehameAaEr: + m_value.ident = CSSValueEthiopicHalehameAaEr; + break; + case EthiopicHalehameAaEt: + m_value.ident = CSSValueEthiopicHalehameAaEt; + break; + case EthiopicHalehameAmEt: + m_value.ident = CSSValueEthiopicHalehameAmEt; + break; + case EthiopicHalehameGez: + m_value.ident = CSSValueEthiopicHalehameGez; + break; + case EthiopicHalehameOmEt: + m_value.ident = CSSValueEthiopicHalehameOmEt; + break; + case EthiopicHalehameSidEt: + m_value.ident = CSSValueEthiopicHalehameSidEt; + break; + case EthiopicHalehameSoEt: + m_value.ident = CSSValueEthiopicHalehameSoEt; + break; + case EthiopicHalehameTiEr: + m_value.ident = CSSValueEthiopicHalehameTiEr; + break; + case EthiopicHalehameTiEt: + m_value.ident = CSSValueEthiopicHalehameTiEt; + break; + case EthiopicHalehameTig: + m_value.ident = CSSValueEthiopicHalehameTig; + break; + case Georgian: + m_value.ident = CSSValueGeorgian; + break; + case Gujarati: + m_value.ident = CSSValueGujarati; + break; + case Gurmukhi: + m_value.ident = CSSValueGurmukhi; + break; + case Hangul: + m_value.ident = CSSValueHangul; + break; + case HangulConsonant: + m_value.ident = CSSValueHangulConsonant; + break; + case Hebrew: + m_value.ident = CSSValueHebrew; + break; + case Hiragana: + m_value.ident = CSSValueHiragana; + break; + case HiraganaIroha: + m_value.ident = CSSValueHiraganaIroha; + break; + case Kannada: + m_value.ident = CSSValueKannada; + break; + case Katakana: + m_value.ident = CSSValueKatakana; + break; + case KatakanaIroha: + m_value.ident = CSSValueKatakanaIroha; + break; + case Khmer: + m_value.ident = CSSValueKhmer; + break; + case Lao: + m_value.ident = CSSValueLao; + break; + case LowerAlpha: + m_value.ident = CSSValueLowerAlpha; + break; + case LowerGreek: + m_value.ident = CSSValueLowerGreek; + break; + case LowerHexadecimal: + m_value.ident = CSSValueLowerHexadecimal; + break; + case LowerLatin: + m_value.ident = CSSValueLowerLatin; + break; + case LowerNorwegian: + m_value.ident = CSSValueLowerNorwegian; + break; + case LowerRoman: + m_value.ident = CSSValueLowerRoman; + break; + case Malayalam: + m_value.ident = CSSValueMalayalam; + break; + case Mongolian: + m_value.ident = CSSValueMongolian; + break; + case Myanmar: + m_value.ident = CSSValueMyanmar; + break; + case NoneListStyle: + m_value.ident = CSSValueNone; + break; + case Octal: + m_value.ident = CSSValueOctal; + break; + case Oriya: + m_value.ident = CSSValueOriya; + break; + case Oromo: + m_value.ident = CSSValueOromo; + break; + case Persian: + m_value.ident = CSSValuePersian; + break; + case Sidama: + m_value.ident = CSSValueSidama; + break; + case Somali: + m_value.ident = CSSValueSomali; + break; + case Square: + m_value.ident = CSSValueSquare; + break; + case Telugu: + m_value.ident = CSSValueTelugu; + break; + case Thai: + m_value.ident = CSSValueThai; + break; + case Tibetan: + m_value.ident = CSSValueTibetan; + break; + case Tigre: + m_value.ident = CSSValueTigre; + break; + case TigrinyaEr: + m_value.ident = CSSValueTigrinyaEr; + break; + case TigrinyaErAbegede: + m_value.ident = CSSValueTigrinyaErAbegede; + break; + case TigrinyaEt: + m_value.ident = CSSValueTigrinyaEt; + break; + case TigrinyaEtAbegede: + m_value.ident = CSSValueTigrinyaEtAbegede; + break; + case UpperAlpha: + m_value.ident = CSSValueUpperAlpha; + break; + case UpperGreek: + m_value.ident = CSSValueUpperGreek; + break; + case UpperHexadecimal: + m_value.ident = CSSValueUpperHexadecimal; + break; + case UpperLatin: + m_value.ident = CSSValueUpperLatin; + break; + case UpperNorwegian: + m_value.ident = CSSValueUpperNorwegian; + break; + case UpperRoman: + m_value.ident = CSSValueUpperRoman; + break; + case Urdu: + m_value.ident = CSSValueUrdu; + break; } } @@ -996,7 +1174,7 @@ template<> inline CSSPrimitiveValue::operator EListStyleType() const { switch (m_value.ident) { case CSSValueNone: - return LNONE; + return NoneListStyle; default: return static_cast(m_value.ident - CSSValueDisc); } @@ -1881,6 +2059,32 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const } } +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space) + : m_type(CSS_IDENT) +{ + switch (space) { + case DeviceColorSpace: + m_value.ident = CSSValueDefault; + break; + case sRGBColorSpace: + m_value.ident = CSSValueSrgb; + break; + } +} + +template<> inline CSSPrimitiveValue::operator ColorSpace() const +{ + switch (m_value.ident) { + case CSSValueDefault: + return DeviceColorSpace; + case CSSValueSrgb: + return sRGBColorSpace; + default: + ASSERT_NOT_REACHED(); + return DeviceColorSpace; + } +} + #if ENABLE(SVG) template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e) diff --git a/src/3rdparty/webkit/WebCore/css/CSSProperty.cpp b/src/3rdparty/webkit/WebCore/css/CSSProperty.cpp index 9b21a3f..d7f2175 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSProperty.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSProperty.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/CSSProperty.h b/src/3rdparty/webkit/WebCore/css/CSSProperty.h index b5635d0..4505f33 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSProperty.h +++ b/src/3rdparty/webkit/WebCore/css/CSSProperty.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in index 48a18e7..9695d0b 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/CSSPropertyNames.in @@ -185,6 +185,7 @@ zoom -webkit-box-reflect -webkit-box-shadow -webkit-box-sizing +-webkit-color-correction -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside diff --git a/src/3rdparty/webkit/WebCore/css/CSSRule.cpp b/src/3rdparty/webkit/WebCore/css/CSSRule.cpp index 8fe4caf..43d8eac 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSRule.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSRule.cpp @@ -22,7 +22,6 @@ #include "config.h" #include "CSSRule.h" -#include "CSSStyleSheet.h" #include "NotImplemented.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/css/CSSRule.idl b/src/3rdparty/webkit/WebCore/css/CSSRule.idl index bc57e55..eaf1335 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSRule.idl @@ -23,10 +23,7 @@ module css { // Introduced in DOM Level 2: interface [ CustomToJS, - GenerateConstructor, - Polymorphic, - InterfaceUUID=548139b4-31ab-4978-b1d5-cfcfdfbaea0e, - ImplementationUUID=0268e673-2489-4743-9a3a-197dae4b4d9c + Polymorphic ] CSSRule { // RuleType diff --git a/src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp b/src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp index 4528d40..7367ab2 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSRuleList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2005, 2006 Apple Computer, Inc. diff --git a/src/3rdparty/webkit/WebCore/css/CSSRuleList.h b/src/3rdparty/webkit/WebCore/css/CSSRuleList.h index 26186b3..a355c4a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSRuleList.h +++ b/src/3rdparty/webkit/WebCore/css/CSSRuleList.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) * Copyright (C) 2002, 2006 Apple Computer, Inc. diff --git a/src/3rdparty/webkit/WebCore/css/CSSRuleList.idl b/src/3rdparty/webkit/WebCore/css/CSSRuleList.idl index 9add078..e253287 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSRuleList.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSRuleList.idl @@ -28,10 +28,7 @@ module css { // Introduced in DOM Level 2: interface [ CustomMarkFunction, - GenerateConstructor, - HasIndexGetter, - InterfaceUUID=64c346a0-1e34-49d3-9472-57ec8e0fdccb, - ImplementationUUID=971a28e0-d0da-4570-9b71-e39fc2cf9a1b + HasIndexGetter ] CSSRuleList { readonly attribute unsigned long length; CSSRule item(in unsigned long index); diff --git a/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp index 313528f..9ae9b9f 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSSelector.cpp @@ -99,6 +99,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus")); DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover")); DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate")); + DEFINE_STATIC_LOCAL(AtomicString, innerSpinButton, ("-webkit-inner-spin-button")); #if ENABLE(DATALIST) DEFINE_STATIC_LOCAL(AtomicString, inputListButton, ("-webkit-input-list-button")); #endif @@ -116,6 +117,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsReturnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button")); + DEFINE_STATIC_LOCAL(AtomicString, mediaControlsToggleClosedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button")); DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container")); @@ -126,6 +128,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child")); DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type")); DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); + DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button")); DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer")); DEFINE_STATIC_LOCAL(AtomicString, root, ("root")); @@ -234,7 +237,10 @@ void CSSSelector::extractPseudoType() const m_pseudoType = PseudoHover; else if (m_value == indeterminate) m_pseudoType = PseudoIndeterminate; - else if (m_value == link) + else if (m_value == innerSpinButton) { + m_pseudoType = PseudoInnerSpinButton; + element = true; + } else if (m_value == link) m_pseudoType = PseudoLink; else if (m_value == lang) m_pseudoType = PseudoLang; @@ -271,6 +277,9 @@ void CSSSelector::extractPseudoType() const } else if (m_value == mediaControlsReturnToRealtimeButton) { m_pseudoType = PseudoMediaControlsReturnToRealtimeButton; element = true; + } else if (m_value == mediaControlsToggleClosedCaptionsButton) { + m_pseudoType = PseudoMediaControlsToggleClosedCaptions; + element = true; } else if (m_value == mediaControlsStatusDisplay) { m_pseudoType = PseudoMediaControlsStatusDisplay; element = true; @@ -293,7 +302,10 @@ void CSSSelector::extractPseudoType() const m_pseudoType = PseudoNthLastChild; else if (m_value == nthLastOfType) m_pseudoType = PseudoNthLastOfType; - else if (m_value == root) + else if (m_value == outerSpinButton) { + m_pseudoType = PseudoOuterSpinButton; + element = true; + } else if (m_value == root) m_pseudoType = PseudoRoot; else if (m_value == windowInactive) m_pseudoType = PseudoWindowInactive; diff --git a/src/3rdparty/webkit/WebCore/css/CSSSelector.h b/src/3rdparty/webkit/WebCore/css/CSSSelector.h index 0c3b677..70f2574 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSSelector.h +++ b/src/3rdparty/webkit/WebCore/css/CSSSelector.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) * 1999 Waldo Bastian (bastian@kde.org) * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. @@ -176,6 +174,7 @@ namespace WebCore { PseudoMediaControlsVolumeSliderContainer, PseudoMediaControlsCurrentTimeDisplay, PseudoMediaControlsTimeRemainingDisplay, + PseudoMediaControlsToggleClosedCaptions, PseudoMediaControlsTimeline, PseudoMediaControlsVolumeSlider, PseudoMediaControlsSeekBackButton, @@ -184,7 +183,9 @@ namespace WebCore { PseudoMediaControlsReturnToRealtimeButton, PseudoMediaControlsStatusDisplay, PseudoMediaControlsFullscreenButton, - PseudoInputListButton + PseudoInputListButton, + PseudoInnerSpinButton, + PseudoOuterSpinButton, }; PseudoType pseudoType() const @@ -230,7 +231,7 @@ namespace WebCore { void extractPseudoType() const; - struct RareData { + struct RareData : Noncopyable { RareData(CSSSelector* tagHistory) : m_tagHistory(tagHistory) , m_simpleSelector(0) diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.idl b/src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.idl index 3e37418..297b732 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleDeclaration.idl @@ -23,12 +23,9 @@ module css { // Introduced in DOM Level 2: interface [ CustomMarkFunction, - GenerateConstructor, DelegatingPutFunction, HasNameGetter, - HasIndexGetter, - InterfaceUUID=9989b2c3-a2b6-449b-abf9-c60d2260b1d7, - ImplementationUUID=985c50c7-9f19-436a-9e45-c0aa02996d0e + HasIndexGetter ] CSSStyleDeclaration { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString cssText setter raises(DOMException); @@ -44,7 +41,7 @@ module css { raises(DOMException); readonly attribute unsigned long length; - [ConvertNullStringTo=Null] DOMString item(in unsigned long index); + DOMString item(in unsigned long index); readonly attribute CSSRule parentRule; // Extensions diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl b/src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl index 0240dd0..862acd8 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleRule.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=ce4e3330-c40b-4430-8ed4-030ab4ddbc93, - ImplementationUUID=c3d2f1b8-3970-4b36-882e-ce7f5668d8e2 - ] CSSStyleRule : CSSRule { + interface CSSStyleRule : CSSRule { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectorText setter raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp index 40627cf..124eb9f 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.cpp @@ -28,14 +28,11 @@ #include "CSSBorderImageValue.h" #include "CSSCursorImageValue.h" -#include "CSSFontFace.h" #include "CSSFontFaceRule.h" -#include "CSSFontFaceSource.h" #include "CSSImportRule.h" #include "CSSMediaRule.h" #include "CSSParser.h" #include "CSSPrimitiveValueMappings.h" -#include "CSSProperty.h" #include "CSSPropertyNames.h" #include "CSSReflectValue.h" #include "CSSRuleList.h" @@ -61,6 +58,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLTextAreaElement.h" +#include "KeyframeList.h" #include "LinkHash.h" #include "MappedAttribute.h" #include "MatrixTransformOperation.h" @@ -350,7 +348,7 @@ if (id == propID) { \ return; \ } -class CSSRuleSet { +class CSSRuleSet : public Noncopyable { public: CSSRuleSet(); ~CSSRuleSet(); @@ -363,9 +361,9 @@ public: void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, CSSStyleRule* rule, CSSSelector* sel); - CSSRuleDataList* getIDRules(AtomicStringImpl* key) { return m_idRules.get(key); } - CSSRuleDataList* getClassRules(AtomicStringImpl* key) { return m_classRules.get(key); } - CSSRuleDataList* getTagRules(AtomicStringImpl* key) { return m_tagRules.get(key); } + CSSRuleDataList* getIDRules(AtomicStringImpl* key) { m_idRules.checkConsistency(); return m_idRules.get(key); } + CSSRuleDataList* getClassRules(AtomicStringImpl* key) { m_classRules.checkConsistency(); return m_classRules.get(key); } + CSSRuleDataList* getTagRules(AtomicStringImpl* key) { m_tagRules.checkConsistency(); return m_tagRules.get(key); } CSSRuleDataList* getUniversalRules() { return m_universalRules; } public: @@ -416,7 +414,7 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C , m_fontSelector(CSSFontSelector::create(doc)) { init(); - + m_matchAuthorAndUserStyles = matchAuthorAndUserStyles; Element* root = doc->documentElement(); @@ -443,7 +441,7 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C m_medium = new MediaQueryEvaluator("all"); if (root) - m_rootDefaultStyle = styleForElement(root, 0, false, true); // dont ref, because the RenderStyle is allocated from global heap + m_rootDefaultStyle = styleForElement(root, 0, false, true); // don't ref, because the RenderStyle is allocated from global heap if (m_rootDefaultStyle && view) { delete m_medium; @@ -465,7 +463,7 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C // add stylesheets from document m_authorStyle = new CSSRuleSet(); - // Add rules from elments like SVG's + // Add rules from elements like SVG's if (mappedElementSheet) m_authorStyle->addRulesFromSheet(mappedElementSheet, *m_medium, this); @@ -475,6 +473,9 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C if (sheet->isCSSStyleSheet() && !sheet->disabled()) m_authorStyle->addRulesFromSheet(static_cast(sheet), *m_medium, this); } + + if (doc->renderer() && doc->renderer()->style()) + doc->renderer()->style()->font().update(fontSelector()); } // This is a simplified style setting function for keyframe styles @@ -662,7 +663,7 @@ void CSSStyleSelector::matchRules(CSSRuleSet* rules, int& firstRuleIndex, int& l matchRulesForList(rules->getIDRules(m_element->getIDAttribute().impl()), firstRuleIndex, lastRuleIndex); if (m_element->hasClass()) { ASSERT(m_styledElement); - const ClassNames& classNames = m_styledElement->classNames(); + const SpaceSplitString& classNames = m_styledElement->classNames(); size_t size = classNames.size(); for (size_t i = 0; i < size; ++i) matchRulesForList(rules->getClassRules(classNames[i].impl()), firstRuleIndex, lastRuleIndex); @@ -761,7 +762,7 @@ void CSSStyleSelector::sortMatchedRules(unsigned start, unsigned end) return; } - // Peform a merge sort for larger lists. + // Perform a merge sort for larger lists. unsigned mid = (start + end) / 2; sortMatchedRules(start, mid); sortMatchedRules(mid, end); @@ -1003,9 +1004,15 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm()) return false; - - if ((s->willValidate() && s->isValidFormControlElement()) != - (m_element->willValidate() && m_element->isValidFormControlElement())) + + if (!m_element->document()->containsValidityStyleRules()) + return false; + + bool willValidate = s->willValidate(); + if (willValidate != m_element->willValidate()) + return false; + + if (willValidate && (s->isValidFormControlElement() != m_element->isValidFormControlElement())) return false; } @@ -1091,6 +1098,39 @@ void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule) } } +PassRefPtr CSSStyleSelector::styleForDocument(Document* document) +{ + RefPtr documentStyle = RenderStyle::create(); + documentStyle->setDisplay(BLOCK); + documentStyle->setVisuallyOrdered(document->visuallyOrdered()); + documentStyle->setZoom(document->frame()->pageZoomFactor()); + + FontDescription fontDescription; + fontDescription.setUsePrinterFont(document->printing()); + if (Settings* settings = document->settings()) { + fontDescription.setRenderingMode(settings->fontRenderingMode()); + if (document->printing() && !settings->shouldPrintBackgrounds()) + documentStyle->setForceBackgroundsToWhite(true); + const AtomicString& stdfont = settings->standardFontFamily(); + if (!stdfont.isEmpty()) { + fontDescription.firstFamily().setFamily(stdfont); + fontDescription.firstFamily().appendFamily(0); + } + fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); + int size = CSSStyleSelector::fontSizeForKeyword(document, CSSValueMedium, false); + fontDescription.setSpecifiedSize(size); + bool useSVGZoomRules = document->isSVGDocument(); + fontDescription.setComputedSize(CSSStyleSelector::getComputedSizeFromSpecifiedSize(document, documentStyle.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules)); + } + + documentStyle->setFontDescription(fontDescription); + documentStyle->font().update(0); + if (document->inCompatMode()) + documentStyle->setHtmlHacks(true); // enable html specific rendering tricks + + return documentStyle.release(); +} + // If resolveForRootDefault is true, style based on user agent style sheet only. This is used in media queries, where // relative units are interpreted according to document root element style, styled only with UA stylesheet @@ -1297,7 +1337,9 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* // Get the keyframesRule for this name if (!e || list.animationName().isEmpty()) return; - + + m_keyframesRuleMap.checkConsistency(); + if (!m_keyframesRuleMap.contains(list.animationName().impl())) return; @@ -2409,11 +2451,17 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme return e && e->isOptionalFormControl(); case CSSSelector::PseudoRequired: return e && e->isRequiredFormControl(); - case CSSSelector::PseudoValid: - return e && e->willValidate() && e->isValidFormControlElement(); - case CSSSelector::PseudoInvalid: - return e && e->willValidate() && !e->isValidFormControlElement(); - case CSSSelector::PseudoChecked: { + case CSSSelector::PseudoValid: { + if (!e) + return false; + e->document()->setContainsValidityStyleRules(); + return e->willValidate() && e->isValidFormControlElement(); + } case CSSSelector::PseudoInvalid: { + if (!e) + return false; + e->document()->setContainsValidityStyleRules(); + return e->willValidate() && !e->isValidFormControlElement(); + } case CSSSelector::PseudoChecked: { if (!e || !e->isFormControlElement()) break; // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that @@ -2556,6 +2604,9 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoMediaControlsReturnToRealtimeButton: dynamicPseudo = MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON; return true; + case CSSSelector::PseudoMediaControlsToggleClosedCaptions: + dynamicPseudo = MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON; + return true; case CSSSelector::PseudoMediaControlsStatusDisplay: dynamicPseudo = MEDIA_CONTROLS_STATUS_DISPLAY; return true; @@ -2583,6 +2634,12 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoResizer: dynamicPseudo = RESIZER; return true; + case CSSSelector::PseudoInnerSpinButton: + dynamicPseudo = INNER_SPIN_BUTTON; + return true; + case CSSSelector::PseudoOuterSpinButton: + dynamicPseudo = OUTER_SPIN_BUTTON; + return true; case CSSSelector::PseudoUnknown: case CSSSelector::PseudoNotParsed: default: @@ -2864,7 +2921,7 @@ void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant, case CSSPropertyFontVariant: case CSSPropertyZoom: // these have to be applied first, because other properties use the computed - // values of these porperties. + // values of these properties. first = true; break; default: @@ -2927,6 +2984,16 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) float zoomFactor = m_style->effectiveZoom(); + // SVG handles zooming in a different way compared to CSS. The whole document is scaled instead + // of each individual length value in the render style / tree. CSSPrimitiveValue::computeLength*() + // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that. + // Though all CSS values that can be applied to outermost elements (width/height/border/padding...) + // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot) grabs values like + // width/height/border/padding/... from the RenderStyle -> for SVG these values would never scale, + // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific + // properties that are NOT allowed to scale within a zoomed SVG document (letter/word-spacing/font-size). + bool useSVGZoomRules = m_element && m_element->isSVGElement(); + Length l; bool apply = false; @@ -3029,7 +3096,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) #if ENABLE(WCSS) if (primitiveValue) { if (primitiveValue->getIdent() == CSSValueWapMarquee) { - // Initialize Wap Marquee style + // Initialize WAP Marquee style m_style->setOverflowX(OMARQUEE); m_style->setOverflowY(OMARQUEE); m_style->setWhiteSpace(NOWRAP); @@ -3568,7 +3635,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } else { if (!primitiveValue) return; - width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor); + width = primitiveValue->computeLengthInt(style(), m_rootElementStyle, useSVGZoomRules ? 1.0f : zoomFactor); } switch (id) { case CSSPropertyLetterSpacing: @@ -3878,7 +3945,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_parentNode) fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize()); } else if (isInitial) { - size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); + size = fontSizeForKeyword(m_checker.m_document, CSSValueMedium, fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); } else if (primitiveValue->getIdent()) { // Keywords are being used. @@ -3891,7 +3958,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSValueXLarge: case CSSValueXxLarge: case CSSValueWebkitXxxLarge: - size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); + size = fontSizeForKeyword(m_checker.m_document, primitiveValue->getIdent(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1); break; case CSSValueLarger: @@ -3978,7 +4045,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (primitiveValue->getIdent() == CSSValueNormal) lineHeight = Length(-100.0, Percent); else if (CSSPrimitiveValue::isUnitTypeLength(type)) { - double multiplier = m_style->effectiveZoom(); + double multiplier = zoomFactor; if (m_style->textSizeAdjust() && m_checker.m_document->frame() && m_checker.m_document->frame()->shouldApplyTextZoom()) multiplier *= m_checker.m_document->frame()->textZoomFactor(); lineHeight = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle, multiplier), Fixed); @@ -4140,7 +4207,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // We need to adjust the size to account for the generic family change from monospace // to non-monospace. if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize()) - setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false)); + setFontSize(fontDescription, fontSizeForKeyword(m_checker.m_document, CSSValueXxSmall + fontDescription.keywordSize() - 1, false)); fontDescription.setGenericFamily(initialDesc.genericFamily()); if (!initialDesc.firstFamily().familyIsEmpty()) fontDescription.setFamily(initialDesc.firstFamily()); @@ -4217,7 +4284,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) // If currFamily is non-zero then we set at least one family on this description. if (currFamily) { if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) - setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize)); + setFontSize(fontDescription, fontSizeForKeyword(m_checker.m_document, CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize)); if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; @@ -4437,7 +4504,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) fontDescription.firstFamily().appendFamily(0); } fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); - setFontSize(fontDescription, fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), false)); + setFontSize(fontDescription, fontSizeForKeyword(m_checker.m_document, CSSValueMedium, false)); m_style->setLineHeight(RenderStyle::initialLineHeight()); m_lineHeightValue = 0; if (m_style->setFontDescription(fontDescription)) @@ -4460,7 +4527,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) fontDescription.setUsePrinterFont(m_checker.m_document->printing()); // Handle the zoom factor. - fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescription.isAbsoluteSize(), fontDescription.specifiedSize())); + fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), fontDescription.specifiedSize(), useSVGZoomRules)); if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; } @@ -5000,13 +5067,15 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSPropertyWebkitMarginBottomCollapse: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marginBottomCollapse, MarginBottomCollapse) return; - - // Apple-specific changes. Do not merge these properties into KHTML. case CSSPropertyWebkitLineClamp: { HANDLE_INHERIT_AND_INITIAL(lineClamp, LineClamp) if (!primitiveValue) return; - m_style->setLineClamp(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE)); + int type = primitiveValue->primitiveType(); + if (type == CSSPrimitiveValue::CSS_NUMBER) + m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_NUMBER), LineClampLineCount)); + else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) + m_style->setLineClamp(LineClampValue(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_PERCENTAGE), LineClampPercentage)); return; } case CSSPropertyWebkitHighlight: { @@ -5267,6 +5336,17 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setPointerEvents(*primitiveValue); return; } + case CSSPropertyWebkitColorCorrection: + if (isInherit) + m_style->setColorSpace(m_parentStyle->colorSpace()); + else if (isInitial) + m_style->setColorSpace(DeviceColorSpace); + else { + if (!primitiveValue) + return; + m_style->setColorSpace(*primitiveValue); + } + return; case CSSPropertyInvalid: return; case CSSPropertyFontStretch: @@ -5769,7 +5849,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty // multiplying by our scale factor. float size; if (childFont.keywordSize()) - size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize()); + size = fontSizeForKeyword(m_checker.m_document, CSSValueXxSmall + childFont.keywordSize() - 1, childFont.useFixedDefaultSize()); else { Settings* settings = m_checker.m_document->settings(); float fixedScaleFactor = settings @@ -5788,11 +5868,20 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty void CSSStyleSelector::setFontSize(FontDescription& fontDescription, float size) { fontDescription.setSpecifiedSize(size); - fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(fontDescription.isAbsoluteSize(), size)); + + bool useSVGZoomRules = m_element && m_element->isSVGElement(); + fontDescription.setComputedSize(getComputedSizeFromSpecifiedSize(m_checker.m_document, m_style.get(), fontDescription.isAbsoluteSize(), size, useSVGZoomRules)); } -float CSSStyleSelector::getComputedSizeFromSpecifiedSize(bool isAbsoluteSize, float specifiedSize) +float CSSStyleSelector::getComputedSizeFromSpecifiedSize(Document* document, RenderStyle* style, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules) { + float zoomFactor = 1.0f; + if (!useSVGZoomRules) { + zoomFactor = style->effectiveZoom(); + if (document->frame() && document->frame()->shouldApplyTextZoom()) + zoomFactor *= document->frame()->textZoomFactor(); + } + // We support two types of minimum font size. The first is a hard override that applies to // all fonts. This is "minSize." The second type of minimum font size is a "smart minimum" // that is applied only when the Web page can't know what size it really asked for, e.g., @@ -5803,17 +5892,12 @@ float CSSStyleSelector::getComputedSizeFromSpecifiedSize(bool isAbsoluteSize, fl // However we always allow the page to set an explicit pixel size that is smaller, // since sites will mis-render otherwise (e.g., http://www.gamespot.com with a 9px minimum). - Settings* settings = m_checker.m_document->settings(); + Settings* settings = document->settings(); if (!settings) return 1.0f; int minSize = settings->minimumFontSize(); int minLogicalSize = settings->minimumLogicalFontSize(); - - float zoomFactor = m_style->effectiveZoom(); - if (m_checker.m_document->frame() && m_checker.m_document->frame()->shouldApplyTextZoom()) - zoomFactor *= m_checker.m_document->frame()->textZoomFactor(); - float zoomedSize = specifiedSize * zoomFactor; // Apply the hard minimum first. We only apply the hard minimum if after zooming we're still too small. @@ -5874,12 +5958,13 @@ static const int strictFontSizeTable[fontSizeTableMax - fontSizeTableMin + 1][to // factors for each keyword value. static const float fontSizeFactors[totalKeywords] = { 0.60f, 0.75f, 0.89f, 1.0f, 1.2f, 1.5f, 2.0f, 3.0f }; -float CSSStyleSelector::fontSizeForKeyword(int keyword, bool quirksMode, bool fixed) const +float CSSStyleSelector::fontSizeForKeyword(Document* document, int keyword, bool fixed) { - Settings* settings = m_checker.m_document->settings(); + Settings* settings = document->settings(); if (!settings) return 1.0f; + bool quirksMode = document->inCompatMode(); int mediumSize = fixed ? settings->defaultFixedFontSize() : settings->defaultFontSize(); if (mediumSize >= fontSizeTableMin && mediumSize <= fontSizeTableMax) { // Look up the entry in the table. diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h index 6e0663f..644051c 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSelector.h @@ -23,7 +23,6 @@ #define CSSStyleSelector_h #include "CSSFontSelector.h" -#include "KeyframeList.h" #include "LinkHash.h" #include "MediaQueryExp.h" #include "RenderStyle.h" @@ -56,6 +55,7 @@ class Element; class Frame; class FrameView; class KURL; +class KeyframeList; class MediaQueryEvaluator; class Node; class Settings; @@ -65,7 +65,7 @@ class StyleSheetList; class StyledElement; class WebKitCSSKeyframesRule; -class MediaQueryResult { +class MediaQueryResult : public Noncopyable { public: MediaQueryResult(const MediaQueryExp& expr, bool result) : m_expression(expr) @@ -92,6 +92,8 @@ public: PassRefPtr pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0); + static PassRefPtr styleForDocument(Document*); + #if ENABLE(DATAGRID) // Datagrid style computation (uses unique pseudo elements and structures) PassRefPtr pseudoStyleForDataGridColumn(DataGridColumn*, RenderStyle* parentStyle); @@ -112,8 +114,8 @@ public: // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return // the correct font size scaled relative to the user's default (medium). - float fontSizeForKeyword(int keyword, bool quirksMode, bool monospace) const; - + static float fontSizeForKeyword(Document*, int keyword, bool monospace); + private: // When the CSS keyword "larger" is used, this function will attempt to match within the keyword // table, and failing that, will simply multiply by 1.2. @@ -129,7 +131,7 @@ public: void applyPropertyToStyle(int id, CSSValue*, RenderStyle*); private: - float getComputedSizeFromSpecifiedSize(bool isAbsoluteSize, float specifiedSize); + static float getComputedSizeFromSpecifiedSize(Document*, RenderStyle*, bool isAbsoluteSize, float specifiedSize, bool useSVGZoomRules); public: Color getColorFromPrimitiveValue(CSSPrimitiveValue*); @@ -286,7 +288,7 @@ public: HashMap > m_resolvedVariablesDeclarations; }; - class CSSRuleData { + class CSSRuleData : public Noncopyable { public: CSSRuleData(unsigned pos, CSSStyleRule* r, CSSSelector* sel, CSSRuleData* prev = 0) : m_position(pos) @@ -314,7 +316,7 @@ public: CSSRuleData* m_next; }; - class CSSRuleDataList { + class CSSRuleDataList : public Noncopyable { public: CSSRuleDataList(unsigned pos, CSSStyleRule* rule, CSSSelector* sel) : m_first(new CSSRuleData(pos, rule, sel)) diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp index 1579999..9c9aa18 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.cpp @@ -28,39 +28,43 @@ #include "Document.h" #include "ExceptionCode.h" #include "Node.h" +#include "SecurityOrigin.h" #include "TextEncoding.h" #include namespace WebCore { -CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset) - : StyleSheet(parentSheet, href) +CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset) + : StyleSheet(parentSheet, href, baseURL) , m_doc(parentSheet ? parentSheet->doc() : 0) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(!parentSheet || parentSheet->useStrictParsing()) , m_isUserStyleSheet(parentSheet ? parentSheet->isUserStyleSheet() : false) + , m_hasSyntacticallyValidCSSHeader(true) { } -CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const String& charset) - : StyleSheet(parentNode, href) +CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, const String& charset) + : StyleSheet(parentNode, href, baseURL) , m_doc(parentNode->document()) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(false) , m_isUserStyleSheet(false) + , m_hasSyntacticallyValidCSSHeader(true) { } -CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset) - : StyleSheet(ownerRule, href) +CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset) + : StyleSheet(ownerRule, href, baseURL) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(!ownerRule || ownerRule->useStrictParsing()) + , m_hasSyntacticallyValidCSSHeader(true) { CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0; m_doc = parentSheet ? parentSheet->doc() : 0; @@ -118,6 +122,8 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio PassRefPtr CSSStyleSheet::cssRules(bool omitCharsetRules) { + if (doc() && !doc()->securityOrigin()->canRequest(baseURL())) + return 0; return CSSRuleList::create(this, omitCharsetRules); } @@ -135,7 +141,7 @@ void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) void CSSStyleSheet::addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri) { - if (uri.isEmpty()) + if (uri.isNull()) return; m_namespaces = new CSSNamespace(prefix, uri, m_namespaces); @@ -148,11 +154,11 @@ void CSSStyleSheet::addNamespace(CSSParser* p, const AtomicString& prefix, const const AtomicString& CSSStyleSheet::determineNamespace(const AtomicString& prefix) { - if (prefix.isEmpty()) + if (prefix.isNull()) return nullAtom; // No namespace. If an element/attribute has a namespace, we won't match it. - else if (prefix == starAtom) + if (prefix == starAtom) return starAtom; // We'll match any namespace. - else if (m_namespaces) { + if (m_namespaces) { CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix); if (ns) return ns->uri(); @@ -227,10 +233,12 @@ void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet& urls) CSSStyleSheet* styleSheet = styleSheetQueue.first(); styleSheetQueue.removeFirst(); - RefPtr ruleList = styleSheet->cssRules(); - - for (unsigned i = 0; i < ruleList->length(); ++i) { - CSSRule* rule = ruleList->item(i); + for (unsigned i = 0; i < styleSheet->length(); ++i) { + StyleBase* styleBase = styleSheet->item(i); + if (!styleBase->isRule()) + continue; + + CSSRule* rule = static_cast(styleBase); if (rule->isImportRule()) { if (CSSStyleSheet* ruleStyleSheet = static_cast(rule)->styleSheet()) styleSheetQueue.append(ruleStyleSheet); diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h index f534104..bb14e28 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.h @@ -38,27 +38,31 @@ class CSSStyleSheet : public StyleSheet { public: static PassRefPtr create() { - return adoptRef(new CSSStyleSheet(static_cast(0), String(), String())); + return adoptRef(new CSSStyleSheet(static_cast(0), String(), KURL(), String())); } static PassRefPtr create(Node* ownerNode) { - return adoptRef(new CSSStyleSheet(ownerNode, String(), String())); + return adoptRef(new CSSStyleSheet(ownerNode, String(), KURL(), String())); } - static PassRefPtr create(Node* ownerNode, const String& href) + static PassRefPtr create(Node* ownerNode, const String& originalURL, const KURL& finalURL) { - return adoptRef(new CSSStyleSheet(ownerNode, href, String())); + return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, String())); } - static PassRefPtr create(Node* ownerNode, const String& href, const String& charset) + static PassRefPtr create(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset) { - return adoptRef(new CSSStyleSheet(ownerNode, href, charset)); + return adoptRef(new CSSStyleSheet(ownerNode, originalURL, finalURL, charset)); } - static PassRefPtr create(CSSRule* ownerRule, const String& href, const String& charset) + static PassRefPtr create(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset) { - return adoptRef(new CSSStyleSheet(ownerRule, href, charset)); + return adoptRef(new CSSStyleSheet(ownerRule, originalURL, finalURL, charset)); + } + static PassRefPtr createInline(Node* ownerNode, const KURL& finalURL) + { + return adoptRef(new CSSStyleSheet(ownerNode, finalURL.string(), finalURL, String())); } virtual ~CSSStyleSheet(); - + CSSRule* ownerRule() const; PassRefPtr cssRules(bool omitCharsetRules = false); unsigned insertRule(const String& rule, unsigned index, ExceptionCode&); @@ -72,7 +76,7 @@ public: void addNamespace(CSSParser*, const AtomicString& prefix, const AtomicString& uri); const AtomicString& determineNamespace(const AtomicString& prefix); - + virtual void styleSheetChanged(); virtual bool parseString(const String&, bool strict = true); @@ -95,12 +99,14 @@ public: void setIsUserStyleSheet(bool b) { m_isUserStyleSheet = b; } bool isUserStyleSheet() const { return m_isUserStyleSheet; } + void setHasSyntacticallyValidCSSHeader(bool b) { m_hasSyntacticallyValidCSSHeader = b; } + bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValidCSSHeader; } private: - CSSStyleSheet(Node* ownerNode, const String& href, const String& charset); - CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset); - CSSStyleSheet(CSSRule* ownerRule, const String& href, const String& charset); - + CSSStyleSheet(Node* ownerNode, const String& originalURL, const KURL& finalURL, const String& charset); + CSSStyleSheet(CSSStyleSheet* parentSheet, const String& originalURL, const KURL& finalURL, const String& charset); + CSSStyleSheet(CSSRule* ownerRule, const String& originalURL, const KURL& finalURL, const String& charset); + virtual bool isCSSStyleSheet() const { return true; } virtual String type() const { return "text/css"; } @@ -110,6 +116,7 @@ private: bool m_loadCompleted : 1; bool m_strictParsing : 1; bool m_isUserStyleSheet : 1; + bool m_hasSyntacticallyValidCSSHeader : 1; }; } // namespace diff --git a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl index d10844c..e180217 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSStyleSheet.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=2f547f65-f8c4-4f13-8724-ed10ed79dcc4, - ImplementationUUID=1b5c24b3-8b6f-43a9-8891-654ba858f42f - ] CSSStyleSheet : stylesheets::StyleSheet { + interface CSSStyleSheet : stylesheets::StyleSheet { readonly attribute CSSRule ownerRule; readonly attribute CSSRuleList cssRules; diff --git a/src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl b/src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl index 2365cd2..b62ceb8 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSUnknownRule.idl @@ -22,8 +22,7 @@ module css { // Introduced in DOM Level 2: interface [ - InterfaceUUID=35670098-b732-419c-b7cd-dc0d5e26d5e3, - ImplementationUUID=4b755f87-2509-4b98-a953-8ecb88fe4b21 + OmitConstructor ] CSSUnknownRule : CSSRule { }; diff --git a/src/3rdparty/webkit/WebCore/css/CSSValue.idl b/src/3rdparty/webkit/WebCore/css/CSSValue.idl index ee82b0c..fe6b8f2 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSValue.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSValue.idl @@ -22,10 +22,7 @@ module css { interface [ CustomToJS, - GenerateConstructor, - Polymorphic, - InterfaceUUID=9fd62a7b-539d-4500-bd6c-ec075abbc404, - ImplementationUUID=e10a2860-f98e-4bd3-96b4-1493ad941dfe + Polymorphic ] CSSValue { // UnitTypes diff --git a/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in b/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in index 1b7b1d8..ca2a47a 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in +++ b/src/3rdparty/webkit/WebCore/css/CSSValueKeywords.in @@ -225,6 +225,28 @@ circle square decimal decimal-leading-zero +arabic-indic +binary +bengali +cambodian +khmer +devanagari +gujarati +gurmukhi +kannada +lower-hexadecimal +lao +malayalam +mongolian +myanmar +octal +oriya +persian +urdu +telugu +tibetan +thai +upper-hexadecimal lower-roman upper-roman lower-greek @@ -232,6 +254,40 @@ lower-alpha lower-latin upper-alpha upper-latin +afar +ethiopic-halehame-aa-et +ethiopic-halehame-aa-er +amharic +ethiopic-halehame-am-et +amharic-abegede +ethiopic-abegede-am-et +cjk-earthly-branch +cjk-heavenly-stem +ethiopic +ethiopic-halehame-gez +ethiopic-abegede +ethiopic-abegede-gez +hangul-consonant +hangul +lower-norwegian +oromo +ethiopic-halehame-om-et +sidama +ethiopic-halehame-sid-et +somali +ethiopic-halehame-so-et +tigre +ethiopic-halehame-tig +tigrinya-er +ethiopic-halehame-ti-er +tigrinya-er-abegede +ethiopic-abegede-ti-er +tigrinya-et +ethiopic-halehame-ti-et +tigrinya-et-abegede +ethiopic-abegede-ti-et +upper-greek +upper-norwegian hebrew armenian georgian @@ -501,6 +557,7 @@ square-button button button-bevel default-button +inner-spin-button list-button listbox listitem @@ -511,6 +568,7 @@ media-seek-back-button media-seek-forward-button media-rewind-button media-return-to-realtime-button +media-toggle-closed-captions-button media-slider media-sliderthumb media-volume-slider-container @@ -523,6 +581,7 @@ menulist menulist-button menulist-text menulist-textfield +outer-spin-button slider-horizontal slider-vertical sliderthumb-horizontal @@ -638,3 +697,7 @@ subpixel-antialiased optimizeSpeed optimizeLegibility geometricPrecision + +# -webkit-color-correction +#default +sRGB diff --git a/src/3rdparty/webkit/WebCore/css/CSSValueList.cpp b/src/3rdparty/webkit/WebCore/css/CSSValueList.cpp index 9633f7c..8f1f88d 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSValueList.cpp +++ b/src/3rdparty/webkit/WebCore/css/CSSValueList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. * diff --git a/src/3rdparty/webkit/WebCore/css/CSSValueList.idl b/src/3rdparty/webkit/WebCore/css/CSSValueList.idl index 8ddfaae..06df5d7 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSValueList.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSValueList.idl @@ -27,10 +27,7 @@ module css { // Introduced in DOM Level 2: interface [ - GenerateConstructor, - HasIndexGetter, - InterfaceUUID=2fb74620-9029-400c-bc4b-4ce8e25b081f, - ImplementationUUID=1d8fc822-f89a-48d5-a2ac-827e5a24357e + HasIndexGetter ] CSSValueList : CSSValue { readonly attribute unsigned long length; CSSValue item(in unsigned long index); diff --git a/src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.idl b/src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.idl index 82d2e9c..672bfe2 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSVariablesDeclaration.idl @@ -26,7 +26,6 @@ module css { interface [ - GenerateConstructor, HasIndexGetter ] CSSVariablesDeclaration { attribute DOMString cssText; diff --git a/src/3rdparty/webkit/WebCore/css/CSSVariablesRule.idl b/src/3rdparty/webkit/WebCore/css/CSSVariablesRule.idl index ec49282..780e84d 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSVariablesRule.idl +++ b/src/3rdparty/webkit/WebCore/css/CSSVariablesRule.idl @@ -25,9 +25,7 @@ module css { - interface [ - GenerateConstructor - ] CSSVariablesRule : CSSRule { + interface CSSVariablesRule : CSSRule { readonly attribute stylesheets::MediaList media; readonly attribute CSSVariablesDeclaration variables; }; diff --git a/src/3rdparty/webkit/WebCore/css/Counter.idl b/src/3rdparty/webkit/WebCore/css/Counter.idl index 5be8f0d..6236c45 100644 --- a/src/3rdparty/webkit/WebCore/css/Counter.idl +++ b/src/3rdparty/webkit/WebCore/css/Counter.idl @@ -20,11 +20,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=365d0f26-3a6e-457c-a34c-174d98f79798, - ImplementationUUID=8bfdc968-9a1b-4e4f-8d36-732d49b48eaa - ] Counter { + interface Counter { readonly attribute DOMString identifier; readonly attribute DOMString listStyle; readonly attribute DOMString separator; diff --git a/src/3rdparty/webkit/WebCore/css/FontValue.cpp b/src/3rdparty/webkit/WebCore/css/FontValue.cpp index 231ac64..991fc6e 100644 --- a/src/3rdparty/webkit/WebCore/css/FontValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/FontValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/Media.cpp b/src/3rdparty/webkit/WebCore/css/Media.cpp index 57c4aac..e238602 100644 --- a/src/3rdparty/webkit/WebCore/css/Media.cpp +++ b/src/3rdparty/webkit/WebCore/css/Media.cpp @@ -34,15 +34,14 @@ namespace WebCore { -Media::Media(DOMWindow* window) - : m_window(window) +Media::Media(Frame* frame) + : m_frame(frame) { } String Media::type() const { - Frame* frame = m_window->frame(); - FrameView* view = frame ? frame->view() : 0; + FrameView* view = m_frame ? m_frame->view() : 0; if (view) return view->mediaType(); @@ -51,15 +50,19 @@ String Media::type() const bool Media::matchMedium(const String& query) const { - Document* document = m_window->document(); - Frame* frame = m_window->frame(); + if (!m_frame) + return false; + + Document* document = m_frame->document(); + ASSERT(document); + Element* documentElement = document->documentElement(); + ASSERT(documentElement); CSSStyleSelector* styleSelector = document->styleSelector(); - Element* docElement = document->documentElement(); - if (!styleSelector || !docElement || !frame) + if (!styleSelector) return false; - RefPtr rootStyle = styleSelector->styleForElement(docElement, 0 /*defaultParent*/, false /*allowSharing*/, true /*resolveForRootDefault*/); + RefPtr rootStyle = styleSelector->styleForElement(documentElement, 0 /*defaultParent*/, false /*allowSharing*/, true /*resolveForRootDefault*/); RefPtr media = MediaList::create(); ExceptionCode ec = 0; @@ -67,7 +70,7 @@ bool Media::matchMedium(const String& query) const if (ec) return false; - MediaQueryEvaluator screenEval(type(), frame, rootStyle.get()); + MediaQueryEvaluator screenEval(type(), m_frame, rootStyle.get()); return screenEval.eval(media.get()); } diff --git a/src/3rdparty/webkit/WebCore/css/Media.h b/src/3rdparty/webkit/WebCore/css/Media.h index 0d7b504..ee6961b 100644 --- a/src/3rdparty/webkit/WebCore/css/Media.h +++ b/src/3rdparty/webkit/WebCore/css/Media.h @@ -32,21 +32,21 @@ namespace WebCore { class Media : public RefCounted { public: - static PassRefPtr create(DOMWindow* window) + static PassRefPtr create(Frame* frame) { - return adoptRef(new Media(window)); + return adoptRef(new Media(frame)); } - - Document* document() const { return m_window->document(); } + + void disconnectFrame() { m_frame = 0; } String type() const; bool matchMedium(const String&) const; private: - Media(DOMWindow*); + Media(Frame*); - RefPtr m_window; + Frame* m_frame; }; } // namespace diff --git a/src/3rdparty/webkit/WebCore/css/Media.idl b/src/3rdparty/webkit/WebCore/css/Media.idl index b01d712..1bf5900 100644 --- a/src/3rdparty/webkit/WebCore/css/Media.idl +++ b/src/3rdparty/webkit/WebCore/css/Media.idl @@ -24,9 +24,7 @@ */ module view { - interface [ - GenerateConstructor, - ] Media { + interface Media { readonly attribute DOMString type; boolean matchMedium(in DOMString mediaquery); }; diff --git a/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.cpp b/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.cpp index fcee5de..a7799c1 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.cpp +++ b/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.cpp @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2005 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or diff --git a/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.h b/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.h index 5196586..2799004 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.h +++ b/src/3rdparty/webkit/WebCore/css/MediaFeatureNames.h @@ -1,6 +1,4 @@ /* - * This file is part of the CSS implementation for KDE. - * * Copyright (C) 2005 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or diff --git a/src/3rdparty/webkit/WebCore/css/MediaList.idl b/src/3rdparty/webkit/WebCore/css/MediaList.idl index dc10e63..54ad4f8 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaList.idl +++ b/src/3rdparty/webkit/WebCore/css/MediaList.idl @@ -27,10 +27,7 @@ module stylesheets { // Introduced in DOM Level 2: interface [ - GenerateConstructor, - HasIndexGetter, - InterfaceUUID=4ed02a0b-15b3-4a20-8f16-d91295aaf2cb, - ImplementationUUID=6c5095d8-fdcc-4f9a-b04a-23c2a6d2cf49 + HasIndexGetter ] MediaList { attribute [ConvertNullToNullString, ConvertNullStringTo=Null] DOMString mediaText diff --git a/src/3rdparty/webkit/WebCore/css/MediaQuery.h b/src/3rdparty/webkit/WebCore/css/MediaQuery.h index ff22d9a..7cbd3bf 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaQuery.h +++ b/src/3rdparty/webkit/WebCore/css/MediaQuery.h @@ -34,7 +34,7 @@ namespace WebCore { class MediaQueryExp; -class MediaQuery { +class MediaQuery : public Noncopyable { public: enum Restrictor { Only, Not, None diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h index 404504b..00ac394 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h +++ b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.h @@ -49,7 +49,7 @@ class MediaQueryExp; * the device characteristics are not known. This can be used to prune the loading * of stylesheets to only those which are probable to match. */ -class MediaQueryEvaluator { +class MediaQueryEvaluator : public Noncopyable { public: /** Creates evaluator which evaluates only simple media queries * Evaluator returns true for "all", and returns value of \mediaFeatureResult diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h b/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h index 5ff4af3..fd55cf6 100644 --- a/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h +++ b/src/3rdparty/webkit/WebCore/css/MediaQueryExp.h @@ -36,7 +36,7 @@ namespace WebCore { class CSSParserValueList; -class MediaQueryExp { +class MediaQueryExp : public FastAllocBase { public: MediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* values); ~MediaQueryExp(); diff --git a/src/3rdparty/webkit/WebCore/css/Pair.h b/src/3rdparty/webkit/WebCore/css/Pair.h index a2b127e..c76bd82 100644 --- a/src/3rdparty/webkit/WebCore/css/Pair.h +++ b/src/3rdparty/webkit/WebCore/css/Pair.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/RGBColor.idl b/src/3rdparty/webkit/WebCore/css/RGBColor.idl index d29f811..1dc87bc 100644 --- a/src/3rdparty/webkit/WebCore/css/RGBColor.idl +++ b/src/3rdparty/webkit/WebCore/css/RGBColor.idl @@ -21,11 +21,7 @@ module css { // Introduced in DOM Level 2: - interface [ - GenerateConstructor, - InterfaceUUID=2e3b1501-2cf7-4a4a-bbf7-d8843d1c3be7, - ImplementationUUID=cf779953-4898-4800-aa31-6c9e3f4711be - ] RGBColor { + interface RGBColor { readonly attribute CSSPrimitiveValue red; readonly attribute CSSPrimitiveValue green; readonly attribute CSSPrimitiveValue blue; diff --git a/src/3rdparty/webkit/WebCore/css/Rect.idl b/src/3rdparty/webkit/WebCore/css/Rect.idl index 3c31dc6..60eb70e 100644 --- a/src/3rdparty/webkit/WebCore/css/Rect.idl +++ b/src/3rdparty/webkit/WebCore/css/Rect.idl @@ -19,11 +19,7 @@ module css { - interface [ - GenerateConstructor, - InterfaceUUID=696bc4d9-c1d3-4225-a5b3-2cef28967705, - ImplementationUUID=ae83743f-4dc4-4785-869b-8c3010c7d006 - ] Rect { + interface Rect { readonly attribute CSSPrimitiveValue top; readonly attribute CSSPrimitiveValue right; readonly attribute CSSPrimitiveValue bottom; diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp index 1f19983..f184b1b 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSComputedStyleDeclaration.cpp @@ -166,7 +166,7 @@ PassRefPtr CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro return 0; } - case CSSPropertyWebkitShadow: + case CSSPropertyWebkitSvgShadow: return valueForShadow(svgStyle->shadow(), propertyID); case CSSPropertyMarker: case CSSPropertyEnableBackground: diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp index 8730e49..0986f1c 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp @@ -257,7 +257,7 @@ bool CSSParser::parseSVGValue(int propId, bool important) m_valueList->next(); } break; - case CSSPropertyWebkitShadow: + case CSSPropertyWebkitSvgShadow: if (id == CSSValueNone) valid_primitive = true; else diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in index 809eabe..9f97146 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSPropertyNames.in @@ -47,4 +47,4 @@ kerning text-anchor writing-mode --webkit-shadow +-webkit-svg-shadow diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp index 7e4483f..5651a0a 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSStyleSelector.cpp @@ -10,8 +10,6 @@ (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com) (C) 2004 Germain Garand(germain@ebooksfrance.org) - This file is part of the KDE project - 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 @@ -527,7 +525,7 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) // Silently ignoring this property for now // http://bugs.webkit.org/show_bug.cgi?id=6022 break; - case CSSPropertyWebkitShadow: { + case CSSPropertyWebkitSvgShadow: { if (isInherit) return svgstyle->setShadow(m_parentStyle->svgStyle()->shadow() ? new ShadowData(*m_parentStyle->svgStyle()->shadow()) : 0); if (isInitial || primitiveValue) // initial | none @@ -536,19 +534,17 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) if (!value->isValueList()) return; - float zoomFactor = m_style->effectiveZoom(); - CSSValueList *list = static_cast(value); ASSERT(list->length() == 1); ShadowValue* item = static_cast(list->itemWithoutBoundsCheck(0)); - int x = item->x->computeLengthInt(style(), m_rootElementStyle, zoomFactor); - int y = item->y->computeLengthInt(style(), m_rootElementStyle, zoomFactor); - int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle, zoomFactor) : 0; + int x = item->x->computeLengthInt(style(), m_rootElementStyle); + int y = item->y->computeLengthInt(style(), m_rootElementStyle); + int blur = item->blur ? item->blur->computeLengthInt(style(), m_rootElementStyle) : 0; Color color; if (item->color) color = getColorFromPrimitiveValue(item->color.get()); - // -webkit-shadow does should not have a spread or style + // -webkit-svg-shadow does should not have a spread or style ASSERT(!item->spread); ASSERT(!item->style); @@ -566,5 +562,4 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value) } -// vim:ts=4:noet -#endif // ENABLE(SVG) +#endif diff --git a/src/3rdparty/webkit/WebCore/css/SVGCSSValueKeywords.in b/src/3rdparty/webkit/WebCore/css/SVGCSSValueKeywords.in index 152a68f..91fb57e 100644 --- a/src/3rdparty/webkit/WebCore/css/SVGCSSValueKeywords.in +++ b/src/3rdparty/webkit/WebCore/css/SVGCSSValueKeywords.in @@ -183,7 +183,7 @@ new # CSS_PROP_STOP_OPACITY # CSS_PROP_COLOR_INTERPOLATION #auto -sRGB +#sRGB linearRGB # CSS_PROP_COLOR_INTERPOLATION_FILTERS diff --git a/src/3rdparty/webkit/WebCore/css/ShadowValue.cpp b/src/3rdparty/webkit/WebCore/css/ShadowValue.cpp index 27be86c..060a322 100644 --- a/src/3rdparty/webkit/WebCore/css/ShadowValue.cpp +++ b/src/3rdparty/webkit/WebCore/css/ShadowValue.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc. * diff --git a/src/3rdparty/webkit/WebCore/css/StyleBase.cpp b/src/3rdparty/webkit/WebCore/css/StyleBase.cpp index 8bfec5e..93dbda0 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleBase.cpp +++ b/src/3rdparty/webkit/WebCore/css/StyleBase.cpp @@ -56,9 +56,9 @@ KURL StyleBase::baseURL() const StyleSheet* sheet = const_cast(this)->stylesheet(); if (!sheet) return KURL(); - if (!sheet->href().isNull()) - return KURL(ParsedURLString, sheet->href()); - if (sheet->parent()) + if (!sheet->finalURL().isNull()) + return sheet->finalURL(); + if (sheet->parent()) return sheet->parent()->baseURL(); if (!sheet->ownerNode()) return KURL(); diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheet.cpp b/src/3rdparty/webkit/WebCore/css/StyleSheet.cpp index 16e6278..4f20a20 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/css/StyleSheet.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2006 Apple Computer, Inc. * @@ -26,27 +24,29 @@ namespace WebCore { -StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& href) +StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL) : StyleList(parentSheet) , m_parentNode(0) - , m_strHref(href) + , m_originalURL(originalURL) + , m_finalURL(finalURL) , m_disabled(false) { } - -StyleSheet::StyleSheet(Node* parentNode, const String& href) +StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL) : StyleList(0) , m_parentNode(parentNode) - , m_strHref(href) + , m_originalURL(originalURL) + , m_finalURL(finalURL) , m_disabled(false) { } -StyleSheet::StyleSheet(StyleBase* owner, const String& href) +StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL) : StyleList(owner) , m_parentNode(0) - , m_strHref(href) + , m_originalURL(originalURL) + , m_finalURL(finalURL) , m_disabled(false) { } diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheet.h b/src/3rdparty/webkit/WebCore/css/StyleSheet.h index 016d50a..621733d 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleSheet.h +++ b/src/3rdparty/webkit/WebCore/css/StyleSheet.h @@ -41,8 +41,15 @@ public: Node* ownerNode() const { return m_parentNode; } StyleSheet *parentStyleSheet() const; - const String& href() const { return m_strHref; } - void setHref(const String& href) { m_strHref = href; } + + // Note that href is the URL that started the redirect chain that led to + // this style sheet. This property probably isn't useful for much except + // the JavaScript binding (which needs to use this value for security). + const String& href() const { return m_originalURL; } + + void setFinalURL(const KURL& finalURL) { m_finalURL = finalURL; } + const KURL& finalURL() const { return m_finalURL; } + const String& title() const { return m_strTitle; } void setTitle(const String& s) { m_strTitle = s; } MediaList* media() const { return m_media.get(); } @@ -58,15 +65,16 @@ public: virtual bool parseString(const String&, bool strict = true) = 0; protected: - StyleSheet(Node* ownerNode, const String& href); - StyleSheet(StyleSheet* parentSheet, const String& href); - StyleSheet(StyleBase* owner, const String& href); + StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL); + StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& finalURL); + StyleSheet(StyleBase* owner, const String& href, const KURL& finalURL); private: virtual bool isStyleSheet() const { return true; } Node* m_parentNode; - String m_strHref; + String m_originalURL; + KURL m_finalURL; String m_strTitle; RefPtr m_media; bool m_disabled; diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheet.idl b/src/3rdparty/webkit/WebCore/css/StyleSheet.idl index e4f4090..4f53689 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleSheet.idl +++ b/src/3rdparty/webkit/WebCore/css/StyleSheet.idl @@ -24,10 +24,7 @@ module stylesheets { interface [ CustomMarkFunction, CustomToJS, - GenerateConstructor, - Polymorphic, - InterfaceUUID=2bd2db5f-aaab-4422-96a0-e05455313f35, - ImplementationUUID=a8ca694d-71f2-4479-8c76-ee9c1c729b49 + Polymorphic ] StyleSheet { readonly attribute [ConvertNullStringTo=Null] DOMString type; attribute boolean disabled; diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp b/src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp index b9df810..2c90258 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp +++ b/src/3rdparty/webkit/WebCore/css/StyleSheetList.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * (C) 1999-2003 Lars Knoll (knoll@kde.org) * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. * diff --git a/src/3rdparty/webkit/WebCore/css/StyleSheetList.idl b/src/3rdparty/webkit/WebCore/css/StyleSheetList.idl index 574d749..6cef99d 100644 --- a/src/3rdparty/webkit/WebCore/css/StyleSheetList.idl +++ b/src/3rdparty/webkit/WebCore/css/StyleSheetList.idl @@ -23,11 +23,8 @@ module stylesheets { // Introduced in DOM Level 2: interface [ CustomMarkFunction, - GenerateConstructor, HasIndexGetter, - HasNameGetter, - InterfaceUUID=707da1d7-7c8f-42b1-bbbf-c009e429663f, - ImplementationUUID=5991ebaf-ce6c-42db-b1c8-fb34af8d5c76 + HasNameGetter ] StyleSheetList { readonly attribute unsigned long length; StyleSheet item(in unsigned long index); diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.idl b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.idl index a8dd9c3..f6eac77 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.idl +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframeRule.idl @@ -29,11 +29,7 @@ module css { // Introduced in DOM Level ?: - interface [ - GenerateConstructor, - InterfaceUUID=87b7cde8-5818-4f68-b554-5382e6d9428c, - ImplementationUUID=b000d468-bb7a-4866-8946-5dea8b6a3c13 - ] WebKitCSSKeyframeRule : CSSRule { + interface WebKitCSSKeyframeRule : CSSRule { attribute DOMString keyText; readonly attribute CSSStyleDeclaration style; diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.cpp b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.cpp index 440d7a2..23f9f34 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.cpp +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.cpp @@ -108,8 +108,16 @@ WebKitCSSKeyframeRule* WebKitCSSKeyframesRule::findRule(const String& s) int WebKitCSSKeyframesRule::findRuleIndex(const String& key) const { + String percentageString; + if (equalIgnoringCase(key, "from")) + percentageString = "0%"; + else if (equalIgnoringCase(key, "to")) + percentageString = "100%"; + else + percentageString = key; + for (unsigned i = 0; i < length(); ++i) { - if (item(i)->keyText() == key) + if (item(i)->keyText() == percentageString) return i; } diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.h b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.h index 8c76b61..f58406f 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.h +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.h @@ -64,7 +64,7 @@ public: // themselves, or know that it will get called later. void setNameInternal(const String& name) { - m_name = name; + m_name = AtomicString(name); } CSSRuleList* cssRules() { return m_lstCSSRules.get(); } diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.idl b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.idl index 2b64be1..c40aff9 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.idl +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSKeyframesRule.idl @@ -30,10 +30,7 @@ module css { // Introduced in DOM Level ?: interface [ - GenerateConstructor, - HasIndexGetter, - InterfaceUUID=49f5644a-5dbb-4e31-ac6b-9446ae3895c9, - ImplementationUUID=a7c78aaa-5883-4ef2-a8bd-f2f1a1fd025a + HasIndexGetter ] WebKitCSSKeyframesRule : CSSRule { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString name; diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.idl b/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.idl index 6b22da1..9d6c897 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.idl +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSMatrix.idl @@ -26,7 +26,7 @@ module css { // Introduced in DOM Level ?: - interface WebKitCSSMatrix { + interface [CustomConstructor] WebKitCSSMatrix { // These attributes are simple aliases for certain elements of the 4x4 matrix attribute double a; // alias for m11 diff --git a/src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.idl b/src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.idl index 14a373f..087aa82 100644 --- a/src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.idl +++ b/src/3rdparty/webkit/WebCore/css/WebKitCSSTransformValue.idl @@ -29,10 +29,7 @@ module css { interface [ - GenerateConstructor, HasIndexGetter - InterfaceUUID=303fe632-5dcf-4472-b977-33a5481e1d12, - ImplementationUUID=eb49e5c6-6075-45b8-b5c4-7e775c01e7c4 ] WebKitCSSTransformValue : CSSValueList { // OperationTypes diff --git a/src/3rdparty/webkit/WebCore/css/html.css b/src/3rdparty/webkit/WebCore/css/html.css index 095fab3..9d9225c 100644 --- a/src/3rdparty/webkit/WebCore/css/html.css +++ b/src/3rdparty/webkit/WebCore/css/html.css @@ -72,7 +72,7 @@ layer { display: block } -nav { +article, aside, footer, header, nav, section { display: block } @@ -359,6 +359,17 @@ input::-webkit-input-list-button { display: inline-block; } +input::-webkit-inner-spin-button { + -webkit-appearance: inner-spin-button; + display: inline-block; +} + +input::-webkit-outer-spin-button { + -webkit-appearance: outer-spin-button; + display: inline-block; + margin-left: 2px; +} + textarea { -webkit-appearance: textarea; background-color: white; @@ -607,6 +618,23 @@ a:-webkit-any-link:active { color: -webkit-activelink } +/* HTML5 ruby elements */ + +ruby, rt { + text-indent: 0; /* blocks used for ruby rendering should not trigger this */ + line-height: normal; +} + +ruby > rt { + display: block; + font-size: 60%; /* make slightly larger than 50% for better readability */ + text-align: center; +} + +ruby > rp { + display: none; +} + /* other elements */ noframes { diff --git a/src/3rdparty/webkit/WebCore/css/maketokenizer b/src/3rdparty/webkit/WebCore/css/maketokenizer index efac3c6..90d5fcb 100644 --- a/src/3rdparty/webkit/WebCore/css/maketokenizer +++ b/src/3rdparty/webkit/WebCore/css/maketokenizer @@ -1,7 +1,5 @@ print < * { + vertical-align: baseline; +} + +mrow, mfenced { + display: inline-block; + white-space: nowrap; + vertical-align: middle; +} + +mrow > mo, mfenced > mo, math > mo +{ + vertical-align: middle; +} + +mi, mtext { + font-style: italic; + padding-right: 0.1em; +} + +mi + mrow { + margin-left: 0.1em; } mfrac { + display: inline-block; vertical-align: middle; } msub, msup { - display: inline-block; + display: inline-block; + vertical-align: baseline; } msub > * + * { - vertical-align: sub; - font-size: 0.75em; - line-height: 0.75em; + vertical-align: sub; + font-size: 0.75em; } msup > * + * { - vertical-align: super; - font-size: 0.75em; - line-height: 0.75em; + vertical-align: super; + font-size: 0.75em; +} + +msubsup { + display: inline-block; + vertical-align: baseline; } msubsup > * { margin: 0px; padding: 0px; - vertical-align: middle; } msubsup > * + * { - font-size: 0.75em; - line-height: 0.75em; + font-size: 0.75em; } -munderover { - vertical-align: middle; +munder, mover, munderover { + display: inline-block; + vertical-align: baseline; } munderover > * + *, mover > * + *, munder > * + * { - font-size: 0.75em; - line-height: 0.5625em; + font-size: 0.75em; } -mrow { - line-height: 1em; - white-space: nowrap; - vertical-align: middle; +mover > mi { + text-align: center; } -mfenced > * { - vertical-align: middle; +mo, mn, mi, mtext { + padding: 0px; + margin: 0px; +} + +mo { + display: inline-block; } -mo, mn, mi { - line-height: 0.75em; - padding: 0px; - margin: 0px; +mo { + padding-left: 0.05em; + padding-right: 0.05em; } mo[mathsize="small"], mn[mathsize="small"], mi[mathsize="small"] { - font-size: 0.75em; - line-height: 0.5625em; + font-size: 0.75em; } mo[mathsize="normal"],mn[mathsize="normal"],mi[mathsize="normal"] { - font-size: 1em; - line-height: 0.75em; + font-size: 1em; } mo[mathsize="big"], mn[mathsize="big"], mi[mathsize="big"] { - line-height: 1.2em; - font-size: 1.5em; + font-size: 1.5em; } annotation, annotation-xml { @@ -100,25 +125,25 @@ merror { } msqrt { + display: inline-block; padding-top: 0.2em; padding-left: 0.75em; } mroot { + display: inline-block; padding-top: 0.2em; padding-left: 0.2em; } mroot > * + * { font-size: 0.75em; - line-height: 0.75em; vertical-align: top; padding-right: 0.3em; } mtable { display: inline-table; - line-height: 1.5em; text-align: center; vertical-align: middle; } @@ -168,3 +193,6 @@ mtable[columnlines="dashed"] > mtr > mtd + mtd { border-left: dashed thin; } +mspace[linebreak="newline"] { + display: block; +} diff --git a/src/3rdparty/webkit/WebCore/css/mediaControls.css b/src/3rdparty/webkit/WebCore/css/mediaControls.css index d0ec90d..de2c2fe 100644 --- a/src/3rdparty/webkit/WebCore/css/mediaControls.css +++ b/src/3rdparty/webkit/WebCore/css/mediaControls.css @@ -124,3 +124,10 @@ audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewin audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { display: none; } + +audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { + -webkit-appearance: media-toggle-closed-captions-button; + display: -webkit-box; + width: 16px; + height: 16px; +} diff --git a/src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css b/src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css new file mode 100644 index 0000000..cc6da14 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/css/mediaControlsGtk.css @@ -0,0 +1,65 @@ +/* + * WebKitGTK+ specific overrides for HTML5 media elements. + * + * Copyright (C) 2009 Zan Dobersek + * + * 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. + * + */ + +audio { + height: 20px; + width: 300px; +} + +audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { + height: 20px; +} + +audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { + width: 20px; + height: 20px; +} + +audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { + width: 20px; + height: 20px; +} + +audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container { + height: 20px; + border-left: 1px solid rgba(255, 255, 255, 0.2); + border-right: 1px solid rgba(255, 255, 255, 0.2); +} + +audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { + height: 20px; +} + +audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { + width: 20px; + height: 20px; +} + +audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button { + width: 20px; + height: 20px; +} + +audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { + width: 20px; + height: 20px; +} diff --git a/src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css b/src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css index 5cf48ae..965685d 100644 --- a/src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css +++ b/src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css @@ -132,7 +132,7 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f height: 16px; margin-left: 7px; margin-right: 7px; - -webkit-box-ordinal-group: 3; /* At the very end */ + -webkit-box-ordinal-group: 4; /* At the very end */ } audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { @@ -175,3 +175,13 @@ audio::-webkit-media-controls-status-display, video::-webkit-media-controls-stat text-indent: 0; text-decoration: none; } + +audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { + -webkit-appearance: media-toggle-closed-captions-button; + display: -webkit-box; + width: 16px; + height: 16px; + margin-left: 7px; + margin-right: 7px; + -webkit-box-ordinal-group: 3; /* between mute and fullscreen */ +} diff --git a/src/3rdparty/webkit/WebCore/css/svg.css b/src/3rdparty/webkit/WebCore/css/svg.css index 322eda8..171c1c4 100644 --- a/src/3rdparty/webkit/WebCore/css/svg.css +++ b/src/3rdparty/webkit/WebCore/css/svg.css @@ -32,9 +32,18 @@ which does not use CSS layout [CSS2-LAYOUT] or XSL formatting [XSL], the 'overflow' property on the outermost 'svg' element is ignored for the purposes of visual rendering and the initial clipping path is set to the bounds of the initial viewport. + + When an outermost 'svg' element is embedded inline within a parent XML grammar which uses CSS layout + [CSS2-LAYOUT] or XSL formatting [XSL], if the 'overflow' property has the value hidden or scroll, then + the user agent will establish an initial clipping path equal to the bounds of the initial viewport; otherwise, + the initial clipping path is set according to the clipping rules as defined in [CSS2-overflow]. + + Opera/Firefox & WebKit agreed on NOT setting "overflow: hidden" for the outermost svg element - SVG 1.1 Errata + contains these changes as well as all future SVG specifications: see http://lists.w3.org/Archives/Public/public-svg-wg/2008JulSep/0347.html */ -svg:root { - overflow: hidden !important + +svg:not(:root), symbol, image, marker, pattern, foreignObject { + overflow: hidden } svg { @@ -42,10 +51,6 @@ svg { height: 100%; } -svg, symbol, marker, pattern { - overflow: hidden -} - text, foreignObject { display: block } diff --git a/src/3rdparty/webkit/WebCore/css/view-source.css b/src/3rdparty/webkit/WebCore/css/view-source.css index f898565..60467b9 100644 --- a/src/3rdparty/webkit/WebCore/css/view-source.css +++ b/src/3rdparty/webkit/WebCore/css/view-source.css @@ -130,7 +130,7 @@ td { -webkit-border-fit: lines; min-height: 13px; font-size: 9px; - font-family: Lucida Grande; + font-family: Lucida Grande, sans-serif; font-weight: bold; margin: 6px 25px; padding: 0 7px 1px; diff --git a/src/3rdparty/webkit/WebCore/dom/Attr.cpp b/src/3rdparty/webkit/WebCore/dom/Attr.cpp index aa5916b..2ef5f9b 100644 --- a/src/3rdparty/webkit/WebCore/dom/Attr.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Attr.cpp @@ -27,9 +27,12 @@ #include "Element.h" #include "ExceptionCode.h" #include "Text.h" +#include "XMLNSNames.h" namespace WebCore { +using namespace HTMLNames; + inline Attr::Attr(Element* element, Document* document, PassRefPtr attribute) : ContainerNode(document) , m_element(element) @@ -100,7 +103,13 @@ void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec) if (ec) return; - m_attribute->setPrefix(prefix); + if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI) + || static_cast(this)->qualifiedName() == xmlnsAtom) { + ec = NAMESPACE_ERR; + return; + } + + m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix); } String Attr::nodeValue() const @@ -164,4 +173,9 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after m_element->attributeChanged(m_attribute.get()); } +bool Attr::isId() const +{ + return qualifiedName().matches(m_element ? m_element->idAttributeName() : idAttr); +} + } diff --git a/src/3rdparty/webkit/WebCore/dom/Attr.h b/src/3rdparty/webkit/WebCore/dom/Attr.h index e927a6e..2e02a02 100644 --- a/src/3rdparty/webkit/WebCore/dom/Attr.h +++ b/src/3rdparty/webkit/WebCore/dom/Attr.h @@ -52,6 +52,8 @@ public: Attribute* attr() const { return m_attribute.get(); } const QualifiedName& qualifiedName() const { return m_attribute->name(); } + bool isId() const; + // An extension to get presentational information for attributes. CSSStyleDeclaration* style() { return m_attribute->style(); } diff --git a/src/3rdparty/webkit/WebCore/dom/Attr.idl b/src/3rdparty/webkit/WebCore/dom/Attr.idl index c01f34a..af84478 100644 --- a/src/3rdparty/webkit/WebCore/dom/Attr.idl +++ b/src/3rdparty/webkit/WebCore/dom/Attr.idl @@ -22,10 +22,7 @@ module core { interface [ CustomMarkFunction, - GenerateConstructor, - GenerateNativeConverter, - InterfaceUUID=EEE8E22B-22C3-4e50-95F4-5E0B8AAD8231, - ImplementationUUID=41B16348-D8E7-4d21-BFDB-125705B7E91F + GenerateNativeConverter ] Attr : Node { // DOM Level 1 @@ -38,11 +35,13 @@ module core { // DOM Level 2 readonly attribute Element ownerElement; - + + // DOM Level 3 + + readonly attribute boolean isId; + // extensions -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM readonly attribute CSSStyleDeclaration style; -#endif }; } diff --git a/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl index d06a39d..9c8b7e5 100644 --- a/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl @@ -26,9 +26,7 @@ module events { - interface [ - GenerateConstructor - ] BeforeLoadEvent : Event { + interface BeforeLoadEvent : Event { void initBeforeLoadEvent(in DOMString type, in boolean canBubble, in boolean cancelable, diff --git a/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.cpp b/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.cpp index 2521aa1..97d7f97 100644 --- a/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.cpp +++ b/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2001 Peter Kelly (pmk@post.com) * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) diff --git a/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.h b/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.h index 39c96fd..2644693 100644 --- a/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/BeforeUnloadEvent.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2001 Peter Kelly (pmk@post.com) * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) diff --git a/src/3rdparty/webkit/WebCore/dom/CDATASection.idl b/src/3rdparty/webkit/WebCore/dom/CDATASection.idl index 7c6c1e6..70a4f55 100644 --- a/src/3rdparty/webkit/WebCore/dom/CDATASection.idl +++ b/src/3rdparty/webkit/WebCore/dom/CDATASection.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=DC8E30FD-42DD-4a12-9B74-78D634321B41, - ImplementationUUID=10A5D70C-D93E-409c-A6BA-9D7CB4E3D06A - ] CDATASection : Text { + interface CDATASection : Text { }; } diff --git a/src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.cpp b/src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.cpp index 7fe0915..9ee6474 100644 --- a/src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.cpp +++ b/src/3rdparty/webkit/WebCore/dom/CSSMappedAttributeDeclaration.cpp @@ -1,6 +1,4 @@ /** - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) diff --git a/src/3rdparty/webkit/WebCore/dom/CharacterData.idl b/src/3rdparty/webkit/WebCore/dom/CharacterData.idl index 7c8c7ac..4ddd782 100644 --- a/src/3rdparty/webkit/WebCore/dom/CharacterData.idl +++ b/src/3rdparty/webkit/WebCore/dom/CharacterData.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=149159F4-D2BA-4040-8137-6BF6424C972A, - ImplementationUUID=E2095280-B9BD-446a-8C03-79F78417CDFF - ] CharacterData : Node { + interface CharacterData : Node { attribute [ConvertNullToNullString] DOMString data setter raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.cpp b/src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.cpp index 9883f58..3cf8848 100644 --- a/src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.cpp +++ b/src/3rdparty/webkit/WebCore/dom/CheckedRadioButtons.cpp @@ -60,6 +60,8 @@ HTMLInputElement* CheckedRadioButtons::checkedButtonForGroup(const AtomicString& { if (!m_nameToCheckedRadioButtonMap) return 0; + + m_nameToCheckedRadioButtonMap->checkConsistency(); return m_nameToCheckedRadioButtonMap->get(name.impl()); } @@ -69,6 +71,8 @@ void CheckedRadioButtons::removeButton(HTMLFormControlElement* element) if (element->name().isEmpty() || !m_nameToCheckedRadioButtonMap) return; + m_nameToCheckedRadioButtonMap->checkConsistency(); + NameToInputMap::iterator it = m_nameToCheckedRadioButtonMap->find(element->name().impl()); if (it == m_nameToCheckedRadioButtonMap->end() || it->second != element) return; diff --git a/src/3rdparty/webkit/WebCore/dom/ClassNames.cpp b/src/3rdparty/webkit/WebCore/dom/ClassNames.cpp deleted file mode 100644 index 1c5ff47..0000000 --- a/src/3rdparty/webkit/WebCore/dom/ClassNames.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2007 David Smith (catfish.man@gmail.com) - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" -#include "ClassNames.h" - -#include - -using namespace WTF; - -namespace WebCore { - -static bool hasNonASCIIOrUpper(const String& string) -{ - const UChar* characters = string.characters(); - unsigned length = string.length(); - bool hasUpper = false; - UChar ored = 0; - for (unsigned i = 0; i < length; i++) { - UChar c = characters[i]; - hasUpper |= isASCIIUpper(c); - ored |= c; - } - return hasUpper || (ored & ~0x7F); -} - -void ClassNamesData::createVector() -{ - ASSERT(!m_createdVector); - ASSERT(m_vector.isEmpty()); - - if (m_shouldFoldCase && hasNonASCIIOrUpper(m_string)) - m_string = m_string.foldCase(); - - const UChar* characters = m_string.characters(); - unsigned length = m_string.length(); - unsigned start = 0; - while (true) { - while (start < length && isClassWhitespace(characters[start])) - ++start; - if (start >= length) - break; - unsigned end = start + 1; - while (end < length && !isClassWhitespace(characters[end])) - ++end; - - m_vector.append(AtomicString(characters + start, end - start)); - - start = end + 1; - } - - m_string = String(); - m_createdVector = true; -} - -bool ClassNamesData::containsAll(ClassNamesData& other) -{ - ensureVector(); - other.ensureVector(); - size_t thisSize = m_vector.size(); - size_t otherSize = other.m_vector.size(); - for (size_t i = 0; i < otherSize; ++i) { - const AtomicString& name = other.m_vector[i]; - size_t j; - for (j = 0; j < thisSize; ++j) { - if (m_vector[j] == name) - break; - } - if (j == thisSize) - return false; - } - return true; -} - -} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ClassNames.h b/src/3rdparty/webkit/WebCore/dom/ClassNames.h deleted file mode 100644 index a836606..0000000 --- a/src/3rdparty/webkit/WebCore/dom/ClassNames.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef ClassNames_h -#define ClassNames_h - -#include "AtomicString.h" -#include -#include - -namespace WebCore { - - class ClassNamesData : public Noncopyable { - public: - ClassNamesData(const String& string, bool shouldFoldCase) - : m_string(string), m_shouldFoldCase(shouldFoldCase), m_createdVector(false) - { - } - - bool contains(const AtomicString& string) - { - ensureVector(); - size_t size = m_vector.size(); - for (size_t i = 0; i < size; ++i) { - if (m_vector[i] == string) - return true; - } - return false; - } - - bool containsAll(ClassNamesData&); - - size_t size() { ensureVector(); return m_vector.size(); } - const AtomicString& operator[](size_t i) { ensureVector(); ASSERT(i < size()); return m_vector[i]; } - - private: - void ensureVector() { if (!m_createdVector) createVector(); } - void createVector(); - - typedef Vector ClassNameVector; - String m_string; - ClassNameVector m_vector; - bool m_shouldFoldCase; - bool m_createdVector; - }; - - class ClassNames { - public: - ClassNames() { } - ClassNames(const String& string, bool shouldFoldCase) : m_data(new ClassNamesData(string, shouldFoldCase)) { } - - void set(const String& string, bool shouldFoldCase) { m_data.set(new ClassNamesData(string, shouldFoldCase)); } - void clear() { m_data.clear(); } - - bool contains(const AtomicString& string) const { return m_data && m_data->contains(string); } - bool containsAll(const ClassNames& names) const { return !names.m_data || (m_data && m_data->containsAll(*names.m_data)); } - - size_t size() const { return m_data ? m_data->size() : 0; } - const AtomicString& operator[](size_t i) const { ASSERT(i < size()); return (*m_data)[i]; } - - private: - OwnPtr m_data; - }; - - inline bool isClassWhitespace(UChar c) - { - return c == ' ' || c == '\r' || c == '\n' || c == '\t' || c == '\f'; - } - -} // namespace WebCore - -#endif // ClassNames_h diff --git a/src/3rdparty/webkit/WebCore/dom/ClassNodeList.h b/src/3rdparty/webkit/WebCore/dom/ClassNodeList.h index d40ee19..c519b3e 100644 --- a/src/3rdparty/webkit/WebCore/dom/ClassNodeList.h +++ b/src/3rdparty/webkit/WebCore/dom/ClassNodeList.h @@ -30,8 +30,8 @@ #ifndef ClassNodeList_h #define ClassNodeList_h -#include "ClassNames.h" #include "DynamicNodeList.h" +#include "SpaceSplitString.h" namespace WebCore { @@ -47,7 +47,7 @@ namespace WebCore { virtual bool nodeMatches(Element*) const; - ClassNames m_classNames; + SpaceSplitString m_classNames; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ClientRect.idl b/src/3rdparty/webkit/WebCore/dom/ClientRect.idl index 6f0598f..7dbdd68 100644 --- a/src/3rdparty/webkit/WebCore/dom/ClientRect.idl +++ b/src/3rdparty/webkit/WebCore/dom/ClientRect.idl @@ -26,9 +26,7 @@ module view { - interface [ - GenerateConstructor - ] ClientRect { + interface ClientRect { readonly attribute float top; readonly attribute float right; readonly attribute float bottom; diff --git a/src/3rdparty/webkit/WebCore/dom/ClientRectList.idl b/src/3rdparty/webkit/WebCore/dom/ClientRectList.idl index 8230f6c..6372418 100644 --- a/src/3rdparty/webkit/WebCore/dom/ClientRectList.idl +++ b/src/3rdparty/webkit/WebCore/dom/ClientRectList.idl @@ -27,7 +27,6 @@ module view { interface [ - GenerateConstructor, HasIndexGetter ] ClientRectList { readonly attribute unsigned long length; diff --git a/src/3rdparty/webkit/WebCore/dom/Clipboard.cpp b/src/3rdparty/webkit/WebCore/dom/Clipboard.cpp index 6d1bc15..7f33aac 100644 --- a/src/3rdparty/webkit/WebCore/dom/Clipboard.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Clipboard.cpp @@ -35,7 +35,9 @@ namespace WebCore { Clipboard::Clipboard(ClipboardAccessPolicy policy, bool isForDragging) - : m_policy(policy) + : m_policy(policy) + , m_dropEffect("none") + , m_effectAllowed("uninitialized") , m_dragStarted(false) , m_forDragging(isForDragging) , m_dragImage(0) @@ -55,6 +57,8 @@ void Clipboard::setAccessPolicy(ClipboardAccessPolicy policy) static DragOperation dragOpFromIEOp(const String& op) { // yep, it's really just this fixed set + if (op == "uninitialized") + return DragOperationEvery; if (op == "none") return DragOperationNone; if (op == "copy") @@ -62,7 +66,7 @@ static DragOperation dragOpFromIEOp(const String& op) if (op == "link") return DragOperationLink; if (op == "move") - return DragOperationGeneric; + return DragOperationGeneric; // FIXME: Why is this DragOperationGeneric? if (op == "copyLink") return (DragOperation)(DragOperationCopy | DragOperationLink); if (op == "copyMove") @@ -96,29 +100,29 @@ static String IEOpFromDragOp(DragOperation op) return "none"; } -bool Clipboard::sourceOperation(DragOperation& op) const +DragOperation Clipboard::sourceOperation() const { - if (m_effectAllowed.isNull()) - return false; - op = dragOpFromIEOp(m_effectAllowed); - return true; + DragOperation op = dragOpFromIEOp(m_effectAllowed); + ASSERT(op != DragOperationPrivate); + return op; } -bool Clipboard::destinationOperation(DragOperation& op) const +DragOperation Clipboard::destinationOperation() const { - if (m_dropEffect.isNull()) - return false; - op = dragOpFromIEOp(m_dropEffect); - return true; + DragOperation op = dragOpFromIEOp(m_dropEffect); + ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove); + return op; } void Clipboard::setSourceOperation(DragOperation op) { + ASSERT_ARG(op, op != DragOperationPrivate); m_effectAllowed = IEOpFromDragOp(op); } void Clipboard::setDestinationOperation(DragOperation op) { + ASSERT_ARG(op, op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove); m_dropEffect = IEOpFromDragOp(op); } @@ -127,6 +131,10 @@ void Clipboard::setDropEffect(const String &effect) if (!m_forDragging) return; + // The attribute must ignore any attempts to set it to a value other than none, copy, link, and move. + if (effect != "none" && effect != "copy" && effect != "link" && effect != "move") + return; + if (m_policy == ClipboardReadable || m_policy == ClipboardTypesReadable) m_dropEffect = effect; } @@ -136,6 +144,17 @@ void Clipboard::setEffectAllowed(const String &effect) if (!m_forDragging) return; + if (dragOpFromIEOp(effect) == DragOperationPrivate) { + // This means that there was no conversion, and the effectAllowed that + // we are passed isn't a valid effectAllowed, so we should ignore it, + // and not set m_effectAllowed. + + // The attribute must ignore any attempts to set it to a value other than + // none, copy, copyLink, copyMove, link, linkMove, move, all, and uninitialized. + return; + } + + if (m_policy == ClipboardWritable) m_effectAllowed = effect; } diff --git a/src/3rdparty/webkit/WebCore/dom/Clipboard.h b/src/3rdparty/webkit/WebCore/dom/Clipboard.h index f6c09b2..2f4dc6f 100644 --- a/src/3rdparty/webkit/WebCore/dom/Clipboard.h +++ b/src/3rdparty/webkit/WebCore/dom/Clipboard.h @@ -69,13 +69,14 @@ namespace WebCore { #endif virtual void writeURL(const KURL&, const String&, Frame*) = 0; virtual void writeRange(Range*, Frame*) = 0; + virtual void writePlainText(const String&) = 0; virtual bool hasData() = 0; void setAccessPolicy(ClipboardAccessPolicy); - bool sourceOperation(DragOperation&) const; - bool destinationOperation(DragOperation&) const; + DragOperation sourceOperation() const; + DragOperation destinationOperation() const; void setSourceOperation(DragOperation); void setDestinationOperation(DragOperation); diff --git a/src/3rdparty/webkit/WebCore/dom/Clipboard.idl b/src/3rdparty/webkit/WebCore/dom/Clipboard.idl index dc8677e..6509677 100644 --- a/src/3rdparty/webkit/WebCore/dom/Clipboard.idl +++ b/src/3rdparty/webkit/WebCore/dom/Clipboard.idl @@ -28,9 +28,7 @@ module core { - interface [ - GenerateConstructor - ] Clipboard { + interface Clipboard { attribute [ConvertNullStringTo=Undefined] DOMString dropEffect; attribute [ConvertNullStringTo=Undefined] DOMString effectAllowed; readonly attribute [CustomGetter] Array types; diff --git a/src/3rdparty/webkit/WebCore/dom/Comment.idl b/src/3rdparty/webkit/WebCore/dom/Comment.idl index a89f0e7..b9f4e31 100644 --- a/src/3rdparty/webkit/WebCore/dom/Comment.idl +++ b/src/3rdparty/webkit/WebCore/dom/Comment.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=5D16069F-7E6B-4b28-8647-C36B2ED81ED1, - ImplementationUUID=CB55DB55-411F-451f-97C6-284B99E77F8E - ] Comment : CharacterData { + interface Comment : CharacterData { }; } diff --git a/src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp new file mode 100644 index 0000000..508d5e6 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" +#include "CompositionEvent.h" + +#include "EventNames.h" + +namespace WebCore { + +CompositionEvent::CompositionEvent() +{ +} + +CompositionEvent::CompositionEvent(const AtomicString& type, PassRefPtr view, const String& data) + : UIEvent(type, true, true, view, 0) + , m_data(data) +{ +} + +CompositionEvent::~CompositionEvent() +{ +} + +void CompositionEvent::initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr view, const String& data) +{ + if (dispatched()) + return; + + initUIEvent(type, canBubble, cancelable, view, 0); + + m_data = data; +} + +bool CompositionEvent::isCompositionEvent() const +{ + return true; +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/CompositionEvent.h b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.h new file mode 100644 index 0000000..4ff01ae --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef CompositionEvent_h +#define CompositionEvent_h + +#include "UIEvent.h" + +namespace WebCore { + + class CompositionEvent : public UIEvent { + public: + static PassRefPtr create() + { + return adoptRef(new CompositionEvent); + } + static PassRefPtr create(const AtomicString& type, PassRefPtr view, const String& data) + { + return adoptRef(new CompositionEvent(type, view, data)); + } + virtual ~CompositionEvent(); + + void initCompositionEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr, const String& data); + + String data() const { return m_data; } + + virtual bool isCompositionEvent() const; + + private: + CompositionEvent(); + CompositionEvent(const AtomicString& type, PassRefPtr view, const String& data); + + String m_data; + }; + +} // namespace WebCore + +#endif // CompositionEvent_h diff --git a/src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl new file mode 100644 index 0000000..28d6625 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/CompositionEvent.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module events { + + // Introduced in DOM Level 3: + interface CompositionEvent : UIEvent { + + readonly attribute DOMString data; + + void initCompositionEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in DOMWindow viewArg, + in DOMString dataArg); + + }; + +} diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp index 5cd0781..39cd3b4 100644 --- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp @@ -33,6 +33,7 @@ #include "Frame.h" #include "FrameView.h" #include "InlineTextBox.h" +#include "InspectorController.h" #include "MutationEvent.h" #include "Page.h" #include "RenderTheme.h" @@ -869,6 +870,13 @@ static void dispatchChildInsertionEvents(Node* child) { ASSERT(!eventDispatchForbidden()); +#if ENABLE(INSPECTOR) + if (Page* page = child->document()->page()) { + if (InspectorController* inspectorController = page->inspectorController()) + inspectorController->didInsertDOMNode(child); + } +#endif + RefPtr c = child; RefPtr document = child->document(); @@ -891,6 +899,13 @@ static void dispatchChildInsertionEvents(Node* child) static void dispatchChildRemovalEvents(Node* child) { +#if ENABLE(INSPECTOR) + if (Page* page = child->document()->page()) { + if (InspectorController* inspectorController = page->inspectorController()) + inspectorController->didRemoveDOMNode(child); + } +#endif + RefPtr c = child; RefPtr document = child->document(); diff --git a/src/3rdparty/webkit/WebCore/dom/DOMCoreException.idl b/src/3rdparty/webkit/WebCore/dom/DOMCoreException.idl index 3001995..9baea1b 100644 --- a/src/3rdparty/webkit/WebCore/dom/DOMCoreException.idl +++ b/src/3rdparty/webkit/WebCore/dom/DOMCoreException.idl @@ -28,9 +28,7 @@ module core { - interface [ - GenerateConstructor - ] DOMCoreException { + interface DOMCoreException { readonly attribute unsigned short code; readonly attribute DOMString name; diff --git a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp index 59b9703..f7c8242 100644 --- a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp +++ b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp @@ -305,7 +305,8 @@ PassRefPtr DOMImplementation::createHTMLDocument(const String& tit { RefPtr d = HTMLDocument::create(0); d->open(); - d->write("" + title + ""); + d->write(""); + d->setTitle(title); return d.release(); } diff --git a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.idl b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.idl index 6f4df80..81df6c8 100644 --- a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.idl +++ b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.idl @@ -20,11 +20,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=B0CC344F-963C-4acc-9FC6-EB22649345E5, - ImplementationUUID=9E835092-2CA3-426b-826B-8272A8105E49 - ] DOMImplementation { + interface DOMImplementation { // DOM Level 1 @@ -44,7 +40,6 @@ module core { // DOMImplementationCSS interface from DOM Level 2 CSS -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM [OldStyleObjC] CSSStyleSheet createCSSStyleSheet(in DOMString title, in DOMString media) raises(DOMException); @@ -52,7 +47,6 @@ module core { // HTMLDOMImplementation interface from DOM Level 2 HTML HTMLDocument createHTMLDocument(in DOMString title); -#endif }; } diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp index 4eb44f7..d0fe75f 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp @@ -36,6 +36,8 @@ #include "CSSValueKeywords.h" #include "CString.h" #include "CachedCSSStyleSheet.h" +#include "Chrome.h" +#include "ChromeClient.h" #include "Comment.h" #include "Console.h" #include "CookieJar.h" @@ -67,6 +69,7 @@ #include "HTMLElementFactory.h" #include "HTMLFrameOwnerElement.h" #include "HTMLHeadElement.h" +#include "HTMLIFrameElement.h" #include "HTMLInputElement.h" #include "HTMLLinkElement.h" #include "HTMLMapElement.h" @@ -98,6 +101,7 @@ #include "PageGroup.h" #include "PageTransitionEvent.h" #include "PlatformKeyboardEvent.h" +#include "PopStateEvent.h" #include "ProcessingInstruction.h" #include "ProgressEvent.h" #include "RegisteredEventListener.h" @@ -112,6 +116,7 @@ #include "SegmentedString.h" #include "SelectionController.h" #include "Settings.h" +#include "StringBuffer.h" #include "StyleSheetList.h" #include "TextEvent.h" #include "TextIterator.h" @@ -125,6 +130,7 @@ #include "WebKitTransitionEvent.h" #include "WheelEvent.h" #include "XMLHttpRequest.h" +#include "XMLNSNames.h" #include "XMLNames.h" #include "XMLTokenizer.h" #include "htmlediting.h" @@ -134,11 +140,6 @@ #include #include -#if ENABLE(DATABASE) -#include "Database.h" -#include "DatabaseThread.h" -#endif - #if ENABLE(SHARED_WORKERS) #include "SharedWorkerRepository.h" #endif @@ -170,6 +171,10 @@ #include "SVGStyleElement.h" #endif +#if ENABLE(TOUCH_EVENTS) +#include "TouchEvent.h" +#endif + #if ENABLE(WML) #include "WMLDocument.h" #include "WMLElement.h" @@ -314,15 +319,50 @@ static bool disableRangeMutation(Page* page) static HashSet* documentsThatNeedStyleRecalc = 0; -Document::Document(Frame* frame, bool isXHTML) +class DocumentWeakReference : public ThreadSafeShared { +public: + static PassRefPtr create(Document* document) + { + return adoptRef(new DocumentWeakReference(document)); + } + + Document* document() + { + ASSERT(isMainThread()); + return m_document; + } + + void clear() + { + ASSERT(isMainThread()); + m_document = 0; + } + +private: + DocumentWeakReference(Document* document) + : m_document(document) + { + ASSERT(isMainThread()); + } + + Document* m_document; +}; + +Document::Document(Frame* frame, bool isXHTML, bool isHTML) : ContainerNode(0) , m_domtree_version(0) , m_styleSheets(StyleSheetList::create(this)) , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired) , m_frameElementsShouldIgnoreScrolling(false) + , m_containsValidityStyleRules(false) + , m_updateFocusAppearanceRestoresSelection(false) , m_title("") + , m_rawTitle("") , m_titleSetExplicitly(false) , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired) + , m_startTime(currentTime()) + , m_overMinimumLayoutThreshold(false) + , m_extraLayoutDelay(0) , m_executeScriptSoonTimer(this, &Document::executeScriptSoonTimerFired) , m_xmlVersion("1.0") , m_xmlStandalone(false) @@ -330,7 +370,6 @@ Document::Document(Frame* frame, bool isXHTML) , m_bindingManager(new XBLBindingManager(this)) #endif , m_savedRenderer(0) - , m_secureForms(0) , m_designMode(inherit) , m_selfOnlyRefCount(0) #if ENABLE(SVG) @@ -345,14 +384,17 @@ Document::Document(Frame* frame, bool isXHTML) , m_inPageCache(false) , m_useSecureKeyboardEntryWhenActive(false) , m_isXHTML(isXHTML) + , m_isHTML(isHTML) , m_numNodeListCaches(0) -#if ENABLE(DATABASE) - , m_hasOpenDatabases(false) +#if USE(JSC) + , m_normalWorldWrapperCache(0) #endif , m_usingGeolocation(false) + , m_storageEventTimer(this, &Document::storageEventTimerFired) #if ENABLE(WML) , m_containsWMLContent(false) #endif + , m_weakReference(DocumentWeakReference::create(this)) { m_document = this; @@ -363,15 +405,13 @@ Document::Document(Frame* frame, bool isXHTML) m_ignoreAutofocus = false; m_frame = frame; - m_renderArena = 0; m_axObjectCache = 0; m_docLoader = new DocLoader(this); - visuallyOrdered = false; + m_visuallyOrdered = false; m_bParsing = false; - m_tokenizer = 0; m_wellFormed = false; setParseMode(Strict); @@ -391,7 +431,6 @@ Document::Document(Frame* frame, bool isXHTML) m_gotoAnchorNeededAfterStylesheetsLoad = false; - m_styleSelector = 0; m_didCalculateStyleSelector = false; m_pendingStylesheets = 0; m_ignorePendingStylesheets = false; @@ -405,8 +444,6 @@ Document::Document(Frame* frame, bool isXHTML) resetActiveLinkColor(); m_processingLoadEvent = false; - m_startTime = currentTime(); - m_overMinimumLayoutThreshold = false; initSecurityContext(); initDNSPrefetch(); @@ -437,13 +474,15 @@ void Document::removedLastRef() m_titleElement = 0; m_documentElement = 0; + // removeAllChildren() doesn't always unregister IDs, do it upfront to avoid having stale references in the map. + m_elementsById.clear(); + removeAllChildren(); deleteAllValues(m_markers); m_markers.clear(); - delete m_tokenizer; - m_tokenizer = 0; + m_tokenizer.clear(); m_cssCanvasElements.clear(); @@ -477,18 +516,14 @@ Document::~Document() forgetAllDOMNodesForDocument(this); #endif - delete m_tokenizer; + m_tokenizer.clear(); m_document = 0; - delete m_styleSelector; - delete m_docLoader; - - if (m_renderArena) { - delete m_renderArena; - m_renderArena = 0; - } + m_docLoader.clear(); + + m_renderArena.clear(); #if ENABLE(XBL) - delete m_bindingManager; + m_bindingManager.clear(); #endif deleteAllValues(m_markers); @@ -501,26 +536,25 @@ Document::~Document() for (unsigned i = 0; i < count; i++) deleteAllValues(m_nameCollectionInfo[i]); -#if ENABLE(DATABASE) - if (m_databaseThread) { - ASSERT(m_databaseThread->terminationRequested()); - m_databaseThread = 0; - } -#endif - if (m_styleSheets) m_styleSheets->documentDestroyed(); + + m_weakReference->clear(); } +#if USE(JSC) Document::JSWrapperCache* Document::createWrapperCache(DOMWrapperWorld* world) { JSWrapperCache* wrapperCache = new JSWrapperCache(); m_wrapperCacheMap.set(world, wrapperCache); -#if USE(JSC) + if (world->isNormal()) { + ASSERT(!m_normalWorldWrapperCache); + m_normalWorldWrapperCache = wrapperCache; + } world->rememberDocument(this); -#endif return wrapperCache; } +#endif void Document::resetLinkColor() { @@ -765,6 +799,9 @@ PassRefPtr Document::adoptNode(PassRefPtr source, ExceptionCode& ec) break; } default: + if (source->hasTagName(iframeTag)) + static_cast(source.get())->setRemainsAliveOnRemovalFromTree(attached()); + if (source->parentNode()) source->parentNode()->removeChild(source.get(), ec); } @@ -777,21 +814,17 @@ PassRefPtr Document::adoptNode(PassRefPtr source, ExceptionCode& ec) bool Document::hasPrefixNamespaceMismatch(const QualifiedName& qName) { - DEFINE_STATIC_LOCAL(const AtomicString, xmlnsNamespaceURI, ("http://www.w3.org/2000/xmlns/")); - DEFINE_STATIC_LOCAL(const AtomicString, xmlns, ("xmlns")); - DEFINE_STATIC_LOCAL(const AtomicString, xml, ("xml")); - // These checks are from DOM Core Level 2, createElementNS // http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createElementNS(null, "html:div") return true; - if (qName.prefix() == xml && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS("http://www.example.com", "xml:lang") + if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS("http://www.example.com", "xml:lang") return true; // Required by DOM Level 3 Core and unspecified by DOM Level 2 Core: // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS // createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElementNS(null, "xmlns:bar") - if ((qName.prefix() == xmlns && qName.namespaceURI() != xmlnsNamespaceURI) || (qName.prefix() != xmlns && qName.namespaceURI() == xmlnsNamespaceURI)) + if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) return true; return false; @@ -852,6 +885,8 @@ Element* Document::getElementById(const AtomicString& elementId) const if (elementId.isEmpty()) return 0; + m_elementsById.checkConsistency(); + Element* element = m_elementsById.get(elementId.impl()); if (element) return element; @@ -861,7 +896,7 @@ Element* Document::getElementById(const AtomicString& elementId) const for (Node *n = traverseNextNode(); n != 0; n = n->traverseNextNode()) { if (n->isElementNode()) { element = static_cast(n); - if (element->hasID() && element->getAttribute(idAttr) == elementId) { + if (element->hasID() && element->getAttribute(element->idAttributeName()) == elementId) { m_duplicateIds.remove(elementId.impl()); m_elementsById.set(elementId.impl(), element); return element; @@ -1043,6 +1078,8 @@ void Document::addElementById(const AtomicString& elementId, Element* element) void Document::removeElementById(const AtomicString& elementId, Element* element) { + m_elementsById.checkConsistency(); + if (m_elementsById.get(elementId.impl()) == element) m_elementsById.remove(elementId.impl()); else @@ -1067,8 +1104,67 @@ Element* Document::getElementByAccessKey(const String& key) const return m_elementsByAccessKey.get(key.impl()); } +/* + * Performs three operations: + * 1. Convert control characters to spaces + * 2. Trim leading and trailing spaces + * 3. Collapse internal whitespace. + */ +static inline String canonicalizedTitle(Document* document, const String& title) +{ + const UChar* characters = title.characters(); + unsigned length = title.length(); + unsigned i; + + StringBuffer buffer(length); + unsigned builderIndex = 0; + + // Skip leading spaces and leading characters that would convert to spaces + for (i = 0; i < length; ++i) { + UChar c = characters[i]; + if (!(c <= 0x20 || c == 0x7F)) + break; + } + + if (i == length) + return ""; + + // Replace control characters with spaces, and backslashes with currency symbols, and collapse whitespace. + bool previousCharWasWS = false; + for (; i < length; ++i) { + UChar c = characters[i]; + if (c <= 0x20 || c == 0x7F || (WTF::Unicode::category(c) & (WTF::Unicode::Separator_Line | WTF::Unicode::Separator_Paragraph))) { + if (previousCharWasWS) + continue; + buffer[builderIndex++] = ' '; + previousCharWasWS = true; + } else { + buffer[builderIndex++] = c; + previousCharWasWS = false; + } + } + + // Strip trailing spaces + while (builderIndex > 0) { + --builderIndex; + if (buffer[builderIndex] != ' ') + break; + } + + if (!builderIndex && buffer[builderIndex] == ' ') + return ""; + + buffer.shrink(builderIndex + 1); + + // Replace the backslashes with currency symbols if the encoding requires it. + document->displayBufferModifiedByEncoding(buffer.characters(), buffer.length()); + + return String::adopt(buffer); +} + void Document::updateTitle() { + m_title = canonicalizedTitle(this, m_rawTitle); if (Frame* f = frame()) f->loader()->setTitle(m_title); } @@ -1095,10 +1191,10 @@ void Document::setTitle(const String& title, Element* titleElement) m_titleElement = titleElement; } - if (m_title == title) + if (m_rawTitle == title) return; - m_title = title; + m_rawTitle = title; updateTitle(); if (m_titleSetExplicitly && m_titleElement && m_titleElement->hasTagName(titleTag)) @@ -1123,8 +1219,8 @@ void Document::removeTitle(Element* titleElement) } } - if (!m_titleElement && !m_title.isEmpty()) { - m_title = ""; + if (!m_titleElement && !m_rawTitle.isEmpty()) { + m_rawTitle = ""; updateTitle(); } } @@ -1231,13 +1327,13 @@ void Document::recalcStyle(StyleChange change) return; // Guard against re-entrancy. -dwh #if ENABLE(INSPECTOR) - InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(); - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) timelineAgent->willRecalculateStyle(); #endif m_inStyleRecalc = true; suspendPostAttachCallbacks(); + RenderWidget::suspendWidgetHierarchyUpdates(); if (view()) view()->pauseScheduledEvents(); @@ -1249,32 +1345,7 @@ void Document::recalcStyle(StyleChange change) // style selector may set this again during recalc m_hasNodesWithPlaceholderStyle = false; - RefPtr documentStyle = RenderStyle::create(); - documentStyle->setDisplay(BLOCK); - documentStyle->setVisuallyOrdered(visuallyOrdered); - documentStyle->setZoom(frame()->pageZoomFactor()); - m_styleSelector->setStyle(documentStyle); - - FontDescription fontDescription; - fontDescription.setUsePrinterFont(printing()); - if (Settings* settings = this->settings()) { - fontDescription.setRenderingMode(settings->fontRenderingMode()); - if (printing() && !settings->shouldPrintBackgrounds()) - documentStyle->setForceBackgroundsToWhite(true); - const AtomicString& stdfont = settings->standardFontFamily(); - if (!stdfont.isEmpty()) { - fontDescription.firstFamily().setFamily(stdfont); - fontDescription.firstFamily().appendFamily(0); - } - fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); - m_styleSelector->setFontSize(fontDescription, m_styleSelector->fontSizeForKeyword(CSSValueMedium, inCompatMode(), false)); - } - - documentStyle->setFontDescription(fontDescription); - documentStyle->font().update(m_styleSelector->fontSelector()); - if (inCompatMode()) - documentStyle->setHtmlHacks(true); // enable html specific rendering tricks - + RefPtr documentStyle = CSSStyleSelector::styleForDocument(this); StyleChange ch = diff(documentStyle.get(), renderer()->style()); if (renderer() && ch != NoChange) renderer()->setStyle(documentStyle.release()); @@ -1300,6 +1371,7 @@ bail_out: if (view()) view()->resumeScheduledEvents(); + RenderWidget::resumeWidgetHierarchyUpdates(); resumePostAttachCallbacks(); m_inStyleRecalc = false; @@ -1310,7 +1382,7 @@ bail_out: } #if ENABLE(INSPECTOR) - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent()) timelineAgent->didRecalculateStyle(); #endif } @@ -1381,7 +1453,7 @@ void Document::updateLayoutIgnorePendingStylesheets() } else if (m_hasNodesWithPlaceholderStyle) // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes // may not have had their real style calculated yet. Normally this gets cleaned when style sheets arrive - // but here we need up-to-date style immediatly. + // but here we need up-to-date style immediately. recalcStyle(Force); } @@ -1390,6 +1462,26 @@ void Document::updateLayoutIgnorePendingStylesheets() m_ignorePendingStylesheets = oldIgnore; } +PassRefPtr Document::styleForElementIgnoringPendingStylesheets(Element* element) +{ + ASSERT_ARG(element, element->document() == this); + + bool oldIgnore = m_ignorePendingStylesheets; + m_ignorePendingStylesheets = true; + RefPtr style = styleSelector()->styleForElement(element, element->parent() ? element->parent()->computedStyle() : 0); + m_ignorePendingStylesheets = oldIgnore; + return style.release(); +} + +void Document::createStyleSelector() +{ + bool matchAuthorAndUserStyles = true; + if (Settings* docSettings = settings()) + matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); + m_styleSelector.set(new CSSStyleSelector(this, m_styleSheets.get(), m_mappedElementSheet.get(), pageUserSheet(), pageGroupUserSheets(), + !inCompatMode(), matchAuthorAndUserStyles)); +} + void Document::attach() { ASSERT(!attached()); @@ -1400,19 +1492,11 @@ void Document::attach() m_renderArena = new RenderArena(); // Create the rendering tree - setRenderer(new (m_renderArena) RenderView(this, view())); + setRenderer(new (m_renderArena.get()) RenderView(this, view())); #if USE(ACCELERATED_COMPOSITING) renderView()->didMoveOnscreen(); #endif - if (!m_styleSelector) { - bool matchAuthorAndUserStyles = true; - if (Settings* docSettings = settings()) - matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); - m_styleSelector = new CSSStyleSelector(this, m_styleSheets.get(), m_mappedElementSheet.get(), pageUserSheet(), pageGroupUserSheets(), - !inCompatMode(), matchAuthorAndUserStyles); - } - recalcStyle(Force); RenderObject* render = renderer(); @@ -1445,6 +1529,17 @@ void Document::detach() FrameView* view = m_frame->view(); if (view) view->detachCustomScrollbars(); + +#if ENABLE(TOUCH_EVENTS) + Page* ownerPage = page(); + if (ownerPage && (m_frame == ownerPage->mainFrame())) { + // Inform the Chrome Client that it no longer needs to + // foward touch events to WebCore as the document is being + // destroyed. It may start again if a subsequent page + // registers a touch event listener. + ownerPage->chrome()->client()->needTouchEvents(false); + } +#endif } // indicate destruction mode, i.e. attached() but renderer == 0 @@ -1462,16 +1557,12 @@ void Document::detach() render->destroy(); // This is required, as our Frame might delete itself as soon as it detaches - // us. However, this violates Node::detach() symantics, as it's never + // us. However, this violates Node::detach() semantics, as it's never // possible to re-attach. Eventually Document::detach() should be renamed, // or this setting of the frame to 0 could be made explicit in each of the // callers of Document::detach(). m_frame = 0; - - if (m_renderArena) { - delete m_renderArena; - m_renderArena = 0; - } + m_renderArena.clear(); } void Document::removeAllEventListeners() @@ -1543,7 +1634,7 @@ AXObjectCache* Document::axObjectCache() const void Document::setVisuallyOrdered() { - visuallyOrdered = true; + m_visuallyOrdered = true; if (renderer()) renderer()->style()->setVisuallyOrdered(true); } @@ -1586,8 +1677,7 @@ void Document::cancelParsing() // the onload handler when closing as a side effect of a cancel-style // change, such as opening a new document or closing the window while // still parsing - delete m_tokenizer; - m_tokenizer = 0; + m_tokenizer.clear(); close(); } } @@ -1596,8 +1686,7 @@ void Document::implicitOpen() { cancelParsing(); - delete m_tokenizer; - m_tokenizer = 0; + m_tokenizer.clear(); removeChildren(); @@ -1694,8 +1783,7 @@ void Document::implicitClose() // We have to clear the tokenizer, in case someone document.write()s from the // onLoad event handler, as in Radar 3206524. - delete m_tokenizer; - m_tokenizer = 0; + m_tokenizer.clear(); // Parser should have picked up all preloads by now m_docLoader->clearPreloads(); @@ -1729,9 +1817,13 @@ void Document::implicitClose() if (f) f->animation()->resumeAnimations(this); - ImageLoader::dispatchPendingEvents(); + ImageLoader::dispatchPendingBeforeLoadEvents(); + ImageLoader::dispatchPendingLoadEvents(); dispatchWindowLoadEvent(); dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, false), this); + if (m_pendingStateObject) + dispatchWindowEvent(PopStateEvent::create(m_pendingStateObject.release())); + if (f) f->loader()->handledOnloadEvents(); #ifdef INSTRUMENT_LAYOUT_SCHEDULING @@ -1818,13 +1910,13 @@ bool Document::shouldScheduleLayout() int Document::minimumLayoutDelay() { if (m_overMinimumLayoutThreshold) - return 0; + return m_extraLayoutDelay; int elapsed = elapsedTime(); m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold; // We'll want to schedule the timer to fire at the minimum layout threshold. - return max(0, cLayoutScheduleThreshold - elapsed); + return max(0, cLayoutScheduleThreshold - elapsed) + m_extraLayoutDelay; } int Document::elapsedTime() const @@ -1920,9 +2012,9 @@ void Document::updateBaseURL() m_baseURL = KURL(); if (m_elemSheet) - m_elemSheet->setHref(m_baseURL.string()); + m_elemSheet->setFinalURL(m_baseURL); if (m_mappedElementSheet) - m_mappedElementSheet->setHref(m_baseURL.string()); + m_mappedElementSheet->setFinalURL(m_baseURL); } String Document::userAgent(const KURL& url) const @@ -1944,7 +2036,7 @@ CSSStyleSheet* Document::pageUserSheet() return 0; // Parse the sheet and cache it. - m_pageUserSheet = CSSStyleSheet::create(this, settings()->userStyleSheetLocation()); + m_pageUserSheet = CSSStyleSheet::createInline(this, settings()->userStyleSheetLocation()); m_pageUserSheet->setIsUserStyleSheet(true); m_pageUserSheet->parseString(userSheetText, !inCompatMode()); return m_pageUserSheet.get(); @@ -1979,7 +2071,7 @@ const Vector >* Document::pageGroupUserSheets() const const UserStyleSheet* sheet = sheets->at(i).get(); if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist())) continue; - RefPtr parsedSheet = CSSStyleSheet::create(const_cast(this), sheet->url()); + RefPtr parsedSheet = CSSStyleSheet::createInline(const_cast(this), sheet->url()); parsedSheet->setIsUserStyleSheet(true); parsedSheet->parseString(sheet->source(), !inCompatMode()); if (!m_pageGroupUserSheets) @@ -2001,14 +2093,14 @@ void Document::clearPageGroupUserSheets() CSSStyleSheet* Document::elementSheet() { if (!m_elemSheet) - m_elemSheet = CSSStyleSheet::create(this, m_baseURL.string()); + m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); return m_elemSheet.get(); } CSSStyleSheet* Document::mappedElementSheet() { if (!m_mappedElementSheet) - m_mappedElementSheet = CSSStyleSheet::create(this, m_baseURL.string()); + m_mappedElementSheet = CSSStyleSheet::createInline(this, m_baseURL); return m_mappedElementSheet.get(); } @@ -2172,8 +2264,10 @@ void Document::processHttpEquiv(const String& equiv, const String& content) } } else if (equalIgnoringCase(equiv, "set-cookie")) { // FIXME: make setCookie work on XML documents too; e.g. in case of - if (isHTMLDocument()) - static_cast(this)->setCookie(content); + if (isHTMLDocument()) { + ExceptionCode ec; // Exception (for sandboxed documents) ignored. + static_cast(this)->setCookie(content, ec); + } } else if (equalIgnoringCase(equiv, "content-language")) setContentLanguage(content); else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) @@ -2489,7 +2583,7 @@ void Document::recalcStyleSelector() sheet = cssSheet.get(); } } - } else if (n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag)) + } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag))) #if ENABLE(SVG) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) #endif @@ -2557,10 +2651,7 @@ void Document::recalcStyleSelector() m_styleSheets->swap(sheets); - // Create a new style selector - delete m_styleSelector; - m_styleSelector = new CSSStyleSelector(this, m_styleSheets.get(), m_mappedElementSheet.get(), - pageUserSheet(), pageGroupUserSheets(), !inCompatMode(), matchAuthorAndUserStyles); + m_styleSelector.clear(); m_didCalculateStyleSelector = true; } @@ -2651,14 +2742,14 @@ bool Document::setFocusedNode(PassRefPtr newFocusedNode) oldFocusedNode->setActive(false); oldFocusedNode->setFocus(false); - + // Dispatch a change event for text fields or textareas that have been edited RenderObject* r = oldFocusedNode->renderer(); - if (r && r->isTextControl() && toRenderTextControl(r)->isEdited()) { - oldFocusedNode->dispatchEvent(Event::create(eventNames().changeEvent, true, false)); + if (r && r->isTextControl() && toRenderTextControl(r)->wasChangedSinceLastChangeEvent()) { + static_cast(oldFocusedNode.get())->dispatchFormControlChangeEvent(); r = oldFocusedNode->renderer(); if (r && r->isTextControl()) - toRenderTextControl(r)->setEdited(false); + toRenderTextControl(r)->setChangedSinceLastChangeEvent(false); } // Dispatch the blur event and let the node do any other blur related activities (important for text fields) @@ -2742,6 +2833,8 @@ bool Document::setFocusedNode(PassRefPtr newFocusedNode) axObjectCache()->handleFocusedUIElementChanged(oldFocusedRenderer, newFocusedRenderer); } #endif + if (!focusChangeBlocked) + page()->chrome()->focusedNodeChanged(m_focusedNode.get()); SetFocusedNodeDone: updateStyleIfNeeded(); @@ -2900,6 +2993,25 @@ void Document::dispatchWindowLoadEvent() domWindow->dispatchLoadEvent(); } +void Document::enqueueStorageEvent(PassRefPtr storageEvent) +{ + m_storageEventQueue.append(storageEvent); + if (!m_storageEventTimer.isActive()) + m_storageEventTimer.startOneShot(0); +} + +void Document::storageEventTimerFired(Timer*) +{ + ASSERT(!m_storageEventTimer.isActive()); + Vector > storageEventQueue; + storageEventQueue.swap(m_storageEventQueue); + + typedef Vector >::const_iterator Iterator; + Iterator end = storageEventQueue.end(); + for (Iterator it = storageEventQueue.begin(); it != end; ++it) + dispatchWindowEvent(*it); +} + PassRefPtr Document::createEvent(const String& eventType, ExceptionCode& ec) { RefPtr event; @@ -2939,6 +3051,10 @@ PassRefPtr Document::createEvent(const String& eventType, ExceptionCode& else if (eventType == "SVGZoomEvents") event = SVGZoomEvent::create(); #endif +#if ENABLE(TOUCH_EVENTS) + else if (eventType == "TouchEvent") + event = TouchEvent::create(); +#endif if (event) { event->setCreatedByDOM(true); return event.release(); @@ -2975,6 +3091,16 @@ void Document::addListenerTypeIfNeeded(const AtomicString& eventType) addListenerType(TRANSITIONEND_LISTENER); else if (eventType == eventNames().beforeloadEvent) addListenerType(BEFORELOAD_LISTENER); +#if ENABLE(TOUCH_EVENTS) + else if (eventType == eventNames().touchstartEvent + || eventType == eventNames().touchmoveEvent + || eventType == eventNames().touchendEvent + || eventType == eventNames().touchcancelEvent) { + addListenerType(TOUCH_LISTENER); + if (Page* page = this->page()) + page->chrome()->client()->needTouchEvents(true); + } +#endif } CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&) @@ -2989,11 +3115,20 @@ Element* Document::ownerElement() const return frame()->ownerElement(); } -String Document::cookie() const +String Document::cookie(ExceptionCode& ec) const { if (page() && !page()->cookieEnabled()) return String(); + // FIXME: The HTML5 DOM spec states that this attribute can raise an + // INVALID_STATE_ERR exception on getting if the Document has no + // browsing context. + + if (!securityOrigin()->canAccessCookies()) { + ec = SECURITY_ERR; + return String(); + } + KURL cookieURL = this->cookieURL(); if (cookieURL.isEmpty()) return String(); @@ -3001,11 +3136,20 @@ String Document::cookie() const return cookies(this, cookieURL); } -void Document::setCookie(const String& value) +void Document::setCookie(const String& value, ExceptionCode& ec) { if (page() && !page()->cookieEnabled()) return; + // FIXME: The HTML5 DOM spec states that this attribute can raise an + // INVALID_STATE_ERR exception on setting if the Document has no + // browsing context. + + if (!securityOrigin()->canAccessCookies()) { + ec = SECURITY_ERR; + return; + } + KURL cookieURL = this->cookieURL(); if (cookieURL.isEmpty()) return; @@ -3027,6 +3171,11 @@ String Document::domain() const void Document::setDomain(const String& newDomain, ExceptionCode& ec) { + if (SecurityOrigin::isDomainRelaxationForbiddenForURLScheme(securityOrigin()->protocol())) { + ec = SECURITY_ERR; + return; + } + // Both NS and IE specify that changing the domain is only allowed when // the new domain is a suffix of the old domain. @@ -3207,6 +3356,8 @@ void Document::removeImageMap(HTMLMapElement* imageMap) if (!name.impl()) return; + m_imageMapsByName.checkConsistency(); + ImageMapsByName::iterator it = m_imageMapsByName.find(name.impl()); if (it != m_imageMapsByName.end() && it->second == imageMap) m_imageMapsByName.remove(it); @@ -3219,6 +3370,7 @@ HTMLMapElement *Document::getImageMap(const String& url) const int hashPos = url.find('#'); String name = (hashPos < 0 ? url : url.substring(hashPos + 1)).impl(); AtomicString mapName = isHTMLDocument() ? name.lower() : name; + m_imageMapsByName.checkConsistency(); return m_imageMapsByName.get(mapName.impl()); } @@ -3732,7 +3884,7 @@ void Document::repaintMarkers(DocumentMarker::MarkerType markerType) } } -void Document::setRenderedRectForMarker(Node* node, DocumentMarker marker, const IntRect& r) +void Document::setRenderedRectForMarker(Node* node, const DocumentMarker& marker, const IntRect& r) { MarkerMapVectorPair* vectorPair = m_markers.get(node); if (!vectorPair) { @@ -3929,7 +4081,7 @@ PassRefPtr Document::createAttributeNS(const String& namespaceURI, const S } // Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrAttrNS - if (!shouldIgnoreNamespaceChecks && qName.localName() == "xmlns" && qName.namespaceURI() != "http://www.w3.org/2000/xmlns/") { + if (!shouldIgnoreNamespaceChecks && qName.localName() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { ec = NAMESPACE_ERR; return 0; } @@ -4024,6 +4176,7 @@ CollectionCache* Document::nameCollectionInfo(CollectionType type, const AtomicS NamedCollectionMap::iterator iter = map.find(name.impl()); if (iter == map.end()) iter = map.add(name.impl(), new CollectionCache).first; + iter->second->checkConsistency(); return iter->second; } @@ -4252,7 +4405,7 @@ void Document::initSecurityContext() // loading URL. const KURL& url = m_frame->loader()->url(); m_cookieURL = url; - ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(url)); + ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(url, m_frame->loader()->sandboxFlags())); if (SecurityOrigin::allowSubstituteDataAccessToLocal()) { // If this document was loaded with substituteData, then the document can @@ -4275,6 +4428,10 @@ void Document::initSecurityContext() // Some clients want file:// URLs to have universal access, but that // setting is dangerous for other clients. securityOrigin()->grantUniversalAccess(); + } else if (!settings->allowFileAccessFromFileURLs() && securityOrigin()->isLocal()) { + // Some clients want file:// URLs to have even tighter restrictions by + // default, and not be able to access other local files. + securityOrigin()->makeUnique(); } } @@ -4304,8 +4461,54 @@ void Document::setSecurityOrigin(SecurityOrigin* securityOrigin) initDNSPrefetch(); } -void Document::updateFocusAppearanceSoon() +#if ENABLE(DATABASE) + +bool Document::isDatabaseReadOnly() const +{ + if (!page() || page()->settings()->privateBrowsingEnabled()) + return true; + return false; +} + +void Document::databaseExceededQuota(const String& name) +{ + Page* currentPage = page(); + if (currentPage) + currentPage->chrome()->client()->exceededDatabaseQuota(document()->frame(), name); +} + +#endif + +bool Document::isContextThread() const +{ + return isMainThread(); +} + +void Document::updateURLForPushOrReplaceState(const KURL& url) +{ + Frame* f = frame(); + if (!f) + return; + + setURL(url); + f->loader()->documentLoader()->replaceRequestURLForSameDocumentNavigation(url); +} + +void Document::statePopped(SerializedScriptValue* stateObject) +{ + Frame* f = frame(); + if (!f) + return; + + if (f->loader()->isComplete()) + dispatchWindowEvent(PopStateEvent::create(stateObject)); + else + m_pendingStateObject = stateObject; +} + +void Document::updateFocusAppearanceSoon(bool restorePreviousSelection) { + m_updateFocusAppearanceRestoresSelection = restorePreviousSelection; if (!m_updateFocusAppearanceTimer.isActive()) m_updateFocusAppearanceTimer.startOneShot(0); } @@ -4327,7 +4530,7 @@ void Document::updateFocusAppearanceTimerFired(Timer*) Element* element = static_cast(node); if (element->isFocusable()) - element->updateFocusAppearance(false); + element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection); } void Document::executeScriptSoonTimerFired(Timer* timer) @@ -4358,63 +4561,12 @@ void Document::executeScriptSoon(ScriptElementData* data, CachedResourceHandledomWindow()->getSelection() : 0; } -#if ENABLE(DATABASE) - -void Document::addOpenDatabase(Database* database) -{ - if (!m_openDatabaseSet) - m_openDatabaseSet.set(new DatabaseSet); - - ASSERT(!m_openDatabaseSet->contains(database)); - m_openDatabaseSet->add(database); -} - -void Document::removeOpenDatabase(Database* database) -{ - ASSERT(m_openDatabaseSet && m_openDatabaseSet->contains(database)); - if (!m_openDatabaseSet) - return; - - m_openDatabaseSet->remove(database); -} - -DatabaseThread* Document::databaseThread() -{ - if (!m_databaseThread && !m_hasOpenDatabases) { - // Create the database thread on first request - but not if at least one database was already opened, - // because in that case we already had a database thread and terminated it and should not create another. - m_databaseThread = DatabaseThread::create(); - if (!m_databaseThread->start()) - m_databaseThread = 0; - } - - return m_databaseThread.get(); -} - -void Document::stopDatabases() -{ - if (m_openDatabaseSet) { - DatabaseSet::iterator i = m_openDatabaseSet->begin(); - DatabaseSet::iterator end = m_openDatabaseSet->end(); - for (; i != end; ++i) { - (*i)->stop(); - if (m_databaseThread) - m_databaseThread->unscheduleDatabaseTasks(*i); - } - } - - if (m_databaseThread) - m_databaseThread->requestTermination(); -} - -#endif - #if ENABLE(WML) void Document::resetWMLPageState() { @@ -4535,7 +4687,7 @@ void Document::scriptImported(unsigned long identifier, const String& sourceStri class ScriptExecutionContextTaskTimer : public TimerBase { public: - ScriptExecutionContextTaskTimer(PassRefPtr context, PassRefPtr task) + ScriptExecutionContextTaskTimer(PassRefPtr context, PassOwnPtr task) : m_context(context) , m_task(task) { @@ -4549,34 +4701,40 @@ private: } RefPtr m_context; - RefPtr m_task; + OwnPtr m_task; }; -struct PerformTaskContext { - PerformTaskContext(ScriptExecutionContext* scriptExecutionContext, PassRefPtr task) - : scriptExecutionContext(scriptExecutionContext) +struct PerformTaskContext : Noncopyable { + PerformTaskContext(PassRefPtr documentReference, PassOwnPtr task) + : documentReference(documentReference) , task(task) { } - ScriptExecutionContext* scriptExecutionContext; // The context should exist until task execution. - RefPtr task; + RefPtr documentReference; + OwnPtr task; }; static void performTask(void* ctx) { - PerformTaskContext* ptctx = reinterpret_cast(ctx); - ptctx->task->performTask(ptctx->scriptExecutionContext); - delete ptctx; + ASSERT(isMainThread()); + + PerformTaskContext* context = reinterpret_cast(ctx); + ASSERT(context); + + if (Document* document = context->documentReference->document()) + context->task->performTask(document); + + delete context; } -void Document::postTask(PassRefPtr task) +void Document::postTask(PassOwnPtr task) { if (isMainThread()) { ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(static_cast(this), task); timer->startOneShot(0); } else { - callOnMainThread(performTask, new PerformTaskContext(this, task)); + callOnMainThread(performTask, new PerformTaskContext(m_weakReference, task)); } } @@ -4635,4 +4793,11 @@ bool Document::isXHTMLMPDocument() const } #endif +#if ENABLE(INSPECTOR) +InspectorTimelineAgent* Document::inspectorTimelineAgent() const +{ + return page() ? page()->inspectorTimelineAgent() : 0; +} +#endif + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h index 0632be1..e8b3e6e 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/WebCore/dom/Document.h @@ -32,10 +32,13 @@ #include "CollectionCache.h" #include "CollectionType.h" #include "Color.h" +#include "Document.h" #include "DocumentMarker.h" -#include "Page.h" #include "ScriptExecutionContext.h" #include "Timer.h" +#if USE(JSC) +#include +#endif #include #include #include @@ -61,6 +64,7 @@ namespace WebCore { class DocLoader; class DocumentFragment; class DocumentType; + class DocumentWeakReference; class EditingText; class Element; class EntityReference; @@ -68,7 +72,6 @@ namespace WebCore { class EventListener; class Frame; class FrameView; - class HitTestRequest; class HTMLCanvasElement; class HTMLCollection; class HTMLAllCollection; @@ -78,6 +81,8 @@ namespace WebCore { class HTMLHeadElement; class HTMLInputElement; class HTMLMapElement; + class HistoryItem; + class HitTestRequest; class InspectorTimelineAgent; class IntPoint; class DOMWrapperWorld; @@ -85,6 +90,7 @@ namespace WebCore { class MouseEventWithHitTestResults; class NodeFilter; class NodeIterator; + class Page; class PlatformMouseEvent; class ProcessingInstruction; class Range; @@ -93,6 +99,7 @@ namespace WebCore { class RenderView; class ScriptElementData; class SecurityOrigin; + class SerializedScriptValue; class SegmentedString; class Settings; class StyleSheet; @@ -172,11 +179,11 @@ class Document : public ContainerNode, public ScriptExecutionContext { public: static PassRefPtr create(Frame* frame) { - return adoptRef(new Document(frame, false)); + return adoptRef(new Document(frame, false, false)); } static PassRefPtr createXHTML(Frame* frame) { - return adoptRef(new Document(frame, true)); + return adoptRef(new Document(frame, true, false)); } virtual ~Document(); @@ -250,6 +257,12 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); DEFINE_ATTRIBUTE_EVENT_LISTENER(search); DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); +#if ENABLE(TOUCH_EVENTS) + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); +#endif DocumentType* doctype() const { return m_docType.get(); } @@ -336,13 +349,14 @@ public: ASSERT(type >= FirstUnnamedDocumentCachedType); unsigned index = type - FirstUnnamedDocumentCachedType; ASSERT(index < NumUnnamedDocumentCachedTypes); + m_collectionInfo[index].checkConsistency(); return &m_collectionInfo[index]; } CollectionCache* nameCollectionInfo(CollectionType, const AtomicString& name); // Other methods (not part of DOM) - virtual bool isHTMLDocument() const { return false; } + bool isHTMLDocument() const { return m_isHTML; } virtual bool isImageDocument() const { return false; } #if ENABLE(SVG) virtual bool isSVGDocument() const { return false; } @@ -361,7 +375,12 @@ public: #endif virtual bool isFrameSet() const { return false; } - CSSStyleSelector* styleSelector() const { return m_styleSelector; } + CSSStyleSelector* styleSelector() + { + if (!m_styleSelector) + createStyleSelector(); + return m_styleSelector.get(); + } Element* getElementByAccessKey(const String& key) const; @@ -450,13 +469,14 @@ public: virtual void updateStyleIfNeeded(); void updateLayout(); void updateLayoutIgnorePendingStylesheets(); + PassRefPtr styleForElementIgnoringPendingStylesheets(Element*); static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function. - DocLoader* docLoader() { return m_docLoader; } + DocLoader* docLoader() { return m_docLoader.get(); } virtual void attach(); virtual void detach(); - RenderArena* renderArena() { return m_renderArena; } + RenderArena* renderArena() { return m_renderArena.get(); } RenderView* renderView() const; @@ -465,6 +485,7 @@ public: // to get visually ordered hebrew and arabic pages right void setVisuallyOrdered(); + bool visuallyOrdered() const { return m_visuallyOrdered; } void open(Document* ownerDocument = 0); void implicitOpen(); @@ -504,7 +525,7 @@ public: CSSStyleSheet* mappedElementSheet(); virtual Tokenizer* createTokenizer(); - Tokenizer* tokenizer() { return m_tokenizer; } + Tokenizer* tokenizer() { return m_tokenizer.get(); } bool printing() const { return m_printing; } void setPrinting(bool p) { m_printing = p; } @@ -521,6 +542,10 @@ public: void setParsing(bool); bool parsing() const { return m_bParsing; } int minimumLayoutDelay(); + + // This method is used by Android. + void setExtraLayoutDelay(int delay) { m_extraLayoutDelay = delay; } + bool shouldScheduleLayout(); int elapsedTime() const; @@ -601,6 +626,9 @@ public: void dispatchWindowEvent(PassRefPtr, PassRefPtr = 0); void dispatchWindowLoadEvent(); + void enqueueStorageEvent(PassRefPtr); + void storageEventTimerFired(Timer*); + PassRefPtr createEvent(const String& eventType, ExceptionCode&); // keep track of what types of event listeners are registered, so we don't @@ -618,7 +646,8 @@ public: ANIMATIONSTART_LISTENER = 0x200, ANIMATIONITERATION_LISTENER = 0x400, TRANSITIONEND_LISTENER = 0x800, - BEFORELOAD_LISTENER = 0x1000 + BEFORELOAD_LISTENER = 0x1000, + TOUCH_LISTENER = 0x2000 }; bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); } @@ -675,8 +704,8 @@ public: void setTitle(const String&, Element* titleElement = 0); void removeTitle(Element* titleElement); - String cookie() const; - void setCookie(const String&); + String cookie(ExceptionCode&) const; + void setCookie(const String&, ExceptionCode&); String referrer() const; @@ -730,7 +759,7 @@ public: void removeMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void removeMarkers(Node*); void repaintMarkers(DocumentMarker::MarkerType = DocumentMarker::AllMarkers); - void setRenderedRectForMarker(Node*, DocumentMarker, const IntRect&); + void setRenderedRectForMarker(Node*, const DocumentMarker&, const IntRect&); void invalidateRenderedRectsForMarkersInRect(const IntRect&); void shiftMarkers(Node*, unsigned startOffset, int delta, DocumentMarker::MarkerType = DocumentMarker::AllMarkers); void setMarkersActive(Range*, bool); @@ -764,7 +793,7 @@ public: #if ENABLE(XBL) // XBL methods - XBLBindingManager* bindingManager() const { return m_bindingManager; } + XBLBindingManager* bindingManager() const { return m_bindingManager.get(); } #endif void incDOMTreeVersion() { ++m_domtree_version; } @@ -802,10 +831,10 @@ public: void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; } bool hasNodeListCaches() const { return m_numNodeListCaches; } - void updateFocusAppearanceSoon(); + void updateFocusAppearanceSoon(bool restorePreviousSelection); void cancelFocusAppearanceUpdate(); - // FF method for accessing the selection added for compatability. + // FF method for accessing the selection added for compatibility. DOMSelection* getSelection() const; // Extension for manipulating canvas drawing contexts for use in CSS @@ -819,18 +848,15 @@ public: virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); virtual void scriptImported(unsigned long, const String&); - virtual void postTask(PassRefPtr); // Executes the task on context's thread asynchronously. + virtual void postTask(PassOwnPtr); // Executes the task on context's thread asynchronously. - typedef HashMap JSWrapperCache; +#if USE(JSC) + typedef JSC::WeakGCMap JSWrapperCache; typedef HashMap JSWrapperCacheMap; JSWrapperCacheMap& wrapperCacheMap() { return m_wrapperCacheMap; } - JSWrapperCache* getWrapperCache(DOMWrapperWorld* world) - { - if (JSWrapperCache* wrapperCache = m_wrapperCacheMap.get(world)) - return wrapperCache; - return createWrapperCache(world); - } + JSWrapperCache* getWrapperCache(DOMWrapperWorld* world); JSWrapperCache* createWrapperCache(DOMWrapperWorld*); +#endif virtual void finishedParsing(); @@ -887,17 +913,18 @@ public: // that already contains content. void setSecurityOrigin(SecurityOrigin*); + void updateURLForPushOrReplaceState(const KURL&); + void statePopped(SerializedScriptValue*); + bool processingLoadEvent() const { return m_processingLoadEvent; } #if ENABLE(DATABASE) - void addOpenDatabase(Database*); - void removeOpenDatabase(Database*); - DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. - void setHasOpenDatabases() { m_hasOpenDatabases = true; } - bool hasOpenDatabases() { return m_hasOpenDatabases; } - void stopDatabases(); + virtual bool isDatabaseReadOnly() const; + virtual void databaseExceededQuota(const String& name); #endif + virtual bool isContextThread() const; + void setUsingGeolocation(bool f) { m_usingGeolocation = f; } bool usingGeolocation() const { return m_usingGeolocation; }; @@ -908,11 +935,12 @@ public: void resetWMLPageState(); void initializeWMLPageState(); #endif + + bool containsValidityStyleRules() const { return m_containsValidityStyleRules; } + void setContainsValidityStyleRules() { m_containsValidityStyleRules = true; } protected: - Document(Frame*, bool isXHTML); - - void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } + Document(Frame*, bool isXHTML, bool isHTML); void clearXMLVersion() { m_xmlVersion = String(); } @@ -947,12 +975,14 @@ private: void cacheDocumentElement() const; - CSSStyleSelector* m_styleSelector; + void createStyleSelector(); + + OwnPtr m_styleSelector; bool m_didCalculateStyleSelector; Frame* m_frame; - DocLoader* m_docLoader; - Tokenizer* m_tokenizer; + OwnPtr m_docLoader; + OwnPtr m_tokenizer; bool m_wellFormed; // Document URLs. @@ -1032,7 +1062,7 @@ private: String m_selectedStylesheetSet; bool m_loadingSheet; - bool visuallyOrdered; + bool m_visuallyOrdered; bool m_bParsing; Timer m_styleRecalcTimer; bool m_inStyleRecalc; @@ -1047,12 +1077,15 @@ private: bool m_isDNSPrefetchEnabled; bool m_haveExplicitlyDisabledDNSPrefetch; bool m_frameElementsShouldIgnoreScrolling; + bool m_containsValidityStyleRules; + bool m_updateFocusAppearanceRestoresSelection; String m_title; + String m_rawTitle; bool m_titleSetExplicitly; RefPtr m_titleElement; - - RenderArena* m_renderArena; + + OwnPtr m_renderArena; typedef std::pair, Vector > MarkerMapVectorPair; typedef HashMap, MarkerMapVectorPair*> MarkerMap; @@ -1065,8 +1098,14 @@ private: Element* m_cssTarget; bool m_processingLoadEvent; + RefPtr m_pendingStateObject; + HashSet > m_associatedHistoryItems; double m_startTime; bool m_overMinimumLayoutThreshold; + // This is used to increase the minimum delay between re-layouts. It is set + // using setExtraLayoutDelay to modify the minimum delay used at different + // points during the lifetime of the Document. + int m_extraLayoutDelay; Vector > > m_scriptsToExecuteSoon; Timer m_executeScriptSoonTimer; @@ -1077,7 +1116,7 @@ private: #endif #if ENABLE(XBL) - XBLBindingManager* m_bindingManager; // The access point through which documents and elements communicate with XBL. + OwnPtr m_bindingManager; // The access point through which documents and elements communicate with XBL. #endif typedef HashMap ImageMapsByName; @@ -1096,7 +1135,6 @@ private: #endif RenderObject* m_savedRenderer; - int m_secureForms; RefPtr m_decoder; @@ -1145,23 +1183,25 @@ private: bool m_useSecureKeyboardEntryWhenActive; bool m_isXHTML; + bool m_isHTML; unsigned m_numNodeListCaches; +#if USE(JSC) JSWrapperCacheMap m_wrapperCacheMap; - -#if ENABLE(DATABASE) - RefPtr m_databaseThread; - bool m_hasOpenDatabases; // This never changes back to false, even as the database thread is closed. - typedef HashSet DatabaseSet; - OwnPtr m_openDatabaseSet; + JSWrapperCache* m_normalWorldWrapperCache; #endif - + bool m_usingGeolocation; + Timer m_storageEventTimer; + Vector > m_storageEventQueue; + #if ENABLE(WML) bool m_containsWMLContent; #endif + + RefPtr m_weakReference; }; inline bool Document::hasElementWithId(AtomicStringImpl* id) const @@ -1175,12 +1215,6 @@ inline bool Node::isDocumentNode() const return this == m_document; } -#if ENABLE(INSPECTOR) -inline InspectorTimelineAgent* Document::inspectorTimelineAgent() const { - return page() ? page()->inspectorTimelineAgent() : 0; -} -#endif - } // namespace WebCore #endif // Document_h diff --git a/src/3rdparty/webkit/WebCore/dom/Document.idl b/src/3rdparty/webkit/WebCore/dom/Document.idl index e9b5480..26ed7fd 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.idl +++ b/src/3rdparty/webkit/WebCore/dom/Document.idl @@ -22,12 +22,9 @@ module core { interface [ CustomToJS, - GenerateConstructor, GenerateNativeConverter, CustomMarkFunction, - InlineGetOwnPropertySlot, - InterfaceUUID=48BB95FC-2D08-4c54-BE65-7558736A4CAE, - ImplementationUUID=FF5CBE81-F817-429c-A6C2-0CCCD2328062 + InlineGetOwnPropertySlot ] Document : Node { // DOM Level 1 Core @@ -35,7 +32,7 @@ module core { readonly attribute [V8Custom] DOMImplementation implementation; readonly attribute Element documentElement; - [ReturnsNew] Element createElement(in [ConvertNullToNullString, HintAtomic] DOMString tagName) + [ReturnsNew] Element createElement(in [ConvertNullToNullString] DOMString tagName) raises (DOMException); DocumentFragment createDocumentFragment(); [ReturnsNew] Text createTextNode(in DOMString data); @@ -64,7 +61,7 @@ module core { raises (DOMException); [OldStyleObjC] NodeList getElementsByTagNameNS(in [ConvertNullToNullString] DOMString namespaceURI, in DOMString localName); - Element getElementById(in [HintAtomic] DOMString elementId); + Element getElementById(in DOMString elementId); // DOM Level 3 Core @@ -81,7 +78,6 @@ module core { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString documentURI; -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM // DOM Level 2 Events (DocumentEvents interface) Event createEvent(in DOMString eventType) @@ -129,7 +125,6 @@ module core { in XPathResult inResult) raises(DOMException); #endif // ENABLE_XPATH -#endif // !defined(LANGUAGE_COM) // Common extensions @@ -162,19 +157,16 @@ module core { #endif readonly attribute DOMString URL; - // FIXME: the DOM spec states that this attribute can - // raise an exception on setting. attribute [ConvertNullToNullString] DOMString cookie - /*setter raises (DOMException)*/; + setter raises (DOMException), + getter raises (DOMException); // FIXME: the DOM spec does NOT have this attribute // raising an exception. attribute HTMLElement body setter raises (DOMException); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM readonly attribute HTMLHeadElement head; -#endif readonly attribute HTMLCollection images; readonly attribute HTMLCollection applets; readonly attribute HTMLCollection links; @@ -195,9 +187,7 @@ module core { readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState; Element elementFromPoint(in long x, in long y); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM Range caretRangeFromPoint(in long x, in long y); -#endif // Mozilla extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT @@ -210,11 +200,9 @@ module core { readonly attribute [ConvertNullStringTo=Null] DOMString preferredStylesheetSet; attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectedStylesheetSet; -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT CSSStyleDeclaration createCSSStyleDeclaration(); #endif -#endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // DOM Level 2 Style Interface @@ -231,11 +219,9 @@ module core { #endif -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C [V8Custom] DOMObject getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height); #endif -#endif // HTML 5 NodeList getElementsByClassName(in DOMString tagname); @@ -253,7 +239,6 @@ module core { #endif #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler DOM attributes attribute [DontEnum] EventListener onabort; attribute [DontEnum] EventListener onblur; @@ -321,6 +306,11 @@ module core { attribute [DontEnum] EventListener onreset; attribute [DontEnum] EventListener onsearch; attribute [DontEnum] EventListener onselectstart; +#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS + attribute [DontEnum] EventListener ontouchstart; + attribute [DontEnum] EventListener ontouchmove; + attribute [DontEnum] EventListener ontouchend; + attribute [DontEnum] EventListener ontouchcancel; #endif #endif }; diff --git a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.idl b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.idl index ff6232f..882b62d 100644 --- a/src/3rdparty/webkit/WebCore/dom/DocumentFragment.idl +++ b/src/3rdparty/webkit/WebCore/dom/DocumentFragment.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=F5C8DAF0-D728-4b2b-9D9C-630621B07D35, - ImplementationUUID=E57BF71F-3FAA-495c-A307-E288F8E5B2EC - ] DocumentFragment : Node { + interface DocumentFragment : Node { // NodeSelector - Selector API Element querySelector(in DOMString selectors) raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/dom/DocumentType.idl b/src/3rdparty/webkit/WebCore/dom/DocumentType.idl index ef7b5b6..7992dc5 100644 --- a/src/3rdparty/webkit/WebCore/dom/DocumentType.idl +++ b/src/3rdparty/webkit/WebCore/dom/DocumentType.idl @@ -20,10 +20,7 @@ module core { interface [ - GenerateConstructor, - GenerateNativeConverter, - InterfaceUUID=20F04535-A423-4273-8CFE-3AD996100D29, - ImplementationUUID=736D952F-DBAF-458b-834B-F1638700BD88 + GenerateNativeConverter ] DocumentType : Node { // DOM Level 1 diff --git a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp index 892a5e7..3f0744b 100644 --- a/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp +++ b/src/3rdparty/webkit/WebCore/dom/DynamicNodeList.cpp @@ -129,7 +129,9 @@ Node* DynamicNodeList::itemWithName(const AtomicString& elementId) const return node; } } - return 0; + if (!node) + return 0; + // In the case of multiple nodes with the same name, just fall through. } unsigned length = this->length(); diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp index 0692999..69802d8 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp @@ -42,11 +42,13 @@ #include "FrameView.h" #include "HTMLElement.h" #include "HTMLNames.h" +#include "InspectorController.h" #include "NamedNodeMap.h" #include "NodeList.h" #include "NodeRenderStyle.h" #include "Page.h" #include "RenderView.h" +#include "RenderWidget.h" #include "TextIterator.h" #include "XMLNames.h" @@ -111,11 +113,11 @@ PassRefPtr Element::cloneElementWithoutChildren() // This is a sanity check as HTML overloads some of the DOM methods. ASSERT(isHTMLElement() == clone->isHTMLElement()); + clone->copyNonAttributeProperties(this); + // Clone attributes. if (namedAttrMap) clone->attributes()->setAttributes(*attributes(true)); // Call attributes(true) to force attribute synchronization to occur (for svg and style) before cloning happens. - - clone->copyNonAttributeProperties(this); return clone.release(); } @@ -135,6 +137,12 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value) ExceptionCode ec; setAttribute(name, value, ec); } + +void Element::setCStringAttribute(const QualifiedName& name, const char* cStringValue) +{ + ExceptionCode ec; + setAttribute(name, AtomicString(cStringValue), ec); +} void Element::setBooleanAttribute(const QualifiedName& name, bool b) { @@ -152,21 +160,6 @@ NamedNodeMap* Element::attributes() const return attributes(false); } -NamedNodeMap* Element::attributes(bool readonly) const -{ - if (!m_isStyleAttributeValid) - updateStyleAttribute(); - -#if ENABLE(SVG) - if (!m_areSVGAttributesValid) - updateAnimatedSVGAttribute(String()); -#endif - - if (!readonly && !namedAttrMap) - createAttributeMap(); - return namedAttrMap.get(); -} - Node::NodeType Element::nodeType() const { return ELEMENT_NODE; @@ -189,7 +182,7 @@ const AtomicString& Element::getAttribute(const QualifiedName& name) const #if ENABLE(SVG) if (!m_areSVGAttributesValid) - updateAnimatedSVGAttribute(name.localName()); + updateAnimatedSVGAttribute(name); #endif if (namedAttrMap) @@ -488,18 +481,22 @@ static inline bool shouldIgnoreAttributeCase(const Element* e) const AtomicString& Element::getAttribute(const String& name) const { - String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; - if (localName == styleAttr.localName() && !m_isStyleAttributeValid) + bool ignoreCase = shouldIgnoreAttributeCase(this); + + // Update the 'style' attribute if it's invalid and being requested: + if (!m_isStyleAttributeValid && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase)) updateStyleAttribute(); #if ENABLE(SVG) - if (!m_areSVGAttributesValid) - updateAnimatedSVGAttribute(name); + if (!m_areSVGAttributesValid) { + // We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well. + updateAnimatedSVGAttribute(QualifiedName(nullAtom, name, nullAtom)); + } #endif if (namedAttrMap) - if (Attribute* a = namedAttrMap->getAttributeItem(name, shouldIgnoreAttributeCase(this))) - return a->value(); + if (Attribute* attribute = namedAttrMap->getAttributeItem(name, ignoreCase)) + return attribute->value(); return nullAtom; } @@ -527,9 +524,9 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, document()->incDOMTreeVersion(); - if (localName == idAttr.localName()) + if (localName == idAttributeName().localName()) updateId(old ? old->value() : nullAtom, value); - + if (old && value.isNull()) namedAttrMap->removeAttribute(old->name()); else if (!old && !value.isNull()) @@ -538,6 +535,15 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, old->setValue(value); attributeChanged(old); } + +#if ENABLE(INSPECTOR) + if (Page* page = document()->page()) { + if (InspectorController* inspectorController = page->inspectorController()) { + if (!m_synchronizingStyleAttribute) + inspectorController->didModifyDOMAttr(this); + } + } +#endif } void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&) @@ -547,9 +553,9 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, // allocate attributemap if necessary Attribute* old = attributes(false)->getAttributeItem(name); - if (name == idAttr) + if (name == idAttributeName()) updateId(old ? old->value() : nullAtom, value); - + if (old && value.isNull()) namedAttrMap->removeAttribute(name); else if (!old && !value.isNull()) @@ -558,6 +564,15 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value, old->setValue(value); attributeChanged(old); } + +#if ENABLE(INSPECTOR) + if (Page* page = document()->page()) { + if (InspectorController* inspectorController = page->inspectorController()) { + if (!m_synchronizingStyleAttribute) + inspectorController->didModifyDOMAttr(this); + } + } +#endif } PassRefPtr Element::createAttribute(const QualifiedName& name, const AtomicString& value) @@ -573,20 +588,22 @@ void Element::attributeChanged(Attribute* attr, bool) void Element::updateAfterAttributeChanged(Attribute* attr) { - AXObjectCache* axObjectCache = document()->axObjectCache(); - if (!axObjectCache->accessibilityEnabled()) + if (!AXObjectCache::accessibilityEnabled()) return; const QualifiedName& attrName = attr->name(); if (attrName == aria_activedescendantAttr) { // any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact - axObjectCache->handleActiveDescendantChanged(renderer()); + document()->axObjectCache()->handleActiveDescendantChanged(renderer()); } else if (attrName == roleAttr) { // the role attribute can change at any time, and the AccessibilityObject must pick up these changes - axObjectCache->handleAriaRoleChanged(renderer()); + document()->axObjectCache()->handleAriaRoleChanged(renderer()); } else if (attrName == aria_valuenowAttr) { // If the valuenow attribute changes, AX clients need to be notified. - axObjectCache->postNotification(renderer(), AXObjectCache::AXValueChanged, true); + document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXValueChanged, true); + } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) { + // If the content of an element changes due to an attribute change, notify accessibility. + document()->axObjectCache()->contentChanged(renderer()); } } @@ -595,15 +612,31 @@ void Element::recalcStyleIfNeededAfterAttributeChanged(Attribute* attr) if (document()->attached() && document()->styleSelector()->hasSelectorForAttribute(attr->name().localName())) setNeedsStyleRecalc(); } - -void Element::setAttributeMap(PassRefPtr list) + +// Returns true is the given attribute is an event handler. +// We consider an event handler any attribute that begins with "on". +// It is a simple solution that has the advantage of not requiring any +// code or configuration change if a new event handler is defined. + +static bool isEventHandlerAttribute(const QualifiedName& name) +{ + return name.namespaceURI().isNull() && name.localName().startsWith("on"); +} + +static bool isAttributeToRemove(const QualifiedName& name, const AtomicString& value) +{ + return (name.localName().endsWith(hrefAttr.localName()) || name == srcAttr || name == actionAttr) && protocolIsJavaScript(deprecatedParseURL(value)); +} + +void Element::setAttributeMap(PassRefPtr list, FragmentScriptingPermission scriptingPermission) { document()->incDOMTreeVersion(); // If setting the whole map changes the id attribute, we need to call updateId. - Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idAttr) : 0; - Attribute* newId = list ? list->getAttributeItem(idAttr) : 0; + const QualifiedName& idName = idAttributeName(); + Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idName) : 0; + Attribute* newId = list ? list->getAttributeItem(idName) : 0; if (oldId || newId) updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom); @@ -615,6 +648,22 @@ void Element::setAttributeMap(PassRefPtr list) if (namedAttrMap) { namedAttrMap->m_element = this; + // If the element is created as result of a paste or drag-n-drop operation + // we want to remove all the script and event handlers. + if (scriptingPermission == FragmentScriptingNotAllowed) { + unsigned i = 0; + while (i < namedAttrMap->length()) { + const QualifiedName& attributeName = namedAttrMap->m_attributes[i]->name(); + if (isEventHandlerAttribute(attributeName)) { + namedAttrMap->m_attributes.remove(i); + continue; + } + + if (isAttributeToRemove(attributeName, namedAttrMap->m_attributes[i]->value())) + namedAttrMap->m_attributes[i]->setValue(nullAtom); + i++; + } + } unsigned len = namedAttrMap->length(); for (unsigned i = 0; i < len; i++) attributeChanged(namedAttrMap->m_attributes[i].get()); @@ -629,7 +678,7 @@ bool Element::hasAttributes() const #if ENABLE(SVG) if (!m_areSVGAttributesValid) - updateAnimatedSVGAttribute(String()); + updateAnimatedSVGAttribute(anyQName()); #endif return namedAttrMap && namedAttrMap->length() > 0; @@ -645,19 +694,20 @@ String Element::nodeNamePreservingCase() const return m_tagName.toString(); } -void Element::setPrefix(const AtomicString &_prefix, ExceptionCode& ec) +void Element::setPrefix(const AtomicString& prefix, ExceptionCode& ec) { ec = 0; - checkSetPrefix(_prefix, ec); + checkSetPrefix(prefix, ec); if (ec) return; - m_tagName.setPrefix(_prefix); + m_tagName.setPrefix(prefix.isEmpty() ? AtomicString() : prefix); } KURL Element::baseURI() const { - KURL base(KURL(), getAttribute(baseAttr)); + const AtomicString& baseAttribute = getAttribute(baseAttr); + KURL base(KURL(), baseAttribute); if (!base.protocol().isEmpty()) return base; @@ -669,7 +719,7 @@ KURL Element::baseURI() const if (parentBase.isNull()) return base; - return KURL(parentBase, base.string()); + return KURL(parentBase, baseAttribute); } void Element::createAttributeMap() const @@ -708,7 +758,7 @@ void Element::insertedIntoDocument() if (hasID()) { if (NamedNodeMap* attrs = namedAttrMap.get()) { - Attribute* idItem = attrs->getAttributeItem(idAttr); + Attribute* idItem = attrs->getAttributeItem(idAttributeName()); if (idItem && !idItem->isNull()) updateId(nullAtom, idItem->value()); } @@ -719,7 +769,7 @@ void Element::removedFromDocument() { if (hasID()) { if (NamedNodeMap* attrs = namedAttrMap.get()) { - Attribute* idItem = attrs->getAttributeItem(idAttr); + Attribute* idItem = attrs->getAttributeItem(idAttributeName()); if (idItem && !idItem->isNull()) updateId(idItem->value(), nullAtom); } @@ -731,6 +781,7 @@ void Element::removedFromDocument() void Element::attach() { suspendPostAttachCallbacks(); + RenderWidget::suspendWidgetHierarchyUpdates(); createRendererIfNeeded(); ContainerNode::attach(); @@ -738,20 +789,25 @@ void Element::attach() ElementRareData* data = rareData(); if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { if (isFocusable() && document()->focusedNode() == this) - document()->updateFocusAppearanceSoon(); + document()->updateFocusAppearanceSoon(false /* don't restore selection */); data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); } } + RenderWidget::resumeWidgetHierarchyUpdates(); resumePostAttachCallbacks(); } void Element::detach() { + RenderWidget::suspendWidgetHierarchyUpdates(); + cancelFocusAppearanceUpdate(); if (hasRareData()) rareData()->resetComputedStyle(); ContainerNode::detach(); + + RenderWidget::resumeWidgetHierarchyUpdates(); } bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle) @@ -990,6 +1046,7 @@ void Element::finishParsingChildren() void Element::dispatchAttrRemovalEvent(Attribute*) { ASSERT(!eventDispatchForbidden()); + #if 0 if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) return; @@ -1002,6 +1059,7 @@ void Element::dispatchAttrRemovalEvent(Attribute*) void Element::dispatchAttrAdditionEvent(Attribute*) { ASSERT(!eventDispatchForbidden()); + #if 0 if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) return; @@ -1036,21 +1094,6 @@ String Element::openTagStartToString() const return result; } -void Element::updateId(const AtomicString& oldId, const AtomicString& newId) -{ - if (!inDocument()) - return; - - if (oldId == newId) - return; - - Document* doc = document(); - if (!oldId.isEmpty()) - doc->removeElementById(oldId, this); - if (!newId.isEmpty()) - doc->addElementById(newId, this); -} - #ifndef NDEBUG void Element::formatForDebugger(char* buffer, unsigned length) const { @@ -1062,7 +1105,7 @@ void Element::formatForDebugger(char* buffer, unsigned length) const result += s; } - s = getAttribute(idAttr); + s = getAttribute(idAttributeName()); if (s.length() > 0) { if (result.length() > 0) result += "; "; @@ -1122,13 +1165,17 @@ PassRefPtr Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) return static_pointer_cast(attrs->removeNamedItem(attr->qualifiedName(), ec)); } -void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec) +void Element::setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode& ec, FragmentScriptingPermission scriptingPermission) { String prefix, localName; if (!Document::parseQualifiedName(qualifiedName, prefix, localName, ec)) return; QualifiedName qName(prefix, localName, namespaceURI); + + if (scriptingPermission == FragmentScriptingNotAllowed && (isEventHandlerAttribute(qName) || isAttributeToRemove(qName, value))) + return; + setAttribute(qName, value, ec); } @@ -1141,6 +1188,14 @@ void Element::removeAttribute(const String& name, ExceptionCode& ec) if (ec == NOT_FOUND_ERR) ec = 0; } + +#if ENABLE(INSPECTOR) + if (Page* page = document()->page()) { + if (InspectorController* inspectorController = page->inspectorController()) + inspectorController->didModifyDOMAttr(this); + } +#endif + } void Element::removeAttributeNS(const String& namespaceURI, const String& localName, ExceptionCode& ec) @@ -1239,7 +1294,7 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/) } } // FIXME: I'm not sure all devices will want this off, but this is - // currently turned off for Andriod. + // currently turned off for Android. #if !ENABLE(DIRECTIONAL_PAD_NAVIGATION) else if (renderer() && !renderer()->isWidget()) renderer()->enclosingLayer()->scrollRectToVisible(getRect()); @@ -1308,7 +1363,7 @@ RenderStyle* Element::computedStyle() ElementRareData* data = ensureRareData(); if (!data->m_computedStyle) - data->m_computedStyle = document()->styleSelector()->styleForElement(this, parent() ? parent()->computedStyle() : 0); + data->m_computedStyle = document()->styleForElementIgnoringPendingStylesheets(this); return data->m_computedStyle.get(); } @@ -1412,7 +1467,7 @@ bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec) KURL Element::getURLAttribute(const QualifiedName& name) const { -#ifndef NDEBUG +#if !ASSERT_DISABLED if (namedAttrMap) { if (Attribute* attribute = namedAttrMap->getAttributeItem(name)) ASSERT(isURLAttribute(attribute)); @@ -1421,4 +1476,9 @@ KURL Element::getURLAttribute(const QualifiedName& name) const return document()->completeURL(deprecatedParseURL(getAttribute(name))); } +const QualifiedName& Element::rareIDAttributeName() const +{ + return rareData()->m_idAttributeName; +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/Element.h b/src/3rdparty/webkit/WebCore/dom/Element.h index d27976a..a5c4e96 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.h +++ b/src/3rdparty/webkit/WebCore/dom/Element.h @@ -26,6 +26,9 @@ #define Element_h #include "ContainerNode.h" +#include "Document.h" +#include "HTMLNames.h" +#include "MappedAttributeEntry.h" #include "QualifiedName.h" #include "ScrollTypes.h" @@ -71,7 +74,7 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(select); DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); - // These 4 attribute event handler attributes are overrided by HTMLBodyElement + // These four attribute event handler attributes are overridden by HTMLBodyElement // and HTMLFrameSetElement to forward to the DOMWindow. DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(blur); DEFINE_VIRTUAL_ATTRIBUTE_EVENT_LISTENER(error); @@ -88,6 +91,12 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); DEFINE_ATTRIBUTE_EVENT_LISTENER(search); DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); +#if ENABLE(TOUCH_EVENTS) + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); +#endif const AtomicString& getIDAttribute() const; bool hasAttribute(const QualifiedName&) const; @@ -104,7 +113,9 @@ public: const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const; void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&); - void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&); + void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&, FragmentScriptingPermission = FragmentScriptingAllowed); + + const QualifiedName& idAttributeName() const; void scrollIntoView(bool alignToTop = true); void scrollIntoViewIfNeeded(bool centerIfNeeded = true); @@ -167,6 +178,9 @@ public: // convenience methods which ignore exceptions void setAttribute(const QualifiedName&, const AtomicString& value); void setBooleanAttribute(const QualifiedName& name, bool); + // Please don't use setCStringAttribute in performance-sensitive code; + // use a static AtomicString value instead to avoid the conversion overhead. + void setCStringAttribute(const QualifiedName&, const char* cStringValue); virtual NamedNodeMap* attributes() const; NamedNodeMap* attributes(bool readonly) const; @@ -175,7 +189,7 @@ public: virtual void attributeChanged(Attribute*, bool preserveDecls = false); // not part of the DOM - void setAttributeMap(PassRefPtr); + void setAttributeMap(PassRefPtr, FragmentScriptingPermission = FragmentScriptingAllowed); NamedNodeMap* attributeMap() const { return namedAttrMap.get(); } virtual void copyNonAttributeProperties(const Element* /*source*/) { } @@ -274,6 +288,7 @@ private: virtual bool childTypeAllowed(NodeType); virtual PassRefPtr createAttribute(const QualifiedName&, const AtomicString& value); + const QualifiedName& rareIDAttributeName() const; #ifndef NDEBUG virtual void formatForDebugger(char* buffer, unsigned length) const; @@ -286,10 +301,9 @@ private: virtual void updateStyleAttribute() const { } #if ENABLE(SVG) - virtual void updateAnimatedSVGAttribute(const String&) const { } + virtual void updateAnimatedSVGAttribute(const QualifiedName&) const { } #endif - void updateFocusAppearanceSoonAfterAttach(); void cancelFocusAppearanceUpdate(); virtual const AtomicString& virtualPrefix() const { return prefix(); } @@ -331,6 +345,41 @@ inline Element* Node::parentElement() const return parent && parent->isElementNode() ? static_cast(parent) : 0; } +inline const QualifiedName& Element::idAttributeName() const +{ + return hasRareData() ? rareIDAttributeName() : HTMLNames::idAttr; +} + +inline NamedNodeMap* Element::attributes(bool readonly) const +{ + if (!m_isStyleAttributeValid) + updateStyleAttribute(); + +#if ENABLE(SVG) + if (!m_areSVGAttributesValid) + updateAnimatedSVGAttribute(anyQName()); +#endif + + if (!readonly && !namedAttrMap) + createAttributeMap(); + return namedAttrMap.get(); +} + +inline void Element::updateId(const AtomicString& oldId, const AtomicString& newId) +{ + if (!inDocument()) + return; + + if (oldId == newId) + return; + + Document* doc = document(); + if (!oldId.isEmpty()) + doc->removeElementById(oldId, this); + if (!newId.isEmpty()) + doc->addElementById(newId, this); +} + } //namespace #endif diff --git a/src/3rdparty/webkit/WebCore/dom/Element.idl b/src/3rdparty/webkit/WebCore/dom/Element.idl index d90f819..e565bc0 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.idl +++ b/src/3rdparty/webkit/WebCore/dom/Element.idl @@ -22,11 +22,8 @@ module core { interface [ CustomMarkFunction, - GenerateConstructor, GenerateNativeConverter, - InlineGetOwnPropertySlot, - InterfaceUUID=FEFE9C21-E58C-4b5b-821A-61A514613763, - ImplementationUUID=12E5B08E-A680-4baf-9D1E-108AEF7ABBFB + InlineGetOwnPropertySlot ] Element : Node { // DOM Level 1 Core @@ -67,9 +64,7 @@ module core { [OldStyleObjC] boolean hasAttributeNS(in [ConvertNullToNullString] DOMString namespaceURI, in DOMString localName); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM readonly attribute CSSStyleDeclaration style; -#endif // Common extensions @@ -110,7 +105,6 @@ module core { NodeList querySelectorAll(in DOMString selectors) raises(DOMException); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM // WebKit extension, pending specification. boolean webkitMatchesSelector(in DOMString selectors) raises(DOMException); @@ -121,7 +115,6 @@ module core { readonly attribute Element previousElementSibling; readonly attribute Element nextElementSibling; readonly attribute unsigned long childElementCount; -#endif #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // CSSOM View Module API @@ -135,7 +128,6 @@ module core { #endif #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler DOM attributes attribute [DontEnum] EventListener onabort; attribute [DontEnum] EventListener onblur; @@ -203,6 +195,11 @@ module core { attribute [DontEnum] EventListener onreset; attribute [DontEnum] EventListener onsearch; attribute [DontEnum] EventListener onselectstart; +#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS + attribute [DontEnum] EventListener ontouchstart; + attribute [DontEnum] EventListener ontouchmove; + attribute [DontEnum] EventListener ontouchend; + attribute [DontEnum] EventListener ontouchcancel; #endif #endif }; diff --git a/src/3rdparty/webkit/WebCore/dom/ElementRareData.h b/src/3rdparty/webkit/WebCore/dom/ElementRareData.h index 94e0499..f23ad8e 100644 --- a/src/3rdparty/webkit/WebCore/dom/ElementRareData.h +++ b/src/3rdparty/webkit/WebCore/dom/ElementRareData.h @@ -27,6 +27,8 @@ namespace WebCore { +using namespace HTMLNames; + class ElementRareData : public NodeRareData { public: ElementRareData(); @@ -38,6 +40,7 @@ public: IntSize m_minimumSizeForResizing; RefPtr m_computedStyle; + QualifiedName m_idAttributeName; }; inline IntSize defaultMinimumSizeForResizing() @@ -47,6 +50,7 @@ inline IntSize defaultMinimumSizeForResizing() inline ElementRareData::ElementRareData() : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) + , m_idAttributeName(idAttr) { } diff --git a/src/3rdparty/webkit/WebCore/dom/Entity.idl b/src/3rdparty/webkit/WebCore/dom/Entity.idl index b154797..8dacbe9 100644 --- a/src/3rdparty/webkit/WebCore/dom/Entity.idl +++ b/src/3rdparty/webkit/WebCore/dom/Entity.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=5CDB5ACA-F3A7-47ea-B89C-F335E4342C55, - ImplementationUUID=DDD2A621-59FD-4bb2-9F95-7061C3FB9F06 - ] Entity : Node { + interface Entity : Node { readonly attribute [ConvertNullStringTo=Null] DOMString publicId; readonly attribute [ConvertNullStringTo=Null] DOMString systemId; readonly attribute [ConvertNullStringTo=Null] DOMString notationName; diff --git a/src/3rdparty/webkit/WebCore/dom/EntityReference.idl b/src/3rdparty/webkit/WebCore/dom/EntityReference.idl index 8a206e9..f652d9a 100644 --- a/src/3rdparty/webkit/WebCore/dom/EntityReference.idl +++ b/src/3rdparty/webkit/WebCore/dom/EntityReference.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=61BF4A03-19FB-4ac4-A624-5BF0893FDA65, - ImplementationUUID=486E1182-CF4F-450b-B411-A584CA42BBD0 - ] EntityReference : Node { + interface EntityReference : Node { }; } diff --git a/src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl b/src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl index 6125e1e..ad13193 100644 --- a/src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/ErrorEvent.idl @@ -32,7 +32,6 @@ module events { interface [ Conditional=WORKERS, - GenerateConstructor, NoStaticTables ] ErrorEvent : Event { diff --git a/src/3rdparty/webkit/WebCore/dom/Event.cpp b/src/3rdparty/webkit/WebCore/dom/Event.cpp index ba310ef..b6abb2a 100644 --- a/src/3rdparty/webkit/WebCore/dom/Event.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Event.cpp @@ -96,6 +96,11 @@ bool Event::isTextEvent() const return false; } +bool Event::isCompositionEvent() const +{ + return false; +} + bool Event::isDragEvent() const { return false; @@ -131,6 +136,11 @@ bool Event::isPageTransitionEvent() const return false; } +bool Event::isPopStateEvent() const +{ + return false; +} + bool Event::isProgressEvent() const { return false; @@ -176,7 +186,38 @@ bool Event::isErrorEvent() const return false; } #endif - + +#if ENABLE(TOUCH_EVENTS) +bool Event::isTouchEvent() const +{ + return false; +} +#endif + +bool Event::fromUserGesture() +{ + if (createdByDOM()) + return false; + + const AtomicString& type = this->type(); + return + // mouse events + type == eventNames().clickEvent || type == eventNames().mousedownEvent + || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent + // keyboard events + || type == eventNames().keydownEvent || type == eventNames().keypressEvent + || type == eventNames().keyupEvent +#if ENABLE(TOUCH_EVENTS) + // touch events + || type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent + || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent +#endif + // other accepted events + || type == eventNames().selectEvent || type == eventNames().changeEvent + || type == eventNames().focusEvent || type == eventNames().blurEvent + || type == eventNames().submitEvent; +} + bool Event::storesResultAsString() const { return false; diff --git a/src/3rdparty/webkit/WebCore/dom/Event.h b/src/3rdparty/webkit/WebCore/dom/Event.h index 74a2f10..0a05863 100644 --- a/src/3rdparty/webkit/WebCore/dom/Event.h +++ b/src/3rdparty/webkit/WebCore/dom/Event.h @@ -103,6 +103,7 @@ namespace WebCore { virtual bool isMutationEvent() const; virtual bool isKeyboardEvent() const; virtual bool isTextEvent() const; + virtual bool isCompositionEvent() const; virtual bool isDragEvent() const; // a subset of mouse events virtual bool isClipboardEvent() const; virtual bool isMessageEvent() const; @@ -110,6 +111,7 @@ namespace WebCore { virtual bool isBeforeTextInsertedEvent() const; virtual bool isOverflowEvent() const; virtual bool isPageTransitionEvent() const; + virtual bool isPopStateEvent() const; virtual bool isProgressEvent() const; virtual bool isXMLHttpRequestProgressEvent() const; virtual bool isWebKitAnimationEvent() const; @@ -124,6 +126,10 @@ namespace WebCore { #if ENABLE(WORKERS) virtual bool isErrorEvent() const; #endif +#if ENABLE(TOUCH_EVENTS) + virtual bool isTouchEvent() const; +#endif + bool fromUserGesture(); bool propagationStopped() const { return m_propagationStopped; } diff --git a/src/3rdparty/webkit/WebCore/dom/Event.idl b/src/3rdparty/webkit/WebCore/dom/Event.idl index 75b6b5f..d64d122 100644 --- a/src/3rdparty/webkit/WebCore/dom/Event.idl +++ b/src/3rdparty/webkit/WebCore/dom/Event.idl @@ -23,11 +23,8 @@ module events { // Introduced in DOM Level 2: interface [ CustomToJS, - GenerateConstructor, NoStaticTables, - Polymorphic, - InterfaceUUID=D17495FA-ACAD-4d27-9362-E19E057B189D, - ImplementationUUID=CFDCDDB2-5B3F-412d-BDA4-80B23C721549 + Polymorphic ] Event { // DOM PhaseType @@ -61,9 +58,8 @@ module events { readonly attribute unsigned short eventPhase; readonly attribute boolean bubbles; readonly attribute boolean cancelable; -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM readonly attribute DOMTimeStamp timeStamp; -#endif + void stopPropagation(); void preventDefault(); [OldStyleObjC] void initEvent(in DOMString eventTypeArg, diff --git a/src/3rdparty/webkit/WebCore/dom/EventException.idl b/src/3rdparty/webkit/WebCore/dom/EventException.idl index 3d82f85..1c8fac6 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventException.idl +++ b/src/3rdparty/webkit/WebCore/dom/EventException.idl @@ -30,7 +30,6 @@ module events { // Introduced in DOM Level 2: interface [ - GenerateConstructor, NoStaticTables ] EventException { diff --git a/src/3rdparty/webkit/WebCore/dom/EventListener.h b/src/3rdparty/webkit/WebCore/dom/EventListener.h index f834b31..8a35922 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventListener.h +++ b/src/3rdparty/webkit/WebCore/dom/EventListener.h @@ -51,8 +51,8 @@ namespace WebCore { virtual bool wasCreatedFromMarkup() const { return false; } #if USE(JSC) - virtual JSC::JSObject* jsFunction(ScriptExecutionContext*) const { return 0; } virtual void markJSFunction(JSC::MarkStack&) { } + virtual void invalidateJSFunction(JSC::JSObject*) { } #endif bool isAttribute() const { return virtualisAttribute(); } diff --git a/src/3rdparty/webkit/WebCore/dom/EventListener.idl b/src/3rdparty/webkit/WebCore/dom/EventListener.idl index 1edf52f..023777b 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventListener.idl +++ b/src/3rdparty/webkit/WebCore/dom/EventListener.idl @@ -25,7 +25,7 @@ module events { NoStaticTables, ObjCProtocol, PureInterface, - InterfaceUUID=B04F2AE3-71E2-4ebe-ABFE-EF4938354082, + OmitConstructor ] EventListener { void handleEvent(in Event evt); }; diff --git a/src/3rdparty/webkit/WebCore/dom/EventNames.cpp b/src/3rdparty/webkit/WebCore/dom/EventNames.cpp index 00191ab..900b8ef 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventNames.cpp +++ b/src/3rdparty/webkit/WebCore/dom/EventNames.cpp @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2005 Apple Computer, Inc. * * This library is free software; you can redistribute it and/or diff --git a/src/3rdparty/webkit/WebCore/dom/EventNames.h b/src/3rdparty/webkit/WebCore/dom/EventNames.h index 2c4cd32..b76776e 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventNames.h +++ b/src/3rdparty/webkit/WebCore/dom/EventNames.h @@ -41,6 +41,9 @@ namespace WebCore { macro(checking) \ macro(click) \ macro(close) \ + macro(compositionend) \ + macro(compositionstart) \ + macro(compositionupdate) \ macro(connect) \ macro(contextmenu) \ macro(copy) \ @@ -81,6 +84,7 @@ namespace WebCore { macro(pagehide) \ macro(pageshow) \ macro(paste) \ + macro(popstate) \ macro(readystatechange) \ macro(reset) \ macro(resize) \ @@ -127,6 +131,9 @@ namespace WebCore { macro(volumechange) \ macro(waiting) \ \ + macro(webkitbeginfullscreen) \ + macro(webkitendfullscreen) \ + \ macro(progress) \ macro(stalled) \ macro(suspend) \ @@ -139,14 +146,22 @@ namespace WebCore { \ macro(orientationchange) \ \ + macro(touchstart) \ + macro(touchmove) \ + macro(touchend) \ + macro(touchcancel) \ + \ + macro(success) \ + \ // end of DOM_EVENT_NAMES_FOR_EACH - class EventNames { + class EventNames : public Noncopyable { int dummy; // Needed to make initialization macro work. - - public: + // Private to prevent accidental call to EventNames() instead of eventNames() EventNames(); + friend class ThreadGlobalData; + public: #define DOM_EVENT_NAMES_DECLARE(name) AtomicString name##Event; DOM_EVENT_NAMES_FOR_EACH(DOM_EVENT_NAMES_DECLARE) #undef DOM_EVENT_NAMES_DECLARE diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp index 694e78a..65d751a 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.cpp @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) @@ -68,6 +66,11 @@ bool eventDispatchForbidden() } #endif // NDEBUG +EventTargetData::~EventTargetData() +{ + deleteAllValues(eventListenerMap); +} + EventTarget::~EventTarget() { } @@ -157,16 +160,19 @@ bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr result = d->eventListenerMap.add(eventType, EventListenerVector()); - EventListenerVector& entry = result.first->second; + pair result = d->eventListenerMap.add(eventType, 0); + EventListenerVector*& entry = result.first->second; + const bool isNewEntry = result.second; + if (isNewEntry) + entry = new EventListenerVector(); RegisteredEventListener registeredListener(listener, useCapture); - if (!result.second) { // pre-existing entry - if (entry.find(registeredListener) != notFound) // duplicate listener + if (!isNewEntry) { + if (entry->find(registeredListener) != notFound) // duplicate listener return false; } - entry.append(registeredListener); + entry->append(registeredListener); return true; } @@ -179,16 +185,18 @@ bool EventTarget::removeEventListener(const AtomicString& eventType, EventListen EventListenerMap::iterator result = d->eventListenerMap.find(eventType); if (result == d->eventListenerMap.end()) return false; - EventListenerVector& entry = result->second; + EventListenerVector* entry = result->second; RegisteredEventListener registeredListener(listener, useCapture); - size_t index = entry.find(registeredListener); + size_t index = entry->find(registeredListener); if (index == notFound) return false; - entry.remove(index); - if (!entry.size()) + entry->remove(index); + if (entry->isEmpty()) { + delete entry; d->eventListenerMap.remove(result); + } // Notify firing events planning to invoke the listener at 'index' that // they have one less listener to invoke. @@ -266,7 +274,7 @@ bool EventTarget::fireEventListeners(Event* event) EventListenerMap::iterator result = d->eventListenerMap.find(event->type()); if (result == d->eventListenerMap.end()) return false; - EventListenerVector& entry = result->second; + EventListenerVector& entry = *result->second; RefPtr protect = this; @@ -303,7 +311,7 @@ const EventListenerVector& EventTarget::getEventListeners(const AtomicString& ev EventListenerMap::iterator it = d->eventListenerMap.find(eventType); if (it == d->eventListenerMap.end()) return emptyVector; - return it->second; + return *it->second; } void EventTarget::removeAllEventListeners() @@ -311,6 +319,7 @@ void EventTarget::removeAllEventListeners() EventTargetData* d = eventTargetData(); if (!d) return; + deleteAllValues(d->eventListenerMap); d->eventListenerMap.clear(); // Notify firing events planning to invoke the listener at 'index' that diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.h b/src/3rdparty/webkit/WebCore/dom/EventTarget.h index 9a1975c..ece0f34 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.h +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.h @@ -36,6 +36,7 @@ #include "EventNames.h" #include "RegisteredEventListener.h" #include +#include namespace WebCore { @@ -76,9 +77,11 @@ namespace WebCore { typedef Vector FiringEventIteratorVector; typedef Vector EventListenerVector; - typedef HashMap EventListenerMap; + typedef HashMap EventListenerMap; + + struct EventTargetData : Noncopyable { + ~EventTargetData(); - struct EventTargetData { EventListenerMap eventListenerMap; FiringEventIteratorVector firingEventIterators; }; @@ -137,8 +140,8 @@ namespace WebCore { bool isFiringEventListeners(); #if USE(JSC) - void markEventListeners(JSC::MarkStack&); - void invalidateEventListeners(); + void markJSEventListeners(JSC::MarkStack&); + void invalidateJSEventListeners(JSC::JSObject*); #endif protected: @@ -182,7 +185,7 @@ namespace WebCore { #endif #if USE(JSC) - inline void EventTarget::markEventListeners(JSC::MarkStack& markStack) + inline void EventTarget::markJSEventListeners(JSC::MarkStack& markStack) { EventTargetData* d = eventTargetData(); if (!d) @@ -190,19 +193,24 @@ namespace WebCore { EventListenerMap::iterator end = d->eventListenerMap.end(); for (EventListenerMap::iterator it = d->eventListenerMap.begin(); it != end; ++it) { - EventListenerVector& entry = it->second; + EventListenerVector& entry = *it->second; for (size_t i = 0; i < entry.size(); ++i) entry[i].listener->markJSFunction(markStack); } } - inline void EventTarget::invalidateEventListeners() + inline void EventTarget::invalidateJSEventListeners(JSC::JSObject* wrapper) { EventTargetData* d = eventTargetData(); if (!d) return; - d->eventListenerMap.clear(); + EventListenerMap::iterator end = d->eventListenerMap.end(); + for (EventListenerMap::iterator it = d->eventListenerMap.begin(); it != end; ++it) { + EventListenerVector& entry = *it->second; + for (size_t i = 0; i < entry.size(); ++i) + entry[i].listener->invalidateJSFunction(wrapper); + } } #endif diff --git a/src/3rdparty/webkit/WebCore/dom/EventTarget.idl b/src/3rdparty/webkit/WebCore/dom/EventTarget.idl index 844dc32..0cdb6b3 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventTarget.idl +++ b/src/3rdparty/webkit/WebCore/dom/EventTarget.idl @@ -24,7 +24,7 @@ module events { interface [ ObjCProtocol, PureInterface, - InterfaceUUID=1D71C7EC-0BA0-4044-BDFD-56B3E8F5F9D4 + OmitConstructor ] EventTarget { [OldStyleObjC] void addEventListener(in DOMString type, in EventListener listener, diff --git a/src/3rdparty/webkit/WebCore/dom/InputElement.cpp b/src/3rdparty/webkit/WebCore/dom/InputElement.cpp index c29cb1c..13bb0b2 100644 --- a/src/3rdparty/webkit/WebCore/dom/InputElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/InputElement.cpp @@ -22,6 +22,7 @@ #include "InputElement.h" #include "BeforeTextInsertedEvent.h" +#include "Chrome.h" #include "ChromeClient.h" #include "Document.h" #include "Event.h" diff --git a/src/3rdparty/webkit/WebCore/dom/InputElement.h b/src/3rdparty/webkit/WebCore/dom/InputElement.h index e0e7110..a24b438 100644 --- a/src/3rdparty/webkit/WebCore/dom/InputElement.h +++ b/src/3rdparty/webkit/WebCore/dom/InputElement.h @@ -47,8 +47,10 @@ public: virtual bool searchEventsShouldBeDispatched() const = 0; virtual int size() const = 0; + virtual const String& suggestedValue() const = 0; virtual String value() const = 0; - virtual void setValue(const String&) = 0; + virtual void setValue(const String&, bool sendChangeEvent = false) = 0; + virtual void setValueForUser(const String&) = 0; virtual String sanitizeValue(const String&) const = 0; virtual void setValueFromRenderer(const String&) = 0; @@ -91,6 +93,9 @@ public: String value() const { return m_value; } void setValue(const String& value) { m_value = value; } + const String& suggestedValue() const { return m_suggestedValue; } + void setSuggestedValue(const String& value) { m_suggestedValue = value; } + int size() const { return m_size; } void setSize(int value) { m_size = value; } @@ -106,6 +111,7 @@ public: private: AtomicString m_name; String m_value; + String m_suggestedValue; int m_size; int m_maxLength; int m_cachedSelectionStart; diff --git a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp index 6bc825f..99c9220 100644 --- a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp +++ b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.cpp @@ -80,7 +80,6 @@ KeyboardEvent::KeyboardEvent(const AtomicString& eventType, bool canBubble, bool KeyboardEvent::~KeyboardEvent() { - delete m_keyEvent; } void KeyboardEvent::initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, diff --git a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h index 2b0a131..793ac41 100644 --- a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.h @@ -79,7 +79,7 @@ namespace WebCore { bool altGraphKey() const { return m_altGraphKey; } - const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent; } + const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } int keyCode() const; // key code for keydown and keyup, character for keypress int charCode() const; // character code for keypress, 0 for keydown and keyup @@ -99,7 +99,7 @@ namespace WebCore { const String& keyIdentifier, unsigned keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey); - PlatformKeyboardEvent* m_keyEvent; + OwnPtr m_keyEvent; String m_keyIdentifier; unsigned m_keyLocation; bool m_altGraphKey : 1; diff --git a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl index 58e5da7..1af3d02 100644 --- a/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/KeyboardEvent.idl @@ -21,9 +21,7 @@ module events { // Introduced in DOM Level 3: - interface [ - GenerateConstructor - ] KeyboardEvent : UIEvent { + interface KeyboardEvent : UIEvent { #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT // KeyLocationCode diff --git a/src/3rdparty/webkit/WebCore/dom/MappedAttributeEntry.h b/src/3rdparty/webkit/WebCore/dom/MappedAttributeEntry.h index 745ad23..ce2464e 100644 --- a/src/3rdparty/webkit/WebCore/dom/MappedAttributeEntry.h +++ b/src/3rdparty/webkit/WebCore/dom/MappedAttributeEntry.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) @@ -49,7 +47,9 @@ enum MappedAttributeEntry { // When adding new entries, make sure to keep eLastEntry at the end of the list. , eLastEntry }; - + +enum FragmentScriptingPermission { FragmentScriptingAllowed, FragmentScriptingNotAllowed }; + } #endif diff --git a/src/3rdparty/webkit/WebCore/dom/MessageChannel.idl b/src/3rdparty/webkit/WebCore/dom/MessageChannel.idl index 4e0892b..bae5b18 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageChannel.idl +++ b/src/3rdparty/webkit/WebCore/dom/MessageChannel.idl @@ -26,7 +26,7 @@ module events { - interface [CustomMarkFunction, NoStaticTables] MessageChannel { + interface [CustomConstructor, CustomMarkFunction, NoStaticTables] MessageChannel { readonly attribute MessagePort port1; readonly attribute MessagePort port2; diff --git a/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl b/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl index 7e497fc..2b47374 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl @@ -27,10 +27,9 @@ module events { interface [ - GenerateConstructor, NoStaticTables ] MessageEvent : Event { - readonly attribute SerializedScriptValue data; + readonly attribute [CachedAttribute] SerializedScriptValue data; readonly attribute DOMString origin; readonly attribute DOMString lastEventId; diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp index 9f6e649..1051920 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp @@ -41,6 +41,7 @@ namespace WebCore { MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext) : m_entangledChannel(0) , m_started(false) + , m_closed(false) , m_scriptExecutionContext(&scriptExecutionContext) { m_scriptExecutionContext->createdMessagePort(this); @@ -131,6 +132,7 @@ void MessagePort::start() void MessagePort::close() { + m_closed = true; if (!m_entangledChannel) return; m_entangledChannel->close(); @@ -200,7 +202,7 @@ PassOwnPtr MessagePort::disentanglePorts(const MessageP // Walk the incoming array - if there are any duplicate ports, or null ports or cloned ports, throw an error (per section 8.3.3 of the HTML5 spec). for (unsigned int i = 0; i < ports->size(); ++i) { MessagePort* port = (*ports)[i].get(); - if (!port || !port->isEntangled() || portSet.contains(port)) { + if (!port || port->isCloned() || portSet.contains(port)) { ec = INVALID_STATE_ERR; return 0; } diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.h b/src/3rdparty/webkit/WebCore/dom/MessagePort.h index 0ab0f50..ae1eb22 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.h +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.h @@ -103,7 +103,10 @@ namespace WebCore { // Returns null otherwise. // NOTE: This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership of the remote port (since it may live cross-process) - those platforms may always return null. MessagePort* locallyEntangledPort(); - bool isEntangled() { return m_entangledChannel; } + // A port starts out its life entangled, and remains entangled until it is closed or is cloned. + bool isEntangled() { return !m_closed && !isCloned(); } + // A port is cloned if its entangled channel has been removed and sent to a new owner via postMessage(). + bool isCloned() { return !m_entangledChannel; } private: MessagePort(ScriptExecutionContext&); @@ -116,6 +119,7 @@ namespace WebCore { OwnPtr m_entangledChannel; bool m_started; + bool m_closed; ScriptExecutionContext* m_scriptExecutionContext; EventTargetData m_eventTargetData; diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl index a9149ec..62cf63a 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl @@ -29,7 +29,6 @@ module events { interface [ CustomMarkFunction, EventTarget, - GenerateConstructor, NoStaticTables ] MessagePort { // We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one, diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h index 2321b1f..192cb92 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h +++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h @@ -62,7 +62,7 @@ namespace WebCore { // Creates a new wrapper for the passed channel. static PassOwnPtr create(PassRefPtr); - // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshalled to its new owning thread and is ready to receive messages). + // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshaled to its new owning thread and is ready to receive messages). // Returns false if the entanglement failed because the port was closed. bool entangleIfOpen(MessagePort*); @@ -78,7 +78,7 @@ namespace WebCore { // Returns true if the proxy currently contains messages for this port. bool hasPendingActivity(); - class EventData { + class EventData : public Noncopyable { public: static PassOwnPtr create(PassRefPtr, PassOwnPtr); diff --git a/src/3rdparty/webkit/WebCore/dom/MouseEvent.idl b/src/3rdparty/webkit/WebCore/dom/MouseEvent.idl index c509459..49385f1 100644 --- a/src/3rdparty/webkit/WebCore/dom/MouseEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/MouseEvent.idl @@ -20,9 +20,7 @@ module events { // Introduced in DOM Level 2: - interface [ - GenerateConstructor - ] MouseEvent : UIEvent { + interface MouseEvent : UIEvent { readonly attribute long screenX; readonly attribute long screenY; readonly attribute long clientX; diff --git a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp index 87815b1..15d4e43 100644 --- a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp @@ -151,7 +151,7 @@ void MouseRelatedEvent::receivedTarget() } // Adjust layerX/Y to be relative to the layer. - // FIXME: We're pretty sure this is the wrong defintion of "layer." + // FIXME: We're pretty sure this is the wrong definition of "layer." // Our RenderLayer is a more modern concept, and layerX/Y is some // other notion about groups of elements (left over from the Netscape 4 days?); // we should test and fix this. diff --git a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.h b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.h index 7649aa9..fc494d1 100644 --- a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2001 Peter Kelly (pmk@post.com) * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) diff --git a/src/3rdparty/webkit/WebCore/dom/MutationEvent.idl b/src/3rdparty/webkit/WebCore/dom/MutationEvent.idl index ea7a4dd..99a6aaa 100644 --- a/src/3rdparty/webkit/WebCore/dom/MutationEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/MutationEvent.idl @@ -20,9 +20,7 @@ module events { // Introduced in DOM Level 2: - interface [ - GenerateConstructor - ] MutationEvent : Event { + interface MutationEvent : Event { // attrChangeType const unsigned short MODIFICATION = 1; diff --git a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp index d4ec598..d8a6ba8 100644 --- a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp +++ b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.cpp @@ -130,7 +130,7 @@ PassRefPtr NamedNodeMap::setNamedItem(Node* arg, ExceptionCode& ec) return 0; } - if (a->name() == idAttr) + if (attr->isId()) m_element->updateId(old ? old->value() : nullAtom, a->value()); // ### slightly inefficient - resizes attribute array twice. @@ -155,9 +155,9 @@ PassRefPtr NamedNodeMap::removeNamedItem(const QualifiedName& name, Except return 0; } - RefPtr r = a->createAttrIfNeeded(m_element); + RefPtr r = a->createAttrIfNeeded(m_element); - if (name == idAttr) + if (r->isId()) m_element->updateId(a->value(), nullAtom); removeAttribute(name); @@ -172,26 +172,23 @@ PassRefPtr NamedNodeMap::item(unsigned index) const return m_attributes[index]->createAttrIfNeeded(m_element); } -// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller -// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not). -Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const +Attribute* NamedNodeMap::getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const { unsigned len = length(); - for (unsigned i = 0; i < len; ++i) { - if (!m_attributes[i]->name().hasPrefix() && m_attributes[i]->name().localName() == name) - return m_attributes[i].get(); - if (shouldIgnoreAttributeCase ? equalIgnoringCase(m_attributes[i]->name().toString(), name) : name == m_attributes[i]->name().toString()) - return m_attributes[i].get(); - } - return 0; -} -Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const -{ - unsigned len = length(); + // Continue to checking case-insensitively and/or full namespaced names if necessary: for (unsigned i = 0; i < len; ++i) { - if (m_attributes[i]->name().matches(name)) - return m_attributes[i].get(); + const QualifiedName& attrName = m_attributes[i]->name(); + if (!attrName.hasPrefix()) { + if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attrName.localName())) + return m_attributes[i].get(); + } else { + // FIXME: Would be faster to do this comparison without calling toString, which + // generates a temporary string by concatenation. But this branch is only reached + // if the attribute name has a prefix, which is rare in HTML. + if (equalPossiblyIgnoringCase(name, attrName.toString(), shouldIgnoreAttributeCase)) + return m_attributes[i].get(); + } } return 0; } @@ -220,8 +217,8 @@ void NamedNodeMap::setAttributes(const NamedNodeMap& other) // If assigning the map changes the id attribute, we need to call // updateId. - Attribute *oldId = getAttributeItem(idAttr); - Attribute *newId = other.getAttributeItem(idAttr); + Attribute* oldId = getAttributeItem(m_element->idAttributeName()); + Attribute* newId = other.getAttributeItem(m_element->idAttributeName()); if (oldId || newId) m_element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom); diff --git a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h index 759900b..d5136b5 100644 --- a/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h +++ b/src/3rdparty/webkit/WebCore/dom/NamedAttrMap.h @@ -103,12 +103,45 @@ private: void detachAttributesFromElement(); void detachFromElement(); Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const; + Attribute* getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const; Element* m_element; Vector > m_attributes; AtomicString m_id; }; +inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const +{ + unsigned len = length(); + for (unsigned i = 0; i < len; ++i) { + if (m_attributes[i]->name().matches(name)) + return m_attributes[i].get(); + } + return 0; +} + +// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller +// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not). +inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const +{ + unsigned len = length(); + bool doSlowCheck = shouldIgnoreAttributeCase; + + // Optimize for the case where the attribute exists and its name exactly matches. + for (unsigned i = 0; i < len; ++i) { + const QualifiedName& attrName = m_attributes[i]->name(); + if (!attrName.hasPrefix()) { + if (name == attrName.localName()) + return m_attributes[i].get(); + } else + doSlowCheck = true; + } + + if (doSlowCheck) + return getAttributeItemSlowCase(name, shouldIgnoreAttributeCase); + return 0; +} + } //namespace #undef id diff --git a/src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.h b/src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.h index 0afa278..a288685 100644 --- a/src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.h +++ b/src/3rdparty/webkit/WebCore/dom/NamedMappedAttrMap.h @@ -26,8 +26,8 @@ #ifndef NamedMappedAttrMap_h #define NamedMappedAttrMap_h -#include "ClassNames.h" #include "NamedNodeMap.h" +#include "SpaceSplitString.h" namespace WebCore { @@ -37,7 +37,7 @@ public: void clearClass() { m_classNames.clear(); } void setClass(const String&); - const ClassNames& classNames() const { return m_classNames; } + const SpaceSplitString& classNames() const { return m_classNames; } bool hasMappedAttributes() const { return m_mappedAttributeCount > 0; } void declRemoved() { m_mappedAttributeCount--; } @@ -53,7 +53,7 @@ private: int declCount() const; - ClassNames m_classNames; + SpaceSplitString m_classNames; int m_mappedAttributeCount; }; diff --git a/src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl b/src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl index 8166853..4d36577 100644 --- a/src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl +++ b/src/3rdparty/webkit/WebCore/dom/NamedNodeMap.idl @@ -22,11 +22,8 @@ module core { interface [ CustomMarkFunction, - GenerateConstructor, HasIndexGetter, - HasNameGetter, - InterfaceUUID=08DAF7A4-4C32-4709-B72F-622721FF0FB8, - ImplementationUUID=A1CC9F5B-092D-4a04-96D9-D7718A8D6242 + HasNameGetter ] NamedNodeMap { Node getNamedItem(in DOMString name); diff --git a/src/3rdparty/webkit/WebCore/dom/Node.cpp b/src/3rdparty/webkit/WebCore/dom/Node.cpp index 612bf18..b897177 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Node.cpp @@ -37,6 +37,7 @@ #include "CString.h" #include "ChildNodeList.h" #include "ClassNodeList.h" +#include "ContextMenuController.h" #include "DOMImplementation.h" #include "Document.h" #include "DynamicNodeList.h" @@ -53,6 +54,7 @@ #include "InspectorTimelineAgent.h" #include "KeyboardEvent.h" #include "Logging.h" +#include "MappedAttribute.h" #include "MouseEvent.h" #include "MutationEvent.h" #include "NameNodeList.h" @@ -143,7 +145,7 @@ void Node::dumpStatistics() size_t attrMaps = 0; size_t mappedAttrMaps = 0; - for (HashSet::const_iterator it = liveNodeSet.begin(); it != liveNodeSet.end(); ++it) { + for (HashSet::iterator it = liveNodeSet.begin(); it != liveNodeSet.end(); ++it) { Node* node = *it; if (node->hasRareData()) @@ -249,7 +251,7 @@ void Node::dumpStatistics() printf(" Number of XPathNS nodes: %zu\n", xpathNSNodes); printf("Element tag name distibution:\n"); - for (HashMap::const_iterator it = perTagCount.begin(); it != perTagCount.end(); ++it) + for (HashMap::iterator it = perTagCount.begin(); it != perTagCount.end(); ++it) printf(" Number of <%s> tags: %zu\n", it->first.utf8().data(), it->second); printf("Attribute Maps:\n"); @@ -311,25 +313,20 @@ Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2) // If the pseudoStyles have changed, we want any StyleChange that is not NoChange // because setStyle will do the right thing with anything else. - if (ch == NoChange && s1->hasPseudoStyle(BEFORE)) { - RenderStyle* ps2 = s2->getCachedPseudoStyle(BEFORE); - if (!ps2) - ch = NoInherit; - else { - RenderStyle* ps1 = s1->getCachedPseudoStyle(BEFORE); - ch = ps1 && *ps1 == *ps2 ? NoChange : NoInherit; - } - } - if (ch == NoChange && s1->hasPseudoStyle(AFTER)) { - RenderStyle* ps2 = s2->getCachedPseudoStyle(AFTER); - if (!ps2) - ch = NoInherit; - else { - RenderStyle* ps1 = s1->getCachedPseudoStyle(AFTER); - ch = ps2 && *ps1 == *ps2 ? NoChange : NoInherit; + if (ch == NoChange && s1->hasAnyPublicPseudoStyles()) { + for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; ch == NoChange && pseudoId < FIRST_INTERNAL_PSEUDOID; pseudoId = static_cast(pseudoId + 1)) { + if (s1->hasPseudoStyle(pseudoId)) { + RenderStyle* ps2 = s2->getCachedPseudoStyle(pseudoId); + if (!ps2) + ch = NoInherit; + else { + RenderStyle* ps1 = s1->getCachedPseudoStyle(pseudoId); + ch = ps1 && *ps1 == *ps2 ? NoChange : NoInherit; + } + } } } - + return ch; } @@ -410,7 +407,6 @@ Node::Node(Document* document, ConstructionType type) , m_hovered(false) , m_inActiveChain(false) , m_inDetach(false) - , m_inSubtreeMark(false) , m_hasRareData(false) , m_isElement(isElement(type)) , m_isContainer(isContainer(type)) @@ -421,6 +417,7 @@ Node::Node(Document* document, ConstructionType type) #if ENABLE(SVG) , m_areSVGAttributesValid(true) , m_synchronizingSVGAttributes(false) + , m_hasRareSVGData(false) #endif { if (m_document) @@ -519,6 +516,12 @@ void Node::setDocument(Document* document) updateDOMNodeDocument(this, m_document, document); #endif + if (hasRareData() && rareData()->nodeLists()) { + if (m_document) + m_document->removeNodeListCache(); + document->addNodeListCache(); + } + if (m_document) m_document->selfOnlyDeref(); @@ -674,7 +677,7 @@ void Node::normalize() // Merge text nodes. while (Node* nextSibling = node->nextSibling()) { - if (!nextSibling->isTextNode()) + if (nextSibling->nodeType() != TEXT_NODE) break; RefPtr nextText = static_cast(nextSibling); @@ -842,7 +845,7 @@ bool Node::isFocusable() const ASSERT(!renderer()->needsLayout()); else // If the node is in a display:none tree it might say it needs style recalc but - // the whole document is atually up to date. + // the whole document is actually up to date. ASSERT(!document()->childNeedsStyleRecalc()); // FIXME: Even if we are not visible, we might have a child that is visible. @@ -910,7 +913,10 @@ void Node::notifyLocalNodeListsAttributeChanged() if (!data->nodeLists()) return; - data->nodeLists()->invalidateCachesThatDependOnAttributes(); + if (!isAttributeNode()) + data->nodeLists()->invalidateCachesThatDependOnAttributes(); + else + data->nodeLists()->invalidateCaches(); if (data->nodeLists()->isEmpty()) { data->clearNodeLists(); @@ -1033,34 +1039,27 @@ Node* Node::traversePreviousSiblingPostOrder(const Node* stayWithin) const return 0; } -void Node::checkSetPrefix(const AtomicString&, ExceptionCode& ec) +void Node::checkSetPrefix(const AtomicString& prefix, ExceptionCode& ec) { // Perform error checking as required by spec for setting Node.prefix. Used by // Element::setPrefix() and Attr::setPrefix() // FIXME: Implement support for INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character. - // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. if (isReadOnlyNode()) { ec = NO_MODIFICATION_ALLOWED_ERR; return; } - // FIXME: Implement NAMESPACE_ERR: - Raised if the specified prefix is malformed - // We have to comment this out, since it's used for attributes and tag names, and we've only - // switched one over. - /* - // - if the namespaceURI of this node is null, - // - if the specified prefix is "xml" and the namespaceURI of this node is different from - // "http://www.w3.org/XML/1998/namespace", - // - if this node is an attribute and the specified prefix is "xmlns" and - // the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", - // - or if this node is an attribute and the qualifiedName of this node is "xmlns" [Namespaces]. - if ((namespacePart(id()) == noNamespace && id() > ID_LAST_TAG) || - (_prefix == "xml" && String(document()->namespaceURI(id())) != "http://www.w3.org/XML/1998/namespace")) { + // FIXME: Raise NAMESPACE_ERR if prefix is malformed per the Namespaces in XML specification. + + const AtomicString& nodeNamespaceURI = namespaceURI(); + if ((nodeNamespaceURI.isEmpty() && !prefix.isEmpty()) + || (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) { ec = NAMESPACE_ERR; return; - }*/ + } + // Attribute-specific checks are in Attr::setPrefix(). } bool Node::canReplaceChild(Node* newChild, Node*) @@ -1464,7 +1463,7 @@ bool Node::canStartSelection() const Node* Node::shadowAncestorNode() { #if ENABLE(SVG) - // SVG elements living in a shadow tree only occour when created them. + // SVG elements living in a shadow tree only occur when created them. // For these cases we do NOT want to return the shadowParentNode() here // but the actual shadow tree element - as main difference to the HTML forms // shadow tree concept. (This function _could_ be made virtual - opinions?) @@ -1653,7 +1652,6 @@ PassRefPtr Node::querySelector(const String& selectors, ExceptionCode& // FIXME: we could also optimize for the the [id="foo"] case if (strictParsing && inDocument() && querySelectorList.hasOneSelector() && querySelectorList.first()->m_match == CSSSelector::Id) { - ASSERT(querySelectorList.first()->attribute() == idAttr); Element* element = document()->getElementById(querySelectorList.first()->m_value); if (element && (isDocumentNode() || element->isDescendantOf(this)) && selectorChecker.checkSelector(querySelectorList.first(), element)) return element; @@ -1763,25 +1761,24 @@ bool Node::isEqualNode(Node *other) const return true; } -bool Node::isDefaultNamespace(const AtomicString &namespaceURI) const +bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const { - // Implemented according to - // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms.html#isDefaultNamespaceAlgo - + const AtomicString& namespaceURI = namespaceURIMaybeEmpty.isEmpty() ? nullAtom : namespaceURIMaybeEmpty; + switch (nodeType()) { case ELEMENT_NODE: { - const Element *elem = static_cast(this); + const Element* elem = static_cast(this); if (elem->prefix().isNull()) return elem->namespaceURI() == namespaceURI; if (elem->hasAttributes()) { - NamedNodeMap *attrs = elem->attributes(); + NamedNodeMap* attrs = elem->attributes(); for (unsigned i = 0; i < attrs->length(); i++) { - Attribute *attr = attrs->attributeItem(i); + Attribute* attr = attrs->attributeItem(i); - if (attr->localName() == "xmlns") + if (attr->localName() == xmlnsAtom) return attr->value() == namespaceURI; } } @@ -1801,7 +1798,7 @@ bool Node::isDefaultNamespace(const AtomicString &namespaceURI) const case DOCUMENT_FRAGMENT_NODE: return false; case ATTRIBUTE_NODE: { - const Attr *attr = static_cast(this); + const Attr* attr = static_cast(this); if (attr->ownerElement()) return attr->ownerElement()->isDefaultNamespace(namespaceURI); return false; @@ -1867,12 +1864,12 @@ String Node::lookupNamespaceURI(const String &prefix) const for (unsigned i = 0; i < attrs->length(); i++) { Attribute *attr = attrs->attributeItem(i); - if (attr->prefix() == "xmlns" && attr->localName() == prefix) { + if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) { if (!attr->value().isEmpty()) return attr->value(); return String(); - } else if (attr->localName() == "xmlns" && prefix.isNull()) { + } else if (attr->localName() == xmlnsAtom && prefix.isNull()) { if (!attr->value().isEmpty()) return attr->value(); @@ -1922,7 +1919,7 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem for (unsigned i = 0; i < attrs->length(); i++) { Attribute *attr = attrs->attributeItem(i); - if (attr->prefix() == "xmlns" && + if (attr->prefix() == xmlnsAtom && attr->value() == _namespaceURI && originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI) return attr->localName(); @@ -2289,6 +2286,19 @@ ContainerNode* Node::eventParentNode() return static_cast(parent); } +Node* Node::enclosingLinkEventParentOrSelf() +{ + for (Node* node = this; node; node = node->eventParentNode()) { + // For imagemaps, the enclosing link node is the associated area element not the image itself. + // So we don't let images be the enclosingLinkNode, even though isLink sometimes returns true + // for them. + if (node->isLink() && !node->hasTagName(imgTag)) + return node; + } + + return 0; +} + // -------- ScriptExecutionContext* Node::scriptExecutionContext() const @@ -2318,49 +2328,159 @@ void Node::didMoveToNewOwnerDocument() setDidMoveToNewOwnerDocumentWasCalled(true); } -static inline void updateSVGElementInstancesAfterEventListenerChange(Node* referenceNode) +#if ENABLE(SVG) +static inline HashSet instancesForSVGElement(Node* node) +{ + HashSet instances; + + ASSERT(node); + if (!node->isSVGElement() || node->shadowTreeRootNode()) + return HashSet(); + + SVGElement* element = static_cast(node); + if (!element->isStyled()) + return HashSet(); + + SVGStyledElement* styledElement = static_cast(element); + ASSERT(!styledElement->instanceUpdatesBlocked()); + + return styledElement->instancesForElement(); +} +#endif + +static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eventType, PassRefPtr listener, bool useCapture) +{ + if (!targetNode->EventTarget::addEventListener(eventType, listener, useCapture)) + return false; + + if (Document* document = targetNode->document()) + document->addListenerTypeIfNeeded(eventType); + + return true; +} + +bool Node::addEventListener(const AtomicString& eventType, PassRefPtr listener, bool useCapture) { #if !ENABLE(SVG) - UNUSED_PARAM(referenceNode); + return tryAddEventListener(this, eventType, listener, useCapture); #else - ASSERT(referenceNode); - if (!referenceNode->isSVGElement()) - return; + if (!isSVGElement()) + return tryAddEventListener(this, eventType, listener, useCapture); - // Elements living inside a shadow tree, never cause any updates! - if (referenceNode->shadowTreeRootNode()) - return; + HashSet instances = instancesForSVGElement(this); + if (instances.isEmpty()) + return tryAddEventListener(this, eventType, listener, useCapture); - // We're possibly (a child of) an element that is referenced by a client - // If an event listeners changes on a referenced element, update all instances. - for (Node* node = referenceNode; node; node = node->parentNode()) { - if (!node->hasID() || !node->isSVGElement()) - continue; + RefPtr listenerForRegularTree = listener; + RefPtr listenerForShadowTree = listenerForRegularTree; + + // Add event listener to regular DOM element + if (!tryAddEventListener(this, eventType, listenerForRegularTree.release(), useCapture)) + return false; - SVGElementInstance::invalidateAllInstancesOfElement(static_cast(node)); - break; + // Add event listener to all shadow tree DOM element instances + const HashSet::const_iterator end = instances.end(); + for (HashSet::const_iterator it = instances.begin(); it != end; ++it) { + ASSERT((*it)->shadowTreeElement()); + ASSERT((*it)->correspondingElement() == this); + + RefPtr listenerForCurrentShadowTreeElement = listenerForShadowTree; + bool result = tryAddEventListener((*it)->shadowTreeElement(), eventType, listenerForCurrentShadowTreeElement.release(), useCapture); + ASSERT_UNUSED(result, result); } + + return true; #endif } -bool Node::addEventListener(const AtomicString& eventType, PassRefPtr listener, bool useCapture) +static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& eventType, EventListener* listener, bool useCapture) { - if (!EventTarget::addEventListener(eventType, listener, useCapture)) + if (!targetNode->EventTarget::removeEventListener(eventType, listener, useCapture)) return false; - if (Document* document = this->document()) - document->addListenerTypeIfNeeded(eventType); - updateSVGElementInstancesAfterEventListenerChange(this); + // FIXME: Notify Document that the listener has vanished. We need to keep track of a number of + // listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861 + return true; } bool Node::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) { - if (!EventTarget::removeEventListener(eventType, listener, useCapture)) +#if !ENABLE(SVG) + return tryRemoveEventListener(this, eventType, listener, useCapture); +#else + if (!isSVGElement()) + return tryRemoveEventListener(this, eventType, listener, useCapture); + + HashSet instances = instancesForSVGElement(this); + if (instances.isEmpty()) + return tryRemoveEventListener(this, eventType, listener, useCapture); + + // EventTarget::removeEventListener creates a PassRefPtr around the given EventListener + // object when creating a temporary RegisteredEventListener object used to look up the + // event listener in a cache. If we want to be able to call removeEventListener() multiple + // times on different nodes, we have to delay its immediate destruction, which would happen + // after the first call below. + RefPtr protector(listener); + + // Remove event listener from regular DOM element + if (!tryRemoveEventListener(this, eventType, listener, useCapture)) return false; - updateSVGElementInstancesAfterEventListenerChange(this); + // Remove event listener from all shadow tree DOM element instances + const HashSet::const_iterator end = instances.end(); + for (HashSet::const_iterator it = instances.begin(); it != end; ++it) { + ASSERT((*it)->correspondingElement() == this); + + SVGElement* shadowTreeElement = (*it)->shadowTreeElement(); + ASSERT(shadowTreeElement); + + if (tryRemoveEventListener(shadowTreeElement, eventType, listener, useCapture)) + continue; + + // This case can only be hit for event listeners created from markup + ASSERT(listener->wasCreatedFromMarkup()); + + // If the event listener 'listener' has been created from markup and has been fired before + // then JSLazyEventListener::parseCode() has been called and m_jsFunction of that listener + // has been created (read: it's not 0 anymore). During shadow tree creation, the event + // listener DOM attribute has been cloned, and another event listener has been setup in + // the shadow tree. If that event listener has not been used yet, m_jsFunction is still 0, + // and tryRemoveEventListener() above will fail. Work around that very seldom problem. + EventTargetData* data = shadowTreeElement->eventTargetData(); + ASSERT(data); + + EventListenerMap::iterator result = data->eventListenerMap.find(eventType); + ASSERT(result != data->eventListenerMap.end()); + + EventListenerVector* entry = result->second; + ASSERT(entry); + + unsigned int index = 0; + bool foundListener = false; + + EventListenerVector::iterator end = entry->end(); + for (EventListenerVector::iterator it = entry->begin(); it != end; ++it) { + if (!(*it).listener->wasCreatedFromMarkup()) { + ++index; + continue; + } + + foundListener = true; + entry->remove(index); + break; + } + + ASSERT(foundListener); + + if (entry->isEmpty()) { + delete entry; + data->eventListenerMap.remove(result); + } + } + return true; +#endif } EventTargetData* Node::eventTargetData() @@ -2447,6 +2567,23 @@ bool Node::dispatchEvent(PassRefPtr prpEvent) return dispatchGenericEvent(event.release()); } +static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window, Node* node, Vector >& ancestors) +{ + if (window && window->hasEventListeners(eventType)) + return true; + + if (node->hasEventListeners(eventType)) + return true; + + for (size_t i = 0; i < ancestors.size(); i++) { + ContainerNode* ancestor = ancestors[i].get(); + if (ancestor->hasEventListeners(eventType)) + return true; + } + + return false; +} + bool Node::dispatchGenericEvent(PassRefPtr prpEvent) { RefPtr event(prpEvent); @@ -2455,12 +2592,6 @@ bool Node::dispatchGenericEvent(PassRefPtr prpEvent) ASSERT(event->target()); ASSERT(!event->type().isNull()); // JavaScript code can create an event with an empty name, but not null. -#if ENABLE(INSPECTOR) - InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent(); - if (timelineAgent) - timelineAgent->willDispatchDOMEvent(*event); -#endif - // Make a vector of ancestors to send the event to. // If the node is not in a document just send the event to it. // Be sure to ref all of nodes since event handlers could result in the last reference going away. @@ -2478,6 +2609,13 @@ bool Node::dispatchGenericEvent(PassRefPtr prpEvent) targetForWindowEvents = static_cast(topLevelContainer)->domWindow(); } +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = document()->inspectorTimelineAgent(); + bool timelineAgentIsActive = timelineAgent && eventHasListeners(event->type(), targetForWindowEvents, this, ancestors); + if (timelineAgentIsActive) + timelineAgent->willDispatchEvent(*event); +#endif + // Give the target node a chance to do some work before DOM event handlers get a crack. void* data = preDispatchEventHandler(event.get()); if (event->propagationStopped()) @@ -2559,8 +2697,8 @@ doneDispatching: doneWithDefault: #if ENABLE(INSPECTOR) - if (timelineAgent) - timelineAgent->didDispatchDOMEvent(); + if (timelineAgentIsActive && (timelineAgent = document()->inspectorTimelineAgent())) + timelineAgent->didDispatchEvent(); #endif Document::updateStyleForAllDocuments(); @@ -2811,6 +2949,23 @@ void Node::defaultEventHandler(Event* event) if (event->isTextEvent()) if (Frame* frame = document()->frame()) frame->eventHandler()->defaultTextInputEventHandler(static_cast(event)); +#if ENABLE(PAN_SCROLLING) + } else if (eventType == eventNames().mousedownEvent) { + MouseEvent* mouseEvent = static_cast(event); + if (mouseEvent->button() == MiddleButton) { + if (enclosingLinkEventParentOrSelf()) + return; + + RenderObject* renderer = this->renderer(); + while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) + renderer = renderer->parent(); + + if (renderer) { + if (Frame* frame = document()->frame()) + frame->eventHandler()->startPanScrolling(renderer); + } + } +#endif } } diff --git a/src/3rdparty/webkit/WebCore/dom/Node.h b/src/3rdparty/webkit/WebCore/dom/Node.h index 35be6d3..1eac305 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.h +++ b/src/3rdparty/webkit/WebCore/dom/Node.h @@ -27,14 +27,9 @@ #include "EventTarget.h" #include "KURLHash.h" -#include "PlatformString.h" -#include "RegisteredEventListener.h" +#include "ScriptWrappable.h" #include "TreeShared.h" -#include "FloatPoint.h" -#include #include -#include -#include namespace WebCore { @@ -46,6 +41,7 @@ class DynamicNodeList; class Element; class Event; class EventListener; +class FloatPoint; class Frame; class IntRect; class KeyboardEvent; @@ -81,7 +77,7 @@ const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // this class implements nodes, which can have a parent but no children: -class Node : public EventTarget, public TreeShared { +class Node : public EventTarget, public TreeShared, public ScriptWrappable { friend class Document; public: enum NodeType { @@ -206,6 +202,9 @@ public: // The node's parent for the purpose of event capture and bubbling. virtual ContainerNode* eventParentNode(); + // Returns the enclosing event parent node (or self) that, when clicked, would trigger a navigation. + Node* enclosingLinkEventParentOrSelf(); + // Node ancestors when concerned about event flow void eventAncestors(Vector > &ancestors); @@ -252,7 +251,7 @@ public: virtual ContainerNode* addChild(PassRefPtr); // Called by the parser when this element's close tag is reached, - // signalling that all child tags have been parsed and added. + // signaling that all child tags have been parsed and added. // This is needed for and elements, which can't lay themselves out // until they know all of their nested s. [Radar 3603191, 4040848]. // Also used for script elements and some SVG elements for similar purposes, @@ -289,9 +288,6 @@ public: void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange); void setIsLink(bool b = true) { m_isLink = b; } - bool inSubtreeMark() const { return m_inSubtreeMark; } - void setInSubtreeMark(bool b = true) { m_inSubtreeMark = b; } - void lazyAttach(); virtual bool canLazyAttach(); @@ -575,7 +571,10 @@ protected: void setTabIndexExplicitly(short); bool hasRareData() const { return m_hasRareData; } - +#if ENABLE(SVG) + bool hasRareSVGData() const { return m_hasRareSVGData; } +#endif + NodeRareData* rareData() const; NodeRareData* ensureRareData(); @@ -623,7 +622,6 @@ private: bool m_hovered : 1; bool m_inActiveChain : 1; bool m_inDetach : 1; - bool m_inSubtreeMark : 1; bool m_hasRareData : 1; const bool m_isElement : 1; const bool m_isContainer : 1; @@ -640,9 +638,10 @@ protected: #if ENABLE(SVG) mutable bool m_areSVGAttributesValid : 1; // Element mutable bool m_synchronizingSVGAttributes : 1; // SVGElement + bool m_hasRareSVGData : 1; // SVGElement #endif - // 11 bits remaining + // 10 bits remaining }; // Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs() diff --git a/src/3rdparty/webkit/WebCore/dom/Node.idl b/src/3rdparty/webkit/WebCore/dom/Node.idl index 45ea132..c6cd4b9 100644 --- a/src/3rdparty/webkit/WebCore/dom/Node.idl +++ b/src/3rdparty/webkit/WebCore/dom/Node.idl @@ -25,12 +25,9 @@ module core { CustomPushEventHandlerScope, CustomToJS, EventTarget, - GenerateConstructor, GenerateNativeConverter, InlineGetOwnPropertySlot, - Polymorphic, - InterfaceUUID=84BA0D7A-7E3E-4a7b-B6FB-7653E8FB54ED, - ImplementationUUID=81B47FDB-94B0-40fd-8E0C-FB2A6E53CC04 + Polymorphic ] Node #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C : Object, EventTarget @@ -135,7 +132,6 @@ module core { #endif /* defined(LANGUAGE_OBJECTIVE_C) */ #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM [Custom] void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture); @@ -145,7 +141,6 @@ module core { boolean dispatchEvent(in Event event) raises(EventException); #endif -#endif }; } diff --git a/src/3rdparty/webkit/WebCore/dom/NodeFilter.h b/src/3rdparty/webkit/WebCore/dom/NodeFilter.h index 5a542ad..53b32e1 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeFilter.h +++ b/src/3rdparty/webkit/WebCore/dom/NodeFilter.h @@ -73,8 +73,9 @@ namespace WebCore { short acceptNode(ScriptState*, Node*) const; void markAggregate(JSC::MarkStack& markStack) { m_condition->markAggregate(markStack); }; - // For non-JS bindings. Silently ignores the JavaScript exception if any. - short acceptNode(Node* node) const { return acceptNode(scriptStateFromNode(node), node); } + // Do not call these functions. They are just scaffolding to support the Objective-C bindings. + // They operate in the main thread normal world, and they swallow JS exceptions. + short acceptNode(Node* node) const { return acceptNode(scriptStateFromNode(mainThreadNormalWorld(), node), node); } private: NodeFilter(PassRefPtr condition) : m_condition(condition) { } diff --git a/src/3rdparty/webkit/WebCore/dom/NodeFilter.idl b/src/3rdparty/webkit/WebCore/dom/NodeFilter.idl index 3cc5e86..d721f80 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeFilter.idl +++ b/src/3rdparty/webkit/WebCore/dom/NodeFilter.idl @@ -21,7 +21,7 @@ module traversal { // Introduced in DOM Level 2: - interface [GenerateConstructor, CustomMarkFunction, CustomNativeConverter, ObjCProtocol] NodeFilter { + interface [CustomMarkFunction, CustomNativeConverter, ObjCProtocol] NodeFilter { // Constants returned by acceptNode const short FILTER_ACCEPT = 1; diff --git a/src/3rdparty/webkit/WebCore/dom/NodeIterator.h b/src/3rdparty/webkit/WebCore/dom/NodeIterator.h index 2a992d3..3eec49a 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeIterator.h +++ b/src/3rdparty/webkit/WebCore/dom/NodeIterator.h @@ -52,9 +52,10 @@ namespace WebCore { // This function is called before any node is removed from the document tree. void nodeWillBeRemoved(Node*); - // For non-JS bindings. Silently ignores the JavaScript exception if any. - PassRefPtr nextNode(ExceptionCode& ec) { return nextNode(scriptStateFromNode(referenceNode()), ec); } - PassRefPtr previousNode(ExceptionCode& ec) { return previousNode(scriptStateFromNode(referenceNode()), ec); } + // Do not call these functions. They are just scaffolding to support the Objective-C bindings. + // They operate in the main thread normal world, and they swallow JS exceptions. + PassRefPtr nextNode(ExceptionCode& ec) { return nextNode(scriptStateFromNode(mainThreadNormalWorld(), referenceNode()), ec); } + PassRefPtr previousNode(ExceptionCode& ec) { return previousNode(scriptStateFromNode(mainThreadNormalWorld(), referenceNode()), ec); } private: NodeIterator(PassRefPtr, unsigned whatToShow, PassRefPtr, bool expandEntityReferences); diff --git a/src/3rdparty/webkit/WebCore/dom/NodeIterator.idl b/src/3rdparty/webkit/WebCore/dom/NodeIterator.idl index 8805d07..e1818a1 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeIterator.idl +++ b/src/3rdparty/webkit/WebCore/dom/NodeIterator.idl @@ -22,8 +22,7 @@ module traversal { // Introduced in DOM Level 2: interface [ - CustomMarkFunction, - GenerateConstructor + CustomMarkFunction ] NodeIterator { readonly attribute Node root; readonly attribute unsigned long whatToShow; diff --git a/src/3rdparty/webkit/WebCore/dom/NodeList.idl b/src/3rdparty/webkit/WebCore/dom/NodeList.idl index cf21cc7..edb2dc7 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeList.idl +++ b/src/3rdparty/webkit/WebCore/dom/NodeList.idl @@ -21,12 +21,9 @@ module core { interface [ - GenerateConstructor, HasIndexGetter, HasNameGetter, - CustomCall, - InterfaceUUID=F9A9F6A9-385C-414e-A6F6-E2E0CF574130, - ImplementationUUID=BBB49E8B-DB1D-4c4a-B970-D300FB4609FA + CustomCall ] NodeList { Node item(in [IsIndex] unsigned long index); diff --git a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h index 8b9e1bf..6e9d0e4 100644 --- a/src/3rdparty/webkit/WebCore/dom/NodeRareData.h +++ b/src/3rdparty/webkit/WebCore/dom/NodeRareData.h @@ -33,7 +33,7 @@ namespace WebCore { -struct NodeListsNodeData { +struct NodeListsNodeData : Noncopyable { typedef HashSet NodeListSet; NodeListSet m_listsWithCaches; @@ -62,7 +62,7 @@ private: } }; -class NodeRareData { +class NodeRareData : public Noncopyable { public: NodeRareData() : m_tabIndex(0) diff --git a/src/3rdparty/webkit/WebCore/dom/Notation.idl b/src/3rdparty/webkit/WebCore/dom/Notation.idl index a16fde6..96351d2 100644 --- a/src/3rdparty/webkit/WebCore/dom/Notation.idl +++ b/src/3rdparty/webkit/WebCore/dom/Notation.idl @@ -19,11 +19,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=6580C703-F5FF-40a7-ACF2-AB80EBC83CA1, - ImplementationUUID=A52869F7-A3CE-4f4c-8C27-E369C4ED9FF9 - ] Notation : Node { + interface Notation : Node { readonly attribute [ConvertNullStringTo=Null] DOMString publicId; readonly attribute [ConvertNullStringTo=Null] DOMString systemId; }; diff --git a/src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl b/src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl index 4a1bed5..0b4f5c6 100644 --- a/src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/OverflowEvent.idl @@ -24,9 +24,7 @@ */ module events { - interface [ - GenerateConstructor - ] OverflowEvent : Event { + interface OverflowEvent : Event { const unsigned short HORIZONTAL = 0; const unsigned short VERTICAL = 1; const unsigned short BOTH = 2; diff --git a/src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.idl b/src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.idl index a09f94b..8d70f67 100644 --- a/src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/PageTransitionEvent.idl @@ -25,9 +25,7 @@ module events { - interface [ - GenerateConstructor - ] PageTransitionEvent : Event { + interface PageTransitionEvent : Event { readonly attribute boolean persisted; diff --git a/src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp new file mode 100644 index 0000000..b9ad862 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "config.h" +#include "PopStateEvent.h" + +#include "EventNames.h" + +namespace WebCore { + +PopStateEvent::PopStateEvent(PassRefPtr stateObject) + : Event(eventNames().popstateEvent, false, true) + , m_stateObject(stateObject) +{ +} + +void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr stateObject) +{ + if (dispatched()) + return; + + initEvent(type, canBubble, cancelable); + + m_stateObject = stateObject; +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/PopStateEvent.h b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.h new file mode 100644 index 0000000..2fb8d06 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef PopStateEvent_h +#define PopStateEvent_h + +#include "Event.h" +#include "SerializedScriptValue.h" + +namespace WebCore { + +class SerializedScriptValue; + +class PopStateEvent : public Event { +public: + static PassRefPtr create(PassRefPtr stateObject) + { + return adoptRef(new PopStateEvent(stateObject)); + } + + void initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr); + bool isPopStateEvent() const { return true; } + + SerializedScriptValue* state() const { return m_stateObject.get(); } + +private: + PopStateEvent(PassRefPtr); + + RefPtr m_stateObject; +}; + +} // namespace WebCore + +#endif // PopStateEvent_h diff --git a/src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl new file mode 100644 index 0000000..f9c9a71 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/PopStateEvent.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +module events { + + interface PopStateEvent : Event { + [Custom] void initPopStateEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in any stateArg); + + readonly attribute [V8CustomGetter] any state; + }; + +} diff --git a/src/3rdparty/webkit/WebCore/dom/Position.cpp b/src/3rdparty/webkit/WebCore/dom/Position.cpp index 060b28c..c0f6fa3 100644 --- a/src/3rdparty/webkit/WebCore/dom/Position.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Position.cpp @@ -307,6 +307,27 @@ bool Position::atLastEditingPositionForNode() const return m_offset >= lastOffsetForEditing(node()); } +// A position is considered at editing boundary if one of the following is true: +// 1. It is the first position in the node and the next visually equivalent position +// is non editable. +// 2. It is the last position in the node and the previous visually equivalent position +// is non editable. +// 3. It is an editable position and both the next and previous visually equivalent +// positions are both non editable. +bool Position::atEditingBoundary() const +{ + Position nextPosition = downstream(CanCrossEditingBoundary); + if (atFirstEditingPositionForNode() && nextPosition.isNotNull() && !nextPosition.node()->isContentEditable()) + return true; + + Position prevPosition = upstream(CanCrossEditingBoundary); + if (atLastEditingPositionForNode() && prevPosition.isNotNull() && !prevPosition.node()->isContentEditable()) + return true; + + return nextPosition.isNotNull() && !nextPosition.node()->isContentEditable() + && prevPosition.isNotNull() && !prevPosition.node()->isContentEditable(); +} + bool Position::atStartOfTree() const { if (isNull()) @@ -448,7 +469,7 @@ static bool isStreamer(const PositionIterator& pos) // and downstream() will return the right one. // Also, upstream() will return [boundary, 0] for any of the positions from [boundary, 0] to the first candidate // in boundary, where endsOfNodeAreVisuallyDistinctPositions(boundary) is true. -Position Position::upstream() const +Position Position::upstream(EditingBoundaryCrossingRule rule) const { Node* startNode = node(); if (!startNode) @@ -460,6 +481,7 @@ Position Position::upstream() const PositionIterator currentPos = lastVisible; bool startEditable = startNode->isContentEditable(); Node* lastNode = startNode; + bool boundaryCrossed = false; for (; !currentPos.atStart(); currentPos.decrement()) { Node* currentNode = currentPos.node(); @@ -468,12 +490,15 @@ Position Position::upstream() const if (currentNode != lastNode) { // Don't change editability. bool currentEditable = currentNode->isContentEditable(); - if (startEditable != currentEditable) - break; + if (startEditable != currentEditable) { + if (rule == CannotCrossEditingBoundary) + break; + boundaryCrossed = true; + } lastNode = currentNode; } - // If we've moved to a position that is visually disinct, return the last saved position. There + // If we've moved to a position that is visually distinct, return the last saved position. There // is code below that terminates early if we're *about* to move to a visually distinct position. if (endsOfNodeAreVisuallyDistinctPositions(currentNode) && currentNode != boundary) return lastVisible; @@ -483,6 +508,11 @@ Position Position::upstream() const if (!renderer || renderer->style()->visibility() != VISIBLE) continue; + if (rule == CanCrossEditingBoundary && boundaryCrossed) { + lastVisible = currentPos; + break; + } + // track last visible streamer position if (isStreamer(currentPos)) lastVisible = currentPos; @@ -560,7 +590,7 @@ Position Position::upstream() const // and upstream() will return the left one. // Also, downstream() will return the last position in the last atomic node in boundary for all of the positions // in boundary after the last candidate, where endsOfNodeAreVisuallyDistinctPositions(boundary). -Position Position::downstream() const +Position Position::downstream(EditingBoundaryCrossingRule rule) const { Node* startNode = node(); if (!startNode) @@ -572,6 +602,7 @@ Position Position::downstream() const PositionIterator currentPos = lastVisible; bool startEditable = startNode->isContentEditable(); Node* lastNode = startNode; + bool boundaryCrossed = false; for (; !currentPos.atEnd(); currentPos.increment()) { Node* currentNode = currentPos.node(); @@ -580,8 +611,12 @@ Position Position::downstream() const if (currentNode != lastNode) { // Don't change editability. bool currentEditable = currentNode->isContentEditable(); - if (startEditable != currentEditable) - break; + if (startEditable != currentEditable) { + if (rule == CannotCrossEditingBoundary) + break; + boundaryCrossed = true; + } + lastNode = currentNode; } @@ -604,6 +639,11 @@ Position Position::downstream() const if (!renderer || renderer->style()->visibility() != VISIBLE) continue; + if (rule == CanCrossEditingBoundary && boundaryCrossed) { + lastVisible = currentPos; + break; + } + // track last visible streamer position if (isStreamer(currentPos)) lastVisible = currentPos; @@ -704,10 +744,18 @@ bool Position::isCandidate() const if (isTableElement(node()) || editingIgnoresContent(node())) return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(node()->parent()); - if (!node()->hasTagName(htmlTag) && renderer->isBlockFlow() && !hasRenderedNonAnonymousDescendantsWithHeight(renderer) && - (toRenderBox(renderer)->height() || node()->hasTagName(bodyTag))) - return atFirstEditingPositionForNode() && !nodeIsUserSelectNone(node()); - + if (m_anchorNode->hasTagName(htmlTag)) + return false; + + if (renderer->isBlockFlow()) { + if (toRenderBlock(renderer)->height() || m_anchorNode->hasTagName(bodyTag)) { + if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer)) + return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(node()); + return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary(); + } + } else + return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary(); + return false; } @@ -949,10 +997,32 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi { caretOffset = m_offset; RenderObject* renderer = node()->renderer(); + if (!renderer->isText()) { - inlineBox = renderer->isBox() ? toRenderBox(renderer)->inlineBoxWrapper() : 0; - if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && caretOffset < inlineBox->caretMaxOffset())) + if (!renderer->isRenderButton() && renderer->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(renderer)) { + bool lastPosition = caretOffset == lastOffsetInNode(node()); + Node* startNode = lastPosition ? node()->childNode(caretOffset - 1) : node()->childNode(caretOffset); + while (startNode && (!startNode->renderer() || (startNode->isTextNode() && toRenderText(startNode->renderer())->isAllCollapsibleWhitespace()))) + startNode = (lastPosition)? startNode->previousSibling(): startNode->nextSibling(); + if (startNode) { + Position pos(startNode, 0); + pos = pos.downstream(CanCrossEditingBoundary); + pos.getInlineBoxAndOffset(UPSTREAM, primaryDirection, inlineBox, caretOffset); + if (lastPosition && inlineBox) + caretOffset = inlineBox->caretMaxOffset(); + return; + } + } + inlineBox = 0; + if (renderer->isBox()) { + inlineBox = toRenderBox(renderer)->inlineBoxWrapper(); + if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && caretOffset < inlineBox->caretMaxOffset())) + return; + } else if (node()->isContentEditable()) { + Position pos = positionInParentBeforeNode(node()).upstream(); + pos.getInlineBoxAndOffset(DOWNSTREAM, primaryDirection, inlineBox, caretOffset); return; + } } else { RenderText* textRenderer = toRenderText(renderer); @@ -976,7 +1046,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi candidate = box; } - if (candidate && !box && affinity == DOWNSTREAM) { + if (candidate && candidate == textRenderer->lastTextBox() && affinity == DOWNSTREAM) { box = searchAheadForBetterMatch(textRenderer); if (box) caretOffset = box->caretMinOffset(); @@ -1106,8 +1176,10 @@ void Position::formatForDebugger(char* buffer, unsigned length) const void Position::showTreeForThis() const { - if (node()) + if (node()) { node()->showTreeForThis(); + fprintf(stderr, "offset: %d\n", m_offset); + } } #endif diff --git a/src/3rdparty/webkit/WebCore/dom/Position.h b/src/3rdparty/webkit/WebCore/dom/Position.h index c08872d..fc5849f 100644 --- a/src/3rdparty/webkit/WebCore/dom/Position.h +++ b/src/3rdparty/webkit/WebCore/dom/Position.h @@ -56,6 +56,11 @@ public: PositionIsBeforeAnchor }; + enum EditingBoundaryCrossingRule { + CanCrossEditingBoundary, + CannotCrossEditingBoundary + }; + Position() : m_offset(0) , m_anchorType(PositionIsOffsetInAnchor) @@ -130,6 +135,9 @@ public: bool atFirstEditingPositionForNode() const; bool atLastEditingPositionForNode() const; + // Returns true if the visually equivalent positions around have different editability + bool atEditingBoundary() const; + bool atStartOfTree() const; bool atEndOfTree() const; @@ -139,8 +147,8 @@ public: Position trailingWhitespacePosition(EAffinity, bool considerNonCollapsibleWhitespace = false) const; // These return useful visually equivalent positions. - Position upstream() const; - Position downstream() const; + Position upstream(EditingBoundaryCrossingRule = CannotCrossEditingBoundary) const; + Position downstream(EditingBoundaryCrossingRule = CannotCrossEditingBoundary) const; bool isCandidate() const; bool inRenderedText() const; diff --git a/src/3rdparty/webkit/WebCore/dom/PositionIterator.cpp b/src/3rdparty/webkit/WebCore/dom/PositionIterator.cpp index 8d881ba..f5b65f5 100644 --- a/src/3rdparty/webkit/WebCore/dom/PositionIterator.cpp +++ b/src/3rdparty/webkit/WebCore/dom/PositionIterator.cpp @@ -156,10 +156,14 @@ bool PositionIterator::isCandidate() const if (isTableElement(m_anchorNode) || editingIgnoresContent(m_anchorNode)) return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parent()); - if (!m_anchorNode->hasTagName(htmlTag) && renderer->isBlockFlow() && !Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer) && - (toRenderBlock(renderer)->height() || m_anchorNode->hasTagName(bodyTag))) - return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anchorNode); - + if (!m_anchorNode->hasTagName(htmlTag) && renderer->isBlockFlow()) { + if (toRenderBlock(renderer)->height() || m_anchorNode->hasTagName(bodyTag)) { + if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer)) + return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anchorNode); + return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary(); + } + } + return false; } diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp index 72993dd..92a2b40 100644 --- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp @@ -42,6 +42,7 @@ inline ProcessingInstruction::ProcessingInstruction(Document* document, const St , m_cachedSheet(0) , m_loading(false) , m_alternate(false) + , m_createdByParser(false) #if ENABLE(XSLT) , m_isXSL(false) #endif @@ -138,7 +139,8 @@ void ProcessingInstruction::checkStyleSheet() // We need to make a synthetic XSLStyleSheet that is embedded. It needs to be able // to kick off import/include loads that can hang off some parent sheet. if (m_isXSL) { - m_sheet = XSLStyleSheet::createEmbedded(this, m_localHref); + KURL finalURL(ParsedURLString, m_localHref); + m_sheet = XSLStyleSheet::createInline(this, finalURL); m_loading = false; } #endif @@ -196,24 +198,27 @@ bool ProcessingInstruction::sheetLoaded() return false; } -void ProcessingInstruction::setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet* sheet) +void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet) { #if ENABLE(XSLT) ASSERT(!m_isXSL); #endif - RefPtr newSheet = CSSStyleSheet::create(this, url, charset); + RefPtr newSheet = CSSStyleSheet::create(this, href, baseURL, charset); m_sheet = newSheet; - parseStyleSheet(sheet->sheetText()); + // We don't need the cross-origin security check here because we are + // getting the sheet text in "strict" mode. This enforces a valid CSS MIME + // type. + parseStyleSheet(sheet->sheetText(true)); newSheet->setTitle(m_title); newSheet->setMedia(MediaList::create(newSheet.get(), m_media)); newSheet->setDisabled(m_alternate); } #if ENABLE(XSLT) -void ProcessingInstruction::setXSLStyleSheet(const String& url, const String& sheet) +void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet) { ASSERT(m_isXSL); - m_sheet = XSLStyleSheet::create(this, url); + m_sheet = XSLStyleSheet::create(this, href, baseURL); parseStyleSheet(sheet); } #endif diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h index 4b7dc86..fdb0ec9 100644 --- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h +++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.h @@ -68,9 +68,9 @@ private: virtual void removedFromDocument(); void checkStyleSheet(); - virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); + virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*); #if ENABLE(XSLT) - virtual void setXSLStyleSheet(const String& url, const String& sheet); + virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet); #endif bool isLoading() const; diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.idl b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.idl index 578b22e..efcc9c1 100644 --- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.idl +++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.idl @@ -20,11 +20,7 @@ module core { - interface [ - GenerateConstructor, - InterfaceUUID=5947E8F8-B5CB-4a51-B883-B91F344F1E13, - ImplementationUUID=7EEC0376-3D76-4643-A964-97B8AC1FB6D3 - ] ProcessingInstruction : Node { + interface ProcessingInstruction : Node { // DOM Level 1 @@ -32,11 +28,8 @@ module core { attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString data setter raises(DOMException); -#if !defined(LANGUAGE_COM) || !LANGUAGE_COM // interface LinkStyle from DOM Level 2 Style Sheets readonly attribute StyleSheet sheet; -#endif - }; } diff --git a/src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl b/src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl index 2db72af..afdf3a2 100644 --- a/src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/ProgressEvent.idl @@ -25,9 +25,7 @@ module events { - interface [ - GenerateConstructor - ] ProgressEvent : Event { + interface ProgressEvent : Event { readonly attribute boolean lengthComputable; readonly attribute unsigned long loaded; readonly attribute unsigned long total; diff --git a/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp b/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp index 2c5f39a..795bdb6 100644 --- a/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp +++ b/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp @@ -51,7 +51,7 @@ struct QNameComponentsTranslator { static QNameSet* gNameCache; -QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n) +void QualifiedName::init(const AtomicString& p, const AtomicString& l, const AtomicString& n) { if (!gNameCache) gNameCache = new QNameSet; @@ -62,6 +62,16 @@ QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const m_impl->ref(); } +QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n) +{ + init(p, l, n); +} + +QualifiedName::QualifiedName(const AtomicString& p, const char* l, const AtomicString& n) +{ + init(p, AtomicString(l), n); +} + void QualifiedName::deref() { #ifdef QNAME_DEFAULT_CONSTRUCTOR diff --git a/src/3rdparty/webkit/WebCore/dom/QualifiedName.h b/src/3rdparty/webkit/WebCore/dom/QualifiedName.h index 3b9f5c4..7581ba1 100644 --- a/src/3rdparty/webkit/WebCore/dom/QualifiedName.h +++ b/src/3rdparty/webkit/WebCore/dom/QualifiedName.h @@ -22,7 +22,7 @@ #define QualifiedName_h #include "AtomicString.h" -#include +#include namespace WebCore { @@ -32,7 +32,7 @@ struct QualifiedNameComponents { StringImpl* m_namespace; }; -class QualifiedName { +class QualifiedName : public FastAllocBase { public: class QualifiedNameImpl : public RefCounted { public: @@ -57,6 +57,7 @@ public: }; QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); + QualifiedName(const AtomicString& prefix, const char* localName, const AtomicString& namespaceURI); ~QualifiedName() { deref(); } #ifdef QNAME_DEFAULT_CONSTRUCTOR QualifiedName() : m_impl(0) { } @@ -88,6 +89,7 @@ public: static void init(); private: + void init(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); void ref() const { m_impl->ref(); } void deref(); diff --git a/src/3rdparty/webkit/WebCore/dom/Range.cpp b/src/3rdparty/webkit/WebCore/dom/Range.cpp index 122130d..52d1785 100644 --- a/src/3rdparty/webkit/WebCore/dom/Range.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Range.cpp @@ -666,7 +666,7 @@ PassRefPtr Range::processContents(ActionType action, Exception } // Complex case: Start and end containers are different. - // There are three possiblities here: + // There are three possibilities here: // 1. Start container == commonRoot (End container must be a descendant) // 2. End container == commonRoot (Start container must be a descendant) // 3. Neither is commonRoot, they are both descendants @@ -1417,7 +1417,7 @@ void Range::surroundContents(PassRefPtr passNewParent, ExceptionCode& ec) // although this will fail below for another reason). if (parentOfNewParent->isCharacterDataNode()) parentOfNewParent = parentOfNewParent->parentNode(); - if (!parentOfNewParent->childTypeAllowed(newParent->nodeType())) { + if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->nodeType())) { ec = HIERARCHY_REQUEST_ERR; return; } @@ -1595,12 +1595,32 @@ IntRect Range::boundingBox() void Range::textRects(Vector& rects, bool useSelectionHeight) { - if (!m_start.container() || !m_end.container()) + Node* startContainer = m_start.container(); + Node* endContainer = m_end.container(); + + if (!startContainer || !endContainer) return; + Node* stopNode = pastLastNode(); + for (Node* node = firstNode(); node != stopNode; node = node->traverseNextNode()) { + RenderObject* r = node->renderer(); + if (!r || !r->isText()) + continue; + RenderText* renderText = toRenderText(r); + int startOffset = node == startContainer ? m_start.offset() : 0; + int endOffset = node == endContainer ? m_end.offset() : numeric_limits::max(); + renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSelectionHeight); + } +} + +void Range::textQuads(Vector& quads, bool useSelectionHeight) +{ Node* startContainer = m_start.container(); Node* endContainer = m_end.container(); + if (!startContainer || !endContainer) + return; + Node* stopNode = pastLastNode(); for (Node* node = firstNode(); node != stopNode; node = node->traverseNextNode()) { RenderObject* r = node->renderer(); @@ -1608,8 +1628,8 @@ void Range::textRects(Vector& rects, bool useSelectionHeight) continue; RenderText* renderText = toRenderText(r); int startOffset = node == startContainer ? m_start.offset() : 0; - int endOffset = node == endContainer ? m_end.offset() : INT_MAX; - renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSelectionHeight); + int endOffset = node == endContainer ? m_end.offset() : numeric_limits::max(); + renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSelectionHeight); } } @@ -1910,3 +1930,17 @@ void Range::getBorderAndTextQuads(Vector& quads) const } } // namespace WebCore + +#ifndef NDEBUG + +void showTree(const WebCore::Range* range) +{ + if (range && range->boundaryPointsValid()) { + WebCore::Position start = range->startPosition(); + WebCore::Position end = range->endPosition(); + start.node()->showTreeAndMark(start.node(), "S", end.node(), "E"); + fprintf(stderr, "start offset: %d, end offset: %d\n", start.deprecatedEditingOffset(), end.deprecatedEditingOffset()); + } +} + +#endif diff --git a/src/3rdparty/webkit/WebCore/dom/Range.h b/src/3rdparty/webkit/WebCore/dom/Range.h index e2e282b..fd0f66a 100644 --- a/src/3rdparty/webkit/WebCore/dom/Range.h +++ b/src/3rdparty/webkit/WebCore/dom/Range.h @@ -105,7 +105,10 @@ public: Node* shadowTreeRootNode() const; IntRect boundingBox(); + // Not transform-friendly void textRects(Vector&, bool useSelectionHeight = false); + // Transform-friendly + void textQuads(Vector&, bool useSelectionHeight = false); void nodeChildrenChanged(ContainerNode*); void nodeWillBeRemoved(Node*); @@ -155,4 +158,9 @@ inline bool operator!=(const Range& a, const Range& b) { return !(a == b); } } // namespace +#ifndef NDEBUG +// Outside the WebCore namespace for ease of invocation from gdb. +void showTree(const WebCore::Range*); +#endif + #endif diff --git a/src/3rdparty/webkit/WebCore/dom/Range.idl b/src/3rdparty/webkit/WebCore/dom/Range.idl index 9024e09..cd01d61 100644 --- a/src/3rdparty/webkit/WebCore/dom/Range.idl +++ b/src/3rdparty/webkit/WebCore/dom/Range.idl @@ -21,7 +21,7 @@ module ranges { // Introduced in DOM Level 2: - interface [GenerateConstructor] Range { + interface Range { readonly attribute Node startContainer getter raises(DOMException); diff --git a/src/3rdparty/webkit/WebCore/dom/RangeException.h b/src/3rdparty/webkit/WebCore/dom/RangeException.h index 2eee3b0..c9f4f5c 100644 --- a/src/3rdparty/webkit/WebCore/dom/RangeException.h +++ b/src/3rdparty/webkit/WebCore/dom/RangeException.h @@ -1,6 +1,4 @@ /* - * This file is part of the DOM implementation for KDE. - * * (C) 1999 Lars Knoll (knoll@kde.org) * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) diff --git a/src/3rdparty/webkit/WebCore/dom/RangeException.idl b/src/3rdparty/webkit/WebCore/dom/RangeException.idl index d2cf385..100912d 100644 --- a/src/3rdparty/webkit/WebCore/dom/RangeException.idl +++ b/src/3rdparty/webkit/WebCore/dom/RangeException.idl @@ -19,9 +19,7 @@ module ranges { - interface [ - GenerateConstructor - ] RangeException { + interface RangeException { readonly attribute unsigned short code; readonly attribute DOMString name; diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp index 827aff3..9a80e16 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp @@ -177,7 +177,7 @@ void ScriptElementData::evaluateScript(const ScriptSourceCode& sourceCode) return; if (Frame* frame = m_element->document()->frame()) { - if (!frame->script()->isEnabled()) + if (!frame->script()->canExecuteScripts()) return; m_evaluated = true; @@ -229,12 +229,14 @@ bool ScriptElementData::shouldExecuteAsJavaScript() const We want to accept all the values that either of these browsers accept, but not other values. */ String type = m_scriptElement->typeAttributeValue(); - if (!type.isEmpty()) - return MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower()); - - String language = m_scriptElement->languageAttributeValue(); - if (!language.isEmpty()) - return isSupportedJavaScriptLanguage(language); + if (!type.isEmpty()) { + if (!MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower())) + return false; + } else { + String language = m_scriptElement->languageAttributeValue(); + if (!language.isEmpty() && !isSupportedJavaScriptLanguage(language)) + return false; + } // No type or language is specified, so we assume the script to be JavaScript. // We don't yet support setting event listeners via the 'for' attribute for scripts. diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp index f7046e3..c2fe120 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp @@ -28,7 +28,9 @@ #include "ScriptExecutionContext.h" #include "ActiveDOMObject.h" -#include "Document.h" +#include "Database.h" +#include "DatabaseTask.h" +#include "DatabaseThread.h" #include "MessagePort.h" #include "SecurityOrigin.h" #include "WorkerContext.h" @@ -44,9 +46,9 @@ namespace WebCore { class ProcessMessagesSoonTask : public ScriptExecutionContext::Task { public: - static PassRefPtr create() + static PassOwnPtr create() { - return adoptRef(new ProcessMessagesSoonTask); + return new ProcessMessagesSoonTask; } virtual void performTask(ScriptExecutionContext* context) @@ -56,6 +58,9 @@ public: }; ScriptExecutionContext::ScriptExecutionContext() +#if ENABLE(DATABASE) + : m_hasOpenDatabases(false) +#endif { } @@ -72,8 +77,69 @@ ScriptExecutionContext::~ScriptExecutionContext() ASSERT((*iter)->scriptExecutionContext() == this); (*iter)->contextDestroyed(); } +#if ENABLE(DATABASE) + if (m_databaseThread) { + ASSERT(m_databaseThread->terminationRequested()); + m_databaseThread = 0; + } +#endif +} + +#if ENABLE(DATABASE) + +DatabaseThread* ScriptExecutionContext::databaseThread() +{ + if (!m_databaseThread && !m_hasOpenDatabases) { + // Create the database thread on first request - but not if at least one database was already opened, + // because in that case we already had a database thread and terminated it and should not create another. + m_databaseThread = DatabaseThread::create(); + if (!m_databaseThread->start()) + m_databaseThread = 0; + } + + return m_databaseThread.get(); +} + +void ScriptExecutionContext::addOpenDatabase(Database* database) +{ + ASSERT(isContextThread()); + if (!m_openDatabaseSet) + m_openDatabaseSet.set(new DatabaseSet()); + + ASSERT(!m_openDatabaseSet->contains(database)); + m_openDatabaseSet->add(database); +} + +void ScriptExecutionContext::removeOpenDatabase(Database* database) +{ + ASSERT(isContextThread()); + ASSERT(m_openDatabaseSet && m_openDatabaseSet->contains(database)); + if (!m_openDatabaseSet) + return; + m_openDatabaseSet->remove(database); +} + +void ScriptExecutionContext::stopDatabases(DatabaseTaskSynchronizer* cleanupSync) +{ + ASSERT(isContextThread()); + if (m_openDatabaseSet) { + DatabaseSet::iterator i = m_openDatabaseSet->begin(); + DatabaseSet::iterator end = m_openDatabaseSet->end(); + for (; i != end; ++i) { + (*i)->stop(); + if (m_databaseThread) + m_databaseThread->unscheduleDatabaseTasks(*i); + } + } + + if (m_databaseThread) + m_databaseThread->requestTermination(cleanupSync); + else if (cleanupSync) + cleanupSync->taskCompleted(); } +#endif + void ScriptExecutionContext::processMessagePortMessagesSoon() { postTask(ProcessMessagesSoonTask::create()); diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h index 398afec..709bc69 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h +++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.h @@ -31,12 +31,19 @@ #include "KURL.h" #include #include +#include #include +#include #include namespace WebCore { class ActiveDOMObject; +#if ENABLE(DATABASE) + class Database; + class DatabaseTaskSynchronizer; + class DatabaseThread; +#endif class DOMTimer; class MessagePort; class SecurityOrigin; @@ -58,6 +65,19 @@ namespace WebCore { virtual bool isDocument() const { return false; } virtual bool isWorkerContext() const { return false; } +#if ENABLE(DATABASE) + virtual bool isDatabaseReadOnly() const = 0; + virtual void databaseExceededQuota(const String& name) = 0; + DatabaseThread* databaseThread(); + void setHasOpenDatabases() { m_hasOpenDatabases = true; } + bool hasOpenDatabases() const { return m_hasOpenDatabases; } + void addOpenDatabase(Database*); + void removeOpenDatabase(Database*); + // When the database cleanup is done, cleanupSync will be signalled. + void stopDatabases(DatabaseTaskSynchronizer*); +#endif + virtual bool isContextThread() const = 0; + const KURL& url() const { return virtualURL(); } KURL completeURL(const String& url) const { return virtualCompleteURL(url); } @@ -92,13 +112,15 @@ namespace WebCore { void ref() { refScriptExecutionContext(); } void deref() { derefScriptExecutionContext(); } - class Task : public ThreadSafeShared { + class Task : public Noncopyable { public: virtual ~Task(); virtual void performTask(ScriptExecutionContext*) = 0; + // Certain tasks get marked specially so that they aren't discarded, and are executed, when the context is shutting down its message queue. + virtual bool isCleanupTask() const { return false; } }; - virtual void postTask(PassRefPtr) = 0; // Executes the task on context's thread asynchronously. + virtual void postTask(PassOwnPtr) = 0; // Executes the task on context's thread asynchronously. void addTimeout(int timeoutId, DOMTimer*); void removeTimeout(int timeoutId); @@ -128,6 +150,13 @@ namespace WebCore { virtual void refScriptExecutionContext() = 0; virtual void derefScriptExecutionContext() = 0; + +#if ENABLE(DATABASE) + RefPtr m_databaseThread; + bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed. + typedef HashSet DatabaseSet; + OwnPtr m_openDatabaseSet; +#endif }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp index 3d2a549..866b6ca 100644 --- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp @@ -22,6 +22,7 @@ #include "SelectElement.h" #include "CharacterNames.h" +#include "Chrome.h" #include "ChromeClient.h" #include "Element.h" #include "EventHandler.h" @@ -49,10 +50,10 @@ // Configure platform-specific behavior when focused pop-up receives arrow/space/return keystroke. // (PLATFORM(MAC) and PLATFORM(GTK) are always false in Chromium, hence the extra tests.) -#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && PLATFORM(DARWIN)) +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) #define ARROW_KEYS_POP_MENU 1 #define SPACE_OR_RETURN_POP_MENU 0 -#elif PLATFORM(GTK) || (PLATFORM(CHROMIUM) && PLATFORM(LINUX)) +#elif PLATFORM(GTK) || (PLATFORM(CHROMIUM) && OS(LINUX)) #define ARROW_KEYS_POP_MENU 0 #define SPACE_OR_RETURN_POP_MENU 1 #else @@ -221,28 +222,21 @@ void SelectElement::scrollToSelection(SelectElementData& data, Element* element) toRenderListBox(renderer)->selectionChanged(); } -void SelectElement::recalcStyle(SelectElementData& data, Element* element) +void SelectElement::setOptionsChangedOnRenderer(SelectElementData& data, Element* element) { - RenderObject* renderer = element->renderer(); - if (element->childNeedsStyleRecalc() && renderer) { + if (RenderObject* renderer = element->renderer()) { if (data.usesMenuList()) toRenderMenuList(renderer)->setOptionsChanged(true); else toRenderListBox(renderer)->setOptionsChanged(true); - } else if (data.shouldRecalcListItems()) - recalcListItems(data, element); + } } void SelectElement::setRecalcListItems(SelectElementData& data, Element* element) { data.setShouldRecalcListItems(true); data.setActiveSelectionAnchorIndex(-1); // Manual selection anchor is reset when manipulating the select programmatically. - if (RenderObject* renderer = element->renderer()) { - if (data.usesMenuList()) - toRenderMenuList(renderer)->setOptionsChanged(true); - else - toRenderListBox(renderer)->setOptionsChanged(true); - } + setOptionsChangedOnRenderer(data, element); element->setNeedsStyleRecalc(); } @@ -251,6 +245,8 @@ void SelectElement::recalcListItems(SelectElementData& data, const Element* elem Vector& listItems = data.rawListItems(); listItems.clear(); + data.setShouldRecalcListItems(false); + OptionElement* foundSelected = 0; for (Node* currentNode = element->firstChild(); currentNode;) { if (!currentNode->isElementNode()) { @@ -296,8 +292,6 @@ void SelectElement::recalcListItems(SelectElementData& data, const Element* elem // ? + case HTMLInputElement::TEXT: return false; } + + ASSERT_NOT_REACHED(); + return false; } -bool ValidityState::rangeUnderflow() +bool ValidityState::rangeUnderflow() const { - if (!control()->hasTagName(inputTag)) + if (!m_control->hasTagName(inputTag)) return false; - return static_cast(control())->rangeUnderflow(); + return static_cast(m_control)->rangeUnderflow(); } -bool ValidityState::rangeOverflow() +bool ValidityState::rangeOverflow() const { - if (!control()->hasTagName(inputTag)) + if (!m_control->hasTagName(inputTag)) return false; - return static_cast(control())->rangeOverflow(); + return static_cast(m_control)->rangeOverflow(); } -bool ValidityState::valid() +bool ValidityState::stepMismatch() const { - bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() || - tooLong() || patternMismatch() || valueMissing() || customError(); + if (!m_control->hasTagName(inputTag)) + return false; + return static_cast(m_control)->stepMismatch(); +} +bool ValidityState::valid() const +{ + bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow() + || tooLong() || patternMismatch() || valueMissing() || customError(); return !someError; } @@ -114,19 +163,18 @@ bool ValidityState::isValidColorString(const String& value) return color.isValid() && !color.hasAlpha(); } -bool ValidityState::isValidEmailAddress(const String& email) +bool ValidityState::isValidEmailAddress(const String& address) { - if (email.isEmpty()) + int addressLength = address.length(); + if (!addressLength) return false; - DEFINE_STATIC_LOCAL(AtomicString, emailPattern, (EMAIL_PATTERN)); - DEFINE_STATIC_LOCAL(RegularExpression, regExp, (emailPattern, TextCaseInsensitive)); + DEFINE_STATIC_LOCAL(const RegularExpression, regExp, (emailPattern, TextCaseInsensitive)); - int matchLength = 0; - int emailLength = email.length(); - int matchOffset = regExp.match(email, 0, &matchLength); + int matchLength; + int matchOffset = regExp.match(address, 0, &matchLength); - return matchOffset == 0 && matchLength == emailLength; + return matchOffset == 0 && matchLength == addressLength; } } // namespace diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.h b/src/3rdparty/webkit/WebCore/html/ValidityState.h index 1dee306..78238f1 100644 --- a/src/3rdparty/webkit/WebCore/html/ValidityState.h +++ b/src/3rdparty/webkit/WebCore/html/ValidityState.h @@ -2,6 +2,7 @@ * This file is part of the WebKit project. * * Copyright (C) 2009 Michelangelo De Simone + * Copyright (C) 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,40 +25,43 @@ #define ValidityState_h #include "HTMLFormControlElement.h" -#include -#include +#include namespace WebCore { - class ValidityState : public RefCounted { - public: - static PassRefPtr create(HTMLFormControlElement* owner) - { - return adoptRef(new ValidityState(owner)); - } +class ValidityState : public Noncopyable { +public: + static PassOwnPtr create(HTMLFormControlElement* control) + { + return new ValidityState(control); + } - HTMLFormControlElement* control() const { return m_control; } + void ref() { m_control->ref(); } + void deref() { m_control->deref(); } - void setCustomErrorMessage(const String& message) { m_customErrorMessage = message; } + String validationMessage() const; - bool valueMissing() { return control()->valueMissing(); } - bool typeMismatch(); - bool patternMismatch() { return control()->patternMismatch(); } - bool tooLong() { return control()->tooLong(); } - bool rangeUnderflow(); - bool rangeOverflow(); - bool stepMismatch() { return false; } - bool customError() { return !m_customErrorMessage.isEmpty(); } - bool valid(); + void setCustomErrorMessage(const String& message) { m_customErrorMessage = message; } - private: - ValidityState(HTMLFormControlElement*); - HTMLFormControlElement* m_control; - String m_customErrorMessage; + bool valueMissing() const { return m_control->valueMissing(); } + bool typeMismatch() const; + bool patternMismatch() const { return m_control->patternMismatch(); } + bool tooLong() const { return m_control->tooLong(); } + bool rangeUnderflow() const; + bool rangeOverflow() const; + bool stepMismatch() const; + bool customError() const { return !m_customErrorMessage.isEmpty(); } + bool valid() const; - static bool isValidColorString(const String&); - bool isValidEmailAddress(const String&); - }; +private: + ValidityState(HTMLFormControlElement* control) : m_control(control) { } + + static bool isValidColorString(const String&); + static bool isValidEmailAddress(const String&); + + HTMLFormControlElement* m_control; + String m_customErrorMessage; +}; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/ValidityState.idl b/src/3rdparty/webkit/WebCore/html/ValidityState.idl index b926852..576fab4 100644 --- a/src/3rdparty/webkit/WebCore/html/ValidityState.idl +++ b/src/3rdparty/webkit/WebCore/html/ValidityState.idl @@ -22,7 +22,7 @@ module html { - interface ValidityState { + interface [OmitConstructor] ValidityState { readonly attribute boolean valueMissing; readonly attribute boolean typeMismatch; readonly attribute boolean patternMismatch; diff --git a/src/3rdparty/webkit/WebCore/html/VoidCallback.idl b/src/3rdparty/webkit/WebCore/html/VoidCallback.idl index 3682cf7..8a7cf19 100644 --- a/src/3rdparty/webkit/WebCore/html/VoidCallback.idl +++ b/src/3rdparty/webkit/WebCore/html/VoidCallback.idl @@ -24,7 +24,7 @@ */ module html { - interface [CustomNativeConverter] VoidCallback { + interface [CustomNativeConverter, OmitConstructor] VoidCallback { void handleEvent(); }; } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h deleted file mode 100644 index b04b0d0..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasActiveInfo_h -#define CanvasActiveInfo_h - -#include "PlatformString.h" -#include -#include - -namespace WebCore { - -class CanvasActiveInfo : public RefCounted { -public: - static PassRefPtr create(const String& name, unsigned type, int size) - { - return adoptRef(new CanvasActiveInfo(name, type, size)); - } - String name() const { return m_name; } - unsigned type() const { return m_type; } - int size() const { return m_size; } - -private: - CanvasActiveInfo(const String& name, unsigned type, int size) - : m_name(name) - , m_type(type) - , m_size(size) - { - ASSERT(name.length()); - ASSERT(type); - ASSERT(size); - } - String m_name; - unsigned m_type; - int m_size; -}; - -} - -#endif // CanvasActiveInfo_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl deleted file mode 100644 index 6ceae29..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - - interface [ - Conditional=3D_CANVAS, - ] CanvasActiveInfo { - readonly attribute int size; - readonly attribute unsigned int type; - readonly attribute DOMString name; - }; - -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.cpp deleted file mode 100644 index 6b5688a..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArray.h" -#include "CanvasArrayBuffer.h" - -namespace WebCore { - CanvasArray::CanvasArray(PassRefPtr buffer, - unsigned offset) - : m_offset(offset) - , m_buffer(buffer) - { - m_baseAddress = m_buffer ? (static_cast(m_buffer->data()) + m_offset) : 0; - } - - CanvasArray::~CanvasArray() - { - } - - unsigned CanvasArray::alignedSizeInBytes() const { - // Assume we only need to round up to 4-byte boundaries for alignment. - return ((sizeInBytes() + 3) / 4) * 4; - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.h deleted file mode 100644 index 8cedbbe..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasArray_h -#define CanvasArray_h - -#include -#include -#include -#include "CanvasArrayBuffer.h" - -namespace WebCore { - class CanvasArray : public RefCounted { - public: - virtual bool isByteArray() const { return false; } - virtual bool isUnsignedByteArray() const { return false; } - virtual bool isShortArray() const { return false; } - virtual bool isUnsignedShortArray() const { return false; } - virtual bool isIntArray() const { return false; } - virtual bool isUnsignedIntArray() const { return false; } - virtual bool isFloatArray() const { return false; } - - PassRefPtr buffer() { - return m_buffer; - } - - void* baseAddress() { - return m_baseAddress; - } - - unsigned offset() const { - return m_offset; - } - - virtual unsigned length() const = 0; - virtual unsigned sizeInBytes() const = 0; - virtual unsigned alignedSizeInBytes() const; - virtual ~CanvasArray(); - - protected: - CanvasArray(PassRefPtr buffer, unsigned offset); - - // This is the address of the CanvasArrayBuffer's storage, plus the offset. - void* m_baseAddress; - unsigned m_offset; - - private: - RefPtr m_buffer; - }; - -} // namespace WebCore - -#endif // CanvasArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.idl deleted file mode 100644 index 63b2dcd..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArray.idl +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS, CustomToJS] CanvasArray { - readonly attribute long length; - int sizeInBytes(); - int alignedSizeInBytes(); - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.cpp deleted file mode 100644 index c8a1397..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" - -namespace WebCore { - - PassRefPtr CanvasArrayBuffer::create(unsigned sizeInBytes) - { - return adoptRef(new CanvasArrayBuffer(sizeInBytes)); - } - - CanvasArrayBuffer::CanvasArrayBuffer(unsigned sizeInBytes) { - m_sizeInBytes = sizeInBytes; - m_data = WTF::fastZeroedMalloc(sizeInBytes); - } - - void* CanvasArrayBuffer::data() { - return m_data; - } - - unsigned CanvasArrayBuffer::byteLength() const { - return m_sizeInBytes; - } - - CanvasArrayBuffer::~CanvasArrayBuffer() { - WTF::fastFree(m_data); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.h deleted file mode 100644 index e3ff2b0..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasArrayBuffer_h -#define CanvasArrayBuffer_h - -#include -#include - -namespace WebCore { - - class CanvasArrayBuffer : public RefCounted { - public: - static PassRefPtr create(unsigned sizeInBytes); - - void* data(); - unsigned byteLength() const; - - ~CanvasArrayBuffer(); - - private: - CanvasArrayBuffer(unsigned sizeInBytes); - unsigned m_sizeInBytes; - void* m_data; - }; - -} // namespace WebCore - -#endif // CanvasArrayBuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.idl deleted file mode 100644 index 5dc0f7f..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasArrayBuffer.idl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasArrayBuffer { - readonly attribute int byteLength; - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.cpp deleted file mode 100644 index 009f8ad..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasBuffer.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasBuffer::create(CanvasRenderingContext3D* ctx) -{ - return adoptRef(new CanvasBuffer(ctx)); -} - -CanvasBuffer::CanvasBuffer(CanvasRenderingContext3D* ctx) - : CanvasObject(ctx) -{ - setObject(context()->graphicsContext3D()->createBuffer()); -} - -void CanvasBuffer::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteBuffer(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.h deleted file mode 100644 index 8fdab82..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasBuffer_h -#define CanvasBuffer_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasBuffer : public CanvasObject { - public: - virtual ~CanvasBuffer() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*); - - protected: - CanvasBuffer(CanvasRenderingContext3D*); - - virtual void _deleteObject(Platform3DObject o); - }; - -} // namespace WebCore - -#endif // CanvasBuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.idl deleted file mode 100644 index 9bca42b..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasBuffer.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasBuffer { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.cpp deleted file mode 100644 index 0f72ccf..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasByteArray.h" - -namespace WebCore { - -PassRefPtr CanvasByteArray::create(unsigned length) -{ - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(signed char)); - return create(buffer, 0, length); -} - -PassRefPtr CanvasByteArray::create(signed char* array, unsigned length) -{ - RefPtr a = CanvasByteArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; -} - -PassRefPtr CanvasByteArray::create(PassRefPtr buffer, int offset, unsigned length) -{ - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(signed char))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasByteArray(buffer, offset, length)); -} - -CanvasByteArray::CanvasByteArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) -{ -} - -unsigned CanvasByteArray::length() const { - return m_size; -} - -unsigned CanvasByteArray::sizeInBytes() const { - return length() * sizeof(signed char); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.h deleted file mode 100644 index 69cadf7..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasByteArray_h -#define CanvasByteArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasArrayBuffer; - - class CanvasByteArray : public CanvasArray { - public: - virtual bool isByteArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(signed char* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - char* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - signed char* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, signed char& result) const - { - if (index >= m_size) - return false; - signed char* storage = static_cast(m_baseAddress); - result = storage[index]; - return true; - } - - signed char item(unsigned index) const - { - ASSERT(index < m_size); - signed char* storage = static_cast(m_baseAddress); - return storage[index]; - } - private: - CanvasByteArray(PassRefPtr buffer, - int offset, - unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasByteArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.idl deleted file mode 100644 index ccf49ad..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasByteArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasByteArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp new file mode 100644 index 0000000..d3d0398 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "CanvasContextAttributes.h" + +namespace WebCore { + +CanvasContextAttributes::CanvasContextAttributes() +{ +} + +CanvasContextAttributes::~CanvasContextAttributes() +{ +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h new file mode 100644 index 0000000..97483b3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasContextAttributes.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CanvasContextAttributes_h +#define CanvasContextAttributes_h + +#include + +namespace WebCore { + +// A base class for any attributes that are needed which would affect +// the creation of the Canvas's rendering context. Currently only the +// WebGLRenderingContext uses this mechanism. + +class CanvasContextAttributes : public RefCounted { + public: + virtual ~CanvasContextAttributes(); + + protected: + CanvasContextAttributes(); +}; + +} // namespace WebCore + +#endif // CanvasContextAttributes_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.cpp deleted file mode 100644 index 09561cb..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasFloatArray.h" - -namespace WebCore { - - PassRefPtr CanvasFloatArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(float)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasFloatArray::create(float* array, unsigned length) - { - RefPtr a = CanvasFloatArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasFloatArray::create(PassRefPtr buffer, int offset, unsigned length) - { - // Make sure the offset results in valid alignment. - if ((offset % sizeof(float)) != 0) - return NULL; - - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(float))) > buffer->byteLength()) - return NULL; - } - return adoptRef(new CanvasFloatArray(buffer, offset, length)); - } - - CanvasFloatArray::CanvasFloatArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasFloatArray::length() const { - return m_size; - } - - unsigned CanvasFloatArray::sizeInBytes() const { - return length() * sizeof(float); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.h deleted file mode 100644 index d2dc4ff..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasFloatArray_h -#define CanvasFloatArray_h - -#include "CanvasArray.h" -#include -#include -#include - -namespace WebCore { - - class CanvasFloatArray : public CanvasArray { - public: - virtual bool isFloatArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(float* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - float* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - float* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, float& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - float item(unsigned index) const - { - ASSERT(index < m_size); - float* storage = static_cast(m_baseAddress); - float result = storage[index]; - if (isnan(result)) { - // Clamp NaN to 0 - result = 0; - } - return result; - } - private: - CanvasFloatArray(PassRefPtr buffer, int offset, unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasFloatArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.idl deleted file mode 100644 index bb236b9..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFloatArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasFloatArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.cpp deleted file mode 100644 index 9700354..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasFramebuffer.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasFramebuffer::create(CanvasRenderingContext3D* ctx) -{ - return adoptRef(new CanvasFramebuffer(ctx)); -} - -CanvasFramebuffer::CanvasFramebuffer(CanvasRenderingContext3D* ctx) - : CanvasObject(ctx) -{ - setObject(context()->graphicsContext3D()->createFramebuffer()); -} - -void CanvasFramebuffer::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteFramebuffer(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.h deleted file mode 100644 index ec3cb97..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasFramebuffer_h -#define CanvasFramebuffer_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasFramebuffer : public CanvasObject { - public: - virtual ~CanvasFramebuffer() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*); - - protected: - CanvasFramebuffer(CanvasRenderingContext3D*); - - virtual void _deleteObject(Platform3DObject); - }; - -} // namespace WebCore - -#endif // CanvasFramebuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.idl deleted file mode 100644 index 0a9b668..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasFramebuffer.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasFramebuffer { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.idl index a925a26..32813bc 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasGradient.idl @@ -27,7 +27,8 @@ module html { interface [ InterfaceUUID=bb1108ea-6b8c-4a08-894a-218628630cdb, - ImplementationUUID=a2942ae6-2731-4286-98cc-9d5e79e20de1 + ImplementationUUID=a2942ae6-2731-4286-98cc-9d5e79e20de1, + OmitConstructor ] CanvasGradient { void addColorStop(in float offset, in DOMString color) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.cpp deleted file mode 100644 index 4716d7b..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasIntArray.h" - -namespace WebCore { - - PassRefPtr CanvasIntArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(int)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasIntArray::create(int* array, unsigned length) - { - RefPtr a = CanvasIntArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasIntArray::create(PassRefPtr buffer, - int offset, - unsigned length) - { - // Make sure the offset results in valid alignment. - if ((offset % sizeof(int)) != 0) - return NULL; - - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(int))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasIntArray(buffer, offset, length)); - } - - CanvasIntArray::CanvasIntArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasIntArray::length() const { - return m_size; - } - - unsigned CanvasIntArray::sizeInBytes() const { - return length() * sizeof(int); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.h deleted file mode 100644 index 4977034..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasIntArray_h -#define CanvasIntArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasIntArray : public CanvasArray { - public: - virtual bool isIntArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(int* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - int* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - int* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, int& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - int item(unsigned index) const - { - ASSERT(index < m_size); - int* storage = static_cast(m_baseAddress); - return storage[index]; - } - - private: - CanvasIntArray(PassRefPtr buffer, - int offset, - unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasIntArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.idl deleted file mode 100644 index 2c81b87..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasIntArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasIntArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.idl index 56e807e..036d4ee 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasNumberArray.idl @@ -26,7 +26,6 @@ module html { interface [ Conditional=3D_CANVAS, - GenerateConstructor, HasCustomIndexGetter ] CanvasNumberArray { readonly attribute unsigned long length; diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.cpp index 8a71a45..6c7667b 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.cpp @@ -28,12 +28,13 @@ #if ENABLE(3D_CANVAS) #include "CanvasObject.h" -#include "CanvasRenderingContext3D.h" +#include "WebGLRenderingContext.h" namespace WebCore { -CanvasObject::CanvasObject(CanvasRenderingContext3D* context) +CanvasObject::CanvasObject(WebGLRenderingContext* context) : m_object(0) + , m_shouldDeleteObject(true) , m_context(context) { } @@ -44,24 +45,27 @@ CanvasObject::~CanvasObject() m_context->removeObject(this); } -void CanvasObject::setObject(Platform3DObject object) +void CanvasObject::setObject(Platform3DObject object, bool shouldDeleteObject) { if (object == m_object) return; deleteObject(); m_object = object; + m_shouldDeleteObject = shouldDeleteObject; } void CanvasObject::deleteObject() { if (m_object) { - if (m_context) { - m_context->graphicsContext3D()->makeContextCurrent(); - _deleteObject(m_object); - } + if (m_shouldDeleteObject) + if (m_context) { + m_context->graphicsContext3D()->makeContextCurrent(); + _deleteObject(m_object); + } m_object = 0; } + m_shouldDeleteObject = true; } } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.h index 748278d..b7b016a 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasObject.h @@ -33,14 +33,14 @@ namespace WebCore { - class CanvasRenderingContext3D; + class WebGLRenderingContext; class CanvasObject : public RefCounted { public: virtual ~CanvasObject(); Platform3DObject object() const { return m_object; } - void setObject(Platform3DObject); + void setObject(Platform3DObject, bool shouldDeleteObject = true); void deleteObject(); void detachContext() @@ -49,15 +49,22 @@ namespace WebCore { m_context = 0; } - CanvasRenderingContext3D* context() const { return m_context; } + WebGLRenderingContext* context() const { return m_context; } protected: - CanvasObject(CanvasRenderingContext3D*); + CanvasObject(WebGLRenderingContext*); virtual void _deleteObject(Platform3DObject) = 0; private: Platform3DObject m_object; - CanvasRenderingContext3D* m_context; + // The shouldDeleteObject flag indicates whether this wrapper + // owns the underlying resource and should delete it when the + // wrapper is unreferenced for the last time and deleted. It + // is only set to false for certain objects returned from get + // queries. FIXME: should consider canonicalizing all of these + // objects in the future. + bool m_shouldDeleteObject; + WebGLRenderingContext* m_context; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.idl index 1cac8f8..492c93f 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPattern.idl @@ -27,7 +27,8 @@ module html { interface [ InterfaceUUID=c2131348-6d8c-47b5-86cc-d41aff34ce15, - ImplementationUUID=82f5d713-3d17-44dd-aa4a-7766fe345940 + ImplementationUUID=82f5d713-3d17-44dd-aa4a-7766fe345940, + OmitConstructor ] CanvasPattern { }; diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.h index 8ac5163..25eb92a 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.h @@ -42,6 +42,7 @@ namespace WebCore { static PassRefPtr create(unsigned length); WTF::ByteArray* data() { return m_data.get(); } + const WTF::ByteArray* data() const { return m_data.get(); } unsigned length() const { return m_data->length(); } void set(unsigned index, double value) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.idl index 2295af6..60726cd 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasPixelArray.idl @@ -29,6 +29,7 @@ module html { #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT || defined(V8_BINDING) && V8_BINDING interface [ + OmitConstructor, CustomHeader, HasNumericIndexGetter, HasCustomIndexSetter diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.cpp deleted file mode 100644 index 83da270..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasProgram.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasProgram::create(CanvasRenderingContext3D* ctx) -{ - return adoptRef(new CanvasProgram(ctx)); -} - -CanvasProgram::CanvasProgram(CanvasRenderingContext3D* ctx) - : CanvasObject(ctx) -{ - setObject(context()->graphicsContext3D()->createProgram()); -} - -void CanvasProgram::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteProgram(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.h deleted file mode 100644 index af817c8..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasProgram_h -#define CanvasProgram_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasProgram : public CanvasObject { - public: - virtual ~CanvasProgram() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*); - - protected: - CanvasProgram(CanvasRenderingContext3D*); - - virtual void _deleteObject(Platform3DObject); - }; - -} // namespace WebCore - -#endif // CanvasProgram_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.idl deleted file mode 100644 index 46daaf2..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasProgram.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasProgram { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.cpp deleted file mode 100644 index 51054cd..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasRenderbuffer.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasRenderbuffer::create(CanvasRenderingContext3D* ctx) -{ - return adoptRef(new CanvasRenderbuffer(ctx)); -} - -CanvasRenderbuffer::CanvasRenderbuffer(CanvasRenderingContext3D* ctx) - : CanvasObject(ctx) -{ - setObject(context()->graphicsContext3D()->createRenderbuffer()); -} - -void CanvasRenderbuffer::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteRenderbuffer(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.h deleted file mode 100644 index 3fb99e9..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasRenderbuffer_h -#define CanvasRenderbuffer_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasRenderbuffer : public CanvasObject { - public: - virtual ~CanvasRenderbuffer() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*); - - protected: - CanvasRenderbuffer(CanvasRenderingContext3D*); - - virtual void _deleteObject(Platform3DObject); - }; - -} // namespace WebCore - -#endif // CanvasRenderbuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.idl deleted file mode 100644 index 5e47cc3..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderbuffer.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasRenderbuffer { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.idl index 8701c80..a11aa75 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.idl @@ -26,7 +26,6 @@ module html { interface [ - GenerateConstructor, CustomToJS, InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443, ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54 diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 848771b..8add19c 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -30,7 +30,7 @@ #include "config.h" #include "CanvasRenderingContext2D.h" -#include "TransformationMatrix.h" +#include "AffineTransform.h" #include "CSSParser.h" #include "CachedImage.h" #include "CanvasGradient.h" @@ -354,7 +354,10 @@ void CanvasRenderingContext2D::scale(float sx, float sy) if (!state().m_invertibleCTM) return; - TransformationMatrix newTransform = state().m_transform; + if (!isfinite(sx) | !isfinite(sy)) + return; + + AffineTransform newTransform = state().m_transform; newTransform.scaleNonUniform(sx, sy); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -363,7 +366,7 @@ void CanvasRenderingContext2D::scale(float sx, float sy) state().m_transform = newTransform; c->scale(FloatSize(sx, sy)); - m_path.transform(TransformationMatrix().scaleNonUniform(1.0/sx, 1.0/sy)); + m_path.transform(AffineTransform().scaleNonUniform(1.0 / sx, 1.0 / sy)); } void CanvasRenderingContext2D::rotate(float angleInRadians) @@ -374,7 +377,10 @@ void CanvasRenderingContext2D::rotate(float angleInRadians) if (!state().m_invertibleCTM) return; - TransformationMatrix newTransform = state().m_transform; + if (!isfinite(angleInRadians)) + return; + + AffineTransform newTransform = state().m_transform; newTransform.rotate(angleInRadians / piDouble * 180.0); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -383,7 +389,7 @@ void CanvasRenderingContext2D::rotate(float angleInRadians) state().m_transform = newTransform; c->rotate(angleInRadians); - m_path.transform(TransformationMatrix().rotate(-angleInRadians / piDouble * 180.0)); + m_path.transform(AffineTransform().rotate(-angleInRadians / piDouble * 180.0)); } void CanvasRenderingContext2D::translate(float tx, float ty) @@ -394,7 +400,10 @@ void CanvasRenderingContext2D::translate(float tx, float ty) if (!state().m_invertibleCTM) return; - TransformationMatrix newTransform = state().m_transform; + if (!isfinite(tx) | !isfinite(ty)) + return; + + AffineTransform newTransform = state().m_transform; newTransform.translate(tx, ty); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -403,7 +412,7 @@ void CanvasRenderingContext2D::translate(float tx, float ty) state().m_transform = newTransform; c->translate(tx, ty); - m_path.transform(TransformationMatrix().translate(-tx, -ty)); + m_path.transform(AffineTransform().translate(-tx, -ty)); } void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float m22, float dx, float dy) @@ -413,14 +422,13 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float return; if (!state().m_invertibleCTM) return; - - // HTML5 3.14.11.1 -- ignore any calls that pass non-finite numbers + if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | !isfinite(m12) | !isfinite(m22) | !isfinite(dy)) return; - TransformationMatrix transform(m11, m12, m21, m22, dx, dy); - TransformationMatrix newTransform = transform * state().m_transform; + AffineTransform transform(m11, m12, m21, m22, dx, dy); + AffineTransform newTransform = transform * state().m_transform; if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; return; @@ -437,12 +445,11 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo if (!c) return; - // HTML5 3.14.11.1 -- ignore any calls that pass non-finite numbers if (!isfinite(m11) | !isfinite(m21) | !isfinite(dx) | !isfinite(m12) | !isfinite(m22) | !isfinite(dy)) return; - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; if (!ctm.isInvertible()) return; c->concatCTM(c->getCTM().inverse()); @@ -701,7 +708,7 @@ bool CanvasRenderingContext2D::isPointInPath(const float x, const float y) return false; FloatPoint point(x, y); - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; FloatPoint transformedPoint = ctm.inverse().mapPoint(point); return m_path.contains(transformedPoint); } @@ -816,7 +823,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, return; RGBA32 rgba = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba)); + c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace); } void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& color, float alpha) @@ -832,7 +839,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, RGBA32 rgba = 0; // default is transparent black if (!state().m_shadowColor.isEmpty()) CSSParser::parseColor(rgba, state().m_shadowColor); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(colorWithOverrideAlpha(rgba, alpha))); + c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(colorWithOverrideAlpha(rgba, alpha)), DeviceColorSpace); } void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float grayLevel, float alpha) @@ -846,7 +853,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, return; RGBA32 rgba = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba)); + c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace); } void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float r, float g, float b, float a) @@ -862,7 +869,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, RGBA32 rgba = makeRGBA32FromFloats(r, g, b, a); // default is transparent black if (!state().m_shadowColor.isEmpty()) CSSParser::parseColor(rgba, state().m_shadowColor); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba)); + c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace); } void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float c, float m, float y, float k, float a) @@ -882,7 +889,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor); CGColorRelease(shadowColor); #else - dc->setShadow(IntSize(width, -height), blur, Color(c, m, y, k, a)); + dc->setShadow(IntSize(width, -height), blur, Color(c, m, y, k, a), DeviceColorSpace); #endif } @@ -905,7 +912,7 @@ void CanvasRenderingContext2D::applyShadow() CSSParser::parseColor(rgba, state().m_shadowColor); float width = state().m_shadowOffset.width(); float height = state().m_shadowOffset.height(); - c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba)); + c->setShadow(IntSize(width, -height), state().m_shadowBlur, Color(rgba), DeviceColorSpace); } static IntSize size(HTMLImageElement* image) @@ -994,7 +1001,7 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); willDraw(destRect); - c->drawImage(cachedImage->image(), destRect, sourceRect, state().m_globalComposite); + c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); } void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y) @@ -1044,7 +1051,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const if (!sourceCanvas->originClean()) canvas()->setOriginTainted(); - c->drawImage(buffer->image(), destRect, sourceRect, state().m_globalComposite); + c->drawImage(buffer->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty. // FIXME: Arguably willDraw should become didDraw and occur after drawing calls and not before them to avoid problems like this. } @@ -1138,7 +1145,7 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, FloatRect destRect = FloatRect(dx, dy, dw, dh); willDraw(destRect); - c->drawImage(cachedImage->image(), destRect, FloatRect(sx, sy, sw, sh), op); + c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, FloatRect(sx, sy, sw, sh), op); } void CanvasRenderingContext2D::setAlpha(float alpha) @@ -1234,7 +1241,7 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options) FloatRect dirtyRect = r; if (options & CanvasWillDrawApplyTransform) { - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; dirtyRect = ctm.mapRect(r); } @@ -1525,9 +1532,9 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo GraphicsContext* maskImageContext = maskImage->context(); if (fill) - maskImageContext->setFillColor(Color::black); + maskImageContext->setFillColor(Color::black, DeviceColorSpace); else { - maskImageContext->setStrokeColor(Color::black); + maskImageContext->setStrokeColor(Color::black, DeviceColorSpace); maskImageContext->setStrokeThickness(c->strokeThickness()); } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.h index 283f92c..553ffd2 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -26,8 +26,8 @@ #ifndef CanvasRenderingContext2D_h #define CanvasRenderingContext2D_h +#include "AffineTransform.h" #include "CanvasRenderingContext.h" -#include "TransformationMatrix.h" #include "FloatSize.h" #include "Font.h" #include "GraphicsTypes.h" @@ -218,7 +218,7 @@ namespace WebCore { String m_shadowColor; float m_globalAlpha; CompositeOperator m_globalComposite; - TransformationMatrix m_transform; + AffineTransform m_transform; bool m_invertibleCTM; // Text state. diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.idl index ef66d1a..f93a752 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -26,7 +26,6 @@ module html { interface [ - GenerateConstructor, InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443, ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54 ] CanvasRenderingContext2D : CanvasRenderingContext { diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp deleted file mode 100644 index 612b4c3..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp +++ /dev/null @@ -1,1441 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasRenderingContext3D.h" - -#include "CanvasActiveInfo.h" -#include "CanvasBuffer.h" -#include "CanvasFramebuffer.h" -#include "CanvasProgram.h" -#include "CanvasRenderbuffer.h" -#include "CanvasTexture.h" -#include "CanvasShader.h" -#include "HTMLCanvasElement.h" -#include "RenderBox.h" -#include "RenderLayer.h" - -namespace WebCore { - -PassOwnPtr CanvasRenderingContext3D::create(HTMLCanvasElement* canvas) -{ - OwnPtr context(GraphicsContext3D::create()); - if (!context) - return 0; - - return new CanvasRenderingContext3D(canvas, context.release()); -} - -CanvasRenderingContext3D::CanvasRenderingContext3D(HTMLCanvasElement* passedCanvas, PassOwnPtr context) - : CanvasRenderingContext(passedCanvas) - , m_context(context) - , m_needsUpdate(true) - , m_markedCanvasDirty(false) -{ - ASSERT(m_context); - m_context->reshape(canvas()->width(), canvas()->height()); -} - -CanvasRenderingContext3D::~CanvasRenderingContext3D() -{ - detachAndRemoveAllObjects(); -} - -void CanvasRenderingContext3D::markContextChanged() -{ -#if USE(ACCELERATED_COMPOSITING) - if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) { - canvas()->renderBox()->layer()->rendererContentChanged(); - } else { -#endif - if (!m_markedCanvasDirty) { - // Make sure the canvas's image buffer is allocated. - canvas()->buffer(); - canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); - m_markedCanvasDirty = true; - } -#if USE(ACCELERATED_COMPOSITING) - } -#endif -} - -void CanvasRenderingContext3D::beginPaint() -{ - if (m_markedCanvasDirty) { - m_context->beginPaint(this); - } -} - -void CanvasRenderingContext3D::endPaint() -{ - if (m_markedCanvasDirty) { - m_markedCanvasDirty = false; - m_context->endPaint(); - } -} - -void CanvasRenderingContext3D::reshape(int width, int height) -{ - if (m_needsUpdate) { -#if USE(ACCELERATED_COMPOSITING) - if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) - canvas()->renderBox()->layer()->rendererContentChanged(); -#endif - m_needsUpdate = false; - } - - m_context->reshape(width, height); -} - -int CanvasRenderingContext3D::sizeInBytes(int type, ExceptionCode& ec) -{ - int result = m_context->sizeInBytes(type); - if (result <= 0) { - ec = SYNTAX_ERR; - } - return result; -} - -void CanvasRenderingContext3D::activeTexture(unsigned long texture) -{ - m_context->activeTexture(texture); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::attachShader(CanvasProgram* program, CanvasShader* shader) -{ - if (!program || !shader) - return; - m_context->attachShader(program, shader); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bindAttribLocation(CanvasProgram* program, unsigned long index, const String& name) -{ - if (!program) - return; - m_context->bindAttribLocation(program, index, name); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bindBuffer(unsigned long target, CanvasBuffer* buffer) -{ - m_context->bindBuffer(target, buffer); - cleanupAfterGraphicsCall(false); -} - - -void CanvasRenderingContext3D::bindFramebuffer(unsigned long target, CanvasFramebuffer* buffer) -{ - m_context->bindFramebuffer(target, buffer); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bindRenderbuffer(unsigned long target, CanvasRenderbuffer* renderbuffer) -{ - m_context->bindRenderbuffer(target, renderbuffer); - cleanupAfterGraphicsCall(false); -} - - -void CanvasRenderingContext3D::bindTexture(unsigned long target, CanvasTexture* texture) -{ - m_context->bindTexture(target, texture); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::blendColor(double red, double green, double blue, double alpha) -{ - m_context->blendColor(red, green, blue, alpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::blendEquation( unsigned long mode ) -{ - m_context->blendEquation(mode); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) -{ - m_context->blendEquationSeparate(modeRGB, modeAlpha); - cleanupAfterGraphicsCall(false); -} - - -void CanvasRenderingContext3D::blendFunc(unsigned long sfactor, unsigned long dfactor) -{ - m_context->blendFunc(sfactor, dfactor); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) -{ - m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bufferData(unsigned long target, int size, unsigned long usage) -{ - m_context->bufferData(target, size, usage); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bufferData(unsigned long target, CanvasArray* data, unsigned long usage) -{ - m_context->bufferData(target, data, usage); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::bufferSubData(unsigned long target, long offset, CanvasArray* data) -{ - m_context->bufferSubData(target, offset, data); - cleanupAfterGraphicsCall(false); -} - -unsigned long CanvasRenderingContext3D::checkFramebufferStatus(unsigned long target) -{ - return m_context->checkFramebufferStatus(target); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::clear(unsigned long mask) -{ - m_context->clear(mask); - cleanupAfterGraphicsCall(true); -} - -void CanvasRenderingContext3D::clearColor(double r, double g, double b, double a) -{ - if (isnan(r)) - r = 0; - if (isnan(g)) - g = 0; - if (isnan(b)) - b = 0; - if (isnan(a)) - a = 1; - m_context->clearColor(r, g, b, a); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::clearDepth(double depth) -{ - m_context->clearDepth(depth); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::clearStencil(long s) -{ - m_context->clearStencil(s); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::colorMask(bool red, bool green, bool blue, bool alpha) -{ - m_context->colorMask(red, green, blue, alpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::compileShader(CanvasShader* shader) -{ - m_context->compileShader(shader); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) -{ - m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) -{ - m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); - cleanupAfterGraphicsCall(false); -} - -PassRefPtr CanvasRenderingContext3D::createBuffer() -{ - RefPtr o = CanvasBuffer::create(this); - addObject(o.get()); - return o; -} - -PassRefPtr CanvasRenderingContext3D::createFramebuffer() -{ - RefPtr o = CanvasFramebuffer::create(this); - addObject(o.get()); - return o; -} - -PassRefPtr CanvasRenderingContext3D::createTexture() -{ - RefPtr o = CanvasTexture::create(this); - addObject(o.get()); - return o; -} - -PassRefPtr CanvasRenderingContext3D::createProgram() -{ - RefPtr o = CanvasProgram::create(this); - addObject(o.get()); - return o; -} - -PassRefPtr CanvasRenderingContext3D::createRenderbuffer() -{ - RefPtr o = CanvasRenderbuffer::create(this); - addObject(o.get()); - return o; -} - -PassRefPtr CanvasRenderingContext3D::createShader(unsigned long type) -{ - // FIXME: Need to include GL_ constants for internal use - // FIXME: Need to do param checking and throw exception if an illegal value is passed in - GraphicsContext3D::ShaderType shaderType = GraphicsContext3D::VERTEX_SHADER; - if (type == 0x8B30) // GL_FRAGMENT_SHADER - shaderType = GraphicsContext3D::FRAGMENT_SHADER; - - RefPtr o = CanvasShader::create(this, shaderType); - addObject(o.get()); - return o; -} - -void CanvasRenderingContext3D::cullFace(unsigned long mode) -{ - m_context->cullFace(mode); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::deleteBuffer(CanvasBuffer* buffer) -{ - if (!buffer) - return; - - buffer->deleteObject(); -} - -void CanvasRenderingContext3D::deleteFramebuffer(CanvasFramebuffer* framebuffer) -{ - if (!framebuffer) - return; - - framebuffer->deleteObject(); -} - -void CanvasRenderingContext3D::deleteProgram(CanvasProgram* program) -{ - if (!program) - return; - - program->deleteObject(); -} - -void CanvasRenderingContext3D::deleteRenderbuffer(CanvasRenderbuffer* renderbuffer) -{ - if (!renderbuffer) - return; - - renderbuffer->deleteObject(); -} - -void CanvasRenderingContext3D::deleteShader(CanvasShader* shader) -{ - if (!shader) - return; - - shader->deleteObject(); -} - -void CanvasRenderingContext3D::deleteTexture(CanvasTexture* texture) -{ - if (!texture) - return; - - texture->deleteObject(); -} - -void CanvasRenderingContext3D::depthFunc(unsigned long func) -{ - m_context->depthFunc(func); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::depthMask(bool flag) -{ - m_context->depthMask(flag); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::depthRange(double zNear, double zFar) -{ - m_context->depthRange(zNear, zFar); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::detachShader(CanvasProgram* program, CanvasShader* shader) -{ - if (!program || !shader) - return; - - m_context->detachShader(program, shader); - cleanupAfterGraphicsCall(false); -} - - -void CanvasRenderingContext3D::disable(unsigned long cap) -{ - m_context->disable(cap); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::disableVertexAttribArray(unsigned long index) -{ - m_context->disableVertexAttribArray(index); - cleanupAfterGraphicsCall(false); -} - - -void CanvasRenderingContext3D::drawArrays(unsigned long mode, long first, long count) -{ - m_context->drawArrays(mode, first, count); - cleanupAfterGraphicsCall(true); -} - -void CanvasRenderingContext3D::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) -{ - m_context->drawElements(mode, count, type, offset); - cleanupAfterGraphicsCall(true); -} - -void CanvasRenderingContext3D::enable(unsigned long cap) -{ - m_context->enable(cap); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::enableVertexAttribArray(unsigned long index) -{ - m_context->enableVertexAttribArray(index); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::finish() -{ - m_context->finish(); - cleanupAfterGraphicsCall(true); -} - - -void CanvasRenderingContext3D::flush() -{ - m_context->flush(); - cleanupAfterGraphicsCall(true); -} - -void CanvasRenderingContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, CanvasRenderbuffer* buffer) -{ - if (!buffer) - return; - - m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, CanvasTexture* texture, long level) -{ - if (!texture) - return; - - m_context->framebufferTexture2D(target, attachment, textarget, texture, level); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::frontFace(unsigned long mode) -{ - m_context->frontFace(mode); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::generateMipmap(unsigned long target) -{ - m_context->generateMipmap(target); - cleanupAfterGraphicsCall(false); -} - -PassRefPtr CanvasRenderingContext3D::getActiveAttrib(CanvasProgram* program, unsigned long index, ExceptionCode& ec) -{ - ActiveInfo info; - if (!program || program->context() != this || !m_context->getActiveAttrib(program, index, info)) { - ec = INDEX_SIZE_ERR; - return 0; - } - return CanvasActiveInfo::create(info.name, info.type, info.size); -} - -PassRefPtr CanvasRenderingContext3D::getActiveUniform(CanvasProgram* program, unsigned long index, ExceptionCode& ec) -{ - ActiveInfo info; - if (!program || program->context() != this || !m_context->getActiveUniform(program, index, info)) { - ec = INDEX_SIZE_ERR; - return 0; - } - return CanvasActiveInfo::create(info.name, info.type, info.size); -} - -int CanvasRenderingContext3D::getAttribLocation(CanvasProgram* program, const String& name) -{ - return m_context->getAttribLocation(program, name); -} - -bool CanvasRenderingContext3D::getBoolean(unsigned long pname) -{ - bool result = m_context->getBoolean(pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getBooleanv(unsigned long pname) -{ - RefPtr array = m_context->getBooleanv(pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getBufferParameteri(unsigned long target, unsigned long pname) -{ - int result = m_context->getBufferParameteri(target, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getBufferParameteriv(unsigned long target, unsigned long pname) -{ - RefPtr array = m_context->getBufferParameteriv(target, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -unsigned long CanvasRenderingContext3D::getError() -{ - return m_context->getError(); -} - -float CanvasRenderingContext3D::getFloat(unsigned long pname) -{ - float result = m_context->getFloat(pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getFloatv(unsigned long pname) -{ - RefPtr array = m_context->getFloatv(pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname) -{ - int result = m_context->getFramebufferAttachmentParameteri(target, attachment, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname) -{ - RefPtr array = m_context->getFramebufferAttachmentParameteriv(target, attachment, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getInteger(unsigned long pname) -{ - float result = m_context->getInteger(pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getIntegerv(unsigned long pname) -{ - RefPtr array = m_context->getIntegerv(pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getProgrami(CanvasProgram* program, unsigned long pname) -{ - int result = m_context->getProgrami(program, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getProgramiv(CanvasProgram* program, unsigned long pname) -{ - RefPtr array = m_context->getProgramiv(program, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -String CanvasRenderingContext3D::getProgramInfoLog(CanvasProgram* program) -{ - String s = m_context->getProgramInfoLog(program); - cleanupAfterGraphicsCall(false); - return s; -} - -int CanvasRenderingContext3D::getRenderbufferParameteri(unsigned long target, unsigned long pname) -{ - int result = m_context->getRenderbufferParameteri(target, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getRenderbufferParameteriv(unsigned long target, unsigned long pname) -{ - RefPtr array = m_context->getRenderbufferParameteriv(target, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getShaderi(CanvasShader* shader, unsigned long pname) -{ - int result = m_context->getShaderi(shader, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getShaderiv(CanvasShader* shader, unsigned long pname) -{ - RefPtr array = m_context->getShaderiv(shader, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -String CanvasRenderingContext3D::getShaderInfoLog(CanvasShader* shader) -{ - String s = m_context->getShaderInfoLog(shader); - cleanupAfterGraphicsCall(false); - return s; -} - -String CanvasRenderingContext3D::getShaderSource(CanvasShader* shader) -{ - String s = m_context->getShaderSource(shader); - cleanupAfterGraphicsCall(false); - return s; -} - -String CanvasRenderingContext3D::getString(unsigned long name) -{ - return m_context->getString(name); -} - -float CanvasRenderingContext3D::getTexParameterf(unsigned long target, unsigned long pname) -{ - float result = m_context->getTexParameterf(target, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getTexParameterfv(unsigned long target, unsigned long pname) -{ - RefPtr array = m_context->getTexParameterfv(target, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -int CanvasRenderingContext3D::getTexParameteri(unsigned long target, unsigned long pname) -{ - int result = m_context->getTexParameteri(target, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getTexParameteriv(unsigned long target, unsigned long pname) -{ - RefPtr array = m_context->getTexParameteriv(target, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -float CanvasRenderingContext3D::getUniformf(CanvasProgram* program, long location) -{ - float result = m_context->getUniformf(program, location); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getUniformfv(CanvasProgram* program, long location) -{ - RefPtr array = m_context->getUniformfv(program, location); - cleanupAfterGraphicsCall(false); - return array; -} - -long CanvasRenderingContext3D::getUniformi(CanvasProgram* program, long location) -{ - long result = m_context->getUniformi(program, location); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getUniformiv(CanvasProgram* program, long location) -{ - RefPtr array = m_context->getUniformiv(program, location); - cleanupAfterGraphicsCall(false); - return array; -} - -long CanvasRenderingContext3D::getUniformLocation(CanvasProgram* program, const String& name) -{ - return m_context->getUniformLocation(program, name); -} - -float CanvasRenderingContext3D::getVertexAttribf(unsigned long index, unsigned long pname) -{ - float result = m_context->getVertexAttribf(index, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getVertexAttribfv(unsigned long index, unsigned long pname) -{ - RefPtr array = m_context->getVertexAttribfv(index, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -long CanvasRenderingContext3D::getVertexAttribi(unsigned long index, unsigned long pname) -{ - long result = m_context->getVertexAttribi(index, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -PassRefPtr CanvasRenderingContext3D::getVertexAttribiv(unsigned long index, unsigned long pname) -{ - RefPtr array = m_context->getVertexAttribiv(index, pname); - cleanupAfterGraphicsCall(false); - return array; -} - -long CanvasRenderingContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname) -{ - long result = m_context->getVertexAttribOffset(index, pname); - cleanupAfterGraphicsCall(false); - return result; -} - -void CanvasRenderingContext3D::hint(unsigned long target, unsigned long mode) -{ - m_context->hint(target, mode); - cleanupAfterGraphicsCall(false); -} - -bool CanvasRenderingContext3D::isBuffer(CanvasBuffer* buffer) -{ - if (!buffer) - return false; - - return m_context->isBuffer(buffer); -} - -bool CanvasRenderingContext3D::isEnabled(unsigned long cap) -{ - return m_context->isEnabled(cap); -} - -bool CanvasRenderingContext3D::isFramebuffer(CanvasFramebuffer* framebuffer) -{ - return m_context->isFramebuffer(framebuffer); -} - -bool CanvasRenderingContext3D::isProgram(CanvasProgram* program) -{ - return m_context->isProgram(program); -} - -bool CanvasRenderingContext3D::isRenderbuffer(CanvasRenderbuffer* renderbuffer) -{ - return m_context->isRenderbuffer(renderbuffer); -} - -bool CanvasRenderingContext3D::isShader(CanvasShader* shader) -{ - return m_context->isShader(shader); -} - -bool CanvasRenderingContext3D::isTexture(CanvasTexture* texture) -{ - return m_context->isTexture(texture); -} - -void CanvasRenderingContext3D::lineWidth(double width) -{ - m_context->lineWidth((float) width); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::linkProgram(CanvasProgram* program) -{ - if (!program) - return; - - m_context->linkProgram(program); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::pixelStorei(unsigned long pname, long param) -{ - m_context->pixelStorei(pname, param); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::polygonOffset(double factor, double units) -{ - m_context->polygonOffset((float) factor, (float) units); - cleanupAfterGraphicsCall(false); -} - -PassRefPtr CanvasRenderingContext3D::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) -{ - RefPtr array = m_context->readPixels(x, y, width, height, format, type); - cleanupAfterGraphicsCall(false); - return array; -} - -void CanvasRenderingContext3D::releaseShaderCompiler() -{ - m_context->releaseShaderCompiler(); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) -{ - m_context->renderbufferStorage(target, internalformat, width, height); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::sampleCoverage(double value, bool invert) -{ - m_context->sampleCoverage((float) value, invert); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::scissor(long x, long y, unsigned long width, unsigned long height) -{ - m_context->scissor(x, y, width, height); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::shaderSource(CanvasShader* shader, const String& string) -{ - m_context->shaderSource(shader, string); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask) -{ - m_context->stencilFunc(func, ref, mask); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) -{ - m_context->stencilFuncSeparate(face, func, ref, mask); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilMask(unsigned long mask) -{ - m_context->stencilMask(mask); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilMaskSeparate(unsigned long face, unsigned long mask) -{ - m_context->stencilMaskSeparate(face, mask); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) -{ - m_context->stencilOp(fail, zfail, zpass); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) -{ - m_context->stencilOpSeparate(face, fail, zfail, zpass); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsigned internalformat, - unsigned width, unsigned height, unsigned border, - unsigned format, unsigned type, CanvasArray* pixels, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texImage2D(target, level, internalformat, width, height, - border, format, type, pixels); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsigned internalformat, - unsigned width, unsigned height, unsigned border, - unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texImage2D(target, level, internalformat, width, height, - border, format, type, pixels); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texImage2D(target, level, image, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texImage2D(target, level, canvas, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texImage2D(target, level, video, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texParameterf(unsigned target, unsigned pname, float param) -{ - m_context->texParameterf(target, pname, param); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texParameteri(unsigned target, unsigned pname, int param) -{ - m_context->texParameteri(target, pname, param); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, - unsigned format, unsigned type, CanvasArray* pixels, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, - unsigned format, unsigned type, ImageData* pixels, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode& ec) -{ - // FIXME: For now we ignore any errors returned - ec = 0; - m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, video, flipY, premultiplyAlpha); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1f(long location, float x) -{ - m_context->uniform1f(location, x); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1fv(long location, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - m_context->uniform1fv(location, v->data(), v->length()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1fv(long location, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - m_context->uniform1fv(location, v, size); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1i(long location, int x) -{ - m_context->uniform1i(location, x); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1iv(long location, CanvasIntArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - m_context->uniform1iv(location, v->data(), v->length()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform1iv(long location, int* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - m_context->uniform1iv(location, v, size); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2f(long location, float x, float y) -{ - m_context->uniform2f(location, x, y); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2fv(long location, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 2 - m_context->uniform2fv(location, v->data(), v->length() / 2); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2fv(long location, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 2 - m_context->uniform2fv(location, v, size / 2); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2i(long location, int x, int y) -{ - m_context->uniform2i(location, x, y); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2iv(long location, CanvasIntArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 2 - m_context->uniform2iv(location, v->data(), v->length() / 2); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform2iv(long location, int* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 2 - m_context->uniform2iv(location, v, size / 2); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3f(long location, float x, float y, float z) -{ - m_context->uniform3f(location, x, y, z); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3fv(long location, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 3 - m_context->uniform3fv(location, v->data(), v->length() / 3); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3fv(long location, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 3 - m_context->uniform3fv(location, v, size / 3); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3i(long location, int x, int y, int z) -{ - m_context->uniform3i(location, x, y, z); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3iv(long location, CanvasIntArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 3 - m_context->uniform3iv(location, v->data(), v->length() / 3); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform3iv(long location, int* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 3 - m_context->uniform3iv(location, v, size / 3); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4f(long location, float x, float y, float z, float w) -{ - m_context->uniform4f(location, x, y, z, w); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4fv(long location, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniform4fv(location, v->data(), v->length() / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4fv(long location, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniform4fv(location, v, size / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4i(long location, int x, int y, int z, int w) -{ - m_context->uniform4i(location, x, y, z, w); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4iv(long location, CanvasIntArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniform4iv(location, v->data(), v->length() / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniform4iv(long location, int* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniform4iv(location, v, size / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniformMatrix2fv(location, transpose, v->data(), v->length() / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 4 - m_context->uniformMatrix2fv(location, transpose, v, size / 4); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 9 - m_context->uniformMatrix3fv(location, transpose, v->data(), v->length() / 9); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 9 - m_context->uniformMatrix3fv(location, transpose, v, size / 9); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, CanvasFloatArray* v) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 16 - m_context->uniformMatrix4fv(location, transpose, v->data(), v->length() / 16); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, float* v, int size) -{ - // FIXME: we need to throw if no array passed in - if (!v) - return; - - // FIXME: length needs to be a multiple of 16 - m_context->uniformMatrix4fv(location, transpose, v, size / 16); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::useProgram(CanvasProgram* program) -{ - m_context->useProgram(program); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::validateProgram(CanvasProgram* program) -{ - m_context->validateProgram(program); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib1f(unsigned long indx, float v0) -{ - m_context->vertexAttrib1f(indx, v0); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, CanvasFloatArray* v) -{ - // FIXME: Need to make sure array is big enough for attribute being set - m_context->vertexAttrib1fv(indx, v->data()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, float* v, int size) -{ - // FIXME: Need to make sure array is big enough for attribute being set - UNUSED_PARAM(size); - - m_context->vertexAttrib1fv(indx, v); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib2f(unsigned long indx, float v0, float v1) -{ - m_context->vertexAttrib2f(indx, v0, v1); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, CanvasFloatArray* v) -{ - // FIXME: Need to make sure array is big enough for attribute being set - m_context->vertexAttrib2fv(indx, v->data()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, float* v, int size) -{ - // FIXME: Need to make sure array is big enough for attribute being set - UNUSED_PARAM(size); - - m_context->vertexAttrib2fv(indx, v); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib3f(unsigned long indx, float v0, float v1, float v2) -{ - m_context->vertexAttrib3f(indx, v0, v1, v2); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, CanvasFloatArray* v) -{ - // FIXME: Need to make sure array is big enough for attribute being set - m_context->vertexAttrib3fv(indx, v->data()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, float* v, int size) -{ - // FIXME: Need to make sure array is big enough for attribute being set - UNUSED_PARAM(size); - - m_context->vertexAttrib3fv(indx, v); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib4f(unsigned long indx, float v0, float v1, float v2, float v3) -{ - m_context->vertexAttrib4f(indx, v0, v1, v2, v3); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, CanvasFloatArray* v) -{ - // FIXME: Need to make sure array is big enough for attribute being set - m_context->vertexAttrib4fv(indx, v->data()); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, float* v, int size) -{ - // FIXME: Need to make sure array is big enough for attribute being set - UNUSED_PARAM(size); - - m_context->vertexAttrib4fv(indx, v); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, unsigned long stride, unsigned long offset) -{ - m_context->vertexAttribPointer(indx, size, type, normalized, stride, offset); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::viewport(long x, long y, unsigned long width, unsigned long height) -{ - if (isnan(x)) - x = 0; - if (isnan(y)) - y = 0; - if (isnan(width)) - width = 100; - if (isnan(height)) - height = 100; - m_context->viewport(x, y, width, height); - cleanupAfterGraphicsCall(false); -} - -void CanvasRenderingContext3D::removeObject(CanvasObject* object) -{ - m_canvasObjects.remove(object); -} - -void CanvasRenderingContext3D::addObject(CanvasObject* object) -{ - removeObject(object); - m_canvasObjects.add(object); -} - -void CanvasRenderingContext3D::detachAndRemoveAllObjects() -{ - HashSet::iterator pend = m_canvasObjects.end(); - for (HashSet::iterator it = m_canvasObjects.begin(); it != pend; ++it) - (*it)->detachContext(); - - m_canvasObjects.clear(); -} - -} // namespace WebCore - -#endif // ENABLE(3D_CANVAS) - diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h deleted file mode 100644 index 70d9b95..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasRenderingContext3D_h -#define CanvasRenderingContext3D_h - -#include "CanvasRenderingContext.h" -#include "ExceptionCode.h" -#include "CanvasFloatArray.h" -#include "CanvasIntArray.h" -#include "CanvasUnsignedByteArray.h" -#include "GraphicsContext3D.h" -#include "PlatformString.h" - -namespace WebCore { - -class CanvasActiveInfo; -class CanvasBuffer; -class CanvasFramebuffer; -class CanvasObject; -class CanvasProgram; -class CanvasRenderbuffer; -class CanvasShader; -class CanvasTexture; -class HTMLImageElement; -class HTMLVideoElement; -class ImageData; -class WebKitCSSMatrix; - - class CanvasRenderingContext3D : public CanvasRenderingContext { - public: - static PassOwnPtr create(HTMLCanvasElement*); - virtual ~CanvasRenderingContext3D(); - - virtual bool is3d() const { return true; } - - // Helper to return the size in bytes of OpenGL data types - // like GL_FLOAT, GL_INT, etc. - int sizeInBytes(int type, ExceptionCode& ec); - - void activeTexture(unsigned long texture); - void attachShader(CanvasProgram*, CanvasShader*); - void bindAttribLocation(CanvasProgram*, unsigned long index, const String& name); - void bindBuffer(unsigned long target, CanvasBuffer*); - void bindFramebuffer(unsigned long target, CanvasFramebuffer*); - void bindRenderbuffer(unsigned long target, CanvasRenderbuffer*); - void bindTexture(unsigned long target, CanvasTexture*); - void blendColor(double red, double green, double blue, double alpha); - void blendEquation(unsigned long mode); - void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); - void blendFunc(unsigned long sfactor, unsigned long dfactor); - void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); - - void bufferData(unsigned long target, int size, unsigned long usage); - void bufferData(unsigned long target, CanvasArray* data, unsigned long usage); - void bufferSubData(unsigned long target, long offset, CanvasArray* data); - - unsigned long checkFramebufferStatus(unsigned long target); - void clear(unsigned long mask); - void clearColor(double red, double green, double blue, double alpha); - void clearDepth(double); - void clearStencil(long); - void colorMask(bool red, bool green, bool blue, bool alpha); - void compileShader(CanvasShader*); - - //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data); - //void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data); - - void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); - void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); - - PassRefPtr createBuffer(); - PassRefPtr createFramebuffer(); - PassRefPtr createProgram(); - PassRefPtr createRenderbuffer(); - PassRefPtr createShader(unsigned long type); - PassRefPtr createTexture(); - - void cullFace(unsigned long mode); - - void deleteBuffer(CanvasBuffer*); - void deleteFramebuffer(CanvasFramebuffer*); - void deleteProgram(CanvasProgram*); - void deleteRenderbuffer(CanvasRenderbuffer*); - void deleteShader(CanvasShader*); - void deleteTexture(CanvasTexture*); - - void depthFunc(unsigned long); - void depthMask(bool); - void depthRange(double zNear, double zFar); - void detachShader(CanvasProgram*, CanvasShader*); - void disable(unsigned long cap); - void disableVertexAttribArray(unsigned long index); - void drawArrays(unsigned long mode, long first, long count); - void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset); - - void enable(unsigned long cap); - void enableVertexAttribArray(unsigned long index); - void finish(); - void flush(); - void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, CanvasRenderbuffer*); - void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, CanvasTexture*, long level); - void frontFace(unsigned long mode); - void generateMipmap(unsigned long target); - - PassRefPtr getActiveAttrib(CanvasProgram*, unsigned long index, ExceptionCode&); - PassRefPtr getActiveUniform(CanvasProgram*, unsigned long index, ExceptionCode&); - - int getAttribLocation(CanvasProgram*, const String& name); - - bool getBoolean(unsigned long pname); - PassRefPtr getBooleanv(unsigned long pname); - int getBufferParameteri(unsigned long target, unsigned long pname); - PassRefPtr getBufferParameteriv(unsigned long target, unsigned long pname); - - unsigned long getError(); - - float getFloat(unsigned long pname); - PassRefPtr getFloatv(unsigned long pname); - int getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname); - PassRefPtr getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname); - int getInteger(unsigned long pname); - PassRefPtr getIntegerv(unsigned long pname); - int getProgrami(CanvasProgram*, unsigned long pname); - PassRefPtr getProgramiv(CanvasProgram*, unsigned long pname); - String getProgramInfoLog(CanvasProgram*); - int getRenderbufferParameteri(unsigned long target, unsigned long pname); - PassRefPtr getRenderbufferParameteriv(unsigned long target, unsigned long pname); - int getShaderi(CanvasShader*, unsigned long pname); - PassRefPtr getShaderiv(CanvasShader*, unsigned long pname); - - String getShaderInfoLog(CanvasShader*); - - // TBD - // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - - String getShaderSource(CanvasShader*); - String getString(unsigned long name); - - float getTexParameterf(unsigned long target, unsigned long pname); - PassRefPtr getTexParameterfv(unsigned long target, unsigned long pname); - int getTexParameteri(unsigned long target, unsigned long pname); - PassRefPtr getTexParameteriv(unsigned long target, unsigned long pname); - - float getUniformf(CanvasProgram* program, long location); - PassRefPtr getUniformfv(CanvasProgram* program, long location); - long getUniformi(CanvasProgram* program, long location); - PassRefPtr getUniformiv(CanvasProgram* program, long location); - - long getUniformLocation(CanvasProgram*, const String& name); - - float getVertexAttribf(unsigned long index, unsigned long pname); - PassRefPtr getVertexAttribfv(unsigned long index, unsigned long pname); - long getVertexAttribi(unsigned long index, unsigned long pname); - PassRefPtr getVertexAttribiv(unsigned long index, unsigned long pname); - - long getVertexAttribOffset(unsigned long index, unsigned long pname); - - void hint(unsigned long target, unsigned long mode); - bool isBuffer(CanvasBuffer*); - bool isEnabled(unsigned long cap); - bool isFramebuffer(CanvasFramebuffer*); - bool isProgram(CanvasProgram*); - bool isRenderbuffer(CanvasRenderbuffer*); - bool isShader(CanvasShader*); - bool isTexture(CanvasTexture*); - void lineWidth(double); - void linkProgram(CanvasProgram*); - void pixelStorei(unsigned long pname, long param); - void polygonOffset(double factor, double units); - - PassRefPtr readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type); - - void releaseShaderCompiler(); - void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); - void sampleCoverage(double value, bool invert); - void scissor(long x, long y, unsigned long width, unsigned long height); - void shaderSource(CanvasShader*, const String&); - void stencilFunc(unsigned long func, long ref, unsigned long mask); - void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); - void stencilMask(unsigned long); - void stencilMaskSeparate(unsigned long face, unsigned long mask); - void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); - void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); - - void texImage2D(unsigned target, unsigned level, unsigned internalformat, - unsigned width, unsigned height, unsigned border, - unsigned format, unsigned type, CanvasArray* pixels, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, unsigned internalformat, - unsigned width, unsigned height, unsigned border, - unsigned format, unsigned type, ImageData* pixels, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - - void texParameterf(unsigned target, unsigned pname, float param); - void texParameteri(unsigned target, unsigned pname, int param); - - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, - unsigned format, unsigned type, CanvasArray* pixels, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, - unsigned format, unsigned type, ImageData* pixels, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLImageElement* image, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLCanvasElement* canvas, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, - unsigned width, unsigned height, HTMLVideoElement* video, - bool flipY, bool premultiplyAlpha, ExceptionCode&); - - void uniform1f(long location, float x); - void uniform1fv(long location, CanvasFloatArray* v); - void uniform1fv(long location, float* v, int size); - void uniform1i(long location, int x); - void uniform1iv(long location, CanvasIntArray* v); - void uniform1iv(long location, int* v, int size); - void uniform2f(long location, float x, float y); - void uniform2fv(long location, CanvasFloatArray* v); - void uniform2fv(long location, float* v, int size); - void uniform2i(long location, int x, int y); - void uniform2iv(long location, CanvasIntArray* v); - void uniform2iv(long location, int* v, int size); - void uniform3f(long location, float x, float y, float z); - void uniform3fv(long location, CanvasFloatArray* v); - void uniform3fv(long location, float* v, int size); - void uniform3i(long location, int x, int y, int z); - void uniform3iv(long location, CanvasIntArray* v); - void uniform3iv(long location, int* v, int size); - void uniform4f(long location, float x, float y, float z, float w); - void uniform4fv(long location, CanvasFloatArray* v); - void uniform4fv(long location, float* v, int size); - void uniform4i(long location, int x, int y, int z, int w); - void uniform4iv(long location, CanvasIntArray* v); - void uniform4iv(long location, int* v, int size); - void uniformMatrix2fv(long location, bool transpose, CanvasFloatArray* value); - void uniformMatrix2fv(long location, bool transpose, float* value, int size); - void uniformMatrix3fv(long location, bool transpose, CanvasFloatArray* value); - void uniformMatrix3fv(long location, bool transpose, float* value, int size); - void uniformMatrix4fv(long location, bool transpose, CanvasFloatArray* value); - void uniformMatrix4fv(long location, bool transpose, float* value, int size); - - void useProgram(CanvasProgram*); - void validateProgram(CanvasProgram*); - - void vertexAttrib1f(unsigned long indx, float x); - void vertexAttrib1fv(unsigned long indx, CanvasFloatArray* values); - void vertexAttrib1fv(unsigned long indx, float* values, int size); - void vertexAttrib2f(unsigned long indx, float x, float y); - void vertexAttrib2fv(unsigned long indx, CanvasFloatArray* values); - void vertexAttrib2fv(unsigned long indx, float* values, int size); - void vertexAttrib3f(unsigned long indx, float x, float y, float z); - void vertexAttrib3fv(unsigned long indx, CanvasFloatArray* values); - void vertexAttrib3fv(unsigned long indx, float* values, int size); - void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); - void vertexAttrib4fv(unsigned long indx, CanvasFloatArray* values); - void vertexAttrib4fv(unsigned long indx, float* values, int size); - void vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, - unsigned long stride, unsigned long offset); - - void viewport(long x, long y, unsigned long width, unsigned long height); - - GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } - - void reshape(int width, int height); - - // Helpers for notification about paint events. - void beginPaint(); - void endPaint(); - - void removeObject(CanvasObject*); - - private: - friend class CanvasObject; - - CanvasRenderingContext3D(HTMLCanvasElement*, PassOwnPtr); - - void addObject(CanvasObject*); - void detachAndRemoveAllObjects(); - - void markContextChanged(); - void cleanupAfterGraphicsCall(bool changed) - { - m_context->checkError(); - if (changed) - markContextChanged(); - } - - OwnPtr m_context; - bool m_needsUpdate; - bool m_markedCanvasDirty; - // FIXME: I think this is broken -- it does not increment any - // reference counts, so may refer to destroyed objects. - HashSet m_canvasObjects; - }; - -} // namespace WebCore - -#endif diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.idl deleted file mode 100644 index db0fff3..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.idl +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - - interface [ - Conditional=3D_CANVAS, - GenerateConstructor, - InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443, - ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54 - ] CanvasRenderingContext3D : CanvasRenderingContext { - - /* ClearBufferMask */ - const unsigned int DEPTH_BUFFER_BIT = 0x00000100; - const unsigned int STENCIL_BUFFER_BIT = 0x00000400; - const unsigned int COLOR_BUFFER_BIT = 0x00004000; - - /* Boolean */ - const unsigned int FALSE = 0; - const unsigned int TRUE = 1; - - /* BeginMode */ - const unsigned int POINTS = 0x0000; - const unsigned int LINES = 0x0001; - const unsigned int LINE_LOOP = 0x0002; - const unsigned int LINE_STRIP = 0x0003; - const unsigned int TRIANGLES = 0x0004; - const unsigned int TRIANGLE_STRIP = 0x0005; - const unsigned int TRIANGLE_FAN = 0x0006; - - /* AlphaFunction (not supported in ES20) */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* BlendingFactorDest */ - const unsigned int ZERO = 0; - const unsigned int ONE = 1; - const unsigned int SRC_COLOR = 0x0300; - const unsigned int ONE_MINUS_SRC_COLOR = 0x0301; - const unsigned int SRC_ALPHA = 0x0302; - const unsigned int ONE_MINUS_SRC_ALPHA = 0x0303; - const unsigned int DST_ALPHA = 0x0304; - const unsigned int ONE_MINUS_DST_ALPHA = 0x0305; - - /* BlendingFactorSrc */ - /* ZERO */ - /* ONE */ - const unsigned int DST_COLOR = 0x0306; - const unsigned int ONE_MINUS_DST_COLOR = 0x0307; - const unsigned int SRC_ALPHA_SATURATE = 0x0308; - /* SRC_ALPHA */ - /* ONE_MINUS_SRC_ALPHA */ - /* DST_ALPHA */ - /* ONE_MINUS_DST_ALPHA */ - - /* BlendEquationSeparate */ - const unsigned int FUNC_ADD = 0x8006; - const unsigned int BLEND_EQUATION = 0x8009; - const unsigned int BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ - const unsigned int BLEND_EQUATION_ALPHA = 0x883D; - - /* BlendSubtract */ - const unsigned int FUNC_SUBTRACT = 0x800A; - const unsigned int FUNC_REVERSE_SUBTRACT = 0x800B; - - /* Separate Blend Functions */ - const unsigned int BLEND_DST_RGB = 0x80C8; - const unsigned int BLEND_SRC_RGB = 0x80C9; - const unsigned int BLEND_DST_ALPHA = 0x80CA; - const unsigned int BLEND_SRC_ALPHA = 0x80CB; - const unsigned int CONSTANT_COLOR = 0x8001; - const unsigned int ONE_MINUS_CONSTANT_COLOR = 0x8002; - const unsigned int CONSTANT_ALPHA = 0x8003; - const unsigned int ONE_MINUS_CONSTANT_ALPHA = 0x8004; - const unsigned int BLEND_COLOR = 0x8005; - - /* Buffer Objects */ - const unsigned int ARRAY_BUFFER = 0x8892; - const unsigned int ELEMENT_ARRAY_BUFFER = 0x8893; - const unsigned int ARRAY_BUFFER_BINDING = 0x8894; - const unsigned int ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - - const unsigned int STREAM_DRAW = 0x88E0; - const unsigned int STATIC_DRAW = 0x88E4; - const unsigned int DYNAMIC_DRAW = 0x88E8; - - const unsigned int BUFFER_SIZE = 0x8764; - const unsigned int BUFFER_USAGE = 0x8765; - - const unsigned int CURRENT_VERTEX_ATTRIB = 0x8626; - - /* CullFaceMode */ - const unsigned int FRONT = 0x0404; - const unsigned int BACK = 0x0405; - const unsigned int FRONT_AND_BACK = 0x0408; - - /* DepthFunction */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* EnableCap */ - const unsigned int TEXTURE_2D = 0x0DE1; - const unsigned int CULL_FACE = 0x0B44; - const unsigned int BLEND = 0x0BE2; - const unsigned int DITHER = 0x0BD0; - const unsigned int STENCIL_TEST = 0x0B90; - const unsigned int DEPTH_TEST = 0x0B71; - const unsigned int SCISSOR_TEST = 0x0C11; - const unsigned int POLYGON_OFFSET_FILL = 0x8037; - const unsigned int SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - const unsigned int SAMPLE_COVERAGE = 0x80A0; - - /* ErrorCode */ - const unsigned int NO_ERROR = 0; - const unsigned int INVALID_ENUM = 0x0500; - const unsigned int INVALID_VALUE = 0x0501; - const unsigned int INVALID_OPERATION = 0x0502; - const unsigned int OUT_OF_MEMORY = 0x0505; - - /* FrontFaceDirection */ - const unsigned int CW = 0x0900; - const unsigned int CCW = 0x0901; - - /* GetPName */ - const unsigned int LINE_WIDTH = 0x0B21; - const unsigned int ALIASED_POINT_SIZE_RANGE = 0x846D; - const unsigned int ALIASED_LINE_WIDTH_RANGE = 0x846E; - const unsigned int CULL_FACE_MODE = 0x0B45; - const unsigned int FRONT_FACE = 0x0B46; - const unsigned int DEPTH_RANGE = 0x0B70; - const unsigned int DEPTH_WRITEMASK = 0x0B72; - const unsigned int DEPTH_CLEAR_VALUE = 0x0B73; - const unsigned int DEPTH_FUNC = 0x0B74; - const unsigned int STENCIL_CLEAR_VALUE = 0x0B91; - const unsigned int STENCIL_FUNC = 0x0B92; - const unsigned int STENCIL_FAIL = 0x0B94; - const unsigned int STENCIL_PASS_DEPTH_FAIL = 0x0B95; - const unsigned int STENCIL_PASS_DEPTH_PASS = 0x0B96; - const unsigned int STENCIL_REF = 0x0B97; - const unsigned int STENCIL_VALUE_MASK = 0x0B93; - const unsigned int STENCIL_WRITEMASK = 0x0B98; - const unsigned int STENCIL_BACK_FUNC = 0x8800; - const unsigned int STENCIL_BACK_FAIL = 0x8801; - const unsigned int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - const unsigned int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - const unsigned int STENCIL_BACK_REF = 0x8CA3; - const unsigned int STENCIL_BACK_VALUE_MASK = 0x8CA4; - const unsigned int STENCIL_BACK_WRITEMASK = 0x8CA5; - const unsigned int VIEWPORT = 0x0BA2; - const unsigned int SCISSOR_BOX = 0x0C10; - /* SCISSOR_TEST */ - const unsigned int COLOR_CLEAR_VALUE = 0x0C22; - const unsigned int COLOR_WRITEMASK = 0x0C23; - const unsigned int UNPACK_ALIGNMENT = 0x0CF5; - const unsigned int PACK_ALIGNMENT = 0x0D05; - const unsigned int MAX_TEXTURE_SIZE = 0x0D33; - const unsigned int MAX_VIEWPORT_DIMS = 0x0D3A; - const unsigned int SUBPIXEL_BITS = 0x0D50; - const unsigned int RED_BITS = 0x0D52; - const unsigned int GREEN_BITS = 0x0D53; - const unsigned int BLUE_BITS = 0x0D54; - const unsigned int ALPHA_BITS = 0x0D55; - const unsigned int DEPTH_BITS = 0x0D56; - const unsigned int STENCIL_BITS = 0x0D57; - const unsigned int POLYGON_OFFSET_UNITS = 0x2A00; - /* POLYGON_OFFSET_FILL */ - const unsigned int POLYGON_OFFSET_FACTOR = 0x8038; - const unsigned int TEXTURE_BINDING_2D = 0x8069; - const unsigned int SAMPLE_BUFFERS = 0x80A8; - const unsigned int SAMPLES = 0x80A9; - const unsigned int SAMPLE_COVERAGE_VALUE = 0x80AA; - const unsigned int SAMPLE_COVERAGE_INVERT = 0x80AB; - - /* GetTextureParameter */ - /* TEXTURE_MAG_FILTER */ - /* TEXTURE_MIN_FILTER */ - /* TEXTURE_WRAP_S */ - /* TEXTURE_WRAP_T */ - - const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; - const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; - - /* HintMode */ - const unsigned int DONT_CARE = 0x1100; - const unsigned int FASTEST = 0x1101; - const unsigned int NICEST = 0x1102; - - /* HintTarget */ - const unsigned int GENERATE_MIPMAP_HINT = 0x8192; - - /* DataType */ - const unsigned int BYTE = 0x1400; - const unsigned int UNSIGNED_BYTE = 0x1401; - const unsigned int SHORT = 0x1402; - const unsigned int UNSIGNED_SHORT = 0x1403; - const unsigned int INT = 0x1404; - const unsigned int UNSIGNED_INT = 0x1405; - const unsigned int FLOAT = 0x1406; - const unsigned int FIXED = 0x140C; - - /* PixelFormat */ - const unsigned int DEPTH_COMPONENT = 0x1902; - const unsigned int ALPHA = 0x1906; - const unsigned int RGB = 0x1907; - const unsigned int RGBA = 0x1908; - const unsigned int LUMINANCE = 0x1909; - const unsigned int LUMINANCE_ALPHA = 0x190A; - - /* PixelType */ - /* UNSIGNED_BYTE */ - const unsigned int UNSIGNED_SHORT_4_4_4_4 = 0x8033; - const unsigned int UNSIGNED_SHORT_5_5_5_1 = 0x8034; - const unsigned int UNSIGNED_SHORT_5_6_5 = 0x8363; - - /* Shaders */ - const unsigned int FRAGMENT_SHADER = 0x8B30; - const unsigned int VERTEX_SHADER = 0x8B31; - const unsigned int MAX_VERTEX_ATTRIBS = 0x8869; - const unsigned int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - const unsigned int MAX_VARYING_VECTORS = 0x8DFC; - const unsigned int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - const unsigned int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - const unsigned int MAX_TEXTURE_IMAGE_UNITS = 0x8872; - const unsigned int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - const unsigned int SHADER_TYPE = 0x8B4F; - const unsigned int DELETE_STATUS = 0x8B80; - const unsigned int LINK_STATUS = 0x8B82; - const unsigned int VALIDATE_STATUS = 0x8B83; - const unsigned int ATTACHED_SHADERS = 0x8B85; - const unsigned int ACTIVE_UNIFORMS = 0x8B86; - const unsigned int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; - const unsigned int ACTIVE_ATTRIBUTES = 0x8B89; - const unsigned int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; - const unsigned int SHADING_LANGUAGE_VERSION = 0x8B8C; - const unsigned int CURRENT_PROGRAM = 0x8B8D; - - /* StencilFunction */ - const unsigned int NEVER = 0x0200; - const unsigned int LESS = 0x0201; - const unsigned int EQUAL = 0x0202; - const unsigned int LEQUAL = 0x0203; - const unsigned int GREATER = 0x0204; - const unsigned int NOTEQUAL = 0x0205; - const unsigned int GEQUAL = 0x0206; - const unsigned int ALWAYS = 0x0207; - - /* StencilOp */ - /* ZERO */ - const unsigned int KEEP = 0x1E00; - const unsigned int REPLACE = 0x1E01; - const unsigned int INCR = 0x1E02; - const unsigned int DECR = 0x1E03; - const unsigned int INVERT = 0x150A; - const unsigned int INCR_WRAP = 0x8507; - const unsigned int DECR_WRAP = 0x8508; - - /* StringName */ - const unsigned int VENDOR = 0x1F00; - const unsigned int RENDERER = 0x1F01; - const unsigned int VERSION = 0x1F02; - const unsigned int EXTENSIONS = 0x1F03; - - /* TextureMagFilter */ - const unsigned int NEAREST = 0x2600; - const unsigned int LINEAR = 0x2601; - - /* TextureMinFilter */ - /* NEAREST */ - /* LINEAR */ - const unsigned int NEAREST_MIPMAP_NEAREST = 0x2700; - const unsigned int LINEAR_MIPMAP_NEAREST = 0x2701; - const unsigned int NEAREST_MIPMAP_LINEAR = 0x2702; - const unsigned int LINEAR_MIPMAP_LINEAR = 0x2703; - - /* TextureParameterName */ - const unsigned int TEXTURE_MAG_FILTER = 0x2800; - const unsigned int TEXTURE_MIN_FILTER = 0x2801; - const unsigned int TEXTURE_WRAP_S = 0x2802; - const unsigned int TEXTURE_WRAP_T = 0x2803; - - /* TextureTarget */ - /* TEXTURE_2D */ - const unsigned int TEXTURE = 0x1702; - - const unsigned int TEXTURE_CUBE_MAP = 0x8513; - const unsigned int TEXTURE_BINDING_CUBE_MAP = 0x8514; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - const unsigned int MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - - /* TextureUnit */ - const unsigned int TEXTURE0 = 0x84C0; - const unsigned int TEXTURE1 = 0x84C1; - const unsigned int TEXTURE2 = 0x84C2; - const unsigned int TEXTURE3 = 0x84C3; - const unsigned int TEXTURE4 = 0x84C4; - const unsigned int TEXTURE5 = 0x84C5; - const unsigned int TEXTURE6 = 0x84C6; - const unsigned int TEXTURE7 = 0x84C7; - const unsigned int TEXTURE8 = 0x84C8; - const unsigned int TEXTURE9 = 0x84C9; - const unsigned int TEXTURE10 = 0x84CA; - const unsigned int TEXTURE11 = 0x84CB; - const unsigned int TEXTURE12 = 0x84CC; - const unsigned int TEXTURE13 = 0x84CD; - const unsigned int TEXTURE14 = 0x84CE; - const unsigned int TEXTURE15 = 0x84CF; - const unsigned int TEXTURE16 = 0x84D0; - const unsigned int TEXTURE17 = 0x84D1; - const unsigned int TEXTURE18 = 0x84D2; - const unsigned int TEXTURE19 = 0x84D3; - const unsigned int TEXTURE20 = 0x84D4; - const unsigned int TEXTURE21 = 0x84D5; - const unsigned int TEXTURE22 = 0x84D6; - const unsigned int TEXTURE23 = 0x84D7; - const unsigned int TEXTURE24 = 0x84D8; - const unsigned int TEXTURE25 = 0x84D9; - const unsigned int TEXTURE26 = 0x84DA; - const unsigned int TEXTURE27 = 0x84DB; - const unsigned int TEXTURE28 = 0x84DC; - const unsigned int TEXTURE29 = 0x84DD; - const unsigned int TEXTURE30 = 0x84DE; - const unsigned int TEXTURE31 = 0x84DF; - const unsigned int ACTIVE_TEXTURE = 0x84E0; - - /* TextureWrapMode */ - const unsigned int REPEAT = 0x2901; - const unsigned int CLAMP_TO_EDGE = 0x812F; - const unsigned int MIRRORED_REPEAT = 0x8370; - - /* Uniform Types */ - const unsigned int FLOAT_VEC2 = 0x8B50; - const unsigned int FLOAT_VEC3 = 0x8B51; - const unsigned int FLOAT_VEC4 = 0x8B52; - const unsigned int INT_VEC2 = 0x8B53; - const unsigned int INT_VEC3 = 0x8B54; - const unsigned int INT_VEC4 = 0x8B55; - const unsigned int BOOL = 0x8B56; - const unsigned int BOOL_VEC2 = 0x8B57; - const unsigned int BOOL_VEC3 = 0x8B58; - const unsigned int BOOL_VEC4 = 0x8B59; - const unsigned int FLOAT_MAT2 = 0x8B5A; - const unsigned int FLOAT_MAT3 = 0x8B5B; - const unsigned int FLOAT_MAT4 = 0x8B5C; - const unsigned int SAMPLER_2D = 0x8B5E; - const unsigned int SAMPLER_CUBE = 0x8B60; - - /* Vertex Arrays */ - const unsigned int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - const unsigned int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - const unsigned int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - const unsigned int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - const unsigned int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - const unsigned int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - const unsigned int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; - - /* Read Format */ - const unsigned int IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; - const unsigned int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; - - /* Shader Source */ - const unsigned int COMPILE_STATUS = 0x8B81; - const unsigned int INFO_LOG_LENGTH = 0x8B84; - const unsigned int SHADER_SOURCE_LENGTH = 0x8B88; - const unsigned int SHADER_COMPILER = 0x8DFA; - - /* Shader Binary */ - const unsigned int SHADER_BINARY_FORMATS = 0x8DF8; - const unsigned int NUM_SHADER_BINARY_FORMATS = 0x8DF9; - - /* Shader Precision-Specified Types */ - const unsigned int LOW_FLOAT = 0x8DF0; - const unsigned int MEDIUM_FLOAT = 0x8DF1; - const unsigned int HIGH_FLOAT = 0x8DF2; - const unsigned int LOW_INT = 0x8DF3; - const unsigned int MEDIUM_INT = 0x8DF4; - const unsigned int HIGH_INT = 0x8DF5; - - /* Framebuffer Object. */ - const unsigned int FRAMEBUFFER = 0x8D40; - const unsigned int RENDERBUFFER = 0x8D41; - - const unsigned int RGBA4 = 0x8056; - const unsigned int RGB5_A1 = 0x8057; - const unsigned int RGB565 = 0x8D62; - const unsigned int DEPTH_COMPONENT16 = 0x81A5; - const unsigned int STENCIL_INDEX = 0x1901; - const unsigned int STENCIL_INDEX8 = 0x8D48; - - const unsigned int RENDERBUFFER_WIDTH = 0x8D42; - const unsigned int RENDERBUFFER_HEIGHT = 0x8D43; - const unsigned int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - const unsigned int RENDERBUFFER_RED_SIZE = 0x8D50; - const unsigned int RENDERBUFFER_GREEN_SIZE = 0x8D51; - const unsigned int RENDERBUFFER_BLUE_SIZE = 0x8D52; - const unsigned int RENDERBUFFER_ALPHA_SIZE = 0x8D53; - const unsigned int RENDERBUFFER_DEPTH_SIZE = 0x8D54; - const unsigned int RENDERBUFFER_STENCIL_SIZE = 0x8D55; - - const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - - const unsigned int COLOR_ATTACHMENT0 = 0x8CE0; - const unsigned int DEPTH_ATTACHMENT = 0x8D00; - const unsigned int STENCIL_ATTACHMENT = 0x8D20; - - const unsigned int NONE = 0; - - const unsigned int FRAMEBUFFER_COMPLETE = 0x8CD5; - const unsigned int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - const unsigned int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - const unsigned int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; - const unsigned int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - - const unsigned int FRAMEBUFFER_BINDING = 0x8CA6; - const unsigned int RENDERBUFFER_BINDING = 0x8CA7; - const unsigned int MAX_RENDERBUFFER_SIZE = 0x84E8; - - const unsigned int INVALID_FRAMEBUFFER_OPERATION = 0x0506; - - long sizeInBytes(in unsigned long type) raises(DOMException); - - void activeTexture(in unsigned long texture); - void attachShader(in CanvasProgram program, in CanvasShader shader); - void bindAttribLocation(in CanvasProgram program, in unsigned long index, in DOMString name); - void bindBuffer(in unsigned long target, in CanvasBuffer buffer); - void bindFramebuffer(in unsigned long target, in CanvasFramebuffer framebuffer); - void bindRenderbuffer(in unsigned long target, in CanvasRenderbuffer renderbuffer); - void bindTexture(in unsigned long target, in CanvasTexture texture); - void blendColor(in double red, in double green, in double blue, in double alpha); - void blendEquation( in unsigned long mode ); - void blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha); - void blendFunc(in unsigned long sfactor, in unsigned long dfactor); - void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); - // Supported forms: - // void bufferData (in GLenum target, in GLsizei size, in GLenum usage); - // void bufferData (in GLenum target, in CanvasArray data, in GLenum usage); - [Custom] void bufferData(); - // Supported forms: - // void bufferSubData (in GLenum target, in GLsizeiptr offset, in CanvasArray data); - [Custom] void bufferSubData(); - - unsigned long checkFramebufferStatus(in unsigned long target); - void clear(in unsigned long mask); - void clearColor(in double red, in double green, in double blue, in double alpha); - void clearDepth(in double depth); - void clearStencil(in long s); - void colorMask(in boolean red, in boolean green, in boolean blue, in boolean alpha); - void compileShader(in CanvasShader shader); - - //void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in unsigned long width, in unsigned long height, in long border, in unsigned long imageSize, const void* data); - //void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long imageSize, const void* data); - - void copyTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long x, in long y, in unsigned long width, in unsigned long height, in long border); - void copyTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long x, in long y, in unsigned long width, in unsigned long height); - - CanvasBuffer createBuffer(); - CanvasFramebuffer createFramebuffer(); - CanvasProgram createProgram(); - CanvasRenderbuffer createRenderbuffer(); - CanvasShader createShader(in unsigned long type); - CanvasTexture createTexture(); - - void cullFace(in unsigned long mode); - - void deleteBuffer(in CanvasBuffer buffer); - void deleteFramebuffer(in CanvasFramebuffer framebuffer); - void deleteProgram(in CanvasProgram program); - void deleteRenderbuffer(in CanvasRenderbuffer renderbuffer); - void deleteShader(in CanvasShader shader); - void deleteTexture(in CanvasTexture texture); - - void depthFunc(in unsigned long func); - void depthMask(in boolean flag); - // FIXME: this differs from the current WebGL spec (depthRangef) - void depthRange(in double zNear, in double zFar); - void detachShader(in CanvasProgram program, in CanvasShader shader); - void disable(in unsigned long cap); - void disableVertexAttribArray(in unsigned long index); - void drawArrays(in unsigned long mode, in long first, in unsigned long count); - void drawElements (in unsigned long mode, in long count, in unsigned long type, in unsigned long offset); - - void enable(in unsigned long cap); - void enableVertexAttribArray(in unsigned long index); - void finish(); - void flush(); - void framebufferRenderbuffer(in unsigned long target, in unsigned long attachment, in unsigned long renderbuffertarget, in CanvasRenderbuffer renderbuffer); - void framebufferTexture2D(in unsigned long target, in unsigned long attachment, in unsigned long textarget, in CanvasTexture texture, in long level); - void frontFace(in unsigned long mode); - void generateMipmap(in unsigned long target); - - // FIXME: these need to be added per the WebGL spec - CanvasActiveInfo getActiveAttrib(in CanvasProgram program, in unsigned long index) - raises (DOMException); - CanvasActiveInfo getActiveUniform(in CanvasProgram program, in unsigned long index) - raises (DOMException); - - // CanvasShaderArray glGetAttachedShaders(GLuint program); - - int getAttribLocation(in CanvasProgram program, in DOMString name); - - boolean getBoolean(in unsigned long pname); - CanvasUnsignedByteArray getBooleanv(in unsigned long pname); - long getBufferParameteri(in unsigned long target, in unsigned long pname); - CanvasIntArray getBufferParameteriv(in unsigned long target, in unsigned long pname); - - unsigned long getError(); - - float getFloat(in unsigned long pname); - CanvasFloatArray getFloatv(in unsigned long pname); - long getFramebufferAttachmentParameteri(in unsigned long target, in unsigned long attachment, in unsigned long pname); - CanvasIntArray getFramebufferAttachmentParameteriv(in unsigned long target, in unsigned long attachment, in unsigned long pname); - long getInteger(in unsigned long pname); - CanvasIntArray getIntegerv(in unsigned long pname); - long getProgrami(in CanvasProgram program, in unsigned long pname); - CanvasIntArray getProgramiv(in CanvasProgram program, in unsigned long pname); - DOMString getProgramInfoLog(in CanvasProgram program); - long getRenderbufferParameteri(in unsigned long target, in unsigned long pname); - CanvasIntArray getRenderbufferParameteriv(in unsigned long target, in unsigned long pname); - long getShaderi(in CanvasShader shader, in unsigned long pname); - CanvasIntArray getShaderiv(in CanvasShader shader, in unsigned long pname); - - DOMString getShaderInfoLog(in CanvasShader shader); - - // TBD - // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - - DOMString getShaderSource(in CanvasShader shader); - DOMString getString(in unsigned long name); - - float getTexParameterf(in unsigned long target, in unsigned long pname); - CanvasFloatArray getTexParameterfv(in unsigned long target, in unsigned long pname); - long getTexParameteri(in unsigned long target, in unsigned long pname); - CanvasIntArray getTexParameteriv(in unsigned long target, in unsigned long pname); - - float getUniformf(in CanvasProgram program, in long location); - CanvasFloatArray getUniformfv(in CanvasProgram program, in long location); - long getUniformi(in CanvasProgram program, in long location); - CanvasIntArray getUniformiv(in CanvasProgram program, in long location); - - long getUniformLocation(in CanvasProgram program, in DOMString name); - - float getVertexAttribf(in unsigned long index, in unsigned long pname); - CanvasFloatArray getVertexAttribfv(in unsigned long index, in unsigned long pname); - long getVertexAttribi(in unsigned long index, in unsigned long pname); - CanvasIntArray getVertexAttribiv(in unsigned long index, in unsigned long pname); - - long getVertexAttribOffset(in unsigned long index, in unsigned long pname); - - void hint(in unsigned long target, in unsigned long mode); - boolean isBuffer(in CanvasBuffer buffer); - boolean isEnabled(in unsigned long cap); - boolean isFramebuffer(in CanvasFramebuffer framebuffer); - boolean isProgram(in CanvasProgram program); - boolean isRenderbuffer(in CanvasRenderbuffer renderbuffer); - boolean isShader(in CanvasShader shader); - boolean isTexture(in CanvasTexture texture); - void lineWidth(in double width); - void linkProgram(in CanvasProgram program); - void pixelStorei(in unsigned long pname, in long param); - void polygonOffset(in double factor, in double units); - - CanvasArray readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type); - - void releaseShaderCompiler(); - void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in unsigned long width, in unsigned long height); - void sampleCoverage(in double value, in boolean invert); - void scissor(in long x, in long y, in unsigned long width, in unsigned long height); - void shaderSource(in CanvasShader shader, in DOMString string); - void stencilFunc(in unsigned long func, in long ref, in unsigned long mask); - void stencilFuncSeparate(in unsigned long face, in unsigned long func, in long ref, in unsigned long mask); - void stencilMask(in unsigned long mask); - void stencilMaskSeparate(in unsigned long face, in unsigned long mask); - void stencilOp(in unsigned long fail, in unsigned long zfail, in unsigned long zpass); - void stencilOpSeparate(in unsigned long face, in unsigned long fail, in unsigned long zfail, in unsigned long zpass); - - void texParameterf(in unsigned long target, in unsigned long pname, in float param); - void texParameteri(in unsigned long target, in unsigned long pname, in long param); - - // Supported forms: - // void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, - // in GLint border, in GLenum format, in GLenum type, in CanvasArray pixels); - // void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, - // in GLint border, in GLenum format, in GLenum type, in ImageData pixels); - // void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - // void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - // void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, - // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); - [Custom] void texImage2D(); - - // Supported forms: - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, - // in GLenum format, in GLenum type, in CanvasArray pixels); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, - // in GLenum format, in GLenum type, in ImageData pixels); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, in HTMLImageElement image, - // [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, in HTMLCanvasElement canvas, - // [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, - // in GLsizei width, in GLsizei height, in HTMLVideoElement video, - // [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); - [Custom] void texSubImage2D(); - - void uniform1f(in long location, in float x); - [Custom] void uniform1fv(in long location, in CanvasFloatArray v); - void uniform1i(in long location, in long x); - [Custom] void uniform1iv(in long location, in CanvasIntArray v); - void uniform2f(in long location, in float x, in float y); - [Custom] void uniform2fv(in long location, in CanvasFloatArray v); - void uniform2i(in long location, in long x, in long y); - [Custom] void uniform2iv(in long location, in CanvasIntArray v); - void uniform3f(in long location, in float x, in float y, in float z); - [Custom] void uniform3fv(in long location, in CanvasFloatArray v); - void uniform3i(in long location, in long x, in long y, in long z); - [Custom] void uniform3iv(in long location, in CanvasIntArray v); - void uniform4f(in long location, in float x, in float y, in float z, in float w); - [Custom] void uniform4fv(in long location, in CanvasFloatArray v); - void uniform4i(in long location, in long x, in long y, in long z, in long w); - [Custom] void uniform4iv(in long location, in CanvasIntArray v); - - [Custom] void uniformMatrix2fv(in long location, in boolean transpose, in CanvasFloatArray array); - [Custom] void uniformMatrix3fv(in long location, in boolean transpose, in CanvasFloatArray array); - [Custom] void uniformMatrix4fv(in long location, in boolean transpose, in CanvasFloatArray array); - - void useProgram(in CanvasProgram program); - void validateProgram(in CanvasProgram program); - - void vertexAttrib1f(in unsigned long indx, in float x); - [Custom] void vertexAttrib1fv(in unsigned long indx, in CanvasFloatArray values); - void vertexAttrib2f(in unsigned long indx, in float x, in float y); - [Custom] void vertexAttrib2fv(in unsigned long indx, in CanvasFloatArray values); - void vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z); - [Custom] void vertexAttrib3fv(in unsigned long indx, in CanvasFloatArray values); - void vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w); - [Custom] void vertexAttrib4fv(in unsigned long indx, in CanvasFloatArray values); - void vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, - in long stride, in unsigned long offset); - - void viewport(in long x, in long y, in unsigned long width, in unsigned long height); - }; -} - diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.cpp deleted file mode 100644 index 7f134fa..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasShader.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasShader::create(CanvasRenderingContext3D* ctx, GraphicsContext3D::ShaderType type) -{ - return adoptRef(new CanvasShader(ctx, type)); -} - -CanvasShader::CanvasShader(CanvasRenderingContext3D* ctx, GraphicsContext3D::ShaderType type) - : CanvasObject(ctx) -{ - setObject(context()->graphicsContext3D()->createShader(type)); -} - -void CanvasShader::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteShader(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.h deleted file mode 100644 index bb7980e..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasShader_h -#define CanvasShader_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasShader : public CanvasObject { - public: - virtual ~CanvasShader() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*, GraphicsContext3D::ShaderType); - - private: - CanvasShader(CanvasRenderingContext3D*, GraphicsContext3D::ShaderType); - - virtual void _deleteObject(Platform3DObject); - }; - -} // namespace WebCore - -#endif // CanvasShader_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.idl deleted file mode 100644 index 7474c3a..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShader.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasShader { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.cpp deleted file mode 100644 index d0cf135..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasShortArray.h" - -namespace WebCore { - - PassRefPtr CanvasShortArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(short)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasShortArray::create(short* array, unsigned length) - { - RefPtr a = CanvasShortArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasShortArray::create(PassRefPtr buffer, - int offset, - unsigned length) - { - // Make sure the offset results in valid alignment. - if ((offset % sizeof(short)) != 0) - return NULL; - - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(short))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasShortArray(buffer, offset, length)); - } - - CanvasShortArray::CanvasShortArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasShortArray::length() const { - return m_size; - } - - unsigned CanvasShortArray::sizeInBytes() const { - return length() * sizeof(short); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.h deleted file mode 100644 index 1eeef0c..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasShortArray_h -#define CanvasShortArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasShortArray : public CanvasArray { - public: - virtual bool isShortArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(short* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - short* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - short* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, short& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - short item(unsigned index) const - { - ASSERT(index < m_size); - short* storage = static_cast(m_baseAddress); - return storage[index]; - } - - private: - CanvasShortArray(PassRefPtr buffer, int offset, unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasShortArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.idl deleted file mode 100644 index 6d64e1c..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasShortArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasShortArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.cpp index 946cac7..5352473 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasStyle.cpp @@ -114,33 +114,33 @@ void CanvasStyle::applyStrokeColor(GraphicsContext* context) case ColorString: { Color c = Color(m_color); if (c.isValid()) { - context->setStrokeColor(c.rgb()); + context->setStrokeColor(c.rgb(), DeviceColorSpace); break; } RGBA32 color = 0; // default is transparent black if (CSSParser::parseColor(color, m_color)) - context->setStrokeColor(color); + context->setStrokeColor(color, DeviceColorSpace); break; } case ColorStringWithAlpha: { Color c = Color(m_color); if (c.isValid()) { - context->setStrokeColor(colorWithOverrideAlpha(c.rgb(), m_alpha)); + context->setStrokeColor(colorWithOverrideAlpha(c.rgb(), m_alpha), DeviceColorSpace); break; } RGBA32 color = 0; // default is transparent black if (CSSParser::parseColor(color, m_color)) - context->setStrokeColor(colorWithOverrideAlpha(color, m_alpha)); + context->setStrokeColor(colorWithOverrideAlpha(color, m_alpha), DeviceColorSpace); break; } case GrayLevel: // We're only supporting 255 levels of gray here. Since this isn't // even part of HTML5, I don't expect anyone will care. If they do // we'll make a fancier Color abstraction. - context->setStrokeColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha)); + context->setStrokeColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha), DeviceColorSpace); break; case RGBA: - context->setStrokeColor(Color(m_red, m_green, m_blue, m_alpha)); + context->setStrokeColor(Color(m_red, m_green, m_blue, m_alpha), DeviceColorSpace); break; case CMYKA: { // FIXME: Do this through platform-independent GraphicsContext API. @@ -154,7 +154,7 @@ void CanvasStyle::applyStrokeColor(GraphicsContext* context) currentPen.setColor(clr); context->platformContext()->setPen(currentPen); #else - context->setStrokeColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha)); + context->setStrokeColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha), DeviceColorSpace); #endif break; } @@ -175,33 +175,33 @@ void CanvasStyle::applyFillColor(GraphicsContext* context) case ColorString: { Color c = Color(m_color); if (c.isValid()) { - context->setFillColor(c.rgb()); + context->setFillColor(c.rgb(), DeviceColorSpace); break; } RGBA32 rgba = 0; // default is transparent black if (CSSParser::parseColor(rgba, m_color)) - context->setFillColor(rgba); + context->setFillColor(rgba, DeviceColorSpace); break; } case ColorStringWithAlpha: { Color c = Color(m_color); if (c.isValid()) { - context->setFillColor(colorWithOverrideAlpha(c.rgb(), m_alpha)); + context->setFillColor(colorWithOverrideAlpha(c.rgb(), m_alpha), DeviceColorSpace); break; } RGBA32 color = 0; // default is transparent black if (CSSParser::parseColor(color, m_color)) - context->setFillColor(colorWithOverrideAlpha(color, m_alpha)); + context->setFillColor(colorWithOverrideAlpha(color, m_alpha), DeviceColorSpace); break; } case GrayLevel: // We're only supporting 255 levels of gray here. Since this isn't // even part of HTML5, I don't expect anyone will care. If they do // we'll make a fancier Color abstraction. - context->setFillColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha)); + context->setFillColor(Color(m_grayLevel, m_grayLevel, m_grayLevel, m_alpha), DeviceColorSpace); break; case RGBA: - context->setFillColor(Color(m_red, m_green, m_blue, m_alpha)); + context->setFillColor(Color(m_red, m_green, m_blue, m_alpha), DeviceColorSpace); break; case CMYKA: { // FIXME: Do this through platform-independent GraphicsContext API. @@ -215,7 +215,7 @@ void CanvasStyle::applyFillColor(GraphicsContext* context) currentBrush.setColor(clr); context->platformContext()->setBrush(currentBrush); #else - context->setFillColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha)); + context->setFillColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_alpha), DeviceColorSpace); #endif break; } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.cpp deleted file mode 100644 index 624c275..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasTexture.h" -#include "CanvasRenderingContext3D.h" - -namespace WebCore { - -PassRefPtr CanvasTexture::create(CanvasRenderingContext3D* ctx) -{ - return adoptRef(new CanvasTexture(ctx)); -} - -CanvasTexture::CanvasTexture(CanvasRenderingContext3D* ctx) - : CanvasObject(ctx) - , cubeMapRWrapModeInitialized(false) -{ - setObject(context()->graphicsContext3D()->createTexture()); -} - -void CanvasTexture::_deleteObject(Platform3DObject object) -{ - context()->graphicsContext3D()->deleteTexture(object); -} - -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.h deleted file mode 100644 index 32a669a..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasTexture_h -#define CanvasTexture_h - -#include "CanvasObject.h" - -#include -#include - -namespace WebCore { - - class CanvasTexture : public CanvasObject { - public: - virtual ~CanvasTexture() { deleteObject(); } - - static PassRefPtr create(CanvasRenderingContext3D*); - - bool isCubeMapRWrapModeInitialized() { - return cubeMapRWrapModeInitialized; - } - - void setCubeMapRWrapModeInitialized(bool initialized) { - cubeMapRWrapModeInitialized = initialized; - } - - protected: - CanvasTexture(CanvasRenderingContext3D*); - - virtual void _deleteObject(Platform3DObject); - - private: - bool cubeMapRWrapModeInitialized; - }; - -} // namespace WebCore - -#endif // CanvasTexture_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.idl deleted file mode 100644 index 77eedd7..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasTexture.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [Conditional=3D_CANVAS] CanvasTexture { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.cpp deleted file mode 100644 index a75066c..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasUnsignedByteArray.h" - -namespace WebCore { - - PassRefPtr CanvasUnsignedByteArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(unsigned char)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasUnsignedByteArray::create(unsigned char* array, unsigned length) - { - RefPtr a = CanvasUnsignedByteArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasUnsignedByteArray::create(PassRefPtr buffer, - int offset, - unsigned length) - { - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(unsigned char))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasUnsignedByteArray(buffer, offset, length)); - } - - CanvasUnsignedByteArray::CanvasUnsignedByteArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasUnsignedByteArray::length() const { - return m_size; - } - - unsigned CanvasUnsignedByteArray::sizeInBytes() const { - return length() * sizeof(unsigned char); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.h deleted file mode 100644 index d8864e0..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasUnsignedByteArray_h -#define CanvasUnsignedByteArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasUnsignedByteArray : public CanvasArray { - public: - virtual bool isUnsignedByteArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(unsigned char* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - unsigned char* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - unsigned char* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, unsigned char& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - unsigned char item(unsigned index) const - { - ASSERT(index < m_size); - unsigned char* storage = static_cast(m_baseAddress); - return storage[index]; - } - - private: - CanvasUnsignedByteArray(PassRefPtr buffer, int offset, unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasUnsignedByteArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.idl deleted file mode 100644 index d46f708..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedByteArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasUnsignedByteArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.cpp deleted file mode 100644 index bd26343..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasUnsignedIntArray.h" - -namespace WebCore { - - PassRefPtr CanvasUnsignedIntArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(unsigned int)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasUnsignedIntArray::create(unsigned int* array, unsigned length) - { - RefPtr a = CanvasUnsignedIntArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasUnsignedIntArray::create(PassRefPtr buffer, - int offset, - unsigned length) - { - // Make sure the offset results in valid alignment. - if ((offset % sizeof(unsigned int)) != 0) { - return NULL; - } - - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(unsigned int))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasUnsignedIntArray(buffer, offset, length)); - } - - CanvasUnsignedIntArray::CanvasUnsignedIntArray(PassRefPtr buffer, int offset, unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasUnsignedIntArray::length() const { - return m_size; - } - - unsigned CanvasUnsignedIntArray::sizeInBytes() const { - return length() * sizeof(unsigned int); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.h deleted file mode 100644 index 10b8edf..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasUnsignedIntArray_h -#define CanvasUnsignedIntArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasUnsignedIntArray : public CanvasArray { - public: - virtual bool isUnsignedIntArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(unsigned int* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - unsigned int* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - unsigned int* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, unsigned int& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - unsigned int item(unsigned index) const - { - ASSERT(index < m_size); - unsigned int* storage = static_cast(m_baseAddress); - return storage[index]; - } - - private: - CanvasUnsignedIntArray(PassRefPtr buffer, int offset, unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasUnsignedIntArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.idl deleted file mode 100644 index 3ab60d60..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedIntArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasUnsignedIntArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.cpp deleted file mode 100644 index 45d827b..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(3D_CANVAS) - -#include "CanvasArrayBuffer.h" -#include "CanvasUnsignedShortArray.h" - -namespace WebCore { - - PassRefPtr CanvasUnsignedShortArray::create(unsigned length) - { - RefPtr buffer = CanvasArrayBuffer::create(length * sizeof(unsigned short)); - return create(buffer, 0, length); - } - - PassRefPtr CanvasUnsignedShortArray::create(unsigned short* array, unsigned length) - { - RefPtr a = CanvasUnsignedShortArray::create(length); - for (unsigned i = 0; i < length; ++i) - a->set(i, array[i]); - return a; - } - - PassRefPtr CanvasUnsignedShortArray::create(PassRefPtr buffer, - int offset, - unsigned length) - { - // Make sure the offset results in valid alignment. - if ((offset % sizeof(unsigned short)) != 0) { - return NULL; - } - - if (buffer) { - // Check to make sure we are talking about a valid region of - // the given CanvasArrayBuffer's storage. - if ((offset + (length * sizeof(unsigned short))) > buffer->byteLength()) - return NULL; - } - - return adoptRef(new CanvasUnsignedShortArray(buffer, offset, length)); - } - - CanvasUnsignedShortArray::CanvasUnsignedShortArray(PassRefPtr buffer, - int offset, - unsigned length) - : CanvasArray(buffer, offset) - , m_size(length) - { - } - - unsigned CanvasUnsignedShortArray::length() const { - return m_size; - } - - unsigned CanvasUnsignedShortArray::sizeInBytes() const { - return length() * sizeof(unsigned short); - } -} - -#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.h deleted file mode 100644 index 9e27566..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CanvasUnsignedShortArray_h -#define CanvasUnsignedShortArray_h - -#include "CanvasArray.h" -#include -#include -#include -#include - -namespace WebCore { - - class CanvasUnsignedShortArray : public CanvasArray { - public: - virtual bool isUnsignedShortArray() const { return true; } - - static PassRefPtr create(unsigned length); - static PassRefPtr create(unsigned short* array, unsigned length); - static PassRefPtr create(PassRefPtr buffer, int offset, unsigned length); - - unsigned short* data() { return static_cast(baseAddress()); } - - virtual unsigned length() const; - virtual unsigned sizeInBytes() const; - - void set(unsigned index, double value) - { - if (index >= m_size) - return; - if (isnan(value)) // Clamp NaN to 0 - value = 0; - if (value < std::numeric_limits::min()) - value = std::numeric_limits::min(); - else if (value > std::numeric_limits::max()) - value = std::numeric_limits::max(); - unsigned short* storage = static_cast(m_baseAddress); - storage[index] = static_cast(value); - } - - bool get(unsigned index, unsigned short& result) const - { - if (index >= m_size) - return false; - unsigned short* storage = static_cast(m_baseAddress); - result = storage[index]; - return true; - } - - unsigned short item(unsigned index) const - { - ASSERT(index < m_size); - unsigned short* storage = static_cast(m_baseAddress); - return storage[index]; - } - - private: - CanvasUnsignedShortArray(PassRefPtr buffer,int offset,unsigned length); - unsigned m_size; - }; - -} // namespace WebCore - -#endif // CanvasUnsignedShortArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.idl deleted file mode 100644 index 99fc6a2..0000000 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasUnsignedShortArray.idl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -module html { - interface [ - Conditional=3D_CANVAS, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - GenerateCustomConstructor, - CustomToJS - ] CanvasUnsignedShortArray : CanvasArray { - }; -} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h new file mode 100644 index 0000000..4650ea1 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLActiveInfo_h +#define WebGLActiveInfo_h + +#include "PlatformString.h" +#include +#include + +namespace WebCore { + +class WebGLActiveInfo : public RefCounted { +public: + static PassRefPtr create(const String& name, unsigned type, int size) + { + return adoptRef(new WebGLActiveInfo(name, type, size)); + } + String name() const { return m_name; } + unsigned type() const { return m_type; } + int size() const { return m_size; } + +private: + WebGLActiveInfo(const String& name, unsigned type, int size) + : m_name(name) + , m_type(type) + , m_size(size) + { + ASSERT(name.length()); + ASSERT(type); + ASSERT(size); + } + String m_name; + unsigned m_type; + int m_size; +}; + +} + +#endif // WebGLActiveInfo_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl new file mode 100644 index 0000000..17bb4d6 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLActiveInfo.idl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + Conditional=3D_CANVAS, + OmitConstructor + ] WebGLActiveInfo { + readonly attribute int size; + readonly attribute unsigned int type; + readonly attribute DOMString name; + }; + +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp new file mode 100644 index 0000000..c5a712d --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArray.h" +#include "WebGLArrayBuffer.h" + +namespace WebCore { + +WebGLArray::WebGLArray(PassRefPtr buffer, + unsigned byteOffset) + : m_byteOffset(byteOffset) + , m_buffer(buffer) +{ + m_baseAddress = m_buffer ? (static_cast(m_buffer->data()) + m_byteOffset) : 0; +} + +WebGLArray::~WebGLArray() +{ +} + +void WebGLArray::setImpl(WebGLArray* array, unsigned byteOffset, ExceptionCode& ec) +{ + if (byteOffset + array->byteLength() > byteLength()) { + ec = INDEX_SIZE_ERR; + return; + } + + char* base = static_cast(baseAddress()); + memcpy(base + byteOffset, array->baseAddress(), array->byteLength()); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h new file mode 100644 index 0000000..11065cc --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLArray_h +#define WebGLArray_h + +#include "ExceptionCode.h" +#include +#include +#include +#include "WebGLArrayBuffer.h" + +namespace WebCore { + +class WebGLArray : public RefCounted { + public: + virtual bool isByteArray() const { return false; } + virtual bool isUnsignedByteArray() const { return false; } + virtual bool isShortArray() const { return false; } + virtual bool isUnsignedShortArray() const { return false; } + virtual bool isIntArray() const { return false; } + virtual bool isUnsignedIntArray() const { return false; } + virtual bool isFloatArray() const { return false; } + + PassRefPtr buffer() { + return m_buffer; + } + + void* baseAddress() { + return m_baseAddress; + } + + unsigned byteOffset() const { + return m_byteOffset; + } + + virtual unsigned length() const = 0; + virtual unsigned byteLength() const = 0; + virtual PassRefPtr slice(unsigned offset, unsigned length) = 0; + + virtual ~WebGLArray(); + + protected: + WebGLArray(PassRefPtr buffer, unsigned byteOffset); + + void setImpl(WebGLArray* array, unsigned byteOffset, ExceptionCode& ec); + + // This is the address of the WebGLArrayBuffer's storage, plus the byte offset. + void* m_baseAddress; + + unsigned m_byteOffset; + + private: + RefPtr m_buffer; +}; + +} // namespace WebCore + +#endif // WebGLArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl new file mode 100644 index 0000000..02e1f51 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArray.idl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, CustomToJS, OmitConstructor] WebGLArray { + readonly attribute WebGLArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; + readonly attribute unsigned long length; + + WebGLArray slice(in unsigned long offset, in unsigned long length); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp new file mode 100644 index 0000000..c565691 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" + +#include + +namespace WebCore { + +PassRefPtr WebGLArrayBuffer::create(unsigned sizeInBytes) +{ + return adoptRef(new WebGLArrayBuffer(sizeInBytes)); +} + +PassRefPtr WebGLArrayBuffer::create(WebGLArrayBuffer* other) +{ + RefPtr buffer = adoptRef(new WebGLArrayBuffer(other->byteLength())); + memcpy(buffer->data(), other->data(), other->byteLength()); + return buffer.release(); +} + +WebGLArrayBuffer::WebGLArrayBuffer(unsigned sizeInBytes) { + m_sizeInBytes = sizeInBytes; + m_data = WTF::fastZeroedMalloc(sizeInBytes); +} + +void* WebGLArrayBuffer::data() { + return m_data; +} + +const void* WebGLArrayBuffer::data() const { + return m_data; +} + +unsigned WebGLArrayBuffer::byteLength() const { + return m_sizeInBytes; +} + +WebGLArrayBuffer::~WebGLArrayBuffer() { + WTF::fastFree(m_data); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h new file mode 100644 index 0000000..a076e16 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLArrayBuffer_h +#define WebGLArrayBuffer_h + +#include +#include + +namespace WebCore { + +class WebGLArrayBuffer : public RefCounted { + public: + static PassRefPtr create(unsigned sizeInBytes); + static PassRefPtr create(WebGLArrayBuffer*); + + void* data(); + const void* data() const; + unsigned byteLength() const; + + ~WebGLArrayBuffer(); + + private: + WebGLArrayBuffer(unsigned sizeInBytes); + unsigned m_sizeInBytes; + void* m_data; +}; + +} // namespace WebCore + +#endif // WebGLArrayBuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl new file mode 100644 index 0000000..3325210 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLArrayBuffer.idl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, CustomConstructor] WebGLArrayBuffer { + readonly attribute int byteLength; + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp new file mode 100644 index 0000000..958bedc --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLBuffer.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLBuffer::create(WebGLRenderingContext* ctx) +{ + return adoptRef(new WebGLBuffer(ctx)); +} + +PassRefPtr WebGLBuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj) +{ + return adoptRef(new WebGLBuffer(ctx, obj)); +} + +WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx) + : CanvasObject(ctx) + , m_elementArrayBufferByteLength(0) + , m_arrayBufferByteLength(0) + , m_nextAvailableCacheEntry(0) +{ + setObject(context()->graphicsContext3D()->createBuffer()); + clearCachedMaxIndices(); +} + +WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx, Platform3DObject obj) + : CanvasObject(ctx) + , m_nextAvailableCacheEntry(0) +{ + setObject(obj, false); + clearCachedMaxIndices(); +} + +void WebGLBuffer::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteBuffer(object); +} + +bool WebGLBuffer::associateBufferData(unsigned long target, int size) +{ + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) { + m_elementArrayBufferByteLength = size; + return true; + } + + if (target == GraphicsContext3D::ARRAY_BUFFER) { + m_arrayBufferByteLength = size; + return true; + } + + return false; +} + +bool WebGLBuffer::associateBufferData(unsigned long target, WebGLArray* array) +{ + if (!array) + return false; + + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) { + clearCachedMaxIndices(); + m_elementArrayBufferByteLength = array->byteLength(); + // We must always clone the incoming data because client-side + // modifications without calling bufferData or bufferSubData + // must never be able to change the validation results. + m_elementArrayBuffer = WebGLArrayBuffer::create(array->buffer().get()); + return true; + } + + if (target == GraphicsContext3D::ARRAY_BUFFER) { + m_arrayBufferByteLength = array->byteLength(); + return true; + } + + return false; +} + +bool WebGLBuffer::associateBufferSubData(unsigned long target, long offset, WebGLArray* array) +{ + if (!array) + return false; + + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) { + clearCachedMaxIndices(); + + // We need to protect against integer overflow with these tests + if (offset < 0) + return false; + + unsigned long uoffset = static_cast(offset); + if (uoffset > m_elementArrayBufferByteLength || array->byteLength() > m_elementArrayBufferByteLength - uoffset) + return false; + + memcpy(static_cast(m_elementArrayBuffer->data()) + offset, array->baseAddress(), array->byteLength()); + return true; + } + + if (target == GraphicsContext3D::ARRAY_BUFFER) + return array->byteLength() + offset <= m_arrayBufferByteLength; + + return false; +} + +unsigned WebGLBuffer::byteLength(unsigned long target) const +{ + return (target == GraphicsContext3D::ARRAY_BUFFER) ? m_arrayBufferByteLength : m_elementArrayBufferByteLength; +} + +long WebGLBuffer::getCachedMaxIndex(unsigned long type) +{ + size_t numEntries = sizeof(m_maxIndexCache) / sizeof(MaxIndexCacheEntry); + for (size_t i = 0; i < numEntries; i++) + if (m_maxIndexCache[i].type == type) + return m_maxIndexCache[i].maxIndex; + return -1; +} + +void WebGLBuffer::setCachedMaxIndex(unsigned long type, long value) +{ + int numEntries = sizeof(m_maxIndexCache) / sizeof(MaxIndexCacheEntry); + for (int i = 0; i < numEntries; i++) + if (m_maxIndexCache[i].type == type) { + m_maxIndexCache[i].maxIndex = value; + return; + } + m_maxIndexCache[m_nextAvailableCacheEntry].type = type; + m_maxIndexCache[m_nextAvailableCacheEntry].maxIndex = value; + m_nextAvailableCacheEntry = (m_nextAvailableCacheEntry + 1) % numEntries; +} + +void WebGLBuffer::clearCachedMaxIndices() +{ + memset(m_maxIndexCache, 0, sizeof(m_maxIndexCache)); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h new file mode 100644 index 0000000..bdb7052 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLBuffer_h +#define WebGLBuffer_h + +#include "CanvasObject.h" +#include "WebGLArrayBuffer.h" + +#include +#include + +namespace WebCore { + + class WebGLBuffer : public CanvasObject { + public: + virtual ~WebGLBuffer() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*); + + // For querying previously created objects via e.g. getFramebufferAttachmentParameter + // FIXME: should consider canonicalizing these objects + static PassRefPtr create(WebGLRenderingContext*, Platform3DObject); + + bool associateBufferData(unsigned long target, int size); + bool associateBufferData(unsigned long target, WebGLArray* array); + bool associateBufferSubData(unsigned long target, long offset, WebGLArray* array); + + unsigned byteLength(unsigned long target) const; + const WebGLArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); } + + // Gets the cached max index for the given type. Returns -1 if + // none has been set. + long getCachedMaxIndex(unsigned long type); + // Sets the cached max index for the given type. + void setCachedMaxIndex(unsigned long type, long value); + + protected: + WebGLBuffer(WebGLRenderingContext*); + WebGLBuffer(WebGLRenderingContext*, Platform3DObject obj); + + virtual void _deleteObject(Platform3DObject o); + + private: + RefPtr m_elementArrayBuffer; + unsigned m_elementArrayBufferByteLength; + unsigned m_arrayBufferByteLength; + + // Optimization for index validation. For each type of index + // (i.e., UNSIGNED_SHORT), cache the maximum index in the + // entire buffer. + // + // This is sufficient to eliminate a lot of work upon each + // draw call as long as all bound array buffers are at least + // that size. + struct MaxIndexCacheEntry { + unsigned long type; + long maxIndex; + }; + // OpenGL ES 2.0 only has two valid index types (UNSIGNED_BYTE + // and UNSIGNED_SHORT), but might as well leave open the + // possibility of adding others. + MaxIndexCacheEntry m_maxIndexCache[4]; + unsigned m_nextAvailableCacheEntry; + + // Clears all of the cached max indices. + void clearCachedMaxIndices(); + }; + +} // namespace WebCore + +#endif // WebGLBuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl new file mode 100644 index 0000000..9dd97c0 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLBuffer.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLBuffer { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp new file mode 100644 index 0000000..1c2849b --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLByteArray.h" + +namespace WebCore { + +PassRefPtr WebGLByteArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(signed char)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLByteArray::create(signed char* array, unsigned length) +{ + RefPtr a = WebGLByteArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLByteArray::create(PassRefPtr buffer, int byteOffset, unsigned length) +{ + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(signed char))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLByteArray(buffer, byteOffset, length)); +} + +WebGLByteArray::WebGLByteArray(PassRefPtr buffer, int offset, unsigned length) + : WebGLArray(buffer, offset) + , m_size(length) +{ +} + +unsigned WebGLByteArray::length() const { + return m_size; +} + +unsigned WebGLByteArray::byteLength() const { + return m_size * sizeof(signed char); +} + +PassRefPtr WebGLByteArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(signed char); + unsigned limitByte = startByte + length * sizeof(signed char); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLByteArray::set(WebGLByteArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(signed char), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h new file mode 100644 index 0000000..c517c03 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLByteArray_h +#define WebGLByteArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLArrayBuffer; + +class WebGLByteArray : public WebGLArray { + public: + virtual bool isByteArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(signed char* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + char* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + signed char* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, signed char& result) const + { + if (index >= m_size) + return false; + signed char* storage = static_cast(m_baseAddress); + result = storage[index]; + return true; + } + + signed char get(unsigned index) const + { + return item(index); + } + + signed char item(unsigned index) const + { + ASSERT(index < m_size); + signed char* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLByteArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLByteArray(PassRefPtr buffer, + int offset, + unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLByteArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl new file mode 100644 index 0000000..dbb3bb2 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLByteArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] WebGLByteArray : WebGLArray { + long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLByteArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp new file mode 100644 index 0000000..a0725ca --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLContextAttributes.h" + +namespace WebCore { + +PassRefPtr WebGLContextAttributes::create() +{ + return adoptRef(new WebGLContextAttributes()); +} + +PassRefPtr WebGLContextAttributes::create(GraphicsContext3D::Attributes attributes) +{ + return adoptRef(new WebGLContextAttributes(attributes)); +} + +WebGLContextAttributes::WebGLContextAttributes() + : CanvasContextAttributes() +{ +} + +WebGLContextAttributes::WebGLContextAttributes(GraphicsContext3D::Attributes attributes) + : CanvasContextAttributes() + , m_attrs(attributes) +{ +} + +WebGLContextAttributes::~WebGLContextAttributes() +{ +} + +bool WebGLContextAttributes::alpha() const +{ + return m_attrs.alpha; +} + +void WebGLContextAttributes::setAlpha(bool alpha) +{ + m_attrs.alpha = alpha; +} + +bool WebGLContextAttributes::depth() const +{ + return m_attrs.depth; +} + +void WebGLContextAttributes::setDepth(bool depth) +{ + m_attrs.depth = depth; +} + +bool WebGLContextAttributes::stencil() const +{ + return m_attrs.stencil; +} + +void WebGLContextAttributes::setStencil(bool stencil) +{ + m_attrs.stencil = stencil; +} + +bool WebGLContextAttributes::antialias() const +{ + return m_attrs.antialias; +} + +void WebGLContextAttributes::setAntialias(bool antialias) +{ + m_attrs.antialias = antialias; +} + +bool WebGLContextAttributes::premultipliedAlpha() const +{ + return m_attrs.premultipliedAlpha; +} + +void WebGLContextAttributes::setPremultipliedAlpha(bool premultipliedAlpha) +{ + m_attrs.premultipliedAlpha = premultipliedAlpha; +} + +GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const +{ + return m_attrs; +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h new file mode 100644 index 0000000..a108605 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLContextAttributes_h +#define WebGLContextAttributes_h + +#include "CanvasContextAttributes.h" +#include "GraphicsContext3D.h" +#include + +namespace WebCore { + +class WebGLContextAttributes : public CanvasContextAttributes { + public: + virtual ~WebGLContextAttributes(); + + // Create a new attributes object + static PassRefPtr create(); + + // Create a new attributes object initialized with preexisting attributes + static PassRefPtr create(GraphicsContext3D::Attributes attributes); + + // Whether or not the drawing buffer has an alpha channel; default=true + bool alpha() const; + void setAlpha(bool alpha); + + // Whether or not the drawing buffer has a depth buffer; default=true + bool depth() const; + void setDepth(bool depth); + + // Whether or not the drawing buffer has a stencil buffer; default=true + bool stencil() const; + void setStencil(bool stencil); + + // Whether or not the drawing buffer is antialiased; default=true + bool antialias() const; + void setAntialias(bool antialias); + + // Whether or not to treat the values in the drawing buffer as + // though their alpha channel has already been multiplied into the + // color channels; default=true + bool premultipliedAlpha() const; + void setPremultipliedAlpha(bool premultipliedAlpha); + + // Fetches a copy of the attributes stored in this object in a + // form that can be used to initialize a GraphicsContext3D. + GraphicsContext3D::Attributes attributes() const; + + protected: + WebGLContextAttributes(); + WebGLContextAttributes(GraphicsContext3D::Attributes attributes); + + private: + GraphicsContext3D::Attributes m_attrs; +}; + +} // namespace WebCore + +#endif // WebGLContextAttributes_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl new file mode 100644 index 0000000..be2b20c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLContextAttributes.idl @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + OmitConstructor + ] WebGLContextAttributes { + attribute boolean alpha; + attribute boolean depth; + attribute boolean stencil; + attribute boolean antialias; + attribute boolean premultipliedAlpha; + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp new file mode 100644 index 0000000..6192898 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLFloatArray.h" + +namespace WebCore { + +PassRefPtr WebGLFloatArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(float)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLFloatArray::create(float* array, unsigned length) +{ + RefPtr a = WebGLFloatArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLFloatArray::create(PassRefPtr buffer, int byteOffset, unsigned length) +{ + // Make sure the offset results in valid alignment. + if ((byteOffset % sizeof(float)) != 0) + return NULL; + + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(float))) > buffer->byteLength()) + return NULL; + } + return adoptRef(new WebGLFloatArray(buffer, byteOffset, length)); +} + +WebGLFloatArray::WebGLFloatArray(PassRefPtr buffer, int byteOffset, unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLFloatArray::length() const { + return m_size; +} + +unsigned WebGLFloatArray::byteLength() const { + return m_size * sizeof(float); +} + +PassRefPtr WebGLFloatArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(float); + unsigned limitByte = startByte + length * sizeof(float); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLFloatArray::set(WebGLFloatArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(float), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h new file mode 100644 index 0000000..4607962 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLFloatArray_h +#define WebGLFloatArray_h + +#include "WebGLArray.h" +#include +#include +#include + +namespace WebCore { + +class WebGLFloatArray : public WebGLArray { + public: + virtual bool isFloatArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(float* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + float* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + float* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, float& result) const + { + if (index >= m_size) + return false; + result = item(index); + return true; + } + + float get(unsigned index) const + { + return item(index); + } + + float item(unsigned index) const + { + ASSERT(index < m_size); + float* storage = static_cast(m_baseAddress); + float result = storage[index]; + if (isnan(result)) { + // Clamp NaN to 0 + result = 0; + } + return result; + } + + void set(WebGLFloatArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLFloatArray(PassRefPtr buffer, int byteOffset, unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLFloatArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl new file mode 100644 index 0000000..e0a80f2 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFloatArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] WebGLFloatArray : WebGLArray { + float get(in unsigned long index); + // void set(in unsigned long index, in float value); + // void set(in WebGLFloatArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp new file mode 100644 index 0000000..7ade990 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLFramebuffer.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLFramebuffer::create(WebGLRenderingContext* ctx) +{ + return adoptRef(new WebGLFramebuffer(ctx)); +} + +WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContext* ctx) + : CanvasObject(ctx) +{ + setObject(context()->graphicsContext3D()->createFramebuffer()); +} + +void WebGLFramebuffer::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteFramebuffer(object); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h new file mode 100644 index 0000000..10b6772 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLFramebuffer_h +#define WebGLFramebuffer_h + +#include "CanvasObject.h" + +#include +#include + +namespace WebCore { + + class WebGLFramebuffer : public CanvasObject { + public: + virtual ~WebGLFramebuffer() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*); + + protected: + WebGLFramebuffer(WebGLRenderingContext*); + + virtual void _deleteObject(Platform3DObject); + }; + +} // namespace WebCore + +#endif // WebGLFramebuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl new file mode 100644 index 0000000..f433352 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLFramebuffer.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLFramebuffer { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp new file mode 100644 index 0000000..96218e5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLGetInfo.h" +#include "WebGLBuffer.h" +#include "WebGLFloatArray.h" +#include "WebGLFramebuffer.h" +#include "WebGLIntArray.h" +#include "WebGLProgram.h" +#include "WebGLRenderbuffer.h" +#include "WebGLTexture.h" +#include "WebGLUnsignedByteArray.h" + +namespace WebCore { + +WebGLGetInfo::WebGLGetInfo(bool value) + : m_type(kTypeBool) + , m_bool(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(float value) + : m_type(kTypeFloat) + , m_float(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(long value) + : m_type(kTypeLong) + , m_long(value) +{ +} + +WebGLGetInfo::WebGLGetInfo() + : m_type(kTypeNull) +{ +} + +WebGLGetInfo::WebGLGetInfo(const String& value) + : m_type(kTypeString) + , m_string(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(unsigned long value) + : m_type(kTypeUnsignedLong) + , m_unsignedLong(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLBuffer) + , m_webglBuffer(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLFloatArray) + , m_webglFloatArray(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLFramebuffer) + , m_webglFramebuffer(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLIntArray) + , m_webglIntArray(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLProgram) + , m_webglProgram(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLRenderbuffer) + , m_webglRenderbuffer(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLTexture) + , m_webglTexture(value) +{ +} + +WebGLGetInfo::WebGLGetInfo(PassRefPtr value) + : m_type(kTypeWebGLUnsignedByteArray) + , m_webglUnsignedByteArray(value) +{ +} + +WebGLGetInfo::~WebGLGetInfo() +{ +} + +WebGLGetInfo::Type WebGLGetInfo::getType() const +{ + return m_type; +} + +bool WebGLGetInfo::getBool() const +{ + ASSERT(getType() == kTypeBool); + return m_bool; +} + +float WebGLGetInfo::getFloat() const +{ + ASSERT(getType() == kTypeFloat); + return m_float; +} + +long WebGLGetInfo::getLong() const +{ + ASSERT(getType() == kTypeLong); + return m_long; +} + +const String& WebGLGetInfo::getString() const +{ + ASSERT(getType() == kTypeString); + return m_string; +} + +unsigned long WebGLGetInfo::getUnsignedLong() const +{ + ASSERT(getType() == kTypeUnsignedLong); + return m_unsignedLong; +} + +PassRefPtr WebGLGetInfo::getWebGLBuffer() const +{ + ASSERT(getType() == kTypeWebGLBuffer); + return m_webglBuffer; +} + +PassRefPtr WebGLGetInfo::getWebGLFloatArray() const +{ + ASSERT(getType() == kTypeWebGLFloatArray); + return m_webglFloatArray; +} + +PassRefPtr WebGLGetInfo::getWebGLFramebuffer() const +{ + ASSERT(getType() == kTypeWebGLFramebuffer); + return m_webglFramebuffer; +} + +PassRefPtr WebGLGetInfo::getWebGLIntArray() const +{ + ASSERT(getType() == kTypeWebGLIntArray); + return m_webglIntArray; +} + +PassRefPtr WebGLGetInfo::getWebGLProgram() const +{ + ASSERT(getType() == kTypeWebGLProgram); + return m_webglProgram; +} + +PassRefPtr WebGLGetInfo::getWebGLRenderbuffer() const +{ + ASSERT(getType() == kTypeWebGLRenderbuffer); + return m_webglRenderbuffer; +} + +PassRefPtr WebGLGetInfo::getWebGLTexture() const +{ + ASSERT(getType() == kTypeWebGLTexture); + return m_webglTexture; +} + +PassRefPtr WebGLGetInfo::getWebGLUnsignedByteArray() const +{ + ASSERT(getType() == kTypeWebGLUnsignedByteArray); + return m_webglUnsignedByteArray; +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h new file mode 100644 index 0000000..8ac42c4 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLGetInfo.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLGetInfo_h +#define WebGLGetInfo_h + +#include "wtf/PassRefPtr.h" +#include "wtf/RefPtr.h" +#include "PlatformString.h" + +#include "WebGLBuffer.h" +#include "WebGLFloatArray.h" +#include "WebGLFramebuffer.h" +#include "WebGLIntArray.h" +// FIXME: implement WebGLObjectArray +//#include "WebGLObjectArray.h" +#include "WebGLProgram.h" +#include "WebGLRenderbuffer.h" +#include "WebGLTexture.h" +#include "WebGLUnsignedByteArray.h" + +namespace WebCore { + +// A tagged union representing the result of get queries like +// getParameter (encompassing getBooleanv, getIntegerv, getFloatv) and +// similar variants. For reference counted types, increments and +// decrements the reference count of the target object. + +class WebGLGetInfo { +public: + enum Type { + kTypeBool, + kTypeFloat, + kTypeLong, + kTypeNull, + kTypeString, + kTypeUnsignedLong, + kTypeWebGLBuffer, + kTypeWebGLFloatArray, + kTypeWebGLFramebuffer, + kTypeWebGLIntArray, + kTypeWebGLObjectArray, + kTypeWebGLProgram, + kTypeWebGLRenderbuffer, + kTypeWebGLTexture, + kTypeWebGLUnsignedByteArray + }; + + WebGLGetInfo(bool value); + WebGLGetInfo(float value); + WebGLGetInfo(long value); + // Represents the NULL value and type + WebGLGetInfo(); + WebGLGetInfo(const String& value); + WebGLGetInfo(unsigned long value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + // FIXME: implement WebGLObjectArray + // WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + WebGLGetInfo(PassRefPtr value); + + virtual ~WebGLGetInfo(); + + Type getType() const; + + bool getBool() const; + float getFloat() const; + long getLong() const; + const String& getString() const; + unsigned long getUnsignedLong() const; + PassRefPtr getWebGLBuffer() const; + PassRefPtr getWebGLFloatArray() const; + PassRefPtr getWebGLFramebuffer() const; + PassRefPtr getWebGLIntArray() const; + // FIXME: implement WebGLObjectArray + // PassRefPtr getWebGLObjectArray() const; + PassRefPtr getWebGLProgram() const; + PassRefPtr getWebGLRenderbuffer() const; + PassRefPtr getWebGLTexture() const; + PassRefPtr getWebGLUnsignedByteArray() const; + +private: + Type m_type; + bool m_bool; + float m_float; + long m_long; + String m_string; + unsigned long m_unsignedLong; + RefPtr m_webglBuffer; + RefPtr m_webglFloatArray; + RefPtr m_webglFramebuffer; + RefPtr m_webglIntArray; + // FIXME: implement WebGLObjectArray + // RefPtr m_webglObjectArray; + RefPtr m_webglProgram; + RefPtr m_webglRenderbuffer; + RefPtr m_webglTexture; + RefPtr m_webglUnsignedByteArray; +}; + +} // namespace WebCore + +#endif // WebGLGetInfo_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp new file mode 100644 index 0000000..4617010 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLIntArray.h" + +namespace WebCore { + +PassRefPtr WebGLIntArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(int)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLIntArray::create(int* array, unsigned length) +{ + RefPtr a = WebGLIntArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLIntArray::create(PassRefPtr buffer, + int byteOffset, + unsigned length) +{ + // Make sure the offset results in valid alignment. + if ((byteOffset % sizeof(int)) != 0) + return NULL; + + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(int))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLIntArray(buffer, byteOffset, length)); +} + +WebGLIntArray::WebGLIntArray(PassRefPtr buffer, int byteOffset, unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLIntArray::length() const { + return m_size; +} + +unsigned WebGLIntArray::byteLength() const { + return m_size * sizeof(int); +} + +PassRefPtr WebGLIntArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(int); + unsigned limitByte = startByte + length * sizeof(int); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLIntArray::set(WebGLIntArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(int), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h new file mode 100644 index 0000000..25108ac --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLIntArray_h +#define WebGLIntArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLIntArray : public WebGLArray { + public: + virtual bool isIntArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(int* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + int* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + int* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, int& result) const + { + if (index >= m_size) + return false; + result = item(index); + return true; + } + + int get(unsigned index) const + { + return item(index); + } + + int item(unsigned index) const + { + ASSERT(index < m_size); + int* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLIntArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLIntArray(PassRefPtr buffer, + int byteOffset, + unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLIntArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl new file mode 100644 index 0000000..ef0d92f --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLIntArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] WebGLIntArray : WebGLArray { + long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLIntArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp new file mode 100644 index 0000000..c2606c1 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLProgram.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLProgram::create(WebGLRenderingContext* ctx) +{ + return adoptRef(new WebGLProgram(ctx)); +} + +WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx) + : CanvasObject(ctx) +{ + setObject(context()->graphicsContext3D()->createProgram()); +} + +void WebGLProgram::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteProgram(object); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h new file mode 100644 index 0000000..8804d39 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLProgram_h +#define WebGLProgram_h + +#include "CanvasObject.h" + +#include +#include + +namespace WebCore { + + class WebGLProgram : public CanvasObject { + public: + virtual ~WebGLProgram() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*); + + protected: + WebGLProgram(WebGLRenderingContext*); + + virtual void _deleteObject(Platform3DObject); + }; + +} // namespace WebCore + +#endif // WebGLProgram_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl new file mode 100644 index 0000000..47e5cda --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLProgram.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLProgram { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp new file mode 100644 index 0000000..286ad2e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLRenderbuffer.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLRenderbuffer::create(WebGLRenderingContext* ctx) +{ + return adoptRef(new WebGLRenderbuffer(ctx)); +} + +PassRefPtr WebGLRenderbuffer::create(WebGLRenderingContext* ctx, Platform3DObject obj) +{ + return adoptRef(new WebGLRenderbuffer(ctx, obj)); +} + +WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) + : CanvasObject(ctx) +{ + setObject(context()->graphicsContext3D()->createRenderbuffer()); +} + +WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx, Platform3DObject obj) + : CanvasObject(ctx) +{ + setObject(obj, false); +} + +void WebGLRenderbuffer::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteRenderbuffer(object); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h new file mode 100644 index 0000000..790fdcd --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLRenderbuffer_h +#define WebGLRenderbuffer_h + +#include "CanvasObject.h" + +#include +#include + +namespace WebCore { + + class WebGLRenderbuffer : public CanvasObject { + public: + virtual ~WebGLRenderbuffer() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*); + + // For querying previously created objects via e.g. getFramebufferAttachmentParameter + // FIXME: should consider canonicalizing these objects + static PassRefPtr create(WebGLRenderingContext*, Platform3DObject renderbuffer); + + protected: + WebGLRenderbuffer(WebGLRenderingContext*); + WebGLRenderbuffer(WebGLRenderingContext*, Platform3DObject); + + virtual void _deleteObject(Platform3DObject); + }; + +} // namespace WebCore + +#endif // WebGLRenderbuffer_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl new file mode 100644 index 0000000..6a4fc35 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderbuffer.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLRenderbuffer { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp new file mode 100644 index 0000000..6cb3348 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -0,0 +1,2531 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLRenderingContext.h" + +#include "CanvasPixelArray.h" +#include "HTMLCanvasElement.h" +#include "HTMLImageElement.h" +#include "ImageBuffer.h" +#include "ImageData.h" +#include "NotImplemented.h" +#include "RenderBox.h" +#include "RenderLayer.h" +#include "WebGLActiveInfo.h" +#include "WebGLBuffer.h" +#include "WebGLContextAttributes.h" +#include "WebGLFramebuffer.h" +#include "WebGLProgram.h" +#include "WebGLRenderbuffer.h" +#include "WebGLTexture.h" +#include "WebGLShader.h" +#include "WebGLUniformLocation.h" +#include "HTMLCanvasElement.h" +#include "HTMLImageElement.h" +#include "ImageBuffer.h" +#include "NotImplemented.h" +#include "RenderBox.h" +#include "RenderLayer.h" + +#include + +namespace WebCore { + +class WebGLStateRestorer { +public: + WebGLStateRestorer(WebGLRenderingContext* context, + bool changed) + : m_context(context) + , m_changed(changed) + { + } + + ~WebGLStateRestorer() + { + m_context->cleanupAfterGraphicsCall(m_changed); + } + +private: + WebGLRenderingContext* m_context; + bool m_changed; +}; + +PassOwnPtr WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) +{ + OwnPtr context(GraphicsContext3D::create(attrs->attributes())); + if (!context) + return 0; + + return new WebGLRenderingContext(canvas, context.release()); +} + +WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr context) + : CanvasRenderingContext(passedCanvas) + , m_context(context) + , m_needsUpdate(true) + , m_markedCanvasDirty(false) + , m_activeTextureUnit(0) +{ + ASSERT(m_context); + int numVertexAttribs = 0; + m_context->getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &numVertexAttribs); + m_maxVertexAttribs = numVertexAttribs; + m_context->reshape(canvas()->width(), canvas()->height()); +} + +WebGLRenderingContext::~WebGLRenderingContext() +{ + detachAndRemoveAllObjects(); +} + +void WebGLRenderingContext::markContextChanged() +{ +#if USE(ACCELERATED_COMPOSITING) + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) { + canvas()->renderBox()->layer()->rendererContentChanged(); + } else { +#endif + if (!m_markedCanvasDirty) { + // Make sure the canvas's image buffer is allocated. + canvas()->buffer(); + canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); + m_markedCanvasDirty = true; + } +#if USE(ACCELERATED_COMPOSITING) + } +#endif +} + +void WebGLRenderingContext::beginPaint() +{ + if (m_markedCanvasDirty) { + m_context->beginPaint(this); + } +} + +void WebGLRenderingContext::endPaint() +{ + if (m_markedCanvasDirty) { + m_markedCanvasDirty = false; + m_context->endPaint(); + } +} + +void WebGLRenderingContext::reshape(int width, int height) +{ + if (m_needsUpdate) { +#if USE(ACCELERATED_COMPOSITING) + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) + canvas()->renderBox()->layer()->rendererContentChanged(); +#endif + m_needsUpdate = false; + } + + m_context->reshape(width, height); +} + +int WebGLRenderingContext::sizeInBytes(int type, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + int result = m_context->sizeInBytes(type); + if (result <= 0) + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + + return result; +} + +void WebGLRenderingContext::activeTexture(unsigned long texture, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if ((texture - GraphicsContext3D::TEXTURE0) > sizeof(m_textureUnits) / sizeof(TextureUnitState)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + m_activeTextureUnit = texture - GraphicsContext3D::TEXTURE0; + m_context->activeTexture(texture); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this || !shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + m_context->attachShader(program, shader); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->bindAttribLocation(program, index, name); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bindBuffer(unsigned long target, WebGLBuffer* buffer, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (buffer && buffer->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (target == GraphicsContext3D::ARRAY_BUFFER) + m_boundArrayBuffer = buffer; + else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) + m_boundElementArrayBuffer = buffer; + else { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + + m_context->bindBuffer(target, buffer); + cleanupAfterGraphicsCall(false); +} + + +void WebGLRenderingContext::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (buffer && buffer->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + if (target != GraphicsContext3D::FRAMEBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + m_framebufferBinding = buffer; + m_context->bindFramebuffer(target, buffer); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderBuffer, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (renderBuffer && renderBuffer->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + if (target != GraphicsContext3D::RENDERBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + m_renderbufferBinding = renderBuffer; + m_context->bindRenderbuffer(target, renderBuffer); + cleanupAfterGraphicsCall(false); +} + + +void WebGLRenderingContext::bindTexture(unsigned long target, WebGLTexture* texture, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (texture && texture->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + if (target == GraphicsContext3D::TEXTURE_2D) + m_textureUnits[m_activeTextureUnit].m_texture2DBinding = texture; + else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) + m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; + else { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + m_context->bindTexture(target, texture); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::blendColor(double red, double green, double blue, double alpha) +{ + m_context->blendColor(red, green, blue, alpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::blendEquation( unsigned long mode ) +{ + m_context->blendEquation(mode); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) +{ + m_context->blendEquationSeparate(modeRGB, modeAlpha); + cleanupAfterGraphicsCall(false); +} + + +void WebGLRenderingContext::blendFunc(unsigned long sfactor, unsigned long dfactor) +{ + m_context->blendFunc(sfactor, dfactor); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) +{ + m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bufferData(unsigned long target, int size, unsigned long usage, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) { + if (!m_boundElementArrayBuffer->associateBufferData(target, size)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) { + if (!m_boundArrayBuffer->associateBufferData(target, size)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + + m_context->bufferData(target, size, usage); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bufferData(unsigned long target, WebGLArray* data, unsigned long usage, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) { + if (!m_boundElementArrayBuffer->associateBufferData(target, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) { + if (!m_boundArrayBuffer->associateBufferData(target, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + + m_context->bufferData(target, data, usage); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::bufferSubData(unsigned long target, long offset, WebGLArray* data, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) { + if (!m_boundElementArrayBuffer->associateBufferSubData(target, offset, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) { + if (!m_boundArrayBuffer->associateBufferSubData(target, offset, data)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + } else { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return; + } + + m_context->bufferSubData(target, offset, data); + cleanupAfterGraphicsCall(false); +} + +unsigned long WebGLRenderingContext::checkFramebufferStatus(unsigned long target) +{ + return m_context->checkFramebufferStatus(target); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::clear(unsigned long mask) +{ + m_context->clear(mask); + cleanupAfterGraphicsCall(true); +} + +void WebGLRenderingContext::clearColor(double r, double g, double b, double a) +{ + if (isnan(r)) + r = 0; + if (isnan(g)) + g = 0; + if (isnan(b)) + b = 0; + if (isnan(a)) + a = 1; + m_context->clearColor(r, g, b, a); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::clearDepth(double depth) +{ + m_context->clearDepth(depth); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::clearStencil(long s) +{ + m_context->clearStencil(s); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::colorMask(bool red, bool green, bool blue, bool alpha) +{ + m_context->colorMask(red, green, blue, alpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->compileShader(shader); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) +{ + m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) +{ + m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + cleanupAfterGraphicsCall(false); +} + +PassRefPtr WebGLRenderingContext::createBuffer() +{ + RefPtr o = WebGLBuffer::create(this); + addObject(o.get()); + return o; +} + +PassRefPtr WebGLRenderingContext::createFramebuffer() +{ + RefPtr o = WebGLFramebuffer::create(this); + addObject(o.get()); + return o; +} + +PassRefPtr WebGLRenderingContext::createTexture() +{ + RefPtr o = WebGLTexture::create(this); + addObject(o.get()); + return o; +} + +PassRefPtr WebGLRenderingContext::createProgram() +{ + RefPtr o = WebGLProgram::create(this); + addObject(o.get()); + return o; +} + +PassRefPtr WebGLRenderingContext::createRenderbuffer() +{ + RefPtr o = WebGLRenderbuffer::create(this); + addObject(o.get()); + return o; +} + +PassRefPtr WebGLRenderingContext::createShader(unsigned long type, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return 0; + } + + RefPtr o = WebGLShader::create(this, static_cast(type)); + addObject(o.get()); + return o; +} + +void WebGLRenderingContext::cullFace(unsigned long mode) +{ + m_context->cullFace(mode); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer) +{ + if (!buffer) + return; + + buffer->deleteObject(); +} + +void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer) +{ + if (!framebuffer) + return; + + framebuffer->deleteObject(); +} + +void WebGLRenderingContext::deleteProgram(WebGLProgram* program) +{ + if (!program) + return; + + program->deleteObject(); +} + +void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer) +{ + if (!renderbuffer) + return; + + renderbuffer->deleteObject(); +} + +void WebGLRenderingContext::deleteShader(WebGLShader* shader) +{ + if (!shader) + return; + + shader->deleteObject(); +} + +void WebGLRenderingContext::deleteTexture(WebGLTexture* texture) +{ + if (!texture) + return; + + texture->deleteObject(); +} + +void WebGLRenderingContext::depthFunc(unsigned long func) +{ + m_context->depthFunc(func); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::depthMask(bool flag) +{ + m_context->depthMask(flag); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::depthRange(double zNear, double zFar) +{ + m_context->depthRange(zNear, zFar); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* shader, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this || !shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->detachShader(program, shader); + cleanupAfterGraphicsCall(false); +} + + +void WebGLRenderingContext::disable(unsigned long cap) +{ + m_context->disable(cap); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::disableVertexAttribArray(unsigned long index, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (index >= m_maxVertexAttribs) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + if (index < m_vertexAttribState.size()) + m_vertexAttribState[index].enabled = false; + + m_context->disableVertexAttribArray(index); + cleanupAfterGraphicsCall(false); +} + +bool WebGLRenderingContext::validateElementArraySize(unsigned long count, unsigned long type, long offset) +{ + if (!m_boundElementArrayBuffer) + return false; + + if (offset < 0) + return false; + + unsigned long uoffset = static_cast(offset); + + if (type == GraphicsContext3D::UNSIGNED_SHORT) { + // For an unsigned short array, offset must be divisible by 2 for alignment reasons. + if (uoffset & 1) + return false; + + // Make uoffset an element offset. + uoffset /= 2; + + unsigned long n = m_boundElementArrayBuffer->byteLength(GraphicsContext3D::ELEMENT_ARRAY_BUFFER) / 2; + if (uoffset > n || count > n - uoffset) + return false; + } else if (type == GraphicsContext3D::UNSIGNED_BYTE) { + unsigned long n = m_boundElementArrayBuffer->byteLength(GraphicsContext3D::ELEMENT_ARRAY_BUFFER); + if (uoffset > n || count > n - uoffset) + return false; + } + return true; +} + +bool WebGLRenderingContext::validateIndexArrayConservative(unsigned long type, long& numElementsRequired) +{ + // Performs conservative validation by caching a maximum index of + // the given type per element array buffer. If all of the bound + // array buffers have enough elements to satisfy that maximum + // index, skips the expensive per-draw-call iteration in + // validateIndexArrayPrecise. + + long maxIndex = m_boundElementArrayBuffer->getCachedMaxIndex(type); + if (maxIndex < 0) { + // Compute the maximum index in the entire buffer for the given type of index. + switch (type) { + case GraphicsContext3D::UNSIGNED_BYTE: { + unsigned numElements = m_boundElementArrayBuffer->byteLength(GraphicsContext3D::ELEMENT_ARRAY_BUFFER); + const unsigned char* p = static_cast(m_boundElementArrayBuffer->elementArrayBuffer()->data()); + for (unsigned i = 0; i < numElements; i++) + maxIndex = max(maxIndex, static_cast(p[i])); + break; + } + case GraphicsContext3D::UNSIGNED_SHORT: { + unsigned numElements = m_boundElementArrayBuffer->byteLength(GraphicsContext3D::ELEMENT_ARRAY_BUFFER) / sizeof(unsigned short); + const unsigned short* p = static_cast(m_boundElementArrayBuffer->elementArrayBuffer()->data()); + for (unsigned i = 0; i < numElements; i++) + maxIndex = max(maxIndex, static_cast(p[i])); + break; + } + default: + return false; + } + m_boundElementArrayBuffer->setCachedMaxIndex(type, maxIndex); + } + + if (maxIndex >= 0) { + // The number of required elements is one more than the maximum + // index that will be accessed. + numElementsRequired = maxIndex + 1; + return true; + } + + return false; +} + +bool WebGLRenderingContext::validateIndexArrayPrecise(unsigned long count, unsigned long type, long offset, long& numElementsRequired) +{ + long lastIndex = -1; + + if (!m_boundElementArrayBuffer) + return false; + + unsigned long uoffset = static_cast(offset); + unsigned long n = count; + + if (type == GraphicsContext3D::UNSIGNED_SHORT) { + // Make uoffset an element offset. + uoffset /= 2; + const unsigned short* p = static_cast(m_boundElementArrayBuffer->elementArrayBuffer()->data()) + uoffset; + while (n-- > 0) { + if (*p > lastIndex) + lastIndex = *p; + ++p; + } + } else if (type == GraphicsContext3D::UNSIGNED_BYTE) { + const unsigned char* p = static_cast(m_boundElementArrayBuffer->elementArrayBuffer()->data()) + uoffset; + while (n-- > 0) { + if (*p > lastIndex) + lastIndex = *p; + ++p; + } + } + + // Then set the last index in the index array and make sure it is valid. + numElementsRequired = lastIndex + 1; + return numElementsRequired > 0; +} + +bool WebGLRenderingContext::validateRenderingState(long numElementsRequired) +{ + // Look in each enabled vertex attrib and find the smallest buffer size + long smallestNumElements = LONG_MAX; + for (unsigned i = 0; i < m_vertexAttribState.size(); ++i) { + const VertexAttribState& state = m_vertexAttribState[i]; + if (state.enabled && state.numElements < smallestNumElements) + smallestNumElements = state.numElements; + } + + if (smallestNumElements == LONG_MAX) + smallestNumElements = 0; + + return numElementsRequired <= smallestNumElements; +} + +void WebGLRenderingContext::drawArrays(unsigned long mode, long first, long count, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + // Ensure we have a valid rendering state + if (first < 0 || count < 0 || !validateRenderingState(first + count)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->drawArrays(mode, first, count); + cleanupAfterGraphicsCall(true); +} + +void WebGLRenderingContext::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + // Ensure we have a valid rendering state + long numElements; + + if (offset < 0 || !validateElementArraySize(count, type, offset)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!validateIndexArrayConservative(type, numElements) || !validateRenderingState(numElements)) + if (!validateIndexArrayPrecise(count, type, offset, numElements) || !validateRenderingState(numElements)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->drawElements(mode, count, type, offset); + cleanupAfterGraphicsCall(true); +} + +void WebGLRenderingContext::enable(unsigned long cap) +{ + m_context->enable(cap); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::enableVertexAttribArray(unsigned long index, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (index >= m_maxVertexAttribs) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + if (index >= m_vertexAttribState.size()) + m_vertexAttribState.resize(index + 1); + + m_vertexAttribState[index].enabled = true; + + m_context->enableVertexAttribArray(index); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::finish() +{ + m_context->finish(); + cleanupAfterGraphicsCall(true); +} + + +void WebGLRenderingContext::flush() +{ + m_context->flush(); + cleanupAfterGraphicsCall(true); +} + +void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (buffer && buffer->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + // Don't allow the default framebuffer to be mutated; all current + // implementations use an FBO internally in place of the default + // FBO. + if (!m_framebufferBinding || !m_framebufferBinding->object()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (texture && texture->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + // Don't allow the default framebuffer to be mutated; all current + // implementations use an FBO internally in place of the default + // FBO. + if (!m_framebufferBinding || !m_framebufferBinding->object()) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->framebufferTexture2D(target, attachment, textarget, texture, level); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::frontFace(unsigned long mode) +{ + m_context->frontFace(mode); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::generateMipmap(unsigned long target) +{ + m_context->generateMipmap(target); + cleanupAfterGraphicsCall(false); +} + +PassRefPtr WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, unsigned long index, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + ActiveInfo info; + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return 0; + } + if (!m_context->getActiveAttrib(program, index, info)) { + return 0; + } + return WebGLActiveInfo::create(info.name, info.type, info.size); +} + +PassRefPtr WebGLRenderingContext::getActiveUniform(WebGLProgram* program, unsigned long index, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + ActiveInfo info; + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return 0; + } + if (!m_context->getActiveUniform(program, index, info)) { + return 0; + } + return WebGLActiveInfo::create(info.name, info.type, info.size); +} + +int WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name) +{ + return m_context->getAttribLocation(program, name); +} + +WebGLGetInfo WebGLRenderingContext::getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + + if (pname != GraphicsContext3D::BUFFER_SIZE && pname != GraphicsContext3D::BUFFER_USAGE) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + + WebGLStateRestorer(this, false); + int value; + m_context->getBufferParameteriv(target, pname, &value); + if (pname == GraphicsContext3D::BUFFER_SIZE) + return WebGLGetInfo(static_cast(value)); + else + return WebGLGetInfo(static_cast(value)); +} + +PassRefPtr WebGLRenderingContext::getContextAttributes() +{ + // We always need to return a new WebGLContextAttributes object to + // prevent the user from mutating any cached version. + return WebGLContextAttributes::create(m_context->getContextAttributes()); +} + +unsigned long WebGLRenderingContext::getError() +{ + return m_context->getError(); +} + +WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target != GraphicsContext3D::FRAMEBUFFER + || (attachment != GraphicsContext3D::COLOR_ATTACHMENT0 + && attachment != GraphicsContext3D::DEPTH_ATTACHMENT + && attachment != GraphicsContext3D::STENCIL_ATTACHMENT) + || (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE + && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME + && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL + && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE)) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + + if (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) { + WebGLStateRestorer(this, false); + int value; + m_context->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) + return WebGLGetInfo(static_cast(value)); + else + return WebGLGetInfo(static_cast(value)); + } else { + WebGLStateRestorer(this, false); + int type = 0; + m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type); + int value = 0; + m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value); + // FIXME: should consider canonicalizing these objects + switch (type) { + case GraphicsContext3D::RENDERBUFFER: { + RefPtr tmp = WebGLRenderbuffer::create(this, value); + addObject(tmp.get()); + return WebGLGetInfo(PassRefPtr(tmp)); + } + case GraphicsContext3D::TEXTURE: { + RefPtr tmp = WebGLTexture::create(this, value); + addObject(tmp.get()); + return WebGLGetInfo(PassRefPtr(tmp)); + } + default: + // FIXME: raise exception? + return WebGLGetInfo(); + } + } +} + +WebGLGetInfo WebGLRenderingContext::getParameter(unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + WebGLStateRestorer(this, false); + switch (pname) { + case GraphicsContext3D::ACTIVE_TEXTURE: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE: + return getWebGLFloatArrayParameter(pname); + case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE: + return getWebGLFloatArrayParameter(pname); + case GraphicsContext3D::ALPHA_BITS: + return getLongParameter(pname); + case GraphicsContext3D::ARRAY_BUFFER_BINDING: + return WebGLGetInfo(PassRefPtr(m_boundArrayBuffer)); + case GraphicsContext3D::BLEND: + return getBooleanParameter(pname); + case GraphicsContext3D::BLEND_COLOR: + return getWebGLFloatArrayParameter(pname); + case GraphicsContext3D::BLEND_DST_ALPHA: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLEND_DST_RGB: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLEND_EQUATION_ALPHA: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLEND_EQUATION_RGB: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLEND_SRC_ALPHA: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLEND_SRC_RGB: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::BLUE_BITS: + return getLongParameter(pname); + case GraphicsContext3D::COLOR_CLEAR_VALUE: + return getWebGLFloatArrayParameter(pname); + case GraphicsContext3D::COLOR_WRITEMASK: + return getWebGLUnsignedByteArrayParameter(pname); + case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS: + // Defined as null in the spec + return WebGLGetInfo(); + case GraphicsContext3D::CULL_FACE: + return getBooleanParameter(pname); + case GraphicsContext3D::CULL_FACE_MODE: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::CURRENT_PROGRAM: + return WebGLGetInfo(PassRefPtr(m_currentProgram)); + case GraphicsContext3D::DEPTH_BITS: + return getLongParameter(pname); + case GraphicsContext3D::DEPTH_CLEAR_VALUE: + return getFloatParameter(pname); + case GraphicsContext3D::DEPTH_FUNC: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::DEPTH_RANGE: + return getWebGLFloatArrayParameter(pname); + case GraphicsContext3D::DEPTH_TEST: + return getBooleanParameter(pname); + case GraphicsContext3D::DEPTH_WRITEMASK: + return getBooleanParameter(pname); + case GraphicsContext3D::DITHER: + return getBooleanParameter(pname); + case GraphicsContext3D::ELEMENT_ARRAY_BUFFER_BINDING: + return WebGLGetInfo(PassRefPtr(m_boundElementArrayBuffer)); + case GraphicsContext3D::FRAMEBUFFER_BINDING: + return WebGLGetInfo(PassRefPtr(m_framebufferBinding)); + case GraphicsContext3D::FRONT_FACE: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::GENERATE_MIPMAP_HINT: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::GREEN_BITS: + return getLongParameter(pname); + case GraphicsContext3D::LINE_WIDTH: + return getFloatParameter(pname); + case GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE: + return getLongParameter(pname); + case GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_RENDERBUFFER_SIZE: + return getLongParameter(pname); + case GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_TEXTURE_SIZE: + return getLongParameter(pname); + case GraphicsContext3D::MAX_VARYING_VECTORS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_VERTEX_ATTRIBS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS: + return getLongParameter(pname); + case GraphicsContext3D::MAX_VIEWPORT_DIMS: + return getWebGLIntArrayParameter(pname); + case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS: + return getLongParameter(pname); + case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS: + // FIXME: should we always return 0 for this? + return getLongParameter(pname); + case GraphicsContext3D::PACK_ALIGNMENT: + return getLongParameter(pname); + case GraphicsContext3D::POLYGON_OFFSET_FACTOR: + return getFloatParameter(pname); + case GraphicsContext3D::POLYGON_OFFSET_FILL: + return getBooleanParameter(pname); + case GraphicsContext3D::POLYGON_OFFSET_UNITS: + return getFloatParameter(pname); + case GraphicsContext3D::RED_BITS: + return getLongParameter(pname); + case GraphicsContext3D::RENDERBUFFER_BINDING: + return WebGLGetInfo(PassRefPtr(m_renderbufferBinding)); + case GraphicsContext3D::SAMPLE_BUFFERS: + return getLongParameter(pname); + case GraphicsContext3D::SAMPLE_COVERAGE_INVERT: + return getBooleanParameter(pname); + case GraphicsContext3D::SAMPLE_COVERAGE_VALUE: + return getFloatParameter(pname); + case GraphicsContext3D::SAMPLES: + return getLongParameter(pname); + case GraphicsContext3D::SCISSOR_BOX: + return getWebGLIntArrayParameter(pname); + case GraphicsContext3D::SCISSOR_TEST: + return getBooleanParameter(pname); + case GraphicsContext3D::STENCIL_BACK_FAIL: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_FUNC: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_FAIL: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_PASS: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_REF: + return getLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_VALUE_MASK: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BACK_WRITEMASK: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_BITS: + return getLongParameter(pname); + case GraphicsContext3D::STENCIL_CLEAR_VALUE: + return getLongParameter(pname); + case GraphicsContext3D::STENCIL_FAIL: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_FUNC: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_PASS_DEPTH_FAIL: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_PASS_DEPTH_PASS: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_REF: + return getLongParameter(pname); + case GraphicsContext3D::STENCIL_TEST: + return getBooleanParameter(pname); + case GraphicsContext3D::STENCIL_VALUE_MASK: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::STENCIL_WRITEMASK: + return getUnsignedLongParameter(pname); + case GraphicsContext3D::SUBPIXEL_BITS: + return getLongParameter(pname); + case GraphicsContext3D::TEXTURE_BINDING_2D: + return WebGLGetInfo(PassRefPtr(m_textureUnits[m_activeTextureUnit].m_texture2DBinding)); + case GraphicsContext3D::TEXTURE_BINDING_CUBE_MAP: + return WebGLGetInfo(PassRefPtr(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding)); + case GraphicsContext3D::UNPACK_ALIGNMENT: + // FIXME: should this be "long" in the spec? + return getIntParameter(pname); + case GraphicsContext3D::VIEWPORT: + return getWebGLIntArrayParameter(pname); + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } +} + +WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return WebGLGetInfo(); + } + + WebGLStateRestorer(this, false); + int value = 0; + switch (pname) { + case GraphicsContext3D::DELETE_STATUS: + case GraphicsContext3D::LINK_STATUS: + case GraphicsContext3D::VALIDATE_STATUS: + m_context->getProgramiv(program, pname, &value); + return WebGLGetInfo(static_cast(value)); + case GraphicsContext3D::INFO_LOG_LENGTH: + case GraphicsContext3D::ATTACHED_SHADERS: + case GraphicsContext3D::ACTIVE_ATTRIBUTES: + case GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH: + case GraphicsContext3D::ACTIVE_UNIFORMS: + case GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH: + m_context->getProgramiv(program, pname, &value); + return WebGLGetInfo(static_cast(value)); + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } +} + +String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return ""; + } + WebGLStateRestorer(this, false); + return m_context->getProgramInfoLog(program); +} + +WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target != GraphicsContext3D::RENDERBUFFER) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + + WebGLStateRestorer(this, false); + int value = 0; + switch (pname) { + case GraphicsContext3D::RENDERBUFFER_WIDTH: + case GraphicsContext3D::RENDERBUFFER_HEIGHT: + case GraphicsContext3D::RENDERBUFFER_RED_SIZE: + case GraphicsContext3D::RENDERBUFFER_GREEN_SIZE: + case GraphicsContext3D::RENDERBUFFER_BLUE_SIZE: + case GraphicsContext3D::RENDERBUFFER_ALPHA_SIZE: + case GraphicsContext3D::RENDERBUFFER_DEPTH_SIZE: + case GraphicsContext3D::RENDERBUFFER_STENCIL_SIZE: + m_context->getRenderbufferParameteriv(target, pname, &value); + return WebGLGetInfo(static_cast(value)); + case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT: + m_context->getRenderbufferParameteriv(target, pname, &value); + return WebGLGetInfo(static_cast(value)); + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } +} + +WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return WebGLGetInfo(); + } + WebGLStateRestorer(this, false); + int value = 0; + switch (pname) { + case GraphicsContext3D::DELETE_STATUS: + case GraphicsContext3D::COMPILE_STATUS: + m_context->getShaderiv(shader, pname, &value); + return WebGLGetInfo(static_cast(value)); + case GraphicsContext3D::SHADER_TYPE: + m_context->getShaderiv(shader, pname, &value); + return WebGLGetInfo(static_cast(value)); + case GraphicsContext3D::INFO_LOG_LENGTH: + case GraphicsContext3D::SHADER_SOURCE_LENGTH: + m_context->getShaderiv(shader, pname, &value); + return WebGLGetInfo(static_cast(value)); + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } +} + +String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return ""; + } + WebGLStateRestorer(this, false); + return m_context->getShaderInfoLog(shader); +} + +String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return ""; + } + WebGLStateRestorer(this, false); + return m_context->getShaderSource(shader); +} + +String WebGLRenderingContext::getString(unsigned long name) +{ + WebGLStateRestorer(this, false); + return m_context->getString(name); +} + +WebGLGetInfo WebGLRenderingContext::getTexParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (target != GraphicsContext3D::TEXTURE_2D + && target != GraphicsContext3D::TEXTURE_CUBE_MAP) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + WebGLStateRestorer(this, false); + int value = 0; + switch (pname) { + case GraphicsContext3D::TEXTURE_MAG_FILTER: + case GraphicsContext3D::TEXTURE_MIN_FILTER: + case GraphicsContext3D::TEXTURE_WRAP_S: + case GraphicsContext3D::TEXTURE_WRAP_T: + m_context->getTexParameteriv(target, pname, &value); + return WebGLGetInfo(static_cast(value)); + default: + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } +} + +WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || uniformLocation->program() != program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return WebGLGetInfo(); + } + long location = uniformLocation->location(); + + WebGLStateRestorer(this, false); + // FIXME: make this more efficient using WebGLUniformLocation and caching types in it + int activeUniforms = 0; + m_context->getProgramiv(program, GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms); + for (int i = 0; i < activeUniforms; i++) { + ActiveInfo info; + if (!m_context->getActiveUniform(program, i, info)) + return WebGLGetInfo(); + // Now need to look this up by name again to find its location + long loc = m_context->getUniformLocation(program, info.name); + if (loc == location) { + // Found it. Use the type in the ActiveInfo to determine the return type. + GraphicsContext3D::WebGLEnumType baseType; + unsigned length; + switch (info.type) { + case GraphicsContext3D::BOOL: + baseType = GraphicsContext3D::BOOL; + length = 1; + break; + case GraphicsContext3D::BOOL_VEC2: + baseType = GraphicsContext3D::BOOL; + length = 2; + break; + case GraphicsContext3D::BOOL_VEC3: + baseType = GraphicsContext3D::BOOL; + length = 3; + break; + case GraphicsContext3D::BOOL_VEC4: + baseType = GraphicsContext3D::BOOL; + length = 4; + break; + case GraphicsContext3D::INT: + baseType = GraphicsContext3D::INT; + length = 1; + break; + case GraphicsContext3D::INT_VEC2: + baseType = GraphicsContext3D::INT; + length = 2; + break; + case GraphicsContext3D::INT_VEC3: + baseType = GraphicsContext3D::INT; + length = 3; + break; + case GraphicsContext3D::INT_VEC4: + baseType = GraphicsContext3D::INT; + length = 4; + break; + case GraphicsContext3D::FLOAT: + baseType = GraphicsContext3D::FLOAT; + length = 1; + break; + case GraphicsContext3D::FLOAT_VEC2: + baseType = GraphicsContext3D::FLOAT; + length = 2; + break; + case GraphicsContext3D::FLOAT_VEC3: + baseType = GraphicsContext3D::FLOAT; + length = 3; + break; + case GraphicsContext3D::FLOAT_VEC4: + baseType = GraphicsContext3D::FLOAT; + length = 4; + break; + case GraphicsContext3D::FLOAT_MAT2: + baseType = GraphicsContext3D::FLOAT; + length = 4; + break; + case GraphicsContext3D::FLOAT_MAT3: + baseType = GraphicsContext3D::FLOAT; + length = 9; + break; + case GraphicsContext3D::FLOAT_MAT4: + baseType = GraphicsContext3D::FLOAT; + length = 16; + break; + default: + // Can't handle this type + // FIXME: what to do about samplers? + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return WebGLGetInfo(); + } + switch (baseType) { + case GraphicsContext3D::FLOAT: { + float value[16] = {0}; + m_context->getUniformfv(program, location, value); + if (length == 1) + return WebGLGetInfo(value[0]); + else + return WebGLGetInfo(WebGLFloatArray::create(value, length)); + } + case GraphicsContext3D::INT: { + int value[16] = {0}; + m_context->getUniformiv(program, location, value); + if (length == 1) + return WebGLGetInfo(static_cast(value[0])); + else + return WebGLGetInfo(WebGLIntArray::create(value, length)); + } + case GraphicsContext3D::BOOL: { + int value[16] = {0}; + m_context->getUniformiv(program, location, value); + if (length == 1) + return WebGLGetInfo(static_cast(value[0])); + else { + unsigned char boolValue[16] = {0}; + for (unsigned j = 0; j < length; j++) + boolValue[j] = static_cast(value[j]); + return WebGLGetInfo(WebGLUnsignedByteArray::create(boolValue, length)); + } + } + default: + notImplemented(); + } + } + } + // If we get here, something went wrong in our unfortunately complex logic above + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return WebGLGetInfo(); +} + +PassRefPtr WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return 0; + } + WebGLStateRestorer(this, false); + return WebGLUniformLocation::create(program, m_context->getUniformLocation(program, name)); +} + +WebGLGetInfo WebGLRenderingContext::getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + WebGLStateRestorer(this, false); + switch (pname) { + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: { + int name = 0; + m_context->getVertexAttribiv(index, pname, &name); + if (name == 0) + return WebGLGetInfo(); + RefPtr tmp = WebGLBuffer::create(this, name); + addObject(tmp.get()); + return WebGLGetInfo(PassRefPtr(tmp)); + } + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_ENABLED: + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_NORMALIZED: { + int value = 0; + m_context->getVertexAttribiv(index, pname, &value); + return WebGLGetInfo(static_cast(value)); + } + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_SIZE: + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_STRIDE: { + int value = 0; + m_context->getVertexAttribiv(index, pname, &value); + return WebGLGetInfo(static_cast(value)); + } + case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE: { + int value = 0; + m_context->getVertexAttribiv(index, pname, &value); + return WebGLGetInfo(static_cast(value)); + } + case GraphicsContext3D::CURRENT_VERTEX_ATTRIB: { + float value[4] = {0}; + m_context->getVertexAttribfv(index, pname, value); + return WebGLGetInfo(WebGLFloatArray::create(value, 4)); + } + default: { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); + } + } +} + +long WebGLRenderingContext::getVertexAttribOffset(unsigned long index, unsigned long pname) +{ + long result = m_context->getVertexAttribOffset(index, pname); + cleanupAfterGraphicsCall(false); + return result; +} + +void WebGLRenderingContext::hint(unsigned long target, unsigned long mode) +{ + m_context->hint(target, mode); + cleanupAfterGraphicsCall(false); +} + +bool WebGLRenderingContext::isBuffer(WebGLBuffer* buffer) +{ + if (!buffer) + return false; + + return m_context->isBuffer(buffer); +} + +bool WebGLRenderingContext::isEnabled(unsigned long cap) +{ + return m_context->isEnabled(cap); +} + +bool WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer) +{ + if (!framebuffer) + return false; + + return m_context->isFramebuffer(framebuffer); +} + +bool WebGLRenderingContext::isProgram(WebGLProgram* program) +{ + if (!program) + return false; + + return m_context->isProgram(program); +} + +bool WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer) +{ + if (!renderbuffer) + return false; + + return m_context->isRenderbuffer(renderbuffer); +} + +bool WebGLRenderingContext::isShader(WebGLShader* shader) +{ + if (!shader) + return false; + + return m_context->isShader(shader); +} + +bool WebGLRenderingContext::isTexture(WebGLTexture* texture) +{ + if (!texture) + return false; + + return m_context->isTexture(texture); +} + +void WebGLRenderingContext::lineWidth(double width) +{ + m_context->lineWidth((float) width); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->linkProgram(program); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::pixelStorei(unsigned long pname, long param) +{ + m_context->pixelStorei(pname, param); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::polygonOffset(double factor, double units) +{ + m_context->polygonOffset((float) factor, (float) units); + cleanupAfterGraphicsCall(false); +} + +PassRefPtr WebGLRenderingContext::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) +{ + RefPtr array = m_context->readPixels(x, y, width, height, format, type); + cleanupAfterGraphicsCall(false); + return array; +} + +void WebGLRenderingContext::releaseShaderCompiler() +{ + m_context->releaseShaderCompiler(); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) +{ + m_context->renderbufferStorage(target, internalformat, width, height); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::sampleCoverage(double value, bool invert) +{ + m_context->sampleCoverage((float) value, invert); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::scissor(long x, long y, unsigned long width, unsigned long height) +{ + m_context->scissor(x, y, width, height); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& string, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!shader || shader->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + m_context->shaderSource(shader, string); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilFunc(unsigned long func, long ref, unsigned long mask) +{ + m_context->stencilFunc(func, ref, mask); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) +{ + m_context->stencilFuncSeparate(face, func, ref, mask); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilMask(unsigned long mask) +{ + m_context->stencilMask(mask); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilMaskSeparate(unsigned long face, unsigned long mask) +{ + m_context->stencilMaskSeparate(face, mask); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) +{ + m_context->stencilOp(fail, zfail, zpass); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) +{ + m_context->stencilOpSeparate(face, fail, zfail, zpass); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned width, unsigned height, unsigned border, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +{ + // FIXME: For now we ignore any errors returned + // FIXME: Need to make sure passed buffer has enough bytes to define the texture + ec = 0; + m_context->texImage2D(target, level, internalformat, width, height, + border, format, type, pixels ? pixels->baseAddress() : 0); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, ImageData* pixels, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + // FIXME: For now we ignore any errors returned + // FIXME: Need a form of this call that can take both a pixel buffer and flipY and premultiplyAlpha flags + UNUSED_PARAM(flipY); + UNUSED_PARAM(premultiplyAlpha); + ec = 0; + m_context->texImage2D(target, level, GraphicsContext3D::RGBA, pixels->width(), pixels->height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels->data()->data()->data()); + //RLP: m_context->texImage2D(target, level, pixels, flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + ec = 0; + if (!image) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + CachedImage* cachedImage = image->cachedImage(); + if (!cachedImage) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + // FIXME: For now we ignore any errors returned + m_context->texImage2D(target, level, cachedImage->image(), flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + ec = 0; + if (!canvas) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + ImageBuffer* buffer = canvas->buffer(); + if (!buffer) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + // FIXME: For now we ignore any errors returned + m_context->texImage2D(target, level, buffer->image(), flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, + bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + // FIXME: Need implement this call + UNUSED_PARAM(target); + UNUSED_PARAM(level); + UNUSED_PARAM(video); + UNUSED_PARAM(flipY); + UNUSED_PARAM(premultiplyAlpha); + + ec = 0; + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texParameterf(unsigned target, unsigned pname, float param) +{ + m_context->texParameterf(target, pname, param); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texParameteri(unsigned target, unsigned pname, int param) +{ + m_context->texParameteri(target, pname, param); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned width, unsigned height, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode& ec) +{ + // FIXME: For now we ignore any errors returned + // FIXME: Need to make sure passed buffer has enough bytes to define the texture + ec = 0; + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels ? pixels->baseAddress() : 0); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + // FIXME: For now we ignore any errors returned + UNUSED_PARAM(flipY); + UNUSED_PARAM(premultiplyAlpha); + ec = 0; + m_context->texSubImage2D(target, level, xoffset, yoffset, pixels->width(), pixels->height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels->data()->data()->data()); + //RLP: m_context->texSubImage2D(target, level, xoffset, yoffset, pixels, flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + // FIXME: For now we ignore any errors returned + ec = 0; + if (!image) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + CachedImage* cachedImage = image->cachedImage(); + if (!cachedImage) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + m_context->texSubImage2D(target, level, xoffset, yoffset, cachedImage->image(), flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + ec = 0; + if (!canvas) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + ImageBuffer* buffer = canvas->buffer(); + if (!buffer) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + // FIXME: For now we ignore any errors returned + m_context->texSubImage2D(target, level, xoffset, yoffset, buffer->image(), flipY, premultiplyAlpha); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode& ec) +{ + // FIXME: Need to implement this call + UNUSED_PARAM(target); + UNUSED_PARAM(level); + UNUSED_PARAM(xoffset); + UNUSED_PARAM(yoffset); + UNUSED_PARAM(video); + UNUSED_PARAM(flipY); + UNUSED_PARAM(premultiplyAlpha); + ec = 0; + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform1f(location->location(), x); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + m_context->uniform1fv(location->location(), v->data(), v->length()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + m_context->uniform1fv(location->location(), v, size); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform1i(location->location(), x); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + m_context->uniform1iv(location->location(), v->data(), v->length()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + m_context->uniform1iv(location->location(), v, size); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform2f(location->location(), x, y); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 2 + m_context->uniform2fv(location->location(), v->data(), v->length() / 2); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 2 + m_context->uniform2fv(location->location(), v, size / 2); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform2i(location->location(), x, y); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 2 + m_context->uniform2iv(location->location(), v->data(), v->length() / 2); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 2 + m_context->uniform2iv(location->location(), v, size / 2); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform3f(location->location(), x, y, z); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 3 + m_context->uniform3fv(location->location(), v->data(), v->length() / 3); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 3 + m_context->uniform3fv(location->location(), v, size / 3); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform3i(location->location(), x, y, z); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 3 + m_context->uniform3iv(location->location(), v->data(), v->length() / 3); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 3 + m_context->uniform3iv(location->location(), v, size / 3); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform4f(location->location(), x, y, z, w); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniform4fv(location->location(), v->data(), v->length() / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniform4fv(location->location(), v, size / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->uniform4i(location->location(), x, y, z, w); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniform4iv(location->location(), v->data(), v->length() / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniform4iv(location->location(), v, size / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniformMatrix2fv(location->location(), transpose, v->data(), v->length() / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 4 + m_context->uniformMatrix2fv(location->location(), transpose, v, size / 4); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 9 + m_context->uniformMatrix3fv(location->location(), transpose, v->data(), v->length() / 9); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 9 + m_context->uniformMatrix3fv(location->location(), transpose, v, size / 9); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* v, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 16 + m_context->uniformMatrix4fv(location->location(), transpose, v->data(), v->length() / 16); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* v, int size, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!location || location->program() != m_currentProgram) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + if (!v) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + // FIXME: length needs to be a multiple of 16 + m_context->uniformMatrix4fv(location->location(), transpose, v, size / 16); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + m_currentProgram = program; + m_context->useProgram(program); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::validateProgram(WebGLProgram* program, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!program || program->context() != this) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); + return; + } + + m_context->validateProgram(program); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib1f(unsigned long indx, float v0) +{ + m_context->vertexAttrib1f(indx, v0); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib1fv(unsigned long indx, WebGLFloatArray* v) +{ + // FIXME: Need to make sure array is big enough for attribute being set + m_context->vertexAttrib1fv(indx, v->data()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib1fv(unsigned long indx, float* v, int size) +{ + // FIXME: Need to make sure array is big enough for attribute being set + UNUSED_PARAM(size); + + m_context->vertexAttrib1fv(indx, v); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib2f(unsigned long indx, float v0, float v1) +{ + m_context->vertexAttrib2f(indx, v0, v1); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib2fv(unsigned long indx, WebGLFloatArray* v) +{ + // FIXME: Need to make sure array is big enough for attribute being set + m_context->vertexAttrib2fv(indx, v->data()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib2fv(unsigned long indx, float* v, int size) +{ + // FIXME: Need to make sure array is big enough for attribute being set + UNUSED_PARAM(size); + + m_context->vertexAttrib2fv(indx, v); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib3f(unsigned long indx, float v0, float v1, float v2) +{ + m_context->vertexAttrib3f(indx, v0, v1, v2); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib3fv(unsigned long indx, WebGLFloatArray* v) +{ + // FIXME: Need to make sure array is big enough for attribute being set + m_context->vertexAttrib3fv(indx, v->data()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib3fv(unsigned long indx, float* v, int size) +{ + // FIXME: Need to make sure array is big enough for attribute being set + UNUSED_PARAM(size); + + m_context->vertexAttrib3fv(indx, v); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib4f(unsigned long indx, float v0, float v1, float v2, float v3) +{ + m_context->vertexAttrib4f(indx, v0, v1, v2, v3); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib4fv(unsigned long indx, WebGLFloatArray* v) +{ + // FIXME: Need to make sure array is big enough for attribute being set + m_context->vertexAttrib4fv(indx, v->data()); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttrib4fv(unsigned long indx, float* v, int size) +{ + // FIXME: Need to make sure array is big enough for attribute being set + UNUSED_PARAM(size); + + m_context->vertexAttrib4fv(indx, v); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, unsigned long stride, unsigned long offset, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); + if (!m_boundArrayBuffer || indx >= m_maxVertexAttribs) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + if (indx >= m_vertexAttribState.size()) + m_vertexAttribState.resize(indx + 1); + + // Determine the number of elements the bound buffer can hold, given the offset, size, type and stride + long bytesPerElement = size * sizeInBytes(type, ec); + if (bytesPerElement <= 0) + return; + long validatedStride = bytesPerElement; + if (stride != 0) { + if ((long) stride < bytesPerElement) { + m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE); + return; + } + + validatedStride = stride; + } + + // Avoid off-by-one errors in numElements computation. + // For the last element, we will only touch the data for the + // element and nothing beyond it. + long bytesRemaining = m_boundArrayBuffer->byteLength(GraphicsContext3D::ARRAY_BUFFER) - offset; + if (bytesRemaining < bytesPerElement) + m_vertexAttribState[indx].numElements = 0; + else + m_vertexAttribState[indx].numElements = 1 + (bytesRemaining - bytesPerElement) / validatedStride; + + m_context->vertexAttribPointer(indx, size, type, normalized, stride, offset); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::viewport(long x, long y, unsigned long width, unsigned long height) +{ + if (isnan(x)) + x = 0; + if (isnan(y)) + y = 0; + if (isnan(width)) + width = 100; + if (isnan(height)) + height = 100; + m_context->viewport(x, y, width, height); + cleanupAfterGraphicsCall(false); +} + +void WebGLRenderingContext::removeObject(CanvasObject* object) +{ + m_canvasObjects.remove(object); +} + +void WebGLRenderingContext::addObject(CanvasObject* object) +{ + removeObject(object); + m_canvasObjects.add(object); +} + +void WebGLRenderingContext::detachAndRemoveAllObjects() +{ + HashSet >::iterator pend = m_canvasObjects.end(); + for (HashSet >::iterator it = m_canvasObjects.begin(); it != pend; ++it) + (*it)->detachContext(); + + m_canvasObjects.clear(); +} + +WebGLGetInfo WebGLRenderingContext::getBooleanParameter(unsigned long pname) +{ + unsigned char value; + m_context->getBooleanv(pname, &value); + return WebGLGetInfo(static_cast(value)); +} + +WebGLGetInfo WebGLRenderingContext::getFloatParameter(unsigned long pname) +{ + float value; + m_context->getFloatv(pname, &value); + return WebGLGetInfo(static_cast(value)); +} + +WebGLGetInfo WebGLRenderingContext::getIntParameter(unsigned long pname) +{ + return getLongParameter(pname); +} + +WebGLGetInfo WebGLRenderingContext::getLongParameter(unsigned long pname) +{ + int value; + m_context->getIntegerv(pname, &value); + return WebGLGetInfo(static_cast(value)); +} + +WebGLGetInfo WebGLRenderingContext::getUnsignedLongParameter(unsigned long pname) +{ + int value; + m_context->getIntegerv(pname, &value); + return WebGLGetInfo(static_cast(value)); +} + +WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(unsigned long pname) +{ + float value[4] = {0}; + m_context->getFloatv(pname, value); + unsigned length = 0; + switch (pname) { + case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE: + case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE: + case GraphicsContext3D::DEPTH_RANGE: + length = 2; + break; + case GraphicsContext3D::BLEND_COLOR: + case GraphicsContext3D::COLOR_CLEAR_VALUE: + length = 4; + break; + default: + notImplemented(); + } + return WebGLGetInfo(WebGLFloatArray::create(value, length)); +} + +WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(unsigned long pname) +{ + int value[4] = {0}; + m_context->getIntegerv(pname, value); + unsigned length = 0; + switch (pname) { + case GraphicsContext3D::MAX_VIEWPORT_DIMS: + length = 2; + break; + case GraphicsContext3D::SCISSOR_BOX: + case GraphicsContext3D::VIEWPORT: + length = 4; + break; + default: + notImplemented(); + } + return WebGLGetInfo(WebGLIntArray::create(value, length)); +} + +WebGLGetInfo WebGLRenderingContext::getWebGLUnsignedByteArrayParameter(unsigned long pname) +{ + unsigned char value[4] = {0}; + m_context->getBooleanv(pname, value); + unsigned length = 0; + switch (pname) { + case GraphicsContext3D::COLOR_WRITEMASK: + length = 4; + break; + default: + notImplemented(); + } + return WebGLGetInfo(WebGLUnsignedByteArray::create(value, length)); +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h new file mode 100644 index 0000000..90d4fab --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.h @@ -0,0 +1,360 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLRenderingContext_h +#define WebGLRenderingContext_h + +#include "CanvasRenderingContext.h" +#include "ExceptionCode.h" +#include "WebGLFloatArray.h" +#include "WebGLGetInfo.h" +#include "WebGLIntArray.h" +#include "WebGLUnsignedByteArray.h" +#include "GraphicsContext3D.h" +#include "PlatformString.h" + +namespace WebCore { + +class WebGLActiveInfo; +class WebGLBuffer; +class WebGLContextAttributes; +class WebGLFramebuffer; +class CanvasObject; +class WebGLProgram; +class WebGLRenderbuffer; +class WebGLShader; +class WebGLTexture; +class WebGLUniformLocation; +class HTMLImageElement; +class HTMLVideoElement; +class ImageData; +class WebKitCSSMatrix; + + class WebGLRenderingContext : public CanvasRenderingContext { + public: + static PassOwnPtr create(HTMLCanvasElement*, WebGLContextAttributes*); + virtual ~WebGLRenderingContext(); + + virtual bool is3d() const { return true; } + + // Helper to return the size in bytes of OpenGL data types + // like GL_FLOAT, GL_INT, etc. + int sizeInBytes(int type, ExceptionCode& ec); + + void activeTexture(unsigned long texture, ExceptionCode& ec); + void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec); + void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name, ExceptionCode& ec); + void bindBuffer(unsigned long target, WebGLBuffer*, ExceptionCode& ec); + void bindFramebuffer(unsigned long target, WebGLFramebuffer*, ExceptionCode& ec); + void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*, ExceptionCode& ec); + void bindTexture(unsigned long target, WebGLTexture*, ExceptionCode& ec); + void blendColor(double red, double green, double blue, double alpha); + void blendEquation(unsigned long mode); + void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha); + void blendFunc(unsigned long sfactor, unsigned long dfactor); + void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha); + + void bufferData(unsigned long target, int size, unsigned long usage, ExceptionCode&); + void bufferData(unsigned long target, WebGLArray* data, unsigned long usage, ExceptionCode&); + void bufferSubData(unsigned long target, long offset, WebGLArray* data, ExceptionCode&); + + unsigned long checkFramebufferStatus(unsigned long target); + void clear(unsigned long mask); + void clearColor(double red, double green, double blue, double alpha); + void clearDepth(double); + void clearStencil(long); + void colorMask(bool red, bool green, bool blue, bool alpha); + void compileShader(WebGLShader*, ExceptionCode& ec); + + //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data); + //void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data); + + void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border); + void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height); + + PassRefPtr createBuffer(); + PassRefPtr createFramebuffer(); + PassRefPtr createProgram(); + PassRefPtr createRenderbuffer(); + PassRefPtr createShader(unsigned long type, ExceptionCode&); + PassRefPtr createTexture(); + + void cullFace(unsigned long mode); + + void deleteBuffer(WebGLBuffer*); + void deleteFramebuffer(WebGLFramebuffer*); + void deleteProgram(WebGLProgram*); + void deleteRenderbuffer(WebGLRenderbuffer*); + void deleteShader(WebGLShader*); + void deleteTexture(WebGLTexture*); + + void depthFunc(unsigned long); + void depthMask(bool); + void depthRange(double zNear, double zFar); + void detachShader(WebGLProgram*, WebGLShader*, ExceptionCode&); + void disable(unsigned long cap); + void disableVertexAttribArray(unsigned long index, ExceptionCode&); + void drawArrays(unsigned long mode, long first, long count, ExceptionCode&); + void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset, ExceptionCode&); + + void enable(unsigned long cap); + void enableVertexAttribArray(unsigned long index, ExceptionCode&); + void finish(); + void flush(); + void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*, ExceptionCode& ec); + void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level, ExceptionCode& ec); + void frontFace(unsigned long mode); + void generateMipmap(unsigned long target); + + PassRefPtr getActiveAttrib(WebGLProgram*, unsigned long index, ExceptionCode&); + PassRefPtr getActiveUniform(WebGLProgram*, unsigned long index, ExceptionCode&); + + int getAttribLocation(WebGLProgram*, const String& name); + + WebGLGetInfo getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode&); + + PassRefPtr getContextAttributes(); + + unsigned long getError(); + + WebGLGetInfo getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode&); + + WebGLGetInfo getParameter(unsigned long pname, ExceptionCode&); + + WebGLGetInfo getProgramParameter(WebGLProgram*, unsigned long pname, ExceptionCode&); + + String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec); + + WebGLGetInfo getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode&); + + WebGLGetInfo getShaderParameter(WebGLShader*, unsigned long pname, ExceptionCode& ec); + + String getShaderInfoLog(WebGLShader*, ExceptionCode& ec); + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + String getShaderSource(WebGLShader*, ExceptionCode&); + String getString(unsigned long name); + + WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&); + + WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, ExceptionCode&); + + PassRefPtr getUniformLocation(WebGLProgram*, const String&, ExceptionCode&); + + WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode&); + + long getVertexAttribOffset(unsigned long index, unsigned long pname); + + void hint(unsigned long target, unsigned long mode); + bool isBuffer(WebGLBuffer*); + bool isEnabled(unsigned long cap); + bool isFramebuffer(WebGLFramebuffer*); + bool isProgram(WebGLProgram*); + bool isRenderbuffer(WebGLRenderbuffer*); + bool isShader(WebGLShader*); + bool isTexture(WebGLTexture*); + void lineWidth(double); + void linkProgram(WebGLProgram*, ExceptionCode&); + void pixelStorei(unsigned long pname, long param); + void polygonOffset(double factor, double units); + + PassRefPtr readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type); + + void releaseShaderCompiler(); + void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height); + void sampleCoverage(double value, bool invert); + void scissor(long x, long y, unsigned long width, unsigned long height); + void shaderSource(WebGLShader*, const String&, ExceptionCode&); + void stencilFunc(unsigned long func, long ref, unsigned long mask); + void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask); + void stencilMask(unsigned long); + void stencilMaskSeparate(unsigned long face, unsigned long mask); + void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass); + void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass); + + void texImage2D(unsigned target, unsigned level, unsigned internalformat, + unsigned width, unsigned height, unsigned border, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, ImageData* pixels, + bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, + bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, + bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, + bool flipY, bool premultiplyAlpha, ExceptionCode&); + + void texParameterf(unsigned target, unsigned pname, float param); + void texParameteri(unsigned target, unsigned pname, int param); + + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + unsigned width, unsigned height, + unsigned format, unsigned type, WebGLArray* pixels, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&); + void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, + HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&); + + void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&); + void uniform1fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode&); + void uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); + void uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode&); + void uniform1iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode&); + void uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); + void uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode&); + void uniform2fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode&); + void uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); + void uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode&); + void uniform2iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode&); + void uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); + void uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode&); + void uniform3fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode&); + void uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); + void uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode&); + void uniform3iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode&); + void uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); + void uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode&); + void uniform4fv(const WebGLUniformLocation* location, WebGLFloatArray* v, ExceptionCode&); + void uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&); + void uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode&); + void uniform4iv(const WebGLUniformLocation* location, WebGLIntArray* v, ExceptionCode&); + void uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&); + void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* value, ExceptionCode&); + void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); + void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* value, ExceptionCode&); + void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); + void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, WebGLFloatArray* value, ExceptionCode&); + void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&); + + void useProgram(WebGLProgram*, ExceptionCode&); + void validateProgram(WebGLProgram*, ExceptionCode&); + + void vertexAttrib1f(unsigned long indx, float x); + void vertexAttrib1fv(unsigned long indx, WebGLFloatArray* values); + void vertexAttrib1fv(unsigned long indx, float* values, int size); + void vertexAttrib2f(unsigned long indx, float x, float y); + void vertexAttrib2fv(unsigned long indx, WebGLFloatArray* values); + void vertexAttrib2fv(unsigned long indx, float* values, int size); + void vertexAttrib3f(unsigned long indx, float x, float y, float z); + void vertexAttrib3fv(unsigned long indx, WebGLFloatArray* values); + void vertexAttrib3fv(unsigned long indx, float* values, int size); + void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w); + void vertexAttrib4fv(unsigned long indx, WebGLFloatArray* values); + void vertexAttrib4fv(unsigned long indx, float* values, int size); + void vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, + unsigned long stride, unsigned long offset, ExceptionCode&); + + void viewport(long x, long y, unsigned long width, unsigned long height); + + GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } + + void reshape(int width, int height); + + // Helpers for notification about paint events. + void beginPaint(); + void endPaint(); + + void removeObject(CanvasObject*); + + private: + friend class CanvasObject; + + WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr); + + void addObject(CanvasObject*); + void detachAndRemoveAllObjects(); + + void markContextChanged(); + void cleanupAfterGraphicsCall(bool changed) + { + if (changed) + markContextChanged(); + } + + // Basic validation of count and offset against number of elements in element array buffer + bool validateElementArraySize(unsigned long count, unsigned long type, long offset); + + // Conservative but quick index validation + bool validateIndexArrayConservative(unsigned long type, long& numElementsRequired); + + // Precise but slow index validation -- only done if conservative checks fail + bool validateIndexArrayPrecise(unsigned long count, unsigned long type, long offset, long& numElementsRequired); + bool validateRenderingState(long numElements); + + OwnPtr m_context; + bool m_needsUpdate; + bool m_markedCanvasDirty; + // FIXME: I think this is broken -- it does not increment any + // reference counts, so may refer to destroyed objects. + HashSet > m_canvasObjects; + + // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and stored values for ELEMENT_ARRAY_BUFFER + RefPtr m_boundArrayBuffer; + RefPtr m_boundElementArrayBuffer; + + // Cached values for vertex attrib range checks + class VertexAttribState { + public: + VertexAttribState() : enabled(false), numElements(0) { } + bool enabled; + long numElements; + }; + + Vector m_vertexAttribState; + unsigned m_maxVertexAttribs; + + RefPtr m_currentProgram; + RefPtr m_framebufferBinding; + RefPtr m_renderbufferBinding; + class TextureUnitState { + public: + RefPtr m_texture2DBinding; + RefPtr m_textureCubeMapBinding; + }; + TextureUnitState m_textureUnits[32]; + unsigned long m_activeTextureUnit; + + // Helpers for getParameter and others + WebGLGetInfo getBooleanParameter(unsigned long pname); + WebGLGetInfo getFloatParameter(unsigned long pname); + WebGLGetInfo getIntParameter(unsigned long pname); + WebGLGetInfo getLongParameter(unsigned long pname); + WebGLGetInfo getUnsignedLongParameter(unsigned long pname); + WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname); + WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname); + WebGLGetInfo getWebGLUnsignedByteArrayParameter(unsigned long pname); + + friend class WebGLStateRestorer; + }; + +} // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl new file mode 100644 index 0000000..ce01f43 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLRenderingContext.idl @@ -0,0 +1,676 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + Conditional=3D_CANVAS, + InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443, + ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54 + ] WebGLRenderingContext : CanvasRenderingContext { + + /* ClearBufferMask */ + const unsigned int DEPTH_BUFFER_BIT = 0x00000100; + const unsigned int STENCIL_BUFFER_BIT = 0x00000400; + const unsigned int COLOR_BUFFER_BIT = 0x00004000; + + /* Boolean */ + const unsigned int FALSE = 0; + const unsigned int TRUE = 1; + + /* BeginMode */ + const unsigned int POINTS = 0x0000; + const unsigned int LINES = 0x0001; + const unsigned int LINE_LOOP = 0x0002; + const unsigned int LINE_STRIP = 0x0003; + const unsigned int TRIANGLES = 0x0004; + const unsigned int TRIANGLE_STRIP = 0x0005; + const unsigned int TRIANGLE_FAN = 0x0006; + + /* AlphaFunction (not supported in ES20) */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* BlendingFactorDest */ + const unsigned int ZERO = 0; + const unsigned int ONE = 1; + const unsigned int SRC_COLOR = 0x0300; + const unsigned int ONE_MINUS_SRC_COLOR = 0x0301; + const unsigned int SRC_ALPHA = 0x0302; + const unsigned int ONE_MINUS_SRC_ALPHA = 0x0303; + const unsigned int DST_ALPHA = 0x0304; + const unsigned int ONE_MINUS_DST_ALPHA = 0x0305; + + /* BlendingFactorSrc */ + /* ZERO */ + /* ONE */ + const unsigned int DST_COLOR = 0x0306; + const unsigned int ONE_MINUS_DST_COLOR = 0x0307; + const unsigned int SRC_ALPHA_SATURATE = 0x0308; + /* SRC_ALPHA */ + /* ONE_MINUS_SRC_ALPHA */ + /* DST_ALPHA */ + /* ONE_MINUS_DST_ALPHA */ + + /* BlendEquationSeparate */ + const unsigned int FUNC_ADD = 0x8006; + const unsigned int BLEND_EQUATION = 0x8009; + const unsigned int BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + const unsigned int BLEND_EQUATION_ALPHA = 0x883D; + + /* BlendSubtract */ + const unsigned int FUNC_SUBTRACT = 0x800A; + const unsigned int FUNC_REVERSE_SUBTRACT = 0x800B; + + /* Separate Blend Functions */ + const unsigned int BLEND_DST_RGB = 0x80C8; + const unsigned int BLEND_SRC_RGB = 0x80C9; + const unsigned int BLEND_DST_ALPHA = 0x80CA; + const unsigned int BLEND_SRC_ALPHA = 0x80CB; + const unsigned int CONSTANT_COLOR = 0x8001; + const unsigned int ONE_MINUS_CONSTANT_COLOR = 0x8002; + const unsigned int CONSTANT_ALPHA = 0x8003; + const unsigned int ONE_MINUS_CONSTANT_ALPHA = 0x8004; + const unsigned int BLEND_COLOR = 0x8005; + + /* Buffer Objects */ + const unsigned int ARRAY_BUFFER = 0x8892; + const unsigned int ELEMENT_ARRAY_BUFFER = 0x8893; + const unsigned int ARRAY_BUFFER_BINDING = 0x8894; + const unsigned int ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + + const unsigned int STREAM_DRAW = 0x88E0; + const unsigned int STATIC_DRAW = 0x88E4; + const unsigned int DYNAMIC_DRAW = 0x88E8; + + const unsigned int BUFFER_SIZE = 0x8764; + const unsigned int BUFFER_USAGE = 0x8765; + + const unsigned int CURRENT_VERTEX_ATTRIB = 0x8626; + + /* CullFaceMode */ + const unsigned int FRONT = 0x0404; + const unsigned int BACK = 0x0405; + const unsigned int FRONT_AND_BACK = 0x0408; + + /* DepthFunction */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* EnableCap */ + const unsigned int TEXTURE_2D = 0x0DE1; + const unsigned int CULL_FACE = 0x0B44; + const unsigned int BLEND = 0x0BE2; + const unsigned int DITHER = 0x0BD0; + const unsigned int STENCIL_TEST = 0x0B90; + const unsigned int DEPTH_TEST = 0x0B71; + const unsigned int SCISSOR_TEST = 0x0C11; + const unsigned int POLYGON_OFFSET_FILL = 0x8037; + const unsigned int SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + const unsigned int SAMPLE_COVERAGE = 0x80A0; + + /* ErrorCode */ + const unsigned int NO_ERROR = 0; + const unsigned int INVALID_ENUM = 0x0500; + const unsigned int INVALID_VALUE = 0x0501; + const unsigned int INVALID_OPERATION = 0x0502; + const unsigned int OUT_OF_MEMORY = 0x0505; + + /* FrontFaceDirection */ + const unsigned int CW = 0x0900; + const unsigned int CCW = 0x0901; + + /* GetPName */ + const unsigned int LINE_WIDTH = 0x0B21; + const unsigned int ALIASED_POINT_SIZE_RANGE = 0x846D; + const unsigned int ALIASED_LINE_WIDTH_RANGE = 0x846E; + const unsigned int CULL_FACE_MODE = 0x0B45; + const unsigned int FRONT_FACE = 0x0B46; + const unsigned int DEPTH_RANGE = 0x0B70; + const unsigned int DEPTH_WRITEMASK = 0x0B72; + const unsigned int DEPTH_CLEAR_VALUE = 0x0B73; + const unsigned int DEPTH_FUNC = 0x0B74; + const unsigned int STENCIL_CLEAR_VALUE = 0x0B91; + const unsigned int STENCIL_FUNC = 0x0B92; + const unsigned int STENCIL_FAIL = 0x0B94; + const unsigned int STENCIL_PASS_DEPTH_FAIL = 0x0B95; + const unsigned int STENCIL_PASS_DEPTH_PASS = 0x0B96; + const unsigned int STENCIL_REF = 0x0B97; + const unsigned int STENCIL_VALUE_MASK = 0x0B93; + const unsigned int STENCIL_WRITEMASK = 0x0B98; + const unsigned int STENCIL_BACK_FUNC = 0x8800; + const unsigned int STENCIL_BACK_FAIL = 0x8801; + const unsigned int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + const unsigned int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + const unsigned int STENCIL_BACK_REF = 0x8CA3; + const unsigned int STENCIL_BACK_VALUE_MASK = 0x8CA4; + const unsigned int STENCIL_BACK_WRITEMASK = 0x8CA5; + const unsigned int VIEWPORT = 0x0BA2; + const unsigned int SCISSOR_BOX = 0x0C10; + /* SCISSOR_TEST */ + const unsigned int COLOR_CLEAR_VALUE = 0x0C22; + const unsigned int COLOR_WRITEMASK = 0x0C23; + const unsigned int UNPACK_ALIGNMENT = 0x0CF5; + const unsigned int PACK_ALIGNMENT = 0x0D05; + const unsigned int MAX_TEXTURE_SIZE = 0x0D33; + const unsigned int MAX_VIEWPORT_DIMS = 0x0D3A; + const unsigned int SUBPIXEL_BITS = 0x0D50; + const unsigned int RED_BITS = 0x0D52; + const unsigned int GREEN_BITS = 0x0D53; + const unsigned int BLUE_BITS = 0x0D54; + const unsigned int ALPHA_BITS = 0x0D55; + const unsigned int DEPTH_BITS = 0x0D56; + const unsigned int STENCIL_BITS = 0x0D57; + const unsigned int POLYGON_OFFSET_UNITS = 0x2A00; + /* POLYGON_OFFSET_FILL */ + const unsigned int POLYGON_OFFSET_FACTOR = 0x8038; + const unsigned int TEXTURE_BINDING_2D = 0x8069; + const unsigned int SAMPLE_BUFFERS = 0x80A8; + const unsigned int SAMPLES = 0x80A9; + const unsigned int SAMPLE_COVERAGE_VALUE = 0x80AA; + const unsigned int SAMPLE_COVERAGE_INVERT = 0x80AB; + + /* GetTextureParameter */ + /* TEXTURE_MAG_FILTER */ + /* TEXTURE_MIN_FILTER */ + /* TEXTURE_WRAP_S */ + /* TEXTURE_WRAP_T */ + + const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; + const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /* HintMode */ + const unsigned int DONT_CARE = 0x1100; + const unsigned int FASTEST = 0x1101; + const unsigned int NICEST = 0x1102; + + /* HintTarget */ + const unsigned int GENERATE_MIPMAP_HINT = 0x8192; + + /* DataType */ + const unsigned int BYTE = 0x1400; + const unsigned int UNSIGNED_BYTE = 0x1401; + const unsigned int SHORT = 0x1402; + const unsigned int UNSIGNED_SHORT = 0x1403; + const unsigned int INT = 0x1404; + const unsigned int UNSIGNED_INT = 0x1405; + const unsigned int FLOAT = 0x1406; + const unsigned int FIXED = 0x140C; + + /* PixelFormat */ + const unsigned int DEPTH_COMPONENT = 0x1902; + const unsigned int ALPHA = 0x1906; + const unsigned int RGB = 0x1907; + const unsigned int RGBA = 0x1908; + const unsigned int LUMINANCE = 0x1909; + const unsigned int LUMINANCE_ALPHA = 0x190A; + + /* PixelType */ + /* UNSIGNED_BYTE */ + const unsigned int UNSIGNED_SHORT_4_4_4_4 = 0x8033; + const unsigned int UNSIGNED_SHORT_5_5_5_1 = 0x8034; + const unsigned int UNSIGNED_SHORT_5_6_5 = 0x8363; + + /* Shaders */ + const unsigned int FRAGMENT_SHADER = 0x8B30; + const unsigned int VERTEX_SHADER = 0x8B31; + const unsigned int MAX_VERTEX_ATTRIBS = 0x8869; + const unsigned int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + const unsigned int MAX_VARYING_VECTORS = 0x8DFC; + const unsigned int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + const unsigned int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + const unsigned int MAX_TEXTURE_IMAGE_UNITS = 0x8872; + const unsigned int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + const unsigned int SHADER_TYPE = 0x8B4F; + const unsigned int DELETE_STATUS = 0x8B80; + const unsigned int LINK_STATUS = 0x8B82; + const unsigned int VALIDATE_STATUS = 0x8B83; + const unsigned int ATTACHED_SHADERS = 0x8B85; + const unsigned int ACTIVE_UNIFORMS = 0x8B86; + const unsigned int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; + const unsigned int ACTIVE_ATTRIBUTES = 0x8B89; + const unsigned int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; + const unsigned int SHADING_LANGUAGE_VERSION = 0x8B8C; + const unsigned int CURRENT_PROGRAM = 0x8B8D; + + /* StencilFunction */ + const unsigned int NEVER = 0x0200; + const unsigned int LESS = 0x0201; + const unsigned int EQUAL = 0x0202; + const unsigned int LEQUAL = 0x0203; + const unsigned int GREATER = 0x0204; + const unsigned int NOTEQUAL = 0x0205; + const unsigned int GEQUAL = 0x0206; + const unsigned int ALWAYS = 0x0207; + + /* StencilOp */ + /* ZERO */ + const unsigned int KEEP = 0x1E00; + const unsigned int REPLACE = 0x1E01; + const unsigned int INCR = 0x1E02; + const unsigned int DECR = 0x1E03; + const unsigned int INVERT = 0x150A; + const unsigned int INCR_WRAP = 0x8507; + const unsigned int DECR_WRAP = 0x8508; + + /* StringName */ + const unsigned int VENDOR = 0x1F00; + const unsigned int RENDERER = 0x1F01; + const unsigned int VERSION = 0x1F02; + const unsigned int EXTENSIONS = 0x1F03; + + /* TextureMagFilter */ + const unsigned int NEAREST = 0x2600; + const unsigned int LINEAR = 0x2601; + + /* TextureMinFilter */ + /* NEAREST */ + /* LINEAR */ + const unsigned int NEAREST_MIPMAP_NEAREST = 0x2700; + const unsigned int LINEAR_MIPMAP_NEAREST = 0x2701; + const unsigned int NEAREST_MIPMAP_LINEAR = 0x2702; + const unsigned int LINEAR_MIPMAP_LINEAR = 0x2703; + + /* TextureParameterName */ + const unsigned int TEXTURE_MAG_FILTER = 0x2800; + const unsigned int TEXTURE_MIN_FILTER = 0x2801; + const unsigned int TEXTURE_WRAP_S = 0x2802; + const unsigned int TEXTURE_WRAP_T = 0x2803; + + /* TextureTarget */ + /* TEXTURE_2D */ + const unsigned int TEXTURE = 0x1702; + + const unsigned int TEXTURE_CUBE_MAP = 0x8513; + const unsigned int TEXTURE_BINDING_CUBE_MAP = 0x8514; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + const unsigned int MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /* TextureUnit */ + const unsigned int TEXTURE0 = 0x84C0; + const unsigned int TEXTURE1 = 0x84C1; + const unsigned int TEXTURE2 = 0x84C2; + const unsigned int TEXTURE3 = 0x84C3; + const unsigned int TEXTURE4 = 0x84C4; + const unsigned int TEXTURE5 = 0x84C5; + const unsigned int TEXTURE6 = 0x84C6; + const unsigned int TEXTURE7 = 0x84C7; + const unsigned int TEXTURE8 = 0x84C8; + const unsigned int TEXTURE9 = 0x84C9; + const unsigned int TEXTURE10 = 0x84CA; + const unsigned int TEXTURE11 = 0x84CB; + const unsigned int TEXTURE12 = 0x84CC; + const unsigned int TEXTURE13 = 0x84CD; + const unsigned int TEXTURE14 = 0x84CE; + const unsigned int TEXTURE15 = 0x84CF; + const unsigned int TEXTURE16 = 0x84D0; + const unsigned int TEXTURE17 = 0x84D1; + const unsigned int TEXTURE18 = 0x84D2; + const unsigned int TEXTURE19 = 0x84D3; + const unsigned int TEXTURE20 = 0x84D4; + const unsigned int TEXTURE21 = 0x84D5; + const unsigned int TEXTURE22 = 0x84D6; + const unsigned int TEXTURE23 = 0x84D7; + const unsigned int TEXTURE24 = 0x84D8; + const unsigned int TEXTURE25 = 0x84D9; + const unsigned int TEXTURE26 = 0x84DA; + const unsigned int TEXTURE27 = 0x84DB; + const unsigned int TEXTURE28 = 0x84DC; + const unsigned int TEXTURE29 = 0x84DD; + const unsigned int TEXTURE30 = 0x84DE; + const unsigned int TEXTURE31 = 0x84DF; + const unsigned int ACTIVE_TEXTURE = 0x84E0; + + /* TextureWrapMode */ + const unsigned int REPEAT = 0x2901; + const unsigned int CLAMP_TO_EDGE = 0x812F; + const unsigned int MIRRORED_REPEAT = 0x8370; + + /* Uniform Types */ + const unsigned int FLOAT_VEC2 = 0x8B50; + const unsigned int FLOAT_VEC3 = 0x8B51; + const unsigned int FLOAT_VEC4 = 0x8B52; + const unsigned int INT_VEC2 = 0x8B53; + const unsigned int INT_VEC3 = 0x8B54; + const unsigned int INT_VEC4 = 0x8B55; + const unsigned int BOOL = 0x8B56; + const unsigned int BOOL_VEC2 = 0x8B57; + const unsigned int BOOL_VEC3 = 0x8B58; + const unsigned int BOOL_VEC4 = 0x8B59; + const unsigned int FLOAT_MAT2 = 0x8B5A; + const unsigned int FLOAT_MAT3 = 0x8B5B; + const unsigned int FLOAT_MAT4 = 0x8B5C; + const unsigned int SAMPLER_2D = 0x8B5E; + const unsigned int SAMPLER_CUBE = 0x8B60; + + /* Vertex Arrays */ + const unsigned int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + const unsigned int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + const unsigned int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + const unsigned int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + const unsigned int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + const unsigned int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + const unsigned int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /* Read Format */ + const unsigned int IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + const unsigned int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /* Shader Source */ + const unsigned int COMPILE_STATUS = 0x8B81; + const unsigned int INFO_LOG_LENGTH = 0x8B84; + const unsigned int SHADER_SOURCE_LENGTH = 0x8B88; + const unsigned int SHADER_COMPILER = 0x8DFA; + + /* Shader Binary */ + const unsigned int SHADER_BINARY_FORMATS = 0x8DF8; + const unsigned int NUM_SHADER_BINARY_FORMATS = 0x8DF9; + + /* Shader Precision-Specified Types */ + const unsigned int LOW_FLOAT = 0x8DF0; + const unsigned int MEDIUM_FLOAT = 0x8DF1; + const unsigned int HIGH_FLOAT = 0x8DF2; + const unsigned int LOW_INT = 0x8DF3; + const unsigned int MEDIUM_INT = 0x8DF4; + const unsigned int HIGH_INT = 0x8DF5; + + /* Framebuffer Object. */ + const unsigned int FRAMEBUFFER = 0x8D40; + const unsigned int RENDERBUFFER = 0x8D41; + + const unsigned int RGBA4 = 0x8056; + const unsigned int RGB5_A1 = 0x8057; + const unsigned int RGB565 = 0x8D62; + const unsigned int DEPTH_COMPONENT16 = 0x81A5; + const unsigned int STENCIL_INDEX = 0x1901; + const unsigned int STENCIL_INDEX8 = 0x8D48; + + const unsigned int RENDERBUFFER_WIDTH = 0x8D42; + const unsigned int RENDERBUFFER_HEIGHT = 0x8D43; + const unsigned int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + const unsigned int RENDERBUFFER_RED_SIZE = 0x8D50; + const unsigned int RENDERBUFFER_GREEN_SIZE = 0x8D51; + const unsigned int RENDERBUFFER_BLUE_SIZE = 0x8D52; + const unsigned int RENDERBUFFER_ALPHA_SIZE = 0x8D53; + const unsigned int RENDERBUFFER_DEPTH_SIZE = 0x8D54; + const unsigned int RENDERBUFFER_STENCIL_SIZE = 0x8D55; + + const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + + const unsigned int COLOR_ATTACHMENT0 = 0x8CE0; + const unsigned int DEPTH_ATTACHMENT = 0x8D00; + const unsigned int STENCIL_ATTACHMENT = 0x8D20; + + const unsigned int NONE = 0; + + const unsigned int FRAMEBUFFER_COMPLETE = 0x8CD5; + const unsigned int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + const unsigned int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + const unsigned int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + const unsigned int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + + const unsigned int FRAMEBUFFER_BINDING = 0x8CA6; + const unsigned int RENDERBUFFER_BINDING = 0x8CA7; + const unsigned int MAX_RENDERBUFFER_SIZE = 0x84E8; + + const unsigned int INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + long sizeInBytes(in unsigned long type) raises(DOMException); + + void activeTexture(in unsigned long texture) raises(DOMException); + void attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); + void bindAttribLocation(in WebGLProgram program, in unsigned long index, in DOMString name) raises(DOMException); + void bindBuffer(in unsigned long target, in WebGLBuffer buffer) raises(DOMException); + void bindFramebuffer(in unsigned long target, in WebGLFramebuffer framebuffer) raises(DOMException); + void bindRenderbuffer(in unsigned long target, in WebGLRenderbuffer renderbuffer) raises(DOMException); + void bindTexture(in unsigned long target, in WebGLTexture texture) raises(DOMException); + void blendColor(in double red, in double green, in double blue, in double alpha); + void blendEquation( in unsigned long mode ); + void blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha); + void blendFunc(in unsigned long sfactor, in unsigned long dfactor); + void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); + + // Supported forms: + // void bufferData (in GLenum target, in GLsizei size, in GLenum usage); + // void bufferData (in GLenum target, in WebGLArray data, in GLenum usage); + [Custom] void bufferData() raises(DOMException); + // Supported forms: + // void bufferSubData (in GLenum target, in GLsizeiptr offset, in WebGLArray data); + [Custom] void bufferSubData() raises(DOMException); + + unsigned long checkFramebufferStatus(in unsigned long target); + void clear(in unsigned long mask); + void clearColor(in double red, in double green, in double blue, in double alpha); + void clearDepth(in double depth); + void clearStencil(in long s); + void colorMask(in boolean red, in boolean green, in boolean blue, in boolean alpha); + void compileShader(in WebGLShader shader) raises(DOMException); + + //void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in unsigned long width, in unsigned long height, in long border, in unsigned long imageSize, const void* data); + //void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long imageSize, const void* data); + + void copyTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long x, in long y, in unsigned long width, in unsigned long height, in long border); + void copyTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long x, in long y, in unsigned long width, in unsigned long height); + + WebGLBuffer createBuffer(); + WebGLFramebuffer createFramebuffer(); + WebGLProgram createProgram(); + WebGLRenderbuffer createRenderbuffer(); + WebGLShader createShader(in unsigned long type) raises(DOMException); + WebGLTexture createTexture(); + + void cullFace(in unsigned long mode); + + void deleteBuffer(in WebGLBuffer buffer); + void deleteFramebuffer(in WebGLFramebuffer framebuffer); + void deleteProgram(in WebGLProgram program); + void deleteRenderbuffer(in WebGLRenderbuffer renderbuffer); + void deleteShader(in WebGLShader shader); + void deleteTexture(in WebGLTexture texture); + + void depthFunc(in unsigned long func); + void depthMask(in boolean flag); + // FIXME: this differs from the current WebGL spec (depthRangef) + void depthRange(in double zNear, in double zFar); + void detachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); + void disable(in unsigned long cap); + void disableVertexAttribArray(in unsigned long index) raises(DOMException); + void drawArrays(in unsigned long mode, in long first, in unsigned long count) raises(DOMException); + void drawElements (in unsigned long mode, in long count, in unsigned long type, in unsigned long offset) raises(DOMException); + + void enable(in unsigned long cap); + void enableVertexAttribArray(in unsigned long index) raises(DOMException); + void finish(); + void flush(); + void framebufferRenderbuffer(in unsigned long target, in unsigned long attachment, in unsigned long renderbuffertarget, in WebGLRenderbuffer renderbuffer) raises(DOMException); + void framebufferTexture2D(in unsigned long target, in unsigned long attachment, in unsigned long textarget, in WebGLTexture texture, in long level) raises(DOMException); + void frontFace(in unsigned long mode); + void generateMipmap(in unsigned long target); + + WebGLActiveInfo getActiveAttrib(in WebGLProgram program, in unsigned long index) + raises (DOMException); + WebGLActiveInfo getActiveUniform(in WebGLProgram program, in unsigned long index) + raises (DOMException); + + // WebGLShaderArray glGetAttachedShaders(GLuint program); + + int getAttribLocation(in WebGLProgram program, in DOMString name); + + // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [Custom] void getBufferParameter(); + + WebGLContextAttributes getContextAttributes(); + + unsigned long getError(); + + // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException); + [Custom] void getFramebufferAttachmentParameter(); + // any getParameter(in unsigned long pname) raises(DOMException); + [Custom] void getParameter(); + // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException); + [Custom] void getProgramParameter(); + DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException); + // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [Custom] void getRenderbufferParameter(); + // any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException); + [Custom] void getShaderParameter() raises(DOMException); + + DOMString getShaderInfoLog(in WebGLShader shader) raises(DOMException); + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + DOMString getShaderSource(in WebGLShader shader) raises(DOMException); + DOMString getString(in unsigned long name); + + // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [Custom] void getTexParameter(); + + // any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException); + [Custom] void getUniform(); + + WebGLUniformLocation getUniformLocation(in WebGLProgram program, in DOMString name) raises(DOMException); + + // any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException); + [Custom] void getVertexAttrib(); + + long getVertexAttribOffset(in unsigned long index, in unsigned long pname); + + void hint(in unsigned long target, in unsigned long mode); + boolean isBuffer(in WebGLBuffer buffer); + boolean isEnabled(in unsigned long cap); + boolean isFramebuffer(in WebGLFramebuffer framebuffer); + boolean isProgram(in WebGLProgram program); + boolean isRenderbuffer(in WebGLRenderbuffer renderbuffer); + boolean isShader(in WebGLShader shader); + boolean isTexture(in WebGLTexture texture); + void lineWidth(in double width); + void linkProgram(in WebGLProgram program) raises(DOMException); + void pixelStorei(in unsigned long pname, in long param); + void polygonOffset(in double factor, in double units); + + WebGLArray readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type); + + void releaseShaderCompiler(); + void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in unsigned long width, in unsigned long height); + void sampleCoverage(in double value, in boolean invert); + void scissor(in long x, in long y, in unsigned long width, in unsigned long height); + void shaderSource(in WebGLShader shader, in DOMString string) raises(DOMException); + void stencilFunc(in unsigned long func, in long ref, in unsigned long mask); + void stencilFuncSeparate(in unsigned long face, in unsigned long func, in long ref, in unsigned long mask); + void stencilMask(in unsigned long mask); + void stencilMaskSeparate(in unsigned long face, in unsigned long mask); + void stencilOp(in unsigned long fail, in unsigned long zfail, in unsigned long zpass); + void stencilOpSeparate(in unsigned long face, in unsigned long fail, in unsigned long zfail, in unsigned long zpass); + + void texParameterf(in unsigned long target, in unsigned long pname, in float param); + void texParameteri(in unsigned long target, in unsigned long pname, in long param); + + // Supported forms: + // void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, + // in GLint border, in GLenum format, in GLenum type, in WebGLArray pixels); + // void texImage2D(in GLenum target, in GLint level, in ImageData pixels, + // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); + // void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image, + // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); + // void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas, + // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); + // void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video, + // [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha); + [Custom] void texImage2D(); + + // Supported forms: + // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, + // in GLsizei width, in GLsizei height, + // in GLenum format, in GLenum type, in WebGLArray pixels); + // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, + // in ImageData pixels, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); + // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, + // in HTMLImageElement image, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); + // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, + // in HTMLCanvasElement canvas, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); + // void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, + // in HTMLVideoElement video, [Optional] GLboolean flipY, [Optional] in premultiplyAlpha); + [Custom] void texSubImage2D(); + + void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); + [Custom] void uniform1fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException); + void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException); + [Custom] void uniform1iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException); + void uniform2f(in WebGLUniformLocation location, in float x, in float y) raises(DOMException); + [Custom] void uniform2fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException); + void uniform2i(in WebGLUniformLocation location, in long x, in long y) raises(DOMException); + [Custom] void uniform2iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException); + void uniform3f(in WebGLUniformLocation location, in float x, in float y, in float z) raises(DOMException); + [Custom] void uniform3fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException); + void uniform3i(in WebGLUniformLocation location, in long x, in long y, in long z) raises(DOMException); + [Custom] void uniform3iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException); + void uniform4f(in WebGLUniformLocation location, in float x, in float y, in float z, in float w) raises(DOMException); + [Custom] void uniform4fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException); + void uniform4i(in WebGLUniformLocation location, in long x, in long y, in long z, in long w) raises(DOMException); + [Custom] void uniform4iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException); + + [Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException); + [Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException); + [Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException); + + void useProgram(in WebGLProgram program) raises(DOMException); + void validateProgram(in WebGLProgram program) raises(DOMException); + + void vertexAttrib1f(in unsigned long indx, in float x); + [Custom] void vertexAttrib1fv(in unsigned long indx, in WebGLFloatArray values); + void vertexAttrib2f(in unsigned long indx, in float x, in float y); + [Custom] void vertexAttrib2fv(in unsigned long indx, in WebGLFloatArray values); + void vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z); + [Custom] void vertexAttrib3fv(in unsigned long indx, in WebGLFloatArray values); + void vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w); + [Custom] void vertexAttrib4fv(in unsigned long indx, in WebGLFloatArray values); + void vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, + in long stride, in unsigned long offset) raises(DOMException); + + void viewport(in long x, in long y, in unsigned long width, in unsigned long height); + }; +} + diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp new file mode 100644 index 0000000..a353b15 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLShader.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLShader::create(WebGLRenderingContext* ctx, GraphicsContext3D::WebGLEnumType type) +{ + return adoptRef(new WebGLShader(ctx, type)); +} + +WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GraphicsContext3D::WebGLEnumType type) + : CanvasObject(ctx) +{ + setObject(context()->graphicsContext3D()->createShader(type)); +} + +void WebGLShader::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteShader(object); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h new file mode 100644 index 0000000..1ef912c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLShader_h +#define WebGLShader_h + +#include "CanvasObject.h" + +#include +#include + +namespace WebCore { + + class WebGLShader : public CanvasObject { + public: + virtual ~WebGLShader() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType); + + private: + WebGLShader(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType); + + virtual void _deleteObject(Platform3DObject); + }; + +} // namespace WebCore + +#endif // WebGLShader_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl new file mode 100644 index 0000000..2d79e49 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShader.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLShader { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp new file mode 100644 index 0000000..f96a290 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLShortArray.h" + +namespace WebCore { + +PassRefPtr WebGLShortArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(short)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLShortArray::create(short* array, unsigned length) +{ + RefPtr a = WebGLShortArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLShortArray::create(PassRefPtr buffer, + int byteOffset, + unsigned length) +{ + // Make sure the offset results in valid alignment. + if ((byteOffset % sizeof(short)) != 0) + return NULL; + + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(short))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLShortArray(buffer, byteOffset, length)); +} + +WebGLShortArray::WebGLShortArray(PassRefPtr buffer, int byteOffset, unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLShortArray::length() const { + return m_size; +} + +unsigned WebGLShortArray::byteLength() const { + return m_size * sizeof(short); +} + +PassRefPtr WebGLShortArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(short); + unsigned limitByte = startByte + length * sizeof(short); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLShortArray::set(WebGLShortArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(short), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h new file mode 100644 index 0000000..70c66ca --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLShortArray_h +#define WebGLShortArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLShortArray : public WebGLArray { + public: + virtual bool isShortArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(short* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + short* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + short* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, short& result) const + { + if (index >= m_size) + return false; + result = item(index); + return true; + } + + short get(unsigned index) const + { + return item(index); + } + + short item(unsigned index) const + { + ASSERT(index < m_size); + short* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLShortArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLShortArray(PassRefPtr buffer, int byteOffset, unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLShortArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl new file mode 100644 index 0000000..59dce76 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLShortArray.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] WebGLShortArray : WebGLArray { + long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLShortArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp new file mode 100644 index 0000000..ae09b48 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLTexture.h" +#include "WebGLRenderingContext.h" + +namespace WebCore { + +PassRefPtr WebGLTexture::create(WebGLRenderingContext* ctx) +{ + return adoptRef(new WebGLTexture(ctx)); +} + +PassRefPtr WebGLTexture::create(WebGLRenderingContext* ctx, Platform3DObject obj) +{ + return adoptRef(new WebGLTexture(ctx, obj)); +} + +WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx) + : CanvasObject(ctx) + , cubeMapRWrapModeInitialized(false) +{ + setObject(context()->graphicsContext3D()->createTexture()); +} + +WebGLTexture::WebGLTexture(WebGLRenderingContext* ctx, Platform3DObject obj) + : CanvasObject(ctx) + , cubeMapRWrapModeInitialized(false) +{ + setObject(obj, false); +} + +void WebGLTexture::_deleteObject(Platform3DObject object) +{ + context()->graphicsContext3D()->deleteTexture(object); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h new file mode 100644 index 0000000..c64dd41 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLTexture_h +#define WebGLTexture_h + +#include "CanvasObject.h" + +#include +#include + +namespace WebCore { + + class WebGLTexture : public CanvasObject { + public: + virtual ~WebGLTexture() { deleteObject(); } + + static PassRefPtr create(WebGLRenderingContext*); + + // For querying previously created objects via e.g. getFramebufferAttachmentParameter + // FIXME: should consider canonicalizing these objects + static PassRefPtr create(WebGLRenderingContext*, Platform3DObject); + + bool isCubeMapRWrapModeInitialized() { + return cubeMapRWrapModeInitialized; + } + + void setCubeMapRWrapModeInitialized(bool initialized) { + cubeMapRWrapModeInitialized = initialized; + } + + protected: + WebGLTexture(WebGLRenderingContext*); + WebGLTexture(WebGLRenderingContext*, Platform3DObject); + + virtual void _deleteObject(Platform3DObject); + + private: + bool cubeMapRWrapModeInitialized; + }; + +} // namespace WebCore + +#endif // WebGLTexture_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl new file mode 100644 index 0000000..0200e7e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLTexture.idl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLTexture { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp new file mode 100644 index 0000000..2157470 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLUniformLocation.h" + +namespace WebCore { + +PassRefPtr WebGLUniformLocation::create(WebGLProgram* program, long location) +{ + return adoptRef(new WebGLUniformLocation(program, location)); +} + +WebGLUniformLocation::WebGLUniformLocation(WebGLProgram* program, long location) + : m_program(program) + , m_location(location) +{ +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h new file mode 100644 index 0000000..f9f7a11 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLUniformLocation_h +#define WebGLUniformLocation_h + +#include "CanvasObject.h" +#include "WebGLProgram.h" + +#include +#include + +namespace WebCore { + +class WebGLUniformLocation : public RefCounted { +public: + virtual ~WebGLUniformLocation() { } + + static PassRefPtr create(WebGLProgram* program, long location); + + WebGLProgram* program() const { return m_program.get(); } + + long location() const { return m_location; } + +protected: + WebGLUniformLocation(WebGLProgram* program, long location); + +private: + RefPtr m_program; + long m_location; +}; + +} // namespace WebCore + +#endif // WebGLUniformLocation_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl new file mode 100644 index 0000000..f25e834 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUniformLocation.idl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor] WebGLUniformLocation { + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp new file mode 100644 index 0000000..3fd1b50 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLUnsignedByteArray.h" + +namespace WebCore { + +PassRefPtr WebGLUnsignedByteArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(unsigned char)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLUnsignedByteArray::create(unsigned char* array, unsigned length) +{ + RefPtr a = WebGLUnsignedByteArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLUnsignedByteArray::create(PassRefPtr buffer, + int byteOffset, + unsigned length) +{ + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(unsigned char))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLUnsignedByteArray(buffer, byteOffset, length)); +} + +WebGLUnsignedByteArray::WebGLUnsignedByteArray(PassRefPtr buffer, int byteOffset, unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLUnsignedByteArray::length() const { + return m_size; +} + +unsigned WebGLUnsignedByteArray::byteLength() const { + return m_size * sizeof(unsigned char); +} + +PassRefPtr WebGLUnsignedByteArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(unsigned char); + unsigned limitByte = startByte + length * sizeof(unsigned char); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLUnsignedByteArray::set(WebGLUnsignedByteArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(unsigned char), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h new file mode 100644 index 0000000..6909de5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLUnsignedByteArray_h +#define WebGLUnsignedByteArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLUnsignedByteArray : public WebGLArray { + public: + virtual bool isUnsignedByteArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(unsigned char* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + unsigned char* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + unsigned char* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, unsigned char& result) const + { + if (index >= m_size) + return false; + result = item(index); + return true; + } + + unsigned char get(unsigned index) const + { + return item(index); + } + + unsigned char item(unsigned index) const + { + ASSERT(index < m_size); + unsigned char* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLUnsignedByteArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLUnsignedByteArray(PassRefPtr buffer, int byteOffset, unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLUnsignedByteArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl new file mode 100644 index 0000000..4de8b42 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedByteArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomConstructor, + CustomToJS + ] WebGLUnsignedByteArray : WebGLArray { + long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLUnsignedByteArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp new file mode 100644 index 0000000..97910f9 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLUnsignedIntArray.h" + +namespace WebCore { + +PassRefPtr WebGLUnsignedIntArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(unsigned int)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLUnsignedIntArray::create(unsigned int* array, unsigned length) +{ + RefPtr a = WebGLUnsignedIntArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLUnsignedIntArray::create(PassRefPtr buffer, + int byteOffset, + unsigned length) +{ + // Make sure the offset results in valid alignment. + if ((byteOffset % sizeof(unsigned int)) != 0) { + return NULL; + } + + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(unsigned int))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLUnsignedIntArray(buffer, byteOffset, length)); +} + +WebGLUnsignedIntArray::WebGLUnsignedIntArray(PassRefPtr buffer, int byteOffset, unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLUnsignedIntArray::length() const { + return m_size; +} + +unsigned WebGLUnsignedIntArray::byteLength() const { + return m_size * sizeof(unsigned int); +} + +PassRefPtr WebGLUnsignedIntArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(unsigned int); + unsigned limitByte = startByte + length * sizeof(unsigned int); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLUnsignedIntArray::set(WebGLUnsignedIntArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(unsigned int), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h new file mode 100644 index 0000000..b0d9b65 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLUnsignedIntArray_h +#define WebGLUnsignedIntArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLUnsignedIntArray : public WebGLArray { + public: + virtual bool isUnsignedIntArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(unsigned int* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + unsigned int* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + unsigned int* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, unsigned int& result) const + { + if (index >= m_size) + return false; + result = item(index); + return true; + } + + unsigned int get(unsigned index) const + { + return item(index); + } + + unsigned int item(unsigned index) const + { + ASSERT(index < m_size); + unsigned int* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLUnsignedIntArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLUnsignedIntArray(PassRefPtr buffer, int byteOffset, unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLUnsignedIntArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl new file mode 100644 index 0000000..75ff598 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedIntArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + CustomConstructor, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomToJS + ] WebGLUnsignedIntArray : WebGLArray { + unsigned long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLUnsignedIntArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp new file mode 100644 index 0000000..86fae8c --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "WebGLArrayBuffer.h" +#include "WebGLUnsignedShortArray.h" + +namespace WebCore { + +PassRefPtr WebGLUnsignedShortArray::create(unsigned length) +{ + RefPtr buffer = WebGLArrayBuffer::create(length * sizeof(unsigned short)); + return create(buffer, 0, length); +} + +PassRefPtr WebGLUnsignedShortArray::create(unsigned short* array, unsigned length) +{ + RefPtr a = WebGLUnsignedShortArray::create(length); + for (unsigned i = 0; i < length; ++i) + a->set(i, array[i]); + return a; +} + +PassRefPtr WebGLUnsignedShortArray::create(PassRefPtr buffer, + int byteOffset, + unsigned length) +{ + // Make sure the offset results in valid alignment. + if ((byteOffset % sizeof(unsigned short)) != 0) { + return NULL; + } + + if (buffer) { + // Check to make sure we are talking about a valid region of + // the given WebGLArrayBuffer's storage. + if ((byteOffset + (length * sizeof(unsigned short))) > buffer->byteLength()) + return NULL; + } + + return adoptRef(new WebGLUnsignedShortArray(buffer, byteOffset, length)); +} + +WebGLUnsignedShortArray::WebGLUnsignedShortArray(PassRefPtr buffer, + int byteOffset, + unsigned length) + : WebGLArray(buffer, byteOffset) + , m_size(length) +{ +} + +unsigned WebGLUnsignedShortArray::length() const { + return m_size; +} + +unsigned WebGLUnsignedShortArray::byteLength() const { + return m_size * sizeof(unsigned short); +} + +PassRefPtr WebGLUnsignedShortArray::slice(unsigned offset, unsigned length) { + // Check to make sure the specified region is within the bounds of + // the WebGLArrayBuffer. + unsigned startByte = m_byteOffset + offset * sizeof(unsigned short); + unsigned limitByte = startByte + length * sizeof(unsigned short); + unsigned bufferLength = buffer()->byteLength(); + if (startByte >= bufferLength || limitByte > bufferLength) + return 0; + return create(buffer(), startByte, length); +} + +void WebGLUnsignedShortArray::set(WebGLUnsignedShortArray* array, unsigned offset, ExceptionCode& ec) { + setImpl(array, offset * sizeof(unsigned short), ec); +} + +} + +#endif // ENABLE(3D_CANVAS) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h new file mode 100644 index 0000000..3bad1b6 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGLUnsignedShortArray_h +#define WebGLUnsignedShortArray_h + +#include "WebGLArray.h" +#include +#include +#include +#include + +namespace WebCore { + +class WebGLUnsignedShortArray : public WebGLArray { + public: + virtual bool isUnsignedShortArray() const { return true; } + + static PassRefPtr create(unsigned length); + static PassRefPtr create(unsigned short* array, unsigned length); + static PassRefPtr create(PassRefPtr buffer, int byteOffset, unsigned length); + + unsigned short* data() { return static_cast(baseAddress()); } + + virtual unsigned length() const; + virtual unsigned byteLength() const; + virtual PassRefPtr slice(unsigned offset, unsigned length); + + void set(unsigned index, double value) + { + if (index >= m_size) + return; + if (isnan(value)) // Clamp NaN to 0 + value = 0; + if (value < std::numeric_limits::min()) + value = std::numeric_limits::min(); + else if (value > std::numeric_limits::max()) + value = std::numeric_limits::max(); + unsigned short* storage = static_cast(m_baseAddress); + storage[index] = static_cast(value); + } + + bool get(unsigned index, unsigned short& result) const + { + if (index >= m_size) + return false; + unsigned short* storage = static_cast(m_baseAddress); + result = storage[index]; + return true; + } + + unsigned short get(unsigned index) const + { + return item(index); + } + + unsigned short item(unsigned index) const + { + ASSERT(index < m_size); + unsigned short* storage = static_cast(m_baseAddress); + return storage[index]; + } + + void set(WebGLUnsignedShortArray* array, unsigned offset, ExceptionCode& ec); + + private: + WebGLUnsignedShortArray(PassRefPtr buffer,int byteOffset,unsigned length); + unsigned m_size; +}; + +} // namespace WebCore + +#endif // WebGLUnsignedShortArray_h diff --git a/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl new file mode 100644 index 0000000..fc53929 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/canvas/WebGLUnsignedShortArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + interface [ + Conditional=3D_CANVAS, + CustomConstructor, + HasNumericIndexGetter, + HasCustomIndexSetter, + GenerateNativeConverter, + CustomToJS + ] WebGLUnsignedShortArray : WebGLArray { + long get(in unsigned long index); + // void set(in unsigned long index, in long value); + // void set(in WebGLUnsignedShortArray array, [Optional] in unsigned long offset); + // void set(in sequence array, [Optional] in unsigned long offset); + [Custom] void set(); + }; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp index eb8d49a..5539e9d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.cpp @@ -34,7 +34,6 @@ #include "InspectorFrontend.h" #include "ScriptCallStack.h" #include "ScriptObject.h" -#include "ScriptObjectQuarantine.h" namespace WebCore { @@ -55,7 +54,8 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, S , m_type(t) , m_level(l) #if ENABLE(INSPECTOR) - , m_wrappedArguments(callStack->at(0).argumentCount()) + , m_arguments(callStack->at(0).argumentCount()) + , m_scriptState(callStack->globalState()) #endif , m_frames(storeTrace ? callStack->size() : 0) , m_groupLevel(g) @@ -75,7 +75,7 @@ ConsoleMessage::ConsoleMessage(MessageSource s, MessageType t, MessageLevel l, S #if ENABLE(INSPECTOR) for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) - m_wrappedArguments[i] = quarantineValue(callStack->state(), lastCaller.argumentAt(i)); + m_arguments[i] = lastCaller.argumentAt(i); #endif } @@ -90,7 +90,7 @@ void ConsoleMessage::addToConsole(InspectorFrontend* frontend) jsonObj.set("url", m_url); jsonObj.set("groupLevel", static_cast(m_groupLevel)); jsonObj.set("repeatCount", static_cast(m_repeatCount)); - frontend->addConsoleMessage(jsonObj, m_frames, m_wrappedArguments, m_message); + frontend->addConsoleMessage(jsonObj, m_frames, m_scriptState, m_arguments, m_message); } void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend) @@ -102,15 +102,15 @@ void ConsoleMessage::updateRepeatCountInConsole(InspectorFrontend* frontend) bool ConsoleMessage::isEqual(ScriptState* state, ConsoleMessage* msg) const { #if ENABLE(INSPECTOR) - if (msg->m_wrappedArguments.size() != m_wrappedArguments.size()) + if (msg->m_arguments.size() != m_arguments.size()) return false; - if (!state && msg->m_wrappedArguments.size()) + if (!state && msg->m_arguments.size()) return false; - ASSERT_ARG(state, state || msg->m_wrappedArguments.isEmpty()); + ASSERT_ARG(state, state || msg->m_arguments.isEmpty()); - for (size_t i = 0; i < msg->m_wrappedArguments.size(); ++i) { - if (!m_wrappedArguments[i].isEqual(state, msg->m_wrappedArguments[i])) + for (size_t i = 0; i < msg->m_arguments.size(); ++i) { + if (!m_arguments[i].isEqual(state, msg->m_arguments[i])) return false; } #else diff --git a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h index 8ed6660..e9ae130 100644 --- a/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h +++ b/src/3rdparty/webkit/WebCore/inspector/ConsoleMessage.h @@ -42,7 +42,7 @@ namespace WebCore { class ScriptCallStack; class ScriptString; - class ConsoleMessage { + class ConsoleMessage : public Noncopyable { public: ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u, unsigned g); ConsoleMessage(MessageSource, MessageType, MessageLevel, ScriptCallStack*, unsigned g, bool storeTrace = false); @@ -63,7 +63,8 @@ namespace WebCore { MessageLevel m_level; String m_message; #if ENABLE(INSPECTOR) - Vector m_wrappedArguments; + Vector m_arguments; + ScriptState* m_scriptState; #endif Vector m_frames; unsigned m_line; diff --git a/src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp b/src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp new file mode 100644 index 0000000..42a2856 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InjectedScript.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InjectedScript.h" + +#if ENABLE(INSPECTOR) + +#include "PlatformString.h" +#include "SerializedScriptValue.h" +#include "ScriptFunctionCall.h" + +namespace WebCore { + +InjectedScript::InjectedScript(ScriptObject injectedScriptObject) + : m_injectedScriptObject(injectedScriptObject) +{ +} + +void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr* result, bool* hadException) +{ + ASSERT(!hasNoValue()); + ScriptFunctionCall function(m_injectedScriptObject, "dispatch"); + function.appendArgument(methodName); + function.appendArgument(arguments); + if (async) + function.appendArgument(callId); + *hadException = false; + ScriptValue resultValue = function.call(*hadException); + if (!*hadException) + *result = resultValue.serialize(m_injectedScriptObject.scriptState()); +} + +#if ENABLE(JAVASCRIPT_DEBUGGER) +PassRefPtr InjectedScript::callFrames() +{ + ASSERT(!hasNoValue()); + ScriptFunctionCall function(m_injectedScriptObject, "callFrames"); + ScriptValue callFramesValue = function.call(); + return callFramesValue.serialize(m_injectedScriptObject.scriptState()); +} +#endif + +PassRefPtr InjectedScript::wrapForConsole(ScriptValue value) +{ + ASSERT(!hasNoValue()); + ScriptFunctionCall wrapFunction(m_injectedScriptObject, "wrapObject"); + wrapFunction.appendArgument(value); + wrapFunction.appendArgument("console"); + ScriptValue r = wrapFunction.call(); + return r.serialize(m_injectedScriptObject.scriptState()); +} + +void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup) +{ + ASSERT(!hasNoValue()); + ScriptFunctionCall releaseFunction(m_injectedScriptObject, "releaseWrapperObjectGroup"); + releaseFunction.appendArgument(objectGroup); + releaseFunction.call(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InjectedScript.h b/src/3rdparty/webkit/WebCore/inspector/InjectedScript.h new file mode 100644 index 0000000..db40f80 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InjectedScript.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedScript_h +#define InjectedScript_h + +#include "InjectedScriptHost.h" +#include "ScriptObject.h" +#include +#include + +namespace WebCore { + +class SerializedScriptValue; +class String; + +class InjectedScript { +public: + InjectedScript() { } + ~InjectedScript() { } + + bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); } + + void dispatch(long callId, const String& methodName, const String& arguments, bool async, RefPtr* result, bool* hadException); +#if ENABLE(JAVASCRIPT_DEBUGGER) + PassRefPtr callFrames(); +#endif + PassRefPtr wrapForConsole(ScriptValue); + void releaseWrapperObjectGroup(const String&); + +private: + friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*); + explicit InjectedScript(ScriptObject); + ScriptObject m_injectedScriptObject; +}; + +} // namespace WebCore + +#endif diff --git a/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp new file mode 100644 index 0000000..62db4b4 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.cpp @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Matt Lilek + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InjectedScriptHost.h" + +#if ENABLE(INSPECTOR) + + +#include "Element.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "HTMLFrameOwnerElement.h" +#include "InjectedScript.h" +#include "InspectorClient.h" +#include "InspectorController.h" +#include "InspectorDOMAgent.h" +#include "InspectorFrontend.h" +#include "InspectorResource.h" +#include "Pasteboard.h" + +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +#include "JavaScriptCallFrame.h" +#include "JavaScriptDebugServer.h" +using namespace JSC; +#endif + +#if ENABLE(DATABASE) +#include "Database.h" +#endif + +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#endif + +#include "markup.h" + +#include +#include + +using namespace std; + +namespace WebCore { + +InjectedScriptHost::InjectedScriptHost(InspectorController* inspectorController) + : m_inspectorController(inspectorController) + , m_nextInjectedScriptId(1) +{ +} + +InjectedScriptHost::~InjectedScriptHost() +{ +} + +void InjectedScriptHost::clearConsoleMessages() +{ + if (m_inspectorController) + m_inspectorController->clearConsoleMessages(); +} + +void InjectedScriptHost::copyText(const String& text) +{ + Pasteboard::generalPasteboard()->writePlainText(text); +} + +Node* InjectedScriptHost::nodeForId(long nodeId) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + return domAgent->nodeForId(nodeId); + return 0; +} + +long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI) +{ + InspectorFrontend* frontend = inspectorFrontend(); + InspectorDOMAgent* domAgent = inspectorDOMAgent(); + if (!domAgent || !frontend) + return 0; + long id = domAgent->pushNodePathToFrontend(node); + if (withChildren) + domAgent->pushChildNodesToFrontend(id); + if (selectInUI) + frontend->updateFocusedNode(id); + return id; +} + +void InjectedScriptHost::addNodesToSearchResult(const String& nodeIds) +{ + if (InspectorFrontend* frontend = inspectorFrontend()) + frontend->addNodesToSearchResult(nodeIds); +} + +long InjectedScriptHost::pushNodeByPathToFrontend(const String& path) +{ + InspectorDOMAgent* domAgent = inspectorDOMAgent(); + if (!domAgent) + return 0; + + Node* node = domAgent->nodeForPath(path); + if (!node) + return 0; + + return domAgent->pushNodePathToFrontend(node); +} + +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +JavaScriptCallFrame* InjectedScriptHost::currentCallFrame() const +{ + return JavaScriptDebugServer::shared().currentCallFrame(); +} +#endif + +#if ENABLE(DATABASE) +Database* InjectedScriptHost::databaseForId(long databaseId) +{ + if (m_inspectorController) + return m_inspectorController->databaseForId(databaseId); + return 0; +} + +void InjectedScriptHost::selectDatabase(Database* database) +{ + if (m_inspectorController) + m_inspectorController->selectDatabase(database); +} +#endif + +#if ENABLE(DOM_STORAGE) +void InjectedScriptHost::selectDOMStorage(Storage* storage) +{ + if (m_inspectorController) + m_inspectorController->selectDOMStorage(storage); +} +#endif + +void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException) +{ + if (InspectorFrontend* frontend = inspectorFrontend()) + frontend->didDispatchOnInjectedScript(callId, result, isException); +} + +InjectedScript InjectedScriptHost::injectedScriptForId(long id) +{ + return m_idToInjectedScript.get(id); +} + +void InjectedScriptHost::discardInjectedScripts() +{ + m_idToInjectedScript.clear(); +} + +void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) +{ + if (injectedScriptId) { + InjectedScript injectedScript = m_idToInjectedScript.get(injectedScriptId); + if (!injectedScript.hasNoValue()) + injectedScript.releaseWrapperObjectGroup(objectGroup); + } else { + // Iterate over all injected scripts if injectedScriptId is not specified. + for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it) + it->second.releaseWrapperObjectGroup(objectGroup); + } +} + +InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent() +{ + if (!m_inspectorController) + return 0; + return m_inspectorController->domAgent(); +} + +InspectorFrontend* InjectedScriptHost::inspectorFrontend() +{ + if (!m_inspectorController) + return 0; + return m_inspectorController->m_frontend.get(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h new file mode 100644 index 0000000..fb56115 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InjectedScriptHost_h +#define InjectedScriptHost_h + +#include "Console.h" +#include "InspectorController.h" +#include "PlatformString.h" +#include "ScriptState.h" + +#include +#include + +namespace WebCore { + +class Database; +class InjectedScript; +class InspectorDOMAgent; +class InspectorFrontend; +class JavaScriptCallFrame; +class Node; +class SerializedScriptValue; +class Storage; + +class InjectedScriptHost : public RefCounted +{ +public: + static PassRefPtr create(InspectorController* inspectorController) + { + return adoptRef(new InjectedScriptHost(inspectorController)); + } + + ~InjectedScriptHost(); + + void setInjectedScriptSource(const String& source) { m_injectedScriptSource = source; } + + InspectorController* inspectorController() { return m_inspectorController; } + void disconnectController() { m_inspectorController = 0; } + + void clearConsoleMessages(); + + void copyText(const String& text); + Node* nodeForId(long nodeId); + long pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI); + + void addNodesToSearchResult(const String& nodeIds); + long pushNodeByPathToFrontend(const String& path); + +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + JavaScriptCallFrame* currentCallFrame() const; +#endif +#if ENABLE(DATABASE) + Database* databaseForId(long databaseId); + void selectDatabase(Database* database); +#endif +#if ENABLE(DOM_STORAGE) + void selectDOMStorage(Storage* storage); +#endif + void reportDidDispatchOnInjectedScript(long callId, SerializedScriptValue* result, bool isException); + + InjectedScript injectedScriptFor(ScriptState*); + InjectedScript injectedScriptForId(long); + void discardInjectedScripts(); + void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); + +private: + InjectedScriptHost(InspectorController* inspectorController); + InspectorDOMAgent* inspectorDOMAgent(); + InspectorFrontend* inspectorFrontend(); + + InspectorController* m_inspectorController; + String m_injectedScriptSource; + long m_nextInjectedScriptId; + typedef HashMap IdToInjectedScriptMap; + IdToInjectedScriptMap m_idToInjectedScript; +}; + +} // namespace WebCore + +#endif // !defined(InjectedScriptHost_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl new file mode 100644 index 0000000..bb57c3a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InjectedScriptHost.idl @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Matt Lilek + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module core { + interface [Conditional=INSPECTOR] InjectedScriptHost { + void clearConsoleMessages(); + + void copyText(in DOMString text); + [Custom] DOMObject nodeForId(in long nodeId); + [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean withChildren, in boolean selectInUI); + + void addNodesToSearchResult(in DOMString nodeIds); + long pushNodeByPathToFrontend(in DOMString path); + +#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING) + [Custom] DOMObject currentCallFrame(); + [Custom] boolean isActivation(in DOMObject object); +#endif + +#if defined(ENABLE_DATABASE) && ENABLE_DATABASE + [Custom] DOMObject databaseForId(in long databaseId); + [Custom] void selectDatabase(in DOMObject database); +#endif + +#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE + [Custom] void selectDOMStorage(in DOMObject storage); +#endif + + [Custom] void reportDidDispatchOnInjectedScript(in long callId, in DOMObject result, in boolean isException); + }; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp index 67c08b9..c43be63 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp @@ -40,6 +40,8 @@ #include "Frame.h" #include "FrameLoader.h" #include "HTMLFrameOwnerElement.h" +#include "InjectedScript.h" +#include "InjectedScriptHost.h" #include "InspectorClient.h" #include "InspectorController.h" #include "InspectorDOMAgent.h" @@ -47,13 +49,13 @@ #include "InspectorResource.h" #include "Pasteboard.h" #include "ScriptArray.h" -#include "ScriptFunctionCall.h" +#include "SerializedScriptValue.h" #if ENABLE(DOM_STORAGE) #include "Storage.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" using namespace JSC; @@ -68,9 +70,8 @@ using namespace std; namespace WebCore { -InspectorBackend::InspectorBackend(InspectorController* inspectorController, InspectorClient* client) +InspectorBackend::InspectorBackend(InspectorController* inspectorController) : m_inspectorController(inspectorController) - , m_client(client) { } @@ -78,87 +79,16 @@ InspectorBackend::~InspectorBackend() { } -void InspectorBackend::hideDOMNodeHighlight() -{ - if (m_inspectorController) - m_inspectorController->hideHighlight(); -} - -String InspectorBackend::localizedStringsURL() -{ - return m_client->localizedStringsURL(); -} - -String InspectorBackend::hiddenPanels() -{ - return m_client->hiddenPanels(); -} - -void InspectorBackend::windowUnloading() -{ - if (m_inspectorController) - m_inspectorController->close(); -} - -bool InspectorBackend::isWindowVisible() +void InspectorBackend::saveFrontendSettings(const String& settings) { if (m_inspectorController) - return m_inspectorController->windowVisible(); - return false; + m_inspectorController->setSetting(InspectorController::FrontendSettingsSettingName, settings); } -void InspectorBackend::addResourceSourceToFrame(long identifier, Node* frame) -{ - if (!m_inspectorController) - return; - RefPtr resource = m_inspectorController->resources().get(identifier); - if (resource) { - String sourceString = resource->sourceString(); - if (!sourceString.isEmpty()) - addSourceToFrame(resource->mimeType(), sourceString, frame); - } -} - -bool InspectorBackend::addSourceToFrame(const String& mimeType, const String& source, Node* frameNode) -{ - ASSERT_ARG(frameNode, frameNode); - - if (!frameNode) - return false; - - if (!frameNode->attached()) { - ASSERT_NOT_REACHED(); - return false; - } - - ASSERT(frameNode->isElementNode()); - if (!frameNode->isElementNode()) - return false; - - Element* element = static_cast(frameNode); - ASSERT(element->isFrameOwnerElement()); - if (!element->isFrameOwnerElement()) - return false; - - HTMLFrameOwnerElement* frameOwner = static_cast(element); - ASSERT(frameOwner->contentFrame()); - if (!frameOwner->contentFrame()) - return false; - - FrameLoader* loader = frameOwner->contentFrame()->loader(); - - loader->setResponseMIMEType(mimeType); - loader->begin(); - loader->write(source); - loader->end(); - - return true; -} - -void InspectorBackend::clearMessages(bool clearUI) +void InspectorBackend::storeLastActivePanel(const String& panelName) { if (m_inspectorController) - m_inspectorController->clearConsoleMessages(clearUI); + m_inspectorController->storeLastActivePanel(panelName); } void InspectorBackend::toggleNodeSearch() @@ -167,30 +97,6 @@ void InspectorBackend::toggleNodeSearch() m_inspectorController->toggleSearchForNodeInPage(); } -void InspectorBackend::attach() -{ - if (m_inspectorController) - m_inspectorController->attachWindow(); -} - -void InspectorBackend::detach() -{ - if (m_inspectorController) - m_inspectorController->detachWindow(); -} - -void InspectorBackend::setAttachedWindowHeight(unsigned height) -{ - if (m_inspectorController) - m_inspectorController->setAttachedWindowHeight(height); -} - -void InspectorBackend::storeLastActivePanel(const String& panelName) -{ - if (m_inspectorController) - m_inspectorController->storeLastActivePanel(panelName); -} - bool InspectorBackend::searchingForNode() { if (m_inspectorController) @@ -198,10 +104,11 @@ bool InspectorBackend::searchingForNode() return false; } -void InspectorBackend::loaded() +bool InspectorBackend::resourceTrackingEnabled() const { if (m_inspectorController) - m_inspectorController->scriptObjectReady(); + return m_inspectorController->resourceTrackingEnabled(); + return false; } void InspectorBackend::enableResourceTracking(bool always) @@ -216,56 +123,17 @@ void InspectorBackend::disableResourceTracking(bool always) m_inspectorController->disableResourceTracking(always); } -bool InspectorBackend::resourceTrackingEnabled() const -{ - if (m_inspectorController) - return m_inspectorController->resourceTrackingEnabled(); - return false; -} - -void InspectorBackend::moveWindowBy(float x, float y) const +void InspectorBackend::getResourceContent(long callId, unsigned long identifier) { - if (m_inspectorController) - m_inspectorController->moveWindowBy(x, y); -} - -void InspectorBackend::closeWindow() -{ - if (m_inspectorController) - m_inspectorController->closeWindow(); -} - -const String& InspectorBackend::platform() const -{ -#if PLATFORM(MAC) -#ifdef BUILDING_ON_TIGER - DEFINE_STATIC_LOCAL(const String, platform, ("mac-tiger")); -#else - DEFINE_STATIC_LOCAL(const String, platform, ("mac-leopard")); -#endif -#elif PLATFORM(WIN_OS) - DEFINE_STATIC_LOCAL(const String, platform, ("windows")); -#else - DEFINE_STATIC_LOCAL(const String, platform, ("unknown")); -#endif - - return platform; -} - - -const String& InspectorBackend::port() const -{ -#if PLATFORM(QT) - DEFINE_STATIC_LOCAL(const String, port, ("qt")); -#elif PLATFORM(GTK) - DEFINE_STATIC_LOCAL(const String, port, ("gtk")); -#elif PLATFORM(WX) - DEFINE_STATIC_LOCAL(const String, port, ("wx")); -#else - DEFINE_STATIC_LOCAL(const String, port, ("unknown")); -#endif + InspectorFrontend* frontend = inspectorFrontend(); + if (!frontend) + return; - return port; + RefPtr resource = m_inspectorController->resources().get(identifier); + if (resource) + frontend->didGetResourceContent(callId, resource->sourceString()); + else + frontend->didGetResourceContent(callId, ""); } void InspectorBackend::startTimelineProfiler() @@ -280,156 +148,161 @@ void InspectorBackend::stopTimelineProfiler() m_inspectorController->stopTimelineProfiler(); } -bool InspectorBackend::timelineProfilerEnabled() const +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +bool InspectorBackend::debuggerEnabled() const { if (m_inspectorController) - return m_inspectorController->timelineProfilerEnabled(); + return m_inspectorController->debuggerEnabled(); return false; } -#if ENABLE(JAVASCRIPT_DEBUGGER) -void InspectorBackend::startProfiling() +void InspectorBackend::enableDebugger(bool always) { if (m_inspectorController) - m_inspectorController->startUserInitiatedProfiling(); + m_inspectorController->enableDebuggerFromFrontend(always); } -void InspectorBackend::stopProfiling() +void InspectorBackend::disableDebugger(bool always) { if (m_inspectorController) - m_inspectorController->stopUserInitiatedProfiling(); + m_inspectorController->disableDebugger(always); } -void InspectorBackend::enableProfiler(bool always) +void InspectorBackend::addBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition) { - if (m_inspectorController) - m_inspectorController->enableProfiler(always); + intptr_t sourceIDValue = sourceID.toIntPtr(); + JavaScriptDebugServer::shared().addBreakpoint(sourceIDValue, lineNumber, condition); } -void InspectorBackend::disableProfiler(bool always) +void InspectorBackend::updateBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition) { - if (m_inspectorController) - m_inspectorController->disableProfiler(always); + intptr_t sourceIDValue = sourceID.toIntPtr(); + JavaScriptDebugServer::shared().updateBreakpoint(sourceIDValue, lineNumber, condition); } -bool InspectorBackend::profilerEnabled() +void InspectorBackend::removeBreakpoint(const String& sourceID, unsigned lineNumber) { - if (m_inspectorController) - return m_inspectorController->profilerEnabled(); - return false; + intptr_t sourceIDValue = sourceID.toIntPtr(); + JavaScriptDebugServer::shared().removeBreakpoint(sourceIDValue, lineNumber); } -void InspectorBackend::getProfileHeaders(long callId) +void InspectorBackend::pauseInDebugger() { - if (m_inspectorController) - m_inspectorController->getProfileHeaders(callId); + JavaScriptDebugServer::shared().pauseProgram(); } -void InspectorBackend::getProfile(long callId, unsigned uid) +void InspectorBackend::resumeDebugger() { if (m_inspectorController) - m_inspectorController->getProfile(callId, uid); + m_inspectorController->resumeDebugger(); } -void InspectorBackend::enableDebugger(bool always) +void InspectorBackend::stepOverStatementInDebugger() { - if (m_inspectorController) - m_inspectorController->enableDebuggerFromFrontend(always); + JavaScriptDebugServer::shared().stepOverStatement(); } -void InspectorBackend::disableDebugger(bool always) +void InspectorBackend::stepIntoStatementInDebugger() { - if (m_inspectorController) - m_inspectorController->disableDebugger(always); + JavaScriptDebugServer::shared().stepIntoStatement(); } -bool InspectorBackend::debuggerEnabled() const +void InspectorBackend::stepOutOfFunctionInDebugger() { - if (m_inspectorController) - return m_inspectorController->debuggerEnabled(); - return false; + JavaScriptDebugServer::shared().stepOutOfFunction(); } -JavaScriptCallFrame* InspectorBackend::currentCallFrame() const +long InspectorBackend::pauseOnExceptionsState() { - return JavaScriptDebugServer::shared().currentCallFrame(); + return JavaScriptDebugServer::shared().pauseOnExceptionsState(); } -void InspectorBackend::addBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition) +void InspectorBackend::setPauseOnExceptionsState(long pauseState) { - intptr_t sourceIDValue = sourceID.toIntPtr(); - JavaScriptDebugServer::shared().addBreakpoint(sourceIDValue, lineNumber, condition); + JavaScriptDebugServer::shared().setPauseOnExceptionsState(static_cast(pauseState)); } -void InspectorBackend::updateBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition) +JavaScriptCallFrame* InspectorBackend::currentCallFrame() const { - intptr_t sourceIDValue = sourceID.toIntPtr(); - JavaScriptDebugServer::shared().updateBreakpoint(sourceIDValue, lineNumber, condition); + return JavaScriptDebugServer::shared().currentCallFrame(); } +#endif -void InspectorBackend::removeBreakpoint(const String& sourceID, unsigned lineNumber) +#if ENABLE(JAVASCRIPT_DEBUGGER) +bool InspectorBackend::profilerEnabled() { - intptr_t sourceIDValue = sourceID.toIntPtr(); - JavaScriptDebugServer::shared().removeBreakpoint(sourceIDValue, lineNumber); + if (m_inspectorController) + return m_inspectorController->profilerEnabled(); + return false; } -bool InspectorBackend::pauseOnExceptions() +void InspectorBackend::enableProfiler(bool always) { - return JavaScriptDebugServer::shared().pauseOnExceptions(); + if (m_inspectorController) + m_inspectorController->enableProfiler(always); } -void InspectorBackend::setPauseOnExceptions(bool pause) +void InspectorBackend::disableProfiler(bool always) { - JavaScriptDebugServer::shared().setPauseOnExceptions(pause); + if (m_inspectorController) + m_inspectorController->disableProfiler(always); } -void InspectorBackend::pauseInDebugger() +void InspectorBackend::startProfiling() { - JavaScriptDebugServer::shared().pauseProgram(); + if (m_inspectorController) + m_inspectorController->startUserInitiatedProfiling(); } -void InspectorBackend::resumeDebugger() +void InspectorBackend::stopProfiling() { if (m_inspectorController) - m_inspectorController->resumeDebugger(); + m_inspectorController->stopUserInitiatedProfiling(); } -void InspectorBackend::stepOverStatementInDebugger() +void InspectorBackend::getProfileHeaders(long callId) { - JavaScriptDebugServer::shared().stepOverStatement(); + if (m_inspectorController) + m_inspectorController->getProfileHeaders(callId); } -void InspectorBackend::stepIntoStatementInDebugger() +void InspectorBackend::getProfile(long callId, unsigned uid) { - JavaScriptDebugServer::shared().stepIntoStatement(); + if (m_inspectorController) + m_inspectorController->getProfile(callId, uid); } +#endif -void InspectorBackend::stepOutOfFunctionInDebugger() +void InspectorBackend::setInjectedScriptSource(const String& source) { - JavaScriptDebugServer::shared().stepOutOfFunction(); + if (m_inspectorController) + m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source); } -#endif - -void InspectorBackend::dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async) +void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async) { InspectorFrontend* frontend = inspectorFrontend(); if (!frontend) return; - ScriptFunctionCall function(m_inspectorController->m_scriptState, m_inspectorController->m_injectedScriptObj, "dispatch"); - function.appendArgument(methodName); - function.appendArgument(arguments); - if (async) - function.appendArgument(static_cast(callId)); + // FIXME: explicitly pass injectedScriptId along with node id to the frontend. + bool injectedScriptIdIsNodeId = injectedScriptId <= 0; + + InjectedScript injectedScript; + if (injectedScriptIdIsNodeId) + injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId); + else + injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForId(injectedScriptId); + + if (injectedScript.hasNoValue()) + return; + + RefPtr result; bool hadException = false; - ScriptValue result = function.call(hadException); + injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException); if (async) return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript. - if (hadException) - frontend->didDispatchOnInjectedScript(callId, "", true); - else - frontend->didDispatchOnInjectedScript(callId, result.toString(m_inspectorController->m_scriptState), false); + frontend->didDispatchOnInjectedScript(callId, result.get(), hadException); } void InspectorBackend::getChildNodes(long callId, long nodeId) @@ -500,85 +373,46 @@ void InspectorBackend::removeNode(long callId, long nodeId) frontend->didRemoveNode(callId, nodeId); } -void InspectorBackend::getCookies(long callId, const String& domain) -{ - if (!m_inspectorController) - return; - m_inspectorController->getCookies(callId, domain); -} - -void InspectorBackend::deleteCookie(const String& cookieName, const String& domain) -{ - if (!m_inspectorController) - return; - m_inspectorController->deleteCookie(cookieName, domain); -} - -void InspectorBackend::highlight(long nodeId) +void InspectorBackend::highlightDOMNode(long nodeId) { if (Node* node = nodeForId(nodeId)) m_inspectorController->highlight(node); } -Node* InspectorBackend::nodeForId(long nodeId) -{ - if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) - return domAgent->nodeForId(nodeId); - return 0; -} - -ScriptValue InspectorBackend::wrapObject(const ScriptValue& object, const String& objectGroup) -{ - if (m_inspectorController) - return m_inspectorController->wrapObject(object, objectGroup); - return ScriptValue(); -} - -ScriptValue InspectorBackend::unwrapObject(const String& objectId) -{ - if (m_inspectorController) - return m_inspectorController->unwrapObject(objectId); - return ScriptValue(); -} - -void InspectorBackend::releaseWrapperObjectGroup(const String& objectGroup) +void InspectorBackend::hideDOMNodeHighlight() { if (m_inspectorController) - m_inspectorController->releaseWrapperObjectGroup(objectGroup); + m_inspectorController->hideHighlight(); } -long InspectorBackend::pushNodePathToFrontend(Node* node, bool selectInUI) +void InspectorBackend::getCookies(long callId) { - InspectorFrontend* frontend = inspectorFrontend(); - InspectorDOMAgent* domAgent = inspectorDOMAgent(); - if (!domAgent || !frontend) - return 0; - long id = domAgent->pushNodePathToFrontend(node); - if (selectInUI) - frontend->updateFocusedNode(id); - return id; + if (!m_inspectorController) + return; + m_inspectorController->getCookies(callId); } -void InspectorBackend::addNodesToSearchResult(const String& nodeIds) +void InspectorBackend::deleteCookie(const String& cookieName, const String& domain) { - if (InspectorFrontend* frontend = inspectorFrontend()) - frontend->addNodesToSearchResult(nodeIds); + if (!m_inspectorController) + return; + m_inspectorController->deleteCookie(cookieName, domain); } -#if ENABLE(DATABASE) -Database* InspectorBackend::databaseForId(long databaseId) +void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) { - if (m_inspectorController) - return m_inspectorController->databaseForId(databaseId); - return 0; + if (!m_inspectorController) + return; + m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup); } -void InspectorBackend::selectDatabase(Database* database) +void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& jsonResult) { if (m_inspectorController) - m_inspectorController->selectDatabase(database); + m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult); } +#if ENABLE(DATABASE) void InspectorBackend::getDatabaseTableNames(long callId, long databaseId) { if (InspectorFrontend* frontend = inspectorFrontend()) { @@ -596,12 +430,6 @@ void InspectorBackend::getDatabaseTableNames(long callId, long databaseId) #endif #if ENABLE(DOM_STORAGE) -void InspectorBackend::selectDOMStorage(Storage* storage) -{ - if (m_inspectorController) - m_inspectorController->selectDOMStorage(storage); -} - void InspectorBackend::getDOMStorageEntries(long callId, long storageId) { if (m_inspectorController) @@ -621,18 +449,6 @@ void InspectorBackend::removeDOMStorageItem(long callId, long storageId, const S } #endif -void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& jsonResult) -{ - if (m_inspectorController) - m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult); -} - -void InspectorBackend::reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException) -{ - if (InspectorFrontend* frontend = inspectorFrontend()) - frontend->didDispatchOnInjectedScript(callId, result, isException); -} - InspectorDOMAgent* InspectorBackend::inspectorDOMAgent() { if (!m_inspectorController) @@ -647,6 +463,13 @@ InspectorFrontend* InspectorBackend::inspectorFrontend() return m_inspectorController->m_frontend.get(); } +Node* InspectorBackend::nodeForId(long nodeId) +{ + if (InspectorDOMAgent* domAgent = inspectorDOMAgent()) + return domAgent->nodeForId(nodeId); + return 0; +} + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h index 08bb5e5..0df13f5 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.h @@ -39,8 +39,8 @@ namespace WebCore { class CachedResource; class Database; -class InspectorClient; class InspectorDOMAgent; +class InspectorFrontend; class JavaScriptCallFrame; class Node; class Storage; @@ -48,91 +48,66 @@ class Storage; class InspectorBackend : public RefCounted { public: - static PassRefPtr create(InspectorController* inspectorController, InspectorClient* client) + static PassRefPtr create(InspectorController* inspectorController) { - return adoptRef(new InspectorBackend(inspectorController, client)); + return adoptRef(new InspectorBackend(inspectorController)); } ~InspectorBackend(); InspectorController* inspectorController() { return m_inspectorController; } - void disconnectController() { m_inspectorController = 0; } - void hideDOMNodeHighlight(); - - String localizedStringsURL(); - String hiddenPanels(); - - void windowUnloading(); - - bool isWindowVisible(); - - void addResourceSourceToFrame(long identifier, Node* frame); - bool addSourceToFrame(const String& mimeType, const String& source, Node* frame); - - void clearMessages(bool clearUI); - - void toggleNodeSearch(); - - void attach(); - void detach(); - - void setAttachedWindowHeight(unsigned height); + void saveFrontendSettings(const String&); void storeLastActivePanel(const String& panelName); + void toggleNodeSearch(); bool searchingForNode(); - void loaded(); - void enableResourceTracking(bool always); void disableResourceTracking(bool always); bool resourceTrackingEnabled() const; - - void moveWindowBy(float x, float y) const; - void closeWindow(); - - const String& platform() const; - const String& port() const; + void getResourceContent(long callId, unsigned long identifier); void startTimelineProfiler(); void stopTimelineProfiler(); - bool timelineProfilerEnabled() const; - -#if ENABLE(JAVASCRIPT_DEBUGGER) - void startProfiling(); - void stopProfiling(); - - void enableProfiler(bool always); - void disableProfiler(bool always); - bool profilerEnabled(); - - void getProfileHeaders(long callId); - void getProfile(long callId, unsigned uid); +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + bool debuggerEnabled() const; void enableDebugger(bool always); void disableDebugger(bool always); - bool debuggerEnabled() const; - - JavaScriptCallFrame* currentCallFrame() const; void addBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition); void updateBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition); void removeBreakpoint(const String& sourceID, unsigned lineNumber); - bool pauseOnExceptions(); - void setPauseOnExceptions(bool pause); - void pauseInDebugger(); void resumeDebugger(); + long pauseOnExceptionsState(); + void setPauseOnExceptionsState(long pauseState); + void stepOverStatementInDebugger(); void stepIntoStatementInDebugger(); void stepOutOfFunctionInDebugger(); + + JavaScriptCallFrame* currentCallFrame() const; #endif +#if ENABLE(JAVASCRIPT_DEBUGGER) + bool profilerEnabled(); + void enableProfiler(bool always); + void disableProfiler(bool always); - void dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async); + void startProfiling(); + void stopProfiling(); + + void getProfileHeaders(long callId); + void getProfile(long callId, unsigned uid); +#endif + + void setInjectedScriptSource(const String& source); + void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async); void getChildNodes(long callId, long nodeId); void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); @@ -140,39 +115,33 @@ public: void getEventListenersForNode(long callId, long nodeId); void copyNode(long nodeId); void removeNode(long callId, long nodeId); + void highlightDOMNode(long nodeId); + void hideDOMNodeHighlight(); - void getCookies(long callId, const String& domain); + void getCookies(long callId); void deleteCookie(const String& cookieName, const String& domain); // Generic code called from custom implementations. - void highlight(long nodeId); - Node* nodeForId(long nodeId); - ScriptValue wrapObject(const ScriptValue& object, const String& objectGroup); - ScriptValue unwrapObject(const String& objectId); - void releaseWrapperObjectGroup(const String& objectGroup); - long pushNodePathToFrontend(Node* node, bool selectInUI); - void addNodesToSearchResult(const String& nodeIds); + void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); + void didEvaluateForTestInFrontend(long callId, const String& jsonResult); + #if ENABLE(DATABASE) - Database* databaseForId(long databaseId); - void selectDatabase(Database* database); void getDatabaseTableNames(long callId, long databaseId); #endif + #if ENABLE(DOM_STORAGE) - void selectDOMStorage(Storage* storage); void getDOMStorageEntries(long callId, long storageId); void setDOMStorageItem(long callId, long storageId, const String& key, const String& value); void removeDOMStorageItem(long callId, long storageId, const String& key); #endif - void reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException); - void didEvaluateForTestInFrontend(long callId, const String& jsonResult); private: - InspectorBackend(InspectorController* inspectorController, InspectorClient* client); + InspectorBackend(InspectorController* inspectorController); InspectorDOMAgent* inspectorDOMAgent(); InspectorFrontend* inspectorFrontend(); + Node* nodeForId(long nodeId); InspectorController* m_inspectorController; - InspectorClient* m_client; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl index fd5dd79..9faae76 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.idl @@ -31,49 +31,23 @@ */ module core { - interface [ - GenerateConstructor - ] InspectorBackend { - void hideDOMNodeHighlight(); - [Custom] void highlightDOMNode(in long nodeId); - void loaded(); - void windowUnloading(); - void attach(); - void detach(); - - void closeWindow(); - void clearMessages(in boolean clearUI); - void toggleNodeSearch(); + interface [Conditional=INSPECTOR] InspectorBackend { + void storeLastActivePanel(in DOMString panelName); - boolean isWindowVisible(); - boolean searchingForNode(); + void saveFrontendSettings(in DOMString settings); - void addResourceSourceToFrame(in long identifier, in Node frame); - boolean addSourceToFrame(in DOMString mimeType, in DOMString sourceValue, in Node frame); - [Custom] void search(in Node node, in DOMString query); -#if defined(ENABLE_DATABASE) && ENABLE_DATABASE - void getDatabaseTableNames(in long callId, in long databaseId); -#endif + void toggleNodeSearch(); + boolean searchingForNode(); - [Custom] DOMObject setting(in DOMString key); - [Custom] void setSetting(in DOMString key, in DOMObject value); - [Custom] DOMWindow inspectedWindow(); - DOMString localizedStringsURL(); - DOMString hiddenPanels(); - DOMString platform(); - DOMString port(); - void startTimelineProfiler(); - void stopTimelineProfiler(); - boolean timelineProfilerEnabled(); - [ImplementationFunction=moveWindowBy] void moveByUnrestricted(in float x, in float y); - void setAttachedWindowHeight(in unsigned long height); - [Custom] DOMObject wrapCallback(in DOMObject callback); boolean resourceTrackingEnabled(); void enableResourceTracking(in boolean always); void disableResourceTracking(in boolean always); - void storeLastActivePanel(in DOMString panelName); + void getResourceContent(in long callId, in unsigned long identifier); -#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER + void startTimelineProfiler(); + void stopTimelineProfiler(); + +#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING) boolean debuggerEnabled(); void enableDebugger(in boolean always); void disableDebugger(in boolean always); @@ -89,11 +63,10 @@ module core { void stepIntoStatementInDebugger(); void stepOutOfFunctionInDebugger(); - [Custom] DOMObject currentCallFrame(); - - boolean pauseOnExceptions(); - void setPauseOnExceptions(in boolean pauseOnExceptions); - + long pauseOnExceptionsState(); + void setPauseOnExceptionsState(in long pauseOnExceptionsState); +#endif +#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER boolean profilerEnabled(); void enableProfiler(in boolean always); void disableProfiler(in boolean always); @@ -104,7 +77,9 @@ module core { void getProfileHeaders(in long callId); void getProfile(in long callId, in unsigned long uid); #endif - void dispatchOnInjectedScript(in long callId, in DOMString methodName, in DOMString arguments, in boolean async); + void setInjectedScriptSource(in DOMString scriptSource); + void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in DOMString methodName, in DOMString arguments, in boolean async); + void getChildNodes(in long callId, in long nodeId); void setAttribute(in long callId, in long elementId, in DOMString name, in DOMString value); void removeAttribute(in long callId, in long elementId, in DOMString name); @@ -112,29 +87,23 @@ module core { void getEventListenersForNode(in long callId, in long nodeId); void copyNode(in long nodeId); void removeNode(in long callId, in long nodeId); + void highlightDOMNode(in long nodeId); + void hideDOMNodeHighlight(); - void getCookies(in long callId, in DOMString domain); + void getCookies(in long callId); void deleteCookie(in DOMString cookieName, in DOMString domain); - // Called from InjectedScript. - // TODO: extract into a separate IDL. - [Custom] DOMObject nodeForId(in long nodeId); - [Custom] long wrapObject(in DOMObject object, in DOMString objectGroup); - [Custom] DOMObject unwrapObject(in long objectId); - void releaseWrapperObjectGroup(in DOMString objectGroup); - [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean selectInUI); - void addNodesToSearchResult(in DOMString nodeIds); + void releaseWrapperObjectGroup(in long injectedScriptId, in DOMString objectGroup); + void didEvaluateForTestInFrontend(in long callId, in DOMString jsonResult); + #if defined(ENABLE_DATABASE) && ENABLE_DATABASE - [Custom] void selectDatabase(in DOMObject database); - [Custom] DOMObject databaseForId(in long databaseId); + void getDatabaseTableNames(in long callId, in long databaseId); #endif + #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE - [Custom] void selectDOMStorage(in DOMObject storage); void getDOMStorageEntries(in long callId, in long storageId); void setDOMStorageItem(in long callId, in long storageId, in DOMString key, in DOMString value); void removeDOMStorageItem(in long callId, in long storageId, in DOMString key); #endif - void reportDidDispatchOnInjectedScript(in long callId, in DOMString result, in boolean isException); - void didEvaluateForTestInFrontend(in long callId, in DOMString jsonResult); }; } diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorClient.h b/src/3rdparty/webkit/WebCore/inspector/InspectorClient.h index f96662a..e448cd2 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorClient.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorClient.h @@ -59,9 +59,8 @@ public: virtual void inspectedURLChanged(const String& newURL) = 0; - virtual void populateSetting(const String& key, InspectorController::Setting&) = 0; - virtual void storeSetting(const String& key, const InspectorController::Setting&) = 0; - virtual void removeSetting(const String& key) = 0; + virtual void populateSetting(const String& key, String* value) = 0; + virtual void storeSetting(const String& key, const String& value) = 0; virtual void inspectorWindowObjectCleared() = 0; }; diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp index a6628cd..b487ad8 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008 Matt Lilek * * Redistribution and use in source and binary forms, with or without @@ -34,13 +34,14 @@ #include "CString.h" #include "CachedResource.h" +#include "Chrome.h" #include "Console.h" #include "ConsoleMessage.h" #include "Cookie.h" #include "CookieJar.h" +#include "DOMWindow.h" #include "Document.h" #include "DocumentLoader.h" -#include "DOMWindow.h" #include "Element.h" #include "FloatConversion.h" #include "FloatQuad.h" @@ -52,24 +53,29 @@ #include "GraphicsContext.h" #include "HTMLFrameOwnerElement.h" #include "HitTestResult.h" +#include "InjectedScript.h" +#include "InjectedScriptHost.h" #include "InspectorBackend.h" #include "InspectorClient.h" -#include "InspectorFrontend.h" -#include "InspectorDatabaseResource.h" #include "InspectorDOMAgent.h" #include "InspectorDOMStorageResource.h" -#include "InspectorTimelineAgent.h" +#include "InspectorDatabaseResource.h" +#include "InspectorFrontend.h" +#include "InspectorFrontendHost.h" #include "InspectorResource.h" -#include "JavaScriptProfile.h" +#include "InspectorTimelineAgent.h" #include "Page.h" +#include "ProgressTracker.h" #include "Range.h" #include "RenderInline.h" #include "ResourceRequest.h" #include "ResourceResponse.h" #include "ScriptCallStack.h" +#include "ScriptDebugServer.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" -#include "ScriptObjectQuarantine.h" +#include "ScriptProfile.h" +#include "ScriptProfiler.h" #include "ScriptString.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -90,13 +96,12 @@ #include "StorageArea.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +#include "JSJavaScriptCallFrame.h" #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" -#include "JSJavaScriptCallFrame.h" +#include "JavaScriptProfile.h" -#include -#include #include #include @@ -113,33 +118,38 @@ static const char* const debuggerEnabledSettingName = "debuggerEnabled"; static const char* const profilerEnabledSettingName = "profilerEnabled"; static const char* const inspectorAttachedHeightName = "inspectorAttachedHeight"; static const char* const lastActivePanelSettingName = "lastActivePanel"; +const char* const InspectorController::FrontendSettingsSettingName = "frontendSettings"; static const unsigned defaultAttachedHeight = 300; static const float minimumAttachedHeight = 250.0f; static const float maximumAttachedHeightRatio = 0.75f; +static const unsigned maximumConsoleMessages = 1000; +static const unsigned expireConsoleMessagesStep = 100; static unsigned s_inspectorControllerCount; -static HashMap* s_settingCache; InspectorController::InspectorController(Page* page, InspectorClient* client) : m_inspectedPage(page) , m_client(client) , m_page(0) - , m_scriptState(0) + , m_expiredConsoleMessageCount(0) + , m_frontendScriptState(0) , m_windowVisible(false) , m_showAfterVisible(CurrentPanel) - , m_nextIdentifier(-2) , m_groupLevel(0) , m_searchingForNode(false) , m_previousMessage(0) , m_resourceTrackingEnabled(false) , m_resourceTrackingSettingsLoaded(false) - , m_inspectorBackend(InspectorBackend::create(this, client)) - , m_lastBoundObjectId(1) -#if ENABLE(JAVASCRIPT_DEBUGGER) + , m_inspectorBackend(InspectorBackend::create(this)) + , m_inspectorFrontendHost(InspectorFrontendHost::create(this, client)) + , m_injectedScriptHost(InjectedScriptHost::create(this)) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) - , m_profilerEnabled(false) +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) + , m_profilerEnabled(!WTF_USE_JSC) , m_recordingUserInitiatedProfile(false) , m_currentUserInitiatedProfileNumber(-1) , m_nextUserInitiatedProfileNumber(1) @@ -155,7 +165,7 @@ InspectorController::~InspectorController() { // These should have been cleared in inspectedPageDestroyed(). ASSERT(!m_client); - ASSERT(!m_scriptState); + ASSERT(!m_frontendScriptState); ASSERT(!m_inspectedPage); ASSERT(!m_page || (m_page && !m_page->parentInspectorController())); @@ -165,24 +175,21 @@ InspectorController::~InspectorController() ASSERT(s_inspectorControllerCount); --s_inspectorControllerCount; - if (!s_inspectorControllerCount && s_settingCache) { - deleteAllValues(*s_settingCache); - delete s_settingCache; - s_settingCache = 0; - } - releaseDOMAgent(); m_inspectorBackend->disconnectController(); + m_inspectorFrontendHost->disconnectController(); + m_injectedScriptHost->disconnectController(); } void InspectorController::inspectedPageDestroyed() { close(); - if (m_scriptState) - ScriptGlobalObject::remove(m_scriptState, "InspectorController"); - + if (m_frontendScriptState) { + ScriptGlobalObject::remove(m_frontendScriptState, "InspectorBackend"); + ScriptGlobalObject::remove(m_frontendScriptState, "InspectorFrontendHost"); + } ASSERT(m_inspectedPage); m_inspectedPage = 0; @@ -197,46 +204,22 @@ bool InspectorController::enabled() const return m_inspectedPage->settings()->developerExtrasEnabled(); } -const InspectorController::Setting& InspectorController::setting(const String& key) const +String InspectorController::setting(const String& key) const { - if (!s_settingCache) - s_settingCache = new HashMap; - - if (Setting* cachedSetting = s_settingCache->get(key)) - return *cachedSetting; - - Setting* newSetting = new Setting; - s_settingCache->set(key, newSetting); - - m_client->populateSetting(key, *newSetting); + Settings::iterator it = m_settings.find(key); + if (it != m_settings.end()) + return it->second; - return *newSetting; + String value; + m_client->populateSetting(key, &value); + m_settings.set(key, value); + return value; } -void InspectorController::setSetting(const String& key, const Setting& setting) +void InspectorController::setSetting(const String& key, const String& value) { - if (setting.type() == Setting::NoType) { - if (s_settingCache) { - Setting* cachedSetting = s_settingCache->get(key); - if (cachedSetting) { - s_settingCache->remove(key); - delete cachedSetting; - } - } - - m_client->removeSetting(key); - return; - } - - if (!s_settingCache) - s_settingCache = new HashMap; - - if (Setting* cachedSetting = s_settingCache->get(key)) - *cachedSetting = setting; - else - s_settingCache->set(key, new Setting(setting)); - - m_client->storeSetting(key, setting); + m_settings.set(key, value); + m_client->storeSetting(key, value); } // Trying to inspect something in a frame with JavaScript disabled would later lead to @@ -247,7 +230,7 @@ static bool canPassNodeToJavaScript(Node* node) if (!node) return false; Frame* frame = node->document()->frame(); - return frame && frame->script()->isEnabled(); + return frame && frame->script()->canExecuteScripts(); } void InspectorController::inspect(Node* node) @@ -315,28 +298,20 @@ void InspectorController::setWindowVisible(bool visible, bool attached) setAttachedWindow(attached); populateScriptObjects(); - // Console panel is implemented as a 'fast view', so there should be - // real panel opened along with it. - bool showConsole = m_showAfterVisible == ConsolePanel; - if (m_showAfterVisible == CurrentPanel || showConsole) { - Setting lastActivePanelSetting = setting(lastActivePanelSettingName); - if (lastActivePanelSetting.type() == Setting::StringType) - m_showAfterVisible = specialPanelForJSName(lastActivePanelSetting.string()); - else - m_showAfterVisible = ElementsPanel; + if (m_showAfterVisible == CurrentPanel) { + String lastActivePanelSetting = setting(lastActivePanelSettingName); + m_showAfterVisible = specialPanelForJSName(lastActivePanelSetting); } if (m_nodeToFocus) focusNode(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) if (m_attachDebuggerWhenShown) enableDebugger(); #endif showPanel(m_showAfterVisible); - if (showConsole) - showPanel(ConsolePanel); } else { -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) // If the window is being closed with the debugger enabled, // remember this state to re-enable debugger on the next window // opening. @@ -345,7 +320,10 @@ void InspectorController::setWindowVisible(bool visible, bool attached) if (debuggerWasEnabled) m_attachDebuggerWhenShown = true; #endif + if (m_searchingForNode) + toggleSearchForNodeInPage(); resetScriptObjects(); + stopTimelineProfiler(); } m_showAfterVisible = CurrentPanel; } @@ -382,18 +360,26 @@ void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMes if (windowVisible()) m_previousMessage->addToConsole(m_frontend.get()); } + + if (!windowVisible() && m_consoleMessages.size() >= maximumConsoleMessages) { + m_expiredConsoleMessageCount += expireConsoleMessagesStep; + for (size_t i = 0; i < expireConsoleMessagesStep; ++i) + delete m_consoleMessages[i]; + m_consoleMessages.remove(0, expireConsoleMessagesStep); + } } -void InspectorController::clearConsoleMessages(bool clearUI) +void InspectorController::clearConsoleMessages() { deleteAllValues(m_consoleMessages); m_consoleMessages.clear(); + m_expiredConsoleMessageCount = 0; m_previousMessage = 0; m_groupLevel = 0; - releaseWrapperObjectGroup("console"); + m_injectedScriptHost->releaseWrapperObjectGroup(0 /* release the group in all scripts */, "console"); if (m_domAgent) m_domAgent->releaseDanglingNodes(); - if (clearUI && m_frontend) + if (m_frontend) m_frontend->clearConsoleMessages(); } @@ -406,7 +392,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL) { - if (m_groupLevel == 0) + if (!m_groupLevel) return; --m_groupLevel; @@ -414,6 +400,12 @@ void InspectorController::endGroup(MessageSource source, unsigned lineNumber, co addConsoleMessage(0, new ConsoleMessage(source, EndGroupMessageType, LogMessageLevel, String(), lineNumber, sourceURL, m_groupLevel)); } +void InspectorController::markTimeline(const String& message) +{ + if (timelineAgent()) + timelineAgent()->didMarkTimeline(message); +} + static unsigned constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight) { return roundf(max(minimumAttachedHeight, min(preferredHeight, totalWindowHeight * maximumAttachedHeightRatio))); @@ -428,8 +420,10 @@ void InspectorController::attachWindow() m_client->attachWindow(); - Setting attachedHeight = setting(inspectorAttachedHeightName); - unsigned preferredHeight = attachedHeight.type() == Setting::IntegerType ? attachedHeight.integerValue() : defaultAttachedHeight; + String attachedHeight = setting(inspectorAttachedHeightName); + bool success = true; + int height = attachedHeight.toInt(&success); + unsigned preferredHeight = success ? height : defaultAttachedHeight; // We need to constrain the window height here in case the user has resized the inspected page's window so that // the user's preferred height would be too big to display. @@ -459,14 +453,14 @@ void InspectorController::setAttachedWindowHeight(unsigned height) unsigned totalHeight = m_page->mainFrame()->view()->visibleHeight() + m_inspectedPage->mainFrame()->view()->visibleHeight(); unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight); - setSetting(inspectorAttachedHeightName, Setting(attachedHeight)); + setSetting(inspectorAttachedHeightName, String::number(attachedHeight)); m_client->setAttachedWindowHeight(attachedHeight); } void InspectorController::storeLastActivePanel(const String& panelName) { - setSetting(lastActivePanelSettingName, Setting(panelName)); + setSetting(lastActivePanelSettingName, panelName); } void InspectorController::toggleSearchForNodeInPage() @@ -507,7 +501,7 @@ void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) { if (!enabled() || !m_frontend || frame != m_inspectedPage->mainFrame()) return; - resetInjectedScript(); + m_injectedScriptHost->discardInjectedScripts(); } void InspectorController::windowScriptObjectAvailable() @@ -517,30 +511,28 @@ void InspectorController::windowScriptObjectAvailable() // Grant the inspector the ability to script the inspected page. m_page->mainFrame()->document()->securityOrigin()->grantUniversalAccess(); - m_scriptState = scriptStateFromPage(m_page); - ScriptGlobalObject::set(m_scriptState, "InspectorController", m_inspectorBackend.get()); + m_frontendScriptState = scriptStateFromPage(debuggerWorld(), m_page); + ScriptGlobalObject::set(m_frontendScriptState, "InspectorBackend", m_inspectorBackend.get()); + ScriptGlobalObject::set(m_frontendScriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get()); } void InspectorController::scriptObjectReady() { - ASSERT(m_scriptState); - if (!m_scriptState) + ASSERT(m_frontendScriptState); + if (!m_frontendScriptState) return; ScriptObject webInspectorObj; - if (!ScriptGlobalObject::get(m_scriptState, "WebInspector", webInspectorObj)) - return; - ScriptObject injectedScriptObj; - if (!ScriptGlobalObject::get(m_scriptState, "InjectedScript", injectedScriptObj)) + if (!ScriptGlobalObject::get(m_frontendScriptState, "WebInspector", webInspectorObj)) return; - setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj); + setFrontendProxyObject(m_frontendScriptState, webInspectorObj); -#if ENABLE(JAVASCRIPT_DEBUGGER) - Setting debuggerEnabled = setting(debuggerEnabledSettingName); - if (debuggerEnabled.type() == Setting::BooleanType && debuggerEnabled.booleanValue()) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + String debuggerEnabled = setting(debuggerEnabledSettingName); + if (debuggerEnabled == "true") enableDebugger(); - Setting profilerEnabled = setting(profilerEnabledSettingName); - if (profilerEnabled.type() == Setting::BooleanType && profilerEnabled.booleanValue()) + String profilerEnabled = setting(profilerEnabledSettingName); + if (profilerEnabled == "true") enableProfiler(); #endif @@ -550,11 +542,10 @@ void InspectorController::scriptObjectReady() m_client->inspectorWindowObjectCleared(); } -void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject injectedScriptObj) +void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject) { - m_scriptState = scriptState; - m_injectedScriptObj = injectedScriptObj; - m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); + m_frontendScriptState = scriptState; + m_frontend.set(new InspectorFrontend(this, webInspectorObj)); releaseDOMAgent(); m_domAgent = InspectorDOMAgent::create(m_frontend.get()); if (m_timelineAgent) @@ -568,7 +559,7 @@ void InspectorController::show() if (!m_page) { if (m_frontend) - return; // We are using custom frontend - no need to create page. + return; // We are using custom frontend - no need to create page. m_page = m_client->createPage(); if (!m_page) @@ -605,20 +596,22 @@ void InspectorController::close() if (!enabled()) return; -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) stopUserInitiatedProfiling(); disableDebugger(); #endif closeWindow(); - m_frontend.set(0); - m_injectedScriptObj = ScriptObject(); releaseDOMAgent(); + m_frontend.set(0); m_timelineAgent = 0; - m_scriptState = 0; - if (m_page) - m_page->setParentInspectorController(0); - m_page = 0; + m_frontendScriptState = 0; + if (m_page) { + if (!m_page->mainFrame() || !m_page->mainFrame()->loader() || !m_page->mainFrame()->loader()->isLoading()) { + m_page->setParentInspectorController(0); + m_page = 0; + } + } } void InspectorController::showWindow() @@ -629,8 +622,10 @@ void InspectorController::showWindow() m_client->showWindow(); - Setting attachedHeight = setting(inspectorAttachedHeightName); - unsigned preferredHeight = attachedHeight.type() == Setting::IntegerType ? attachedHeight.integerValue() : defaultAttachedHeight; + String attachedHeight = setting(inspectorAttachedHeightName); + bool success = true; + int height = attachedHeight.toInt(&success); + unsigned preferredHeight = success ? height : defaultAttachedHeight; // This call might not go through (if the window starts out detached), but if the window is initially created attached, // InspectorController::attachWindow is never called, so we need to make sure to set the attachedWindowHeight. @@ -648,7 +643,7 @@ void InspectorController::releaseDOMAgent() // m_domAgent is RefPtr. Remove DOM listeners first to ensure that there are // no references to the DOM agent from the DOM tree. if (m_domAgent) - m_domAgent->setDocument(0); + m_domAgent->reset(); m_domAgent = 0; } @@ -658,16 +653,16 @@ void InspectorController::populateScriptObjects() if (!m_frontend) return; - m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + m_frontend->populateFrontendSettings(setting(FrontendSettingsSettingName)); ResourcesMap::iterator resourcesEnd = m_resources.end(); - for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) { - it->second->createScriptObject(m_frontend.get()); - KURL resourceURL = it->second->frame()->document()->url(); - if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file")) - m_frontend->addCookieDomain(resourceURL.host()); - } + for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) + it->second->updateScriptObject(m_frontend.get()); + + m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + if (m_expiredConsoleMessageCount) + m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount); unsigned messageCount = m_consoleMessages.size(); for (unsigned i = 0; i < messageCount; ++i) m_consoleMessages[i]->addToConsole(m_frontend.get()); @@ -715,9 +710,7 @@ void InspectorController::resetScriptObjects() m_timelineAgent->reset(); m_frontend->reset(); - m_domAgent->setDocument(0); - m_objectGroups.clear(); - m_idToWrappedObject.clear(); + m_domAgent->reset(); } void InspectorController::pruneResources(ResourcesMap* resourceMap, DocumentLoader* loaderToKeep) @@ -749,11 +742,12 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (loader->frame() == m_inspectedPage->mainFrame()) { m_client->inspectedURLChanged(loader->url().string()); - clearConsoleMessages(false); + m_injectedScriptHost->discardInjectedScripts(); + clearConsoleMessages(); m_times.clear(); m_counts.clear(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) m_profiles.clear(); m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; @@ -761,6 +755,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) // resetScriptObjects should be called before database and DOM storage // resources are cleared so that it has a chance to unbind them. resetScriptObjects(); + #if ENABLE(DATABASE) m_databaseResources.clear(); #endif @@ -775,7 +770,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) // needed to keep the load for a user-entered URL from showing up in the // list of resources for the page they are navigating away from. if (windowVisible()) - m_mainResource->createScriptObject(m_frontend.get()); + m_mainResource->updateScriptObject(m_frontend.get()); } else { // Pages loaded from the page cache are committed before // m_mainResource is the right resource for this load, so we @@ -840,7 +835,7 @@ void InspectorController::removeResource(InspectorResource* resource) } } -InspectorResource* InspectorController::getTrackedResource(long long identifier) +InspectorResource* InspectorController::getTrackedResource(unsigned long identifier) { if (!enabled()) return 0; @@ -870,7 +865,7 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, if (!isMainResource && !m_resourceTrackingEnabled) return; - RefPtr resource = InspectorResource::createCached(m_nextIdentifier--, loader, cachedResource); + RefPtr resource = InspectorResource::createCached(m_inspectedPage->progress()->createUniqueIdentifier(), loader, cachedResource); if (isMainResource) { m_mainResource = resource; @@ -880,7 +875,7 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, addResource(resource.get()); if (windowVisible()) - resource->createScriptObject(m_frontend.get()); + resource->updateScriptObject(m_frontend.get()); } void InspectorController::identifierForInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request) @@ -894,9 +889,7 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier, if (!isMainResource && !m_resourceTrackingEnabled) return; - RefPtr resource = InspectorResource::create(identifier, loader); - - resource->updateRequest(request); + RefPtr resource = InspectorResource::create(identifier, loader, request.url()); if (isMainResource) { m_mainResource = resource; @@ -906,7 +899,7 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier, addResource(resource.get()); if (windowVisible() && loader->frameLoader()->isLoadingFromCachedPage() && resource == m_mainResource) - resource->createScriptObject(m_frontend.get()); + resource->updateScriptObject(m_frontend.get()); } void InspectorController::mainResourceFiredDOMContentEvent(DocumentLoader* loader, const KURL& url) @@ -938,25 +931,45 @@ bool InspectorController::isMainResourceLoader(DocumentLoader* loader, const KUR return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL(); } -void InspectorController::willSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) +void InspectorController::willSendRequest(unsigned long identifier, const ResourceRequest& request, const ResourceResponse& redirectResponse) { + bool isMainResource = (m_mainResource && m_mainResource->identifier() == identifier); + if (m_timelineAgent) + m_timelineAgent->willSendResourceRequest(identifier, isMainResource, request); + RefPtr resource = getTrackedResource(identifier); if (!resource) return; - resource->startTiming(); - if (!redirectResponse.isNull()) { - resource->updateRequest(request); + resource->markResponseReceivedTime(); + resource->endTiming(); resource->updateResponse(redirectResponse); + + // We always store last redirect by the original id key. Rest of the redirects are stored within the last one. + unsigned long id = m_inspectedPage->progress()->createUniqueIdentifier(); + RefPtr withRedirect = resource->appendRedirect(id, request.url()); + removeResource(resource.get()); + addResource(withRedirect.get()); + if (isMainResource) { + m_mainResource = withRedirect; + withRedirect->markMainResource(); + } + resource = withRedirect; } + resource->startTiming(); + resource->updateRequest(request); + if (resource != m_mainResource && windowVisible()) - resource->createScriptObject(m_frontend.get()); + resource->updateScriptObject(m_frontend.get()); } -void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response) +void InspectorController::didReceiveResponse(unsigned long identifier, const ResourceResponse& response) { + if (m_timelineAgent) + m_timelineAgent->didReceiveResourceResponse(identifier, response); + RefPtr resource = getTrackedResource(identifier); if (!resource) return; @@ -964,11 +977,11 @@ void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long iden resource->updateResponse(response); resource->markResponseReceivedTime(); - if (windowVisible()) + if (resource != m_mainResource && windowVisible()) resource->updateScriptObject(m_frontend.get()); } -void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) +void InspectorController::didReceiveContentLength(unsigned long identifier, int lengthReceived) { RefPtr resource = getTrackedResource(identifier); if (!resource) @@ -976,44 +989,38 @@ void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long resource->addLength(lengthReceived); - if (windowVisible()) + if (resource != m_mainResource && windowVisible()) resource->updateScriptObject(m_frontend.get()); } -void InspectorController::didFinishLoading(DocumentLoader*, unsigned long identifier) +void InspectorController::didFinishLoading(unsigned long identifier) { + if (m_timelineAgent) + m_timelineAgent->didFinishLoadingResource(identifier, false); + RefPtr resource = getTrackedResource(identifier); if (!resource) return; - removeResource(resource.get()); - resource->endTiming(); - addResource(resource.get()); - - if (windowVisible()) { + if (resource != m_mainResource && windowVisible()) resource->updateScriptObject(m_frontend.get()); - KURL resourceURL = resource->frame()->document()->url(); - if (resourceURL.protocolInHTTPFamily() || resourceURL.protocolIs("file")) - m_frontend->addCookieDomain(resourceURL.host()); - } } -void InspectorController::didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError& /*error*/) +void InspectorController::didFailLoading(unsigned long identifier, const ResourceError& /*error*/) { + if (m_timelineAgent) + m_timelineAgent->didFinishLoadingResource(identifier, true); + RefPtr resource = getTrackedResource(identifier); if (!resource) return; - removeResource(resource.get()); - resource->markFailed(); resource->endTiming(); - addResource(resource.get()); - - if (windowVisible()) + if (resource != m_mainResource && windowVisible()) resource->updateScriptObject(m_frontend.get()); } @@ -1044,7 +1051,7 @@ void InspectorController::scriptImported(unsigned long identifier, const String& // FIXME: imported script and XHR response are currently viewed as the same // thing by the Inspector. They should be made into distinct types. resource->setXMLHttpResponseText(ScriptString(sourceString)); - + if (windowVisible()) resource->updateScriptObject(m_frontend.get()); } @@ -1055,7 +1062,7 @@ void InspectorController::enableResourceTracking(bool always, bool reload) return; if (always) - setSetting(resourceTrackingEnabledSettingName, Setting(true)); + setSetting(resourceTrackingEnabledSettingName, "true"); if (m_resourceTrackingEnabled) return; @@ -1075,7 +1082,7 @@ void InspectorController::disableResourceTracking(bool always) return; if (always) - setSetting(resourceTrackingEnabledSettingName, Setting(false)); + setSetting(resourceTrackingEnabledSettingName, "false"); ASSERT(m_inspectedPage); m_resourceTrackingEnabled = false; @@ -1089,8 +1096,8 @@ void InspectorController::ensureResourceTrackingSettingsLoaded() return; m_resourceTrackingSettingsLoaded = true; - Setting resourceTracking = setting(resourceTrackingEnabledSettingName); - if (resourceTracking.type() == Setting::BooleanType && resourceTracking.booleanValue()) + String resourceTracking = setting(resourceTrackingEnabledSettingName); + if (resourceTracking == "true") m_resourceTrackingEnabled = true; } @@ -1120,14 +1127,6 @@ void InspectorController::stopTimelineProfiler() m_frontend->timelineProfilerWasStopped(); } -bool InspectorController::timelineProfilerEnabled() const -{ - if (!enabled()) - return false; - - return m_timelineAgent; -} - #if ENABLE(DATABASE) void InspectorController::selectDatabase(Database* database) { @@ -1165,42 +1164,44 @@ void InspectorController::didOpenDatabase(Database* database, const String& doma } #endif -void InspectorController::getCookies(long callId, const String& host) +void InspectorController::getCookies(long callId) { if (!m_frontend) return; - + // If we can get raw cookies. ListHashSet rawCookiesList; - + // If we can't get raw cookies - fall back to String representation String stringCookiesList; - + // Return value to getRawCookies should be the same for every call because // the return value is platform/network backend specific, and the call will // always return the same true/false value. bool rawCookiesImplemented = false; - + ResourcesMap::iterator resourcesEnd = m_resources.end(); for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) { Document* document = it->second->frame()->document(); - if (document->url().host() == host) { - Vector docCookiesList; - rawCookiesImplemented = getRawCookies(document, document->cookieURL(), docCookiesList); - - if (!rawCookiesImplemented) - // FIXME: We need duplication checking for the String representation of cookies. - stringCookiesList += document->cookie(); - else { - int cookiesSize = docCookiesList.size(); - for (int i = 0; i < cookiesSize; i++) { - if (!rawCookiesList.contains(docCookiesList[i])) - rawCookiesList.add(docCookiesList[i]); - } + Vector docCookiesList; + rawCookiesImplemented = getRawCookies(document, it->second->requestURL(), docCookiesList); + + if (!rawCookiesImplemented) { + // FIXME: We need duplication checking for the String representation of cookies. + ExceptionCode ec = 0; + stringCookiesList += document->cookie(ec); + // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here + // because "document" is the document of the main frame of the page. + ASSERT(!ec); + } else { + int cookiesSize = docCookiesList.size(); + for (int i = 0; i < cookiesSize; i++) { + if (!rawCookiesList.contains(docCookiesList[i])) + rawCookiesList.add(docCookiesList[i]); } } } - + if (!rawCookiesImplemented) m_frontend->didGetCookies(callId, m_frontend->newScriptArray(), stringCookiesList); else @@ -1307,7 +1308,7 @@ void InspectorController::setDOMStorageItem(long callId, long storageId, const S if (storageResource) { ExceptionCode exception = 0; storageResource->domStorage()->setItem(key, value, exception); - success = (exception == 0); + success = !exception; } m_frontend->didSetDOMStorageItem(callId, success); } @@ -1346,43 +1347,35 @@ void InspectorController::moveWindowBy(float x, float y) const } #if ENABLE(JAVASCRIPT_DEBUGGER) -void InspectorController::addProfile(PassRefPtr prpProfile, unsigned lineNumber, const UString& sourceURL) +void InspectorController::addProfile(PassRefPtr prpProfile, unsigned lineNumber, const String& sourceURL) { if (!enabled()) return; - RefPtr profile = prpProfile; + RefPtr profile = prpProfile; m_profiles.add(profile->uid(), profile); if (m_frontend) { +#if USE(JSC) JSLock lock(SilenceAssertionsOnly); +#endif m_frontend->addProfileHeader(createProfileHeader(*profile)); } addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL); } -void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr prpProfile, unsigned lineNumber, const UString& sourceURL) +void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr prpProfile, unsigned lineNumber, const String& sourceURL) { - RefPtr profile = prpProfile; + RefPtr profile = prpProfile; - UString message = "Profile \"webkit-profile://"; - message += encodeWithURLEscapeSequences(CPUProfileType); - message += "/"; - message += encodeWithURLEscapeSequences(profile->title()); - message += "#"; - message += UString::from(profile->uid()); - message += "\" finished."; + String message = String::format("Profile \"webkit-profile://%s/%s#%d\" finished.", CPUProfileType, encodeWithURLEscapeSequences(profile->title()).utf8().data(), profile->uid()); addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL); } -void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL) +void InspectorController::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL) { - UString message = "Profile \"webkit-profile://"; - message += encodeWithURLEscapeSequences(CPUProfileType); - message += "/"; - message += encodeWithURLEscapeSequences(title); - message += "#0\" started."; + String message = String::format("Profile \"webkit-profile://%s/%s#0\" started.", CPUProfileType, encodeWithURLEscapeSequences(title).utf8().data()); addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL); } @@ -1403,28 +1396,27 @@ void InspectorController::getProfile(long callId, unsigned uid) if (!m_frontend) return; ProfilesMap::iterator it = m_profiles.find(uid); +#if USE(JSC) if (it != m_profiles.end()) - m_frontend->didGetProfile(callId, toJS(m_scriptState, it->second.get())); + m_frontend->didGetProfile(callId, toJS(m_frontendScriptState, it->second.get())); +#endif } -ScriptObject InspectorController::createProfileHeader(const JSC::Profile& profile) +ScriptObject InspectorController::createProfileHeader(const ScriptProfile& profile) { ScriptObject header = m_frontend->newScriptObject(); header.set("title", profile.title()); header.set("uid", profile.uid()); + header.set("typeId", String(CPUProfileType)); return header; } -UString InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false) +String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false) { if (incrementProfileNumber) m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++; - UString title = UserInitiatedProfileName; - title += "."; - title += UString::from(m_currentUserInitiatedProfileNumber); - - return title; + return String::format("%s.%d", UserInitiatedProfileName, m_currentUserInitiatedProfileNumber); } void InspectorController::startUserInitiatedProfilingSoon() @@ -1439,17 +1431,21 @@ void InspectorController::startUserInitiatedProfiling(Timer if (!profilerEnabled()) { enableProfiler(false, true); - JavaScriptDebugServer::shared().recompileAllJSFunctions(); + ScriptDebugServer::recompileAllJSFunctions(); } m_recordingUserInitiatedProfile = true; - UString title = getCurrentUserInitiatedProfileName(true); + String title = getCurrentUserInitiatedProfileName(true); +#if USE(JSC) ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); - Profiler::profiler()->startProfiling(scriptState, title); +#else + ScriptState* scriptState = 0; +#endif + ScriptProfiler::start(scriptState, title); - addStartProfilingMessageToConsole(title, 0, UString()); + addStartProfilingMessageToConsole(title, 0, String()); toggleRecordButton(true); } @@ -1461,12 +1457,16 @@ void InspectorController::stopUserInitiatedProfiling() m_recordingUserInitiatedProfile = false; - UString title = getCurrentUserInitiatedProfileName(); + String title = getCurrentUserInitiatedProfileName(); +#if USE(JSC) ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); - RefPtr profile = Profiler::profiler()->stopProfiling(scriptState, title); +#else + ScriptState* scriptState = 0; +#endif + RefPtr profile = ScriptProfiler::stop(scriptState, title); if (profile) - addProfile(profile, 0, UString()); + addProfile(profile, 0, String()); toggleRecordButton(false); } @@ -1481,7 +1481,7 @@ void InspectorController::toggleRecordButton(bool isProfiling) void InspectorController::enableProfiler(bool always, bool skipRecompile) { if (always) - setSetting(profilerEnabledSettingName, Setting(true)); + setSetting(profilerEnabledSettingName, "true"); if (m_profilerEnabled) return; @@ -1489,7 +1489,7 @@ void InspectorController::enableProfiler(bool always, bool skipRecompile) m_profilerEnabled = true; if (!skipRecompile) - JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon(); + ScriptDebugServer::recompileAllJSFunctionsSoon(); if (m_frontend) m_frontend->profilerWasEnabled(); @@ -1498,23 +1498,25 @@ void InspectorController::enableProfiler(bool always, bool skipRecompile) void InspectorController::disableProfiler(bool always) { if (always) - setSetting(profilerEnabledSettingName, Setting(false)); + setSetting(profilerEnabledSettingName, "false"); if (!m_profilerEnabled) return; m_profilerEnabled = false; - JavaScriptDebugServer::shared().recompileAllJSFunctionsSoon(); + ScriptDebugServer::recompileAllJSFunctionsSoon(); if (m_frontend) m_frontend->profilerWasDisabled(); } +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void InspectorController::enableDebuggerFromFrontend(bool always) { if (always) - setSetting(debuggerEnabledSettingName, Setting(true)); + setSetting(debuggerEnabledSettingName, "true"); ASSERT(m_inspectedPage); @@ -1533,9 +1535,9 @@ void InspectorController::enableDebugger() if (m_debuggerEnabled) return; - if (!m_scriptState || !m_frontend) { + if (!m_frontendScriptState || !m_frontend) m_attachDebuggerWhenShown = true; - } else { + else { m_frontend->attachDebuggerWhenShown(); m_attachDebuggerWhenShown = false; } @@ -1547,7 +1549,7 @@ void InspectorController::disableDebugger(bool always) return; if (always) - setSetting(debuggerEnabledSettingName, Setting(false)); + setSetting(debuggerEnabledSettingName, "false"); ASSERT(m_inspectedPage); @@ -1581,9 +1583,12 @@ void InspectorController::failedToParseSource(ExecState*, const SourceCode& sour void InspectorController::didPause() { - ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "getCallFrames"); - ScriptValue callFrames = function.call(); - m_frontend->pausedScript(callFrames); + JavaScriptCallFrame* callFrame = m_injectedScriptHost->currentCallFrame(); + ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec(); + ASSERT(scriptState); + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState); + RefPtr callFrames = injectedScript.callFrames(); + m_frontend->pausedScript(callFrames.get()); } void InspectorController::didContinue() @@ -1603,11 +1608,11 @@ void InspectorController::evaluateForTestInFrontend(long callId, const String& s void InspectorController::didEvaluateForTestInFrontend(long callId, const String& jsonResult) { - ScriptState* scriptState = scriptStateFromPage(m_inspectedPage); + ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage); ScriptObject window; ScriptGlobalObject::get(scriptState, "window", window); - ScriptFunctionCall function(scriptState, window, "didEvaluateForTestInFrontend"); - function.appendArgument(static_cast(callId)); + ScriptFunctionCall function(window, "didEvaluateForTestInFrontend"); + function.appendArgument(callId); function.appendArgument(jsonResult); function.call(); } @@ -1639,7 +1644,7 @@ static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, co context.addPath(quadPath); context.setStrokeThickness(outlineThickness); - context.setStrokeColor(outlineColor); + context.setStrokeColor(outlineColor, DeviceColorSpace); context.strokePath(); context.restore(); @@ -1647,7 +1652,7 @@ static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, co // Now do the fill context.addPath(quadPath); - context.setFillColor(fillColor); + context.setFillColor(fillColor, DeviceColorSpace); context.fillPath(); } @@ -1794,72 +1799,52 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co { if (panelName == "elements") return ElementsPanel; - else if (panelName == "resources") + if (panelName == "resources") return ResourcesPanel; - else if (panelName == "scripts") + if (panelName == "scripts") return ScriptsPanel; - else if (panelName == "profiles") + if (panelName == "timeline") + return TimelinePanel; + if (panelName == "profiles") return ProfilesPanel; - else if (panelName == "storage" || panelName == "databases") + if (panelName == "storage" || panelName == "databases") return StoragePanel; - else - return ElementsPanel; + if (panelName == "console") + return ConsolePanel; + return ElementsPanel; } -ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject, const String& objectGroup) +void InspectorController::deleteCookie(const String& cookieName, const String& domain) { - ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); - function.appendArgument(quarantinedObject); - if (quarantinedObject.isObject()) { - long id = m_lastBoundObjectId++; - String objectId = String::format("object#%ld", id); - m_idToWrappedObject.set(objectId, quarantinedObject); - ObjectGroupsMap::iterator it = m_objectGroups.find(objectGroup); - if (it == m_objectGroups.end()) - it = m_objectGroups.set(objectGroup, Vector()).first; - it->second.append(objectId); - function.appendArgument(objectId); + ResourcesMap::iterator resourcesEnd = m_resources.end(); + for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) { + Document* document = it->second->frame()->document(); + if (document->url().host() == domain) + WebCore::deleteCookie(document, it->second->requestURL(), cookieName); } - ScriptValue wrapper = function.call(); - return wrapper; } -ScriptValue InspectorController::unwrapObject(const String& objectId) +InjectedScript InspectorController::injectedScriptForNodeId(long id) { - HashMap::iterator it = m_idToWrappedObject.find(objectId); - if (it != m_idToWrappedObject.end()) - return it->second; - return ScriptValue(); -} -void InspectorController::releaseWrapperObjectGroup(const String& objectGroup) -{ - ObjectGroupsMap::iterator groupIt = m_objectGroups.find(objectGroup); - if (groupIt == m_objectGroups.end()) - return; + Frame* frame = 0; + if (id) { + ASSERT(m_domAgent); + Node* node = m_domAgent->nodeForId(id); + if (node) { + Document* document = node->ownerDocument(); + if (document) + frame = document->frame(); + } + } else + frame = m_inspectedPage->mainFrame(); - Vector& groupIds = groupIt->second; - for (Vector::iterator it = groupIds.begin(); it != groupIds.end(); ++it) - m_idToWrappedObject.remove(*it); - m_objectGroups.remove(groupIt); -} + if (frame) + return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame)); -void InspectorController::resetInjectedScript() -{ - ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "reset"); - function.call(); -} - -void InspectorController::deleteCookie(const String& cookieName, const String& domain) -{ - ResourcesMap::iterator resourcesEnd = m_resources.end(); - for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) { - Document* document = it->second->frame()->document(); - if (document->url().host() == domain) - WebCore::deleteCookie(document, document->cookieURL(), cookieName); - } + return InjectedScript(); } } // namespace WebCore - + #endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h index 382d887..2f25eec 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorController.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorController.h @@ -31,9 +31,11 @@ #include "Console.h" #include "Cookie.h" +#include "InspectorDOMAgent.h" #include "PlatformString.h" #include "ScriptArray.h" #include "ScriptObject.h" +#include "ScriptProfile.h" #include "ScriptState.h" #include "ScriptValue.h" #include "StringHash.h" @@ -45,12 +47,11 @@ #include #include -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptDebugListener.h" namespace JSC { - class Profile; - class UString; +class UString; } #endif @@ -60,18 +61,21 @@ class CachedResource; class Database; class Document; class DocumentLoader; +class Element; class GraphicsContext; class HitTestResult; +class InjectedScript; +class InjectedScriptHost; class InspectorBackend; class InspectorClient; -class InspectorDOMAgent; class InspectorFrontend; +class InspectorFrontendHost; class InspectorTimelineAgent; class JavaScriptCallFrame; class KURL; class Node; class Page; -struct ResourceRequest; +class ResourceRequest; class ResourceResponse; class ResourceError; class ScriptCallStack; @@ -86,85 +90,35 @@ class InspectorDOMStorageResource; class InspectorResource; class InspectorController -#if ENABLE(JAVASCRIPT_DEBUGGER) - : JavaScriptDebugListener +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + : JavaScriptDebugListener, public Noncopyable +#else + : public Noncopyable #endif { public: - typedef HashMap > ResourcesMap; + typedef HashMap > ResourcesMap; typedef HashMap, ResourcesMap*> FrameResourcesMap; typedef HashMap > DatabaseResourcesMap; typedef HashMap > DOMStorageResourcesMap; - typedef HashMap > ObjectGroupsMap; typedef enum { CurrentPanel, ConsolePanel, ElementsPanel, - ProfilesPanel, ResourcesPanel, ScriptsPanel, + TimelinePanel, + ProfilesPanel, StoragePanel } SpecialPanels; - struct Setting { - enum Type { - NoType, StringType, StringVectorType, DoubleType, IntegerType, BooleanType - }; - - Setting() - : m_type(NoType) - { - } - - explicit Setting(bool value) - : m_type(BooleanType) - { - m_simpleContent.m_boolean = value; - } - - explicit Setting(unsigned value) - : m_type(IntegerType) - { - m_simpleContent.m_integer = value; - } - - explicit Setting(const String& value) - : m_type(StringType) - { - m_string = value; - } - - Type type() const { return m_type; } - - String string() const { ASSERT(m_type == StringType); return m_string; } - const Vector& stringVector() const { ASSERT(m_type == StringVectorType); return m_stringVector; } - double doubleValue() const { ASSERT(m_type == DoubleType); return m_simpleContent.m_double; } - long integerValue() const { ASSERT(m_type == IntegerType); return m_simpleContent.m_integer; } - bool booleanValue() const { ASSERT(m_type == BooleanType); return m_simpleContent.m_boolean; } - - void set(const String& value) { m_type = StringType; m_string = value; } - void set(const Vector& value) { m_type = StringVectorType; m_stringVector = value; } - void set(double value) { m_type = DoubleType; m_simpleContent.m_double = value; } - void set(long value) { m_type = IntegerType; m_simpleContent.m_integer = value; } - void set(bool value) { m_type = BooleanType; m_simpleContent.m_boolean = value; } - - private: - Type m_type; - - String m_string; - Vector m_stringVector; - - union { - double m_double; - long m_integer; - bool m_boolean; - } m_simpleContent; - }; InspectorController(Page*, InspectorClient*); ~InspectorController(); InspectorBackend* inspectorBackend() { return m_inspectorBackend.get(); } + InspectorFrontendHost* inspectorFrontendHost() { return m_inspectorFrontendHost.get(); } + InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); } void inspectedPageDestroyed(); void pageDestroyed() { m_page = 0; } @@ -173,8 +127,8 @@ public: Page* inspectedPage() const { return m_inspectedPage; } - const Setting& setting(const String& key) const; - void setSetting(const String& key, const Setting&); + String setting(const String& key) const; + void setSetting(const String& key, const String& value); void inspect(Node*); void highlight(Node*); @@ -189,14 +143,14 @@ public: void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*); void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID); - void clearConsoleMessages(bool clearUI); + void clearConsoleMessages(); const Vector& consoleMessages() const { return m_consoleMessages; } void attachWindow(); void detachWindow(); void toggleSearchForNodeInPage(); - bool searchingForNodeInPage() { return m_searchingForNode; }; + bool searchingForNodeInPage() const { return m_searchingForNode; } void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void handleMousePressOnNode(Node*); @@ -204,7 +158,7 @@ public: void windowScriptObjectAvailable(); void setFrontendProxyObject(ScriptState* state, ScriptObject webInspectorObj, ScriptObject injectedScriptObj = ScriptObject()); - ScriptState* frontendScriptState() const { return m_scriptState; } + ScriptState* frontendScriptState() const { return m_frontendScriptState; } void populateScriptObjects(); void resetScriptObjects(); @@ -215,11 +169,11 @@ public: void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*); void identifierForInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&); - void willSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse); - void didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&); - void didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived); - void didFinishLoading(DocumentLoader*, unsigned long identifier); - void didFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&); + void willSendRequest(unsigned long identifier, const ResourceRequest&, const ResourceResponse& redirectResponse); + void didReceiveResponse(unsigned long identifier, const ResourceResponse&); + void didReceiveContentLength(unsigned long identifier, int lengthReceived); + void didFinishLoading(unsigned long identifier); + void didFailLoading(unsigned long identifier, const ResourceError&); void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString); void scriptImported(unsigned long identifier, const String& sourceString); @@ -230,13 +184,16 @@ public: void startTimelineProfiler(); void stopTimelineProfiler(); - bool timelineProfilerEnabled() const; InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); } void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&); void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&); + + void didInsertDOMNode(Node*); + void didRemoveDOMNode(Node*); + void didModifyDOMAttr(Element*); - void getCookies(long callId, const String& url); + void getCookies(long callId); #if ENABLE(DATABASE) void didOpenDatabase(Database*, const String& domain, const String& name, const String& version); @@ -261,21 +218,25 @@ public: void startGroup(MessageSource source, ScriptCallStack* callFrame); void endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL); + void markTimeline(const String& message); + #if ENABLE(JAVASCRIPT_DEBUGGER) - void addProfile(PassRefPtr, unsigned lineNumber, const JSC::UString& sourceURL); - void addProfileFinishedMessageToConsole(PassRefPtr, unsigned lineNumber, const JSC::UString& sourceURL); - void addStartProfilingMessageToConsole(const JSC::UString& title, unsigned lineNumber, const JSC::UString& sourceURL); + void addProfile(PassRefPtr, unsigned lineNumber, const String& sourceURL); + void addProfileFinishedMessageToConsole(PassRefPtr, unsigned lineNumber, const String& sourceURL); + void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); bool isRecordingUserInitiatedProfile() const { return m_recordingUserInitiatedProfile; } - JSC::UString getCurrentUserInitiatedProfileName(bool incrementProfileNumber); + String getCurrentUserInitiatedProfileName(bool incrementProfileNumber); void startUserInitiatedProfiling(Timer* = 0); void stopUserInitiatedProfiling(); void enableProfiler(bool always = false, bool skipRecompile = false); void disableProfiler(bool always = false); bool profilerEnabled() const { return enabled() && m_profilerEnabled; } +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void enableDebugger(); void disableDebugger(bool always = false); bool debuggerEnabled() const { return m_debuggerEnabled; } @@ -290,8 +251,13 @@ public: void evaluateForTestInFrontend(long callId, const String& script); + InjectedScript injectedScriptForNodeId(long id); + private: + static const char* const FrontendSettingsSettingName; friend class InspectorBackend; + friend class InspectorFrontendHost; + friend class InjectedScriptHost; // Following are used from InspectorBackend and internally. void scriptObjectReady(); void moveWindowBy(float x, float y) const; @@ -302,27 +268,17 @@ private: InspectorDOMAgent* domAgent() { return m_domAgent.get(); } void releaseDOMAgent(); - friend class InspectorFrontend; - // Following are used from InspectorFrontend only. We don't want to expose them to the - // rest of the InspectorController clients. - // TODO: extract these into a separate interface. - ScriptValue wrapObject(const ScriptValue& object, const String& objectGroup); - ScriptValue unwrapObject(const String& objectId); - void releaseWrapperObjectGroup(const String& objectGroup); - - void resetInjectedScript(); - void deleteCookie(const String& cookieName, const String& domain); #if ENABLE(JAVASCRIPT_DEBUGGER) - typedef HashMap > ProfilesMap; + typedef HashMap > ProfilesMap; void startUserInitiatedProfilingSoon(); void toggleRecordButton(bool); void enableDebuggerFromFrontend(bool always); void getProfileHeaders(long callId); void getProfile(long callId, unsigned uid); - ScriptObject createProfileHeader(const JSC::Profile& profile); + ScriptObject createProfileHeader(const ScriptProfile& profile); #endif #if ENABLE(DATABASE) void selectDatabase(Database* database); @@ -341,7 +297,7 @@ private: void addResource(InspectorResource*); void removeResource(InspectorResource*); - InspectorResource* getTrackedResource(long long identifier); + InspectorResource* getTrackedResource(unsigned long identifier); void pruneResources(ResourcesMap*, DocumentLoader* loaderToKeep = 0); void removeAllResources(ResourcesMap* map) { pruneResources(map); } @@ -359,7 +315,6 @@ private: OwnPtr m_frontend; RefPtr m_domAgent; OwnPtr m_timelineAgent; - ScriptObject m_injectedScriptObj; Page* m_page; RefPtr m_nodeToFocus; RefPtr m_mainResource; @@ -367,6 +322,7 @@ private: HashSet m_knownResources; FrameResourcesMap m_frameResources; Vector m_consoleMessages; + unsigned m_expiredConsoleMessageCount; HashMap m_times; HashMap m_counts; #if ENABLE(DATABASE) @@ -375,10 +331,9 @@ private: #if ENABLE(DOM_STORAGE) DOMStorageResourcesMap m_domStorageResources; #endif - ScriptState* m_scriptState; + ScriptState* m_frontendScriptState; bool m_windowVisible; SpecialPanels m_showAfterVisible; - long long m_nextIdentifier; RefPtr m_highlightedNode; unsigned m_groupLevel; bool m_searchingForNode; @@ -386,14 +341,18 @@ private: bool m_resourceTrackingEnabled; bool m_resourceTrackingSettingsLoaded; RefPtr m_inspectorBackend; - HashMap m_idToWrappedObject; - ObjectGroupsMap m_objectGroups; + RefPtr m_inspectorFrontendHost; + RefPtr m_injectedScriptHost; + + typedef HashMap Settings; + mutable Settings m_settings; - long m_lastBoundObjectId; Vector > m_pendingEvaluateTestCommands; -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) bool m_debuggerEnabled; bool m_attachDebuggerWhenShown; +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) bool m_profilerEnabled; bool m_recordingUserInitiatedProfile; int m_currentUserInitiatedProfileNumber; @@ -403,6 +362,24 @@ private: #endif }; +inline void InspectorController::didInsertDOMNode(Node* node) +{ + if (m_domAgent) + m_domAgent->didInsertDOMNode(node); +} + +inline void InspectorController::didRemoveDOMNode(Node* node) +{ + if (m_domAgent) + m_domAgent->didRemoveDOMNode(node); +} + +inline void InspectorController::didModifyDOMAttr(Element* element) +{ + if (m_domAgent) + m_domAgent->didModifyDOMAttr(element); +} + } // namespace WebCore #endif // !defined(InspectorController_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp index f6c2d46..0387f30 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.cpp @@ -39,6 +39,7 @@ #include "CookieJar.h" #include "DOMWindow.h" #include "Document.h" +#include "DocumentType.h" #include "Event.h" #include "EventListener.h" #include "EventNames.h" @@ -68,13 +69,11 @@ InspectorDOMAgent::InspectorDOMAgent(InspectorFrontend* frontend) InspectorDOMAgent::~InspectorDOMAgent() { - setDocument(0); + reset(); } -void InspectorDOMAgent::setDocument(Document* doc) +void InspectorDOMAgent::reset() { - if (doc == mainFrameDocument()) - return; discardBindings(); ListHashSet > copy = m_documents; @@ -82,13 +81,21 @@ void InspectorDOMAgent::setDocument(Document* doc) stopListening((*it).get()); ASSERT(!m_documents.size()); +} + +void InspectorDOMAgent::setDocument(Document* doc) +{ + if (doc == mainFrameDocument()) + return; + + reset(); if (doc) { startListening(doc); - if (doc->documentElement()) { + if (doc->documentElement()) pushDocumentToFrontend(); - } - } + } else + m_frontend->setDocument(ScriptObject()); } void InspectorDOMAgent::releaseDanglingNodes() @@ -103,9 +110,6 @@ void InspectorDOMAgent::startListening(Document* doc) return; doc->addEventListener(eventNames().DOMContentLoadedEvent, this, false); - doc->addEventListener(eventNames().DOMNodeInsertedEvent, this, false); - doc->addEventListener(eventNames().DOMNodeRemovedEvent, this, false); - doc->addEventListener(eventNames().DOMAttrModifiedEvent, this, false); doc->addEventListener(eventNames().loadEvent, this, true); m_documents.add(doc); } @@ -116,9 +120,6 @@ void InspectorDOMAgent::stopListening(Document* doc) return; doc->removeEventListener(eventNames().DOMContentLoadedEvent, this, false); - doc->removeEventListener(eventNames().DOMNodeInsertedEvent, this, false); - doc->removeEventListener(eventNames().DOMNodeRemovedEvent, this, false); - doc->removeEventListener(eventNames().DOMAttrModifiedEvent, this, false); doc->removeEventListener(eventNames().loadEvent, this, true); m_documents.remove(doc); } @@ -128,56 +129,7 @@ void InspectorDOMAgent::handleEvent(ScriptExecutionContext*, Event* event) AtomicString type = event->type(); Node* node = event->target()->toNode(); - if (type == eventNames().DOMAttrModifiedEvent) { - long id = m_documentNodeToIdMap.get(node); - // If node is not mapped yet -> ignore the event. - if (!id) - return; - - Element* element = static_cast(node); - m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element)); - } else if (type == eventNames().DOMNodeInsertedEvent) { - if (isWhitespace(node)) - return; - - // We could be attaching existing subtree. Forget the bindings. - unbind(node, &m_documentNodeToIdMap); - - Node* parent = static_cast(event)->relatedNode(); - long parentId = m_documentNodeToIdMap.get(parent); - // Return if parent is not mapped yet. - if (!parentId) - return; - - if (!m_childrenRequested.contains(parentId)) { - // No children are mapped yet -> only notify on changes of hasChildren. - m_frontend->childNodeCountUpdated(parentId, innerChildNodeCount(parent)); - } else { - // Children have been requested -> return value of a new child. - Node* prevSibling = innerPreviousSibling(node); - long prevId = prevSibling ? m_documentNodeToIdMap.get(prevSibling) : 0; - ScriptObject value = buildObjectForNode(node, 0, &m_documentNodeToIdMap); - m_frontend->childNodeInserted(parentId, prevId, value); - } - } else if (type == eventNames().DOMNodeRemovedEvent) { - if (isWhitespace(node)) - return; - - Node* parent = static_cast(event)->relatedNode(); - long parentId = m_documentNodeToIdMap.get(parent); - // If parent is not mapped yet -> ignore the event. - if (!parentId) - return; - - if (!m_childrenRequested.contains(parentId)) { - // No children are mapped yet -> only notify on changes of hasChildren. - if (innerChildNodeCount(parent) == 1) - m_frontend->childNodeCountUpdated(parentId, 0); - } else { - m_frontend->childNodeRemoved(parentId, m_documentNodeToIdMap.get(node)); - } - unbind(node, &m_documentNodeToIdMap); - } else if (type == eventNames().DOMContentLoadedEvent) { + if (type == eventNames().DOMContentLoadedEvent) { // Re-push document once it is loaded. discardBindings(); pushDocumentToFrontend(); @@ -193,8 +145,9 @@ void InspectorDOMAgent::handleEvent(ScriptExecutionContext*, Event* event) // Re-add frame owner element together with its new children. long parentId = m_documentNodeToIdMap.get(innerParentNode(node)); m_frontend->childNodeRemoved(parentId, frameOwnerId); - long prevId = m_documentNodeToIdMap.get(innerPreviousSibling(node)); ScriptObject value = buildObjectForNode(node, 0, &m_documentNodeToIdMap); + Node* previousSibling = innerPreviousSibling(node); + long prevId = previousSibling ? m_documentNodeToIdMap.get(previousSibling) : 0; m_frontend->childNodeInserted(parentId, prevId, value); // Invalidate children requested flag for the element. m_childrenRequested.remove(m_childrenRequested.find(frameOwnerId)); @@ -238,17 +191,20 @@ void InspectorDOMAgent::unbind(Node* node, NodeToIdMap* nodesMap) } } -void InspectorDOMAgent::pushDocumentToFrontend() +bool InspectorDOMAgent::pushDocumentToFrontend() { Document* document = mainFrameDocument(); + if (!document) + return false; if (!m_documentNodeToIdMap.contains(document)) m_frontend->setDocument(buildObjectForNode(document, 2, &m_documentNodeToIdMap)); + return true; } void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId) { Node* node = nodeForId(nodeId); - if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)) + if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE && node->nodeType() != Node::DOCUMENT_FRAGMENT_NODE)) return; if (m_childrenRequested.contains(nodeId)) return; @@ -278,6 +234,35 @@ Node* InspectorDOMAgent::nodeForId(long id) return 0; } +Node* InspectorDOMAgent::nodeForPath(const String& path) +{ + // The path is of form "1,HTML,2,BODY,1,DIV" + Node* node = mainFrameDocument(); + if (!node) + return 0; + + Vector pathTokens; + path.split(",", false, pathTokens); + for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { + bool success = true; + unsigned childNumber = pathTokens[i].toUInt(&success); + if (!success) + return 0; + if (childNumber >= innerChildNodeCount(node)) + return 0; + + Node* child = innerFirstChild(node); + String childName = pathTokens[i + 1]; + for (size_t j = 0; child && j < childNumber; ++j) + child = innerNextSibling(child); + + if (!child || child->nodeName() != childName) + return 0; + node = child; + } + return node; +} + void InspectorDOMAgent::getChildNodes(long callId, long nodeId) { pushChildNodesToFrontend(nodeId); @@ -289,7 +274,8 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush) ASSERT(nodeToPush); // Invalid input // If we are sending information to the client that is currently being created. Send root node first. - pushDocumentToFrontend(); + if (!pushDocumentToFrontend()) + return 0; // Return id in case the node is known. long result = m_documentNodeToIdMap.get(nodeToPush); @@ -380,8 +366,8 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId) // Get the list of event types this Node is concerned with Vector eventTypes; const EventListenerMap& listenerMap = d->eventListenerMap; - HashMap::const_iterator end = listenerMap.end(); - for (HashMap::const_iterator iter = listenerMap.begin(); iter != end; ++iter) + EventListenerMap::const_iterator end = listenerMap.end(); + for (EventListenerMap::const_iterator iter = listenerMap.begin(); iter != end; ++iter) eventTypes.append(iter->first); // Quick break if no useful listeners @@ -438,6 +424,13 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId) m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray); } +String InspectorDOMAgent::documentURLString(Document* document) const +{ + if (!document || document->url().isNull()) + return ""; + return document->url().string(); +} + ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap) { ScriptObject value = m_frontend->newScriptObject(); @@ -465,22 +458,35 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeTo break; } - value.set("id", static_cast(id)); + value.set("id", id); value.set("nodeType", node->nodeType()); value.set("nodeName", nodeName); value.set("localName", localName); value.set("nodeValue", nodeValue); - if (node->nodeType() == Node::ELEMENT_NODE) { - Element* element = static_cast(node); - value.set("attributes", buildArrayForElementAttributes(element)); - } - if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE) { + if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE || node->nodeType() == Node::DOCUMENT_FRAGMENT_NODE) { int nodeCount = innerChildNodeCount(node); value.set("childNodeCount", nodeCount); ScriptArray children = buildArrayForContainerChildren(node, depth, nodesMap); if (children.length() > 0) value.set("children", children); + + if (node->nodeType() == Node::ELEMENT_NODE) { + Element* element = static_cast(node); + value.set("attributes", buildArrayForElementAttributes(element)); + if (node->isFrameOwnerElement()) { + HTMLFrameOwnerElement* frameOwner = static_cast(node); + value.set("documentURL", documentURLString(frameOwner->contentDocument())); + } + } else if (node->nodeType() == Node::DOCUMENT_NODE) { + Document* document = static_cast(node); + value.set("documentURL", documentURLString(document)); + } + } else if (node->nodeType() == Node::DOCUMENT_TYPE_NODE) { + DocumentType* docType = static_cast(node); + value.set("publicId", docType->publicId()); + value.set("systemId", docType->systemId()); + value.set("internalSubset", docType->internalSubset()); } return value; } @@ -532,7 +538,7 @@ ScriptObject InspectorDOMAgent::buildObjectForEventListener(const RegisteredEven value.set("type", eventType); value.set("useCapture", registeredEventListener.useCapture); value.set("isAttribute", eventListener->isAttribute()); - value.set("nodeId", static_cast(pushNodePathToFrontend(node))); + value.set("nodeId", pushNodePathToFrontend(node)); value.set("listener", getEventListenerHandlerBody(node->document(), m_frontend->scriptState(), eventListener.get())); return value; } @@ -569,9 +575,9 @@ Node* InspectorDOMAgent::innerPreviousSibling(Node* node) return node; } -int InspectorDOMAgent::innerChildNodeCount(Node* node) +unsigned InspectorDOMAgent::innerChildNodeCount(Node* node) { - int count = 0; + unsigned count = 0; Node* child = innerFirstChild(node); while (child) { count++; @@ -609,6 +615,62 @@ bool InspectorDOMAgent::operator==(const EventListener& listener) return false; } +void InspectorDOMAgent::didInsertDOMNode(Node* node) +{ + if (isWhitespace(node)) + return; + + // We could be attaching existing subtree. Forget the bindings. + unbind(node, &m_documentNodeToIdMap); + + Node* parent = node->parentNode(); + long parentId = m_documentNodeToIdMap.get(parent); + // Return if parent is not mapped yet. + if (!parentId) + return; + + if (!m_childrenRequested.contains(parentId)) { + // No children are mapped yet -> only notify on changes of hasChildren. + m_frontend->childNodeCountUpdated(parentId, innerChildNodeCount(parent)); + } else { + // Children have been requested -> return value of a new child. + Node* prevSibling = innerPreviousSibling(node); + long prevId = prevSibling ? m_documentNodeToIdMap.get(prevSibling) : 0; + ScriptObject value = buildObjectForNode(node, 0, &m_documentNodeToIdMap); + m_frontend->childNodeInserted(parentId, prevId, value); + } +} + +void InspectorDOMAgent::didRemoveDOMNode(Node* node) +{ + if (isWhitespace(node)) + return; + + Node* parent = node->parentNode(); + long parentId = m_documentNodeToIdMap.get(parent); + // If parent is not mapped yet -> ignore the event. + if (!parentId) + return; + + if (!m_childrenRequested.contains(parentId)) { + // No children are mapped yet -> only notify on changes of hasChildren. + if (innerChildNodeCount(parent) == 1) + m_frontend->childNodeCountUpdated(parentId, 0); + } else + m_frontend->childNodeRemoved(parentId, m_documentNodeToIdMap.get(node)); + unbind(node, &m_documentNodeToIdMap); +} + +void InspectorDOMAgent::didModifyDOMAttr(Element* element) +{ + long id = m_documentNodeToIdMap.get(element); + // If node is not mapped yet -> ignore the event. + if (!id) + return; + + m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element)); +} + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h index 3f736f7..d7334b7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDOMAgent.h @@ -83,6 +83,8 @@ namespace WebCore { InspectorDOMAgent(InspectorFrontend* frontend); ~InspectorDOMAgent(); + void reset(); + virtual bool operator==(const EventListener& other); // Methods called from the frontend. @@ -96,8 +98,14 @@ namespace WebCore { void setDocument(Document* document); void releaseDanglingNodes(); + void didInsertDOMNode(Node*); + void didRemoveDOMNode(Node*); + void didModifyDOMAttr(Element*); + Node* nodeForId(long nodeId); + Node* nodeForPath(const String& path); long pushNodePathToFrontend(Node* node); + void pushChildNodesToFrontend(long nodeId); private: void startListening(Document* document); @@ -109,8 +117,7 @@ namespace WebCore { long bind(Node* node, NodeToIdMap* nodesMap); void unbind(Node* node, NodeToIdMap* nodesMap); - void pushDocumentToFrontend(); - void pushChildNodesToFrontend(long nodeId); + bool pushDocumentToFrontend(); ScriptObject buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap); ScriptArray buildArrayForElementAttributes(Element* element); @@ -123,11 +130,12 @@ namespace WebCore { Node* innerFirstChild(Node* node); Node* innerNextSibling(Node* node); Node* innerPreviousSibling(Node* node); - int innerChildNodeCount(Node* node); + unsigned innerChildNodeCount(Node* node); Node* innerParentNode(Node* node); bool isWhitespace(Node* node); Document* mainFrameDocument() const; + String documentURLString(Document* document) const; void discardBindings(); InspectorFrontend* m_frontend; diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.cpp index c2dc5c6..cec0e28 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorDatabaseResource.cpp @@ -37,7 +37,6 @@ #include "Frame.h" #include "InspectorFrontend.h" #include "ScriptObject.h" -#include "ScriptObjectQuarantine.h" namespace WebCore { @@ -59,9 +58,6 @@ void InspectorDatabaseResource::bind(InspectorFrontend* frontend) return; ScriptObject jsonObject = frontend->newScriptObject(); - ScriptObject database; - if (!getQuarantinedScriptObject(m_database.get(), database)) - return; jsonObject.set("id", m_id); jsonObject.set("domain", m_domain); jsonObject.set("name", m_name); diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp old mode 100644 new mode 100755 index 2c422ac..90b60f4 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.cpp @@ -34,16 +34,19 @@ #include "ConsoleMessage.h" #include "Frame.h" +#include "InjectedScript.h" +#include "InjectedScriptHost.h" #include "InspectorController.h" #include "Node.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" -#include "ScriptObjectQuarantine.h" #include "ScriptState.h" #include "ScriptString.h" +#include "ScriptValue.h" +#include "SerializedScriptValue.h" #include -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include #include #include @@ -51,9 +54,8 @@ namespace WebCore { -InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptState* scriptState, ScriptObject webInspector) +InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector) : m_inspectorController(inspectorController) - , m_scriptState(scriptState) , m_webInspector(webInspector) { } @@ -65,12 +67,12 @@ InspectorFrontend::~InspectorFrontend() ScriptArray InspectorFrontend::newScriptArray() { - return ScriptArray::createNew(m_scriptState); + return ScriptArray::createNew(scriptState()); } ScriptObject InspectorFrontend::newScriptObject() { - return ScriptObject::createNew(m_scriptState); + return ScriptObject::createNew(scriptState()); } void InspectorFrontend::didCommitLoad() @@ -78,26 +80,53 @@ void InspectorFrontend::didCommitLoad() callSimpleFunction("didCommitLoad"); } -void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector& frames, const Vector wrappedArguments, const String& message) +void InspectorFrontend::populateFrontendSettings(const String& settings) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("populateFrontendSettings"); + function.appendArgument(settings); + function.call(); +} + +void InspectorFrontend::updateConsoleMessageExpiredCount(unsigned count) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("updateConsoleMessageExpiredCount"); + function.appendArgument(count); + function.call(); +} + +void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector& frames, ScriptState* scriptState, const Vector arguments, const String& message) { - OwnPtr function(newFunctionCall("addConsoleMessage")); - function->appendArgument(messageObj); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addConsoleMessage"); + function.appendArgument(messageObj); if (!frames.isEmpty()) { for (unsigned i = 0; i < frames.size(); ++i) - function->appendArgument(frames[i]); - } else if (!wrappedArguments.isEmpty()) { - for (unsigned i = 0; i < wrappedArguments.size(); ++i) - function->appendArgument(m_inspectorController->wrapObject(wrappedArguments[i], "console")); - } else - function->appendArgument(message); - function->call(); + function.appendArgument(frames[i]); + } else if (!arguments.isEmpty()) { + InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState); + for (unsigned i = 0; i < arguments.size(); ++i) { + RefPtr serializedValue = injectedScript.wrapForConsole(arguments[i]); + ScriptValue scriptValue = ScriptValue::deserialize(this->scriptState(), serializedValue.get()); + if (scriptValue.hasNoValue()) { + ASSERT_NOT_REACHED(); + return; + } + function.appendArgument(scriptValue); + } + } else { + function.appendArgument(message); + } + function.call(); } -void InspectorFrontend::updateConsoleMessageRepeatCount(const int count) +void InspectorFrontend::updateConsoleMessageRepeatCount(unsigned count) { - OwnPtr function(newFunctionCall("updateConsoleMessageRepeatCount")); - function->appendArgument(count); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("updateConsoleMessageRepeatCount"); + function.appendArgument(count); + function.call(); } void InspectorFrontend::clearConsoleMessages() @@ -105,52 +134,48 @@ void InspectorFrontend::clearConsoleMessages() callSimpleFunction("clearConsoleMessages"); } -bool InspectorFrontend::addResource(long long identifier, const ScriptObject& resourceObj) +bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj) { - OwnPtr function(newFunctionCall("addResource")); - function->appendArgument(identifier); - function->appendArgument(resourceObj); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("updateResource"); + function.appendArgument(identifier); + function.appendArgument(resourceObj); bool hadException = false; - function->call(hadException); + function.call(hadException); return !hadException; } -bool InspectorFrontend::updateResource(long long identifier, const ScriptObject& resourceObj) +void InspectorFrontend::removeResource(unsigned long identifier) { - OwnPtr function(newFunctionCall("updateResource")); - function->appendArgument(identifier); - function->appendArgument(resourceObj); - bool hadException = false; - function->call(hadException); - return !hadException; -} - -void InspectorFrontend::removeResource(long long identifier) -{ - OwnPtr function(newFunctionCall("removeResource")); - function->appendArgument(identifier); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("removeResource"); + function.appendArgument(identifier); + function.call(); } -void InspectorFrontend::addCookieDomain(String domain) +void InspectorFrontend::didGetResourceContent(int callId, const String& content) { - OwnPtr function(newFunctionCall("addCookieDomain")); - function->appendArgument(domain); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetResourceContent"); + function.appendArgument(callId); + function.appendArgument(content); + function.call(); } -void InspectorFrontend::updateFocusedNode(long long nodeId) +void InspectorFrontend::updateFocusedNode(long nodeId) { - OwnPtr function(newFunctionCall("updateFocusedNode")); - function->appendArgument(nodeId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("updateFocusedNode"); + function.appendArgument(nodeId); + function.call(); } void InspectorFrontend::setAttachedWindow(bool attached) { - OwnPtr function(newFunctionCall("setAttachedWindow")); - function->appendArgument(attached); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("setAttachedWindow"); + function.appendArgument(attached); + function.call(); } void InspectorFrontend::showPanel(int panel) @@ -158,20 +183,23 @@ void InspectorFrontend::showPanel(int panel) const char* showFunctionName; switch (panel) { case InspectorController::ConsolePanel: - showFunctionName = "showConsole"; + showFunctionName = "showConsolePanel"; break; case InspectorController::ElementsPanel: showFunctionName = "showElementsPanel"; break; - case InspectorController::ProfilesPanel: - showFunctionName = "showProfilesPanel"; - break; case InspectorController::ResourcesPanel: showFunctionName = "showResourcesPanel"; break; case InspectorController::ScriptsPanel: showFunctionName = "showScriptsPanel"; break; + case InspectorController::TimelinePanel: + showFunctionName = "showTimelinePanel"; + break; + case InspectorController::ProfilesPanel: + showFunctionName = "showProfilesPanel"; + break; case InspectorController::StoragePanel: showFunctionName = "showStoragePanel"; break; @@ -216,12 +244,13 @@ void InspectorFrontend::timelineProfilerWasStopped() void InspectorFrontend::addRecordToTimeline(const ScriptObject& record) { - OwnPtr function(newFunctionCall("addRecordToTimeline")); - function->appendArgument(record); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addRecordToTimeline"); + function.appendArgument(record); + function.call(); } -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void InspectorFrontend::attachDebuggerWhenShown() { callSimpleFunction("attachDebuggerWhenShown"); @@ -237,284 +266,329 @@ void InspectorFrontend::debuggerWasDisabled() callSimpleFunction("debuggerWasDisabled"); } -void InspectorFrontend::profilerWasEnabled() +void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source) { - callSimpleFunction("profilerWasEnabled"); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("parsedScriptSource"); + function.appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID()))); + function.appendArgument(source.provider()->url()); + function.appendArgument(JSC::UString(source.data(), source.length())); + function.appendArgument(source.firstLine()); + function.call(); } -void InspectorFrontend::profilerWasDisabled() +void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage) { - callSimpleFunction("profilerWasDisabled"); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("failedToParseScriptSource"); + function.appendArgument(source.provider()->url()); + function.appendArgument(JSC::UString(source.data(), source.length())); + function.appendArgument(source.firstLine()); + function.appendArgument(errorLine); + function.appendArgument(errorMessage); + function.call(); } -void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source) +void InspectorFrontend::pausedScript(SerializedScriptValue* callFrames) { - OwnPtr function(newFunctionCall("parsedScriptSource")); - function->appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID()))); - function->appendArgument(source.provider()->url()); - function->appendArgument(JSC::UString(source.data(), source.length())); - function->appendArgument(source.firstLine()); - function->call(); + ScriptValue callFramesValue = ScriptValue::deserialize(scriptState(), callFrames); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("pausedScript"); + function.appendArgument(callFramesValue); + function.call(); } -void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage) +void InspectorFrontend::resumedScript() { - OwnPtr function(newFunctionCall("failedToParseScriptSource")); - function->appendArgument(source.provider()->url()); - function->appendArgument(JSC::UString(source.data(), source.length())); - function->appendArgument(source.firstLine()); - function->appendArgument(errorLine); - function->appendArgument(errorMessage); - function->call(); + callSimpleFunction("resumedScript"); } +#endif -void InspectorFrontend::addProfileHeader(const ScriptValue& profile) +#if ENABLE(JAVASCRIPT_DEBUGGER) +void InspectorFrontend::profilerWasEnabled() { - OwnPtr function(newFunctionCall("addProfileHeader")); - function->appendArgument(profile); - function->call(); + callSimpleFunction("profilerWasEnabled"); } -void InspectorFrontend::setRecordingProfile(bool isProfiling) +void InspectorFrontend::profilerWasDisabled() { - OwnPtr function(newFunctionCall("setRecordingProfile")); - function->appendArgument(isProfiling); - function->call(); + callSimpleFunction("profilerWasDisabled"); } -void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers) +void InspectorFrontend::addProfileHeader(const ScriptValue& profile) { - OwnPtr function(newFunctionCall("didGetProfileHeaders")); - function->appendArgument(callId); - function->appendArgument(headers); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addProfileHeader"); + function.appendArgument(profile); + function.call(); } -void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile) +void InspectorFrontend::setRecordingProfile(bool isProfiling) { - OwnPtr function(newFunctionCall("didGetProfile")); - function->appendArgument(callId); - function->appendArgument(profile); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("setRecordingProfile"); + function.appendArgument(isProfiling); + function.call(); } -void InspectorFrontend::pausedScript(const ScriptValue& callFrames) +void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers) { - OwnPtr function(newFunctionCall("pausedScript")); - function->appendArgument(callFrames); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetProfileHeaders"); + function.appendArgument(callId); + function.appendArgument(headers); + function.call(); } -void InspectorFrontend::resumedScript() +void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile) { - callSimpleFunction("resumedScript"); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetProfile"); + function.appendArgument(callId); + function.appendArgument(profile); + function.call(); } #endif void InspectorFrontend::setDocument(const ScriptObject& root) { - OwnPtr function(newFunctionCall("setDocument")); - function->appendArgument(root); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("setDocument"); + function.appendArgument(root); + function.call(); } void InspectorFrontend::setDetachedRoot(const ScriptObject& root) { - OwnPtr function(newFunctionCall("setDetachedRoot")); - function->appendArgument(root); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("setDetachedRoot"); + function.appendArgument(root); + function.call(); } void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes) { - OwnPtr function(newFunctionCall("setChildNodes")); - function->appendArgument(parentId); - function->appendArgument(nodes); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("setChildNodes"); + function.appendArgument(parentId); + function.appendArgument(nodes); + function.call(); } void InspectorFrontend::childNodeCountUpdated(int id, int newValue) { - OwnPtr function(newFunctionCall("childNodeCountUpdated")); - function->appendArgument(id); - function->appendArgument(newValue); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("childNodeCountUpdated"); + function.appendArgument(id); + function.appendArgument(newValue); + function.call(); } void InspectorFrontend::childNodeInserted(int parentId, int prevId, const ScriptObject& node) { - OwnPtr function(newFunctionCall("childNodeInserted")); - function->appendArgument(parentId); - function->appendArgument(prevId); - function->appendArgument(node); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("childNodeInserted"); + function.appendArgument(parentId); + function.appendArgument(prevId); + function.appendArgument(node); + function.call(); } void InspectorFrontend::childNodeRemoved(int parentId, int id) { - OwnPtr function(newFunctionCall("childNodeRemoved")); - function->appendArgument(parentId); - function->appendArgument(id); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("childNodeRemoved"); + function.appendArgument(parentId); + function.appendArgument(id); + function.call(); } void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes) { - OwnPtr function(newFunctionCall("attributesUpdated")); - function->appendArgument(id); - function->appendArgument(attributes); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("attributesUpdated"); + function.appendArgument(id); + function.appendArgument(attributes); + function.call(); } void InspectorFrontend::didRemoveNode(int callId, int nodeId) { - OwnPtr function(newFunctionCall("didRemoveNode")); - function->appendArgument(callId); - function->appendArgument(nodeId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didRemoveNode"); + function.appendArgument(callId); + function.appendArgument(nodeId); + function.call(); } void InspectorFrontend::didGetChildNodes(int callId) { - OwnPtr function(newFunctionCall("didGetChildNodes")); - function->appendArgument(callId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetChildNodes"); + function.appendArgument(callId); + function.call(); } void InspectorFrontend::didApplyDomChange(int callId, bool success) { - OwnPtr function(newFunctionCall("didApplyDomChange")); - function->appendArgument(callId); - function->appendArgument(success); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didApplyDomChange"); + function.appendArgument(callId); + function.appendArgument(success); + function.call(); } void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray) { - OwnPtr function(newFunctionCall("didGetEventListenersForNode")); - function->appendArgument(callId); - function->appendArgument(nodeId); - function->appendArgument(listenersArray); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetEventListenersForNode"); + function.appendArgument(callId); + function.appendArgument(nodeId); + function.appendArgument(listenersArray); + function.call(); } void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString) { - OwnPtr function(newFunctionCall("didGetCookies")); - function->appendArgument(callId); - function->appendArgument(cookies); - function->appendArgument(cookiesString); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetCookies"); + function.appendArgument(callId); + function.appendArgument(cookies); + function.appendArgument(cookiesString); + function.call(); } -void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& result, bool isException) +void InspectorFrontend::didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException) { - OwnPtr function(newFunctionCall("didDispatchOnInjectedScript")); - function->appendArgument(callId); - function->appendArgument(result); - function->appendArgument(isException); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didDispatchOnInjectedScript"); + function.appendArgument(callId); + if (isException) + function.appendArgument(""); + else { + ScriptValue resultValue = ScriptValue::deserialize(scriptState(), result); + function.appendArgument(resultValue); + } + function.appendArgument(isException); + function.call(); } #if ENABLE(DATABASE) bool InspectorFrontend::addDatabase(const ScriptObject& dbObject) { - OwnPtr function(newFunctionCall("addDatabase")); - function->appendArgument(dbObject); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addDatabase"); + function.appendArgument(dbObject); bool hadException = false; - function->call(hadException); + function.call(hadException); return !hadException; } void InspectorFrontend::selectDatabase(int databaseId) { - OwnPtr function(newFunctionCall("selectDatabase")); - function->appendArgument(databaseId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("selectDatabase"); + function.appendArgument(databaseId); + function.call(); } void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray& tableNames) { - OwnPtr function(newFunctionCall("didGetDatabaseTableNames")); - function->appendArgument(callId); - function->appendArgument(tableNames); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetDatabaseTableNames"); + function.appendArgument(callId); + function.appendArgument(tableNames); + function.call(); } #endif #if ENABLE(DOM_STORAGE) bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj) { - OwnPtr function(newFunctionCall("addDOMStorage")); - function->appendArgument(domStorageObj); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addDOMStorage"); + function.appendArgument(domStorageObj); bool hadException = false; - function->call(hadException); + function.call(hadException); return !hadException; } void InspectorFrontend::selectDOMStorage(int storageId) { - OwnPtr function(newFunctionCall("selectDOMStorage")); - function->appendArgument(storageId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("selectDOMStorage"); + function.appendArgument(storageId); + function.call(); } void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries) { - OwnPtr function(newFunctionCall("didGetDOMStorageEntries")); - function->appendArgument(callId); - function->appendArgument(entries); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didGetDOMStorageEntries"); + function.appendArgument(callId); + function.appendArgument(entries); + function.call(); } void InspectorFrontend::didSetDOMStorageItem(int callId, bool success) { - OwnPtr function(newFunctionCall("didSetDOMStorageItem")); - function->appendArgument(callId); - function->appendArgument(success); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didSetDOMStorageItem"); + function.appendArgument(callId); + function.appendArgument(success); + function.call(); } void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success) { - OwnPtr function(newFunctionCall("didRemoveDOMStorageItem")); - function->appendArgument(callId); - function->appendArgument(success); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didRemoveDOMStorageItem"); + function.appendArgument(callId); + function.appendArgument(success); + function.call(); } void InspectorFrontend::updateDOMStorage(int storageId) { - OwnPtr function(newFunctionCall("updateDOMStorage")); - function->appendArgument(storageId); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("updateDOMStorage"); + function.appendArgument(storageId); + function.call(); } #endif void InspectorFrontend::addNodesToSearchResult(const String& nodeIds) { - OwnPtr function(newFunctionCall("addNodesToSearchResult")); - function->appendArgument(nodeIds); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("addNodesToSearchResult"); + function.appendArgument(nodeIds); + function.call(); } -void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script) +void InspectorFrontend::contextMenuItemSelected(int itemId) { - OwnPtr function(newFunctionCall("evaluateForTestInFrontend")); - function->appendArgument(callId); - function->appendArgument(script); - function->call(); + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("contextMenuItemSelected"); + function.appendArgument(itemId); + function.call(); } -PassOwnPtr InspectorFrontend::newFunctionCall(const String& functionName) +void InspectorFrontend::contextMenuCleared() { - ScriptFunctionCall* function = new ScriptFunctionCall(m_scriptState, m_webInspector, "dispatch"); - function->appendArgument(functionName); - return function; + callSimpleFunction("contextMenuCleared"); +} + +void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("evaluateForTestInFrontend"); + function.appendArgument(callId); + function.appendArgument(script); + function.call(); } void InspectorFrontend::callSimpleFunction(const String& functionName) { - ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); + ScriptFunctionCall function(m_webInspector, "dispatch"); function.appendArgument(functionName); function.call(); } diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h index 3cb9b8c..1a37256 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontend.h @@ -35,7 +35,7 @@ #include "ScriptState.h" #include -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) namespace JSC { class JSValue; class SourceCode; @@ -50,30 +50,32 @@ namespace WebCore { class InspectorController; class InspectorResource; class Node; - class ScriptFunctionCall; class ScriptString; + class SerializedScriptValue; class Storage; - class InspectorFrontend { + class InspectorFrontend : public Noncopyable { public: - InspectorFrontend(InspectorController* inspectorController, ScriptState*, ScriptObject webInspector); + InspectorFrontend(InspectorController* inspectorController, ScriptObject webInspector); ~InspectorFrontend(); ScriptArray newScriptArray(); ScriptObject newScriptObject(); void didCommitLoad(); - void addConsoleMessage(const ScriptObject& messageObj, const Vector& frames, const Vector wrappedArguments, const String& message); - void updateConsoleMessageRepeatCount(const int count); - void clearConsoleMessages(); - bool addResource(long long identifier, const ScriptObject& resourceObj); - bool updateResource(long long identifier, const ScriptObject& resourceObj); - void removeResource(long long identifier); + void populateFrontendSettings(const String& settings); + + void updateConsoleMessageExpiredCount(unsigned count); + void addConsoleMessage(const ScriptObject& messageObj, const Vector& frames, ScriptState*, const Vector arguments, const String& message); + void updateConsoleMessageRepeatCount(unsigned count); + void clearConsoleMessages(); - void addCookieDomain(String); + bool updateResource(unsigned long identifier, const ScriptObject& resourceObj); + void removeResource(unsigned long identifier); + void didGetResourceContent(int callId, const String& content); - void updateFocusedNode(long long nodeId); + void updateFocusedNode(long nodeId); void setAttachedWindow(bool attached); void showPanel(int panel); void populateInterface(); @@ -82,20 +84,22 @@ namespace WebCore { void resourceTrackingWasEnabled(); void resourceTrackingWasDisabled(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void attachDebuggerWhenShown(); void debuggerWasEnabled(); void debuggerWasDisabled(); - void profilerWasEnabled(); - void profilerWasDisabled(); void parsedScriptSource(const JSC::SourceCode&); void failedToParseScriptSource(const JSC::SourceCode&, int errorLine, const JSC::UString& errorMessage); + void pausedScript(SerializedScriptValue* callFrames); + void resumedScript(); +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) + void profilerWasEnabled(); + void profilerWasDisabled(); void addProfileHeader(const ScriptValue& profile); void setRecordingProfile(bool isProfiling); void didGetProfileHeaders(int callId, const ScriptArray& headers); void didGetProfile(int callId, const ScriptValue& profile); - void pausedScript(const ScriptValue& callFrames); - void resumedScript(); #endif #if ENABLE(DATABASE) @@ -130,18 +134,19 @@ namespace WebCore { void addRecordToTimeline(const ScriptObject&); void didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString); - void didDispatchOnInjectedScript(int callId, const String& result, bool isException); + void didDispatchOnInjectedScript(int callId, SerializedScriptValue* result, bool isException); void addNodesToSearchResult(const String& nodeIds); - ScriptState* scriptState() const { return m_scriptState; } + void contextMenuItemSelected(int itemId); + void contextMenuCleared(); + + ScriptState* scriptState() const { return m_webInspector.scriptState(); } void evaluateForTestInFrontend(int callId, const String& script); private: - PassOwnPtr newFunctionCall(const String& functionName); void callSimpleFunction(const String& functionName); InspectorController* m_inspectorController; - ScriptState* m_scriptState; ScriptObject m_webInspector; }; diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp new file mode 100644 index 0000000..1aeb1d7 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Matt Lilek + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InspectorFrontendHost.h" + +#if ENABLE(INSPECTOR) + +#include "ContextMenu.h" +#include "ContextMenuItem.h" +#include "ContextMenuController.h" +#include "ContextMenuProvider.h" +#include "Element.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "HitTestResult.h" +#include "HTMLFrameOwnerElement.h" +#include "InspectorClient.h" +#include "InspectorFrontend.h" +#include "InspectorResource.h" +#include "Page.h" +#include "Pasteboard.h" + +#include +#include + +using namespace std; + +namespace WebCore { + +InspectorFrontendHost::InspectorFrontendHost(InspectorController* inspectorController, InspectorClient* client) + : m_inspectorController(inspectorController) + , m_client(client) +{ +} + +InspectorFrontendHost::~InspectorFrontendHost() +{ + if (m_menuProvider) + m_menuProvider->disconnect(); +} + +void InspectorFrontendHost::loaded() +{ + if (m_inspectorController) + m_inspectorController->scriptObjectReady(); +} + +void InspectorFrontendHost::attach() +{ + if (m_inspectorController) + m_inspectorController->attachWindow(); +} + +void InspectorFrontendHost::detach() +{ + if (m_inspectorController) + m_inspectorController->detachWindow(); +} + +void InspectorFrontendHost::closeWindow() +{ + if (m_inspectorController) + m_inspectorController->closeWindow(); +} + +void InspectorFrontendHost::windowUnloading() +{ + if (m_inspectorController) + m_inspectorController->close(); +} + +void InspectorFrontendHost::setAttachedWindowHeight(unsigned height) +{ + if (m_inspectorController) + m_inspectorController->setAttachedWindowHeight(height); +} + +void InspectorFrontendHost::moveWindowBy(float x, float y) const +{ + if (m_inspectorController) + m_inspectorController->moveWindowBy(x, y); +} + +String InspectorFrontendHost::localizedStringsURL() +{ + return m_client->localizedStringsURL(); +} + +String InspectorFrontendHost::hiddenPanels() +{ + return m_client->hiddenPanels(); +} + +const String& InspectorFrontendHost::platform() const +{ +#if PLATFORM(MAC) + DEFINE_STATIC_LOCAL(const String, platform, ("mac")); +#elif OS(WINDOWS) + DEFINE_STATIC_LOCAL(const String, platform, ("windows")); +#elif OS(LINUX) + DEFINE_STATIC_LOCAL(const String, platform, ("linux")); +#else + DEFINE_STATIC_LOCAL(const String, platform, ("unknown")); +#endif + return platform; +} + +const String& InspectorFrontendHost::port() const +{ +#if PLATFORM(QT) + DEFINE_STATIC_LOCAL(const String, port, ("qt")); +#elif PLATFORM(GTK) + DEFINE_STATIC_LOCAL(const String, port, ("gtk")); +#elif PLATFORM(WX) + DEFINE_STATIC_LOCAL(const String, port, ("wx")); +#else + DEFINE_STATIC_LOCAL(const String, port, ("unknown")); +#endif + + return port; +} + +void InspectorFrontendHost::copyText(const String& text) +{ + Pasteboard::generalPasteboard()->writePlainText(text); +} + +void InspectorFrontendHost::showContextMenu(Event* event, const Vector& items) +{ + if (!m_inspectorController) + return; + if (!m_inspectorController->windowVisible()) + return; + + + m_menuProvider = MenuProvider::create(this, items); + ContextMenuController* menuController = m_inspectorController->m_page->contextMenuController(); + menuController->showContextMenu(event, m_menuProvider); +} + +void InspectorFrontendHost::contextMenuItemSelected(ContextMenuItem* item) +{ + if (m_inspectorController && m_inspectorController->windowVisible()) { + int itemNumber = item->action() - ContextMenuItemBaseCustomTag; + m_inspectorController->m_frontend->contextMenuItemSelected(itemNumber); + } +} + +void InspectorFrontendHost::contextMenuCleared() +{ + m_menuProvider = 0; + if (m_inspectorController && m_inspectorController->windowVisible()) + m_inspectorController->m_frontend->contextMenuCleared(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h new file mode 100644 index 0000000..390b018 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.h @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InspectorFrontendHost_h +#define InspectorFrontendHost_h + +#include "Console.h" +#include "ContextMenu.h" +#include "ContextMenuProvider.h" +#include "InspectorController.h" +#include "PlatformString.h" + +#include +#include + +namespace WebCore { + +class ContextMenuItem; +class Event; +class InspectorClient; +class Node; + +class InspectorFrontendHost : public RefCounted +{ +public: + static PassRefPtr create(InspectorController* inspectorController, InspectorClient* client) + { + return adoptRef(new InspectorFrontendHost(inspectorController, client)); + } + + ~InspectorFrontendHost(); + + InspectorController* inspectorController() { return m_inspectorController; } + + void disconnectController() { m_inspectorController = 0; } + + void loaded(); + void attach(); + void detach(); + void closeWindow(); + void windowUnloading(); + + void setAttachedWindowHeight(unsigned height); + void moveWindowBy(float x, float y) const; + + String localizedStringsURL(); + String hiddenPanels(); + const String& platform() const; + const String& port() const; + + void copyText(const String& text); + + // Called from [Custom] implementations. + void showContextMenu(Event*, const Vector& items); + +private: + class MenuProvider : public ContextMenuProvider { + public: + static PassRefPtr create(InspectorFrontendHost* frontendHost, const Vector& items) + { + return adoptRef(new MenuProvider(frontendHost, items)); + } + + virtual ~MenuProvider() + { + contextMenuCleared(); + } + + void disconnect() + { + m_frontendHost = 0; + } + + virtual void populateContextMenu(ContextMenu* menu) + { + for (size_t i = 0; i < m_items.size(); ++i) + menu->appendItem(*m_items[i]); + } + + virtual void contextMenuItemSelected(ContextMenuItem* item) + { + if (m_frontendHost) + m_frontendHost->contextMenuItemSelected(item); + } + + virtual void contextMenuCleared() + { + if (m_frontendHost) + m_frontendHost->contextMenuCleared(); + deleteAllValues(m_items); + m_items.clear(); + } + + private: + MenuProvider(InspectorFrontendHost* frontendHost, const Vector& items) + : m_frontendHost(frontendHost) + , m_items(items) { } + InspectorFrontendHost* m_frontendHost; + Vector m_items; + }; + + InspectorFrontendHost(InspectorController* inspectorController, InspectorClient* client); + + void contextMenuItemSelected(ContextMenuItem*); + void contextMenuCleared(); + + InspectorController* m_inspectorController; + InspectorClient* m_client; + RefPtr m_menuProvider; +}; + +} // namespace WebCore + +#endif // !defined(InspectorFrontendHost_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl new file mode 100644 index 0000000..9de49c1 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorFrontendHost.idl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Matt Lilek + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module core { + interface [Conditional=INSPECTOR] InspectorFrontendHost { + void loaded(); + void attach(); + void detach(); + void closeWindow(); + void windowUnloading(); + + void setAttachedWindowHeight(in unsigned long height); + void moveWindowBy(in float x, in float y); + + DOMString localizedStringsURL(); + DOMString hiddenPanels(); + DOMString platform(); + DOMString port(); + + void copyText(in DOMString text); + + [Custom] void showContextMenu(in MouseEvent event, in DOMObject items); + }; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp index b8bb22b..6f08d58 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.cpp @@ -46,11 +46,11 @@ namespace WebCore { -InspectorResource::InspectorResource(long long identifier, DocumentLoader* loader) +InspectorResource::InspectorResource(unsigned long identifier, DocumentLoader* loader, const KURL& requestURL) : m_identifier(identifier) , m_loader(loader) , m_frame(loader->frame()) - , m_scriptObjectCreated(false) + , m_requestURL(requestURL) , m_expectedContentLength(0) , m_cached(false) , m_finished(false) @@ -70,13 +70,27 @@ InspectorResource::~InspectorResource() { } -PassRefPtr InspectorResource::createCached(long long identifier, DocumentLoader* loader, const CachedResource* cachedResource) +PassRefPtr InspectorResource::appendRedirect(unsigned long identifier, const KURL& redirectURL) { - PassRefPtr resource = create(identifier, loader); + // Last redirect is always a container of all previous ones. Pass this container here. + RefPtr redirect = InspectorResource::create(m_identifier, m_loader.get(), redirectURL); + redirect->m_redirects = m_redirects; + redirect->m_redirects.append(this); + redirect->m_changes.set(RedirectsChange); + + m_identifier = identifier; + // Re-send request info with new id. + m_changes.set(RequestChange); + m_redirects.clear(); + return redirect; +} + +PassRefPtr InspectorResource::createCached(unsigned long identifier, DocumentLoader* loader, const CachedResource* cachedResource) +{ + PassRefPtr resource = create(identifier, loader, KURL(ParsedURLString, cachedResource->url())); resource->m_finished = true; - resource->m_requestURL = KURL(ParsedURLString, cachedResource->url()); resource->updateResponse(cachedResource->response()); resource->m_length = cachedResource->encodedSize(); @@ -93,7 +107,6 @@ PassRefPtr InspectorResource::createCached(long long identifi void InspectorResource::updateRequest(const ResourceRequest& request) { m_requestHeaderFields = request.httpHeaderFields(); - m_requestURL = request.url(); m_requestMethod = request.httpMethod(); if (request.httpBody() && !request.httpBody()->isEmpty()) m_requestFormData = request.httpBody()->flattenToString(); @@ -105,6 +118,11 @@ void InspectorResource::updateResponse(const ResourceResponse& response) { m_expectedContentLength = response.expectedContentLength(); m_mimeType = response.mimeType(); + if (m_mimeType.isEmpty() && response.httpStatusCode() == 304) { + CachedResource* cachedResource = cache()->resourceForURL(response.url().string()); + if (cachedResource) + m_mimeType = cachedResource->response().mimeType(); + } m_responseHeaderFields = response.httpHeaderFields(); m_responseStatusCode = response.httpStatusCode(); m_suggestedFilename = response.suggestedFilename(); @@ -121,42 +139,17 @@ static void populateHeadersObject(ScriptObject* object, const HTTPHeaderMap& hea } } -void InspectorResource::createScriptObject(InspectorFrontend* frontend) -{ - if (!m_scriptObjectCreated) { - ScriptObject jsonObject = frontend->newScriptObject(); - ScriptObject requestHeaders = frontend->newScriptObject(); - populateHeadersObject(&requestHeaders, m_requestHeaderFields); - jsonObject.set("requestHeaders", requestHeaders); - jsonObject.set("requestURL", requestURL()); - jsonObject.set("host", m_requestURL.host()); - jsonObject.set("path", m_requestURL.path()); - jsonObject.set("lastPathComponent", m_requestURL.lastPathComponent()); - jsonObject.set("isMainResource", m_isMainResource); - jsonObject.set("cached", m_cached); - jsonObject.set("requestMethod", m_requestMethod); - jsonObject.set("requestFormData", m_requestFormData); - if (!frontend->addResource(m_identifier, jsonObject)) - return; - - m_scriptObjectCreated = true; - m_changes.clear(RequestChange); - } - updateScriptObject(frontend); -} void InspectorResource::updateScriptObject(InspectorFrontend* frontend) { - if (!m_scriptObjectCreated) - return; - if (m_changes.hasChange(NoChange)) return; ScriptObject jsonObject = frontend->newScriptObject(); if (m_changes.hasChange(RequestChange)) { - jsonObject.set("url", requestURL()); - jsonObject.set("domain", m_requestURL.host()); + jsonObject.set("url", m_requestURL.string()); + jsonObject.set("documentURL", m_frame->document()->url().string()); + jsonObject.set("host", m_requestURL.host()); jsonObject.set("path", m_requestURL.path()); jsonObject.set("lastPathComponent", m_requestURL.lastPathComponent()); ScriptObject requestHeaders = frontend->newScriptObject(); @@ -166,6 +159,7 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend) jsonObject.set("requestMethod", m_requestMethod); jsonObject.set("requestFormData", m_requestFormData); jsonObject.set("didRequestChange", true); + jsonObject.set("cached", m_cached); } if (m_changes.hasChange(ResponseChange)) { @@ -184,7 +178,7 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend) jsonObject.set("type", static_cast(type())); jsonObject.set("didTypeChange", true); } - + if (m_changes.hasChange(LengthChange)) { jsonObject.set("contentLength", m_length); jsonObject.set("didLengthChange", true); @@ -209,19 +203,23 @@ void InspectorResource::updateScriptObject(InspectorFrontend* frontend) jsonObject.set("domContentEventTime", m_domContentEventTime); jsonObject.set("didTimingChange", true); } - if (!frontend->updateResource(m_identifier, jsonObject)) - return; - m_changes.clearAll(); + + if (m_changes.hasChange(RedirectsChange)) { + for (size_t i = 0; i < m_redirects.size(); ++i) + m_redirects[i]->updateScriptObject(frontend); + } + + if (frontend->updateResource(m_identifier, jsonObject)) + m_changes.clearAll(); } void InspectorResource::releaseScriptObject(InspectorFrontend* frontend, bool callRemoveResource) { - if (!m_scriptObjectCreated) - return; - - m_scriptObjectCreated = false; m_changes.setAll(); + for (size_t i = 0; i < m_redirects.size(); ++i) + m_redirects[i]->releaseScriptObject(frontend, callRemoveResource); + if (!callRemoveResource) return; @@ -233,25 +231,17 @@ CachedResource* InspectorResource::cachedResource() const // Try hard to find a corresponding CachedResource. During preloading, DocLoader may not have the resource in document resources set yet, // but Inspector will already try to fetch data that is only available via CachedResource (and it won't update once the resource is added, // because m_changes will not have the appropriate bits set). - const String& url = requestURL(); + const String& url = m_requestURL.string(); CachedResource* cachedResource = m_frame->document()->docLoader()->cachedResource(url); if (!cachedResource) cachedResource = cache()->resourceForURL(url); return cachedResource; } -InspectorResource::Type InspectorResource::type() const +InspectorResource::Type InspectorResource::cachedResourceType() const { - if (!m_xmlHttpResponseText.isNull()) - return XHR; - - if (m_requestURL == m_loader->requestURL()) - return Doc; - - if (m_loader->frameLoader() && m_requestURL == m_loader->frameLoader()->iconURL()) - return Image; - CachedResource* cachedResource = this->cachedResource(); + if (!cachedResource) return Other; @@ -272,6 +262,25 @@ InspectorResource::Type InspectorResource::type() const } } +InspectorResource::Type InspectorResource::type() const +{ + if (!m_xmlHttpResponseText.isNull()) + return XHR; + + if (m_requestURL == m_loader->requestURL()) { + InspectorResource::Type resourceType = cachedResourceType(); + if (resourceType == Other) + return Doc; + + return resourceType; + } + + if (m_loader->frameLoader() && m_requestURL == m_loader->frameLoader()->iconURL()) + return Image; + + return cachedResourceType(); +} + void InspectorResource::setXMLHttpResponseText(const ScriptString& data) { m_xmlHttpResponseText = data; @@ -362,6 +371,12 @@ void InspectorResource::addLength(int lengthReceived) { m_length += lengthReceived; m_changes.set(LengthChange); + + // Update load time, otherwise the resource will + // have start time == end time and 0 load duration + // until its loading is completed. + m_endTime = currentTime(); + m_changes.set(TimingChange); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h index 0335586..d347e5c 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorResource.h @@ -51,7 +51,7 @@ namespace WebCore { class Frame; class ResourceResponse; - struct ResourceRequest; + class ResourceRequest; class InspectorResource : public RefCounted { public: @@ -68,16 +68,16 @@ namespace WebCore { Other }; - static PassRefPtr create(long long identifier, DocumentLoader* loader) + static PassRefPtr create(unsigned long identifier, DocumentLoader* loader, const KURL& requestURL) { - return adoptRef(new InspectorResource(identifier, loader)); + return adoptRef(new InspectorResource(identifier, loader, requestURL)); } - static PassRefPtr createCached(long long identifier, DocumentLoader*, const CachedResource*); + static PassRefPtr createCached(unsigned long identifier, DocumentLoader*, const CachedResource*); ~InspectorResource(); - void createScriptObject(InspectorFrontend* frontend); + PassRefPtr appendRedirect(unsigned long identifier, const KURL& redirectURL); void updateScriptObject(InspectorFrontend* frontend); void releaseScriptObject(InspectorFrontend* frontend, bool callRemoveResource); @@ -91,8 +91,8 @@ namespace WebCore { bool isSameLoader(DocumentLoader* loader) const { return loader == m_loader; } void markMainResource() { m_isMainResource = true; } - long long identifier() const { return m_identifier; } - String requestURL() const { return m_requestURL.string(); } + unsigned long identifier() const { return m_identifier; } + KURL requestURL() const { return m_requestURL; } Frame* frame() const { return m_frame.get(); } const String& mimeType() const { return m_mimeType; } const HTTPHeaderMap& requestHeaderFields() const { return m_requestHeaderFields; } @@ -118,36 +118,41 @@ namespace WebCore { TypeChange = 4, LengthChange = 8, CompletionChange = 16, - TimingChange = 32 + TimingChange = 32, + RedirectsChange = 64 }; class Changes { public: Changes() : m_change(NoChange) {} - inline bool hasChange(ChangeType change) { return (m_change & change) || !(m_change + change); } + inline bool hasChange(ChangeType change) + { + return m_change & change || (m_change == NoChange && change == NoChange); + } inline void set(ChangeType change) { - m_change = static_cast(static_cast(m_change) | static_cast(change)); + m_change = static_cast(static_cast(m_change) | static_cast(change)); } inline void clear(ChangeType change) { m_change = static_cast(static_cast(m_change) & ~static_cast(change)); } - inline void setAll() { m_change = static_cast(63); } + inline void setAll() { m_change = static_cast(127); } inline void clearAll() { m_change = NoChange; } private: ChangeType m_change; }; - InspectorResource(long long identifier, DocumentLoader*); + InspectorResource(unsigned long identifier, DocumentLoader*, const KURL& requestURL); Type type() const; + Type cachedResourceType() const; CachedResource* cachedResource() const; - long long m_identifier; + unsigned long m_identifier; RefPtr m_loader; RefPtr m_frame; KURL m_requestURL; @@ -155,7 +160,6 @@ namespace WebCore { HTTPHeaderMap m_responseHeaderFields; String m_mimeType; String m_suggestedFilename; - bool m_scriptObjectCreated; long long m_expectedContentLength; bool m_cached; bool m_finished; @@ -172,6 +176,7 @@ namespace WebCore { bool m_isMainResource; String m_requestMethod; String m_requestFormData; + Vector > m_redirects; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp index 4f7b736..cbf6ee1 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.cpp @@ -35,6 +35,9 @@ #include "Event.h" #include "InspectorFrontend.h" +#include "IntRect.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" #include "TimelineRecordFactory.h" #include @@ -51,19 +54,20 @@ InspectorTimelineAgent::~InspectorTimelineAgent() { } -void InspectorTimelineAgent::willDispatchDOMEvent(const Event& event) +void InspectorTimelineAgent::willDispatchEvent(const Event& event) { - pushCurrentRecord(TimelineRecordFactory::createDOMDispatchRecord(m_frontend, currentTimeInMilliseconds(), event), DOMDispatchTimelineRecordType); + pushCurrentRecord(TimelineRecordFactory::createEventDispatchData(m_frontend, event), + EventDispatchTimelineRecordType); } -void InspectorTimelineAgent::didDispatchDOMEvent() +void InspectorTimelineAgent::didDispatchEvent() { - didCompleteCurrentRecord(DOMDispatchTimelineRecordType); + didCompleteCurrentRecord(EventDispatchTimelineRecordType); } void InspectorTimelineAgent::willLayout() { - pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), LayoutTimelineRecordType); + pushCurrentRecord(m_frontend->newScriptObject(), LayoutTimelineRecordType); } void InspectorTimelineAgent::didLayout() @@ -73,7 +77,7 @@ void InspectorTimelineAgent::didLayout() void InspectorTimelineAgent::willRecalculateStyle() { - pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), RecalculateStylesTimelineRecordType); + pushCurrentRecord(m_frontend->newScriptObject(), RecalculateStylesTimelineRecordType); } void InspectorTimelineAgent::didRecalculateStyle() @@ -81,9 +85,9 @@ void InspectorTimelineAgent::didRecalculateStyle() didCompleteCurrentRecord(RecalculateStylesTimelineRecordType); } -void InspectorTimelineAgent::willPaint() +void InspectorTimelineAgent::willPaint(const IntRect& rect) { - pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), PaintTimelineRecordType); + pushCurrentRecord(TimelineRecordFactory::createPaintData(m_frontend, rect), PaintTimelineRecordType); } void InspectorTimelineAgent::didPaint() @@ -91,32 +95,37 @@ void InspectorTimelineAgent::didPaint() didCompleteCurrentRecord(PaintTimelineRecordType); } -void InspectorTimelineAgent::willWriteHTML() +void InspectorTimelineAgent::willWriteHTML(unsigned int length, unsigned int startLine) { - pushCurrentRecord(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), ParseHTMLTimelineRecordType); + pushCurrentRecord(TimelineRecordFactory::createParseHTMLData(m_frontend, length, startLine), ParseHTMLTimelineRecordType); } -void InspectorTimelineAgent::didWriteHTML() +void InspectorTimelineAgent::didWriteHTML(unsigned int endLine) { - didCompleteCurrentRecord(ParseHTMLTimelineRecordType); + if (!m_recordStack.isEmpty()) { + TimelineRecordEntry entry = m_recordStack.last(); + entry.data.set("endLine", endLine); + didCompleteCurrentRecord(ParseHTMLTimelineRecordType); + } } void InspectorTimelineAgent::didInstallTimer(int timerId, int timeout, bool singleShot) { - addRecordToTimeline(TimelineRecordFactory::createTimerInstallRecord(m_frontend, currentTimeInMilliseconds(), timerId, - timeout, singleShot), TimerInstallTimelineRecordType); + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createTimerInstallData(m_frontend, timerId, timeout, singleShot)); + addRecordToTimeline(record, TimerInstallTimelineRecordType); } void InspectorTimelineAgent::didRemoveTimer(int timerId) { - addRecordToTimeline(TimelineRecordFactory::createGenericTimerRecord(m_frontend, currentTimeInMilliseconds(), timerId), - TimerRemoveTimelineRecordType); + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createGenericTimerData(m_frontend, timerId)); + addRecordToTimeline(record, TimerRemoveTimelineRecordType); } void InspectorTimelineAgent::willFireTimer(int timerId) { - pushCurrentRecord(TimelineRecordFactory::createGenericTimerRecord(m_frontend, currentTimeInMilliseconds(), timerId), - TimerFireTimelineRecordType); + pushCurrentRecord(TimelineRecordFactory::createGenericTimerData(m_frontend, timerId), TimerFireTimelineRecordType); } void InspectorTimelineAgent::didFireTimer() @@ -126,8 +135,7 @@ void InspectorTimelineAgent::didFireTimer() void InspectorTimelineAgent::willChangeXHRReadyState(const String& url, int readyState) { - pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeTimelineRecord(m_frontend, currentTimeInMilliseconds(), url, readyState), - XHRReadyStateChangeRecordType); + pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(m_frontend, url, readyState), XHRReadyStateChangeRecordType); } void InspectorTimelineAgent::didChangeXHRReadyState() @@ -137,7 +145,7 @@ void InspectorTimelineAgent::didChangeXHRReadyState() void InspectorTimelineAgent::willLoadXHR(const String& url) { - pushCurrentRecord(TimelineRecordFactory::createXHRLoadTimelineRecord(m_frontend, currentTimeInMilliseconds(), url), XHRLoadRecordType); + pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(m_frontend, url), XHRLoadRecordType); } void InspectorTimelineAgent::didLoadXHR() @@ -145,14 +153,46 @@ void InspectorTimelineAgent::didLoadXHR() didCompleteCurrentRecord(XHRLoadRecordType); } -void InspectorTimelineAgent::willEvaluateScriptTag(const String& url, int lineNumber) +void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber) { - pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(m_frontend, currentTimeInMilliseconds(), url, lineNumber), EvaluateScriptTagTimelineRecordType); + pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(m_frontend, url, lineNumber), EvaluateScriptTimelineRecordType); } -void InspectorTimelineAgent::didEvaluateScriptTag() +void InspectorTimelineAgent::didEvaluateScript() +{ + didCompleteCurrentRecord(EvaluateScriptTimelineRecordType); +} + +void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, bool isMainResource, + const ResourceRequest& request) +{ + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createResourceSendRequestData(m_frontend, identifier, isMainResource, request)); + record.set("type", ResourceSendRequestTimelineRecordType); + m_frontend->addRecordToTimeline(record); +} + +void InspectorTimelineAgent::didReceiveResourceResponse(unsigned long identifier, const ResourceResponse& response) { - didCompleteCurrentRecord(EvaluateScriptTagTimelineRecordType); + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createResourceReceiveResponseData(m_frontend, identifier, response)); + record.set("type", ResourceReceiveResponseTimelineRecordType); + m_frontend->addRecordToTimeline(record); +} + +void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail) +{ + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createResourceFinishData(m_frontend, identifier, didFail)); + record.set("type", ResourceFinishTimelineRecordType); + m_frontend->addRecordToTimeline(record); +} + +void InspectorTimelineAgent::didMarkTimeline(const String& message) +{ + ScriptObject record = TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()); + record.set("data", TimelineRecordFactory::createMarkTimelineData(m_frontend, message)); + addRecordToTimeline(record, MarkTimelineRecordType); } void InspectorTimelineAgent::reset() @@ -180,13 +220,17 @@ void InspectorTimelineAgent::addRecordToTimeline(ScriptObject record, TimelineRe void InspectorTimelineAgent::didCompleteCurrentRecord(TimelineRecordType type) { - ASSERT(!m_recordStack.isEmpty()); - TimelineRecordEntry entry = m_recordStack.last(); - m_recordStack.removeLast(); - ASSERT(entry.type == type); - entry.record.set("children", entry.children); - entry.record.set("endTime", currentTimeInMilliseconds()); - addRecordToTimeline(entry.record, type); + // An empty stack could merely mean that the timeline agent was turned on in the middle of + // an event. Don't treat as an error. + if (!m_recordStack.isEmpty()) { + TimelineRecordEntry entry = m_recordStack.last(); + m_recordStack.removeLast(); + ASSERT(entry.type == type); + entry.record.set("data", entry.data); + entry.record.set("children", entry.children); + entry.record.set("endTime", currentTimeInMilliseconds()); + addRecordToTimeline(entry.record, type); + } } double InspectorTimelineAgent::currentTimeInMilliseconds() @@ -194,9 +238,9 @@ double InspectorTimelineAgent::currentTimeInMilliseconds() return currentTime() * 1000.0; } -void InspectorTimelineAgent::pushCurrentRecord(ScriptObject record, TimelineRecordType type) +void InspectorTimelineAgent::pushCurrentRecord(ScriptObject data, TimelineRecordType type) { - m_recordStack.append(TimelineRecordEntry(record, m_frontend->newScriptArray(), type)); + m_recordStack.append(TimelineRecordEntry(TimelineRecordFactory::createGenericRecord(m_frontend, currentTimeInMilliseconds()), data, m_frontend->newScriptArray(), type)); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h index 0401977..fd86ba7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h +++ b/src/3rdparty/webkit/WebCore/inspector/InspectorTimelineAgent.h @@ -31,6 +31,8 @@ #ifndef InspectorTimelineAgent_h #define InspectorTimelineAgent_h +#if ENABLE(INSPECTOR) + #include "Document.h" #include "ScriptExecutionContext.h" #include "ScriptObject.h" @@ -40,10 +42,13 @@ namespace WebCore { class Event; class InspectorFrontend; + class IntRect; + class ResourceRequest; + class ResourceResponse; // Must be kept in sync with TimelineAgent.js enum TimelineRecordType { - DOMDispatchTimelineRecordType = 0, + EventDispatchTimelineRecordType = 0, LayoutTimelineRecordType = 1, RecalculateStylesTimelineRecordType = 2, PaintTimelineRecordType = 3, @@ -53,10 +58,14 @@ namespace WebCore { TimerFireTimelineRecordType = 7, XHRReadyStateChangeRecordType = 8, XHRLoadRecordType = 9, - EvaluateScriptTagTimelineRecordType = 10, + EvaluateScriptTimelineRecordType = 10, + MarkTimelineRecordType = 11, + ResourceSendRequestTimelineRecordType = 12, + ResourceReceiveResponseTimelineRecordType = 13, + ResourceFinishTimelineRecordType = 14, }; - class InspectorTimelineAgent { + class InspectorTimelineAgent : public Noncopyable { public: InspectorTimelineAgent(InspectorFrontend* frontend); ~InspectorTimelineAgent(); @@ -65,8 +74,8 @@ namespace WebCore { void resetFrontendProxyObject(InspectorFrontend*); // Methods called from WebCore. - void willDispatchDOMEvent(const Event&); - void didDispatchDOMEvent(); + void willDispatchEvent(const Event&); + void didDispatchEvent(); void willLayout(); void didLayout(); @@ -74,11 +83,11 @@ namespace WebCore { void willRecalculateStyle(); void didRecalculateStyle(); - void willPaint(); + void willPaint(const IntRect&); void didPaint(); - void willWriteHTML(); - void didWriteHTML(); + void willWriteHTML(unsigned int length, unsigned int startLine); + void didWriteHTML(unsigned int endLine); void didInstallTimer(int timerId, int timeout, bool singleShot); void didRemoveTimer(int timerId); @@ -90,14 +99,21 @@ namespace WebCore { void willLoadXHR(const String&); void didLoadXHR(); - void willEvaluateScriptTag(const String&, int); - void didEvaluateScriptTag(); + void willEvaluateScript(const String&, int); + void didEvaluateScript(); + + void didMarkTimeline(const String&); + + void willSendResourceRequest(unsigned long, bool isMainResource, const ResourceRequest&); + void didReceiveResourceResponse(unsigned long, const ResourceResponse&); + void didFinishLoadingResource(unsigned long, bool didFail); static InspectorTimelineAgent* retrieve(ScriptExecutionContext*); private: struct TimelineRecordEntry { - TimelineRecordEntry(ScriptObject record, ScriptArray children, TimelineRecordType type) : record(record), children(children), type(type) { } + TimelineRecordEntry(ScriptObject record, ScriptObject data, ScriptArray children, TimelineRecordType type) : record(record), data(data), children(children), type(type) { } ScriptObject record; + ScriptObject data; ScriptArray children; TimelineRecordType type; }; @@ -107,7 +123,7 @@ namespace WebCore { static double currentTimeInMilliseconds(); void didCompleteCurrentRecord(TimelineRecordType); - + void addRecordToTimeline(ScriptObject, TimelineRecordType); InspectorFrontend* m_frontend; @@ -117,11 +133,12 @@ namespace WebCore { inline InspectorTimelineAgent* InspectorTimelineAgent::retrieve(ScriptExecutionContext* context) { - if (context->isDocument()) + if (context && context->isDocument()) return static_cast(context)->inspectorTimelineAgent(); return 0; } } // namespace WebCore +#endif // !ENABLE(INSPECTOR) #endif // !defined(InspectorTimelineAgent_h) diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp index 1559d82..e6f75b8 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.cpp @@ -27,7 +27,7 @@ #include "JavaScriptCallFrame.h" #include "JSDOMBinding.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "PlatformString.h" #include @@ -106,7 +106,7 @@ JSValue JavaScriptCallFrame::evaluate(const UString& script, JSValue& exception) return jsNull(); JSLock lock(SilenceAssertionsOnly); - return DebuggerCallFrame_evaluateInWorld(m_debuggerCallFrame, script, exception); + return m_debuggerCallFrame.evaluate(script, exception); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h index 47cdac2..bf61c4b 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.h @@ -26,7 +26,7 @@ #ifndef JavaScriptCallFrame_h #define JavaScriptCallFrame_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include #include diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.idl b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.idl index 2f247f0..639ecc9 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.idl +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptCallFrame.idl @@ -25,7 +25,7 @@ module inspector { - interface [Conditional=JAVASCRIPT_DEBUGGER] JavaScriptCallFrame { + interface [Conditional=JAVASCRIPT_DEBUGGER, OmitConstructor] JavaScriptCallFrame { [Custom] void evaluate(in DOMString script); readonly attribute JavaScriptCallFrame caller; diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugListener.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugListener.h index 912a751..6570065 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugListener.h +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugListener.h @@ -29,7 +29,7 @@ #ifndef JavaScriptDebugListener_h #define JavaScriptDebugListener_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) namespace JSC { class ExecState; diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp index e460ae8..03c3577 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "JavaScriptDebugServer.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "DOMWindow.h" #include "EventLoop.h" @@ -75,7 +75,7 @@ JavaScriptDebugServer& JavaScriptDebugServer::shared() JavaScriptDebugServer::JavaScriptDebugServer() : m_callingListeners(false) - , m_pauseOnExceptions(false) + , m_pauseOnExceptionsState(DontPauseOnExceptions) , m_pauseOnNextStatement(false) , m_paused(false) , m_doneProcessingDebuggerEvents(true) @@ -249,9 +249,9 @@ void JavaScriptDebugServer::clearBreakpoints() m_breakpoints.clear(); } -void JavaScriptDebugServer::setPauseOnExceptions(bool pause) +void JavaScriptDebugServer::setPauseOnExceptionsState(PauseOnExceptionsState pause) { - m_pauseOnExceptions = pause; + m_pauseOnExceptionsState = pause; } void JavaScriptDebugServer::pauseProgram() @@ -423,7 +423,7 @@ void JavaScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused) { ASSERT_ARG(frame, frame); - if (!frame->script()->isEnabled()) + if (!frame->script()->canExecuteScripts()) return; frame->script()->setPaused(paused); @@ -540,7 +540,7 @@ void JavaScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFra m_currentCallFrame = m_currentCallFrame->caller(); } -void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) +void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber, bool hasHandler) { if (m_paused) return; @@ -549,7 +549,7 @@ void JavaScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame if (!m_currentCallFrame) return; - if (m_pauseOnExceptions) + if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler)) m_pauseOnNextStatement = true; m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h index 33c6e3d..d7c23bc 100644 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h +++ b/src/3rdparty/webkit/WebCore/inspector/JavaScriptDebugServer.h @@ -29,7 +29,7 @@ #ifndef JavaScriptDebugServer_h #define JavaScriptDebugServer_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "Timer.h" #include @@ -52,7 +52,7 @@ namespace WebCore { class JavaScriptCallFrame; class JavaScriptDebugListener; - class JavaScriptDebugServer : JSC::Debugger { + class JavaScriptDebugServer : JSC::Debugger, public Noncopyable { public: static JavaScriptDebugServer& shared(); @@ -68,8 +68,13 @@ namespace WebCore { bool hasBreakpoint(intptr_t sourceID, unsigned lineNumber) const; void clearBreakpoints(); - bool pauseOnExceptions() const { return m_pauseOnExceptions; } - void setPauseOnExceptions(bool); + enum PauseOnExceptionsState { + DontPauseOnExceptions, + PauseOnAllExceptions, + PauseOnUncaughtExceptions + }; + PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; } + void setPauseOnExceptionsState(PauseOnExceptionsState); void pauseProgram(); void continueProgram(); @@ -120,7 +125,7 @@ namespace WebCore { virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int firstLine); virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); - virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); + virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler); virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); @@ -136,7 +141,7 @@ namespace WebCore { PageListenersMap m_pageListenersMap; ListenerSet m_listeners; bool m_callingListeners; - bool m_pauseOnExceptions; + PauseOnExceptionsState m_pauseOnExceptionsState; bool m_pauseOnNextStatement; bool m_paused; bool m_doneProcessingDebuggerEvents; diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.cpp deleted file mode 100644 index 3a65fb8..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JavaScriptProfile.h" - -#if ENABLE(JAVASCRIPT_DEBUGGER) - -#include "JavaScriptProfileNode.h" -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace JSC; - -namespace WebCore { - -// Cache - -typedef HashMap ProfileMap; - -static ProfileMap& profileCache() -{ - DEFINE_STATIC_LOCAL(ProfileMap, staticProfiles, ()); - return staticProfiles; -} - -// Static Values - -static JSClassRef ProfileClass(); - -static JSValueRef getTitleCallback(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(ctx, OpaqueJSString::create(profile->title()).get()); -} - -static JSValueRef getHeadCallback(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - ExecState* exec = toJS(ctx); - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - return toRef(exec, toJS(exec, profile->head())); -} - -static JSValueRef getUniqueIdCallback(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profile->uid()); -} - -// Static Functions - -static JSValueRef focus(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - if (argumentCount < 1) - return JSValueMakeUndefined(ctx); - - if (!JSValueIsObjectOfClass(ctx, arguments[0], ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - profile->focus(static_cast(JSObjectGetPrivate(const_cast(arguments[0])))); - - return JSValueMakeUndefined(ctx); -} - -static JSValueRef exclude(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* /*exception*/) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - if (argumentCount < 1) - return JSValueMakeUndefined(ctx); - - if (!JSValueIsObjectOfClass(ctx, arguments[0], ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - profile->exclude(static_cast(JSObjectGetPrivate(const_cast(arguments[0])))); - - return JSValueMakeUndefined(ctx); -} - -static JSValueRef restoreAll(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments*/, JSValueRef* /*exception*/) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileClass())) - return JSValueMakeUndefined(ctx); - - Profile* profile = static_cast(JSObjectGetPrivate(thisObject)); - profile->restoreAll(); - - return JSValueMakeUndefined(ctx); -} - -static void finalize(JSObjectRef object) -{ - Profile* profile = static_cast(JSObjectGetPrivate(object)); - profileCache().remove(profile); - profile->deref(); -} - -JSClassRef ProfileClass() -{ - static JSStaticValue staticValues[] = { - { "title", getTitleCallback, 0, kJSPropertyAttributeNone }, - { "head", getHeadCallback, 0, kJSPropertyAttributeNone }, - { "uid", getUniqueIdCallback, 0, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } - }; - - static JSStaticFunction staticFunctions[] = { - { "focus", focus, kJSPropertyAttributeNone }, - { "exclude", exclude, kJSPropertyAttributeNone }, - { "restoreAll", restoreAll, kJSPropertyAttributeNone }, - { 0, 0, 0 } - }; - - static JSClassDefinition classDefinition = { - 0, kJSClassAttributeNone, "Profile", 0, staticValues, staticFunctions, - 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - static JSClassRef profileClass = JSClassCreate(&classDefinition); - return profileClass; -} - -JSValue toJS(ExecState* exec, Profile* profile) -{ - if (!profile) - return jsNull(); - - JSObject* profileWrapper = profileCache().get(profile); - if (profileWrapper) - return profileWrapper; - - profile->ref(); - profileWrapper = toJS(JSObjectMake(toRef(exec), ProfileClass(), static_cast(profile))); - profileCache().set(profile, profileWrapper); - return profileWrapper; -} - -} // namespace WebCore - -#endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.h deleted file mode 100644 index 28fd3e4..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfile.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JavaScriptProfile_h -#define JavaScriptProfile_h - -#if ENABLE(JAVASCRIPT_DEBUGGER) - -#include - -namespace JSC { - class ExecState; - class Profile; -} - -namespace WebCore { - - JSC::JSValue toJS(JSC::ExecState*, JSC::Profile*); - -} // namespace WebCore - -#endif // ENABLE(JAVASCRIPT_DEBUGGER) - -#endif diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp deleted file mode 100644 index 2d462f6..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "JavaScriptProfileNode.h" - -#if ENABLE(JAVASCRIPT_DEBUGGER) - -#include "JSDOMBinding.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace JSC; - -namespace WebCore { - -// Cache - -typedef HashMap ProfileNodeMap; - -static ProfileNodeMap& profileNodeCache() -{ - DEFINE_STATIC_LOCAL(ProfileNodeMap, staticProfileNodes, ()); - return staticProfileNodes; -} - -static JSValueRef getFunctionName(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - JSRetainPtr functionNameString(Adopt, JSStringCreateWithCharacters(profileNode->functionName().data(), profileNode->functionName().size())); - return JSValueMakeString(ctx, functionNameString.get()); -} - -static JSValueRef getURL(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - JSRetainPtr urlString(Adopt, JSStringCreateWithCharacters(profileNode->url().data(), profileNode->url().size())); - return JSValueMakeString(ctx, urlString.get()); -} - -static JSValueRef getLineNumber(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profileNode->lineNumber()); -} - -static JSValueRef getTotalTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profileNode->totalTime()); -} - -static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profileNode->selfTime()); -} - -static JSValueRef getNumberOfCalls(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profileNode->numberOfCalls()); -} - -static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef* exception) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - const Vector >& children = profileNode->children(); - - JSObjectRef global = JSContextGetGlobalObject(ctx); - - JSRetainPtr arrayString(Adopt, JSStringCreateWithUTF8CString("Array")); - - JSValueRef arrayProperty = JSObjectGetProperty(ctx, global, arrayString.get(), exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - - JSObjectRef arrayConstructor = JSValueToObject(ctx, arrayProperty, exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - - JSObjectRef result = JSObjectCallAsConstructor(ctx, arrayConstructor, 0, 0, exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - - JSRetainPtr pushString(Adopt, JSStringCreateWithUTF8CString("push")); - - JSValueRef pushProperty = JSObjectGetProperty(ctx, result, pushString.get(), exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - - JSObjectRef pushFunction = JSValueToObject(ctx, pushProperty, exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - - ExecState* exec = toJS(ctx); - for (Vector >::const_iterator it = children.begin(); it != children.end(); ++it) { - JSValueRef arg0 = toRef(exec, toJS(exec, (*it).get() )); - JSObjectCallAsFunction(ctx, pushFunction, result, 1, &arg0, exception); - if (exception && *exception) - return JSValueMakeUndefined(ctx); - } - - return result; -} - -static JSValueRef getVisible(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeBoolean(ctx, profileNode->visible()); -} - -static JSValueRef getCallUID(JSContextRef ctx, JSObjectRef thisObject, JSStringRef, JSValueRef*) -{ - JSC::JSLock lock(SilenceAssertionsOnly); - - if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) - return JSValueMakeUndefined(ctx); - - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, profileNode->callIdentifier().hash()); -} - -static void finalize(JSObjectRef object) -{ - ProfileNode* profileNode = static_cast(JSObjectGetPrivate(object)); - profileNodeCache().remove(profileNode); - profileNode->deref(); -} - -JSClassRef ProfileNodeClass() -{ - static JSStaticValue staticValues[] = { - { "functionName", getFunctionName, 0, kJSPropertyAttributeNone }, - { "url", getURL, 0, kJSPropertyAttributeNone }, - { "lineNumber", getLineNumber, 0, kJSPropertyAttributeNone }, - { "totalTime", getTotalTime, 0, kJSPropertyAttributeNone }, - { "selfTime", getSelfTime, 0, kJSPropertyAttributeNone }, - { "numberOfCalls", getNumberOfCalls, 0, kJSPropertyAttributeNone }, - { "children", getChildren, 0, kJSPropertyAttributeNone }, - { "visible", getVisible, 0, kJSPropertyAttributeNone }, - { "callUID", getCallUID, 0, kJSPropertyAttributeNone }, - { 0, 0, 0, 0 } - }; - - static JSClassDefinition classDefinition = { - 0, kJSClassAttributeNone, "ProfileNode", 0, staticValues, 0, - 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - static JSClassRef profileNodeClass = JSClassCreate(&classDefinition); - return profileNodeClass; -} - -JSValue toJS(ExecState* exec, ProfileNode* profileNode) -{ - if (!profileNode) - return jsNull(); - - JSObject* profileNodeWrapper = profileNodeCache().get(profileNode); - if (profileNodeWrapper) - return profileNodeWrapper; - - profileNode->ref(); - - profileNodeWrapper = toJS(JSObjectMake(toRef(exec), ProfileNodeClass(), static_cast(profileNode))); - profileNodeCache().set(profileNode, profileNodeWrapper); - return profileNodeWrapper; -} - -} // namespace WebCore - -#endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.h b/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.h deleted file mode 100644 index ad72b71..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/JavaScriptProfileNode.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef JavaScriptProfileNode_h -#define JavaScriptProfileNode_h - -#if ENABLE(JAVASCRIPT_DEBUGGER) - -#include -#include - -namespace JSC { - class ExecState; - class ProfileNode; -} - -namespace WebCore { - - JSClassRef ProfileNodeClass(); - JSC::JSValue toJS(JSC::ExecState*, JSC::ProfileNode*); - -} // namespace WebCore - -#endif // ENABLE(JAVASCRIPT_DEBUGGER) - -#endif diff --git a/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp index 085bcd9..525e61d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp +++ b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.cpp @@ -35,11 +35,14 @@ #include "Event.h" #include "InspectorFrontend.h" +#include "IntRect.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" #include "ScriptArray.h" #include "ScriptObject.h" + namespace WebCore { -// static ScriptObject TimelineRecordFactory::createGenericRecord(InspectorFrontend* frontend, double startTime) { ScriptObject record = frontend->newScriptObject(); @@ -47,68 +50,104 @@ ScriptObject TimelineRecordFactory::createGenericRecord(InspectorFrontend* front return record; } -// static -ScriptObject TimelineRecordFactory::createDOMDispatchRecord(InspectorFrontend* frontend, double startTime, const Event& event) +ScriptObject TimelineRecordFactory::createEventDispatchData(InspectorFrontend* frontend, const Event& event) { - ScriptObject record = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("type", event.type().string()); - record.set("data", data); - return record; + return data; } -// static -ScriptObject TimelineRecordFactory::createGenericTimerRecord(InspectorFrontend* frontend, double startTime, int timerId) +ScriptObject TimelineRecordFactory::createGenericTimerData(InspectorFrontend* frontend, int timerId) { - ScriptObject record = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("timerId", timerId); - record.set("data", data); - return record; + return data; } -// static -ScriptObject TimelineRecordFactory::createTimerInstallRecord(InspectorFrontend* frontend, double startTime, int timerId, int timeout, bool singleShot) +ScriptObject TimelineRecordFactory::createTimerInstallData(InspectorFrontend* frontend, int timerId, int timeout, bool singleShot) { - ScriptObject record = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("timerId", timerId); data.set("timeout", timeout); data.set("singleShot", singleShot); - record.set("data", data); - return record; + return data; } -// static -ScriptObject TimelineRecordFactory::createXHRReadyStateChangeTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url, int readyState) +ScriptObject TimelineRecordFactory::createXHRReadyStateChangeData(InspectorFrontend* frontend, const String& url, int readyState) { - ScriptObject record = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("url", url); data.set("readyState", readyState); - record.set("data", data); - return record; + return data; } -// static -ScriptObject TimelineRecordFactory::createXHRLoadTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url) +ScriptObject TimelineRecordFactory::createXHRLoadData(InspectorFrontend* frontend, const String& url) { - ScriptObject record = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("url", url); - record.set("data", data); - return record; + return data; } -// static -ScriptObject TimelineRecordFactory::createEvaluateScriptTagTimelineRecord(InspectorFrontend* frontend, double startTime, const String& url, double lineNumber) +ScriptObject TimelineRecordFactory::createEvaluateScriptData(InspectorFrontend* frontend, const String& url, double lineNumber) { - ScriptObject item = createGenericRecord(frontend, startTime); ScriptObject data = frontend->newScriptObject(); data.set("url", url); data.set("lineNumber", lineNumber); - item.set("data", data); - return item; + return data; +} + +ScriptObject TimelineRecordFactory::createMarkTimelineData(InspectorFrontend* frontend, const String& message) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("message", message); + return data; +} + + +ScriptObject TimelineRecordFactory::createResourceSendRequestData(InspectorFrontend* frontend, unsigned long identifier, bool isMainResource, const ResourceRequest& request) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("identifier", identifier); + data.set("url", request.url().string()); + data.set("requestMethod", request.httpMethod()); + data.set("isMainResource", isMainResource); + return data; +} + +ScriptObject TimelineRecordFactory::createResourceReceiveResponseData(InspectorFrontend* frontend, unsigned long identifier, const ResourceResponse& response) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("identifier", identifier); + data.set("statusCode", response.httpStatusCode()); + data.set("mimeType", response.mimeType()); + data.set("expectedContentLength", response.expectedContentLength()); + return data; +} + +ScriptObject TimelineRecordFactory::createResourceFinishData(InspectorFrontend* frontend, unsigned long identifier, bool didFail) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("identifier", identifier); + data.set("didFail", didFail); + return data; +} + +ScriptObject TimelineRecordFactory::createPaintData(InspectorFrontend* frontend, const IntRect& rect) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("x", rect.x()); + data.set("y", rect.y()); + data.set("width", rect.width()); + data.set("height", rect.height()); + return data; +} + +ScriptObject TimelineRecordFactory::createParseHTMLData(InspectorFrontend* frontend, unsigned int length, unsigned int startLine) +{ + ScriptObject data = frontend->newScriptObject(); + data.set("length", length); + data.set("startLine", startLine); + return data; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h index 3d36649..b7437f5 100644 --- a/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h +++ b/src/3rdparty/webkit/WebCore/inspector/TimelineRecordFactory.h @@ -37,22 +37,39 @@ namespace WebCore { class Event; class InspectorFrontend; + class IntRect; + class ResourceRequest; + class ResourceResponse; class ScriptObject; class TimelineRecordFactory { public: static ScriptObject createGenericRecord(InspectorFrontend*, double startTime); - static ScriptObject createDOMDispatchRecord(InspectorFrontend*, double startTime, const Event&); + static ScriptObject createEventDispatchData(InspectorFrontend*, const Event&); - static ScriptObject createGenericTimerRecord(InspectorFrontend*, double startTime, int timerId); + static ScriptObject createGenericTimerData(InspectorFrontend*, int timerId); - static ScriptObject createTimerInstallRecord(InspectorFrontend*, double startTime, int timerId, int timeout, bool singleShot); + static ScriptObject createTimerInstallData(InspectorFrontend*, int timerId, int timeout, bool singleShot); - static ScriptObject createXHRReadyStateChangeTimelineRecord(InspectorFrontend*, double startTime, const String& url, int readyState); - static ScriptObject createXHRLoadTimelineRecord(InspectorFrontend*, double startTime, const String& url); + static ScriptObject createXHRReadyStateChangeData(InspectorFrontend*, const String& url, int readyState); + + static ScriptObject createXHRLoadData(InspectorFrontend*, const String& url); + + static ScriptObject createEvaluateScriptData(InspectorFrontend*, const String&, double lineNumber); - static ScriptObject createEvaluateScriptTagTimelineRecord(InspectorFrontend*, double startTime, const String&, double lineNumber); + static ScriptObject createMarkTimelineData(InspectorFrontend*, const String&); + + static ScriptObject createResourceSendRequestData(InspectorFrontend*, unsigned long identifier, + bool isMainResource, const ResourceRequest&); + + static ScriptObject createResourceReceiveResponseData(InspectorFrontend*, unsigned long identifier, const ResourceResponse&); + + static ScriptObject createResourceFinishData(InspectorFrontend*, unsigned long identifier, bool didFail); + + static ScriptObject createPaintData(InspectorFrontend*, const IntRect&); + + static ScriptObject createParseHTMLData(InspectorFrontend*, unsigned int length, unsigned int startLine); private: TimelineRecordFactory() { } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js index 75e4062..6c5d715 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AbstractTimelinePanel.js @@ -57,10 +57,13 @@ WebInspector.AbstractTimelinePanel.prototype = { // Should be implemented by the concrete subclasses. }, - createInterface: function() + get items() { - this._createFilterPanel(); + return this._items; + }, + createInterface: function() + { this.containerElement = document.createElement("div"); this.containerElement.id = "resources-container"; this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false); @@ -70,10 +73,20 @@ WebInspector.AbstractTimelinePanel.prototype = { this.sidebarElement.id = "resources-sidebar"; this.populateSidebar(); - this._createGraph(); + this._containerContentElement = document.createElement("div"); + this._containerContentElement.id = "resources-container-content"; + this.containerElement.appendChild(this._containerContentElement); + + this.summaryBar = new WebInspector.SummaryBar(this.categories); + this.summaryBar.element.id = "resources-summary"; + this._containerContentElement.appendChild(this.summaryBar.element); + + this._timelineGrid = new WebInspector.TimelineGrid(); + this._containerContentElement.appendChild(this._timelineGrid.element); + this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement; }, - _createFilterPanel: function() + createFilterPanel: function() { this.filterBarElement = document.createElement("div"); this.filterBarElement.id = "resources-filter"; @@ -108,14 +121,14 @@ WebInspector.AbstractTimelinePanel.prototype = { createFilterElement.call(this, category); }, - _showCategory: function(category) + showCategory: function(category) { var filterClass = "filter-" + category.toLowerCase(); this.itemsGraphsElement.addStyleClass(filterClass); this.itemsTreeElement.childrenListElement.addStyleClass(filterClass); }, - _hideCategory: function(category) + hideCategory: function(category) { var filterClass = "filter-" + category.toLowerCase(); this.itemsGraphsElement.removeStyleClass(filterClass); @@ -132,7 +145,7 @@ WebInspector.AbstractTimelinePanel.prototype = { continue; child.removeStyleClass("selected"); - this._hideCategory(child.category); + this.hideCategory(child.category); } } @@ -148,7 +161,7 @@ WebInspector.AbstractTimelinePanel.prototype = { // Something other than All is being selected, so we want to unselect All. if (this.filterAllElement.hasStyleClass("selected")) { this.filterAllElement.removeStyleClass("selected"); - this._hideCategory("all"); + this.hideCategory("all"); } } @@ -158,7 +171,7 @@ WebInspector.AbstractTimelinePanel.prototype = { unselectAll.call(this); target.addStyleClass("selected"); - this._showCategory(target.category); + this.showCategory(target.category); return; } @@ -166,18 +179,18 @@ WebInspector.AbstractTimelinePanel.prototype = { // If selectMultiple is turned on, and we were selected, we just // want to unselect ourselves. target.removeStyleClass("selected"); - this._hideCategory(target.category); + this.hideCategory(target.category); } else { // If selectMultiple is turned on, and we weren't selected, we just // want to select ourselves. target.addStyleClass("selected"); - this._showCategory(target.category); + this.showCategory(target.category); } }, _updateFilter: function(e) { - var isMac = InspectorController.platform().indexOf("mac-") === 0; + var isMac = WebInspector.isMac(); var selectMultiple = false; if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) selectMultiple = true; @@ -191,83 +204,21 @@ WebInspector.AbstractTimelinePanel.prototype = { this.containerElement.scrollTop = 0; }, - _createGraph: function() - { - this._containerContentElement = document.createElement("div"); - this._containerContentElement.id = "resources-container-content"; - this.containerElement.appendChild(this._containerContentElement); - - this.summaryBar = new WebInspector.SummaryBar(this.categories); - this.summaryBar.element.id = "resources-summary"; - this._containerContentElement.appendChild(this.summaryBar.element); - - this.itemsGraphsElement = document.createElement("div"); - this.itemsGraphsElement.id = "resources-graphs"; - this._containerContentElement.appendChild(this.itemsGraphsElement); - - this.dividersElement = document.createElement("div"); - this.dividersElement.id = "resources-dividers"; - this._containerContentElement.appendChild(this.dividersElement); - - this.eventDividersElement = document.createElement("div"); - this.eventDividersElement.id = "resources-event-dividers"; - this._containerContentElement.appendChild(this.eventDividersElement); - - this.dividersLabelBarElement = document.createElement("div"); - this.dividersLabelBarElement.id = "resources-dividers-label-bar"; - this._containerContentElement.appendChild(this.dividersLabelBarElement); - }, - updateGraphDividersIfNeeded: function(force) { if (!this.visible) { this.needsRefresh = true; return false; } - - if (document.body.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet or the window is closed, - // so we can't calculate what is need. Return early. - return false; - } - - var dividerCount = Math.round(this.dividersElement.offsetWidth / 64); - var slice = this.calculator.boundarySpan / dividerCount; - if (!force && this._currentDividerSlice === slice) - return false; - - this._currentDividerSlice = slice; - - this.dividersElement.removeChildren(); - this.eventDividersElement.removeChildren(); - this.dividersLabelBarElement.removeChildren(); - - for (var i = 1; i <= dividerCount; ++i) { - var divider = document.createElement("div"); - divider.className = "resources-divider"; - if (i === dividerCount) - divider.addStyleClass("last"); - divider.style.left = ((i / dividerCount) * 100) + "%"; - - this.dividersElement.appendChild(divider.cloneNode()); - - var label = document.createElement("div"); - label.className = "resources-divider-label"; - if (!isNaN(slice)) - label.textContent = this.calculator.formatValue(slice * i); - divider.appendChild(label); - - this.dividersLabelBarElement.appendChild(divider); - } + return this._timelineGrid.updateDividers(force, this.calculator); }, _updateDividersLabelBarPosition: function() { - var scrollTop = this.containerElement.scrollTop; - var dividersTop = (scrollTop < this.summaryBar.element.offsetHeight ? this.summaryBar.element.offsetHeight : scrollTop); - this.dividersElement.style.top = scrollTop + "px"; - this.eventDividersElement.style.top = scrollTop + "px"; - this.dividersLabelBarElement.style.top = dividersTop + "px"; + const scrollTop = this.containerElement.scrollTop; + const offsetHeight = this.summaryBar.element.offsetHeight; + const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop); + this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop); }, get needsRefresh() @@ -309,13 +260,20 @@ WebInspector.AbstractTimelinePanel.prototype = { resize: function() { + WebInspector.Panel.prototype.resize.call(this); + this.updateGraphDividersIfNeeded(); }, updateMainViewWidth: function(width) { this._containerContentElement.style.left = width + "px"; - this.updateGraphDividersIfNeeded(); + this.resize(); + }, + + invalidateAllItems: function() + { + this._staleItems = this._items.slice(); }, refresh: function() @@ -323,21 +281,22 @@ WebInspector.AbstractTimelinePanel.prototype = { this.needsRefresh = false; var staleItemsLength = this._staleItems.length; + var boundariesChanged = false; for (var i = 0; i < staleItemsLength; ++i) { var item = this._staleItems[i]; - if (!item._itemTreeElement) { + if (!item._itemsTreeElement) { // Create the timeline tree element and graph. - item._itemTreeElement = this.createItemTreeElement(item); - item._itemTreeElement._itemGraph = this.createItemGraph(item); + item._itemsTreeElement = this.createItemTreeElement(item); + item._itemsTreeElement._itemGraph = this.createItemGraph(item); - this.itemsTreeElement.appendChild(item._itemTreeElement); - this.itemsGraphsElement.appendChild(item._itemTreeElement._itemGraph.graphElement); + this.itemsTreeElement.appendChild(item._itemsTreeElement); + this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement); } - if (item._itemTreeElement.refresh) - item._itemTreeElement.refresh(); + if (item._itemsTreeElement.refresh) + item._itemsTreeElement.refresh(); if (this.calculator.updateBoundaries(item)) boundariesChanged = true; @@ -345,12 +304,12 @@ WebInspector.AbstractTimelinePanel.prototype = { if (boundariesChanged) { // The boundaries changed, so all item graphs are stale. - this._staleItems = this._items; + this._staleItems = this._items.slice(); staleItemsLength = this._staleItems.length; } for (var i = 0; i < staleItemsLength; ++i) - this._staleItems[i]._itemTreeElement._itemGraph.refresh(this.calculator); + this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator); this._staleItems = []; @@ -394,7 +353,7 @@ WebInspector.AbstractTimelinePanel.prototype = { this._calculator = x; this._calculator.reset(); - this._staleItems = this._items; + this._staleItems = this._items.slice(); this.refresh(); }, @@ -408,12 +367,12 @@ WebInspector.AbstractTimelinePanel.prototype = { { this._items.remove(item, true); - if (item._itemTreeElement) { - this.itemsTreeElement.removeChild(resource._itemTreeElement); - this.itemsGraphsElement.removeChild(resource._itemTreeElement._itemGraph.graphElement); + if (item._itemsTreeElement) { + this.itemsTreeElement.removeChild(item._itemsTreeElement); + this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement); } - delete item._itemTreeElement; + delete item._itemsTreeElement; this.adjustScrollPosition(); }, @@ -458,6 +417,11 @@ WebInspector.AbstractTimelinePanel.prototype = { // Prevent the container from being scrolled off the end. if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight) this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight); + }, + + addEventDivider: function(divider) + { + this._timelineGrid.addEventDivider(divider); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js new file mode 100644 index 0000000..6931b5f --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditCategories.js @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AuditCategories.PagePerformance = function() { + WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.PagePerformance.AuditCategoryName); +} + +WebInspector.AuditCategories.PagePerformance.AuditCategoryName = "Web Page Performance"; + +WebInspector.AuditCategories.PagePerformance.prototype = { + initialize: function() + { + this.addRule(new WebInspector.AuditRules.UnusedCssRule()); + this.addRule(new WebInspector.AuditRules.CssInHeadRule({InlineURLScore: 6, InlineStylesheetScore: 21})); + this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule({CSSAfterJSURLScore: 11, InlineBetweenResourcesScore: 21})); + } +} + +WebInspector.AuditCategories.PagePerformance.prototype.__proto__ = WebInspector.AuditCategory.prototype; + +WebInspector.AuditCategories.NetworkUtilization = function() { + WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName); +} + +WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName = "Network Utilization"; + +WebInspector.AuditCategories.NetworkUtilization.prototype = { + initialize: function() + { + this.addRule(new WebInspector.AuditRules.GzipRule()); + this.addRule(new WebInspector.AuditRules.ImageDimensionsRule({ScorePerImageUse: 5})); + this.addRule(new WebInspector.AuditRules.CookieSizeRule({MinBytesThreshold: 400, MaxBytesThreshold: 1000})); + this.addRule(new WebInspector.AuditRules.StaticCookielessRule({MinResources: 5})); + this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11})); + this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule({AllowedPerDomain: 2, ScorePerResource: 11})); + this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule({HostCountThreshold: 4, ViolationDomainScore: 6})); + this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule({OptimalHostnameCount: 4, MinRequestThreshold: 10, MinBalanceThreshold: 0.5})); + this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule()); + this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule()); + } +} + +WebInspector.AuditCategories.NetworkUtilization.prototype.__proto__ = WebInspector.AuditCategory.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js new file mode 100644 index 0000000..f2a2fd2 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditLauncherView.js @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AuditLauncherView = function(categoriesById, runnerCallback) +{ + WebInspector.View.call(this); + this._categoriesById = categoriesById; + this._runnerCallback = runnerCallback; + this._categoryIdPrefix = "audit-category-item-"; + this._auditRunning = false; + + this.element.addStyleClass("audit-launcher-view"); + + this._contentElement = document.createElement("div"); + this._contentElement.className = "audit-launcher-view-content"; + this.element.appendChild(this._contentElement); + + function categorySortFunction(a, b) + { + var aTitle = a.displayName || ""; + var bTitle = b.displayName || ""; + return aTitle.localeCompare(bTitle); + } + var sortedCategories = []; + for (var id in this._categoriesById) + sortedCategories.push(this._categoriesById[id]); + sortedCategories.sort(categorySortFunction); + + if (!sortedCategories.length) { + this._headerElement = document.createElement("h1"); + this._headerElement.className = "no-audits"; + this._headerElement.textContent = WebInspector.UIString("No audits to run"); + this._contentElement.appendChild(this._headerElement); + } else + this._createLauncherUI(sortedCategories); +} + +WebInspector.AuditLauncherView.prototype = { + updateResourceTrackingState: function(isTracking) + { + if (!this._auditPresentStateLabelElement) + return; + if (isTracking) { + this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State"); + this._auditPresentStateElement.disabled = false; + this._auditPresentStateElement.parentElement.removeStyleClass("disabled"); + } else { + this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State (Resource Tracking must be enabled)"); + this._auditPresentStateElement.disabled = true; + this._auditPresentStateElement.parentElement.addStyleClass("disabled"); + this.auditReloadedStateElement.checked = true; + } + }, + + _setAuditRunning: function(auditRunning) + { + if (this._auditRunning === auditRunning) + return; + this._auditRunning = auditRunning; + this._updateButton(); + }, + + _launchButtonClicked: function(event) + { + var catIds = []; + var childNodes = this._categoriesElement.childNodes; + for (var id in this._categoriesById) { + if (this._categoriesById[id]._checkboxElement.checked) + catIds.push(id); + } + function profilingFinishedCallback() + { + this._setAuditRunning(false); + } + this._setAuditRunning(true); + this._runnerCallback(catIds, this._auditPresentStateElement.checked, profilingFinishedCallback.bind(this)); + }, + + _selectAllClicked: function(checkCategories) + { + var childNodes = this._categoriesElement.childNodes; + for (var i = 0, length = childNodes.length; i < length; ++i) + childNodes[i].firstChild.checked = checkCategories; + this._currentCategoriesCount = checkCategories ? this._totalCategoriesCount : 0; + this._updateButton(); + }, + + _categoryClicked: function(event) + { + this._currentCategoriesCount += event.target.checked ? 1 : -1; + this._selectAllCheckboxElement.checked = this._currentCategoriesCount === this._totalCategoriesCount; + this._updateButton(); + }, + + _createCategoryElement: function(title, id) + { + var element; + var labelElement = document.createElement("label"); + labelElement.id = this._categoryIdPrefix + id; + + element = document.createElement("input"); + element.type = "checkbox"; + labelElement.appendChild(element); + labelElement.appendChild(document.createTextNode(title)); + + return labelElement; + }, + + _createLauncherUI: function(sortedCategories) + { + this._headerElement = document.createElement("h1"); + this._headerElement.textContent = WebInspector.UIString("Select audits to run"); + this._contentElement.appendChild(this._headerElement); + + function handleSelectAllClick(event) + { + this._selectAllClicked(event.target.checked); + } + var categoryElement = this._createCategoryElement(WebInspector.UIString("Select All"), ""); + categoryElement.id = "audit-launcher-selectall"; + this._selectAllCheckboxElement = categoryElement.firstChild; + this._selectAllCheckboxElement.checked = true; + this._selectAllCheckboxElement.addEventListener("click", handleSelectAllClick.bind(this), false); + this._contentElement.appendChild(categoryElement); + + this._categoriesElement = document.createElement("div"); + this._categoriesElement.className = "audit-categories-container"; + this._contentElement.appendChild(this._categoriesElement); + + var boundCategoryClickListener = this._categoryClicked.bind(this); + + for (var i = 0; i < sortedCategories.length; ++i) { + categoryElement = this._createCategoryElement(sortedCategories[i].displayName, sortedCategories[i].id); + categoryElement.firstChild.addEventListener("click", boundCategoryClickListener, false); + sortedCategories[i]._checkboxElement = categoryElement.firstChild; + this._categoriesElement.appendChild(categoryElement); + } + + this._totalCategoriesCount = this._categoriesElement.childNodes.length; + this._currentCategoriesCount = 0; + + this._buttonContainerElement = document.createElement("div"); + this._buttonContainerElement.className = "button-container"; + + var labelElement = document.createElement("label"); + this._auditPresentStateElement = document.createElement("input"); + this._auditPresentStateElement.name = "audit-mode"; + this._auditPresentStateElement.type = "radio"; + this._auditPresentStateElement.checked = true; + this._auditPresentStateLabelElement = document.createTextNode(""); + labelElement.appendChild(this._auditPresentStateElement); + labelElement.appendChild(this._auditPresentStateLabelElement); + this._buttonContainerElement.appendChild(labelElement); + + labelElement = document.createElement("label"); + this.auditReloadedStateElement = document.createElement("input"); + this.auditReloadedStateElement.name = "audit-mode"; + this.auditReloadedStateElement.type = "radio"; + labelElement.appendChild(this.auditReloadedStateElement); + labelElement.appendChild(document.createTextNode("Reload Page and Audit on Load")); + this._buttonContainerElement.appendChild(labelElement); + + this._launchButton = document.createElement("button"); + this._launchButton.setAttribute("type", "button"); + this._launchButton.addEventListener("click", this._launchButtonClicked.bind(this), false); + this._buttonContainerElement.appendChild(this._launchButton); + + this._contentElement.appendChild(this._buttonContainerElement); + + this._selectAllClicked(this._selectAllCheckboxElement.checked); + this.updateResourceTrackingState(); + this._updateButton(); + }, + + _updateButton: function() + { + this._launchButton.disabled = !this._currentCategoriesCount || this._auditRunning; + if (this._auditRunning) + this._launchButton.textContent = WebInspector.UIString("Running..."); + else + this._launchButton.textContent = WebInspector.UIString("Run"); + }, + + show: function(parentElement) + { + WebInspector.View.prototype.show.call(this, parentElement); + setTimeout(this.resize(), 0); + }, + + resize: function() + { + if (this._categoriesElement) + this._categoriesElement.style.height = (this._buttonContainerElement.totalOffsetTop - this._categoriesElement.totalOffsetTop) + "px"; + } +} + +WebInspector.AuditLauncherView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js new file mode 100644 index 0000000..ac818fb --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditResultView.js @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AuditResultView = function(categoryResults) +{ + WebInspector.View.call(this); + + this.element.id = "audit-result-view"; + + function entrySortFunction(a, b) + { + var result = b.type - a.type; + if (!result) + result = (a.value || "").localeCompare(b.value || ""); + return result; + } + + for (var i = 0; i < categoryResults.length; ++i) { + var entries = categoryResults[i].entries; + if (entries) { + entries.sort(entrySortFunction); + this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element); + } + } +} + +WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype; + + +WebInspector.AuditCategoryResultPane = function(categoryResult) +{ + WebInspector.SidebarPane.call(this, categoryResult.title); + this.expand(); + for (var i = 0; i < categoryResult.entries.length; ++i) + this.bodyElement.appendChild(new WebInspector.AuditRuleResultPane(categoryResult.entries[i]).element); +} + +WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + + +WebInspector.AuditRuleResultPane = function(ruleResult) +{ + WebInspector.SidebarPane.call(this, ruleResult.value); + if (!ruleResult.children) + return; + + this._decorateRuleResult(ruleResult); + + for (var i = 0; i < ruleResult.children.length; ++i) { + var section = new WebInspector.AuditRuleResultChildSection(ruleResult.children[i]); + this.bodyElement.appendChild(section.element); + } +} + +WebInspector.AuditRuleResultPane.prototype = { + _decorateRuleResult: function(ruleResult) + { + if (ruleResult.type == WebInspector.AuditRuleResult.Type.NA) + return; + + var scoreElement = document.createElement("img"); + scoreElement.className = "score"; + var className = (ruleResult.type == WebInspector.AuditRuleResult.Type.Violation) ? "red" : "green"; + scoreElement.addStyleClass(className); + this.element.insertBefore(scoreElement, this.element.firstChild); + } +} + +WebInspector.AuditRuleResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + + +WebInspector.AuditRuleResultChildSection = function(entry) +{ + WebInspector.Section.call(this, entry.value); + var children = entry.children; + this._hasChildren = !!children && children.length; + if (!this._hasChildren) + this.element.addStyleClass("blank-section"); + else { + this.contentElement = document.createElement("div"); + this.contentElement.addStyleClass("section-content"); + for (var i = 0; i < children.length; ++i) { + var paraElement = document.createElement("p"); + paraElement.innerHTML = children[i].value; + this.contentElement.appendChild(paraElement); + } + this.contentElement.appendChild(paraElement); + this.element.appendChild(this.contentElement); + } +} + +WebInspector.AuditRuleResultChildSection.prototype = { + + // title is considered pure HTML + set title(x) + { + if (this._title === x) + return; + this._title = x; + + this.titleElement.innerHTML = x; + }, + + expand: function() + { + if (this._hasChildren) + WebInspector.Section.prototype.expand.call(this); + } +} + +WebInspector.AuditRuleResultChildSection.prototype.__proto__ = WebInspector.Section.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js new file mode 100644 index 0000000..210b8a9 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditRules.js @@ -0,0 +1,1213 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AuditRules.IPAddressRegexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; + +WebInspector.AuditRules.CacheableResponseCodes = +{ + 200: true, + 203: true, + 206: true, + 300: true, + 301: true, + 410: true, + + 304: true // Underlying resource is cacheable +} + +/** + * @param {Array} array Array of Elements (outerHTML is used) or strings (plain value is used as innerHTML) + */ +WebInspector.AuditRules.arrayAsUL = function(array, shouldLinkify) +{ + if (!array.length) + return ""; + var ulElement = document.createElement("ul"); + for (var i = 0; i < array.length; ++i) { + var liElement = document.createElement("li"); + if (array[i] instanceof Element) + liElement.appendChild(array[i]); + else if (shouldLinkify) + liElement.appendChild(WebInspector.linkifyURLAsNode(array[i])); + else + liElement.innerHTML = array[i]; + ulElement.appendChild(liElement); + } + return ulElement.outerHTML; +} + +WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, regexp, needFullResources) +{ + var domainToResourcesMap = {}; + for (var i = 0, size = resources.length; i < size; ++i) { + var resource = resources[i]; + if (types && types.indexOf(resource.type) === -1) + continue; + var match = resource.url.match(regexp); + if (!match) + continue; + var domain = match[2]; + var domainResources = domainToResourcesMap[domain]; + if (domainResources === undefined) { + domainResources = []; + domainToResourcesMap[domain] = domainResources; + } + domainResources.push(needFullResources ? resource : resource.url); + } + return domainToResourcesMap; +} + +WebInspector.AuditRules.evaluateInTargetWindow = function(func, callback) +{ + InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), callback); +} + + +WebInspector.AuditRules.GzipRule = function() +{ + WebInspector.AuditRule.call(this, "network-gzip", "Enable gzip compression"); +} + +WebInspector.AuditRules.GzipRule.prototype = { + doRun: function(resources, result, callback) + { + try { + var commonMessage = undefined; + var totalSavings = 0; + var compressedSize = 0 + var candidateSize = 0 + var outputResources = []; + for (var i = 0, length = resources.length; i < length; ++i) { + var resource = resources[i]; + if (this._shouldCompress(resource)) { + var size = resource.contentLength; + candidateSize += size; + if (this._isCompressed(resource)) { + compressedSize += size; + continue; + } + if (!commonMessage) + commonMessage = result.appendChild(""); + var savings = 2 * size / 3; + totalSavings += savings; + outputResources.push( + String.sprintf("Compressing %s could save ~%s", + WebInspector.linkifyURL(resource.url), Number.bytesToString(savings))); + } + } + if (commonMessage) { + commonMessage.value = + String.sprintf("Compressing the following resources with gzip could reduce their " + + "transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings)); + commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources)); + result.score = 100 * compressedSize / candidateSize; + result.type = WebInspector.AuditRuleResult.Type.Violation; + } + } catch(e) { + console.log(e); + } finally { + callback(result); + } + }, + + _isCompressed: function(resource) + { + var encoding = resource.responseHeaders["Content-Encoding"]; + return encoding === "gzip" || encoding === "deflate"; + }, + + _shouldCompress: function(resource) + { + return WebInspector.Resource.Type.isTextType(resource.type) && resource.domain && resource.contentLength !== undefined && resource.contentLength > 150; + } +} + +WebInspector.AuditRules.GzipRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CombineExternalResourcesRule = function(id, name, type, resourceTypeName, parametersObject) +{ + WebInspector.AuditRule.call(this, id, name, parametersObject); + this._type = type; + this._resourceTypeName = resourceTypeName; +} + +WebInspector.AuditRules.CombineExternalResourcesRule.prototype = { + doRun: function(resources, result, callback) + { + try { + var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type], WebInspector.URLRegExp); + var penalizedResourceCount = 0; + // TODO: refactor according to the chosen i18n approach + for (var domain in domainToResourcesMap) { + var domainResources = domainToResourcesMap[domain]; + var extraResourceCount = domainResources.length - this.getValue("AllowedPerDomain"); + if (extraResourceCount <= 0) + continue; + penalizedResourceCount += extraResourceCount - 1; + result.appendChild( + String.sprintf("There are %d %s files served from %s. Consider combining them into as few files as possible.", + domainResources.length, this._resourceTypeName, domain)); + } + result.score = 100 - (penalizedResourceCount * this.getValue("ScorePerResource")); + result.type = WebInspector.AuditRuleResult.Type.Hint; + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } +}; + +WebInspector.AuditRules.CombineExternalResourcesRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CombineJsResourcesRule = function(parametersObject) { + WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JS", parametersObject); +} + +WebInspector.AuditRules.CombineJsResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype; + + +WebInspector.AuditRules.CombineCssResourcesRule = function(parametersObject) { + WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", parametersObject); +} + +WebInspector.AuditRules.CombineCssResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype; + + +WebInspector.AuditRules.MinimizeDnsLookupsRule = function(parametersObject) { + WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups", parametersObject); +} + +WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype = { + doRun: function(resources, result, callback) + { + try { + var violationDomains = []; + var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined, WebInspector.URLRegExp); + for (var domain in domainToResourcesMap) { + if (domainToResourcesMap[domain].length > 1) + continue; + var match = domain.match(WebInspector.URLRegExp); + if (!match) + continue; + if (!match[2].search(WebInspector.AuditRules.IPAddressRegexp)) + continue; // an IP address + violationDomains.push(match[2]); + } + if (violationDomains.length <= this.getValue("HostCountThreshold")) + return; + var commonMessage = result.appendChild( + "The following domains only serve one resource each. If possible, avoid the extra DNS " + + "lookups by serving these resources from existing domains."); + commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(violationDomains)); + result.score = 100 - violationDomains.length * this.getValue("ViolationDomainScore"); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } +} + +WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.ParallelizeDownloadRule = function(parametersObject) +{ + WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames", parametersObject); +} + + +WebInspector.AuditRules.ParallelizeDownloadRule.prototype = { + doRun: function(resources, result, callback) + { + function hostSorter(a, b) + { + var aCount = domainToResourcesMap[a].length; + var bCount = domainToResourcesMap[b].length; + return (aCount < bCount) ? 1 : (aCount == bCount) ? 0 : -1; + } + + try { + var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap( + resources, + [WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image], + WebInspector.URLRegExp, + true); + + var hosts = []; + for (var url in domainToResourcesMap) + hosts.push(url); + + if (!hosts.length) + return; // no hosts (local file or something) + + hosts.sort(hostSorter); + + var optimalHostnameCount = this.getValue("OptimalHostnameCount"); + if (hosts.length > optimalHostnameCount) + hosts.splice(optimalHostnameCount); + + var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length; + var resourceCountAboveThreshold = busiestHostResourceCount - this.getValue("MinRequestThreshold"); + if (resourceCountAboveThreshold <= 0) + return; + + var avgResourcesPerHost = 0; + for (var i = 0, size = hosts.length; i < size; ++i) + avgResourcesPerHost += domainToResourcesMap[hosts[i]].length; + + // Assume optimal parallelization. + avgResourcesPerHost /= optimalHostnameCount; + + avgResourcesPerHost = Math.max(avgResourcesPerHost, 1); + + var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0; + + var minBalanceThreshold = this.getValue("MinBalanceThreshold"); + if (pctAboveAvg < minBalanceThreshold) { + result.score = 100; + return; + } + + result.score = (1 - (pctAboveAvg - minBalanceThreshold)) * 100; + result.type = WebInspector.AuditRuleResult.Type.Hint; + + var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]]; + var commonMessage = result.appendChild( + String.sprintf("This page makes %d parallelizable requests to %s" + + ". Increase download parallelization by distributing the following" + + " requests across multiple hostnames.", busiestHostResourceCount, hosts[0])); + var outputResources = []; + for (var i = 0, size = resourcesOnBusiestHost.length; i < size; ++i) + outputResources.push(resourcesOnBusiestHost[i].url); + commonMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true)); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } +} + +WebInspector.AuditRules.ParallelizeDownloadRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +// The reported CSS rule size is incorrect (parsed != original in WebKit), +// so use percentages instead, which gives a better approximation. +WebInspector.AuditRules.UnusedCssRule = function(parametersObject) +{ + WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS", parametersObject); +} + +WebInspector.AuditRules.UnusedCssRule.prototype = { + _getUnusedStylesheetRatioMessage: function(unusedLength, type, location, styleSheetLength) + { + var url = type === "href" + ? WebInspector.linkifyURL(location) + : String.sprintf("Inline block #%s", location); + var pctUnused = Math.round(unusedLength / styleSheetLength * 100); + return String.sprintf("%s: %f%% (estimated) is not used by the current page.", url, pctUnused); + }, + + _getUnusedTotalRatioMessage: function(unusedLength, totalLength) + { + var pctUnused = Math.round(unusedLength / totalLength * 100); + return String.sprintf("%d%% of CSS (estimated) is not used by the current page.", pctUnused); + }, + + doRun: function(resources, result, callback) + { + var self = this; + function evalCallback(evalResult, isException) { + try { + if (isException) + return; + + var totalLength = 0; + var totalUnusedLength = 0; + var topMessage; + var styleSheetMessage; + for (var i = 0; i < evalResult.length; ) { + var type = evalResult[i++]; + if (type === "totalLength") { + totalLength = evalResult[i++]; + continue; + } + + var styleSheetLength = evalResult[i++]; + var location = evalResult[i++]; + var unusedRules = evalResult[i++]; + styleSheetMessage = undefined; + if (!topMessage) + topMessage = result.appendChild(""); + + var totalUnusedRuleLength = 0; + var ruleSelectors = []; + for (var j = 0; j < unusedRules.length; ++j) { + var rule = unusedRules[j]; + totalUnusedRuleLength += parseInt(rule[1]); + if (!styleSheetMessage) + styleSheetMessage = result.appendChild(""); + ruleSelectors.push(rule[0]); + } + styleSheetMessage.appendChild(WebInspector.AuditRules.arrayAsUL(ruleSelectors)); + + styleSheetMessage.value = self._getUnusedStylesheetRatioMessage(totalUnusedRuleLength, type, location, styleSheetLength); + totalUnusedLength += totalUnusedRuleLength; + } + if (totalUnusedLength) { + var totalUnusedPercent = totalUnusedLength / totalLength; + topMessage.value = self._getUnusedTotalRatioMessage(totalUnusedLength, totalLength); + var pctMultiplier = Math.log(Math.max(200, totalUnusedLength - 800)) / 7 - 0.6; + result.score = (1 - totalUnusedPercent * pctMultiplier) * 100; + result.type = WebInspector.AuditRuleResult.Type.Hint; + } else + result.score = 100; + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } + + function routine() + { + var styleSheets = document.styleSheets; + if (!styleSheets) + return {}; + var styleSheetToUnusedRules = []; + var inlineBlockOrdinal = 0; + var totalCSSLength = 0; + var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus/; + for (var i = 0; i < styleSheets.length; ++i) { + var styleSheet = styleSheets[i]; + if (!styleSheet.cssRules) + continue; + var currentStyleSheetSize = 0; + var unusedRules = []; + for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) { + var rule = styleSheet.cssRules[curRule]; + var textLength = rule.cssText ? rule.cssText.length : 0; + currentStyleSheetSize += textLength; + totalCSSLength += textLength; + if (rule.type !== 1 || rule.selectorText.match(pseudoSelectorRegexp)) + continue; + var nodes = document.querySelectorAll(rule.selectorText); + if (nodes && nodes.length) + continue; + unusedRules.push([rule.selectorText, textLength]); + } + if (unusedRules.length) { + styleSheetToUnusedRules.push(styleSheet.href ? "href" : "inline"); + styleSheetToUnusedRules.push(currentStyleSheetSize); + styleSheetToUnusedRules.push(styleSheet.href ? styleSheet.href : ++inlineBlockOrdinal); + styleSheetToUnusedRules.push(unusedRules); + } + } + styleSheetToUnusedRules.push("totalLength"); + styleSheetToUnusedRules.push(totalCSSLength); + return styleSheetToUnusedRules; + } + + WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback); + } +} + +WebInspector.AuditRules.UnusedCssRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CacheControlRule = function(id, name, parametersObject) +{ + WebInspector.AuditRule.call(this, id, name, parametersObject); +} + +WebInspector.AuditRules.CacheControlRule.MillisPerMonth = 1000 * 60 * 60 * 24 * 30; + +WebInspector.AuditRules.CacheControlRule.prototype = { + + InfoCheck: -1, + FailCheck: 0, + WarningCheck: 1, + SevereCheck: 2, + + doRun: function(resources, result, callback) + { + try { + var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources); + if (cacheableAndNonCacheableResources[0].length) { + result.score = 100; + this.runChecks(cacheableAndNonCacheableResources[0], result); + } + this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + }, + + handleNonCacheableResources: function() + { + }, + + _cacheableAndNonCacheableResources: function(resources) + { + var processedResources = [[], []]; + for (var i = 0; i < resources.length; ++i) { + var resource = resources[i]; + if (!this.isCacheableResource(resource)) + continue; + if (this._isExplicitlyNonCacheable(resource)) + processedResources[1].push(resource); + else + processedResources[0].push(resource); + } + return processedResources; + }, + + execCheck: function(messageText, resourceCheckFunction, resources, severity, result) + { + var topMessage; + var failingResources = 0; + var resourceCount = resources.length; + var outputResources = []; + for (var i = 0; i < resourceCount; ++i) { + if (resourceCheckFunction.call(this, resources[i])) { + ++failingResources; + if (!topMessage) + topMessage = result.appendChild(messageText); + outputResources.push(resources[i].url); + } + } + if (topMessage) + topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources, true)); + if (failingResources) { + switch (severity) { + case this.FailCheck: + result.score = 0; + result.type = WebInspector.AuditRuleResult.Type.Violation; + break; + case this.SevereCheck: + case this.WarningCheck: + result.score -= 50 * severity * failingResources / resourceCount; + result.type = WebInspector.AuditRuleResult.Type.Hint; + break; + } + } + return topMessage; + }, + + freshnessLifetimeGreaterThan: function(resource, timeMs) + { + var dateHeader = this.responseHeader(resource, "Date"); + if (!dateHeader) + return false; + + var dateHeaderMs = Date.parse(dateHeader); + if (isNaN(dateHeaderMs)) + return false; + + var freshnessLifetimeMs; + var maxAgeMatch = this.responseHeaderMatch(resource, "Cache-Control", "max-age=(\\d+)"); + + if (maxAgeMatch) + freshnessLifetimeMs = (maxAgeMatch[1]) ? 1000 * maxAgeMatch[1] : 0; + else { + var expiresHeader = this.responseHeader(resource, "Expires"); + if (expiresHeader) { + var expDate = Date.parse(expiresHeader); + if (!isNaN(expDate)) + freshnessLifetimeMs = expDate - dateHeaderMs; + } + } + + return (isNaN(freshnessLifetimeMs)) ? false : freshnessLifetimeMs > timeMs; + }, + + responseHeader: function(resource, header) + { + return resource.responseHeaders[header]; + }, + + hasResponseHeader: function(resource, header) + { + return resource.responseHeaders[header] !== undefined; + }, + + isCompressible: function(resource) + { + return WebInspector.Resource.Type.isTextType(resource.type); + }, + + isPubliclyCacheable: function(resource) + { + if (this._isExplicitlyNonCacheable(resource)) + return false; + + if (this.responseHeaderMatch(resource, "Cache-Control", "public")) + return true; + + return resource.url.indexOf("?") == -1 && !this.responseHeaderMatch(resource, "Cache-Control", "private"); + }, + + responseHeaderMatch: function(resource, header, regexp) + { + return resource.responseHeaders[header] + ? resource.responseHeaders[header].match(new RegExp(regexp, "im")) + : undefined; + }, + + hasExplicitExpiration: function(resource) + { + return this.hasResponseHeader(resource, "Date") && + (this.hasResponseHeader(resource, "Expires") || this.responseHeaderMatch(resource, "Cache-Control", "max-age")); + }, + + _isExplicitlyNonCacheable: function(resource) + { + var hasExplicitExp = this.hasExplicitExpiration(resource); + return this.responseHeaderMatch(resource, "Cache-Control", "(no-cache|no-store|must-revalidate)") || + this.responseHeaderMatch(resource, "Pragma", "no-cache") || + (hasExplicitExp && !this.freshnessLifetimeGreaterThan(resource, 0)) || + (!hasExplicitExp && resource.url && resource.url.indexOf("?") >= 0) || + (!hasExplicitExp && !this.isCacheableResource(resource)); + }, + + isCacheableResource: function(resource) + { + return resource.statusCode !== undefined && WebInspector.AuditRules.CacheableResponseCodes[resource.statusCode]; + } +} + +WebInspector.AuditRules.CacheControlRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.BrowserCacheControlRule = function(parametersObject) +{ + WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching", parametersObject); +} + +WebInspector.AuditRules.BrowserCacheControlRule.prototype = { + handleNonCacheableResources: function(resources, result) + { + if (resources.length) { + var message = result.appendChild( + "The following resources are explicitly non-cacheable. Consider making them cacheable if possible:"); + var resourceOutput = []; + for (var i = 0; i < resources.length; ++i) + resourceOutput.push(resources[i].url); + message.appendChild(WebInspector.AuditRules.arrayAsUL(resourceOutput, true)); + } + }, + + runChecks: function(resources, result, callback) + { + this.execCheck( + "The following resources are missing a cache expiration." + + " Resources that do not specify an expiration may not be" + + " cached by browsers:", + this._missingExpirationCheck, resources, this.SevereCheck, result); + this.execCheck( + "The following resources specify a \"Vary\" header that" + + " disables caching in most versions of Internet Explorer:", + this._varyCheck, resources, this.SevereCheck, result); + this.execCheck( + "The following cacheable resources have a short" + + " freshness lifetime:", + this._oneMonthExpirationCheck, resources, this.WarningCheck, result); + + // Unable to implement the favicon check due to the WebKit limitations. + + this.execCheck( + "To further improve cache hit rate, specify an expiration" + + " one year in the future for the following cacheable" + + " resources:", + this._oneYearExpirationCheck, resources, this.InfoCheck, result); + }, + + _missingExpirationCheck: function(resource) + { + return this.isCacheableResource(resource) && !this.hasResponseHeader(resource, "Set-Cookie") && !this.hasExplicitExpiration(resource); + }, + + _varyCheck: function(resource) + { + var varyHeader = this.responseHeader(resource, "Vary"); + if (varyHeader) { + varyHeader = varyHeader.replace(/User-Agent/gi, ""); + varyHeader = varyHeader.replace(/Accept-Encoding/gi, ""); + varyHeader = varyHeader.replace(/[, ]*/g, ""); + } + return varyHeader && varyHeader.length && this.isCacheableResource(resource) && this.freshnessLifetimeGreaterThan(resource, 0); + }, + + _oneMonthExpirationCheck: function(resource) + { + return this.isCacheableResource(resource) && + !this.hasResponseHeader(resource, "Set-Cookie") && + !this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth) && + this.freshnessLifetimeGreaterThan(resource, 0); + }, + + _oneYearExpirationCheck: function(resource) + { + return this.isCacheableResource(resource) && + !this.hasResponseHeader(resource, "Set-Cookie") && + !this.freshnessLifetimeGreaterThan(resource, 11 * WebInspector.AuditRules.CacheControlRule.MillisPerMonth) && + this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth); + } +} + +WebInspector.AuditRules.BrowserCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype; + + +WebInspector.AuditRules.ProxyCacheControlRule = function(parametersObject) { + WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching", parametersObject); +} + +WebInspector.AuditRules.ProxyCacheControlRule.prototype = { + runChecks: function(resources, result, callback) + { + this.execCheck( + "Resources with a \"?\" in the URL are not cached by most" + + " proxy caching servers:", + this._questionMarkCheck, resources, this.WarningCheck, result); + this.execCheck( + "Consider adding a \"Cache-Control: public\" header to the" + + " following resources:", + this._publicCachingCheck, resources, this.InfoCheck, result); + this.execCheck( + "The following publicly cacheable resources contain" + + " a Set-Cookie header. This security vulnerability" + + " can cause cookies to be shared by multiple users.", + this._setCookieCacheableCheck, resources, this.FailCheck, result); + }, + + _questionMarkCheck: function(resource) + { + return resource.url.indexOf("?") >= 0 && !this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource); + }, + + _publicCachingCheck: function(resource) + { + return this.isCacheableResource(resource) && + !this.isCompressible(resource) && + !this.responseHeaderMatch(resource, "Cache-Control", "public") && + !this.hasResponseHeader(resource, "Set-Cookie"); + }, + + _setCookieCacheableCheck: function(resource) + { + return this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource); + } +} + +WebInspector.AuditRules.ProxyCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype; + + +WebInspector.AuditRules.ImageDimensionsRule = function(parametersObject) +{ + WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions", parametersObject); +} + +WebInspector.AuditRules.ImageDimensionsRule.prototype = { + doRun: function(resources, result, callback) + { + function evalCallback(evalResult, isException) + { + try { + if (isException) + return; + if (!evalResult || !evalResult.totalImages) + return; + result.score = 100; + var topMessage = result.appendChild( + "A width and height should be specified for all images in order to " + + "speed up page display. The following image(s) are missing a width and/or height:"); + var map = evalResult.map; + var outputResources = []; + for (var url in map) { + var value = WebInspector.linkifyURL(url); + if (map[url] > 1) + value += " (" + map[url] + " uses)"; + outputResources.push(value); + result.score -= this.getValue("ScorePerImageUse") * map[url]; + result.type = WebInspector.AuditRuleResult.Type.Hint; + } + topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputResources)); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } + + function routine() + { + var images = document.getElementsByTagName("img"); + const widthRegExp = /width[^:;]*:/gim; + const heightRegExp = /height[^:;]*:/gim; + + function hasDimension(element, cssText, rules, regexp, attributeName) { + if (element.attributes.getNamedItem(attributeName) != null || (cssText && cssText.match(regexp))) + return true; + + if (!rules) + return false; + for (var i = 0; i < rules.length; ++i) { + if (rules.item(i).style.cssText.match(regexp)) + return true; + } + return false; + } + + function hasWidth(element, cssText, rules) { + return hasDimension(element, cssText, rules, widthRegExp, "width"); + } + + function hasHeight(element, cssText, rules) { + return hasDimension(element, cssText, rules, heightRegExp, "height"); + } + + var urlToNoDimensionCount = {}; + var found = false; + for (var i = 0; i < images.length; ++i) { + var image = images[i]; + if (!image.src) + continue; + var position = document.defaultView.getComputedStyle(image).getPropertyValue("position"); + if (position === "absolute") + continue; + var cssText = (image.style && image.style.cssText) ? image.style.cssText : ""; + var rules = document.defaultView.getMatchedCSSRules(image, "", true); + if (!hasWidth(image, cssText, rules) || !hasHeight(image, cssText, rules)) { + found = true; + if (urlToNoDimensionCount.hasOwnProperty(image.src)) + ++urlToNoDimensionCount[image.src]; + else + urlToNoDimensionCount[image.src] = 1; + } + } + return found ? {totalImages: images.length, map: urlToNoDimensionCount} : null; + } + + WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this)); + } +} + +WebInspector.AuditRules.ImageDimensionsRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CssInHeadRule = function(parametersObject) +{ + WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head", parametersObject); +} + +WebInspector.AuditRules.CssInHeadRule.prototype = { + doRun: function(resources, result, callback) + { + function evalCallback(evalResult, isException) + { + try { + if (isException) + return; + if (!evalResult) + return; + result.score = 100; + var outputMessages = []; + for (var url in evalResult) { + var urlViolations = evalResult[url]; + var topMessage = result.appendChild( + String.sprintf("CSS in the %s document body adversely impacts rendering performance.", + WebInspector.linkifyURL(url))); + if (urlViolations[0]) { + outputMessages.push( + String.sprintf("%s style block(s) in the body should be moved to the document head.", urlViolations[0])); + result.score -= this.getValue("InlineURLScore") * urlViolations[0]; + } + for (var i = 0; i < urlViolations[1].length; ++i) { + outputMessages.push( + String.sprintf("Link node %s should be moved to the document head", WebInspector.linkifyURL(urlViolations[1]))); + } + result.score -= this.getValue("InlineStylesheetScore") * urlViolations[1]; + result.type = WebInspector.AuditRuleResult.Type.Hint; + } + topMessage.appendChild(WebInspector.AuditRules.arrayAsUL(outputMessages)); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } + + function routine() + { + function allViews() { + var views = [document.defaultView]; + var curView = 0; + while (curView < views.length) { + var view = views[curView]; + var frames = view.frames; + for (var i = 0; i < frames.length; ++i) { + if (frames[i] !== view) + views.push(frames[i]); + } + ++curView; + } + return views; + } + + var views = allViews(); + var urlToViolationsArray = {}; + var found = false; + for (var i = 0; i < views.length; ++i) { + var view = views[i]; + if (!view.document) + continue; + + var inlineStyles = view.document.querySelectorAll("body style"); + var inlineStylesheets = view.document.querySelectorAll( + "body link[rel~='stylesheet'][href]"); + if (!inlineStyles.length && !inlineStylesheets.length) + continue; + + found = true; + var inlineStylesheetHrefs = []; + for (var j = 0; j < inlineStylesheets.length; ++j) + inlineStylesheetHrefs.push(inlineStylesheets[j].href); + + urlToViolationsArray[view.location.href] = + [inlineStyles.length, inlineStylesheetHrefs]; + } + return found ? urlToViolationsArray : null; + } + + WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback); + } +} + +WebInspector.AuditRules.CssInHeadRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.StylesScriptsOrderRule = function(parametersObject) +{ + WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts", parametersObject); +} + +WebInspector.AuditRules.StylesScriptsOrderRule.prototype = { + doRun: function(resources, result, callback) + { + function evalCallback(evalResult, isException) + { + try { + if (isException) + return; + if (!evalResult) + return; + + result.score = 100; + var lateCssUrls = evalResult['late']; + if (lateCssUrls) { + var lateMessage = result.appendChild( + 'The following external CSS files were included after ' + + 'an external JavaScript file in the document head. To ' + + 'ensure CSS files are downloaded in parallel, always ' + + 'include external CSS before external JavaScript.'); + lateMessage.appendChild(WebInspector.AuditRules.arrayAsUL(lateCssUrls, true)); + result.score -= this.getValue("InlineBetweenResourcesScore") * lateCssUrls.length; + result.type = WebInspector.AuditRuleResult.Type.Violation; + } + if (evalResult['cssBeforeInlineCount']) { + var count = evalResult['cssBeforeInlineCount']; + result.appendChild(count + ' inline script block' + + (count > 1 ? 's were' : ' was') + ' found in the head between an ' + + 'external CSS file and another resource. To allow parallel ' + + 'downloading, move the inline script before the external CSS ' + + 'file, or after the next resource.'); + result.score -= this.getValue("CSSAfterJSURLScore") * count; + result.type = WebInspector.AuditRuleResult.Type.Violation; + } + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } + + function routine() + { + var lateStyles = document.querySelectorAll( + "head script[src] ~ link[rel~='stylesheet'][href]"); + var stylesBeforeInlineScript = document.querySelectorAll( + "head link[rel~='stylesheet'][href] ~ script:not([src])"); + + var resultObject; + if (!lateStyles.length && !stylesBeforeInlineScript.length) + resultObject = null; + else { + resultObject = {}; + if (lateStyles.length) { + lateStyleUrls = []; + for (var i = 0; i < lateStyles.length; ++i) + lateStyleUrls.push(lateStyles[i].href); + resultObject["late"] = lateStyleUrls; + } + resultObject["cssBeforeInlineCount"] = stylesBeforeInlineScript.length; + } + return resultObject; + } + + WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this)); + } +} + +WebInspector.AuditRules.StylesScriptsOrderRule.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CookieRuleBase = function(id, name, parametersObject) +{ + WebInspector.AuditRule.call(this, id, name, parametersObject); +} + +WebInspector.AuditRules.CookieRuleBase.prototype = { + doRun: function(resources, result, callback) + { + var self = this; + function resultCallback(receivedCookies, isAdvanced) { + try { + self.processCookies(isAdvanced ? receivedCookies : [], resources, result); + } catch(e) { + console.log(e); + } finally { + callback(result); + } + } + WebInspector.Cookies.getCookiesAsync(resultCallback); + }, + + mapResourceCookies: function(resourcesByDomain, allCookies, callback) + { + for (var i = 0; i < allCookies.length; ++i) { + for (var resourceDomain in resourcesByDomain) { + if (WebInspector.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain, resourceDomain)) + this._callbackForResourceCookiePairs(resourcesByDomain[resourceDomain], allCookies[i], callback); + } + } + }, + + _callbackForResourceCookiePairs: function(resources, cookie, callback) + { + if (!resources) + return; + for (var i = 0; i < resources.length; ++i) { + if (WebInspector.Cookies.cookieMatchesResourceURL(cookie, resources[i].url)) + callback(resources[i], cookie); + } + } +} + +WebInspector.AuditRules.CookieRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype; + + +WebInspector.AuditRules.CookieSizeRule = function(parametersObject) +{ + WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size", parametersObject); +} + +WebInspector.AuditRules.CookieSizeRule.prototype = { + _average: function(cookieArray) + { + var total = 0; + for (var i = 0; i < cookieArray.length; ++i) + total += cookieArray[i].size; + return cookieArray.length ? Math.round(total / cookieArray.length) : 0; + }, + + _max: function(cookieArray) + { + var result = 0; + for (var i = 0; i < cookieArray.length; ++i) + result = Math.max(cookieArray[i].size, result); + return result; + }, + + processCookies: function(allCookies, resources, result) + { + function maxSizeSorter(a, b) + { + return b.maxCookieSize - a.maxCookieSize; + } + + function avgSizeSorter(a, b) + { + return b.avgCookieSize - a.avgCookieSize; + } + + var cookiesPerResourceDomain = {}; + + function collectorCallback(resource, cookie) + { + var cookies = cookiesPerResourceDomain[resource.domain]; + if (!cookies) { + cookies = []; + cookiesPerResourceDomain[resource.domain] = cookies; + } + cookies.push(cookie); + } + + if (!allCookies.length) + return; + + var sortedCookieSizes = []; + + var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, + null, + WebInspector.URLRegExp, + true); + var matchingResourceData = {}; + this.mapResourceCookies(domainToResourcesMap, allCookies, collectorCallback.bind(this)); + + result.score = 100; + for (var resourceDomain in cookiesPerResourceDomain) { + var cookies = cookiesPerResourceDomain[resourceDomain]; + sortedCookieSizes.push({ + domain: resourceDomain, + avgCookieSize: this._average(cookies), + maxCookieSize: this._max(cookies) + }); + } + var avgAllCookiesSize = this._average(allCookies); + + var hugeCookieDomains = []; + sortedCookieSizes.sort(maxSizeSorter); + + var maxBytesThreshold = this.getValue("MaxBytesThreshold"); + var minBytesThreshold = this.getValue("MinBytesThreshold"); + + for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) { + var maxCookieSize = sortedCookieSizes[i].maxCookieSize; + if (maxCookieSize > maxBytesThreshold) + hugeCookieDomains.push(sortedCookieSizes[i].domain + ": " + Number.bytesToString(maxCookieSize)); + } + + var bigAvgCookieDomains = []; + sortedCookieSizes.sort(avgSizeSorter); + for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) { + var domain = sortedCookieSizes[i].domain; + var avgCookieSize = sortedCookieSizes[i].avgCookieSize; + if (avgCookieSize > minBytesThreshold && avgCookieSize < maxBytesThreshold) + bigAvgCookieDomains.push(domain + ": " + Number.bytesToString(avgCookieSize)); + } + result.appendChild("The average cookie size for all requests on this page is " + Number.bytesToString(avgAllCookiesSize)); + + var message; + if (hugeCookieDomains.length) { + result.score = 75; + result.type = WebInspector.AuditRuleResult.Type.Violation; + message = result.appendChild( + String.sprintf("The following domains have a cookie size in excess of %d " + + " bytes. This is harmful because requests with cookies larger than 1KB" + + " typically cannot fit into a single network packet.", maxBytesThreshold)); + message.appendChild(WebInspector.AuditRules.arrayAsUL(hugeCookieDomains)); + } + + if (bigAvgCookieDomains.length) { + this.score -= Math.max(0, avgAllCookiesSize - minBytesThreshold) / + (minBytesThreshold - minBytesThreshold) / this.getValue("TotalPoints"); + if (!result.type) + result.type = WebInspector.AuditRuleResult.Type.Hint; + message = result.appendChild( + String.sprintf("The following domains have an average cookie size in excess of %d" + + " bytes. Reducing the size of cookies" + + " for these domains can reduce the time it takes to send requests.", minBytesThreshold)); + message.appendChild(WebInspector.AuditRules.arrayAsUL(bigAvgCookieDomains)); + } + + if (!bigAvgCookieDomains.length && !hugeCookieDomains.length) + result.score = WebInspector.AuditCategoryResult.ScoreNA; + } +} + +WebInspector.AuditRules.CookieSizeRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype; + + +WebInspector.AuditRules.StaticCookielessRule = function(parametersObject) +{ + WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain", parametersObject); +} + +WebInspector.AuditRules.StaticCookielessRule.prototype = { + processCookies: function(allCookies, resources, result) + { + var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, + [WebInspector.Resource.Type.Stylesheet, + WebInspector.Resource.Type.Image], + WebInspector.URLRegExp, + true); + var totalStaticResources = 0; + var minResources = this.getValue("MinResources"); + for (var domain in domainToResourcesMap) + totalStaticResources += domainToResourcesMap[domain].length; + if (totalStaticResources < minResources) + return; + var matchingResourceData = {}; + this.mapResourceCookies(domainToResourcesMap, allCookies, this._collectorCallback.bind(this, matchingResourceData)); + + var badUrls = []; + var cookieBytes = 0; + for (var url in matchingResourceData) { + badUrls.push(url); + cookieBytes += matchingResourceData[url] + } + if (badUrls.length < minResources) + return; + + result.score = 100; + var badPoints = cookieBytes / 75; + var violationPct = Math.max(badUrls.length / totalStaticResources, 0.6); + badPoints *= violationPct; + result.score -= badPoints; + result.score = Math.max(result.score, 0); + result.type = WebInspector.AuditRuleResult.Type.Violation; + result.appendChild(String.sprintf("%s of cookies were sent with the following static resources.", Number.bytesToString(cookieBytes))); + var message = result.appendChild("Serve these static resources from a domain that does not set cookies:"); + message.appendChild(WebInspector.AuditRules.arrayAsUL(badUrls, true)); + }, + + _collectorCallback: function(matchingResourceData, resource, cookie) + { + matchingResourceData[resource.url] = (matchingResourceData[resource.url] || 0) + cookie.size; + } +} + +WebInspector.AuditRules.StaticCookielessRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js new file mode 100644 index 0000000..fcadb82 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/AuditsPanel.js @@ -0,0 +1,480 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.AuditsPanel = function() +{ + WebInspector.Panel.call(this); + + this._constructCategories(); + + this.createSidebar(); + this.auditsTreeElement = new WebInspector.SidebarSectionTreeElement("", {}, true); + this.sidebarTree.appendChild(this.auditsTreeElement); + this.auditsTreeElement.expand(); + + this.auditsItemTreeElement = new WebInspector.AuditsSidebarTreeElement(); + this.auditsTreeElement.appendChild(this.auditsItemTreeElement); + + this.auditResultsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESULTS"), {}, true); + this.sidebarTree.appendChild(this.auditResultsTreeElement); + this.auditResultsTreeElement.expand(); + + this.element.addStyleClass("audits"); + + this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-audit-results-status-bar-item"); + this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false); + + this.viewsContainerElement = document.createElement("div"); + this.viewsContainerElement.id = "audit-views"; + this.element.appendChild(this.viewsContainerElement); +} + +WebInspector.AuditsPanel.prototype = { + toolbarItemClass: "audits", + + get toolbarItemLabel() + { + return WebInspector.UIString("Audits"); + }, + + get statusBarItems() + { + return [this.clearResultsButton.element]; + }, + + get mainResourceLoadTime() + { + return this._mainResourceLoadTime; + }, + + set mainResourceLoadTime(x) + { + this._mainResourceLoadTime = x; + this._didMainResourceLoad(); + }, + + get mainResourceDOMContentTime() + { + return this._mainResourceDOMContentTime; + }, + + set mainResourceDOMContentTime(x) + { + this._mainResourceDOMContentTime = x; + }, + + get categoriesById() + { + return this._auditCategoriesById; + }, + + get visibleView() + { + return this._visibleView; + }, + + _constructCategories: function() + { + this._auditCategoriesById = {}; + for (var categoryCtorID in WebInspector.AuditCategories) { + var auditCategory = new WebInspector.AuditCategories[categoryCtorID](); + auditCategory._id = categoryCtorID; + this.categoriesById[categoryCtorID] = auditCategory; + } + }, + + _executeAudit: function(categories, resultCallback) + { + var resources = []; + for (var id in WebInspector.resources) + resources.push(WebInspector.resources[id]); + + var rulesRemaining = 0; + for (var i = 0; i < categories.length; ++i) + rulesRemaining += categories[i].ruleCount; + + var results = []; + var mainResourceURL = WebInspector.mainResource.url; + + function ruleResultReadyCallback(categoryResult, ruleResult) + { + if (ruleResult.children) + categoryResult.entries.push(ruleResult); + + --rulesRemaining; + + if (!rulesRemaining && resultCallback) + resultCallback(mainResourceURL, results); + } + + if (!rulesRemaining) { + resultCallback(mainResourceURL, results); + return; + } + + for (var i = 0; i < categories.length; ++i) { + var category = categories[i]; + var result = new WebInspector.AuditCategoryResult(category); + results.push(result); + category.runRules(resources, ruleResultReadyCallback.bind(null, result)); + } + }, + + _auditFinishedCallback: function(launcherCallback, mainResourceURL, results) + { + var children = this.auditResultsTreeElement.children; + var ordinal = 1; + for (var i = 0; i < children.length; ++i) { + if (children[i].mainResourceURL === mainResourceURL) + ordinal++; + } + + var resultTreeElement = new WebInspector.AuditResultSidebarTreeElement(results, mainResourceURL, ordinal); + this.auditResultsTreeElement.appendChild(resultTreeElement); + resultTreeElement.reveal(); + resultTreeElement.select(); + if (launcherCallback) + launcherCallback(); + }, + + initiateAudit: function(categoryIds, runImmediately, launcherCallback) + { + if (!categoryIds || !categoryIds.length) + return; + + var categories = []; + for (var i = 0; i < categoryIds.length; ++i) + categories.push(this.categoriesById[categoryIds[i]]); + + function initiateAuditCallback(categories, launcherCallback) + { + this._executeAudit(categories, this._auditFinishedCallback.bind(this, launcherCallback)); + } + + if (runImmediately) + initiateAuditCallback.call(this, categories, launcherCallback); + else + this._reloadResources(initiateAuditCallback.bind(this, categories, launcherCallback)); + }, + + _reloadResources: function(callback) + { + this._resourceTrackingCallback = callback; + + if (!InspectorBackend.resourceTrackingEnabled()) { + InspectorBackend.enableResourceTracking(false); + this._updateLauncherViewControls(true); + } else + InjectedScriptAccess.getDefault().evaluate("window.location.reload()", switchCallback); + }, + + _didMainResourceLoad: function() + { + if (this._resourceTrackingCallback) { + var callback = this._resourceTrackingCallback; + this._resourceTrackingCallback = null; + callback(); + } + }, + + showResults: function(categoryResults) + { + if (!categoryResults._resultView) + categoryResults._resultView = new WebInspector.AuditResultView(categoryResults); + + this.showView(categoryResults._resultView); + }, + + showLauncherView: function() + { + if (!this._launcherView) + this._launcherView = new WebInspector.AuditLauncherView(this.categoriesById, this.initiateAudit.bind(this)); + + this.showView(this._launcherView); + }, + + showView: function(view) + { + if (view) { + if (this._visibleView === view) + return; + this._closeVisibleView(); + this._visibleView = view; + } + var visibleView = this.visibleView; + if (visibleView) + visibleView.show(this.viewsContainerElement); + }, + + show: function() + { + WebInspector.Panel.prototype.show.call(this); + + this.showView(); + this._updateLauncherViewControls(InspectorBackend.resourceTrackingEnabled()); + }, + + attach: function() + { + WebInspector.Panel.prototype.attach.call(this); + + this.auditsItemTreeElement.select(); + }, + + updateMainViewWidth: function(width) + { + this.viewsContainerElement.style.left = width + "px"; + }, + + _updateLauncherViewControls: function(isTracking) + { + if (this._launcherView) + this._launcherView.updateResourceTrackingState(isTracking); + }, + + _clearButtonClicked: function() + { + this.auditsItemTreeElement.reveal(); + this.auditsItemTreeElement.select(); + this.auditResultsTreeElement.removeChildren(); + }, + + _closeVisibleView: function() + { + if (this.visibleView) + this.visibleView.hide(); + } +} + +WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype; + + + +WebInspector.AuditCategory = function(displayName) +{ + this._displayName = displayName; + this._rules = []; +} + +WebInspector.AuditCategory.prototype = { + get id() + { + // this._id value is injected at construction time. + return this._id; + }, + + get displayName() + { + return this._displayName; + }, + + get ruleCount() + { + this._ensureInitialized(); + return this._rules.length; + }, + + addRule: function(rule) + { + this._rules.push(rule); + }, + + runRules: function(resources, callback) + { + this._ensureInitialized(); + for (var i = 0; i < this._rules.length; ++i) + this._rules[i].run(resources, callback); + }, + + _ensureInitialized: function() + { + if (!this._initialized) { + if ("initialize" in this) + this.initialize(); + this._initialized = true; + } + } +} + + +WebInspector.AuditRule = function(id, displayName, parametersObject) +{ + this._id = id; + this._displayName = displayName; + this._parametersObject = parametersObject; +} + +WebInspector.AuditRule.prototype = { + get id() + { + return this._id; + }, + + get displayName() + { + return this._displayName; + }, + + run: function(resources, callback) + { + this.doRun(resources, new WebInspector.AuditRuleResult(this.displayName), callback); + }, + + doRun: function(resources, result, callback) + { + throw new Error("doRun() not implemented"); + }, + + getValue: function(key) + { + if (key in this._parametersObject) + return this._parametersObject[key]; + else + throw new Error(key + " not found in rule parameters"); + } +} + + +WebInspector.AuditCategoryResult = function(category) +{ + this.title = category.displayName; + this.entries = []; +} + +WebInspector.AuditCategoryResult.prototype = { + addEntry: function(value) + { + var entry = new WebInspector.AuditRuleResult(value); + this.entries.push(entry); + return entry; + } +} + +/** + * @param {string} value The result message HTML contents. + */ +WebInspector.AuditRuleResult = function(value) +{ + this.value = value; + this.type = WebInspector.AuditRuleResult.Type.NA; +} + +WebInspector.AuditRuleResult.Type = { + // Does not denote a discovered flaw but rather represents an informational message. + NA: 0, + + // Denotes a minor impact on the checked metric. + Hint: 1, + + // Denotes a major impact on the checked metric. + Violation: 2 +} + +WebInspector.AuditRuleResult.prototype = { + appendChild: function(value) + { + if (!this.children) + this.children = []; + var entry = new WebInspector.AuditRuleResult(value); + this.children.push(entry); + return entry; + }, + + set type(x) + { + this._type = x; + }, + + get type() + { + return this._type; + } +} + + +WebInspector.AuditsSidebarTreeElement = function() +{ + this.small = false; + + WebInspector.SidebarTreeElement.call(this, "audits-sidebar-tree-item", WebInspector.UIString("Audits"), "", null, false); +} + +WebInspector.AuditsSidebarTreeElement.prototype = { + onattach: function() + { + WebInspector.SidebarTreeElement.prototype.onattach.call(this); + }, + + onselect: function() + { + WebInspector.panels.audits.showLauncherView(); + }, + + get selectable() + { + return true; + }, + + refresh: function() + { + this.refreshTitles(); + } +} + +WebInspector.AuditsSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + + +WebInspector.AuditResultSidebarTreeElement = function(results, mainResourceURL, ordinal) +{ + this.results = results; + this.mainResourceURL = mainResourceURL; + + WebInspector.SidebarTreeElement.call(this, "audit-result-sidebar-tree-item", String.sprintf("%s (%d)", mainResourceURL, ordinal), "", {}, false); +} + +WebInspector.AuditResultSidebarTreeElement.prototype = { + onselect: function() + { + WebInspector.panels.audits.showResults(this.results); + }, + + get selectable() + { + return true; + } +} + +WebInspector.AuditResultSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + +// Contributed audit rules should go into this namespace. +WebInspector.AuditRules = {}; + +// Contributed audit categories should go into this namespace. +WebInspector.AuditCategories = {}; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js b/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js index 41a8a3a..5aaae0c 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js @@ -31,11 +31,7 @@ WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree) { - // In bottom up mode, our parents are our children since we display an inverted tree. - // However, we don't want to show the very top parent since it is redundant. - var hasChildren = !!(profileNode.parent && profileNode.parent.parent); - - WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren); + WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode)); this._remainingNodeInfos = []; } @@ -78,6 +74,14 @@ WebInspector.BottomUpProfileDataGridNode.prototype = { this._merge(child, true); }, + _restore: function() + { + WebInspector.ProfileDataGridNode.prototype._restore(); + + if (!this.children.length) + this.hasChildren = this._willHaveChildren(); + }, + _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb) { this.selfTime -= child.selfTime; @@ -128,6 +132,14 @@ WebInspector.BottomUpProfileDataGridNode.prototype = { } delete this._remainingNodeInfos; + }, + + _willHaveChildren: function(profileNode) + { + profileNode = profileNode || this.profileNode; + // In bottom up mode, our parents are our children since we display an inverted tree. + // However, we don't want to show the very top parent since it is redundant. + return !!(profileNode.parent && profileNode.parent.parent); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Breakpoint.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Breakpoint.js index 292975a..5d46cc9 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Breakpoint.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Breakpoint.js @@ -89,7 +89,7 @@ WebInspector.Breakpoint.prototype = { this.dispatchEventToListeners("condition-changed"); if (this.enabled) - InspectorController.updateBreakpoint(this.sourceID, this.line, c); + InspectorBackend.updateBreakpoint(this.sourceID, this.line, c); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/src/3rdparty/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js index e6edece..8865f0b 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js @@ -58,21 +58,24 @@ WebInspector.BreakpointsSidebarPane.prototype = { this.bodyElement.appendChild(this.listElement); } - if (!InspectorController.debuggerEnabled() || !breakpoint.sourceID) + if (!InspectorBackend.debuggerEnabled() || !breakpoint.sourceID) return; if (breakpoint.enabled) - InspectorController.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition); + InspectorBackend.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition); }, _appendBreakpointElement: function(breakpoint) { - function checkboxClicked() + function checkboxClicked(event) { breakpoint.enabled = !breakpoint.enabled; + + // without this, we'd switch to the source of the clicked breakpoint + event.stopPropagation(); } - function labelClicked() + function breakpointClicked() { var script = WebInspector.panels.scripts.scriptOrResourceForID(breakpoint.sourceID); if (script) @@ -82,6 +85,7 @@ WebInspector.BreakpointsSidebarPane.prototype = { var breakpointElement = document.createElement("li"); breakpoint._breakpointListElement = breakpointElement; breakpointElement._breakpointObject = breakpoint; + breakpointElement.addEventListener("click", breakpointClicked, false); var checkboxElement = document.createElement("input"); checkboxElement.className = "checkbox-elem"; @@ -90,14 +94,12 @@ WebInspector.BreakpointsSidebarPane.prototype = { checkboxElement.addEventListener("click", checkboxClicked, false); breakpointElement.appendChild(checkboxElement); - var labelElement = document.createElement("a"); - labelElement.textContent = breakpoint.label; - labelElement.addEventListener("click", labelClicked, false); + var labelElement = document.createTextNode(breakpoint.label); breakpointElement.appendChild(labelElement); var sourceTextElement = document.createElement("div"); sourceTextElement.textContent = breakpoint.sourceText; - sourceTextElement.className = "source-text"; + sourceTextElement.className = "source-text monospace"; breakpointElement.appendChild(sourceTextElement); var currentElement = this.listElement.firstChild; @@ -133,10 +135,10 @@ WebInspector.BreakpointsSidebarPane.prototype = { this.bodyElement.appendChild(this.emptyElement); } - if (!InspectorController.debuggerEnabled() || !breakpoint.sourceID) + if (!InspectorBackend.debuggerEnabled() || !breakpoint.sourceID) return; - InspectorController.removeBreakpoint(breakpoint.sourceID, breakpoint.line); + InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line); }, _breakpointEnableChanged: function(event) @@ -146,13 +148,13 @@ WebInspector.BreakpointsSidebarPane.prototype = { var checkbox = breakpoint._breakpointListElement.firstChild; checkbox.checked = breakpoint.enabled; - if (!InspectorController.debuggerEnabled() || !breakpoint.sourceID) + if (!InspectorBackend.debuggerEnabled() || !breakpoint.sourceID) return; if (breakpoint.enabled) - InspectorController.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition); + InspectorBackend.addBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.condition); else - InspectorController.removeBreakpoint(breakpoint.sourceID, breakpoint.line); + InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line); }, _breakpointTextChanged: function(event) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js b/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js index 2fe4315..ddca80b4 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/CallStackSidebarPane.js @@ -109,13 +109,12 @@ WebInspector.CallStackSidebarPane.prototype = { this.dispatchEventToListeners("call frame selected"); }, - handleKeyEvent: function(event) + handleShortcut: function(event) { var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); var handler = this._shortcuts[shortcut]; if (handler) { handler(event); - event.preventDefault(); event.handled = true; } }, diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js new file mode 100644 index 0000000..6dbc558 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsolePanel.js @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2009 Joseph Pecoraro + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.ConsolePanel = function() +{ + WebInspector.Panel.call(this); +} + +WebInspector.ConsolePanel.prototype = { + toolbarItemClass: "console", + + get toolbarItemLabel() + { + return WebInspector.UIString("Console"); + }, + + show: function() + { + WebInspector.Panel.prototype.show.call(this); + + this._previousConsoleState = WebInspector.drawer.state; + WebInspector.drawer.enterPanelMode(); + WebInspector.showConsole(); + + // Move the scope bar to the top of the messages, like the resources filter. + var scopeBar = document.getElementById("console-filter"); + var consoleMessages = document.getElementById("console-messages"); + + scopeBar.parentNode.removeChild(scopeBar); + document.getElementById("console-view").insertBefore(scopeBar, consoleMessages); + + // Update styles, and give console-messages a top margin so it doesn't overwrite the scope bar. + scopeBar.addStyleClass("console-filter-top"); + scopeBar.removeStyleClass("status-bar-item"); + + consoleMessages.addStyleClass("console-filter-top"); + }, + + hide: function() + { + WebInspector.Panel.prototype.hide.call(this); + + if (this._previousConsoleState === WebInspector.Drawer.State.Hidden) + WebInspector.drawer.immediatelyExitPanelMode(); + else + WebInspector.drawer.exitPanelMode(); + delete this._previousConsoleState; + + // Move the scope bar back to the bottom bar, next to Clear Console. + var scopeBar = document.getElementById("console-filter"); + + scopeBar.parentNode.removeChild(scopeBar); + document.getElementById("other-drawer-status-bar-items").appendChild(scopeBar); + + // Update styles, and remove the top margin on console-messages. + scopeBar.removeStyleClass("console-filter-top"); + scopeBar.addStyleClass("status-bar-item"); + + document.getElementById("console-messages").removeStyleClass("console-filter-top"); + } +} + +WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js index 9317824..07d9812 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ConsoleView.js @@ -45,7 +45,8 @@ WebInspector.ConsoleView = function(drawer) this.messagesElement.addEventListener("click", this._messagesClicked.bind(this), true); this.promptElement = document.getElementById("console-prompt"); - this.promptElement.handleKeyEvent = this._promptKeyDown.bind(this); + this.promptElement.className = "source-code"; + this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true); this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + "."); this.topGroup = new WebInspector.ConsoleGroup(null, 0); @@ -57,51 +58,67 @@ WebInspector.ConsoleView = function(drawer) this.toggleConsoleButton.title = WebInspector.UIString("Show console."); this.toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false); - var anchoredStatusBar = document.getElementById("anchored-status-bar-items"); - anchoredStatusBar.appendChild(this.toggleConsoleButton); - // Will hold the list of filter elements this.filterBarElement = document.getElementById("console-filter"); - + function createDividerElement() { var dividerElement = document.createElement("div"); - dividerElement.addStyleClass("divider"); - this.filterBarElement.appendChild(dividerElement); } - + + var updateFilterHandler = this._updateFilter.bind(this); function createFilterElement(category) { var categoryElement = document.createElement("li"); categoryElement.category = category; - - categoryElement.addStyleClass(categoryElement.category); - + categoryElement.addStyleClass(categoryElement.category); + categoryElement.addEventListener("click", updateFilterHandler, false); + var label = category.toString(); categoryElement.appendChild(document.createTextNode(label)); - - categoryElement.addEventListener("click", this._updateFilter.bind(this), false); - + this.filterBarElement.appendChild(categoryElement); return categoryElement; } this.allElement = createFilterElement.call(this, "All"); - createDividerElement.call(this); - this.errorElement = createFilterElement.call(this, "Errors"); this.warningElement = createFilterElement.call(this, "Warnings"); this.logElement = createFilterElement.call(this, "Logs"); this.filter(this.allElement, false); + + this._shortcuts = {}; + + var shortcut; + var clearConsoleHandler = this.requestClearMessages.bind(this); + + shortcut = WebInspector.KeyboardShortcut.makeKey("k", WebInspector.KeyboardShortcut.Modifiers.Meta); + this._shortcuts[shortcut] = clearConsoleHandler; + this._shortcuts[shortcut].isMacOnly = true; + shortcut = WebInspector.KeyboardShortcut.makeKey("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); + this._shortcuts[shortcut] = clearConsoleHandler; + + // Since the Context Menu for the Console View will always be the same, we can create it in + // the constructor. + this._contextMenu = new WebInspector.ContextMenu(); + this._contextMenu.appendItem(WebInspector.UIString("Clear Console"), clearConsoleHandler); + this.messagesElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); + + this._customFormatters = { + "object": this._formatobject, + "array": this._formatarray, + "node": this._formatnode, + "string": this._formatstring + }; } WebInspector.ConsoleView.prototype = { _updateFilter: function(e) { - var isMac = InspectorController.platform().indexOf("mac-") === 0; + var isMac = WebInspector.isMac(); var selectMultiple = false; if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) selectMultiple = true; @@ -242,7 +259,8 @@ WebInspector.ConsoleView.prototype = { this.promptElement.scrollIntoView(false); }, - updateMessageRepeatCount: function(count) { + updateMessageRepeatCount: function(count) + { var msg = this.previousMessage; var prevRepeatCount = msg.totalRepeatCount; @@ -260,7 +278,8 @@ WebInspector.ConsoleView.prototype = { } }, - _incrementErrorWarningCount: function(msg) { + _incrementErrorWarningCount: function(msg) + { switch (msg.level) { case WebInspector.ConsoleMessage.MessageLevel.Warning: WebInspector.warnings += msg.repeatDelta; @@ -271,10 +290,13 @@ WebInspector.ConsoleView.prototype = { } }, - clearMessages: function(clearInspectorController) + requestClearMessages: function() + { + InjectedScriptAccess.getDefault().clearConsoleMessages(function() {}); + }, + + clearMessages: function() { - if (clearInspectorController) - InspectorController.clearMessages(false); if (WebInspector.panels.resources) WebInspector.panels.resources.clearMessages(); @@ -312,9 +334,14 @@ WebInspector.ConsoleView.prototype = { // Collect comma separated object properties for the completion. var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); - if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) - var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); - InjectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); + var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); + var injectedScriptAccess; + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { + var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame; + injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.injectedScriptId); + } else + injectedScriptAccess = InjectedScriptAccess.getDefault(); + injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); }, _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { @@ -357,7 +384,18 @@ WebInspector.ConsoleView.prototype = { _clearButtonClicked: function() { - this.clearMessages(true); + this.requestClearMessages(); + }, + + _handleContextMenuEvent: function(event) + { + if (!window.getSelection().isCollapsed) { + // If there is a selection, we want to show our normal context menu + // (with Copy, etc.), and not Clear Console. + return; + } + + this._contextMenu.show(event); }, _messagesSelectStart: function(event) @@ -396,7 +434,15 @@ WebInspector.ConsoleView.prototype = { return; } - this.prompt.handleKeyEvent(event); + var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); + var handler = this._shortcuts[shortcut]; + if (handler) { + if (!this._shortcuts[shortcut].isMacOnly || WebInspector.isMac()) { + handler(); + event.preventDefault(); + return; + } + } }, evalInInspectedWindow: function(expression, objectGroup, callback) @@ -419,7 +465,7 @@ WebInspector.ConsoleView.prototype = { { callback(result.value, result.isException); }; - InjectedScriptAccess.evaluate(expression, objectGroup, evalCallback); + InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback); }, _enterKeyPressed: function(event) @@ -453,44 +499,17 @@ WebInspector.ConsoleView.prototype = { _format: function(output, forceObjectFormat) { var isProxy = (output != null && typeof output === "object"); + var type = (forceObjectFormat ? "object" : Object.proxyType(output)); - if (forceObjectFormat) - var type = "object"; - else - var type = Object.proxyType(output); - - if (isProxy && type !== "object" && type !== "function" && type !== "array" && type !== "node") { - // Unwrap primitive value, skip decoration. - output = output.description; - type = "undecorated" - } - - // We don't perform any special formatting on these types, so we just - // pass them through the simple _formatvalue function. - var undecoratedTypes = { - "undefined": 1, - "null": 1, - "boolean": 1, - "number": 1, - "undecorated": 1 - }; - - var formatter; - if (forceObjectFormat) - formatter = "_formatobject"; - else if (type in undecoratedTypes) - formatter = "_formatvalue"; - else { - formatter = "_format" + type; - if (!(formatter in this)) { - formatter = "_formatobject"; - type = "object"; - } + var formatter = this._customFormatters[type]; + if (!formatter || !isProxy) { + formatter = this._formatvalue; + output = output.description || output; } var span = document.createElement("span"); - span.addStyleClass("console-formatted-" + type); - this[formatter](output, span); + span.className = "console-formatted-" + type + " source-code"; + formatter.call(this, output, span); return span; }, @@ -499,36 +518,52 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode(val)); }, - _formatfunction: function(func, elem) + _formatobject: function(obj, elem) { - elem.appendChild(document.createTextNode(func.description)); + elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element); }, - _formatdate: function(date, elem) + _formatnode: function(object, elem) { - elem.appendChild(document.createTextNode(date)); - }, + function printNode(nodeId) + { + if (!nodeId) + return; + var treeOutline = new WebInspector.ElementsTreeOutline(); + treeOutline.showInElementsPanelEnabled = true; + treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); + treeOutline.element.addStyleClass("outline-disclosure"); + if (!treeOutline.children[0].hasChildren) + treeOutline.element.addStyleClass("single-node"); + elem.appendChild(treeOutline.element); + } - _formatstring: function(str, elem) - { - elem.appendChild(document.createTextNode("\"" + str + "\"")); + InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode); }, - _formatregexp: function(re, elem) + _formatarray: function(arr, elem) { - var formatted = String(re.description).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); - elem.appendChild(document.createTextNode(formatted)); + InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem)); }, - _formatarray: function(arr, elem) + _formatstring: function(output, elem) { - InjectedScriptAccess.getProperties(arr, false, this._printArray.bind(this, elem)); + var span = document.createElement("span"); + span.className = "console-formatted-string source-code"; + span.appendChild(WebInspector.linkifyStringAsFragment(output.description)); + + // Make black quotes. + elem.removeStyleClass("console-formatted-string"); + elem.appendChild(document.createTextNode("\"")); + elem.appendChild(span); + elem.appendChild(document.createTextNode("\"")); }, _printArray: function(elem, properties) { if (!properties) return; + var elements = []; for (var i = 0; i < properties.length; ++i) { var name = properties[i].name; @@ -547,53 +582,6 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode(", ")); } elem.appendChild(document.createTextNode("]")); - }, - - _formatnode: function(object, elem) - { - function printNode(nodeId) - { - if (!nodeId) - return; - var treeOutline = new WebInspector.ElementsTreeOutline(); - treeOutline.showInElementsPanelEnabled = true; - treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); - treeOutline.element.addStyleClass("outline-disclosure"); - if (!treeOutline.children[0].hasChildren) - treeOutline.element.addStyleClass("single-node"); - elem.appendChild(treeOutline.element); - } - InjectedScriptAccess.pushNodeToFrontend(object, printNode); - }, - - _formatobject: function(obj, elem) - { - elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element); - }, - - _formaterror: function(obj, elem) - { - var messageElement = document.createElement("span"); - messageElement.className = "error-message"; - messageElement.textContent = obj.name + ": " + obj.message; - elem.appendChild(messageElement); - - if (obj.sourceURL) { - var urlElement = document.createElement("a"); - urlElement.className = "webkit-html-resource-link"; - urlElement.href = obj.sourceURL; - urlElement.lineNumber = obj.line; - urlElement.preferredPanel = "scripts"; - - if (obj.line > 0) - urlElement.textContent = WebInspector.displayNameForURL(obj.sourceURL) + ":" + obj.line; - else - urlElement.textContent = WebInspector.displayNameForURL(obj.sourceURL); - - elem.appendChild(document.createTextNode(" (")); - elem.appendChild(urlElement); - elem.appendChild(document.createTextNode(")")); - } } } @@ -621,7 +609,7 @@ WebInspector.ConsoleMessage.prototype = { switch (this.type) { case WebInspector.ConsoleMessage.MessageType.Trace: var span = document.createElement("span"); - span.addStyleClass("console-formatted-trace"); + span.className = "console-formatted-trace source-code"; var stack = Array.prototype.slice.call(args); var funcNames = stack.map(function(f) { return f || WebInspector.UIString("(anonymous function)"); @@ -648,69 +636,75 @@ WebInspector.ConsoleMessage.prototype = { _format: function(parameters) { + // This node is used like a Builder. Values are continually appended onto it. var formattedResult = document.createElement("span"); - if (!parameters.length) return formattedResult; // Formatting code below assumes that parameters are all wrappers whereas frontend console - // API allows passing arbitrary values as messages (strings, numberts, etc.). Wrap them here. - for (var i = 0; i < parameters.length; ++i) { + // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here. + for (var i = 0; i < parameters.length; ++i) if (typeof parameters[i] !== "object" && typeof parameters[i] !== "function") parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]); - } - - function formatForConsole(obj) - { - return WebInspector.console._format(obj); - } - function formatAsObjectForConsole(obj) - { - return WebInspector.console._format(obj, true); - } + // There can be string log and string eval result. We distinguish between them based on message type. + var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result; - if (Object.proxyType(parameters[0]) === "string") { - var formatters = {} - for (var i in String.standardFormatters) - formatters[i] = String.standardFormatters[i]; - - // Firebug uses %o for formatting objects. - formatters.o = formatForConsole; - // Firebug allows both %i and %d for formatting integers. - formatters.i = formatters.d; - // Support %O to force object formating, instead of the type-based %o formatting. - formatters.O = formatAsObjectForConsole; - - function append(a, b) - { - if (!(b instanceof Node)) - a.appendChild(WebInspector.linkifyStringAsFragment(b.toString())); - else - a.appendChild(b); - return a; - } - - var result = String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append); - formattedResult = result.formattedResult; + // Multiple parameters with the first being a format string. Save unused substitutions. + if (shouldFormatMessage) { + // Multiple parameters with the first being a format string. Save unused substitutions. + var result = this._formatWithSubstitutionString(parameters, formattedResult); parameters = result.unusedSubstitutions; if (parameters.length) formattedResult.appendChild(document.createTextNode(" ")); } + // Single parameter, or unused substitutions from above. for (var i = 0; i < parameters.length; ++i) { - if (Object.proxyType(parameters[i]) === "string") - formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i].description)); + // Inline strings when formatting. + if (shouldFormatMessage && parameters[i].type === "string") + formattedResult.appendChild(document.createTextNode(parameters[i].description)); else - formattedResult.appendChild(formatForConsole(parameters[i])); - + formattedResult.appendChild(WebInspector.console._format(parameters[i])); if (i < parameters.length - 1) formattedResult.appendChild(document.createTextNode(" ")); } - return formattedResult; }, + _formatWithSubstitutionString: function(parameters, formattedResult) + { + var formatters = {} + for (var i in String.standardFormatters) + formatters[i] = String.standardFormatters[i]; + + function consoleFormatWrapper(force) + { + return function(obj) { + return WebInspector.console._format(obj, force); + }; + } + + // Firebug uses %o for formatting objects. + formatters.o = consoleFormatWrapper(); + // Firebug allows both %i and %d for formatting integers. + formatters.i = formatters.d; + // Support %O to force object formatting, instead of the type-based %o formatting. + formatters.O = consoleFormatWrapper(true); + + function append(a, b) + { + if (!(b instanceof Node)) + a.appendChild(WebInspector.linkifyStringAsFragment(b.toString())); + else + a.appendChild(b); + return a; + } + + // String.format does treat formattedResult like a Builder, result is an object. + return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append); + }, + toMessageElement: function() { if (this._element) @@ -788,7 +782,7 @@ WebInspector.ConsoleMessage.prototype = { } var messageTextElement = document.createElement("span"); - messageTextElement.className = "console-message-text"; + messageTextElement.className = "console-message-text source-code"; if (this.type === WebInspector.ConsoleMessage.MessageType.Assert) messageTextElement.appendChild(document.createTextNode(WebInspector.UIString("Assertion failed: "))); messageTextElement.appendChild(this.formattedMessage); @@ -855,6 +849,9 @@ WebInspector.ConsoleMessage.prototype = { case WebInspector.ConsoleMessage.MessageType.Assert: typeString = "Assert"; break; + case WebInspector.ConsoleMessage.MessageType.Result: + typeString = "Result"; + break; } var levelString; @@ -911,7 +908,8 @@ WebInspector.ConsoleMessage.MessageType = { Trace: 2, StartGroup: 3, EndGroup: 4, - Assert: 5 + Assert: 5, + Result: 6 } WebInspector.ConsoleMessage.MessageLevel = { @@ -935,7 +933,7 @@ WebInspector.ConsoleCommand.prototype = { element.className = "console-user-command"; var commandTextElement = document.createElement("span"); - commandTextElement.className = "console-message-text"; + commandTextElement.className = "console-message-text source-code"; commandTextElement.textContent = this.command; element.appendChild(commandTextElement); @@ -955,12 +953,17 @@ WebInspector.ConsoleCommandResult = function(result, exception, originatingComma { var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); var message = result; + if (exception) { + // Distinguish between strings and errors (no need to quote latter). + message = WebInspector.ObjectProxy.wrapPrimitiveValue(result); + message.type = "error"; + } var line = (exception ? result.line : -1); var url = (exception ? result.sourceURL : null); - WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, line, url, null, 1, message); - this.originatingCommand = originatingCommand; + + WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, message); } WebInspector.ConsoleCommandResult.prototype = { diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js new file mode 100644 index 0000000..3cdb152 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ContextMenu.js @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.ContextMenu = function() { + this._items = []; + this._handlers = {}; +} + +WebInspector.ContextMenu.prototype = { + show: function(event) + { + // Remove trailing separator. + while (this._items.length > 0 && !("id" in this._items[this._items.length - 1])) + this._items.splice(this._items.length - 1, 1); + + if (this._items.length) { + WebInspector._contextMenu = this; + InspectorFrontendHost.showContextMenu(event, this._items); + } + }, + + appendItem: function(label, handler) + { + var id = this._items.length; + this._items.push({id: id, label: label}); + this._handlers[id] = handler; + }, + + appendSeparator: function() + { + // No separator dupes allowed. + if (this._items.length === 0) + return; + if (!("id" in this._items[this._items.length - 1])) + return; + this._items.push({}); + }, + + _itemSelected: function(id) + { + if (this._handlers[id]) + this._handlers[id].call(this); + } +} + +WebInspector.contextMenuItemSelected = function(id) +{ + if (WebInspector._contextMenu) + WebInspector._contextMenu._itemSelected(id); +} + +WebInspector.contextMenuCleared = function() +{ + // FIXME: Unfortunately, contextMenuCleared is invoked between show and item selected + // so we can't delete last menu object from WebInspector. Fix the contract. +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/CookieItemsView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/CookieItemsView.js index 9f9845c..b5674b8 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/CookieItemsView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/CookieItemsView.js @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.CookieItemsView = function(cookieDomain) +WebInspector.CookieItemsView = function(treeElement, cookieDomain) { WebInspector.View.call(this); @@ -41,7 +41,13 @@ WebInspector.CookieItemsView = function(cookieDomain) this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); + this._treeElement = treeElement; this._cookieDomain = cookieDomain; + + this._emptyMsgElement = document.createElement("div"); + this._emptyMsgElement.className = "storage-table-empty"; + this._emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); + this.element.appendChild(this._emptyMsgElement); } WebInspector.CookieItemsView.prototype = { @@ -53,7 +59,7 @@ WebInspector.CookieItemsView.prototype = { show: function(parentElement) { WebInspector.View.prototype.show.call(this, parentElement); - this.update(); + this._update(); }, hide: function() @@ -62,194 +68,211 @@ WebInspector.CookieItemsView.prototype = { this.deleteButton.visible = false; }, - update: function() + _update: function() + { + WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this)); + }, + + _updateWithCookies: function(allCookies, isAdvanced) { - this.element.removeChildren(); - - var self = this; - function callback(cookies, isAdvanced) { - var dataGrid = (isAdvanced ? self.dataGridForCookies(cookies) : self.simpleDataGridForCookies(cookies)); - if (dataGrid) { - self._dataGrid = dataGrid; - self.element.appendChild(dataGrid.element); - self._dataGrid.updateWidths(); - if (isAdvanced) - self.deleteButton.visible = true; + if (isAdvanced) + this._filterCookiesForDomain(allCookies); + else + this._cookies = allCookies; + + if (!this._cookies.length) { + // Nothing to show. + this._emptyMsgElement.removeStyleClass("hidden"); + this.deleteButton.visible = false; + if (this._dataGrid) + this._dataGrid.element.addStyleClass("hidden"); + return; + } + + if (!this._dataGrid) { + if (isAdvanced) { + this._createDataGrid(); + this._populateDataGrid(); + this._dataGrid.autoSizeColumns(6, 33); + this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length, + Number.bytesToString(this._totalSize, WebInspector.UIString)); } else { - var emptyMsgElement = document.createElement("div"); - emptyMsgElement.className = "storage-table-empty"; - emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); - self.element.appendChild(emptyMsgElement); - self._dataGrid = null; - self.deleteButton.visible = false; + this._createSimpleDataGrid(); + this._populateSimpleDataGrid(); + this._dataGrid.autoSizeColumns(20, 80); } + } else { + if (isAdvanced) + this._populateDataGrid(); + else + this._populateSimpleDataGrid(); } - WebInspector.Cookies.getCookiesAsync(callback, this._cookieDomain); + this._dataGrid.element.removeStyleClass("hidden"); + this._emptyMsgElement.addStyleClass("hidden"); + if (isAdvanced) + this.deleteButton.visible = true; }, - dataGridForCookies: function(cookies) + _filterCookiesForDomain: function(allCookies) { - if (!cookies.length) - return null; + this._cookies = []; + var resourceURLsForDocumentURL = []; + this._totalSize = 0; + + for (var id in WebInspector.resources) { + var resource = WebInspector.resources[id]; + var match = resource.documentURL.match(WebInspector.URLRegExp); + if (match && match[2] === this._cookieDomain) + resourceURLsForDocumentURL.push(resource.url); + } - for (var i = 0; i < cookies.length; ++i) - cookies[i].expires = new Date(cookies[i].expires); + for (var i = 0; i < allCookies.length; ++i) { + var pushed = false; + var size = allCookies[i].size; + for (var j = 0; j < resourceURLsForDocumentURL.length; ++j) { + var resourceURL = resourceURLsForDocumentURL[j]; + if (WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i], resourceURL)) { + this._totalSize += size; + if (!pushed) { + pushed = true; + this._cookies.push(allCookies[i]); + } + } + } + } + }, + _createDataGrid: function() + { var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} }; columns[0].title = WebInspector.UIString("Name"); - columns[0].width = columns[0].title.length; + columns[0].sortable = true; columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[1].title.length; + columns[1].sortable = true; columns[2].title = WebInspector.UIString("Domain"); - columns[2].width = columns[2].title.length; + columns[2].sortable = true; columns[3].title = WebInspector.UIString("Path"); - columns[3].width = columns[3].title.length; + columns[3].sortable = true; columns[4].title = WebInspector.UIString("Expires"); - columns[4].width = columns[4].title.length; + columns[4].sortable = true; columns[5].title = WebInspector.UIString("Size"); - columns[5].width = columns[5].title.length; columns[5].aligned = "right"; + columns[5].sortable = true; columns[6].title = WebInspector.UIString("HTTP"); - columns[6].width = columns[6].title.length; columns[6].aligned = "centered"; + columns[6].sortable = true; columns[7].title = WebInspector.UIString("Secure"); - columns[7].width = columns[7].title.length; columns[7].aligned = "centered"; + columns[7].sortable = true; - function updateDataAndColumn(index, value) { - data[index] = value; - if (value.length > columns[index].width) - columns[index].width = value.length; - } + this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCookieCallback.bind(this)); + this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this); + this.element.appendChild(this._dataGrid.element); + this._dataGrid.updateWidths(); + }, - var data; - var nodes = []; - for (var i = 0; i < cookies.length; ++i) { - var cookie = cookies[i]; - data = {}; - - updateDataAndColumn(0, cookie.name); - updateDataAndColumn(1, cookie.value); - updateDataAndColumn(2, cookie.domain); - updateDataAndColumn(3, cookie.path); - updateDataAndColumn(4, (cookie.session ? WebInspector.UIString("Session") : cookie.expires.toGMTString())); - updateDataAndColumn(5, Number.bytesToString(cookie.size, WebInspector.UIString)); - updateDataAndColumn(6, (cookie.httpOnly ? "\u2713" : "")); // Checkmark - updateDataAndColumn(7, (cookie.secure ? "\u2713" : "")); // Checkmark + _populateDataGrid: function() + { + var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null; + var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1; - var node = new WebInspector.DataGridNode(data, false); - node.cookie = cookie; - node.selectable = true; - nodes.push(node); + function localeCompare(field, cookie1, cookie2) + { + return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "") } - var totalColumnWidths = 0; - for (var columnIdentifier in columns) - totalColumnWidths += columns[columnIdentifier].width; - - // Enforce the Value column (the 2nd column) to be a max of 33% - // tweaking the raw total width because may massively outshadow the others - var valueColumnWidth = columns[1].width; - if (valueColumnWidth / totalColumnWidths > 0.33) { - totalColumnWidths -= valueColumnWidth; - totalColumnWidths *= 1.33; - columns[1].width = totalColumnWidths * 0.33; + function numberCompare(field, cookie1, cookie2) + { + return sortDirection * (cookie1[field] - cookie2[field]); } - // Calculate the percentage width for the columns. - const minimumPrecent = 6; - var recoupPercent = 0; - for (var columnIdentifier in columns) { - var width = columns[columnIdentifier].width; - width = Math.round((width / totalColumnWidths) * 100); - if (width < minimumPrecent) { - recoupPercent += (minimumPrecent - width); - width = minimumPrecent; - } - columns[columnIdentifier].width = width; - } + function expiresCompare(cookie1, cookie2) + { + if (cookie1.session !== cookie2.session) + return sortDirection * (cookie1.session ? 1 : -1); - // Enforce the minimum percentage width. (need to narrow total percentage due to earlier additions) - while (recoupPercent > 0) { - for (var columnIdentifier in columns) { - if (columns[columnIdentifier].width > minimumPrecent) { - --columns[columnIdentifier].width; - --recoupPercent; - if (!recoupPercent) - break; - } - } + if (cookie1.session) + return 0; + + return sortDirection * (cookie1.expires - cookie2.expires); } - for (var columnIdentifier in columns) - columns[columnIdentifier].width += "%"; + var comparator; + switch (parseInt(this._dataGrid.sortColumnIdentifier)) { + case 0: comparator = localeCompare.bind(this, "name"); break; + case 1: comparator = localeCompare.bind(this, "value"); break; + case 2: comparator = localeCompare.bind(this, "domain"); break; + case 3: comparator = localeCompare.bind(this, "path"); break; + case 4: comparator = expiresCompare; break; + case 5: comparator = numberCompare.bind(this, "size"); break; + case 6: comparator = localeCompare.bind(this, "httpOnly"); break; + case 7: comparator = localeCompare.bind(this, "secure"); break; + default: localeCompare.bind(this, "name"); + } - var dataGrid = new WebInspector.DataGrid(columns); - var length = nodes.length; - for (var i = 0; i < length; ++i) - dataGrid.appendChild(nodes[i]); - if (length > 0) - nodes[0].selected = true; + this._cookies.sort(comparator); - return dataGrid; + this._dataGrid.removeChildren(); + var nodeToSelect; + for (var i = 0; i < this._cookies.length; ++i) { + var data = {}; + var cookie = this._cookies[i]; + data[0] = cookie.name; + data[1] = cookie.value; + data[2] = cookie.domain; + data[3] = cookie.path; + data[4] = (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString()); + data[5] = Number.bytesToString(cookie.size, WebInspector.UIString); + data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark + data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark + + var node = new WebInspector.DataGridNode(data); + node.cookie = cookie; + node.selectable = true; + this._dataGrid.appendChild(node); + if (cookie === selectedCookie) + nodeToSelect = node; + } + if (nodeToSelect) + nodeToSelect.selected = true; + else + this._dataGrid.children[0].selected = true; }, - simpleDataGridForCookies: function(cookies) + _createSimpleDataGrid: function() { - if (!cookies.length) - return null; - var columns = {}; columns[0] = {}; columns[1] = {}; columns[0].title = WebInspector.UIString("Name"); - columns[0].width = columns[0].title.length; columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[1].title.length; - var nodes = []; + this._dataGrid = new WebInspector.DataGrid(columns); + this.element.appendChild(this._dataGrid.element); + this._dataGrid.updateWidths(); + }, + + _populateSimpleDataGrid: function() + { + var cookies = this._cookies; + this._dataGrid.removeChildren(); + var addedCookies = {}; for (var i = 0; i < cookies.length; ++i) { - var cookie = cookies[i]; + if (addedCookies[cookies[i].name]) + continue; + addedCookies[cookies[i].name] = true; var data = {}; - - var name = cookie.name; - data[0] = name; - if (name.length > columns[0].width) - columns[0].width = name.length; - - var value = cookie.value; - data[1] = value; - if (value.length > columns[1].width) - columns[1].width = value.length; + data[0] = cookies[i].name; + data[1] = cookies[i].value; var node = new WebInspector.DataGridNode(data, false); node.selectable = true; - nodes.push(node); + this._dataGrid.appendChild(node); } - - var totalColumnWidths = columns[0].width + columns[1].width; - var width = Math.round((columns[0].width * 100) / totalColumnWidths); - const minimumPrecent = 20; - if (width < minimumPrecent) - width = minimumPrecent; - if (width > 100 - minimumPrecent) - width = 100 - minimumPrecent; - columns[0].width = width; - columns[1].width = 100 - width; - columns[0].width += "%"; - columns[1].width += "%"; - - var dataGrid = new WebInspector.DataGrid(columns); - var length = nodes.length; - for (var i = 0; i < length; ++i) - dataGrid.appendChild(nodes[i]); - if (length > 0) - nodes[0].selected = true; - - return dataGrid; + this._dataGrid.children[0].selected = true; }, - + resize: function() { if (this._dataGrid) @@ -258,17 +281,22 @@ WebInspector.CookieItemsView.prototype = { _deleteButtonClicked: function(event) { - if (!this._dataGrid) + if (!this._dataGrid || !this._dataGrid.selectedNode) return; - var cookie = this._dataGrid.selectedNode.cookie; - InspectorController.deleteCookie(cookie.name, this._cookieDomain); - this.update(); + this._deleteCookieCallback(this._dataGrid.selectedNode); + }, + + _deleteCookieCallback: function(node) + { + var cookie = node.cookie; + InspectorBackend.deleteCookie(cookie.name, this._cookieDomain); + this._update(); }, _refreshButtonClicked: function(event) { - this.update(); + this._update(); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMAgent.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMAgent.js index 25ffafa..834f527 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMAgent.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMAgent.js @@ -33,6 +33,10 @@ WebInspector.DOMNode = function(doc, payload) { this.ownerDocument = doc; this.id = payload.id; + // injectedScriptId is a node is for DOM nodes which should be converted + // to corresponding InjectedScript by the inspector backend. We indicate + // this by making injectedScriptId negative. + this.injectedScriptId = -payload.id; this.nodeType = payload.nodeType; this.nodeName = payload.nodeName; this.localName = payload.localName; @@ -60,12 +64,20 @@ WebInspector.DOMNode = function(doc, payload) { this.style = null; this._matchedCSSRules = []; - if (this.nodeType == Node.ELEMENT_NODE) { - if (this.nodeName == "HTML") + if (this.nodeType === Node.ELEMENT_NODE) { + // HTML and BODY from internal iframes should not overwrite top-level ones. + if (!this.ownerDocument.documentElement && this.nodeName === "HTML") this.ownerDocument.documentElement = this; - if (this.nodeName == "BODY") + if (!this.ownerDocument.body && this.nodeName === "BODY") this.ownerDocument.body = this; - } + if (payload.documentURL) + this.documentURL = payload.documentURL; + } else if (this.nodeType === Node.DOCUMENT_TYPE_NODE) { + this.publicId = payload.publicId; + this.systemId = payload.systemId; + this.internalSubset = payload.internalSubset; + } else if (this.nodeType === Node.DOCUMENT_NODE) + this.documentURL = payload.documentURL; } WebInspector.DOMNode.prototype = { @@ -132,6 +144,8 @@ WebInspector.DOMNode.prototype = { _setAttributesPayload: function(attrs) { + this.attributes = []; + this._attributesMap = {}; for (var i = 0; i < attrs.length; i += 2) this._addAttribute(attrs[i], attrs[i + 1]); }, @@ -139,10 +153,13 @@ WebInspector.DOMNode.prototype = { _insertChild: function(prev, payload) { var node = new WebInspector.DOMNode(this.ownerDocument, payload); - if (!prev) - // First node - this.children = [ node ]; - else + if (!prev) { + if (!this.children) { + // First node + this.children = [ node ]; + } else + this.children.unshift(node); + } else this.children.splice(this.children.indexOf(prev) + 1, 0, node); this._renumber(); return node; @@ -178,6 +195,7 @@ WebInspector.DOMNode.prototype = { this.lastChild = this.children[this._childNodeCount - 1]; for (var i = 0; i < this._childNodeCount; ++i) { var child = this.children[i]; + child.index = i; child.nextSibling = i + 1 < this._childNodeCount ? this.children[i + 1] : null; child.prevSibling = i - 1 >= 0 ? this.children[i - 1] : null; child.parentNode = this; @@ -326,25 +344,25 @@ WebInspector.DOMAgent.prototype = { callback(parent.children); } var callId = WebInspector.Callback.wrap(mycallback); - InspectorController.getChildNodes(callId, parent.id); + InspectorBackend.getChildNodes(callId, parent.id); }, setAttributeAsync: function(node, name, value, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setAttribute(WebInspector.Callback.wrap(mycallback), node.id, name, value); + InspectorBackend.setAttribute(WebInspector.Callback.wrap(mycallback), node.id, name, value); }, removeAttributeAsync: function(node, name, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.removeAttribute(WebInspector.Callback.wrap(mycallback), node.id, name); + InspectorBackend.removeAttribute(WebInspector.Callback.wrap(mycallback), node.id, name); }, setTextNodeValueAsync: function(node, text, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node.id, text); + InspectorBackend.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node.id, text); }, _didApplyDomChange: function(node, callback, success) @@ -354,15 +372,16 @@ WebInspector.DOMAgent.prototype = { callback(); // TODO(pfeldman): Fix this hack. var elem = WebInspector.panels.elements.treeOutline.findTreeElement(node); - if (elem) { - elem._updateTitle(); - } + if (elem) + elem.updateTitle(); }, _attributesUpdated: function(nodeId, attrsArray) { var node = this._idToDOMNode[nodeId]; node._setAttributesPayload(attrsArray); + var event = {target: node}; + this.document._fireDomEvent("DOMAttrModified", event); }, nodeForId: function(nodeId) { @@ -372,13 +391,13 @@ WebInspector.DOMAgent.prototype = { _setDocument: function(payload) { this._idToDOMNode = {}; - if (payload) { + if (payload && "id" in payload) { this.document = new WebInspector.DOMDocument(this, this._window, payload); this._idToDOMNode[payload.id] = this.document; this._bindNodes(this.document.children); } else this.document = null; - WebInspector.panels.elements.reset(); + WebInspector.panels.elements.setDocument(this.document); }, _setDetachedRoot: function(payload) @@ -437,7 +456,7 @@ WebInspector.DOMAgent.prototype = { WebInspector.Cookies = {} -WebInspector.Cookies.getCookiesAsync = function(callback, cookieDomain) +WebInspector.Cookies.getCookiesAsync = function(callback) { function mycallback(cookies, cookiesString) { if (cookiesString) @@ -446,7 +465,7 @@ WebInspector.Cookies.getCookiesAsync = function(callback, cookieDomain) callback(cookies, true); } var callId = WebInspector.Callback.wrap(mycallback); - InspectorController.getCookies(callId, cookieDomain); + InspectorBackend.getCookies(callId); } WebInspector.Cookies.buildCookiesFromString = function(rawCookieString) @@ -468,6 +487,28 @@ WebInspector.Cookies.buildCookiesFromString = function(rawCookieString) return cookies; } +WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) +{ + var match = resourceURL.match(WebInspector.URLRegExp); + if (!match) + return false; + // See WebInspector.URLRegExp for definitions of the group index constants. + if (!this.cookieDomainMatchesResourceDomain(cookie.domain, match[2])) + return false; + var resourcePort = match[3] ? match[3] : undefined; + var resourcePath = match[4] ? match[4] : '/'; + return (resourcePath.indexOf(cookie.path) === 0 + && (!cookie.port || resourcePort == cookie.port) + && (!cookie.secure || match[1].toLowerCase() === 'https')); +} + +WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) +{ + if (cookieDomain.charAt(0) !== '.') + return resourceDomain === cookieDomain; + return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i"); +} + WebInspector.EventListeners = {} WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callback) @@ -476,12 +517,13 @@ WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callb return; var callId = WebInspector.Callback.wrap(callback); - InspectorController.getEventListenersForNode(callId, node.id); + InspectorBackend.getEventListenersForNode(callId, node.id); } WebInspector.CSSStyleDeclaration = function(payload) { this.id = payload.id; + this.injectedScriptId = payload.injectedScriptId; this.width = payload.width; this.height = payload.height; this.__disabledProperties = payload.__disabledProperties; @@ -524,6 +566,7 @@ WebInspector.CSSStyleDeclaration.parseRule = function(payload) { var rule = {}; rule.id = payload.id; + rule.injectedScriptId = payload.injectedScriptId; rule.selectorText = payload.selectorText; rule.style = new WebInspector.CSSStyleDeclaration(payload.style); rule.style.parentRule = rule; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js index 03a10bf..c5f658d 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorage.js @@ -57,19 +57,19 @@ WebInspector.DOMStorage.prototype = { getEntries: function(callback) { var callId = WebInspector.Callback.wrap(callback); - InspectorController.getDOMStorageEntries(callId, this._id); + InspectorBackend.getDOMStorageEntries(callId, this._id); }, setItem: function(key, value, callback) { var callId = WebInspector.Callback.wrap(callback); - InspectorController.setDOMStorageItem(callId, this._id, key, value); + InspectorBackend.setDOMStorageItem(callId, this._id, key, value); }, removeItem: function(key, callback) { var callId = WebInspector.Callback.wrap(callback); - InspectorController.removeDOMStorageItem(callId, this._id, key); + InspectorBackend.removeDOMStorageItem(callId, this._id, key); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js deleted file mode 100644 index 45a9ba1..0000000 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageDataGrid.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2009 Nokia Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.DOMStorageDataGrid = function(columns, domStorage, keys) -{ - WebInspector.DataGrid.call(this, columns); - this.dataTableBody.addEventListener("dblclick", this._ondblclick.bind(this), false); - this._domStorage = domStorage; - this._keys = keys; -} - -WebInspector.DOMStorageDataGrid.prototype = { - _ondblclick: function(event) - { - if (this._editing) - return; - if (this._editingNode) - return; - this._startEditing(event); - }, - - _startEditingColumnOfDataGridNode: function(node, column) - { - this._editing = true; - this._editingNode = node; - this._editingNode.select(); - - var element = this._editingNode._element.children[column]; - WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); - window.getSelection().setBaseAndExtent(element, 0, element, 1); - }, - - _startEditing: function(event) - { - var element = event.target.enclosingNodeOrSelfWithNodeName("td"); - if (!element) - return; - - this._editingNode = this.dataGridNodeFromEvent(event); - if (!this._editingNode) { - if (!this.creationNode) - return; - this._editingNode = this.creationNode; - } - - // Force editing the "Key" column when editing the creation node - if (this._editingNode.isCreationNode) - return this._startEditingColumnOfDataGridNode(this._editingNode, 0); - - this._editing = true; - WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); - window.getSelection().setBaseAndExtent(element, 0, element, 1); - }, - - _editingCommitted: function(element, newText, oldText, context, moveDirection) - { - var columnIdentifier = (element.hasStyleClass("0-column") ? 0 : 1); - var textBeforeEditing = this._editingNode.data[columnIdentifier]; - var currentEditingNode = this._editingNode; - - function moveToNextIfNeeded(wasChange) { - if (!moveDirection) - return; - - if (moveDirection === "forward") { - if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange) - return; - - if (columnIdentifier === 0) - return this._startEditingColumnOfDataGridNode(currentEditingNode, 1); - - var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true); - if (nextDataGridNode) - return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0); - if (currentEditingNode.isCreationNode && wasChange) { - addCreationNode(false); - return this._startEditingColumnOfDataGridNode(this.creationNode, 0); - } - return; - } - - if (moveDirection === "backward") { - if (columnIdentifier === 1) - return this._startEditingColumnOfDataGridNode(currentEditingNode, 0); - var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true); - - if (nextDataGridNode) - return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1); - return; - } - } - - if (textBeforeEditing == newText) { - this._editingCancelled(element); - moveToNextIfNeeded.call(this, false); - return; - } - - var domStorage = this._domStorage; - if (columnIdentifier === 0) { - if (this._keys.indexOf(newText) !== -1) { - element.textContent = this._editingNode.data[0]; - this._editingCancelled(element); - moveToNextIfNeeded.call(this, false); - return; - } - domStorage.removeItem(this._editingNode.data[0]); - domStorage.setItem(newText, this._editingNode.data[1]); - this._editingNode.data[0] = newText; - } else { - domStorage.setItem(this._editingNode.data[0], newText); - this._editingNode.data[1] = newText; - } - - if (this._editingNode.isCreationNode) - this.addCreationNode(false); - - this._editingCancelled(element); - moveToNextIfNeeded.call(this, true); - }, - - _editingCancelled: function(element, context) - { - delete this._editing; - this._editingNode = null; - }, - - deleteSelectedRow: function() - { - var node = this.selectedNode; - if (!node || node.isCreationNode) - return; - - if (this._domStorage) - this._domStorage.removeItem(node.data[0]); - } -} - -WebInspector.DOMStorageDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js index a7da370..dbd736b 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMStorageItemsView.js @@ -65,22 +65,12 @@ WebInspector.DOMStorageItemsView.prototype = { this.domStorage.getEntries(callback); }, - _showDOMStorageEntries: function(entries) + _showDOMStorageEntries: function(entries) { - if (entries.length > 0) { - this._dataGrid = this._dataGridForDOMStorageEntries(entries); - this.element.appendChild(this._dataGrid.element); - this._dataGrid.updateWidths(); - this.deleteButton.visible = true; - } else { - var emptyMsgElement = document.createElement("div"); - emptyMsgElement.className = "storage-table-empty"; - if (this.domStorage) - emptyMsgElement.textContent = WebInspector.UIString("This storage is empty."); - this.element.appendChild(emptyMsgElement); - this._dataGrid = null; - this.deleteButton.visible = false; - } + this._dataGrid = this._dataGridForDOMStorageEntries(entries); + this.element.appendChild(this._dataGrid.element); + this._dataGrid.autoSizeColumns(10); + this.deleteButton.visible = true; }, resize: function() @@ -95,9 +85,7 @@ WebInspector.DOMStorageItemsView.prototype = { columns[0] = {}; columns[1] = {}; columns[0].title = WebInspector.UIString("Key"); - columns[0].width = columns[0].title.length; columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[1].title.length; var nodes = []; @@ -108,32 +96,15 @@ WebInspector.DOMStorageItemsView.prototype = { var key = entries[i][0]; data[0] = key; - if (key.length > columns[0].width) - columns[0].width = key.length; - var value = entries[i][1]; data[1] = value; - if (value.length > columns[1].width) - columns[1].width = value.length; var node = new WebInspector.DataGridNode(data, false); node.selectable = true; nodes.push(node); keys.push(key); } - var totalColumnWidths = columns[0].width + columns[1].width; - var width = Math.round((columns[0].width * 100) / totalColumnWidths); - const minimumPrecent = 10; - if (width < minimumPrecent) - width = minimumPrecent; - if (width > 100 - minimumPrecent) - width = 100 - minimumPrecent; - columns[0].width = width; - columns[1].width = 100 - width; - columns[0].width += "%"; - columns[1].width += "%"; - - var dataGrid = new WebInspector.DOMStorageDataGrid(columns, this.domStorage, keys); + var dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this)); var length = nodes.length; for (var i = 0; i < length; ++i) dataGrid.appendChild(nodes[i]); @@ -145,16 +116,41 @@ WebInspector.DOMStorageItemsView.prototype = { _deleteButtonClicked: function(event) { - if (this._dataGrid) { - this._dataGrid.deleteSelectedRow(); - - this.show(); - } + if (!this._dataGrid || !this._dataGrid.selectedNode) + return; + + this._deleteCallback(this._dataGrid.selectedNode); }, _refreshButtonClicked: function(event) { this.update(); + }, + + _editingCallback: function(editingNode, columnIdentifier, oldText, newText) + { + var domStorage = this.domStorage; + if (columnIdentifier === 0) { + if (oldText) + domStorage.removeItem(oldText); + + domStorage.setItem(newText, editingNode.data[1]); + } else { + domStorage.setItem(editingNode.data[0], newText); + } + + this.update(); + }, + + _deleteCallback: function(node) + { + if (!node || node.isCreationNode) + return; + + if (this.domStorage) + this.domStorage.removeItem(node.data[0]); + + this.update(); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js new file mode 100644 index 0000000..07233d3 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DOMSyntaxHighlighter.js @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.DOMSyntaxHighlighter = function(mimeType) +{ + this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType); +} + +WebInspector.DOMSyntaxHighlighter.prototype = { + createSpan: function(content, className) + { + var span = document.createElement("span"); + span.className = "webkit-" + className; + span.appendChild(document.createTextNode(content)); + return span; + }, + + syntaxHighlightNode: function(node) + { + this._tokenizer.condition = this._tokenizer.initialCondition; + var lines = node.textContent.split("\n"); + node.removeChildren(); + + for (var i = lines[0].length ? 0 : 1; i < lines.length; ++i) { + var line = lines[i]; + var plainTextStart = 0; + this._tokenizer.line = line; + var column = 0; + do { + var newColumn = this._tokenizer.nextToken(column); + var tokenType = this._tokenizer.tokenType; + if (tokenType) { + if (column > plainTextStart) { + var plainText = line.substring(plainTextStart, column); + node.appendChild(document.createTextNode(plainText)); + } + var token = line.substring(column, newColumn); + node.appendChild(this.createSpan(token, tokenType)); + plainTextStart = newColumn; + } + column = newColumn; + } while (column < line.length) + + if (plainTextStart < line.length) { + var plainText = line.substring(plainTextStart, line.length); + node.appendChild(document.createTextNode(plainText)); + } + if (i < lines.length - 1) + node.appendChild(document.createElement("br")); + } + } +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DataGrid.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DataGrid.js index ce61548..1ecc4f2 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DataGrid.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DataGrid.js @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.DataGrid = function(columns) +WebInspector.DataGrid = function(columns, editCallback, deleteCallback) { this.element = document.createElement("div"); this.element.className = "data-grid"; @@ -38,7 +38,18 @@ WebInspector.DataGrid = function(columns) this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true); this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true); - + + this._dataTable.addEventListener("contextmenu", this._contextMenuInDataTable.bind(this), true); + + // FIXME: Add a createCallback which is different from editCallback and has different + // behavior when creating a new node. + if (editCallback) { + this._dataTable.addEventListener("dblclick", this._ondblclick.bind(this), false); + this._editCallback = editCallback; + } + if (deleteCallback) + this._deleteCallback = deleteCallback; + this.aligned = {}; var scrollContainer = document.createElement("div"); @@ -50,7 +61,7 @@ WebInspector.DataGrid = function(columns) var headerRow = document.createElement("tr"); var columnGroup = document.createElement("colgroup"); - var columnCount = 0; + this._columnCount = 0; for (var columnIdentifier in columns) { var column = columns[columnIdentifier]; @@ -60,6 +71,7 @@ WebInspector.DataGrid = function(columns) var col = document.createElement("col"); if (column.width) col.style.width = column.width; + column.element = col; columnGroup.appendChild(col); var cell = document.createElement("th"); @@ -87,10 +99,10 @@ WebInspector.DataGrid = function(columns) headerRow.appendChild(cell); - ++columnCount; + ++this._columnCount; } - columnGroup.span = columnCount; + columnGroup.span = this._columnCount; var cell = document.createElement("th"); cell.className = "corner"; @@ -103,7 +115,7 @@ WebInspector.DataGrid = function(columns) var fillerRow = document.createElement("tr"); fillerRow.className = "filler"; - for (var i = 0; i < columnCount; ++i) { + for (var i = 0; i < this._columnCount; ++i) { var cell = document.createElement("td"); fillerRow.appendChild(cell); } @@ -128,6 +140,116 @@ WebInspector.DataGrid = function(columns) } WebInspector.DataGrid.prototype = { + _ondblclick: function(event) + { + if (this._editing || this._editingNode) + return; + + this._startEditing(event.target); + }, + + _startEditingColumnOfDataGridNode: function(node, column) + { + this._editing = true; + this._editingNode = node; + this._editingNode.select(); + + var element = this._editingNode._element.children[column]; + WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); + window.getSelection().setBaseAndExtent(element, 0, element, 1); + }, + + _startEditing: function(target) + { + var element = target.enclosingNodeOrSelfWithNodeName("td"); + if (!element) + return; + + this._editingNode = this.dataGridNodeFromNode(target); + if (!this._editingNode) { + if (!this.creationNode) + return; + this._editingNode = this.creationNode; + } + + // Force editing the 1st column when editing the creation node + if (this._editingNode.isCreationNode) + return this._startEditingColumnOfDataGridNode(this._editingNode, 0); + + this._editing = true; + WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent); + window.getSelection().setBaseAndExtent(element, 0, element, 1); + }, + + _editingCommitted: function(element, newText, oldText, context, moveDirection) + { + // FIXME: We need more column identifiers here throughout this function. + // Not needed yet since only editable DataGrid is DOM Storage, which is Key - Value. + + // FIXME: Better way to do this than regular expressions? + var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1]); + + var textBeforeEditing = this._editingNode.data[columnIdentifier]; + var currentEditingNode = this._editingNode; + + function moveToNextIfNeeded(wasChange) { + if (!moveDirection) + return; + + if (moveDirection === "forward") { + if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange) + return; + + if (columnIdentifier === 0) + return this._startEditingColumnOfDataGridNode(currentEditingNode, 1); + + var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true); + if (nextDataGridNode) + return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0); + if (currentEditingNode.isCreationNode && wasChange) { + addCreationNode(false); + return this._startEditingColumnOfDataGridNode(this.creationNode, 0); + } + return; + } + + if (moveDirection === "backward") { + if (columnIdentifier === 1) + return this._startEditingColumnOfDataGridNode(currentEditingNode, 0); + var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true); + + if (nextDataGridNode) + return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1); + return; + } + } + + if (textBeforeEditing == newText) { + this._editingCancelled(element); + moveToNextIfNeeded.call(this, false); + return; + } + + // Update the text in the datagrid that we typed + this._editingNode.data[columnIdentifier] = newText; + + // Make the callback - expects an editing node (table row), the column number that is being edited, + // the text that used to be there, and the new text. + this._editCallback(this._editingNode, columnIdentifier, textBeforeEditing, newText); + + if (this._editingNode.isCreationNode) + this.addCreationNode(false); + + this._editingCancelled(element); + moveToNextIfNeeded.call(this, true); + }, + + _editingCancelled: function(element, context) + { + delete this._editing; + this._editingNode = null; + }, + get sortColumnIdentifier() { if (!this._sortColumnCell) @@ -171,7 +293,70 @@ WebInspector.DataGrid.prototype = { return this._dataTableBody; }, - + + autoSizeColumns: function(minPercent, maxPercent) + { + if (minPercent) + minPercent = Math.min(minPercent, Math.floor(100 / this._columnCount)); + var widths = {}; + var columns = this.columns; + for (var columnIdentifier in columns) + widths[columnIdentifier] = (columns[columnIdentifier].title || "").length; + + for (var i = 0; i < this.children.length; ++i) { + var node = this.children[i]; + for (var columnIdentifier in columns) { + var text = node.data[columnIdentifier] || ""; + if (text.length > widths[columnIdentifier]) + widths[columnIdentifier] = text.length; + } + } + + var totalColumnWidths = 0; + for (var columnIdentifier in columns) + totalColumnWidths += widths[columnIdentifier]; + + var recoupPercent = 0; + for (var columnIdentifier in columns) { + var width = Math.round(100 * widths[columnIdentifier] / totalColumnWidths); + if (minPercent && width < minPercent) { + recoupPercent += (minPercent - width); + width = minPercent; + } else if (maxPercent && width > maxPercent) { + recoupPercent -= (width - maxPercent); + width = maxPercent; + } + widths[columnIdentifier] = width; + } + + while (minPercent && recoupPercent > 0) { + for (var columnIdentifier in columns) { + if (widths[columnIdentifier] > minPercent) { + --widths[columnIdentifier]; + --recoupPercent; + if (!recoupPercent) + break; + } + } + } + + while (maxPercent && recoupPercent < 0) { + for (var columnIdentifier in columns) { + if (widths[columnIdentifier] < maxPercent) { + ++widths[columnIdentifier]; + ++recoupPercent; + if (!recoupPercent) + break; + } + } + } + + for (var columnIdentifier in columns) + columns[columnIdentifier].element.style.width = widths[columnIdentifier] + "%"; + this.columnWidthsInitialized = false; + this.updateWidths(); + }, + // Updates the widths of the table, including the positions of the column // resizers. // @@ -266,6 +451,7 @@ WebInspector.DataGrid.prototype = { delete child._depth; delete child._revealed; delete child._attached; + child._shouldRefreshChildren = true; var current = child.children[0]; while (current) { @@ -273,6 +459,7 @@ WebInspector.DataGrid.prototype = { delete current._depth; delete current._revealed; delete current._attached; + current._shouldRefreshChildren = true; current = current.traverseNextNode(false, child, true); } @@ -348,10 +535,11 @@ WebInspector.DataGrid.prototype = { this.children = []; }, - handleKeyEvent: function(event) + + _keyDown: function(event) { - if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey) - return false; + if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing) + return; var handled = false; var nextSelectedNode; @@ -396,6 +584,18 @@ WebInspector.DataGrid.prototype = { this.selectedNode.expand(); } } + } else if (event.keyCode === 8 || event.keyCode === 46) { + if (this._deleteCallback) { + handled = true; + this._deleteCallback(this.selectedNode); + } + } else if (isEnterKey(event)) { + if (this._editCallback) { + handled = true; + // The first child of the selected element is the , + // and that's what we want to edit. + this._startEditing(this.selectedNode._element.children[0]); + } } if (nextSelectedNode) { @@ -407,8 +607,6 @@ WebInspector.DataGrid.prototype = { event.preventDefault(); event.stopPropagation(); } - - return handled; }, expand: function() @@ -426,9 +624,9 @@ WebInspector.DataGrid.prototype = { // This is the root, do nothing. }, - dataGridNodeFromEvent: function(event) + dataGridNodeFromNode: function(target) { - var rowElement = event.target.enclosingNodeOrSelfWithNodeName("tr"); + var rowElement = target.enclosingNodeOrSelfWithNodeName("tr"); return rowElement._dataGridNode; }, @@ -439,11 +637,6 @@ WebInspector.DataGrid.prototype = { return rowElement._dataGridNode; }, - _keyDown: function(event) - { - this.handleKeyEvent(event); - }, - _clickInHeaderCell: function(event) { var cell = event.target.enclosingNodeOrSelfWithNodeName("th"); @@ -473,7 +666,7 @@ WebInspector.DataGrid.prototype = { _mouseDownInDataTable: function(event) { - var gridNode = this.dataGridNodeFromEvent(event); + var gridNode = this.dataGridNodeFromNode(event.target); if (!gridNode || !gridNode.selectable) return; @@ -488,10 +681,34 @@ WebInspector.DataGrid.prototype = { } else gridNode.select(); }, + + _contextMenuInDataTable: function(event) + { + var gridNode = this.dataGridNodeFromNode(event.target); + if (!gridNode || !gridNode.selectable) + return; + + if (gridNode.isEventWithinDisclosureTriangle(event)) + return; + + var contextMenu = new WebInspector.ContextMenu(); + + // FIXME: Use the column names for Editing, instead of just "Edit". + if (this.dataGrid._editCallback) { + if (gridNode === this.creationNode) + contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target)); + else + contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target)); + } + if (this.dataGrid._deleteCallback && gridNode !== this.creationNode) + contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode)); + + contextMenu.show(event); + }, _clickInDataTable: function(event) { - var gridNode = this.dataGridNodeFromEvent(event); + var gridNode = this.dataGridNodeFromNode(event.target); if (!gridNode || !gridNode.hasChildren) return; @@ -1019,6 +1236,30 @@ WebInspector.DataGridNode.prototype = { for (var i = 0; i < this.children.length; ++i) this.children[i]._detach(); + }, + + savePosition: function() + { + if (this._savedPosition) + return; + + if (!this.parent) + throw("savePosition: Node must have a parent."); + this._savedPosition = { + parent: this.parent, + index: this.parent.children.indexOf(this) + }; + }, + + restorePosition: function() + { + if (!this._savedPosition) + return; + + if (this.parent !== this._savedPosition.parent) + this._savedPosition.parent.insertChild(this, this._savedPosition.index); + + delete this._savedPosition; } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Database.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Database.js index 1a348fc..a0dc9ca 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Database.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Database.js @@ -82,7 +82,7 @@ WebInspector.Database.prototype = { callback(names.sort()); } var callId = WebInspector.Callback.wrap(sortingCallback); - InspectorController.getDatabaseTableNames(callId, this._id); + InspectorBackend.getDatabaseTableNames(callId, this._id); }, executeSql: function(query, onSuccess, onError) @@ -95,7 +95,8 @@ WebInspector.Database.prototype = { } onSuccess(result); } - InjectedScriptAccess.executeSql(this._id, query, callback); + // FIXME: execute the query in the frame the DB comes from. + InjectedScriptAccess.getDefault().executeSql(this._id, query, callback); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js index e85af66..cc902e7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseQueryView.js @@ -31,6 +31,7 @@ WebInspector.DatabaseQueryView = function(database) this.element.addStyleClass("storage-view"); this.element.addStyleClass("query"); + this.element.addStyleClass("monospace"); this.element.tabIndex = 0; this.element.addEventListener("selectstart", this._selectStart.bind(this), false); @@ -38,7 +39,7 @@ WebInspector.DatabaseQueryView = function(database) this.promptElement = document.createElement("div"); this.promptElement.className = "database-query-prompt"; this.promptElement.appendChild(document.createElement("br")); - this.promptElement.handleKeyEvent = this._promptKeyDown.bind(this); + this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true); this.element.appendChild(this.promptElement); this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), " "); @@ -98,8 +99,6 @@ WebInspector.DatabaseQueryView.prototype = { this._enterKeyPressed(event); return; } - - this.prompt.handleKeyEvent(event); }, _selectStart: function(event) @@ -145,6 +144,7 @@ WebInspector.DatabaseQueryView.prototype = { return; dataGrid.element.addStyleClass("inline"); this._appendQueryResult(query, dataGrid.element); + dataGrid.autoSizeColumns(5); if (query.match(/^create /i) || query.match(/^drop table /i)) WebInspector.panels.storage.updateDatabaseTables(this.database); diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseTableView.js b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseTableView.js index aa76794..cd66ab7 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseTableView.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/DatabaseTableView.js @@ -68,6 +68,7 @@ WebInspector.DatabaseTableView.prototype = { } this.element.appendChild(dataGrid.element); + dataGrid.autoSizeColumns(5); }, _queryError: function(error) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/Drawer.js b/src/3rdparty/webkit/WebCore/inspector/front-end/Drawer.js index 1b50f91..8bf707e 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/Drawer.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/Drawer.js @@ -7,13 +7,13 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -31,6 +31,12 @@ WebInspector.Drawer = function() { WebInspector.View.call(this, document.getElementById("drawer")); + this._savedHeight = 200; // Default. + this.state = WebInspector.Drawer.State.Hidden; + this.fullPanel = false; + + this.mainElement = document.getElementById("main"); + this.toolbarElement = document.getElementById("toolbar"); this.mainStatusBar = document.getElementById("main-status-bar"); this.mainStatusBar.addEventListener("mousedown", this._startStatusBarDragging.bind(this), true); this.viewStatusBar = document.getElementById("other-drawer-status-bar-items"); @@ -45,6 +51,8 @@ WebInspector.Drawer.prototype = { set visibleView(x) { if (this._visibleView === x) { + if (this.visible && this.fullPanel) + return; this.visible = !this.visible; return; } @@ -64,6 +72,12 @@ WebInspector.Drawer.prototype = { } }, + get savedHeight() + { + var height = this._savedHeight || this.element.offsetHeight; + return Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - this.mainElement.totalOffsetTop - Preferences.minConsoleHeight); + }, + showView: function(view) { if (!this.visible || this.visibleView !== view) @@ -85,15 +99,16 @@ WebInspector.Drawer.prototype = { document.body.addStyleClass("drawer-visible"); var anchoredItems = document.getElementById("anchored-status-bar-items"); - + var height = (this.fullPanel ? window.innerHeight - this.toolbarElement.offsetHeight : this.savedHeight); var animations = [ - {element: document.getElementById("main"), end: {bottom: this.element.offsetHeight}}, + {element: this.element, end: {height: height}}, + {element: document.getElementById("main"), end: {bottom: height}}, {element: document.getElementById("main-status-bar"), start: {"padding-left": anchoredItems.offsetWidth - 1}, end: {"padding-left": 0}}, {element: document.getElementById("other-drawer-status-bar-items"), start: {opacity: 0}, end: {opacity: 1}} ]; - var consoleStatusBar = document.getElementById("drawer-status-bar"); - consoleStatusBar.insertBefore(anchoredItems, consoleStatusBar.firstChild); + var drawerStatusBar = document.getElementById("drawer-status-bar"); + drawerStatusBar.insertBefore(anchoredItems, drawerStatusBar.firstChild); function animationFinished() { @@ -102,9 +117,11 @@ WebInspector.Drawer.prototype = { if (this.visibleView.afterShow) this.visibleView.afterShow(); delete this._animating; + delete this._currentAnimationInterval; + this.state = (this.fullPanel ? WebInspector.Drawer.State.Full : WebInspector.Drawer.State.Variable); } - WebInspector.animateStyle(animations, window.event && window.event.shiftKey ? 2000 : 250, animationFinished.bind(this)); + this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this)); }, hide: function() @@ -113,20 +130,23 @@ WebInspector.Drawer.prototype = { return; WebInspector.View.prototype.hide.call(this); - + if (this.visibleView) this.visibleView.hide(); this._animating = true; + if (!this.fullPanel) + this._savedHeight = this.element.offsetHeight; + if (this.element === WebInspector.currentFocusElement || this.element.isAncestor(WebInspector.currentFocusElement)) WebInspector.currentFocusElement = WebInspector.previousFocusElement; var anchoredItems = document.getElementById("anchored-status-bar-items"); - // Temporally set properties and classes to mimic the post-animation values so panels + // Temporarily set properties and classes to mimic the post-animation values so panels // like Elements in their updateStatusBarItems call will size things to fit the final location. - document.getElementById("main-status-bar").style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px"); + this.mainStatusBar.style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px"); document.body.removeStyleClass("drawer-visible"); if ("updateStatusBarItems" in WebInspector.currentPanel) WebInspector.currentPanel.updateStatusBarItems(); @@ -140,14 +160,102 @@ WebInspector.Drawer.prototype = { function animationFinished() { + WebInspector.currentPanel.resize(); var mainStatusBar = document.getElementById("main-status-bar"); mainStatusBar.insertBefore(anchoredItems, mainStatusBar.firstChild); mainStatusBar.style.removeProperty("padding-left"); document.body.removeStyleClass("drawer-visible"); delete this._animating; + delete this._currentAnimationInterval; + this.state = WebInspector.Drawer.State.Hidden; + } + + this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this)); + }, + + resize: function() + { + if (this.state === WebInspector.Drawer.State.Hidden) + return; + + var height; + var mainElement = document.getElementById("main"); + if (this.state === WebInspector.Drawer.State.Variable) { + height = parseInt(this.element.style.height); + height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight); + } else + height = window.innerHeight - this.toolbarElement.offsetHeight; + + mainElement.style.bottom = height + "px"; + this.element.style.height = height + "px"; + }, + + enterPanelMode: function() + { + this._cancelAnimationIfNeeded(); + this.fullPanel = true; + + if (this.visible) { + this._savedHeight = this.element.offsetHeight; + var height = window.innerHeight - this.toolbarElement.offsetHeight; + this._animateDrawerHeight(height, WebInspector.Drawer.State.Full); + } + }, + + exitPanelMode: function() + { + this._cancelAnimationIfNeeded(); + this.fullPanel = false; + + if (this.visible) { + // If this animation gets cancelled, we want the state of the drawer to be Variable, + // so that the new animation can't do an immediate transition between Hidden/Full states. + this.state = WebInspector.Drawer.State.Variable; + var height = this.savedHeight; + this._animateDrawerHeight(height, WebInspector.Drawer.State.Variable); + } + }, + + immediatelyExitPanelMode: function() + { + this.visible = false; + this.fullPanel = false; + }, + + _cancelAnimationIfNeeded: function() + { + if (this._animating) { + clearInterval(this._currentAnimationInterval); + delete this._animating; + delete this._currentAnimationInterval; + } + }, + + _animateDrawerHeight: function(height, finalState) + { + this._animating = true; + var animations = [ + {element: this.element, end: {height: height}}, + {element: document.getElementById("main"), end: {bottom: height}} + ]; + + function animationFinished() + { + delete this._animating; + delete this._currentAnimationInterval; + this.state = finalState; } - WebInspector.animateStyle(animations, window.event && window.event.shiftKey ? 2000 : 250, animationFinished.bind(this)); + this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this)); + }, + + _animationDuration: function() + { + // Immediate if going between Hidden and Full in full panel mode + if (this.fullPanel && (this.state === WebInspector.Drawer.State.Hidden || this.state === WebInspector.Drawer.State.Full)) + return 0; + + return (window.event && window.event.shiftKey ? 2000 : 250); }, _safelyRemoveChildren: function() @@ -165,10 +273,10 @@ WebInspector.Drawer.prototype = { _startStatusBarDragging: function(event) { - if (!this.visible || event.target !== document.getElementById("main-status-bar")) + if (!this.visible || event.target !== this.mainStatusBar) return; - WebInspector.elementDragStart(document.getElementById("main-status-bar"), this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize"); + WebInspector.elementDragStart(this.mainStatusBar, this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize"); this._statusBarDragOffset = event.pageY - this.element.totalOffsetTop; @@ -178,7 +286,6 @@ WebInspector.Drawer.prototype = { _statusBarDragging: function(event) { var mainElement = document.getElementById("main"); - var height = window.innerHeight - event.pageY + this._statusBarDragOffset; height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight); @@ -193,6 +300,7 @@ WebInspector.Drawer.prototype = { { WebInspector.elementDragEnd(event); + this._savedHeight = this.element.offsetHeight; delete this._statusBarDragOffset; event.stopPropagation(); @@ -200,3 +308,9 @@ WebInspector.Drawer.prototype = { } WebInspector.Drawer.prototype.__proto__ = WebInspector.View.prototype; + +WebInspector.Drawer.State = { + Hidden: 0, + Variable: 1, + Full: 2 +}; diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js index aa6319c..897fdd1 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsPanel.js @@ -36,7 +36,7 @@ WebInspector.ElementsPanel = function() this.contentElement = document.createElement("div"); this.contentElement.id = "elements-content"; - this.contentElement.className = "outline-disclosure"; + this.contentElement.className = "outline-disclosure source-code"; this.treeOutline = new WebInspector.ElementsTreeOutline(); this.treeOutline.panel = this; @@ -46,7 +46,7 @@ WebInspector.ElementsPanel = function() this.treeOutline.focusedNodeChanged = function(forceUpdate) { if (this.panel.visible && WebInspector.currentFocusElement !== document.getElementById("search")) - WebInspector.currentFocusElement = document.getElementById("main-panels"); + WebInspector.currentFocusElement = this.element; this.panel.updateBreadcrumb(forceUpdate); @@ -58,12 +58,12 @@ WebInspector.ElementsPanel = function() this.panel.updateProperties(); this.panel.updateEventListeners(); - if (InspectorController.searchingForNode()) { - InspectorController.toggleNodeSearch(); + if (InspectorBackend.searchingForNode()) { + InspectorBackend.toggleNodeSearch(); this.panel.nodeSearchButton.toggled = false; } if (this._focusedDOMNode) - InjectedScriptAccess.addInspectedNode(this._focusedDOMNode.id, function() {}); + InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {}); }; this.contentElement.appendChild(this.treeOutline.element); @@ -129,6 +129,11 @@ WebInspector.ElementsPanel.prototype = { return [this.nodeSearchButton.element, this.crumbsElement]; }, + get defaultFocusedElement() + { + return this.treeOutline.element; + }, + updateStatusBarItems: function() { this.updateBreadcrumbSizes(); @@ -141,7 +146,7 @@ WebInspector.ElementsPanel.prototype = { this.updateBreadcrumb(); this.treeOutline.updateSelection(); if (this.recentlyModifiedNodes.length) - this._updateModifiedNodes(); + this.updateModifiedNodes(); }, hide: function() @@ -150,8 +155,8 @@ WebInspector.ElementsPanel.prototype = { WebInspector.hoveredDOMNode = null; - if (InspectorController.searchingForNode()) { - InspectorController.toggleNodeSearch(); + if (InspectorBackend.searchingForNode()) { + InspectorBackend.toggleNodeSearch(); this.nodeSearchButton.toggled = false; } }, @@ -164,13 +169,24 @@ WebInspector.ElementsPanel.prototype = { reset: function() { + if (this.focusedDOMNode) { + this._selectedPathOnReset = []; + var node = this.focusedDOMNode; + while ("index" in node) { + this._selectedPathOnReset.push(node.nodeName); + this._selectedPathOnReset.push(node.index); + node = node.parentNode; + } + this._selectedPathOnReset.reverse(); + } + this.rootDOMNode = null; this.focusedDOMNode = null; WebInspector.hoveredDOMNode = null; - if (InspectorController.searchingForNode()) { - InspectorController.toggleNodeSearch(); + if (InspectorBackend.searchingForNode()) { + InspectorBackend.toggleNodeSearch(); this.nodeSearchButton.toggled = false; } @@ -178,48 +194,65 @@ WebInspector.ElementsPanel.prototype = { delete this.currentQuery; this.searchCanceled(); + }, - var domWindow = WebInspector.domAgent.domWindow; - if (!domWindow || !domWindow.document || !domWindow.document.firstChild) - return; + setDocument: function(inspectedRootDocument) + { + this.reset(); - // If the window isn't visible, return early so the DOM tree isn't built - // and mutation event listeners are not added. - if (!InspectorController.isWindowVisible()) + if (!inspectedRootDocument) return; - var inspectedRootDocument = domWindow.document; inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this)); inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this)); + inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this)); + this.treeOutline.suppressSelectHighlight = true; this.rootDOMNode = inspectedRootDocument; + this.treeOutline.suppressSelectHighlight = false; - var canidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement; - if (canidateFocusNode) { - this.treeOutline.suppressSelectHighlight = true; - this.focusedDOMNode = canidateFocusNode; - this.treeOutline.suppressSelectHighlight = false; + function selectNode(candidateFocusNode) + { + if (!candidateFocusNode) + candidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement; + if (!candidateFocusNode) + return; + + this.treeOutline.suppressSelectHighlight = true; + this.focusedDOMNode = candidateFocusNode; if (this.treeOutline.selectedTreeElement) this.treeOutline.selectedTreeElement.expand(); + this.treeOutline.suppressSelectHighlight = false; } + + function selectLastSelectedNode(nodeId) + { + if (this.focusedDOMNode) { + // Focused node has been explicitly set while reaching out for the last selected node. + return; + } + var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : 0; + selectNode.call(this, node); + } + + if (this._selectedPathOnReset) + InjectedScriptAccess.getDefault().nodeByPath(this._selectedPathOnReset, selectLastSelectedNode.bind(this)); + else + selectNode.call(this); + delete this._selectedPathOnReset; }, searchCanceled: function() { - if (this._searchResults) { - for (var i = 0; i < this._searchResults.length; ++i) { - var treeElement = this.treeOutline.findTreeElement(this._searchResults[i]); - if (treeElement) - treeElement.highlighted = false; - } - } + delete this._searchQuery; + this._hideSearchHighlights(); WebInspector.updateSearchMatchesCount(0, this); this._currentSearchResultIndex = 0; this._searchResults = []; - InjectedScriptAccess.searchCanceled(function() {}); + InjectedScriptAccess.getDefault().searchCanceled(function() {}); }, performSearch: function(query) @@ -227,14 +260,15 @@ WebInspector.ElementsPanel.prototype = { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); - const whitespaceTrimmedQuery = query.trimWhitespace(); + const whitespaceTrimmedQuery = query.trim(); if (!whitespaceTrimmedQuery.length) return; this._updatedMatchCountOnce = false; this._matchesCountUpdateTimeout = null; + this._searchQuery = query; - InjectedScriptAccess.performSearch(whitespaceTrimmedQuery, function() {}); + InjectedScriptAccess.getDefault().performSearch(whitespaceTrimmedQuery, function() {}); }, _updateMatchesCount: function() @@ -266,25 +300,10 @@ WebInspector.ElementsPanel.prototype = { if (!node) continue; - if (!this._searchResults.length) { - this._currentSearchResultIndex = 0; - - // Only change the focusedDOMNode if the search was manually performed, because - // the search may have been performed programmatically and we wouldn't want to - // change the current focusedDOMNode. - if (WebInspector.currentFocusElement === document.getElementById("search")) - this.focusedDOMNode = node; - } - + this._currentSearchResultIndex = 0; this._searchResults.push(node); - - // Highlight the tree element to show it matched the search. - // FIXME: highlight the substrings in text nodes and attributes. - var treeElement = this.treeOutline.findTreeElement(node); - if (treeElement) - treeElement.highlighted = true; } - + this._highlightCurrentSearchResult(); this._updateMatchesCountSoon(); }, @@ -292,18 +311,41 @@ WebInspector.ElementsPanel.prototype = { { if (!this._searchResults || !this._searchResults.length) return; + if (++this._currentSearchResultIndex >= this._searchResults.length) this._currentSearchResultIndex = 0; - this.focusedDOMNode = this._searchResults[this._currentSearchResultIndex]; + this._highlightCurrentSearchResult(); }, jumpToPreviousSearchResult: function() { if (!this._searchResults || !this._searchResults.length) return; + if (--this._currentSearchResultIndex < 0) this._currentSearchResultIndex = (this._searchResults.length - 1); - this.focusedDOMNode = this._searchResults[this._currentSearchResultIndex]; + this._highlightCurrentSearchResult(); + }, + + _highlightCurrentSearchResult: function() + { + this._hideSearchHighlights(); + var node = this._searchResults[this._currentSearchResultIndex]; + var treeElement = this.treeOutline.findTreeElement(node); + if (treeElement) { + treeElement.highlightSearchResults(this._searchQuery); + treeElement.reveal(); + } + }, + + _hideSearchHighlights: function(node) + { + for (var i = 0; this._searchResults && i < this._searchResults.length; ++i) { + var node = this._searchResults[i]; + var treeElement = this.treeOutline.findTreeElement(node); + if (treeElement) + treeElement.highlightSearchResults(null); + } }, renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector) @@ -440,6 +482,13 @@ WebInspector.ElementsPanel.prototype = { this.treeOutline.focusedDOMNode = x; }, + _attributesUpdated: function(event) + { + this.recentlyModifiedNodes.push({node: event.target, updated: true}); + if (this.visible) + this._updateModifiedNodesSoon(); + }, + _nodeInserted: function(event) { this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true}); @@ -458,10 +507,10 @@ WebInspector.ElementsPanel.prototype = { { if ("_updateModifiedNodesTimeout" in this) return; - this._updateModifiedNodesTimeout = setTimeout(this._updateModifiedNodes.bind(this), 0); + this._updateModifiedNodesTimeout = setTimeout(this.updateModifiedNodes.bind(this), 0); }, - _updateModifiedNodes: function() + updateModifiedNodes: function() { if ("_updateModifiedNodesTimeout" in this) { clearTimeout(this._updateModifiedNodesTimeout); @@ -474,6 +523,15 @@ WebInspector.ElementsPanel.prototype = { for (var i = 0; i < this.recentlyModifiedNodes.length; ++i) { var replaced = this.recentlyModifiedNodes[i].replaced; var parent = this.recentlyModifiedNodes[i].parent; + var node = this.recentlyModifiedNodes[i].node; + + if (this.recentlyModifiedNodes[i].updated) { + var nodeItem = this.treeOutline.findTreeElement(node); + if (nodeItem) + nodeItem.updateTitle(); + continue; + } + if (!parent) continue; @@ -525,7 +583,7 @@ WebInspector.ElementsPanel.prototype = { _mouseMovedOutOfCrumbs: function(event) { var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY); - if (nodeUnderMouse.isDescendant(this.crumbsElement)) + if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement)) return; WebInspector.hoveredDOMNode = null; @@ -996,9 +1054,22 @@ WebInspector.ElementsPanel.prototype = { eventListenersSidebarPane.needsUpdate = false; }, - handleKeyEvent: function(event) + handleShortcut: function(event) { - this.treeOutline.handleKeyEvent(event); + // Cmd/Control + Shift + C should be a shortcut to clicking the Node Search Button. + // This shortcut matches Firebug. + if (event.keyIdentifier === "U+0043") { // C key + if (WebInspector.isMac()) + var isNodeSearchKey = event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey; + else + var isNodeSearchKey = event.ctrlKey && !event.metaKey && !event.altKey && event.shiftKey; + + if (isNodeSearchKey) { + this._nodeSearchButtonClicked(event); + event.handled = true; + return; + } + } }, handleCopyEvent: function(event) @@ -1008,7 +1079,7 @@ WebInspector.ElementsPanel.prototype = { return; event.clipboardData.clearData(); event.preventDefault(); - InspectorController.copyNode(this.focusedDOMNode.id); + InspectorBackend.copyNode(this.focusedDOMNode.id); }, rightSidebarResizerDragStart: function(event) @@ -1037,9 +1108,9 @@ WebInspector.ElementsPanel.prototype = { _nodeSearchButtonClicked: function(event) { - InspectorController.toggleNodeSearch(); + InspectorBackend.toggleNodeSearch(); - this.nodeSearchButton.toggled = InspectorController.searchingForNode(); + this.nodeSearchButton.toggled = InspectorBackend.searchingForNode(); } } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js index be01647..fe7ae53 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -41,6 +41,9 @@ WebInspector.ElementsTreeOutline = function() { this.showInElementsPanelEnabled = false; this.rootDOMNode = null; this.focusedDOMNode = null; + + this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); + this.element.addEventListener("keydown", this._keyDown.bind(this), true); } WebInspector.ElementsTreeOutline.prototype = { @@ -56,9 +59,16 @@ WebInspector.ElementsTreeOutline.prototype = { this._rootDOMNode = x; + this._isXMLMimeType = !!(WebInspector.mainResource && WebInspector.mainResource.mimeType && WebInspector.mainResource.mimeType.match(/x(?:ht)?ml/i)); + this.update(); }, + get isXMLMimeType() + { + return this._isXMLMimeType; + }, + get focusedDOMNode() { return this._focusedDOMNode; @@ -83,7 +93,7 @@ WebInspector.ElementsTreeOutline.prototype = { this.focusedNodeChanged(); if (x && !this.suppressSelectHighlight) { - InspectorController.highlightDOMNode(x.id); + InspectorBackend.highlightDOMNode(x.id); if ("_restorePreviousHighlightNodeTimeout" in this) clearTimeout(this._restorePreviousHighlightNodeTimeout); @@ -92,9 +102,9 @@ WebInspector.ElementsTreeOutline.prototype = { { var hoveredNode = WebInspector.hoveredDOMNode; if (hoveredNode) - InspectorController.highlightDOMNode(hoveredNode.id); + InspectorBackend.highlightDOMNode(hoveredNode.id); else - InspectorController.hideDOMNodeHighlight(); + InspectorBackend.hideDOMNodeHighlight(); } this._restorePreviousHighlightNodeTimeout = setTimeout(restoreHighlightToHoveredNode, 2000); @@ -104,6 +114,8 @@ WebInspector.ElementsTreeOutline.prototype = { update: function() { + var selectedNode = this.selectedTreeElement ? this.selectedTreeElement.representedObject : null; + this.removeChildren(); if (!this.rootDOMNode) @@ -125,7 +137,8 @@ WebInspector.ElementsTreeOutline.prototype = { } } - this.updateSelection(); + if (selectedNode) + this.revealAndSelectNode(selectedNode); }, updateSelection: function() @@ -149,12 +162,27 @@ WebInspector.ElementsTreeOutline.prototype = { return treeElement; }, + createTreeElementFor: function(node) + { + var treeElement = this.findTreeElement(node); + if (treeElement) + return treeElement; + if (!node.parentNode) + return null; + + var treeElement = this.createTreeElementFor(node.parentNode); + if (treeElement && treeElement.showChild(node.index)) + return treeElement.children[node.index]; + + return null; + }, + revealAndSelectNode: function(node) { if (!node) return; - var treeElement = this.findTreeElement(node); + var treeElement = this.createTreeElementFor(node); if (!treeElement) return; @@ -186,21 +214,26 @@ WebInspector.ElementsTreeOutline.prototype = { return element; }, - handleKeyEvent: function(event) + _keyDown: function(event) { + if (event.target !== this.treeOutline.element) + return; + var selectedElement = this.selectedTreeElement; if (!selectedElement) return; - // Delete or backspace pressed, delete the node. - if (event.keyCode === 8 || event.keyCode === 46) { + if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Backspace || + event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) { selectedElement.remove(); + event.preventDefault(); + event.stopPropagation(); return; } // On Enter or Return start editing the first attribute // or create a new attribute on the selected element. - if (event.keyIdentifier === "Enter") { + if (isEnterKey(event)) { if (this._editing) return; @@ -208,10 +241,9 @@ WebInspector.ElementsTreeOutline.prototype = { // prevent a newline from being immediately inserted event.preventDefault(); + event.stopPropagation(); return; } - - TreeOutline.prototype.handleKeyEvent.call(this, event); }, _onmousedown: function(event) @@ -255,6 +287,23 @@ WebInspector.ElementsTreeOutline.prototype = { } WebInspector.hoveredDOMNode = null; + }, + + _contextMenuEventFired: function(event) + { + var listItem = event.target.enclosingNodeOrSelfWithNodeName("LI"); + if (!listItem || !listItem.treeElement) + return; + + var contextMenu = new WebInspector.ContextMenu(); + + var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag"); + var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node"); + if (tag && listItem.treeElement._populateTagContextMenu) + listItem.treeElement._populateTagContextMenu(contextMenu, event); + else if (textNode && listItem.treeElement._populateTextContextMenu) + listItem.treeElement._populateTextContextMenu(contextMenu, textNode); + contextMenu.show(event); } } @@ -269,27 +318,28 @@ WebInspector.ElementsTreeElement = function(node) if (this.representedObject.nodeType == Node.ELEMENT_NODE) this._canAddAttributes = true; + this._searchQuery = null; + this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildrenLimit; } -WebInspector.ElementsTreeElement.prototype = { - get highlighted() - { - return this._highlighted; - }, +WebInspector.ElementsTreeElement.InitialChildrenLimit = 500; - set highlighted(x) +// A union of HTML4 and HTML5-Draft elements that explicitly +// or implicitly (for HTML5) forbid the closing tag. +// FIXME: Revise once HTML5 Final is published. +WebInspector.ElementsTreeElement.ForbiddenClosingTagElements = [ + "area", "base", "basefont", "br", "canvas", "col", "command", "embed", "frame", + "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source" +].keySet(); + +WebInspector.ElementsTreeElement.prototype = { + highlightSearchResults: function(searchQuery) { - if (this._highlighted === x) + if (this._searchQuery === searchQuery) return; - this._highlighted = x; - - if (this.listItemElement) { - if (x) - this.listItemElement.addStyleClass("highlighted"); - else - this.listItemElement.removeStyleClass("highlighted"); - } + this._searchQuery = searchQuery; + this.updateTitle(); }, get hovered() @@ -308,41 +358,66 @@ WebInspector.ElementsTreeElement.prototype = { if (x) { this.updateSelection(); this.listItemElement.addStyleClass("hovered"); - if (this._canAddAttributes) - this._pendingToggleNewAttribute = setTimeout(this.toggleNewAttributeButton.bind(this, true), 500); } else { this.listItemElement.removeStyleClass("hovered"); - if (this._pendingToggleNewAttribute) { - clearTimeout(this._pendingToggleNewAttribute); - delete this._pendingToggleNewAttribute; - } - this.toggleNewAttributeButton(false); } } }, - toggleNewAttributeButton: function(visible) + get expandedChildrenLimit() { - function removeAddAttributeSpan() - { - if (this._addAttributeElement && this._addAttributeElement.parentNode) - this._addAttributeElement.parentNode.removeChild(this._addAttributeElement); - delete this._addAttributeElement; + return this._expandedChildrenLimit; + }, - this.updateSelection(); + set expandedChildrenLimit(x) + { + if (this._expandedChildrenLimit === x) + return; + + this._expandedChildrenLimit = x; + if (this.treeOutline && !this._updateChildrenInProgress) + this._updateChildren(true); + }, + + get expandedChildCount() + { + var count = this.children.length; + if (count && this.children[count - 1].elementCloseTag) + count--; + if (count && this.children[count - 1].expandAllButton) + count--; + return count; + }, + + showChild: function(index) + { + if (index >= this.expandedChildrenLimit) { + this._expandedChildrenLimit = index + 1; + this._updateChildren(true); } - if (!this._addAttributeElement && visible && !this._editing) { - var span = document.createElement("span"); - span.className = "add-attribute webkit-html-attribute-name"; - span.textContent = " ?=\"\""; - span.addEventListener("dblclick", removeAddAttributeSpan.bind(this), false); - this._addAttributeElement = span; + // Whether index-th child is visible in the children tree + return this.expandedChildCount > index; + }, + + createTooltipForImageNode: function(node, callback) + { + function createTooltipThenCallback(properties) + { + if (!properties) { + callback(); + return; + } - var tag = this.listItemElement.getElementsByClassName("webkit-html-tag")[0]; - this._insertInLastAttributePosition(tag, span); - } else if (!visible && this._addAttributeElement) - removeAddAttributeSpan.call(this); + var tooltipText = null; + if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth) + tooltipText = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight); + else + tooltipText = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); + callback(tooltipText); + } + var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id); + WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], createTooltipThenCallback); }, updateSelection: function() @@ -370,15 +445,12 @@ WebInspector.ElementsTreeElement.prototype = { { this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false); - if (this._highlighted) - this.listItemElement.addStyleClass("highlighted"); - if (this._hovered) { this.updateSelection(); this.listItemElement.addStyleClass("hovered"); } - this._updateTitle(); + this.updateTitle(); this._preventFollowingLinksOnDoubleClick(); }, @@ -406,9 +478,34 @@ WebInspector.ElementsTreeElement.prototype = { WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh)); }, + insertChildElement: function(child, index) + { + var newElement = new WebInspector.ElementsTreeElement(child); + newElement.selectable = this.treeOutline.selectEnabled; + this.insertChild(newElement, index); + return newElement; + }, + + moveChild: function(child, targetIndex) + { + var wasSelected = child.selected; + treeElement.removeChild(child); + treeElement.insertChild(child, targetIndex); + if (wasSelected) + existingTreeElement.select(); + }, + _updateChildren: function(fullRefresh) { + if (this._updateChildrenInProgress) + return; + + this._updateChildrenInProgress = true; + var focusedNode = this.treeOutline.focusedDOMNode; + var originalScrollTop; if (fullRefresh) { + var treeOutlineContainerElement = this.treeOutline.element.parentNode; + originalScrollTop = treeOutlineContainerElement.scrollTop; var selectedTreeElement = this.treeOutline.selectedTreeElement; if (selectedTreeElement && selectedTreeElement.hasAncestor(this)) this.select(); @@ -417,6 +514,7 @@ WebInspector.ElementsTreeElement.prototype = { var treeElement = this; var treeChildIndex = 0; + var elementToSelect; function updateChildrenOfNode(node) { @@ -427,7 +525,7 @@ WebInspector.ElementsTreeElement.prototype = { if (!currentTreeElement || currentTreeElement.representedObject !== child) { // Find any existing element that is later in the children list. var existingTreeElement = null; - for (var i = (treeChildIndex + 1); i < treeElement.children.length; ++i) { + for (var i = (treeChildIndex + 1), size = treeElement.expandedChildCount; i < size; ++i) { if (treeElement.children[i].representedObject === child) { existingTreeElement = treeElement.children[i]; break; @@ -436,16 +534,16 @@ WebInspector.ElementsTreeElement.prototype = { if (existingTreeElement && existingTreeElement.parent === treeElement) { // If an existing element was found and it has the same parent, just move it. - var wasSelected = existingTreeElement.selected; - treeElement.removeChild(existingTreeElement); - treeElement.insertChild(existingTreeElement, treeChildIndex); - if (wasSelected) - existingTreeElement.select(); + treeElement.moveChild(existingTreeElement, treeChildIndex); } else { // No existing element found, insert a new element. - var newElement = new WebInspector.ElementsTreeElement(child); - newElement.selectable = treeOutline.selectEnabled; - treeElement.insertChild(newElement, treeChildIndex); + if (treeChildIndex < treeElement.expandedChildrenLimit) { + var newElement = treeElement.insertChildElement(child, treeChildIndex); + if (child === focusedNode) + elementToSelect = newElement; + if (treeElement.expandedChildCount > treeElement.expandedChildrenLimit) + treeElement.expandedChildrenLimit++; + } } } @@ -474,6 +572,7 @@ WebInspector.ElementsTreeElement.prototype = { } updateChildrenOfNode(this.representedObject); + this.adjustCollapsedRange(false); var lastChild = this.children[this.children.length - 1]; if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild.elementCloseTag)) { @@ -483,15 +582,66 @@ WebInspector.ElementsTreeElement.prototype = { item.elementCloseTag = true; this.appendChild(item); } + + // We want to restore the original selection and tree scroll position after a full refresh, if possible. + if (fullRefresh && elementToSelect) { + elementToSelect.select(); + if (treeOutlineContainerElement && originalScrollTop <= treeOutlineContainerElement.scrollHeight) + treeOutlineContainerElement.scrollTop = originalScrollTop; + } + + delete this._updateChildrenInProgress; + }, + + adjustCollapsedRange: function() + { + // Ensure precondition: only the tree elements for node children are found in the tree + // (not the Expand All button or the closing tag). + if (this.expandAllButtonElement && this.expandAllButtonElement.__treeElement.parent) + this.removeChild(this.expandAllButtonElement.__treeElement); + + const node = this.representedObject; + if (!node.children) + return; + const childNodeCount = node.children.length; + + // In case some nodes from the expanded range were removed, pull some nodes from the collapsed range into the expanded range at the bottom. + for (var i = this.expandedChildCount, limit = Math.min(this.expandedChildrenLimit, childNodeCount); i < limit; ++i) + this.insertChildElement(node.children[i], i); + + const expandedChildCount = this.expandedChildCount; + if (childNodeCount > this.expandedChildCount) { + var targetButtonIndex = expandedChildCount; + if (!this.expandAllButtonElement) { + var title = "
-
-
+
+
-

+

diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js index 083a0af..8bcdf63 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspector.js @@ -28,28 +28,92 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var Preferences = { - showUserAgentStyles: true, - maxInlineTextChildLength: 80, - minConsoleHeight: 75, - minSidebarWidth: 100, - minElementsSidebarWidth: 200, - minScriptsSidebarWidth: 200, - showInheritedComputedStyleProperties: false, - styleRulesExpandedState: {}, - showMissingLocalizedStrings: false, - heapProfilerPresent: false, - samplingCPUProfiler: false, - showColorNicknames: true, - colorFormat: "hex", - eventListenersFilter: "all", - resourcesLargeRows: true -} +function preloadImages() +{ + (new Image()).src = "Images/clearConsoleButtonGlyph.png"; + (new Image()).src = "Images/consoleButtonGlyph.png"; + (new Image()).src = "Images/dockButtonGlyph.png"; + (new Image()).src = "Images/enableOutlineButtonGlyph.png"; + (new Image()).src = "Images/enableSolidButtonGlyph.png"; + (new Image()).src = "Images/excludeButtonGlyph.png"; + (new Image()).src = "Images/focusButtonGlyph.png"; + (new Image()).src = "Images/largerResourcesButtonGlyph.png"; + (new Image()).src = "Images/nodeSearchButtonGlyph.png"; + (new Image()).src = "Images/pauseOnExceptionButtonGlyph.png"; + (new Image()).src = "Images/percentButtonGlyph.png"; + (new Image()).src = "Images/recordButtonGlyph.png"; + (new Image()).src = "Images/recordToggledButtonGlyph.png"; + (new Image()).src = "Images/reloadButtonGlyph.png"; + (new Image()).src = "Images/undockButtonGlyph.png"; +} + +preloadImages(); var WebInspector = { resources: {}, resourceURLMap: {}, + cookieDomains: {}, missingLocalizedStrings: {}, + pendingDispatches: 0, + + // RegExp groups: + // 1 - scheme + // 2 - hostname + // 3 - ?port + // 4 - ?path + // 5 - ?fragment + URLRegExp: /^(http[s]?|file):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i, + + get platform() + { + if (!("_platform" in this)) + this._platform = InspectorFrontendHost.platform(); + + return this._platform; + }, + + get platformFlavor() + { + if (!("_platformFlavor" in this)) + this._platformFlavor = this._detectPlatformFlavor(); + + return this._platformFlavor; + }, + + _detectPlatformFlavor: function() + { + const userAgent = navigator.userAgent; + + if (this.platform === "windows") { + var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/); + if (match && match[1] >= 6) + return WebInspector.PlatformFlavor.WindowsVista; + return null; + } else if (this.platform === "mac") { + var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/); + if (!match || match[1] != 10) + return WebInspector.PlatformFlavor.MacSnowLeopard; + switch (Number(match[2])) { + case 4: + return WebInspector.PlatformFlavor.MacTiger; + case 5: + return WebInspector.PlatformFlavor.MacLeopard; + case 6: + default: + return WebInspector.PlatformFlavor.MacSnowLeopard; + } + } + + return null; + }, + + get port() + { + if (!("_port" in this)) + this._port = InspectorFrontendHost.port(); + + return this._port; + }, get previousFocusElement() { @@ -126,43 +190,35 @@ var WebInspector = { for (var panelName in WebInspector.panels) { if (WebInspector.panels[panelName] == x) - InspectorController.storeLastActivePanel(panelName); + InspectorBackend.storeLastActivePanel(panelName); } }, _createPanels: function() { - var hiddenPanels = (InspectorController.hiddenPanels() || "").split(','); + var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(','); if (hiddenPanels.indexOf("elements") === -1) this.panels.elements = new WebInspector.ElementsPanel(); if (hiddenPanels.indexOf("resources") === -1) this.panels.resources = new WebInspector.ResourcesPanel(); if (hiddenPanels.indexOf("scripts") === -1) this.panels.scripts = new WebInspector.ScriptsPanel(); + if (hiddenPanels.indexOf("timeline") === -1) + this.panels.timeline = new WebInspector.TimelinePanel(); if (hiddenPanels.indexOf("profiles") === -1) { this.panels.profiles = new WebInspector.ProfilesPanel(); this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType()); } - if (hiddenPanels.indexOf("timeline") === -1 && hiddenPanels.indexOf("timeline") === -1) - this.panels.timeline = new WebInspector.TimelinePanel(); if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) this.panels.storage = new WebInspector.StoragePanel(); - }, - _loadPreferences: function() - { - var colorFormat = InspectorController.setting("color-format"); - if (colorFormat) - Preferences.colorFormat = colorFormat; - - var eventListenersFilter = InspectorController.setting("event-listeners-filter"); - if (eventListenersFilter) - Preferences.eventListenersFilter = eventListenersFilter; + // FIXME: Uncomment when ready. + // if (hiddenPanels.indexOf("audits") === -1) + // this.panels.audits = new WebInspector.AuditsPanel(); - var resourcesLargeRows = InspectorController.setting("resources-large-rows"); - if (typeof resourcesLargeRows !== "undefined") - Preferences.resourcesLargeRows = resourcesLargeRows; + if (hiddenPanels.indexOf("console") === -1) + this.panels.console = new WebInspector.ConsolePanel(); }, get attached() @@ -183,12 +239,12 @@ var WebInspector = { var body = document.body; if (x) { - InspectorController.attach(); + InspectorFrontendHost.attach(); body.removeStyleClass("detached"); body.addStyleClass("attached"); dockToggleButton.title = WebInspector.UIString("Undock into separate window."); } else { - InspectorController.detach(); + InspectorFrontendHost.detach(); body.removeStyleClass("attached"); body.addStyleClass("detached"); dockToggleButton.title = WebInspector.UIString("Dock to main window."); @@ -357,24 +413,35 @@ var WebInspector = { } if (this._hoveredDOMNode) { - InspectorController.highlightDOMNode(this._hoveredDOMNode.id); + InspectorBackend.highlightDOMNode(this._hoveredDOMNode.id); this.showingDOMNodeHighlight = true; } else { - InspectorController.hideDOMNodeHighlight(); + InspectorBackend.hideDOMNodeHighlight(); this.showingDOMNodeHighlight = false; } } } +WebInspector.PlatformFlavor = { + WindowsVista: "windows-vista", + MacTiger: "mac-tiger", + MacLeopard: "mac-leopard", + MacSnowLeopard: "mac-snowleopard" +} + WebInspector.loaded = function() { - var platform = InspectorController.platform(); + InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");"); + + var platform = WebInspector.platform; document.body.addStyleClass("platform-" + platform); - var port = InspectorController.port(); + var flavor = WebInspector.platformFlavor; + if (flavor) + document.body.addStyleClass("platform-" + flavor); + var port = WebInspector.port; document.body.addStyleClass("port-" + port); - this._loadPreferences(); - this.pendingDispatches = 0; + this.settings = new WebInspector.Settings(); this.drawer = new WebInspector.Drawer(); this.console = new WebInspector.ConsoleView(this.drawer); @@ -401,17 +468,8 @@ WebInspector.loaded = function() var previousToolbarItem = toolbarElement.children[0]; this.panelOrder = []; - for (var panelName in this.panels) { - var panel = this.panels[panelName]; - var panelToolbarItem = panel.toolbarItem; - this.panelOrder.push(panel); - panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this)); - if (previousToolbarItem) - toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling); - else - toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild); - previousToolbarItem = panelToolbarItem; - } + for (var panelName in this.panels) + previousToolbarItem = WebInspector.addPanelToolbarIcon(toolbarElement, this.panels[panelName], previousToolbarItem); this.Tips = { ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")} @@ -427,21 +485,10 @@ WebInspector.loaded = function() window.addEventListener("resize", this.windowResize.bind(this), true); document.addEventListener("focus", this.focusChanged.bind(this), true); - document.addEventListener("keydown", this.documentKeyDown.bind(this), true); - document.addEventListener("keyup", this.documentKeyUp.bind(this), true); + document.addEventListener("keydown", this.documentKeyDown.bind(this), false); document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); document.addEventListener("copy", this.documentCopy.bind(this), true); - document.addEventListener("contextmenu", this.contextMenu.bind(this), true); - - var mainPanelsElement = document.getElementById("main-panels"); - mainPanelsElement.handleKeyEvent = this.mainKeyDown.bind(this); - mainPanelsElement.handleKeyUpEvent = this.mainKeyUp.bind(this); - mainPanelsElement.handleCopyEvent = this.mainCopy.bind(this); - - // Focus the mainPanelsElement in a timeout so it happens after the initial focus, - // so it doesn't get reset to the first toolbar button. This initial focus happens - // on Mac when the window is made key and the WebHTMLView becomes the first responder. - setTimeout(function() { WebInspector.currentFocusElement = mainPanelsElement }, 0); + document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true); var dockToggleButton = document.getElementById("dock-status-bar-item"); dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), false); @@ -463,23 +510,37 @@ WebInspector.loaded = function() var searchField = document.getElementById("search"); searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied + searchField.addEventListener("mousedown", this._searchFieldManualFocus.bind(this), false); // when the search field is manually selected + searchField.addEventListener("keydown", this._searchKeyDown.bind(this), true); toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true); document.getElementById("close-button-left").addEventListener("click", this.close, true); document.getElementById("close-button-right").addEventListener("click", this.close, true); - InspectorController.loaded(); + InspectorFrontendHost.loaded(); +} + +WebInspector.addPanelToolbarIcon = function(toolbarElement, panel, previousToolbarItem) +{ + var panelToolbarItem = panel.toolbarItem; + this.panelOrder.push(panel); + panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this)); + if (previousToolbarItem) + toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling); + else + toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild); + return panelToolbarItem; } var windowLoaded = function() { - var localizedStringsURL = InspectorController.localizedStringsURL(); + var localizedStringsURL = InspectorFrontendHost.localizedStringsURL(); if (localizedStringsURL) { var localizedStringsScriptElement = document.createElement("script"); localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false); localizedStringsScriptElement.type = "text/javascript"; localizedStringsScriptElement.src = localizedStringsURL; - document.getElementsByTagName("head").item(0).appendChild(localizedStringsScriptElement); + document.head.appendChild(localizedStringsScriptElement); } else WebInspector.loaded(); @@ -506,13 +567,14 @@ WebInspector.dispatch = function() { WebInspector.windowUnload = function(event) { - InspectorController.windowUnloading(); + InspectorFrontendHost.windowUnloading(); } WebInspector.windowResize = function(event) { - if (this.currentPanel && this.currentPanel.resize) + if (this.currentPanel) this.currentPanel.resize(); + this.drawer.resize(); } WebInspector.windowFocused = function(event) @@ -545,7 +607,7 @@ WebInspector.setAttachedWindow = function(attached) WebInspector.close = function(event) { - InspectorController.closeWindow(); + InspectorFrontendHost.closeWindow(); } WebInspector.documentClick = function(event) @@ -560,13 +622,13 @@ WebInspector.documentClick = function(event) function followLink() { // FIXME: support webkit-html-external-link links here. - if (anchor.href in WebInspector.resourceURLMap) { + if (WebInspector.canShowSourceLineForURL(anchor.href, anchor.preferredPanel)) { if (anchor.hasStyleClass("webkit-html-external-link")) { anchor.removeStyleClass("webkit-html-external-link"); anchor.addStyleClass("webkit-html-resource-link"); } - WebInspector.showResourceForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel); + WebInspector.showSourceLineForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel); } else { var profileString = WebInspector.ProfileType.URLRegExp.exec(anchor.href); if (profileString) @@ -590,166 +652,159 @@ WebInspector.documentClick = function(event) WebInspector.documentKeyDown = function(event) { - if (!this.currentFocusElement) - return; - if (this.currentFocusElement.handleKeyEvent) + if (this.currentFocusElement && this.currentFocusElement.handleKeyEvent) { this.currentFocusElement.handleKeyEvent(event); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "KeyDown"]) - WebInspector[this.currentFocusElement.id + "KeyDown"](event); + if (event.handled) { + event.preventDefault(); + return; + } + } - if (!event.handled) { - var isMac = InspectorController.platform().indexOf("mac-") === 0; + if (this.currentPanel && this.currentPanel.handleShortcut) { + this.currentPanel.handleShortcut(event); + if (event.handled) { + event.preventDefault(); + return; + } + } + + var isMac = WebInspector.isMac(); + + switch (event.keyIdentifier) { + case "U+001B": // Escape key + event.preventDefault(); + if (this.drawer.fullPanel) + return; + + this.drawer.visible = !this.drawer.visible; + break; - switch (event.keyIdentifier) { - case "U+001B": // Escape key - this.drawer.visible = !this.drawer.visible; + case "U+0046": // F key + if (isMac) + var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey; + else + var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey; + + if (isFindKey) { + WebInspector.focusSearchField(); event.preventDefault(); - break; + } - case "U+0046": // F key - if (isMac) - var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey; - else - var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey; + break; - if (isFindKey) { - var searchField = document.getElementById("search"); - searchField.focus(); - searchField.select(); - event.preventDefault(); - } + case "U+0047": // G key + if (isMac) + var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey; + else + var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey; + + if (isFindAgainKey) { + if (event.shiftKey) { + if (this.currentPanel.jumpToPreviousSearchResult) + this.currentPanel.jumpToPreviousSearchResult(); + } else if (this.currentPanel.jumpToNextSearchResult) + this.currentPanel.jumpToNextSearchResult(); + event.preventDefault(); + } - break; + break; - case "U+0047": // G key - if (isMac) - var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey; - else - var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey; - - if (isFindAgainKey) { - if (event.shiftKey) { - if (this.currentPanel.jumpToPreviousSearchResult) - this.currentPanel.jumpToPreviousSearchResult(); - } else if (this.currentPanel.jumpToNextSearchResult) - this.currentPanel.jumpToNextSearchResult(); - event.preventDefault(); - } + // Windows and Mac have two different definitions of [, so accept both. + case "U+005B": + case "U+00DB": // [ key + if (isMac) + var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; + else + var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; - break; + if (isRotateLeft) { + var index = this.panelOrder.indexOf(this.currentPanel); + index = (index === 0) ? this.panelOrder.length - 1 : index - 1; + this.panelOrder[index].toolbarItem.click(); + event.preventDefault(); + } - // Windows and Mac have two different definitions of [, so accept both. - case "U+005B": - case "U+00DB": // [ key - if (isMac) - var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; - else - var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; + break; - if (isRotateLeft) { - var index = this.panelOrder.indexOf(this.currentPanel); - index = (index === 0) ? this.panelOrder.length - 1 : index - 1; - this.panelOrder[index].toolbarItem.click(); - event.preventDefault(); - } + // Windows and Mac have two different definitions of ], so accept both. + case "U+005D": + case "U+00DD": // ] key + if (isMac) + var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; + else + var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; - break; + if (isRotateRight) { + var index = this.panelOrder.indexOf(this.currentPanel); + index = (index + 1) % this.panelOrder.length; + this.panelOrder[index].toolbarItem.click(); + event.preventDefault(); + } - // Windows and Mac have two different definitions of ], so accept both. - case "U+005D": - case "U+00DD": // ] key - if (isMac) - var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; - else - var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; + break; - if (isRotateRight) { - var index = this.panelOrder.indexOf(this.currentPanel); - index = (index + 1) % this.panelOrder.length; - this.panelOrder[index].toolbarItem.click(); - event.preventDefault(); + case "U+0041": // A key + if (isMac) + var shouldShowAuditsPanel = event.metaKey && !event.shiftKey && !event.ctrlKey && event.altKey; + else + var shouldShowAuditsPanel = event.ctrlKey && !event.shiftKey && !event.metaKey && event.altKey; + + if (shouldShowAuditsPanel) { + if (!this.panels.audits) { + this.panels.audits = new WebInspector.AuditsPanel(); + var toolbarElement = document.getElementById("toolbar"); + WebInspector.addPanelToolbarIcon(toolbarElement, this.panels.audits, this.panels.console.toolbarItem); } + this.currentPanel = this.panels.audits; + } - break; - } + break; } } -WebInspector.documentKeyUp = function(event) -{ - if (!this.currentFocusElement || !this.currentFocusElement.handleKeyUpEvent) - return; - this.currentFocusElement.handleKeyUpEvent(event); -} - WebInspector.documentCanCopy = function(event) { - if (!this.currentFocusElement) - return; - // Calling preventDefault() will say "we support copying, so enable the Copy menu". - if (this.currentFocusElement.handleCopyEvent) - event.preventDefault(); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) + if (this.currentPanel && this.currentPanel.handleCopyEvent) event.preventDefault(); } WebInspector.documentCopy = function(event) { - if (!this.currentFocusElement) - return; - if (this.currentFocusElement.handleCopyEvent) - this.currentFocusElement.handleCopyEvent(event); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) - WebInspector[this.currentFocusElement.id + "Copy"](event); + if (this.currentPanel && this.currentPanel.handleCopyEvent) + this.currentPanel.handleCopyEvent(event); } -WebInspector.contextMenu = function(event) +WebInspector.contextMenuEventFired = function(event) { if (event.handled || event.target.hasStyleClass("popup-glasspane")) event.preventDefault(); } -WebInspector.mainKeyDown = function(event) -{ - if (this.currentPanel && this.currentPanel.handleKeyEvent) - this.currentPanel.handleKeyEvent(event); -} - -WebInspector.mainKeyUp = function(event) -{ - if (this.currentPanel && this.currentPanel.handleKeyUpEvent) - this.currentPanel.handleKeyUpEvent(event); -} - -WebInspector.mainCopy = function(event) +WebInspector.animateStyle = function(animations, duration, callback) { - if (this.currentPanel && this.currentPanel.handleCopyEvent) - this.currentPanel.handleCopyEvent(event); -} + var interval; + var complete = 0; -WebInspector.animateStyle = function(animations, duration, callback, complete) -{ - if (complete === undefined) - complete = 0; - var slice = (1000 / 30); // 30 frames per second + const intervalDuration = (1000 / 30); // 30 frames per second. + const animationsLength = animations.length; + const propertyUnit = {opacity: ""}; + const defaultUnit = "px"; - var defaultUnit = "px"; - var propertyUnit = {opacity: ""}; + function cubicInOut(t, b, c, d) + { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + } - for (var i = 0; i < animations.length; ++i) { + // Pre-process animations. + for (var i = 0; i < animationsLength; ++i) { var animation = animations[i]; - var element = null; - var start = null; - var current = null; - var end = null; - var key = null; + var element = null, start = null, end = null, key = null; for (key in animation) { if (key === "element") element = animation[key]; else if (key === "start") start = animation[key]; - else if (key === "current") - current = animation[key]; else if (key === "end") end = animation[key]; } @@ -757,49 +812,54 @@ WebInspector.animateStyle = function(animations, duration, callback, complete) if (!element || !end) continue; - var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element); if (!start) { + var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element); start = {}; for (key in end) start[key] = parseInt(computedStyle.getPropertyValue(key)); animation.start = start; - } else if (complete == 0) + } else for (key in start) element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); + } - if (!current) { - current = {}; - for (key in start) - current[key] = start[key]; - animation.current = current; - } - - function cubicInOut(t, b, c, d) - { - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; + function animateLoop() + { + // Advance forward. + complete += intervalDuration; + var next = complete + intervalDuration; + + // Make style changes. + for (var i = 0; i < animationsLength; ++i) { + var animation = animations[i]; + var element = animation.element; + var start = animation.start; + var end = animation.end; + if (!element || !end) + continue; + + var style = element.style; + for (key in end) { + var endValue = end[key]; + if (next < duration) { + var startValue = start[key]; + var newValue = cubicInOut(complete, startValue, endValue - startValue, duration); + style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); + } else + style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); + } } - var style = element.style; - for (key in end) { - var startValue = start[key]; - var currentValue = current[key]; - var endValue = end[key]; - if ((complete + slice) < duration) { - var delta = (endValue - startValue) / (duration / slice); - var newValue = cubicInOut(complete, startValue, endValue - startValue, duration); - style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); - current[key] = newValue; - } else { - style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); - } + // End condition. + if (complete >= duration) { + clearInterval(interval); + if (callback) + callback(); } } - if (complete < duration) - setTimeout(WebInspector.animateStyle, slice, animations, duration, callback, complete + slice); - else if (callback) - callback(); + interval = setInterval(animateLoop, intervalDuration); + return interval; } WebInspector.updateSearchLabel = function() @@ -816,14 +876,22 @@ WebInspector.updateSearchLabel = function() } } +WebInspector.focusSearchField = function() +{ + var searchField = document.getElementById("search"); + searchField.focus(); + searchField.select(); +} + WebInspector.toggleAttach = function() { this.attached = !this.attached; + this.drawer.resize(); } WebInspector.toolbarDragStart = function(event) { - if ((!WebInspector.attached && InspectorController.platform() !== "mac-leopard") || InspectorController.port() == "qt") + if ((!WebInspector.attached && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port == "qt") return; var target = event.target; @@ -857,14 +925,14 @@ WebInspector.toolbarDrag = function(event) if (WebInspector.attached) { var height = window.innerHeight - (event.screenY - toolbar.lastScreenY); - InspectorController.setAttachedWindowHeight(height); + InspectorFrontendHost.setAttachedWindowHeight(height); } else { var x = event.screenX - toolbar.lastScreenX; var y = event.screenY - toolbar.lastScreenY; // We cannot call window.moveBy here because it restricts the movement // of the window at the edges. - InspectorController.moveByUnrestricted(x, y); + InspectorFrontendHost.moveWindowBy(x, y); } toolbar.lastScreenX = event.screenX; @@ -927,6 +995,11 @@ WebInspector.showScriptsPanel = function() this.currentPanel = this.panels.scripts; } +WebInspector.showTimelinePanel = function() +{ + this.currentPanel = this.panels.timeline; +} + WebInspector.showProfilesPanel = function() { this.currentPanel = this.panels.profiles; @@ -937,32 +1010,14 @@ WebInspector.showStoragePanel = function() this.currentPanel = this.panels.storage; } -WebInspector.addResource = function(identifier, payload) +WebInspector.showConsolePanel = function() { - var resource = new WebInspector.Resource( - payload.requestHeaders, - payload.requestURL, - payload.host, - payload.path, - payload.lastPathComponent, - identifier, - payload.isMainResource, - payload.cached, - payload.requestMethod, - payload.requestFormData); - this.resources[identifier] = resource; - this.resourceURLMap[resource.url] = resource; - - if (resource.mainResource) - this.mainResource = resource; - - if (this.panels.resources) - this.panels.resources.addResource(resource); + this.currentPanel = this.panels.console; } WebInspector.clearConsoleMessages = function() { - WebInspector.console.clearMessages(false); + WebInspector.console.clearMessages(); } WebInspector.selectDatabase = function(o) @@ -980,18 +1035,34 @@ WebInspector.selectDOMStorage = function(o) WebInspector.updateResource = function(identifier, payload) { var resource = this.resources[identifier]; - if (!resource) - return; + if (!resource) { + resource = new WebInspector.Resource(identifier, payload.url); + this.resources[identifier] = resource; + this.resourceURLMap[resource.url] = resource; + if (this.panels.resources) + this.panels.resources.addResource(resource); + } if (payload.didRequestChange) { - resource.url = payload.url; - resource.domain = payload.domain; + resource.domain = payload.host; resource.path = payload.path; resource.lastPathComponent = payload.lastPathComponent; resource.requestHeaders = payload.requestHeaders; resource.mainResource = payload.mainResource; resource.requestMethod = payload.requestMethod; resource.requestFormData = payload.requestFormData; + resource.cached = payload.cached; + resource.documentURL = payload.documentURL; + + if (resource.mainResource) + this.mainResource = resource; + + var match = payload.documentURL.match(WebInspector.URLRegExp); + if (match) { + var protocol = match[1].toLowerCase(); + if (protocol.indexOf("http") === 0 || protocol === "file") + this._addCookieDomain(protocol === "file" ? "" : match[2]); + } } if (payload.didResponseChange) { @@ -1023,20 +1094,24 @@ WebInspector.updateResource = function(identifier, payload) resource.responseReceivedTime = payload.responseReceivedTime; if (payload.endTime) resource.endTime = payload.endTime; - + if (payload.loadEventTime) { // This loadEventTime is for the main resource, and we want to show it // for all resources on this page. This means we want to set it as a member // of the resources panel instead of the individual resource. if (this.panels.resources) this.panels.resources.mainResourceLoadTime = payload.loadEventTime; + if (this.panels.audits) + this.panels.audits.mainResourceLoadTime = payload.loadEventTime; } - + if (payload.domContentEventTime) { // This domContentEventTime is for the main resource, so it should go in // the resources panel for the same reasons as above. if (this.panels.resources) this.panels.resources.mainResourceDOMContentTime = payload.domContentEventTime; + if (this.panels.audits) + this.panels.audits.mainResourceDOMContentTime = payload.domContentEventTime; } } } @@ -1057,6 +1132,8 @@ WebInspector.removeResource = function(identifier) WebInspector.addDatabase = function(payload) { + if (!this.panels.storage) + return; var database = new WebInspector.Database( payload.id, payload.domain, @@ -1065,14 +1142,22 @@ WebInspector.addDatabase = function(payload) this.panels.storage.addDatabase(database); } -WebInspector.addCookieDomain = function(domain) +WebInspector._addCookieDomain = function(domain) { - if (this.panels.storage) - this.panels.storage.addCookieDomain(domain); + // Eliminate duplicate domains from the list. + if (domain in this.cookieDomains) + return; + this.cookieDomains[domain] = true; + + if (!this.panels.storage) + return; + this.panels.storage.addCookieDomain(domain); } WebInspector.addDOMStorage = function(payload) { + if (!this.panels.storage) + return; var domStorage = new WebInspector.DOMStorage( payload.id, payload.host, @@ -1082,6 +1167,8 @@ WebInspector.addDOMStorage = function(payload) WebInspector.updateDOMStorage = function(storageId) { + if (!this.panels.storage) + return; this.panels.storage.updateDOMStorage(storageId); } @@ -1162,6 +1249,7 @@ WebInspector.reset = function() this.resources = {}; this.resourceURLMap = {}; + this.cookieDomains = {}; this.hoveredDOMNode = null; delete this.mainResource; @@ -1181,7 +1269,13 @@ WebInspector.didCommitLoad = function() WebInspector.setDocument(null); } -WebInspector.addConsoleMessage = function(payload) +WebInspector.updateConsoleMessageExpiredCount = function(count) +{ + var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count); + WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning)); +} + +WebInspector.addConsoleMessage = function(payload, opt_args) { var consoleMessage = new WebInspector.ConsoleMessage( payload.source, @@ -1204,23 +1298,23 @@ WebInspector.log = function(message) { // remember 'this' for setInterval() callback var self = this; - + // return indication if we can actually log a message function isLogAvailable() { return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console; } - + // flush the queue of pending messages function flushQueue() { var queued = WebInspector.log.queued; - if (!queued) + if (!queued) return; - + for (var i = 0; i < queued.length; ++i) logMessage(queued[i]); - + delete WebInspector.log.queued; } @@ -1230,26 +1324,26 @@ WebInspector.log = function(message) { if (!isLogAvailable()) return; - + clearInterval(WebInspector.log.interval); delete WebInspector.log.interval; - + flushQueue(); } - + // actually log the message function logMessage(message) { var repeatCount = 1; if (message == WebInspector.log.lastMessage) repeatCount = WebInspector.log.repeatCount + 1; - + WebInspector.log.lastMessage = message; WebInspector.log.repeatCount = repeatCount; - + // ConsoleMessage expects a proxy object - message = new WebInspector.ObjectProxy(null, [], 0, message, false); - + message = new WebInspector.ObjectProxy(null, null, [], message, false); + // post the message var msg = new WebInspector.ConsoleMessage( WebInspector.ConsoleMessage.MessageSource.Other, @@ -1260,20 +1354,20 @@ WebInspector.log = function(message) null, repeatCount, message); - + self.console.addMessage(msg); } - + // if we can't log the message, queue it if (!isLogAvailable()) { if (!WebInspector.log.queued) WebInspector.log.queued = []; - + WebInspector.log.queued.push(message); - + if (!WebInspector.log.interval) WebInspector.log.interval = setInterval(flushQueueIfAvailable, 1000); - + return; } @@ -1286,7 +1380,7 @@ WebInspector.log = function(message) WebInspector.addProfileHeader = function(profile) { - this.panels.profiles.addProfileHeader(WebInspector.CPUProfileType.TypeId, new WebInspector.CPUProfile(profile)); + this.panels.profiles.addProfileHeader(profile); } WebInspector.setRecordingProfile = function(isProfiling) @@ -1361,31 +1455,34 @@ WebInspector.resourceForURL = function(url) return null; } -WebInspector.showResourceForURL = function(url, line, preferredPanel) +WebInspector._choosePanelToShowSourceLineForURL = function(url, preferredPanel) { - var resource = this.resourceForURL(url); - if (!resource) - return false; + preferredPanel = preferredPanel || "resources"; + var panel = this.panels[preferredPanel]; + if (panel && panel.canShowSourceLineForURL(url)) + return panel; + panel = this.panels.resources; + return panel.canShowSourceLineForURL(url) ? panel : null; +} - if (preferredPanel && preferredPanel in WebInspector.panels) { - var panel = this.panels[preferredPanel]; - if (!("showResource" in panel)) - panel = null; - else if ("canShowResource" in panel && !panel.canShowResource(resource)) - panel = null; - } +WebInspector.canShowSourceLineForURL = function(url, preferredPanel) +{ + return !!this._choosePanelToShowSourceLineForURL(url, preferredPanel); +} - this.currentPanel = panel || this.panels.resources; +WebInspector.showSourceLineForURL = function(url, line, preferredPanel) +{ + this.currentPanel = this._choosePanelToShowSourceLineForURL(url, preferredPanel); if (!this.currentPanel) return false; - this.currentPanel.showResource(resource, line); + this.currentPanel.showSourceLineForURL(url, line); return true; } WebInspector.linkifyStringAsFragment = function(string) { var container = document.createDocumentFragment(); - var linkStringRegEx = new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}://|www\\.)[\\w$\\-_+*'=\\|/\\\\(){}[\\]%@&#~,:;.!?]{2,}[\\w$\\-_+*=\\|/\\\\({%@&#~]"); + var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/; while (string) { var linkString = linkStringRegEx.exec(string); @@ -1413,12 +1510,13 @@ WebInspector.linkifyStringAsFragment = function(string) return container; } -WebInspector.showProfileForURL = function(url) { +WebInspector.showProfileForURL = function(url) +{ WebInspector.showProfilesPanel(); WebInspector.panels.profiles.showProfileForURL(url); } -WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal) +WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, tooltipText) { if (!linkText) linkText = url; @@ -1428,18 +1526,32 @@ WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal) var a = document.createElement("a"); a.href = url; a.className = classes; - a.title = url; + a.title = tooltipText || url; a.target = "_blank"; a.textContent = linkText; return a; } -WebInspector.linkifyURL = function(url, linkText, classes, isExternal) +WebInspector.linkifyURL = function(url, linkText, classes, isExternal, tooltipText) { // Use the DOM version of this function so as to avoid needing to escape attributes. // FIXME: Get rid of linkifyURL entirely. - return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal).outerHTML; + return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal, tooltipText).outerHTML; +} + +WebInspector.completeURL = function(baseURL, href) +{ + var match = baseURL.match(WebInspector.URLRegExp); + if (match) { + var path = href; + if (path.charAt(0) !== "/") { + var basePath = match[4] || "/"; + path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path; + } + return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path; + } + return null; } WebInspector.addMainEventListeners = function(doc) @@ -1449,8 +1561,32 @@ WebInspector.addMainEventListeners = function(doc) doc.addEventListener("click", this.documentClick.bind(this), true); } -WebInspector.searchKeyDown = function(event) +WebInspector._searchFieldManualFocus = function(event) +{ + this.currentFocusElement = event.target; + this._previousFocusElement = event.target; +} + +WebInspector._searchKeyDown = function(event) { + // Escape Key will clear the field and clear the search results + if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) { + // If focus belongs here and text is empty - nothing to do, return unhandled. + if (event.target.value === "" && this.currentFocusElement === this.previousFocusElement) + return; + event.preventDefault(); + event.stopPropagation(); + // When search was selected manually and is currently blank, we'd like Esc stay unhandled + // and hit console drawer handler. + event.target.value = ""; + + this.performSearch(event); + this.currentFocusElement = this.previousFocusElement; + if (this.currentFocusElement === event.target) + this.currentFocusElement.select(); + return false; + } + if (!isEnterKey(event)) return false; @@ -1560,7 +1696,7 @@ WebInspector.UIString = function(string) string = window.localizedStrings[string]; else { if (!(string in this.missingLocalizedStrings)) { - if (!WebInspector.InspectorControllerStub) + if (!WebInspector.InspectorBackendStub) console.error("Localized string \"" + string + "\" not found."); this.missingLocalizedStrings[string] = true; } @@ -1572,19 +1708,26 @@ WebInspector.UIString = function(string) return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); } +WebInspector.isMac = function() +{ + if (!("_isMac" in this)) + this._isMac = WebInspector.platform === "mac"; + + return this._isMac; +} + WebInspector.isBeingEdited = function(element) { return element.__editing; } -WebInspector.startEditing = function(element, committedCallback, cancelledCallback, context) +WebInspector.startEditing = function(element, committedCallback, cancelledCallback, context, multiline) { if (element.__editing) return; element.__editing = true; var oldText = getContent(element); - var oldHandleKeyEvent = element.handleKeyEvent; var moveDirection = ""; element.addStyleClass("editing"); @@ -1612,8 +1755,8 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba this.scrollTop = 0; this.scrollLeft = 0; - this.handleKeyEvent = oldHandleKeyEvent; element.removeEventListener("blur", blurEventListener, false); + element.removeEventListener("keydown", keyDownEventListener, true); if (element === WebInspector.currentFocusElement || element.isAncestor(WebInspector.currentFocusElement)) WebInspector.currentFocusElement = WebInspector.previousFocusElement; @@ -1638,24 +1781,24 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba committedCallback(this, getContent(this), oldText, context, moveDirection); } - element.handleKeyEvent = function(event) { - if (oldHandleKeyEvent) - oldHandleKeyEvent(event); - if (event.handled) - return; - - if (isEnterKey(event)) { + function keyDownEventListener(event) { + var isMetaOrCtrl = WebInspector.isMac() ? + event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey : + event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; + if (isEnterKey(event) && (!multiline || isMetaOrCtrl)) { editingCommitted.call(element); event.preventDefault(); - } else if (event.keyCode === 27) { // Escape key + event.stopPropagation(); + } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) { editingCancelled.call(element); event.preventDefault(); - event.handled = true; + event.stopPropagation(); } else if (event.keyIdentifier === "U+0009") // Tab key moveDirection = (event.shiftKey ? "backward" : "forward"); } element.addEventListener("blur", blurEventListener, false); + element.addEventListener("keydown", keyDownEventListener, true); WebInspector.currentFocusElement = element; } diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css b/src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css index 2cbb3c5..0965a5c 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css @@ -30,9 +30,9 @@ color: rgb(0, 116, 0); } -.webkit-css-string, .webkit-css-keyword, .webkit-css-unit { +.webkit-css-url, .webkit-css-color, .webkit-css-string, .webkit-css-keyword { color: rgb(7, 144, 154); -} + } .webkit-css-number { color: rgb(50, 0, 255); @@ -42,16 +42,12 @@ color: rgb(200, 0, 0); } -.webkit-css-url { - color: rgb(0, 0, 0); -} - .webkit-css-selector { - color: rgb(0, 0, 0); + color: black; } -.webkit-css-pseudo-class { - color: rgb(128, 128, 128); +.webkit-css-important { + color: rgb(200, 0, 180); } .webkit-javascript-comment { @@ -69,3 +65,47 @@ .webkit-javascript-string, .webkit-javascript-regexp { color: rgb(196, 26, 22); } + +.webkit-javascript-ident { + color: black; +} + +.webkit-html-comment { + /* Keep this in sync with view-source.css (.webkit-html-comment) */ + color: rgb(35, 110, 37); +} + +.webkit-html-tag { + /* Keep this in sync with view-source.css (.webkit-html-tag) */ + color: rgb(136, 18, 128); +} + +.webkit-html-doctype { + /* Keep this in sync with view-source.css (.webkit-html-doctype) */ + color: rgb(192, 192, 192); +} + +.webkit-html-attribute-name { + /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */ + color: rgb(153, 69, 0); +} + +.webkit-html-attribute-value { + /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */ + color: rgb(26, 26, 166); +} + +.webkit-html-external-link, .webkit-html-resource-link { + /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */ + color: #00e; +} + +.webkit-html-external-link { + /* Keep this in sync with view-source.css (.webkit-html-external-link) */ + text-decoration: none; +} + +.webkit-html-external-link:hover { + /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */ + text-decoration: underline; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/popover.css b/src/3rdparty/webkit/WebCore/inspector/front-end/popover.css new file mode 100644 index 0000000..ae6f610 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/popover.css @@ -0,0 +1,200 @@ +.popover { + position: absolute; + -webkit-border-image: url(Images/popoverBackground.png) 25 25 25 25; + border-width: 25px; + z-index: 100; + pointer-events: none; +} + +.popover .content { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + pointer-events: auto; + overflow: auto; +} + +.popover .arrow { + position: absolute; + background-image: url(Images/popoverArrows.png); + width: 19px; + height: 19px; + margin-left: 15px; + margin-top: -25px; + top: 0; + left: 0; +} + +.popover.top-left-arrow .arrow { + /* The default is top-left, no styles needed. */ +} + +.popover.top-right-arrow .arrow { + right: 25px; + left: auto; +} + +.popover.bottom-left-arrow .arrow { + top: auto; + bottom: 0; + margin-top: 0; + margin-bottom: -25px; + background-position: 0 -19px; +} + +.popover.bottom-right-arrow .arrow { + right: 15px; + left: auto; + top: auto; + bottom: 0; + margin-top: 0; + margin-bottom: -25px; + background-position: 0 -19px; +} + +.popover.left-top-arrow .arrow { + top: 0; + margin-top: 15px; + margin-left: -25px; + background-position: 0 -38px; +} + +.popover.left-bottom-arrow .arrow { + top: auto; + bottom: 0; + margin-bottom: 15px; + margin-left: -25px; + background-position: 0 -38px; +} + +.popover.right-top-arrow .arrow { + right: 0; + left: auto; + top: 0; + margin-top: 15px; + margin-right: -25px; + background-position: 0 -57px; +} + +.popover.right-bottom-arrow .arrow { + right: 0; + left: auto; + top: auto; + bottom: 0; + margin-bottom: 15px; + margin-right: -25px; + background-position: 0 -57px; +} + +.popover ::-webkit-scrollbar { + width: 11px; + height: 11px; +} + +.popover ::-webkit-scrollbar-corner { + display: none; +} + +.popover ::-webkit-resizer { + display: none; +} + +/* Horizontal Scrollbar Styles */ + +.popover ::-webkit-scrollbar:horizontal:corner-present { + border-right-width: 0; +} + +.popover ::-webkit-scrollbar-thumb:horizontal { + -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11; + border-color: transparent; + border-width: 0 11px; + min-width: 20px; +} + +.popover ::-webkit-scrollbar-thumb:horizontal:hover { + -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11; +} + +.popover ::-webkit-scrollbar-thumb:horizontal:active { + -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11; +} + +.popover ::-webkit-scrollbar-track-piece:horizontal:start { + margin-left: 5px; +} + +.popover ::-webkit-scrollbar-track-piece:horizontal:end { + margin-right: 5px; +} + +.popover ::-webkit-scrollbar-track-piece:horizontal:end:corner-present { + margin-right: 4px; +} + +.popover ::-webkit-scrollbar-track-piece:horizontal:decrement { + -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11; + border-color: transparent; + border-width: 0 0 0 11px; +} + +.popover ::-webkit-scrollbar-track-piece:horizontal:increment { + -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11; + border-color: transparent; + border-width: 0 11px 0 0; +} + +/* Vertical Scrollbar Styles */ + + +.popover ::-webkit-scrollbar:vertical:corner-present { + border-bottom-width: 0; +} + +.popover ::-webkit-scrollbar-thumb:vertical { + -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0; + border-color: transparent; + border-width: 11px 0; + min-height: 20px; +} + +.popover ::-webkit-scrollbar-thumb:vertical:hover { + -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0; +} + +.popover ::-webkit-scrollbar-thumb:vertical:active { + -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0; +} + + +.popover ::-webkit-scrollbar-track-piece:vertical:start { + margin-top: 5px; +} + +.popover ::-webkit-scrollbar-track-piece:vertical:end { + margin-bottom: 5px; +} + +.popover ::-webkit-scrollbar-track-piece:vertical:end:corner-present { + margin-bottom: 4px; +} + +.popover ::-webkit-scrollbar-track-piece:vertical:decrement { + -webkit-border-image: url(Images/trackVert.png) 11 0 11 0; + border-color: transparent; + border-width: 11px 0 0 0; +} + +.popover ::-webkit-scrollbar-track-piece:vertical:increment { + -webkit-border-image: url(Images/trackVert.png) 11 0 11 0; + border-color: transparent; + border-width: 0 0 11px 0; +} + +/* Forced Scrollbar Mode Styles */ + +.popover ::-webkit-scrollbar-button { + display: none; +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css b/src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css new file mode 100644 index 0000000..1447dfd --- /dev/null +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/textViewer.css @@ -0,0 +1,148 @@ +.text-editor { + position: absolute; + top:0; + left:0; + right:0; + bottom:0; + white-space: pre; + overflow: auto; +} + +.text-editor-lines { + border: 0; + width: 100%; + -webkit-border-horizontal-spacing: 0; + -webkit-border-vertical-spacing: 0; + -webkit-user-select: text; +} + +.webkit-html-message-bubble { + -webkit-box-shadow: black 0px 2px 5px; + -webkit-border-radius: 9px; + -webkit-border-fit: lines; + font-size: 10px; + font-family: Lucida Grande, sans-serif; + font-weight: bold; + margin: 6px 25px; + padding: 0 7px 1px; + z-index:20; + max-width: 80%; + +} + +.webkit-html-warning-message { + background-color: rgb(100%, 62%, 42%); + border: 2px solid rgb(100%, 52%, 21%); +} + +.webkit-html-error-message { + background-color: rgb(100%, 42%, 42%); + border: 2px solid rgb(100%, 31%, 31%); +} + +.webkit-html-message-line { + padding-left: 23px; + text-indent: -20px; +} + +.webkit-html-message-line-hover { + padding-left: 23px; + text-indent: -20px; + white-space: auto; + text-overflow: auto; + overflow: auto; +} + +.webkit-html-message-icon { + position: relative; + top: 2px; + margin: 0 4px; +} + +.webkit-line-number { + color: rgb(128, 128, 128); + text-align: right; + word-break: normal; + -webkit-user-select: none; + background-color: rgb(240, 240, 240); + border-right: 1px solid rgb(187, 187, 187) !important; + padding-left: 2px; + padding-right: 2px; + background-repeat: no-repeat; + background-position: right 1px; + vertical-align: top; +} + +.webkit-line-content { + padding-left: 2px; + vertical-align: top; +} + +.webkit-execution-line .webkit-line-number { + color: transparent; + background-image: -webkit-canvas(program-counter); +} + +.webkit-breakpoint .webkit-line-number { + color: white; + background-image: -webkit-canvas(breakpoint); +} + +.webkit-breakpoint-disabled .webkit-line-number { + color: white; + background-image: -webkit-canvas(breakpoint-disabled); +} + +.webkit-breakpoint.webkit-execution-line .webkit-line-number { + color: transparent; + background-image: -webkit-canvas(breakpoint-program-counter); +} + +.webkit-breakpoint-disabled.webkit-execution-line .webkit-line-number { + color: transparent; + background-image: -webkit-canvas(breakpoint-disabled-program-counter); +} + +.webkit-breakpoint.webkit-breakpoint-conditional .webkit-line-number { + color: white; + background-image: -webkit-canvas(breakpoint-conditional); +} + +.webkit-breakpoint-disabled.webkit-breakpoint-conditional .webkit-line-number { + color: white; + background-image: -webkit-canvas(breakpoint-disabled-conditional); +} + +.webkit-breakpoint.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number { + color: transparent; + background-image: -webkit-canvas(breakpoint-conditional-program-counter); +} + +.webkit-breakpoint-disabled.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number { + color: transparent; + background-image: -webkit-canvas(breakpoint-disabled-conditional-program-counter); +} + +.webkit-execution-line .webkit-line-content { + background-color: rgb(171, 191, 254); + outline: 1px solid rgb(64, 115, 244); +} + +.webkit-search-result { + -webkit-border-radius: 4px; + padding: 2px 2px 2px 3px; + margin: -2px -2px -2px -3px; + opacity: 0.8; + -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px; + background-color: rgb(241, 234, 0); + color: black; +} + +.webkit-highlighted-line .webkit-line-content { + -webkit-animation: "fadeout" 2s 0s; +} + +@-webkit-keyframes fadeout { + from {background-color: rgb(255, 255, 120); } + to { background-color: white; } +} diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js b/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js index ecc322b..b6e35bb 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/treeoutline.js @@ -40,6 +40,9 @@ function TreeOutline(listNode) this.expanded = true; this.selected = false; this.treeOutline = this; + + this._childrenListNode.tabIndex = 0; + this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true); } TreeOutline._knownTreeElementNextIdentifier = 1; @@ -141,7 +144,15 @@ TreeOutline._removeChildAtIndex = function(childIndex) var child = this.children[childIndex]; this.children.splice(childIndex, 1); - child.deselect(); + var parent = child.parent; + if (child.deselect()) { + if (child.previousSibling) + child.previousSibling.select(); + else if (child.nextSibling) + child.nextSibling.select(); + else + parent.select(); + } if (child.previousSibling) child.previousSibling.nextSibling = child.nextSibling; @@ -327,10 +338,13 @@ TreeOutline.prototype.treeElementFromPoint = function(x, y) return null; } -TreeOutline.prototype.handleKeyEvent = function(event) +TreeOutline.prototype._treeKeyDown = function(event) { + if (event.target !== this._childrenListNode) + return; + if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey) - return false; + return; var handled = false; var nextSelectedElement; @@ -386,8 +400,6 @@ TreeOutline.prototype.handleKeyEvent = function(event) event.preventDefault(); event.stopPropagation(); } - - return handled; } TreeOutline.prototype.expand = function() @@ -624,7 +636,7 @@ TreeElement.treeElementDoubleClicked = function(event) return; if (element.treeElement.ondblclick) - element.treeElement.ondblclick(element.treeElement, event); + element.treeElement.ondblclick.call(element.treeElement, event); else if (element.treeElement.hasChildren && !element.treeElement.expanded) element.treeElement.expand(); } @@ -764,6 +776,7 @@ TreeElement.prototype.select = function(supressOnSelect) this.treeOutline.selectedTreeElement.deselect(); this.selected = true; + this.treeOutline._childrenListNode.focus(); this.treeOutline.selectedTreeElement = this; if (this._listItemNode) this._listItemNode.addStyleClass("selected"); @@ -775,7 +788,7 @@ TreeElement.prototype.select = function(supressOnSelect) TreeElement.prototype.deselect = function(supressOnDeselect) { if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected) - return; + return false; this.selected = false; this.treeOutline.selectedTreeElement = null; @@ -784,6 +797,7 @@ TreeElement.prototype.deselect = function(supressOnDeselect) if (this.ondeselect && !supressOnDeselect) this.ondeselect(this); + return true; } TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate, info) diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js index e9d185f..f30ab9f 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/utilities.js @@ -145,15 +145,44 @@ Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, di return result; } +Node.prototype.traverseNextTextNode = function(stayWithin) +{ + var node = this.traverseNextNode(stayWithin); + if (!node) + return; + + while (node && node.nodeType !== Node.TEXT_NODE) + node = node.traverseNextNode(stayWithin); + + return node; +} + +Node.prototype.rangeBoundaryForOffset = function(offset) +{ + var node = this.traverseNextTextNode(this); + while (node && offset > node.nodeValue.length) { + offset -= node.nodeValue.length; + node = node.traverseNextTextNode(this); + } + if (!node) + return { container: this, offset: 0 }; + return { container: node, offset: offset }; +} + Element.prototype.removeStyleClass = function(className) { - // Test for the simple case before using a RegExp. + // Test for the simple case first. if (this.className === className) { this.className = ""; return; } - this.removeMatchingStyleClasses(className.escapeForRegExp()); + var index = this.className.indexOf(className); + if (index === -1) + return; + + var newClassName = " " + this.className + " "; + this.className = newClassName.replace(" " + className + " ", " "); } Element.prototype.removeMatchingStyleClasses = function(classNameRegex) @@ -173,11 +202,15 @@ Element.prototype.hasStyleClass = function(className) { if (!className) return false; - // Test for the simple case before using a RegExp. + // Test for the simple case if (this.className === className) return true; - var regex = new RegExp("(^|\\s)" + className.escapeForRegExp() + "($|\\s)"); - return regex.test(this.className); + + var index = this.className.indexOf(className); + if (index === -1) + return false; + var toTest = " " + this.className + " "; + return toTest.indexOf(" " + className + " ", index) !== -1; } Element.prototype.positionAt = function(x, y) @@ -222,8 +255,7 @@ Element.prototype.query = function(query) Element.prototype.removeChildren = function() { - while (this.firstChild) - this.removeChild(this.firstChild); + this.innerHTML = ""; } Element.prototype.isInsertionCaretInside = function() @@ -239,7 +271,7 @@ Element.prototype.__defineGetter__("totalOffsetLeft", function() { var total = 0; for (var element = this; element; element = element.offsetParent) - total += element.offsetLeft; + total += element.offsetLeft + (this !== element ? element.clientLeft : 0); return total; }); @@ -247,7 +279,7 @@ Element.prototype.__defineGetter__("totalOffsetTop", function() { var total = 0; for (var element = this; element; element = element.offsetParent) - total += element.offsetTop; + total += element.offsetTop + (this !== element ? element.clientTop : 0); return total; }); @@ -325,24 +357,9 @@ String.prototype.collapseWhitespace = function() return this.replace(/[\s\xA0]+/g, " "); } -String.prototype.trimLeadingWhitespace = function() -{ - return this.replace(/^[\s\xA0]+/g, ""); -} - -String.prototype.trimTrailingWhitespace = function() -{ - return this.replace(/[\s\xA0]+$/g, ""); -} - -String.prototype.trimWhitespace = function() -{ - return this.replace(/^[\s\xA0]+|[\s\xA0]+$/g, ""); -} - String.prototype.trimURL = function(baseURLDomain) { - var result = this.replace(new RegExp("^http[s]?:\/\/", "i"), ""); + var result = this.replace(/^https?:\/\//i, ""); if (baseURLDomain) result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp(), "i"), ""); return result; @@ -542,6 +559,9 @@ Number.secondsToString = function(seconds, formatterFunction, higherResolution) if (!formatterFunction) formatterFunction = String.sprintf; + if (seconds === 0) + return "0"; + var ms = seconds * 1000; if (higherResolution && ms < 1000) return formatterFunction("%.3fms", ms); @@ -617,6 +637,14 @@ Array.prototype.remove = function(value, onlyFirst) } } +Array.prototype.keySet = function() +{ + var keys = {}; + for (var i = 0; i < this.length; ++i) + keys[this[i]] = true; + return keys; +} + function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction) { // indexOf returns (-lowerBound - 1). Taking (-result - 1) works out to lowerBound. @@ -822,3 +850,60 @@ function isEnterKey(event) { // Check if in IME. return event.keyCode !== 229 && event.keyIdentifier === "Enter"; } + + +function highlightSearchResult(element, offset, length) +{ + var lineText = element.textContent; + var endOffset = offset + length; + var highlightNode = document.createElement("span"); + highlightNode.className = "webkit-search-result"; + highlightNode.textContent = lineText.substring(offset, endOffset); + + var boundary = element.rangeBoundaryForOffset(offset); + var textNode = boundary.container; + var text = textNode.textContent; + + if (boundary.offset + length < text.length) { + // Selection belong to a single split mode. + textNode.textContent = text.substring(boundary.offset + length); + textNode.parentElement.insertBefore(highlightNode, textNode); + var prefixNode = document.createTextNode(text.substring(0, boundary.offset)); + textNode.parentElement.insertBefore(prefixNode, highlightNode); + return highlightNode; + } + + var parentElement = textNode.parentElement; + var anchorElement = textNode.nextSibling; + + length -= text.length - boundary.offset; + textNode.textContent = text.substring(0, boundary.offset); + textNode = textNode.traverseNextTextNode(element); + + while (textNode) { + var text = textNode.textContent; + if (length < text.length) { + textNode.textContent = text.substring(length); + break; + } + + length -= text.length; + textNode.textContent = ""; + textNode = textNode.traverseNextTextNode(element); + } + + parentElement.insertBefore(highlightNode, anchorElement); + return highlightNode; +} + +function createSearchRegex(query) +{ + var regex = ""; + for (var i = 0; i < query.length; ++i) { + var char = query.charAt(i); + if (char === "]") + char = "\\]"; + regex += "[" + char + "]"; + } + return new RegExp(regex, "i"); +} diff --git a/src/3rdparty/webkit/WebCore/loader/Cache.cpp b/src/3rdparty/webkit/WebCore/loader/Cache.cpp index 46fb068..fdd9b25 100644 --- a/src/3rdparty/webkit/WebCore/loader/Cache.cpp +++ b/src/3rdparty/webkit/WebCore/loader/Cache.cpp @@ -31,6 +31,7 @@ #include "DocLoader.h" #include "Document.h" #include "FrameLoader.h" +#include "FrameLoaderTypes.h" #include "FrameView.h" #include "Image.h" #include "ResourceHandle.h" @@ -123,19 +124,21 @@ CachedResource* Cache::requestResource(DocLoader* docLoader, CachedResource::Typ resource->load(docLoader); + if (resource->errorOccurred()) { + // We don't support immediate loads, but we do support immediate failure. + // In that case we should to delete the resource now and return 0 because otherwise + // it would leak if no ref/deref was ever done on it. + resource->setInCache(false); + delete resource; + return 0; + } + if (!disabled()) m_resources.set(url.string(), resource); // The size will be added in later once the resource is loaded and calls back to us with the new size. else { // Kick the resource out of the cache, because the cache is disabled. resource->setInCache(false); resource->setDocLoader(docLoader); - if (resource->errorOccurred()) { - // We don't support immediate loads, but we do support immediate failure. - // In that case we should to delete the resource now and return 0 because otherwise - // it would leak if no ref/deref was ever done on it. - delete resource; - return 0; - } } } @@ -164,7 +167,7 @@ CachedCSSStyleSheet* Cache::requestUserCSSStyleSheet(DocLoader* docLoader, const // FIXME: CachedResource should just use normal refcounting instead. userSheet->setInCache(true); // Don't load incrementally, skip load checks, don't send resource load callbacks. - userSheet->load(docLoader, false, true, false); + userSheet->load(docLoader, false, SkipSecurityCheck, false); if (!disabled()) m_resources.set(url, userSheet); else @@ -292,7 +295,7 @@ void Cache::pruneLiveResources() return; // Destroy our decoded data. This will remove us from - // m_liveDecodedResources, and possibly move us to a differnt LRU + // m_liveDecodedResources, and possibly move us to a different LRU // list in m_allResources. current->destroyDecodedData(); @@ -344,7 +347,7 @@ void Cache::pruneDeadResources() CachedResource* prev = current->m_prevInAllResourcesList; if (!current->hasClients() && !current->isPreloaded() && current->isLoaded()) { // Destroy our decoded data. This will remove us from - // m_liveDecodedResources, and possibly move us to a differnt + // m_liveDecodedResources, and possibly move us to a different // LRU list in m_allResources. current->destroyDecodedData(); @@ -465,13 +468,13 @@ void Cache::removeFromLRUList(CachedResource* resource) if (resource->accessCount() == 0) return; -#ifndef NDEBUG +#if !ASSERT_DISABLED unsigned oldListIndex = resource->m_lruIndex; #endif LRUList* list = lruListFor(resource); -#ifndef NDEBUG +#if !ASSERT_DISABLED // Verify that the list we got is the list we want. ASSERT(resource->m_lruIndex == oldListIndex); diff --git a/src/3rdparty/webkit/WebCore/loader/Cache.h b/src/3rdparty/webkit/WebCore/loader/Cache.h index a0023da..1ccd86d 100644 --- a/src/3rdparty/webkit/WebCore/loader/Cache.h +++ b/src/3rdparty/webkit/WebCore/loader/Cache.h @@ -190,7 +190,7 @@ private: unsigned m_deadSize; // The number of bytes currently consumed by "dead" resources in the cache. // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold - // more resources than the cached resource map, since it can also hold "stale" muiltiple versions of objects that are + // more resources than the cached resource map, since it can also hold "stale" multiple versions of objects that are // waiting to die when the clients referencing them go away. Vector m_allResources; diff --git a/src/3rdparty/webkit/WebCore/loader/CachePolicy.h b/src/3rdparty/webkit/WebCore/loader/CachePolicy.h index 93f92b1..2639caa 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachePolicy.h +++ b/src/3rdparty/webkit/WebCore/loader/CachePolicy.h @@ -32,7 +32,8 @@ namespace WebCore { CachePolicyCache, CachePolicyVerify, CachePolicyRevalidate, - CachePolicyReload + CachePolicyReload, + CachePolicyAllowStale }; } diff --git a/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.cpp b/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.cpp index 4c466fa..b2e03b9 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.cpp @@ -52,9 +52,9 @@ CachedCSSStyleSheet::~CachedCSSStyleSheet() void CachedCSSStyleSheet::didAddClient(CachedResourceClient *c) { if (!m_loading) - c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), this); + c->setCSSStyleSheet(m_url, m_response.url(), m_decoder->encoding().name(), this); } - + void CachedCSSStyleSheet::allClientsRemoved() { if (isSafeToMakePurgeable()) @@ -71,11 +71,11 @@ String CachedCSSStyleSheet::encoding() const return m_decoder->encoding().name(); } -const String CachedCSSStyleSheet::sheetText(bool enforceMIMEType) const +const String CachedCSSStyleSheet::sheetText(bool enforceMIMEType, bool* hasValidMIMEType) const { ASSERT(!isPurgeable()); - if (!m_data || m_data->isEmpty() || !canUseSheet(enforceMIMEType)) + if (!m_data || m_data->isEmpty() || !canUseSheet(enforceMIMEType, hasValidMIMEType)) return String(); if (!m_decodedSheetText.isNull()) @@ -112,7 +112,7 @@ void CachedCSSStyleSheet::checkNotify() CachedResourceClientWalker w(m_clients); while (CachedResourceClient *c = w.next()) - c->setCSSStyleSheet(m_response.url().string(), m_decoder->encoding().name(), this); + c->setCSSStyleSheet(m_url, m_response.url(), m_decoder->encoding().name(), this); } void CachedCSSStyleSheet::error() @@ -122,12 +122,12 @@ void CachedCSSStyleSheet::error() checkNotify(); } -bool CachedCSSStyleSheet::canUseSheet(bool enforceMIMEType) const +bool CachedCSSStyleSheet::canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const { if (errorOccurred()) return false; - if (!enforceMIMEType) + if (!enforceMIMEType && !hasValidMIMEType) return true; // This check exactly matches Firefox. Note that we grab the Content-Type @@ -138,7 +138,12 @@ bool CachedCSSStyleSheet::canUseSheet(bool enforceMIMEType) const // This code defaults to allowing the stylesheet for non-HTTP protocols so // folks can use standards mode for local HTML documents. String mimeType = extractMIMETypeFromMediaType(response().httpHeaderField("Content-Type")); - return mimeType.isEmpty() || equalIgnoringCase(mimeType, "text/css") || equalIgnoringCase(mimeType, "application/x-unknown-content-type"); + bool typeOK = mimeType.isEmpty() || equalIgnoringCase(mimeType, "text/css") || equalIgnoringCase(mimeType, "application/x-unknown-content-type"); + if (hasValidMIMEType) + *hasValidMIMEType = typeOK; + if (!enforceMIMEType) + return true; + return typeOK; } } diff --git a/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.h b/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.h index e782f2e..908c4c0 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.h +++ b/src/3rdparty/webkit/WebCore/loader/CachedCSSStyleSheet.h @@ -40,7 +40,7 @@ namespace WebCore { CachedCSSStyleSheet(const String& URL, const String& charset); virtual ~CachedCSSStyleSheet(); - const String sheetText(bool enforceMIMEType = true) const; + const String sheetText(bool enforceMIMEType = true, bool* hasValidMIMEType = 0) const; virtual void didAddClient(CachedResourceClient*); @@ -56,7 +56,7 @@ namespace WebCore { void checkNotify(); private: - bool canUseSheet(bool enforceMIMEType) const; + bool canUseSheet(bool enforceMIMEType, bool* hasValidMIMEType) const; protected: RefPtr m_decoder; diff --git a/src/3rdparty/webkit/WebCore/loader/CachedFont.cpp b/src/3rdparty/webkit/WebCore/loader/CachedFont.cpp index 9cf152d..64ab24f 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedFont.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedFont.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "CachedFont.h" -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) || PLATFORM(WINCE) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (OS(WINDOWS) || OS(LINUX))) || PLATFORM(HAIKU) || OS(WINCE) #define STORE_FONT_CUSTOM_PLATFORM_DATA #endif @@ -165,7 +165,7 @@ SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const Node* node = list->item(i); ASSERT(node); - if (static_cast(node)->getAttribute(HTMLNames::idAttr) != fontName) + if (static_cast(node)->getAttribute(static_cast(node)->idAttributeName()) != fontName) continue; ASSERT(node->hasTagName(SVGNames::fontTag)); diff --git a/src/3rdparty/webkit/WebCore/loader/CachedImage.cpp b/src/3rdparty/webkit/WebCore/loader/CachedImage.cpp index e610ad1..026b129 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedImage.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedImage.cpp @@ -30,6 +30,7 @@ #include "CachedResourceClientWalker.h" #include "DocLoader.h" #include "Frame.h" +#include "FrameLoaderTypes.h" #include "FrameView.h" #include "Request.h" #include "Settings.h" @@ -81,7 +82,7 @@ void CachedImage::decodedDataDeletionTimerFired(Timer*) void CachedImage::load(DocLoader* docLoader) { if (!docLoader || docLoader->autoLoadImages()) - CachedResource::load(docLoader, true, false, true); + CachedResource::load(docLoader, true, DoSecurityCheck, true); else m_loading = false; } diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp index f2f52b0..640d1f7 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedResource.cpp @@ -103,10 +103,10 @@ CachedResource::~CachedResource() m_docLoader->removeCachedResource(this); } -void CachedResource::load(DocLoader* docLoader, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks) +void CachedResource::load(DocLoader* docLoader, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks) { m_sendResourceLoadCallbacks = sendResourceLoadCallbacks; - cache()->loader()->load(docLoader, this, incremental, skipCanLoadCheck, sendResourceLoadCallbacks); + cache()->loader()->load(docLoader, this, incremental, securityCheck, sendResourceLoadCallbacks); m_loading = true; } @@ -431,7 +431,7 @@ bool CachedResource::makePurgeable(bool purgeable) if (!m_data) return false; - // Should not make buffer purgeable if it has refs othen than this since we don't want two copies. + // Should not make buffer purgeable if it has refs other than this since we don't want two copies. if (!m_data->hasOneRef()) return false; diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResource.h b/src/3rdparty/webkit/WebCore/loader/CachedResource.h index 05d24fc..0f46a62 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResource.h +++ b/src/3rdparty/webkit/WebCore/loader/CachedResource.h @@ -24,6 +24,7 @@ #define CachedResource_h #include "CachePolicy.h" +#include "FrameLoaderTypes.h" #include "PlatformString.h" #include "ResourceResponse.h" #include "SharedBuffer.h" @@ -46,7 +47,7 @@ class PurgeableBuffer; // A resource that is held in the cache. Classes who want to use this object should derive // from CachedResourceClient, to get the function calls in case the requested data has arrived. // This class also does the actual communication with the loader to obtain the resource from the network. -class CachedResource { +class CachedResource : public Noncopyable { friend class Cache; friend class InspectorResource; @@ -75,8 +76,8 @@ public: CachedResource(const String& url, Type); virtual ~CachedResource(); - virtual void load(DocLoader* docLoader) { load(docLoader, false, false, true); } - void load(DocLoader*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks); + virtual void load(DocLoader* docLoader) { load(docLoader, false, DoSecurityCheck, true); } + void load(DocLoader*, bool incremental, SecurityCheckPolicy, bool sendResourceLoadCallbacks); virtual void setEncoding(const String&) { } virtual String encoding() const { return String(); } @@ -148,7 +149,7 @@ public: virtual bool schedule() const { return false; } - // List of acceptable MIME types seperated by ",". + // List of acceptable MIME types separated by ",". // A MIME type may contain a wildcard, e.g. "text/*". String accept() const { return m_accept; } void setAccept(const String& accept) { m_accept = accept; } diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResourceClient.h b/src/3rdparty/webkit/WebCore/loader/CachedResourceClient.h index dd9bb94..be3f87e 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResourceClient.h +++ b/src/3rdparty/webkit/WebCore/loader/CachedResourceClient.h @@ -42,6 +42,7 @@ namespace WebCore { class String; class Image; class IntRect; + class KURL; /** * @internal @@ -65,8 +66,8 @@ namespace WebCore { // e.g., in the b/f cache or in a background tab). virtual bool willRenderImage(CachedImage*) { return false; } - virtual void setCSSStyleSheet(const String& /*URL*/, const String& /*charset*/, const CachedCSSStyleSheet*) { } - virtual void setXSLStyleSheet(const String& /*URL*/, const String& /*sheet*/) { } + virtual void setCSSStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* charset */, const CachedCSSStyleSheet*) { } + virtual void setXSLStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* sheet */) { } virtual void fontLoaded(CachedFont*) {}; diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h index 0956e0c..7d485bf 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h +++ b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h @@ -72,7 +72,7 @@ namespace WebCore { bool operator!=(const CachedResourceHandleBase& o) const { return get() != o.get(); } }; - // Don't inline for winscw compiler to prevent the compiler agressively resolving + // Don't inline for winscw compiler to prevent the compiler aggressively resolving // the base class of R* when CachedResourceHandler(R*) is inlined. The bug is // reported at: https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812. template diff --git a/src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.cpp b/src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.cpp index 5da0abf..59c3907 100644 --- a/src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CachedXSLStyleSheet.cpp @@ -48,7 +48,7 @@ CachedXSLStyleSheet::CachedXSLStyleSheet(const String &url) void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c) { if (!m_loading) - c->setXSLStyleSheet(m_url, m_sheet); + c->setXSLStyleSheet(m_url, m_response.url(), m_sheet); } void CachedXSLStyleSheet::setEncoding(const String& chs) @@ -83,10 +83,9 @@ void CachedXSLStyleSheet::checkNotify() CachedResourceClientWalker w(m_clients); while (CachedResourceClient *c = w.next()) - c->setXSLStyleSheet(m_url, m_sheet); + c->setXSLStyleSheet(m_url, m_response.url(), m_sheet); } - void CachedXSLStyleSheet::error() { m_loading = false; diff --git a/src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.cpp b/src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.cpp index f0f8b6a..01596e2 100644 --- a/src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.cpp +++ b/src/3rdparty/webkit/WebCore/loader/CrossOriginAccessControl.cpp @@ -100,6 +100,9 @@ bool passesAccessControlCheck(const ResourceResponse& response, bool includeCred if (accessControlOriginString == "*" && !includeCredentials) return true; + if (securityOrigin->isUnique()) + return false; + RefPtr accessControlOrigin = SecurityOrigin::createFromString(accessControlOriginString); if (!accessControlOrigin->isSameSchemeHostPort(securityOrigin)) return false; diff --git a/src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.h b/src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.h index 97b526a..faf55e5 100644 --- a/src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.h +++ b/src/3rdparty/webkit/WebCore/loader/CrossOriginPreflightResultCache.h @@ -26,6 +26,8 @@ #include "KURLHash.h" #include "StringHash.h" +#include +#include namespace WebCore { diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp index 5eb7acf..0053e7b 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.cpp @@ -40,6 +40,7 @@ #include "HTMLElement.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "loader.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -111,8 +112,8 @@ void DocLoader::checkForReload(const KURL& fullURL) case CachePolicyRevalidate: cache()->revalidateResource(existing, this); break; - default: - ASSERT_NOT_REACHED(); + case CachePolicyAllowStale: + return; } m_reloadedURLs.add(fullURL.string()); @@ -120,6 +121,11 @@ void DocLoader::checkForReload(const KURL& fullURL) CachedImage* DocLoader::requestImage(const String& url) { + if (Frame* f = frame()) { + Settings* settings = f->settings(); + if (!f->loader()->client()->allowImages(!settings || settings->areImagesEnabled())) + return 0; + } CachedImage* resource = static_cast(requestResource(CachedResource::ImageResource, url, String())); if (autoLoadImages() && resource && resource->stillNeedsLoad()) { resource->setLoading(true); diff --git a/src/3rdparty/webkit/WebCore/loader/DocLoader.h b/src/3rdparty/webkit/WebCore/loader/DocLoader.h index 13a57bd..8ec73e1 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/DocLoader.h @@ -47,7 +47,7 @@ class ImageLoader; class KURL; // The DocLoader manages the loading of scripts/images/stylesheets for a single document. -class DocLoader +class DocLoader : public Noncopyable { friend class Cache; friend class ImageLoader; diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp index 820cb36..37a2de2 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.cpp @@ -46,7 +46,6 @@ #include "PlatformString.h" #include "Settings.h" #include "SharedBuffer.h" -#include "StringBuffer.h" #include "XMLTokenizer.h" #include @@ -54,67 +53,6 @@ namespace WebCore { -/* - * Performs four operations: - * 1. Convert backslashes to currency symbols - * 2. Convert control characters to spaces - * 3. Trim leading and trailing spaces - * 4. Collapse internal whitespace. - */ -static inline String canonicalizedTitle(const String& title, Frame* frame) -{ - ASSERT(!title.isEmpty()); - - const UChar* characters = title.characters(); - unsigned length = title.length(); - unsigned i; - - StringBuffer buffer(length); - unsigned builderIndex = 0; - - // Skip leading spaces and leading characters that would convert to spaces - for (i = 0; i < length; ++i) { - UChar c = characters[i]; - if (!(c <= 0x20 || c == 0x7F)) - break; - } - - if (i == length) - return ""; - - // Replace control characters with spaces, and backslashes with currency symbols, and collapse whitespace. - bool previousCharWasWS = false; - for (; i < length; ++i) { - UChar c = characters[i]; - if (c <= 0x20 || c == 0x7F || (WTF::Unicode::category(c) & (WTF::Unicode::Separator_Line | WTF::Unicode::Separator_Paragraph))) { - if (previousCharWasWS) - continue; - buffer[builderIndex++] = ' '; - previousCharWasWS = true; - } else { - buffer[builderIndex++] = c; - previousCharWasWS = false; - } - } - - // Strip trailing spaces - while (builderIndex > 0) { - --builderIndex; - if (buffer[builderIndex] != ' ') - break; - } - - if (!builderIndex && buffer[builderIndex] == ' ') - return ""; - - buffer.shrink(builderIndex + 1); - - // Replace the backslashes with currency symbols if the encoding requires it. - frame->document()->displayBufferModifiedByEncoding(buffer.characters(), buffer.length()); - - return String::adopt(buffer); -} - static void cancelAll(const ResourceLoaderSet& loaders) { const ResourceLoaderSet copy = loaders; @@ -199,7 +137,7 @@ const KURL& DocumentLoader::url() const return request().url(); } -void DocumentLoader::replaceRequestURLForAnchorScroll(const KURL& url) +void DocumentLoader::replaceRequestURLForSameDocumentNavigation(const KURL& url) { m_originalRequestCopy.setURL(url); m_request.setURL(url); @@ -662,10 +600,9 @@ void DocumentLoader::setTitle(const String& title) if (title.isEmpty()) return; - String trimmed = canonicalizedTitle(title, m_frame); - if (!trimmed.isEmpty() && m_pageTitle != trimmed) { + if (m_pageTitle != title) { frameLoader()->willChangeTitle(this); - m_pageTitle = trimmed; + m_pageTitle = title; frameLoader()->didChangeTitle(this); } } diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.h b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.h index 70d5afd..99d82bd 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/DocumentLoader.h @@ -88,7 +88,7 @@ namespace WebCore { const KURL& responseURL() const; const String& responseMIMEType() const; - void replaceRequestURLForAnchorScroll(const KURL&); + void replaceRequestURLForSameDocumentNavigation(const KURL&); bool isStopping() const { return m_isStopping; } void stopLoading(DatabasePolicy = DatabasePolicyStop); void setCommitted(bool committed) { m_committed = committed; } @@ -154,7 +154,7 @@ namespace WebCore { KURL urlForHistory() const; bool urlForHistoryReflectsFailure() const; - // These accessors accomodate WebCore's somewhat fickle custom of creating history + // These accessors accommodate WebCore's somewhat fickle custom of creating history // items for redirects, but only sometimes. For "source" and "destination", // these accessors return the URL that would have been used if a history // item were created. This allows WebKit to link history items reflecting diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.cpp b/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.cpp index 8a223fd..de0a0b0 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.cpp @@ -70,8 +70,7 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document* document, Threadabl ASSERT(client); if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) { - bool skipCanLoadCheck = false; - loadRequest(request, skipCanLoadCheck); + loadRequest(request, DoSecurityCheck); return; } @@ -111,8 +110,7 @@ void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const Resource crossOriginRequest.setAllowCookies(m_options.allowCredentials); crossOriginRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); - bool skipCanLoadCheck = false; - loadRequest(crossOriginRequest, skipCanLoadCheck); + loadRequest(crossOriginRequest, DoSecurityCheck); } void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request) @@ -142,8 +140,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const R preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer)); } - bool skipCanLoadCheck = false; - loadRequest(preflightRequest, skipCanLoadCheck); + loadRequest(preflightRequest, DoSecurityCheck); } DocumentThreadableLoader::~DocumentThreadableLoader() @@ -284,8 +281,8 @@ void DocumentThreadableLoader::preflightSuccess() OwnPtr actualRequest; actualRequest.swap(m_actualRequest); - bool skipCanLoadCheck = true; // ok to skip load check since we already asked about the preflight request - loadRequest(*actualRequest, skipCanLoadCheck); + // It should be ok to skip the security check since we already asked about the preflight request. + loadRequest(*actualRequest, SkipSecurityCheck); } void DocumentThreadableLoader::preflightFailure() @@ -293,7 +290,7 @@ void DocumentThreadableLoader::preflightFailure() m_client->didFail(ResourceError()); } -void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool skipCanLoadCheck) +void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, SecurityCheckPolicy securityCheck) { if (m_async) { // Don't sniff content or send load callbacks for the preflight request. @@ -302,7 +299,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool // Clear the loader so that any callbacks from SubresourceLoader::create will not have the old loader. m_loader = 0; - m_loader = SubresourceLoader::create(m_document->frame(), this, request, skipCanLoadCheck, sendLoadCallbacks, sniffContent); + m_loader = SubresourceLoader::create(m_document->frame(), this, request, securityCheck, sendLoadCallbacks, sniffContent); return; } diff --git a/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.h b/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.h index 64b1a22..48d1551 100644 --- a/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/DocumentThreadableLoader.h @@ -31,6 +31,7 @@ #ifndef DocumentThreadableLoader_h #define DocumentThreadableLoader_h +#include "FrameLoaderTypes.h" #include "SubresourceLoaderClient.h" #include "ThreadableLoader.h" #include @@ -41,7 +42,7 @@ namespace WebCore { class Document; class KURL; - struct ResourceRequest; + class ResourceRequest; class ThreadableLoaderClient; class DocumentThreadableLoader : public RefCounted, public ThreadableLoader, private SubresourceLoaderClient { @@ -85,7 +86,7 @@ namespace WebCore { void preflightSuccess(); void preflightFailure(); - void loadRequest(const ResourceRequest&, bool skipCanLoadCheck); + void loadRequest(const ResourceRequest&, SecurityCheckPolicy); bool isAllowedRedirect(const KURL&); RefPtr m_loader; diff --git a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h index 91c7030..ead0124 100644 --- a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h +++ b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h @@ -76,6 +76,8 @@ public: virtual bool canTakeFocus(FocusDirection) { return false; } virtual void takeFocus(FocusDirection) { } + virtual void focusedNodeChanged(Node*) { } + virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) { return 0; } virtual void show() { } @@ -144,6 +146,7 @@ public: #endif virtual void runOpenPanel(Frame*, PassRefPtr) { } + virtual void iconForFiles(const Vector&, PassRefPtr) { } virtual void formStateDidChange(const Node*) { } @@ -163,9 +166,13 @@ public: virtual void setNeedsOneShotDrawingSynchronization() {}; virtual void scheduleCompositingLayerSync() {}; #endif + +#if ENABLE(TOUCH_EVENTS) + virtual void needTouchEvents(bool) { } +#endif }; -class EmptyFrameLoaderClient : public FrameLoaderClient { +class EmptyFrameLoaderClient : public FrameLoaderClient, public Noncopyable { public: virtual ~EmptyFrameLoaderClient() { } virtual void frameLoaderDestroyed() { } @@ -200,6 +207,9 @@ public: virtual void dispatchDidCancelClientRedirect() { } virtual void dispatchWillPerformClientRedirect(const KURL&, double, double) { } virtual void dispatchDidChangeLocationWithinPage() { } + virtual void dispatchDidPushStateWithinPage() { } + virtual void dispatchDidReplaceStateWithinPage() { } + virtual void dispatchDidPopStateWithinPage() { } virtual void dispatchWillClose() { } virtual void dispatchDidReceiveIcon() { } virtual void dispatchDidStartProvisionalLoad() { } @@ -279,11 +289,15 @@ public: virtual void updateGlobalHistory() { } virtual void updateGlobalHistoryRedirectLinks() { } virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; } + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const { } + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { }; + virtual void dispatchDidChangeBackForwardIndex() const { } virtual void saveViewStateToItem(HistoryItem*) { } virtual bool canCachePage() const { return false; } virtual void didDisplayInsecureContent() { } virtual void didRunInsecureContent(SecurityOrigin*) { } virtual PassRefPtr createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; } + virtual void didTransferChildFrameToNewDocument() { } virtual PassRefPtr createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector&, const Vector&, const String&, bool) { return 0; } virtual PassRefPtr createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector&, const Vector&) { return 0; } @@ -291,7 +305,7 @@ public: virtual String overrideMediaType() const { return String(); } virtual void redirectDataToPlugin(Widget*) { } - virtual void windowObjectCleared() { } + virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*) { } virtual void documentElementAvailable() { } virtual void didPerformFirstNavigation() const { } @@ -312,7 +326,7 @@ public: }; -class EmptyEditorClient : public EditorClient { +class EmptyEditorClient : public EditorClient, public Noncopyable { public: virtual ~EmptyEditorClient() { } virtual void pageDestroyed() { } @@ -417,7 +431,7 @@ public: }; #if ENABLE(CONTEXT_MENUS) -class EmptyContextMenuClient : public ContextMenuClient { +class EmptyContextMenuClient : public ContextMenuClient, public Noncopyable { public: virtual ~EmptyContextMenuClient() { } virtual void contextMenuDestroyed() { } @@ -440,7 +454,7 @@ public: #endif // ENABLE(CONTEXT_MENUS) #if ENABLE(DRAG_SUPPORT) -class EmptyDragClient : public DragClient { +class EmptyDragClient : public DragClient, public Noncopyable { public: virtual ~EmptyDragClient() {} virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { } @@ -453,7 +467,7 @@ public: }; #endif // ENABLE(DRAG_SUPPORT) -class EmptyInspectorClient : public InspectorClient { +class EmptyInspectorClient : public InspectorClient, public Noncopyable { public: virtual ~EmptyInspectorClient() { } @@ -477,20 +491,12 @@ public: virtual void hideHighlight() { } virtual void inspectedURLChanged(const String&) { } - virtual void populateSetting(const String&, InspectorController::Setting&) { } - virtual void storeSetting(const String&, const InspectorController::Setting&) { } - virtual void removeSetting(const String&) { } + virtual void populateSetting(const String&, String*) { } + virtual void storeSetting(const String&, const String&) { } virtual void inspectorWindowObjectCleared() { } }; -class EmptyPluginHalterClient : public PluginHalterClient -{ -public: - virtual bool shouldHaltPlugin(Node*) const { return false; } - virtual bool enabled() const { return false; } -}; - } #endif // EmptyClients_h diff --git a/src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.cpp b/src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.cpp index ee0f4ca..62173f5 100644 --- a/src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FTPDirectoryDocument.cpp @@ -38,14 +38,9 @@ #include "Settings.h" #include "SharedBuffer.h" #include "Text.h" -#include -#if PLATFORM(QT) -#include -// On Windows, use the threadsafe *_r functions provided by pthread. -#elif PLATFORM(WIN_OS) && (USE(PTHREADS) || HAVE(PTHREAD_H)) -#include -#endif +#include +#include using namespace std; @@ -200,48 +195,6 @@ static bool wasLastDayOfMonth(int year, int month, int day) return lastDays[month] == day; } -#if PLATFORM(QT) - -/*! - Replacement for localtime_r() which is not available on MinGW. - - We use this on all of Qt's platforms for portability. - */ -struct tm gmtimeQt(const QDateTime &input) -{ - tm result; - - const QDate date(input.date()); - result.tm_year = date.year() - 1900; - result.tm_mon = date.month(); - result.tm_mday = date.day(); - result.tm_wday = date.dayOfWeek(); - result.tm_yday = date.dayOfYear(); - - const QTime time(input.time()); - result.tm_sec = time.second(); - result.tm_min = time.minute(); - result.tm_hour = time.hour(); - - return result; -} - -static struct tm *localTimeQt(const time_t *const timep, struct tm *result) -{ - const QDateTime dt(QDateTime::fromTime_t(*timep)); - *result = WebCore::gmtimeQt(dt.toLocalTime()); - return result; -} - -#define localtime_r(x, y) localTimeQt(x, y) -#elif PLATFORM(WIN_OS) && !defined(localtime_r) -#if defined(_MSC_VER) && (_MSC_VER >= 1400) -#define localtime_r(x, y) localtime_s((y), (x)) -#else /* !_MSC_VER */ -#define localtime_r(x,y) (localtime(x)?(*(y)=*localtime(x),(y)):0) -#endif -#endif - static String processFileDateString(const FTPTime& fileTime) { // FIXME: Need to localize this string? @@ -267,7 +220,7 @@ static String processFileDateString(const FTPTime& fileTime) // If it was today or yesterday, lets just do that - but we have to compare to the current time struct tm now; time_t now_t = time(NULL); - localtime_r(&now_t, &now); + getLocalTime(&now_t, &now); // localtime does "year = current year - 1900", compensate for that for readability and comparison purposes now.tm_year += 1900; diff --git a/src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.cpp b/src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.cpp index 40bd714..142f2a3 100644 --- a/src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FTPDirectoryParser.cpp @@ -27,7 +27,7 @@ #if PLATFORM(QT) #include // On Windows, use the threadsafe *_r functions provided by pthread. -#elif PLATFORM(WIN_OS) && (USE(PTHREADS) || HAVE(PTHREAD_H)) +#elif OS(WINDOWS) && (USE(PTHREADS) || HAVE(PTHREAD_H)) #include #endif @@ -38,8 +38,27 @@ using namespace WTF; namespace WebCore { #if PLATFORM(QT) && defined(Q_WS_WIN32) -// Defined in FTPDirectoryDocument.cpp. -struct tm gmtimeQt(const QDateTime &input); + +// Replacement for gmtime_r() which is not available on MinGW. +// We use this on Win32 Qt platform for portability. +struct tm gmtimeQt(const QDateTime& input) +{ + tm result; + + QDate date(input.date()); + result.tm_year = date.year() - 1900; + result.tm_mon = date.month(); + result.tm_mday = date.day(); + result.tm_wday = date.dayOfWeek(); + result.tm_yday = date.dayOfYear(); + + QTime time(input.time()); + result.tm_sec = time.second(); + result.tm_min = time.minute(); + result.tm_hour = time.hour(); + + return result; +} static struct tm *gmtimeQt(const time_t *const timep, struct tm *result) { @@ -49,7 +68,7 @@ static struct tm *gmtimeQt(const time_t *const timep, struct tm *result) } #define gmtime_r(x, y) gmtimeQt(x, y) -#elif PLATFORM(WIN_OS) && !defined(gmtime_r) +#elif OS(WINDOWS) && !defined(gmtime_r) #if defined(_MSC_VER) && (_MSC_VER >= 1400) #define gmtime_r(x, y) gmtime_s((y), (x)) #else /* !_MSC_VER */ @@ -1185,7 +1204,7 @@ FTPEntryType parseOneFTPLine(const char* line, ListState& state, ListResult& res } /* time/year */ - // there is exacly 1 space between filename and previous token in all + // there is exactly 1 space between filename and previous token in all // outputs except old Hellsoft if (!isOldHellsoft) result.filename = tokens[tokmarker+3] + toklen[tokmarker+3] + 1; diff --git a/src/3rdparty/webkit/WebCore/loader/FormState.cpp b/src/3rdparty/webkit/WebCore/loader/FormState.cpp index bd37086..552789a 100644 --- a/src/3rdparty/webkit/WebCore/loader/FormState.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FormState.cpp @@ -34,16 +34,17 @@ namespace WebCore { -inline FormState::FormState(PassRefPtr form, StringPairVector& textFieldValuesToAdopt, PassRefPtr sourceFrame) +inline FormState::FormState(PassRefPtr form, StringPairVector& textFieldValuesToAdopt, PassRefPtr sourceFrame, FormSubmissionTrigger formSubmissionTrigger) : m_form(form) , m_sourceFrame(sourceFrame) + , m_formSubmissionTrigger(formSubmissionTrigger) { m_textFieldValues.swap(textFieldValuesToAdopt); } -PassRefPtr FormState::create(PassRefPtr form, StringPairVector& textFieldValuesToAdopt, PassRefPtr sourceFrame) +PassRefPtr FormState::create(PassRefPtr form, StringPairVector& textFieldValuesToAdopt, PassRefPtr sourceFrame, FormSubmissionTrigger formSubmissionTrigger) { - return adoptRef(new FormState(form, textFieldValuesToAdopt, sourceFrame)); + return adoptRef(new FormState(form, textFieldValuesToAdopt, sourceFrame, formSubmissionTrigger)); } } diff --git a/src/3rdparty/webkit/WebCore/loader/FormState.h b/src/3rdparty/webkit/WebCore/loader/FormState.h index 03317b1..8f7166e 100644 --- a/src/3rdparty/webkit/WebCore/loader/FormState.h +++ b/src/3rdparty/webkit/WebCore/loader/FormState.h @@ -36,22 +36,29 @@ namespace WebCore { class Frame; class HTMLFormElement; + enum FormSubmissionTrigger { + SubmittedByJavaScript, + NotSubmittedByJavaScript + }; + typedef Vector > StringPairVector; class FormState : public RefCounted { public: - static PassRefPtr create(PassRefPtr, StringPairVector& textFieldValuesToAdopt, PassRefPtr); + static PassRefPtr create(PassRefPtr, StringPairVector& textFieldValuesToAdopt, PassRefPtr, FormSubmissionTrigger); HTMLFormElement* form() const { return m_form.get(); } const StringPairVector& textFieldValues() const { return m_textFieldValues; } Frame* sourceFrame() const { return m_sourceFrame.get(); } + FormSubmissionTrigger formSubmissionTrigger() const { return m_formSubmissionTrigger; } private: - FormState(PassRefPtr, StringPairVector& textFieldValuesToAdopt, PassRefPtr); + FormState(PassRefPtr, StringPairVector& textFieldValuesToAdopt, PassRefPtr, FormSubmissionTrigger); RefPtr m_form; StringPairVector m_textFieldValues; RefPtr m_sourceFrame; + FormSubmissionTrigger m_formSubmissionTrigger; }; } diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp index a85dcf5..47f32c9 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp @@ -36,6 +36,7 @@ #include "ApplicationCacheHost.h" #include "Archive.h" #include "ArchiveFactory.h" +#include "BackForwardList.h" #include "CString.h" #include "Cache.h" #include "CachedPage.h" @@ -196,6 +197,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_didPerformFirstNavigation(false) , m_loadingFromCachedPage(false) , m_suppressOpenerInNewFrame(false) + , m_sandboxFlags(SandboxAll) #ifndef NDEBUG , m_didDispatchDidCommitLoad(false) #endif @@ -228,6 +230,9 @@ void FrameLoader::init() m_frame->document()->cancelParsing(); m_creatingInitialEmptyDocument = false; m_didCallImplicitClose = true; + + // Propagate sandbox attributes to this Frameloader and its descendants. + updateSandboxFlags(); } void FrameLoader::setDefersLoading(bool defers) @@ -398,6 +403,12 @@ Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL return 0; } + // All new frames will have m_isComplete set to true at this point due to synchronously loading + // an empty document in FrameLoader::init(). But many frames will now be starting an + // asynchronous load of url, so we set m_isComplete to false and then check if the load is + // actually completed below. (Note that we set m_isComplete to false even for synchronous + // loads, so that checkCompleted() below won't bail early.) + // FIXME: Can we remove this entirely? m_isComplete normally gets set to false when a load is committed. frame->loader()->m_isComplete = false; RenderObject* renderer = ownerElement->renderer(); @@ -407,16 +418,17 @@ Frame* FrameLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL checkCallImplicitClose(); + // Some loads are performed synchronously (e.g., about:blank and loads + // cancelled by returning a null ResourceRequest from requestFromDelegate). // In these cases, the synchronous load would have finished // before we could connect the signals, so make sure to send the - // completed() signal for the child by hand + // completed() signal for the child by hand and mark the load as being + // complete. // FIXME: In this case the Frame will have finished loading before // it's being added to the child list. It would be a good idea to // create the child first, then invoke the loader separately. - if (url.isEmpty() || url == blankURL()) { - frame->loader()->completed(); + if (frame->loader()->state() == FrameStateComplete) frame->loader()->checkCompleted(); - } return frame.get(); } @@ -438,6 +450,9 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtrscript()->executeIfJavaScriptURL(u, false, false); @@ -448,7 +463,9 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtrdocument()->baseTarget() : target; - Frame* targetFrame = findFrameForNavigation(targetOrBaseTarget); + Frame* targetFrame = m_frame->tree()->find(targetOrBaseTarget); + if (!shouldAllowNavigation(targetFrame)) + return; if (!targetFrame) { targetFrame = m_frame; frameRequest.setFrameName(targetOrBaseTarget); @@ -512,7 +529,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic m_unloadEventBeingDispatched = true; if (m_frame->domWindow()) { if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) - m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document()); + m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document()); if (!m_frame->document()->inPageCache()) m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document()); } @@ -551,7 +568,9 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic #if ENABLE(DATABASE) if (databasePolicy == DatabasePolicyStop) - doc->stopDatabases(); + doc->stopDatabases(0); +#else + UNUSED_PARAM(databasePolicy); #endif } @@ -603,10 +622,11 @@ KURL FrameLoader::iconURL() return KURL(); KURL url; - url.setProtocol(m_URL.protocol()); + bool couldSetProtocol = url.setProtocol(m_URL.protocol()); + ASSERT_UNUSED(couldSetProtocol, couldSetProtocol); url.setHost(m_URL.host()); - if (int port = m_URL.port()) - url.setPort(port); + if (m_URL.hasPort()) + url.setPort(m_URL.port()); url.setPath("/favicon.ico"); return url; } @@ -653,7 +673,7 @@ void FrameLoader::didExplicitOpen() // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results // from a subsequent window.document.open / window.document.write call. - // Cancelling redirection here works for all cases because document.open + // Canceling redirection here works for all cases because document.open // implicitly precedes document.write. m_frame->redirectScheduler()->cancel(); if (m_frame->document()->url() != blankURL()) @@ -740,7 +760,7 @@ void FrameLoader::receivedFirstData() begin(m_workingURL, false); dispatchDidCommitLoad(); - dispatchWindowObjectAvailable(); + dispatchDidClearWindowObjectsInAllWorlds(); if (m_documentLoader) { String ptitle = m_documentLoader->title(); @@ -820,6 +840,11 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) document->setURL(m_URL); m_frame->setDocument(document); + if (m_pendingStateObject) { + document->statePopped(m_pendingStateObject.get()); + m_pendingStateObject.clear(); + } + if (m_decoder) document->setDecoder(m_decoder.get()); if (forcedSecurityOrigin) @@ -829,7 +854,7 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->domWindow()->setSecurityOrigin(document->securityOrigin()); if (dispatch) - dispatchWindowObjectAvailable(); + dispatchDidClearWindowObjectsInAllWorlds(); updateFirstPartyForCookies(); @@ -1252,17 +1277,21 @@ bool FrameLoader::requestObject(RenderPart* renderer, const String& url, const A bool useFallback; if (shouldUsePlugin(completedURL, mimeType, renderer->hasFallbackContent(), useFallback)) { Settings* settings = m_frame->settings(); - if (!settings || !settings->arePluginsEnabled() || - (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) + if (!m_client->allowPlugins(settings && settings->arePluginsEnabled()) + || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType))) + return false; + if (isDocumentSandboxed(SandboxPlugins)) return false; return loadPlugin(renderer, completedURL, mimeType, paramNames, paramValues, useFallback); } ASSERT(renderer->node()->hasTagName(objectTag) || renderer->node()->hasTagName(embedTag)); HTMLPlugInElement* element = static_cast(renderer->node()); - - // FIXME: OK to always make a new frame? When does the old frame get removed? - return loadSubframe(element, completedURL, frameName, m_outgoingReferrer); + + // If the plug-in element already contains a subframe, requestFrame will re-use it. Otherwise, + // it will create a new frame and set it as the RenderPart's widget, causing what was previously + // in the widget to be torn down. + return requestFrame(element, completedURL, frameName); } bool FrameLoader::shouldUsePlugin(const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback) @@ -1371,7 +1400,7 @@ bool FrameLoader::isMixedContent(SecurityOrigin* context, const KURL& url) if (context->protocol() != "https") return false; // We only care about HTTPS security origins. - if (url.protocolIs("https") || url.protocolIs("about") || url.protocolIs("data")) + if (!url.isValid() || url.protocolIs("https") || url.protocolIs("about") || url.protocolIs("data")) return false; // Loading these protocols is secure. return true; @@ -1438,9 +1467,9 @@ void FrameLoader::provisionalLoadStarted() bool FrameLoader::isProcessingUserGesture() { Frame* frame = m_frame->tree()->top(); - if (!frame->script()->isEnabled()) + if (!frame->script()->canExecuteScripts()) return true; // If JavaScript is disabled, a user gesture must have initiated the navigation. - return frame->script()->processingUserGesture(); // FIXME: Use pageIsProcessingUserGesture. + return frame->script()->processingUserGesture(mainThreadNormalWorld()); // FIXME: Use pageIsProcessingUserGesture. } void FrameLoader::resetMultipleFormSubmissionProtection() @@ -1692,52 +1721,70 @@ void FrameLoader::setFirstPartyForCookies(const KURL& url) child->loader()->setFirstPartyForCookies(url); } -class HashChangeEventTask : public ScriptExecutionContext::Task { -public: - static PassRefPtr create(PassRefPtr document) - { - return adoptRef(new HashChangeEventTask(document)); - } - - virtual void performTask(ScriptExecutionContext* context) - { - ASSERT_UNUSED(context, context->isDocument()); - m_document->dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false)); - } - -private: - HashChangeEventTask(PassRefPtr document) - : m_document(document) - { - ASSERT(m_document); - } - - RefPtr m_document; -}; - // This does the same kind of work that didOpenURL does, except it relies on the fact // that a higher level already checked that the URLs match and the scrolling is the right thing to do. -void FrameLoader::scrollToAnchor(const KURL& url) -{ - ASSERT(equalIgnoringFragmentIdentifier(url, m_URL)); - if (equalIgnoringFragmentIdentifier(url, m_URL) && !equalIgnoringNullity(url.fragmentIdentifier(), m_URL.fragmentIdentifier())) { - Document* currentDocument = frame()->document(); - currentDocument->postTask(HashChangeEventTask::create(currentDocument)); +void FrameLoader::loadInSameDocument(const KURL& url, SerializedScriptValue* stateObject, bool isNewNavigation) +{ + // If we have a state object, we cannot also be a new navigation. + ASSERT(!stateObject || (stateObject && !isNewNavigation)); + + // Update the data source's request with the new URL to fake the URL change + m_frame->document()->setURL(url); + documentLoader()->replaceRequestURLForSameDocumentNavigation(url); + if (isNewNavigation && !shouldTreatURLAsSameAsCurrent(url) && !stateObject) { + // NB: must happen after replaceRequestURLForSameDocumentNavigation(), since we add + // based on the current request. Must also happen before we openURL and displace the + // scroll position, since adding the BF item will save away scroll state. + + // NB2: If we were loading a long, slow doc, and the user anchor nav'ed before + // it was done, currItem is now set the that slow doc, and prevItem is whatever was + // before it. Adding the b/f item will bump the slow doc down to prevItem, even + // though its load is not yet done. I think this all works out OK, for one because + // we have already saved away the scroll and doc state for the long slow load, + // but it's not an obvious case. + + history()->updateBackForwardListForFragmentScroll(); } + bool hashChange = equalIgnoringFragmentIdentifier(url, m_URL) && url.fragmentIdentifier() != m_URL.fragmentIdentifier(); m_URL = url; - history()->updateForAnchorScroll(); + history()->updateForSameDocumentNavigation(); // If we were in the autoscroll/panScroll mode we want to stop it before following the link to the anchor - m_frame->eventHandler()->stopAutoscrollTimer(); - started(); - if (FrameView* view = m_frame->view()) - view->scrollToFragment(m_URL); - + if (hashChange) + m_frame->eventHandler()->stopAutoscrollTimer(); + // It's important to model this as a load that starts and immediately finishes. // Otherwise, the parent frame may think we never finished loading. + started(); + + if (hashChange) { + if (FrameView* view = m_frame->view()) + view->scrollToFragment(m_URL); + } + m_isComplete = false; checkCompleted(); + + if (isNewNavigation) { + // This will clear previousItem from the rest of the frame tree that didn't + // doing any loading. We need to make a pass on this now, since for anchor nav + // we'll not go through a real load and reach Completed state. + checkLoadComplete(); + } + + if (stateObject) { + m_frame->document()->statePopped(stateObject); + m_client->dispatchDidPopStateWithinPage(); + } + + if (hashChange) { + m_frame->document()->dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false)); + m_client->dispatchDidChangeLocationWithinPage(); + } + + // FrameLoaderClient::didFinishLoad() tells the internal load delegate the load finished with no error + m_client->didFinishLoad(); } bool FrameLoader::isComplete() const @@ -2195,6 +2242,10 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const if (m_frame == targetFrame) return true; + // A sandboxed frame can only navigate itself and its descendants. + if (isDocumentSandboxed(SandboxNavigation) && !targetFrame->tree()->isDescendantOf(m_frame)) + return false; + // Let a frame navigate the top-level window that contains it. This is // important to allow because it lets a site "frame-bust" (escape from a // frame created by another web site). @@ -2262,6 +2313,8 @@ void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy) if (m_documentLoader) m_documentLoader->clearArchiveResources(); + m_checkTimer.stop(); + m_inStopAllLoaders = false; } @@ -2485,10 +2538,13 @@ void FrameLoader::transitionToCommitted(PassRefPtr cachedPage) case FrameLoadTypeBack: case FrameLoadTypeBackWMLDeckNotAccessible: case FrameLoadTypeIndexedBackForward: - if (Page* page = m_frame->page()) + if (Page* page = m_frame->page()) { if (page->backForwardList()) { history()->updateForBackForwardNavigation(); + if (history()->currentItem()) + m_pendingStateObject = history()->currentItem()->stateObject(); + // Create a document view for this document, or used the cached view. if (cachedPage) { DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader(); @@ -2499,6 +2555,7 @@ void FrameLoader::transitionToCommitted(PassRefPtr cachedPage) } else m_client->transitionToCommittedForNewPage(); } + } break; case FrameLoadTypeReload: @@ -2623,7 +2680,7 @@ void FrameLoader::open(CachedPage& cachedPage) closeURL(); // Delete old status bar messages (if it _was_ activated on last URL). - if (m_frame->script()->isEnabled()) { + if (m_frame->script()->canExecuteScripts()) { m_frame->setJSStatusBarText(String()); m_frame->setJSDefaultStatusBarText(String()); } @@ -2847,6 +2904,9 @@ CachePolicy FrameLoader::subresourceCachePolicy() const if (m_loadType == FrameLoadTypeReload) return CachePolicyRevalidate; + if (request.cachePolicy() == ReturnCacheDataElseLoad) + return CachePolicyAllowStale; + return CachePolicyVerify; } @@ -2886,6 +2946,10 @@ void FrameLoader::checkLoadCompleteForThisFrame() stopLoadingSubframes(); pdl->stopLoading(); + // If we're in the middle of loading multipart data, we need to restore the document loader. + if (isReplacing() && !m_documentLoader.get()) + setDocumentLoader(m_provisionalDocumentLoader.get()); + // Finish resetting the load state, but only if another load hasn't been started by the // delegate callback. if (pdl == m_provisionalDocumentLoader) @@ -3085,6 +3149,10 @@ void FrameLoader::tokenizerProcessedData() void FrameLoader::handledOnloadEvents() { m_client->dispatchDidHandleOnloadEvents(); +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + if (documentLoader()) + documentLoader()->applicationCacheHost()->stopDeferringEvents(); +#endif } void FrameLoader::frameDetached() @@ -3160,7 +3228,8 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp request.setCachePolicy(ReloadIgnoringCacheData); request.setHTTPHeaderField("Cache-Control", "no-cache"); request.setHTTPHeaderField("Pragma", "no-cache"); - } + } else if (isBackForwardLoadType(loadType) && !request.url().protocolIs("https")) + request.setCachePolicy(ReturnCacheDataElseLoad); if (mainResource) request.setHTTPAccept(defaultAcceptHeader); @@ -3257,10 +3326,16 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ ResourceRequest initialRequest = request; initialRequest.setTimeoutInterval(10); + // Use the original request's cache policy for two reasons: + // 1. For POST requests, we mutate the cache policy for the main resource, + // but we do not want this to apply to subresources + // 2. Delegates that modify the cache policy using willSendRequest: should + // not affect any other resources. Such changes need to be done + // per request. if (initialRequest.isConditional()) initialRequest.setCachePolicy(ReloadIgnoringCacheData); else - initialRequest.setCachePolicy(documentLoader()->request().cachePolicy()); + initialRequest.setCachePolicy(originalRequest().cachePolicy()); if (!referrer.isEmpty()) initialRequest.setHTTPReferrer(referrer); @@ -3341,40 +3416,13 @@ void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue) { - bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == FrameLoadTypeRedirectWithLockedBackForwardList; m_quickRedirectComing = false; if (!shouldContinue) return; - KURL url = request.url(); - - m_documentLoader->replaceRequestURLForAnchorScroll(url); - if (!isRedirect && !shouldTreatURLAsSameAsCurrent(url)) { - // NB: must happen after _setURL, since we add based on the current request. - // Must also happen before we openURL and displace the scroll position, since - // adding the BF item will save away scroll state. - - // NB2: If we were loading a long, slow doc, and the user anchor nav'ed before - // it was done, currItem is now set the that slow doc, and prevItem is whatever was - // before it. Adding the b/f item will bump the slow doc down to prevItem, even - // though its load is not yet done. I think this all works out OK, for one because - // we have already saved away the scroll and doc state for the long slow load, - // but it's not an obvious case. - - history()->updateBackForwardListForFragmentScroll(); - } - - scrollToAnchor(url); - - if (!isRedirect) - // This will clear previousItem from the rest of the frame tree that didn't - // doing any loading. We need to make a pass on this now, since for anchor nav - // we'll not go through a real load and reach Completed state. - checkLoadComplete(); - - m_client->dispatchDidChangeLocationWithinPage(); - m_client->didFinishLoad(); + bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == FrameLoadTypeRedirectWithLockedBackForwardList; + loadInSameDocument(request.url(), 0, !isRedirect); } bool FrameLoader::shouldScrollToAnchor(bool isFormSubmission, FrameLoadType loadType, const KURL& url) @@ -3451,7 +3499,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass if (!m_frame->page()) return; -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) +#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && USE(JSC) if (Page* page = m_frame->page()) { if (page->mainFrame() == m_frame) page->inspectorController()->resumeDebugger(); @@ -3614,7 +3662,7 @@ void FrameLoader::pageHidden() { m_unloadEventBeingDispatched = true; if (m_frame->domWindow()) - m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, true), m_frame->document()); + m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, true), m_frame->document()); m_unloadEventBeingDispatched = false; // Send pagehide event for subframes as well @@ -3649,14 +3697,48 @@ Frame* FrameLoader::findFrameForNavigation(const AtomicString& name) return frame; } -// Loads content into this frame, as specified by history item +void FrameLoader::navigateWithinDocument(HistoryItem* item) +{ + ASSERT(item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber()); + + // Save user view state to the current history item here since we don't do a normal load. + // FIXME: Does form state need to be saved here too? + history()->saveScrollPositionAndViewStateToItem(history()->currentItem()); + if (FrameView* view = m_frame->view()) + view->setWasScrolledByUser(false); + + history()->setCurrentItem(item); + + // loadInSameDocument() actually changes the URL and notifies load delegates of a "fake" load + loadInSameDocument(item->url(), item->stateObject(), false); + + // Restore user view state from the current history item here since we don't do a normal load. + history()->restoreScrollPositionAndViewState(); +} + // FIXME: This function should really be split into a couple pieces, some of // which should be methods of HistoryController and some of which should be // methods of FrameLoader. -void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) -{ - if (!m_frame->page()) - return; +void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType loadType) +{ + // Remember this item so we can traverse any child items as child frames load + history()->setProvisionalItem(item); + + // Check if we'll be using the page cache. We only use the page cache + // if one exists and it is less than _backForwardCacheExpirationInterval + // seconds old. If the cache is expired it gets flushed here. + if (RefPtr cachedPage = pageCache()->get(item)) { + // FIXME: 1800 should not be hardcoded, it should come from + // WebKitBackForwardCacheExpirationIntervalKey in WebKit. + // Or we should remove WebKitBackForwardCacheExpirationIntervalKey. + if (currentTime() - cachedPage->timeStamp() <= 1800) { + loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0); + return; + } + + LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", history()->provisionalItem()->url().string().ascii().data()); + pageCache()->remove(item); + } KURL itemURL = item->url(); KURL itemOriginalURL = item->originalURL(); @@ -3665,138 +3747,98 @@ void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) currentURL = documentLoader()->url(); RefPtr formData = item->formData(); - // Are we navigating to an anchor within the page? - // Note if we have child frames we do a real reload, since the child frames might not - // match our current frame structure, or they might not have the right content. We could - // check for all that as an additional optimization. - // We also do not do anchor-style navigation if we're posting a form or navigating from - // a page that was resulted from a form post. - bool shouldScroll = !formData && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item); + bool addedExtraFields = false; + ResourceRequest request(itemURL); -#if ENABLE(WML) - // All WML decks should go through the real load mechanism, not the scroll-to-anchor code - if (frameContainsWMLContent(m_frame)) - shouldScroll = false; -#endif - - if (shouldScroll) { - // Must do this maintenance here, since we don't go through a real page reload - history()->saveScrollPositionAndViewStateToItem(history()->currentItem()); - - if (FrameView* view = m_frame->view()) - view->setWasScrolledByUser(false); - - history()->setCurrentItem(item); + if (!item->referrer().isNull()) + request.setHTTPReferrer(item->referrer()); + + // If this was a repost that failed the page cache, we might try to repost the form. + NavigationAction action; + if (formData) { + formData->generateFiles(m_frame->page()->chrome()->client()); - // FIXME: Form state might need to be saved here too. + request.setHTTPMethod("POST"); + request.setHTTPBody(formData); + request.setHTTPContentType(item->formContentType()); + RefPtr securityOrigin = SecurityOrigin::createFromString(item->referrer()); + addHTTPOriginIfNeeded(request, securityOrigin->toString()); - // We always call scrollToAnchor here, even if the URL doesn't have an - // anchor fragment. This is so we'll keep the WebCore Frame's URL up-to-date. - scrollToAnchor(item->url()); - - // must do this maintenance here, since we don't go through a real page reload - history()->restoreScrollPositionAndViewState(); + // Make sure to add extra fields to the request after the Origin header is added for the FormData case. + // See https://bugs.webkit.org/show_bug.cgi?id=22194 for more discussion. + addExtraFieldsToRequest(request, m_loadType, true, formData); + addedExtraFields = true; - // Fake the URL change by updating the data source's request. This will no longer - // be necessary if we do the better fix described above. - documentLoader()->replaceRequestURLForAnchorScroll(itemURL); - - m_client->dispatchDidChangeLocationWithinPage(); + // FIXME: Slight hack to test if the NSURL cache contains the page we're going to. + // We want to know this before talking to the policy delegate, since it affects whether + // we show the DoYouReallyWantToRepost nag. + // + // This trick has a small bug (3123893) where we might find a cache hit, but then + // have the item vanish when we try to use it in the ensuing nav. This should be + // extremely rare, but in that case the user will get an error on the navigation. - // FrameLoaderClient::didFinishLoad() tells the internal load delegate the load finished with no error - m_client->didFinishLoad(); + if (ResourceHandle::willLoadFromCache(request, m_frame)) + action = NavigationAction(itemURL, loadType, false); + else { + request.setCachePolicy(ReloadIgnoringCacheData); + action = NavigationAction(itemURL, NavigationTypeFormResubmitted); + } } else { - // Remember this item so we can traverse any child items as child frames load - history()->setProvisionalItem(item); - - bool inPageCache = false; - - // Check if we'll be using the page cache. We only use the page cache - // if one exists and it is less than _backForwardCacheExpirationInterval - // seconds old. If the cache is expired it gets flushed here. - if (RefPtr cachedPage = pageCache()->get(item)) { - double interval = currentTime() - cachedPage->timeStamp(); - - // FIXME: 1800 should not be hardcoded, it should come from - // WebKitBackForwardCacheExpirationIntervalKey in WebKit. - // Or we should remove WebKitBackForwardCacheExpirationIntervalKey. - if (interval <= 1800) { - loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0); - inPageCache = true; - } else { - LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", history()->provisionalItem()->url().string().ascii().data()); - pageCache()->remove(item); - } + switch (loadType) { + case FrameLoadTypeReload: + case FrameLoadTypeReloadFromOrigin: + request.setCachePolicy(ReloadIgnoringCacheData); + break; + case FrameLoadTypeBack: + case FrameLoadTypeBackWMLDeckNotAccessible: + case FrameLoadTypeForward: + case FrameLoadTypeIndexedBackForward: + if (!itemURL.protocolIs("https")) + request.setCachePolicy(ReturnCacheDataElseLoad); + break; + case FrameLoadTypeStandard: + case FrameLoadTypeRedirectWithLockedBackForwardList: + break; + case FrameLoadTypeSame: + default: + ASSERT_NOT_REACHED(); } - - if (!inPageCache) { - bool addedExtraFields = false; - ResourceRequest request(itemURL); - if (!item->referrer().isNull()) - request.setHTTPReferrer(item->referrer()); - - // If this was a repost that failed the page cache, we might try to repost the form. - NavigationAction action; - if (formData) { - - formData->generateFiles(m_frame->page()->chrome()->client()); + action = NavigationAction(itemOriginalURL, loadType, false); + } + + if (!addedExtraFields) + addExtraFieldsToRequest(request, m_loadType, true, formData); - request.setHTTPMethod("POST"); - request.setHTTPBody(formData); - request.setHTTPContentType(item->formContentType()); - RefPtr securityOrigin = SecurityOrigin::createFromString(item->referrer()); - addHTTPOriginIfNeeded(request, securityOrigin->toString()); - - // Make sure to add extra fields to the request after the Origin header is added for the FormData case. - // See https://bugs.webkit.org/show_bug.cgi?id=22194 for more discussion. - addExtraFieldsToRequest(request, m_loadType, true, formData); - addedExtraFields = true; - - // FIXME: Slight hack to test if the NSURL cache contains the page we're going to. - // We want to know this before talking to the policy delegate, since it affects whether - // we show the DoYouReallyWantToRepost nag. - // - // This trick has a small bug (3123893) where we might find a cache hit, but then - // have the item vanish when we try to use it in the ensuing nav. This should be - // extremely rare, but in that case the user will get an error on the navigation. - - if (ResourceHandle::willLoadFromCache(request, m_frame)) - action = NavigationAction(itemURL, loadType, false); - else { - request.setCachePolicy(ReloadIgnoringCacheData); - action = NavigationAction(itemURL, NavigationTypeFormResubmitted); - } - } else { - switch (loadType) { - case FrameLoadTypeReload: - case FrameLoadTypeReloadFromOrigin: - request.setCachePolicy(ReloadIgnoringCacheData); - break; - case FrameLoadTypeBack: - case FrameLoadTypeBackWMLDeckNotAccessible: - case FrameLoadTypeForward: - case FrameLoadTypeIndexedBackForward: - if (itemURL.protocol() != "https") - request.setCachePolicy(ReturnCacheDataElseLoad); - break; - case FrameLoadTypeStandard: - case FrameLoadTypeRedirectWithLockedBackForwardList: - break; - case FrameLoadTypeSame: - default: - ASSERT_NOT_REACHED(); - } + loadWithNavigationAction(request, action, false, loadType, 0); +} - action = NavigationAction(itemOriginalURL, loadType, false); - } - - if (!addedExtraFields) - addExtraFieldsToRequest(request, m_loadType, true, formData); +// Loads content into this frame, as specified by history item +void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) +{ + // We do same-document navigation in the following cases: + // - The HistoryItem has a history state object + // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry, + // and the URLs in the frame tree match the history item for fragment scrolling. + HistoryItem* currentItem = history()->currentItem(); + bool sameDocumentNavigation = (!item->formData() && !(currentItem && currentItem->formData()) && history()->urlsMatchItem(item)) + || (currentItem && item->documentSequenceNumber() == currentItem->documentSequenceNumber()); - loadWithNavigationAction(request, action, false, loadType, 0); - } - } +#if ENABLE(WML) + // All WML decks should go through the real load mechanism, not the scroll-to-anchor code + // FIXME: Why do WML decks have this different behavior? + // Are WML decks incompatible with HTML5 pushState/replaceState which require inter-document history navigations? + // Should this new API be disabled for WML pages, or does WML need to update their mechanism to act like normal loads? + // If scroll-to-anchor navigations were broken for WML and required them to have different loading behavior, then + // state object loads are certainly also broken for them. + if (frameContainsWMLContent(m_frame)) + sameDocumentNavigation = false; +#endif + + if (sameDocumentNavigation) + navigateWithinDocument(item); + else + navigateToDifferentDocument(item, loadType); } void FrameLoader::setMainDocumentError(DocumentLoader* loader, const ResourceError& error) @@ -3866,15 +3908,28 @@ void FrameLoader::dispatchDocumentElementAvailable() m_client->documentElementAvailable(); } -void FrameLoader::dispatchWindowObjectAvailable() +void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds() +{ + if (!m_frame->script()->canExecuteScripts()) + return; + + Vector worlds; + ScriptController::getAllWorlds(worlds); + for (size_t i = 0; i < worlds.size(); ++i) + dispatchDidClearWindowObjectInWorld(worlds[i]); +} + +void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world) { - // FIXME: should this be isolated-worlds-aware? - if (!m_frame->script()->isEnabled() || !m_frame->script()->existingWindowShell(mainThreadNormalWorld())) + if (!m_frame->script()->canExecuteScripts() || !m_frame->script()->existingWindowShell(world)) return; - m_client->windowObjectCleared(); + m_client->dispatchDidClearWindowObjectInWorld(world); #if ENABLE(INSPECTOR) + if (world != mainThreadNormalWorld()) + return; + if (Page* page = m_frame->page()) { if (InspectorController* inspector = page->inspectorController()) inspector->inspectedWindowScriptObjectCleared(m_frame); @@ -3884,6 +3939,28 @@ void FrameLoader::dispatchWindowObjectAvailable() #endif } +void FrameLoader::updateSandboxFlags() +{ + SandboxFlags flags = SandboxNone; + if (Frame* parentFrame = m_frame->tree()->parent()) + flags |= parentFrame->loader()->sandboxFlags(); + if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) + flags |= ownerElement->sandboxFlags(); + + if (m_sandboxFlags == flags) + return; + + m_sandboxFlags = flags; + + for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) + child->loader()->updateSandboxFlags(); +} + +bool FrameLoader::isDocumentSandboxed(SandboxFlags mask) const +{ + return m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(mask); +} + PassRefPtr FrameLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap& args) { String baseURLString; diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h index 3bf6196..6533445 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h @@ -50,6 +50,7 @@ class AuthenticationChallenge; class CachedFrameBase; class CachedPage; class CachedResource; +class DOMWrapperWorld; class Document; class DocumentLoader; class Event; @@ -72,6 +73,7 @@ class ScriptSourceCode; class ScriptString; class ScriptValue; class SecurityOrigin; +class SerializedScriptValue; class SharedBuffer; class SubstituteData; class TextResourceDecoder; @@ -246,9 +248,15 @@ public: PassRefPtr createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap& args); - void dispatchWindowObjectAvailable(); + void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); + void dispatchDidClearWindowObjectsInAllWorlds(); void dispatchDocumentElementAvailable(); + void ownerElementSandboxFlagsChanged() { updateSandboxFlags(); } + + bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; } + SandboxFlags sandboxFlags() const { return m_sandboxFlags; } + // Mixed content related functions. static bool isMixedContent(SecurityOrigin* context, const KURL&); void checkIfDisplayInsecureContent(SecurityOrigin* context, const KURL&); @@ -343,6 +351,9 @@ private: bool loadPlugin(RenderPart*, const KURL&, const String& mimeType, const Vector& paramNames, const Vector& paramValues, bool useFallback); + void navigateWithinDocument(HistoryItem*); + void navigateToDifferentDocument(HistoryItem*, FrameLoadType); + bool loadProvisionalItemFromCachedPage(); void cachePageForHistoryItem(HistoryItem*); void pageHidden(); @@ -417,7 +428,7 @@ private: Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer); - void scrollToAnchor(const KURL&); + void loadInSameDocument(const KURL&, SerializedScriptValue* stateObject, bool isNewNavigation); void provisionalLoadStarted(); @@ -433,6 +444,10 @@ private: bool shouldTreatURLAsSameAsCurrent(const KURL&) const; + void updateSandboxFlags(); + // FIXME: isDocumentSandboxed should eventually replace isSandboxed. + bool isDocumentSandboxed(SandboxFlags) const; + Frame* m_frame; FrameLoaderClient* m_client; @@ -470,6 +485,8 @@ private: bool m_isComplete; bool m_isLoadingMainResource; + RefPtr m_pendingStateObject; + KURL m_URL; KURL m_workingURL; @@ -504,6 +521,8 @@ private: bool m_loadingFromCachedPage; bool m_suppressOpenerInNewFrame; + SandboxFlags m_sandboxFlags; + #ifndef NDEBUG bool m_didDispatchDidCommitLoad; #endif diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h index 2042b32..23d13bc 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderClient.h @@ -47,6 +47,7 @@ namespace WebCore { class AuthenticationChallenge; class CachedFrame; class Color; + class DOMWrapperWorld; class DocumentLoader; class Element; class FormState; @@ -64,7 +65,7 @@ namespace WebCore { class ResourceError; class ResourceHandle; class ResourceLoader; - struct ResourceRequest; + class ResourceRequest; class ResourceResponse; class ScriptString; class SecurityOrigin; @@ -116,6 +117,9 @@ namespace WebCore { virtual void dispatchDidCancelClientRedirect() = 0; virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) = 0; virtual void dispatchDidChangeLocationWithinPage() = 0; + virtual void dispatchDidPushStateWithinPage() = 0; + virtual void dispatchDidReplaceStateWithinPage() = 0; + virtual void dispatchDidPopStateWithinPage() = 0; virtual void dispatchWillClose() = 0; virtual void dispatchDidReceiveIcon() = 0; virtual void dispatchDidStartProvisionalLoad() = 0; @@ -165,6 +169,9 @@ namespace WebCore { virtual void updateGlobalHistoryRedirectLinks() = 0; virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0; + virtual void dispatchDidAddBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const = 0; + virtual void dispatchDidChangeBackForwardIndex() const = 0; // This frame has displayed inactive content (such as an image) from an // insecure source. Inactive content cannot spread to other frames. @@ -212,6 +219,7 @@ namespace WebCore { virtual PassRefPtr createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0; + virtual void didTransferChildFrameToNewDocument() = 0; virtual PassRefPtr createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector&, const Vector&, const String&, bool loadManually) = 0; virtual void redirectDataToPlugin(Widget* pluginWidget) = 0; @@ -222,7 +230,7 @@ namespace WebCore { virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0; virtual String overrideMediaType() const = 0; - virtual void windowObjectCleared() = 0; + virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*) = 0; virtual void documentElementAvailable() = 0; virtual void didPerformFirstNavigation() const = 0; // "Navigation" here means a transition from one page to another that ends up in the back/forward list. @@ -246,6 +254,12 @@ namespace WebCore { virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const { return false; } virtual bool shouldLoadMediaElementURL(const KURL&) const { return true; } + + virtual void didChangeScrollOffset() { } + + virtual bool allowJavaScript(bool enabledPerSettings) { return enabledPerSettings; } + virtual bool allowPlugins(bool enabledPerSettings) { return enabledPerSettings; } + virtual bool allowImages(bool enabledPerSettings) { return enabledPerSettings; } }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h index e7d51c7..8288bce 100644 --- a/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h +++ b/src/3rdparty/webkit/WebCore/loader/FrameLoaderTypes.h @@ -92,6 +92,23 @@ namespace WebCore { SendReferrer, NoReferrer }; + + enum SandboxFlag { + SandboxNone = 0, + SandboxNavigation = 1, + SandboxPlugins = 1 << 1, + SandboxOrigin = 1 << 2, + SandboxForms = 1 << 3, + SandboxScripts = 1 << 4, + SandboxAll = -1 // Mask with all bits set to 1. + }; + + enum SecurityCheckPolicy { + SkipSecurityCheck, + DoSecurityCheck + }; + + typedef int SandboxFlags; } #endif diff --git a/src/3rdparty/webkit/WebCore/loader/HistoryController.cpp b/src/3rdparty/webkit/WebCore/loader/HistoryController.cpp index 501640a..55b68dc 100644 --- a/src/3rdparty/webkit/WebCore/loader/HistoryController.cpp +++ b/src/3rdparty/webkit/WebCore/loader/HistoryController.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "HistoryController.h" +#include "BackForwardList.h" #include "CachedPage.h" #include "CString.h" #include "DocumentLoader.h" @@ -105,6 +106,14 @@ void HistoryController::restoreScrollPositionAndViewState() void HistoryController::updateBackForwardListForFragmentScroll() { updateBackForwardListClippedAtTarget(false); + + // Since the document isn't changed as a result of a fragment scroll, we should + // preserve the DocumentSequenceNumber of the previous item. + if (!m_previousItem) + return; + + ASSERT(m_currentItem); + m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); } void HistoryController::saveDocumentState() @@ -402,7 +411,7 @@ void HistoryController::updateForCommit() } } -void HistoryController::updateForAnchorScroll() +void HistoryController::updateForSameDocumentNavigation() { if (m_frame->loader()->url().isEmpty()) return; @@ -624,4 +633,38 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) page->backForwardList()->addItem(item); } +void HistoryController::pushState(PassRefPtr stateObject, const String& title, const String& urlString) +{ + Page* page = m_frame->page(); + ASSERT(page); + + // Get a HistoryItem tree for the current frame tree. + RefPtr item = createItemTree(m_frame, false); + ASSERT(item->isTargetItem()); + + // Override data in the target item to reflect the pushState() arguments. + item->setTitle(title); + item->setStateObject(stateObject); + item->setURLString(urlString); + + // Since the document isn't changed as a result of a pushState call, we + // should preserve the DocumentSequenceNumber of the previous item. + item->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber()); + + page->backForwardList()->pushStateItem(item.release()); +} + +void HistoryController::replaceState(PassRefPtr stateObject, const String& title, const String& urlString) +{ + Page* page = m_frame->page(); + ASSERT(page); + HistoryItem* current = page->backForwardList()->currentItem(); + ASSERT(current); + + if (!urlString.isEmpty()) + current->setURLString(urlString); + current->setTitle(title); + current->setStateObject(stateObject); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/loader/HistoryController.h b/src/3rdparty/webkit/WebCore/loader/HistoryController.h index 4ecae69..7c4a1ac 100644 --- a/src/3rdparty/webkit/WebCore/loader/HistoryController.h +++ b/src/3rdparty/webkit/WebCore/loader/HistoryController.h @@ -39,6 +39,7 @@ namespace WebCore { class Frame; class HistoryItem; +class SerializedScriptValue; class HistoryController : public Noncopyable { public: @@ -65,7 +66,7 @@ public: void updateForRedirectWithLockedBackForwardList(); void updateForClientRedirect(); void updateForCommit(); - void updateForAnchorScroll(); + void updateForSameDocumentNavigation(); void updateForFrameLoadCompleted(); HistoryItem* currentItem() const { return m_currentItem.get(); } @@ -75,6 +76,9 @@ public: HistoryItem* provisionalItem() const { return m_provisionalItem.get(); } void setProvisionalItem(HistoryItem*); + void pushState(PassRefPtr, const String& title, const String& url); + void replaceState(PassRefPtr, const String& title, const String& url); + private: PassRefPtr createItem(bool useOriginal); PassRefPtr createItemTree(Frame* targetFrame, bool clipAtTarget); diff --git a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp index 9b5598d..2f564cc 100644 --- a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp @@ -33,6 +33,7 @@ #include "EventNames.h" #include "Frame.h" #include "FrameLoader.h" +#include "FrameLoaderClient.h" #include "FrameView.h" #include "HTMLImageElement.h" #include "HTMLNames.h" @@ -115,8 +116,13 @@ void ImageTokenizer::write(const SegmentedString&, bool) bool ImageTokenizer::writeRawData(const char*, int) { + Frame* frame = m_doc->frame(); + Settings* settings = frame->settings(); + if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled())) + return false; + CachedImage* cachedImage = m_doc->cachedImage(); - cachedImage->data(m_doc->frame()->loader()->documentLoader()->mainResourceData(), false); + cachedImage->data(frame->loader()->documentLoader()->mainResourceData(), false); m_doc->imageChanged(); diff --git a/src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp b/src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp index cdc31bc..929b28a 100644 --- a/src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,9 +29,27 @@ #include "Element.h" #include "RenderImage.h" +#if !ASSERT_DISABLED +// ImageLoader objects are allocated as members of other objects, so generic pointer check would always fail. +namespace WTF { + +template<> struct ValueCheck { + typedef WebCore::ImageLoader* TraitType; + static void checkConsistency(const WebCore::ImageLoader* p) + { + if (!p) + return; + ASSERT(p->element()); + ValueCheck::checkConsistency(p->element()); + } +}; + +} +#endif + namespace WebCore { -class ImageEventSender { +class ImageEventSender : public Noncopyable { public: ImageEventSender(const AtomicString& eventType); @@ -40,6 +58,10 @@ public: void dispatchPendingEvents(); +#if !ASSERT_DISABLED + bool hasPendingEvents(ImageLoader* loader) { return m_dispatchSoonList.find(loader) != notFound; } +#endif + private: void timerFired(Timer*); @@ -75,8 +97,12 @@ ImageLoader::~ImageLoader() { if (m_image) m_image->removeClient(this); + + ASSERT(!m_firedBeforeLoad || !beforeLoadEventSender().hasPendingEvents(this)); if (!m_firedBeforeLoad) beforeLoadEventSender().cancelEvent(this); + + ASSERT(!m_firedLoad || !loadEventSender().hasPendingEvents(this)); if (!m_firedLoad) loadEventSender().cancelEvent(this); } @@ -86,9 +112,15 @@ void ImageLoader::setImage(CachedImage* newImage) ASSERT(m_failedLoadURL.isEmpty()); CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { - setLoadingImage(newImage); - m_firedBeforeLoad = true; - m_firedLoad = true; + m_image = newImage; + if (!m_firedBeforeLoad) { + beforeLoadEventSender().cancelEvent(this); + m_firedBeforeLoad = true; + } + if (!m_firedLoad) { + loadEventSender().cancelEvent(this); + m_firedLoad = true; + } m_imageComplete = true; if (newImage) newImage->addClient(this); @@ -103,14 +135,6 @@ void ImageLoader::setImage(CachedImage* newImage) } } -void ImageLoader::setLoadingImage(CachedImage* loadingImage) -{ - m_image = loadingImage; - m_firedBeforeLoad = !loadingImage; - m_firedLoad = !loadingImage; - m_imageComplete = !loadingImage; -} - void ImageLoader::updateFromElement() { // If we're not making renderers for the page, then don't load images. We don't want to slow @@ -146,7 +170,16 @@ void ImageLoader::updateFromElement() CachedImage* oldImage = m_image.get(); if (newImage != oldImage) { - setLoadingImage(newImage); + if (!m_firedBeforeLoad) + beforeLoadEventSender().cancelEvent(this); + if (!m_firedLoad) + loadEventSender().cancelEvent(this); + + m_image = newImage; + m_firedBeforeLoad = !newImage; + m_firedLoad = !newImage; + m_imageComplete = !newImage; + if (newImage) { newImage->addClient(this); if (!m_element->document()->hasListenerType(Document::BEFORELOAD_LISTENER)) @@ -180,13 +213,16 @@ void ImageLoader::notifyFinished(CachedResource*) if (haveFiredBeforeLoadEvent()) updateRenderer(); + if (m_firedLoad) + return; + loadEventSender().dispatchEventSoon(this); } void ImageLoader::updateRenderer() { if (RenderObject* renderer = m_element->renderer()) { - if (!renderer->isImage()) + if (!renderer->isImage() && !renderer->isVideo()) return; RenderImage* imageRenderer = toRenderImage(renderer); @@ -194,7 +230,7 @@ void ImageLoader::updateRenderer() // is a complete image. This prevents flickering in the case where a dynamic // change is happening between two images. CachedImage* cachedImage = imageRenderer->cachedImage(); - if (m_image != cachedImage && (m_imageComplete || !imageRenderer->cachedImage())) + if (m_image != cachedImage && (m_imageComplete || !cachedImage)) imageRenderer->setCachedImage(m_image.get()); } } @@ -231,9 +267,13 @@ void ImageLoader::dispatchPendingLoadEvent() dispatchLoadEvent(); } -void ImageLoader::dispatchPendingEvents() +void ImageLoader::dispatchPendingBeforeLoadEvents() { beforeLoadEventSender().dispatchPendingEvents(); +} + +void ImageLoader::dispatchPendingLoadEvents() +{ loadEventSender().dispatchPendingEvents(); } @@ -278,6 +318,8 @@ void ImageEventSender::dispatchPendingEvents() m_timer.stop(); + m_dispatchSoonList.checkConsistency(); + m_dispatchingList.swap(m_dispatchSoonList); size_t size = m_dispatchingList.size(); for (size_t i = 0; i < size; ++i) { diff --git a/src/3rdparty/webkit/WebCore/loader/ImageLoader.h b/src/3rdparty/webkit/WebCore/loader/ImageLoader.h index 7f42e33..44fe98e 100644 --- a/src/3rdparty/webkit/WebCore/loader/ImageLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/ImageLoader.h @@ -49,14 +49,15 @@ public: bool imageComplete() const { return m_imageComplete; } CachedImage* image() const { return m_image.get(); } - void setImage(CachedImage*); + void setImage(CachedImage*); // Cancels pending beforeload and load events, and doesn't dispatch new ones. void setLoadManually(bool loadManually) { m_loadManually = loadManually; } bool haveFiredBeforeLoadEvent() const { return m_firedBeforeLoad; } bool haveFiredLoadEvent() const { return m_firedLoad; } - static void dispatchPendingEvents(); + static void dispatchPendingBeforeLoadEvents(); + static void dispatchPendingLoadEvents(); protected: virtual void notifyFinished(CachedResource*); @@ -69,8 +70,6 @@ private: void dispatchPendingBeforeLoadEvent(); void dispatchPendingLoadEvent(); - void setLoadingImage(CachedImage*); - void updateRenderer(); Element* m_element; diff --git a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp index 4970f06..d4b22d0 100644 --- a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.cpp @@ -38,6 +38,9 @@ #include "FrameLoaderClient.h" #include "HTMLFormElement.h" #include "Page.h" +#if PLATFORM(QT) +#include "PluginDatabase.h" +#endif #include "ResourceError.h" #include "ResourceHandle.h" #include "Settings.h" @@ -279,6 +282,29 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction policy) deref(); // balances ref in didReceiveResponse } +#if PLATFORM(QT) +void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResponse& r) +{ + if (!m_frame->settings()->arePluginsEnabled()) + return; + + String filename = r.url().lastPathComponent(); + if (filename.endsWith("/")) + return; + + int extensionPos = filename.reverseFind('.'); + if (extensionPos == -1) + return; + + String extension = filename.substring(extensionPos + 1); + String mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(extension); + if (!mimeType.isEmpty()) { + ResourceResponse* response = const_cast(&r); + response->setMimeType(mimeType); + } +} +#endif + void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) @@ -301,6 +327,11 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) ASSERT(shouldLoadAsEmptyDocument(r.url()) || !defersLoading()); #endif +#if PLATFORM(QT) + if (r.mimeType() == "application/octet-stream") + substituteMIMETypeFromPluginDatabase(r); +#endif + if (m_loadingMultipartContent) { frameLoader()->setupForReplaceByMIMEType(r.mimeType()); clearResourceData(); diff --git a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.h b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.h index d3f411b..eaaf2e8 100644 --- a/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/MainResourceLoader.h @@ -40,7 +40,7 @@ namespace WebCore { class FormState; - struct ResourceRequest; + class ResourceRequest; class MainResourceLoader : public ResourceLoader { public: @@ -92,6 +92,10 @@ namespace WebCore { static void callContinueAfterContentPolicy(void*, PolicyAction); void continueAfterContentPolicy(PolicyAction); void continueAfterContentPolicy(PolicyAction, const ResourceResponse&); + +#if PLATFORM(QT) + void substituteMIMETypeFromPluginDatabase(const ResourceResponse&); +#endif ResourceRequest m_initialRequest; SubstituteData m_substituteData; diff --git a/src/3rdparty/webkit/WebCore/loader/MediaDocument.cpp b/src/3rdparty/webkit/WebCore/loader/MediaDocument.cpp index 656d0a0..a2d6276 100644 --- a/src/3rdparty/webkit/WebCore/loader/MediaDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/MediaDocument.cpp @@ -159,12 +159,12 @@ void MediaDocument::defaultEventHandler(Event* event) HTMLVideoElement* video = static_cast(targetNode); if (event->type() == eventNames().clickEvent) { if (!video->canPlay()) { - video->pause(); + video->pause(event->fromUserGesture()); event->setDefaultHandled(); } } else if (event->type() == eventNames().dblclickEvent) { if (video->canPlay()) { - video->play(); + video->play(event->fromUserGesture()); event->setDefaultHandled(); } } @@ -186,9 +186,9 @@ void MediaDocument::defaultEventHandler(Event* event) if (keyboardEvent->keyIdentifier() == "U+0020") { // space if (video->paused()) { if (video->canPlay()) - video->play(); + video->play(event->fromUserGesture()); } else - video->pause(); + video->pause(event->fromUserGesture()); event->setDefaultHandled(); } } diff --git a/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.cpp b/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.cpp index af14c72..81222b3 100644 --- a/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.cpp +++ b/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.cpp @@ -35,11 +35,6 @@ void PlaceholderDocument::attach() { ASSERT(!attached()); - if (!styleSelector()) { - RefPtr styleSheetList = StyleSheetList::create(this); - setStyleSelector(new CSSStyleSelector(this, styleSheetList.get(), 0, pageUserSheet(), pageGroupUserSheets(), true, false)); - } - // Skipping Document::attach(). ContainerNode::attach(); } diff --git a/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.h b/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.h index a759266..5b76a9c 100644 --- a/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.h +++ b/src/3rdparty/webkit/WebCore/loader/PlaceholderDocument.h @@ -40,7 +40,7 @@ public: virtual void attach(); private: - PlaceholderDocument(Frame* frame) : Document(frame, false) { } + PlaceholderDocument(Frame* frame) : Document(frame, false, false) { } }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp index 6b6ce1b..458de68 100644 --- a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp @@ -26,10 +26,12 @@ #include "config.h" #include "ProgressTracker.h" +#include "CString.h" #include "DocumentLoader.h" #include "Frame.h" #include "FrameLoader.h" #include "FrameLoaderClient.h" +#include "Logging.h" #include "ResourceResponse.h" #include @@ -47,7 +49,7 @@ static const double finalProgressValue = 0.9; // 1.0 - initialProgressValue static const int progressItemDefaultEstimatedLength = 1024 * 16; -struct ProgressItem { +struct ProgressItem : Noncopyable { ProgressItem(long long length) : bytesReceived(0) , estimatedLength(length) { } @@ -97,7 +99,7 @@ void ProgressTracker::reset() void ProgressTracker::progressStarted(Frame* frame) { - // LOG (Progress, "frame %p(%@), _private->numProgressTrackedFrames %d, _private->originatingProgressFrame %p", frame, [frame name], _private->numProgressTrackedFrames, _private->originatingProgressFrame); + LOG(Progress, "Progress started (%p) - frame %p(\"%s\"), value %f, tracked frames %d, originating frame %p", this, frame, frame->tree()->name().string().utf8().data(), m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); frame->loader()->client()->willChangeEstimatedProgress(); @@ -115,7 +117,7 @@ void ProgressTracker::progressStarted(Frame* frame) void ProgressTracker::progressCompleted(Frame* frame) { - // LOG (Progress, "frame %p(%@), _private->numProgressTrackedFrames %d, _private->originatingProgressFrame %p", frame, [frame name], _private->numProgressTrackedFrames, _private->originatingProgressFrame); + LOG(Progress, "Progress completed (%p) - frame %p(\"%s\"), value %f, tracked frames %d, originating frame %p", this, frame, frame->tree()->name().string().utf8().data(), m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); if (m_numProgressTrackedFrames <= 0) return; @@ -132,7 +134,7 @@ void ProgressTracker::progressCompleted(Frame* frame) void ProgressTracker::finalProgressComplete() { - // LOG (Progress, ""); + LOG(Progress, "Final progress complete (%p)", this); RefPtr frame = m_originatingProgressFrame.release(); @@ -151,7 +153,7 @@ void ProgressTracker::finalProgressComplete() void ProgressTracker::incrementProgress(unsigned long identifier, const ResourceResponse& response) { - // LOG (Progress, "_private->numProgressTrackedFrames %d, _private->originatingProgressFrame %p", _private->numProgressTrackedFrames, _private->originatingProgressFrame); + LOG(Progress, "Progress incremented (%p) - value %f, tracked frames %d, originating frame %p", this, m_progressValue, m_numProgressTrackedFrames, m_originatingProgressFrame.get()); if (m_numProgressTrackedFrames <= 0) return; @@ -214,7 +216,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i double now = currentTime(); double notifiedProgressTimeDelta = now - m_lastNotifiedProgressTime; - // LOG (Progress, "_private->progressValue %g, _private->numProgressTrackedFrames %d", _private->progressValue, _private->numProgressTrackedFrames); + LOG(Progress, "Progress incremented (%p) - value %f, tracked frames %d", this, m_progressValue, m_numProgressTrackedFrames); double notificationProgressDelta = m_progressValue - m_lastNotifiedProgressValue; if ((notificationProgressDelta >= m_progressNotificationInterval || notifiedProgressTimeDelta >= m_progressNotificationTimeInterval) && diff --git a/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp b/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp index c0d78ae..4b44422 100644 --- a/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp +++ b/src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp @@ -32,18 +32,22 @@ #include "config.h" #include "RedirectScheduler.h" +#include "BackForwardList.h" #include "DocumentLoader.h" #include "Event.h" #include "FormState.h" #include "Frame.h" #include "FrameLoadRequest.h" #include "FrameLoader.h" +#include "HistoryItem.h" #include "HTMLFormElement.h" +#include "HTMLFrameOwnerElement.h" +#include "Page.h" #include namespace WebCore { -struct ScheduledRedirection { +struct ScheduledRedirection : Noncopyable { enum Type { redirection, locationChange, historyNavigation, formSubmission }; const Type type; @@ -171,7 +175,7 @@ bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame) for (Frame* ancestor = targetFrame->tree()->parent(); ancestor; ancestor = ancestor->tree()->parent()) { Document* document = ancestor->document(); - if (!ancestor->loader()->isComplete() || document && document->processingLoadEvent()) + if (!ancestor->loader()->isComplete() || (document && document->processingLoadEvent())) return true; } return false; @@ -217,7 +221,13 @@ void RedirectScheduler::scheduleFormSubmission(const FrameLoadRequest& frameRequ // This may happen when a frame changes the location of another frame. bool duringLoad = !m_frame->loader()->committedFirstRealDocumentLoad(); - schedule(new ScheduledRedirection(frameRequest, lockHistory, mustLockBackForwardList(m_frame), event, formState, duringLoad)); + // If this is a child frame and the form submission was triggered by a script, lock the back/forward list + // to match IE and Opera. + // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. + + bool lockBackForwardList = mustLockBackForwardList(m_frame) || (formState->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent()); + + schedule(new ScheduledRedirection(frameRequest, lockHistory, lockBackForwardList, event, formState, duringLoad)); } void RedirectScheduler::scheduleRefresh(bool wasUserGesture) @@ -257,11 +267,23 @@ void RedirectScheduler::scheduleHistoryNavigation(int steps) // Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled // redirects. We also avoid the possibility of cancelling the current load by avoiding the scheduled redirection altogether. - if (!m_frame->page()->canGoBackOrForward(steps)) { - cancel(); - return; - } - + HistoryItem* specifiedEntry = m_frame->page()->backForwardList()->itemAtIndex(steps); + if (!specifiedEntry) { + cancel(); + return; + } + +#if !ENABLE(HISTORY_ALWAYS_ASYNC) + // If the specified entry and the current entry have the same document, this is either a state object traversal or a fragment + // traversal (or both) and should be performed synchronously. + HistoryItem* currentEntry = m_frame->loader()->history()->currentItem(); + if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) { + m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward); + return; + } +#endif + + // In all other cases, schedule the history traversal to occur asynchronously. schedule(new ScheduledRedirection(steps)); } diff --git a/src/3rdparty/webkit/WebCore/loader/Request.cpp b/src/3rdparty/webkit/WebCore/loader/Request.cpp index 7791a48..630a4bb 100644 --- a/src/3rdparty/webkit/WebCore/loader/Request.cpp +++ b/src/3rdparty/webkit/WebCore/loader/Request.cpp @@ -28,12 +28,12 @@ namespace WebCore { -Request::Request(DocLoader* docLoader, CachedResource* object, bool incremental, bool shouldSkipCanLoadCheck, bool sendResourceLoadCallbacks) +Request::Request(DocLoader* docLoader, CachedResource* object, bool incremental, SecurityCheckPolicy shouldDoSecurityCheck, bool sendResourceLoadCallbacks) : m_object(object) , m_docLoader(docLoader) , m_incremental(incremental) , m_multipart(false) - , m_shouldSkipCanLoadCheck(shouldSkipCanLoadCheck) + , m_shouldDoSecurityCheck(shouldDoSecurityCheck) , m_sendResourceLoadCallbacks(sendResourceLoadCallbacks) { m_object->setRequest(this); diff --git a/src/3rdparty/webkit/WebCore/loader/Request.h b/src/3rdparty/webkit/WebCore/loader/Request.h index 07d1b82..468f8ff 100644 --- a/src/3rdparty/webkit/WebCore/loader/Request.h +++ b/src/3rdparty/webkit/WebCore/loader/Request.h @@ -23,6 +23,7 @@ #ifndef Request_h #define Request_h +#include "FrameLoaderTypes.h" #include namespace WebCore { @@ -30,9 +31,9 @@ namespace WebCore { class CachedResource; class DocLoader; - class Request { + class Request : public Noncopyable { public: - Request(DocLoader*, CachedResource*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks); + Request(DocLoader*, CachedResource*, bool incremental, SecurityCheckPolicy, bool sendResourceLoadCallbacks); ~Request(); Vector& buffer() { return m_buffer; } @@ -45,7 +46,7 @@ namespace WebCore { bool isMultipart() { return m_multipart; } void setIsMultipart(bool b = true) { m_multipart = b; } - bool shouldSkipCanLoadCheck() const { return m_shouldSkipCanLoadCheck; } + SecurityCheckPolicy shouldDoSecurityCheck() const { return m_shouldDoSecurityCheck; } bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; } private: @@ -54,7 +55,7 @@ namespace WebCore { DocLoader* m_docLoader; bool m_incremental; bool m_multipart; - bool m_shouldSkipCanLoadCheck; + SecurityCheckPolicy m_shouldDoSecurityCheck; bool m_sendResourceLoadCallbacks; }; diff --git a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp index 4cddd01..9280434 100644 --- a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp @@ -96,6 +96,11 @@ void ResourceLoadNotifier::didFailToLoad(ResourceLoader* loader, const ResourceE if (!error.isNull()) m_frame->loader()->client()->dispatchDidFailLoading(loader->documentLoader(), loader->identifier(), error); + +#if ENABLE(INSPECTOR) + if (Page* page = m_frame->page()) + page->inspectorController()->didFailLoading(loader->identifier(), error); +#endif } void ResourceLoadNotifier::didLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) @@ -126,7 +131,7 @@ void ResourceLoadNotifier::dispatchWillSendRequest(DocumentLoader* loader, unsig #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) - page->inspectorController()->willSendRequest(loader, identifier, request, redirectResponse); + page->inspectorController()->willSendRequest(identifier, request, redirectResponse); #endif } @@ -136,7 +141,7 @@ void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, un #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) - page->inspectorController()->didReceiveResponse(loader, identifier, r); + page->inspectorController()->didReceiveResponse(identifier, r); #endif } @@ -146,7 +151,7 @@ void ResourceLoadNotifier::dispatchDidReceiveContentLength(DocumentLoader* loade #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) - page->inspectorController()->didReceiveContentLength(loader, identifier, length); + page->inspectorController()->didReceiveContentLength(identifier, length); #endif } @@ -156,7 +161,7 @@ void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsi #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) - page->inspectorController()->didFinishLoading(loader, identifier); + page->inspectorController()->didFinishLoading(identifier); #endif } diff --git a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h index b09d7be..23e4246 100644 --- a/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h +++ b/src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h @@ -41,7 +41,7 @@ class ResourceError; class ResourceLoader; class ResourceResponse; class ScriptString; -struct ResourceRequest; +class ResourceRequest; class ResourceLoadNotifier : public Noncopyable { public: diff --git a/src/3rdparty/webkit/WebCore/loader/ResourceLoader.cpp b/src/3rdparty/webkit/WebCore/loader/ResourceLoader.cpp index 9244cf0..afa8ad2 100644 --- a/src/3rdparty/webkit/WebCore/loader/ResourceLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ResourceLoader.cpp @@ -318,7 +318,7 @@ void ResourceLoader::didCancel(const ResourceError& error) // load itself to be cancelled (which could happen with a javascript that // changes the window location). This is used to prevent both the body // of this method and the body of connectionDidFinishLoading: running - // for a single delegate. Cancelling wins. + // for a single delegate. Canceling wins. m_cancelled = true; if (m_handle) diff --git a/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.cpp b/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.cpp index 2ee4626..f92a074 100644 --- a/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.cpp @@ -61,18 +61,18 @@ SubresourceLoader::~SubresourceLoader() #endif } -PassRefPtr SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, bool skipCanLoadCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff) +PassRefPtr SubresourceLoader::create(Frame* frame, SubresourceLoaderClient* client, const ResourceRequest& request, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks, bool shouldContentSniff) { if (!frame) return 0; FrameLoader* fl = frame->loader(); - if (!skipCanLoadCheck && (fl->state() == FrameStateProvisional || fl->activeDocumentLoader()->isStopping())) + if (securityCheck == DoSecurityCheck && (fl->state() == FrameStateProvisional || fl->activeDocumentLoader()->isStopping())) return 0; ResourceRequest newRequest = request; - if (!skipCanLoadCheck + if (securityCheck == DoSecurityCheck && SecurityOrigin::restrictAccessToLocal() && !SecurityOrigin::canLoad(request.url(), String(), frame->document())) { FrameLoader::reportLocalLoadFailed(frame, request.url().string()); diff --git a/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.h b/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.h index 0fce930..907d917 100644 --- a/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/SubresourceLoader.h @@ -28,17 +28,18 @@ #ifndef SubresourceLoader_h #define SubresourceLoader_h - + +#include "FrameLoaderTypes.h" #include "ResourceLoader.h" namespace WebCore { - struct ResourceRequest; + class ResourceRequest; class SubresourceLoaderClient; class SubresourceLoader : public ResourceLoader { public: - static PassRefPtr create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true); + static PassRefPtr create(Frame*, SubresourceLoaderClient*, const ResourceRequest&, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true, bool shouldContentSniff = true); void clearClient() { m_client = 0; } diff --git a/src/3rdparty/webkit/WebCore/loader/SubresourceLoaderClient.h b/src/3rdparty/webkit/WebCore/loader/SubresourceLoaderClient.h index acf8e6a..76fde47 100644 --- a/src/3rdparty/webkit/WebCore/loader/SubresourceLoaderClient.h +++ b/src/3rdparty/webkit/WebCore/loader/SubresourceLoaderClient.h @@ -33,7 +33,7 @@ namespace WebCore { class AuthenticationChallenge; class ResourceError; -struct ResourceRequest; +class ResourceRequest; class ResourceResponse; class SubresourceLoader; diff --git a/src/3rdparty/webkit/WebCore/loader/ThreadableLoader.h b/src/3rdparty/webkit/WebCore/loader/ThreadableLoader.h index a52bfad..f41a774 100644 --- a/src/3rdparty/webkit/WebCore/loader/ThreadableLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/ThreadableLoader.h @@ -38,7 +38,7 @@ namespace WebCore { class ResourceError; - struct ResourceRequest; + class ResourceRequest; class ResourceResponse; class ScriptExecutionContext; class ThreadableLoaderClient; diff --git a/src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClient.h b/src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClient.h index 93a8e86..b8a6584 100644 --- a/src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClient.h +++ b/src/3rdparty/webkit/WebCore/loader/ThreadableLoaderClient.h @@ -36,7 +36,7 @@ namespace WebCore { class ResourceError; class ResourceResponse; - class ThreadableLoaderClient { + class ThreadableLoaderClient : public Noncopyable { public: virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } diff --git a/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.cpp b/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.cpp index bd362f4..6837ca1 100644 --- a/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009, 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -147,7 +147,7 @@ void WorkerThreadableLoader::MainThreadBridge::mainThreadCancel(ScriptExecutionC void WorkerThreadableLoader::MainThreadBridge::cancel() { m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCancel, this)); - ThreadableLoaderClientWrapper* clientWrapper = static_cast(m_workerClientWrapper.get()); + ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get(); if (!clientWrapper->done()) { // If the client hasn't reached a termination state, then transition it by sending a cancellation error. // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that. @@ -160,7 +160,7 @@ void WorkerThreadableLoader::MainThreadBridge::cancel() void WorkerThreadableLoader::MainThreadBridge::clearClientWrapper() { - static_cast(m_workerClientWrapper.get())->clearClient(); + m_workerClientWrapper->clearClient(); } static void workerContextDidSendData(ScriptExecutionContext* context, RefPtr workerClientWrapper, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) diff --git a/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.h b/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.h index 230c77d..09f8f85 100644 --- a/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.h +++ b/src/3rdparty/webkit/WebCore/loader/WorkerThreadableLoader.h @@ -47,7 +47,7 @@ namespace WebCore { class ResourceError; - struct ResourceRequest; + class ResourceRequest; class WorkerContext; class WorkerLoaderProxy; struct CrossThreadResourceResponseData; @@ -82,7 +82,7 @@ namespace WebCore { // // all cases. All tasks posted from the worker context's thread are ok because // the last task posted always is "mainThreadDestroy", so MainThreadBridge is - // around for all tasks that use it on the mian thread. + // around for all tasks that use it on the main thread. // // case 1. worker.terminate is called. // In this case, no more tasks are posted from the worker object's thread to the worker @@ -94,7 +94,7 @@ namespace WebCore { // thread do "ThreadableLoaderClientWrapper::ref" (automatically inside of the cross thread copy // done in createCallbackTask), so the ThreadableLoaderClientWrapper instance is there until all // tasks are executed. - class MainThreadBridge : ThreadableLoaderClient { + class MainThreadBridge : public ThreadableLoaderClient { public: // All executed on the worker context's thread. MainThreadBridge(PassRefPtr, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); @@ -124,7 +124,7 @@ namespace WebCore { // ThreadableLoaderClientWrapper is to be used on the worker context thread. // The ref counting is done on either thread. - RefPtr > m_workerClientWrapper; + RefPtr m_workerClientWrapper; // May be used on either thread. WorkerLoaderProxy& m_loaderProxy; diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.h b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.h index d1444c0..08e2dd3 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.h +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCache.h @@ -42,7 +42,7 @@ class ApplicationCacheResource; class DocumentLoader; class KURL; -struct ResourceRequest; +class ResourceRequest; typedef Vector > FallbackURLVector; diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp index c66f36f..c424895 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -32,6 +32,7 @@ #include "ApplicationCacheHost.h" #include "ApplicationCacheResource.h" #include "ApplicationCacheStorage.h" +#include "Chrome.h" #include "ChromeClient.h" #include "DocumentLoader.h" #include "DOMApplicationCache.h" @@ -622,7 +623,7 @@ void ApplicationCacheGroup::didFinishLoadingManifest() ASSERT(newestManifest); if (!m_manifestResource || // The resource will be null if HTTP response was 304 Not Modified. - newestManifest->data()->size() == m_manifestResource->data()->size() && !memcmp(newestManifest->data()->data(), m_manifestResource->data()->data(), newestManifest->data()->size())) { + (newestManifest->data()->size() == m_manifestResource->data()->size() && !memcmp(newestManifest->data()->data(), m_manifestResource->data()->data(), newestManifest->data()->size()))) { m_completionType = NoUpdate; m_manifestResource = 0; @@ -947,9 +948,9 @@ void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback() class CallCacheListenerTask : public ScriptExecutionContext::Task { public: - static PassRefPtr create(PassRefPtr loader, ApplicationCacheHost::EventID eventID) + static PassOwnPtr create(PassRefPtr loader, ApplicationCacheHost::EventID eventID) { - return adoptRef(new CallCacheListenerTask(loader, eventID)); + return new CallCacheListenerTask(loader, eventID); } virtual void performTask(ScriptExecutionContext* context) diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp index 751efc1..fc98746 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp @@ -46,6 +46,7 @@ namespace WebCore { ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader) : m_domApplicationCache(0) , m_documentLoader(documentLoader) + , m_defersEvents(true) , m_candidateApplicationCacheGroup(0) { ASSERT(m_documentLoader); @@ -229,6 +230,11 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic void ApplicationCacheHost::notifyDOMApplicationCache(EventID id) { + if (m_defersEvents) { + // Events are deferred until document.onload has fired. + m_deferredEvents.append(id); + return; + } if (m_domApplicationCache) { ExceptionCode ec = 0; m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); @@ -236,6 +242,21 @@ void ApplicationCacheHost::notifyDOMApplicationCache(EventID id) } } +void ApplicationCacheHost::stopDeferringEvents() +{ + RefPtr protect(documentLoader()); + for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { + EventID id = m_deferredEvents[i]; + if (m_domApplicationCache) { + ExceptionCode ec = 0; + m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); + ASSERT(!ec); + } + } + m_deferredEvents.clear(); + m_defersEvents = false; +} + void ApplicationCacheHost::setCandidateApplicationCacheGroup(ApplicationCacheGroup* group) { ASSERT(!m_applicationCache); diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h index 236013d..52d4d40 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h @@ -33,6 +33,7 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) +#include #include #include #include @@ -45,7 +46,7 @@ namespace WebCore { class KURL; class ResourceLoader; class ResourceError; - struct ResourceRequest; + class ResourceRequest; class ResourceResponse; class SubstituteData; #if PLATFORM(CHROMIUM) @@ -57,7 +58,7 @@ namespace WebCore { class ApplicationCacheStorage; #endif - class ApplicationCacheHost { + class ApplicationCacheHost : public Noncopyable { public: // The Status numeric values are specified in the HTML5 spec. enum Status { @@ -110,12 +111,16 @@ namespace WebCore { void setDOMApplicationCache(DOMApplicationCache* domApplicationCache); void notifyDOMApplicationCache(EventID id); + void stopDeferringEvents(); // Also raises the events that have been queued up. + private: bool isApplicationCacheEnabled(); DocumentLoader* documentLoader() { return m_documentLoader; } DOMApplicationCache* m_domApplicationCache; DocumentLoader* m_documentLoader; + bool m_defersEvents; // Events are deferred until after document onload. + Vector m_deferredEvents; #if PLATFORM(CHROMIUM) friend class ApplicationCacheHostInternal; diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.cpp index d6ee723..1e97d78 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -405,7 +405,7 @@ int64_t ApplicationCacheStorage::spaceNeeded(int64_t cacheToSave) totalAvailableSize = (m_maximumSize - currentSize) + m_database.freeSpaceSize(); } - // The space needed to be freed in order to accomodate the failed cache is + // The space needed to be freed in order to accommodate the failed cache is // the size of the failed cache minus any already available free space. spaceNeeded = cacheToSave - totalAvailableSize; // The space needed value must be positive (or else the total already diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.h b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.h index 1348aa9..aaa5c9c 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -44,7 +44,7 @@ class KURL; template class StorageIDJournal; -class ApplicationCacheStorage { +class ApplicationCacheStorage : public Noncopyable { public: void setCacheDirectory(const String&); const String& cacheDirectory() const; diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp index 29c1bd5..b9297b1 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp +++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp @@ -42,7 +42,6 @@ namespace WebCore { DOMApplicationCache::DOMApplicationCache(Frame* frame) : m_frame(frame) { - ASSERT(!m_frame || applicationCacheHost()); ApplicationCacheHost* cacheHost = applicationCacheHost(); if (cacheHost) cacheHost->setDOMApplicationCache(this); @@ -87,8 +86,9 @@ void DOMApplicationCache::swapCache(ExceptionCode& ec) ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const { - ASSERT(m_frame); - return m_frame->document(); + if (m_frame) + return m_frame->document(); + return 0; } const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::EventID id) diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl index dd5468a..9c3a359 100644 --- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl +++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl @@ -27,7 +27,8 @@ module offline { interface [ Conditional=OFFLINE_WEB_APPLICATIONS, - EventTarget + EventTarget, + OmitConstructor ] DOMApplicationCache { // update status const unsigned short UNCACHED = 0; diff --git a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp index 1322dbb..d09b064 100644 --- a/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp +++ b/src/3rdparty/webkit/WebCore/loader/archive/ArchiveFactory.cpp @@ -29,12 +29,13 @@ #include "config.h" #include "ArchiveFactory.h" -#if PLATFORM(CF) -#include "LegacyWebArchive.h" -#endif #include "MIMETypeRegistry.h" #include "PlatformString.h" +#if PLATFORM(CF) && !PLATFORM(QT) +#include "LegacyWebArchive.h" +#endif + #include #include #include @@ -55,14 +56,14 @@ static ArchiveMIMETypesMap& archiveMIMETypes() { DEFINE_STATIC_LOCAL(ArchiveMIMETypesMap, mimeTypes, ()); static bool initialized = false; - + if (initialized) return mimeTypes; - -#if PLATFORM(CF) + +#if PLATFORM(CF) && !PLATFORM(QT) mimeTypes.set("application/x-webarchive", archiveFactoryCreate); #endif - + initialized = true; return mimeTypes; } diff --git a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseClient.h b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseClient.h index 8806406..1811214 100644 --- a/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseClient.h +++ b/src/3rdparty/webkit/WebCore/loader/icon/IconDatabaseClient.h @@ -29,6 +29,8 @@ #ifndef IconDatabaseClient_h #define IconDatabaseClient_h +#include + // All of these client methods will be called from a non-main thread // Take appropriate measures @@ -36,7 +38,7 @@ namespace WebCore { class String; -class IconDatabaseClient { +class IconDatabaseClient : public Noncopyable { public: virtual ~IconDatabaseClient() { } virtual bool performImport() { return true; } diff --git a/src/3rdparty/webkit/WebCore/loader/loader.cpp b/src/3rdparty/webkit/WebCore/loader/loader.cpp index 0b6dff1..4d2b474 100644 --- a/src/3rdparty/webkit/WebCore/loader/loader.cpp +++ b/src/3rdparty/webkit/WebCore/loader/loader.cpp @@ -61,7 +61,9 @@ Loader::Loader() , m_isSuspendingPendingRequests(false) { m_nonHTTPProtocolHost = Host::create(AtomicString(), maxRequestsInFlightForNonHTTPProtocols); +#if REQUEST_MANAGEMENT_ENABLED maxRequestsInFlightPerHost = initializeMaximumHTTPConnectionCountPerHost(); +#endif } Loader::~Loader() @@ -69,6 +71,27 @@ Loader::~Loader() ASSERT_NOT_REACHED(); } +static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource::Type type) +{ + switch (type) { + case CachedResource::CSSStyleSheet: +#if ENABLE(XSLT) + case CachedResource::XSLStyleSheet: +#endif +#if ENABLE(XBL) + case CachedResource::XBL: +#endif + return ResourceRequest::TargetIsStyleSheet; + case CachedResource::Script: + return ResourceRequest::TargetIsScript; + case CachedResource::FontResource: + return ResourceRequest::TargetIsFontResource; + case CachedResource::ImageResource: + return ResourceRequest::TargetIsImage; + } + return ResourceRequest::TargetIsSubresource; +} + Loader::Priority Loader::determinePriority(const CachedResource* resource) const { #if REQUEST_MANAGEMENT_ENABLED @@ -94,14 +117,15 @@ Loader::Priority Loader::determinePriority(const CachedResource* resource) const #endif } -void Loader::load(DocLoader* docLoader, CachedResource* resource, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks) +void Loader::load(DocLoader* docLoader, CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks) { ASSERT(docLoader); - Request* request = new Request(docLoader, resource, incremental, skipCanLoadCheck, sendResourceLoadCallbacks); + Request* request = new Request(docLoader, resource, incremental, securityCheck, sendResourceLoadCallbacks); RefPtr host; KURL url(ParsedURLString, resource->url()); if (url.protocolInHTTPFamily()) { + m_hosts.checkConsistency(); AtomicString hostName = url.host(); host = m_hosts.get(hostName.impl()); if (!host) { @@ -146,6 +170,7 @@ void Loader::servePendingRequests(Priority minimumPriority) m_nonHTTPProtocolHost->servePendingRequests(minimumPriority); Vector hostsToServe; + m_hosts.checkConsistency(); HostMap::iterator i = m_hosts.begin(); HostMap::iterator end = m_hosts.end(); for (;i != end; ++i) @@ -182,6 +207,7 @@ void Loader::nonCacheRequestInFlight(const KURL& url) return; AtomicString hostName = url.host(); + m_hosts.checkConsistency(); RefPtr host = m_hosts.get(hostName.impl()); if (!host) { host = Host::create(hostName, maxRequestsInFlightPerHost); @@ -197,6 +223,7 @@ void Loader::nonCacheRequestComplete(const KURL& url) return; AtomicString hostName = url.host(); + m_hosts.checkConsistency(); RefPtr host = m_hosts.get(hostName.impl()); ASSERT(host); if (!host) @@ -213,6 +240,7 @@ void Loader::cancelRequests(DocLoader* docLoader) m_nonHTTPProtocolHost->cancelRequests(docLoader); Vector hostsToCancel; + m_hosts.checkConsistency(); HostMap::iterator i = m_hosts.begin(); HostMap::iterator end = m_hosts.end(); for (;i != end; ++i) @@ -294,11 +322,13 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser bool shouldLimitRequests = !m_name.isNull() || docLoader->doc()->parsing() || !docLoader->doc()->haveStylesheetsLoaded(); if (shouldLimitRequests && m_requestsLoading.size() + m_nonCachedRequestsInFlight >= m_maxRequestsInFlight) { serveLowerPriority = false; + cache()->loader()->scheduleServePendingRequests(); return; } requestsPending.removeFirst(); ResourceRequest resourceRequest(request->cachedResource()->url()); + resourceRequest.setTargetType(cachedResourceTypeToTargetType(request->cachedResource()->type())); if (!request->cachedResource()->accept().isEmpty()) resourceRequest.setHTTPAccept(request->cachedResource()->accept()); @@ -323,7 +353,7 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser } RefPtr loader = SubresourceLoader::create(docLoader->doc()->frame(), - this, resourceRequest, request->shouldSkipCanLoadCheck(), request->sendResourceLoadCallbacks()); + this, resourceRequest, request->shouldDoSecurityCheck(), request->sendResourceLoadCallbacks()); if (loader) { m_requestsLoading.add(loader.release(), request); request->cachedResource()->setRequestedFromNetworkingLayer(); @@ -375,7 +405,7 @@ void Loader::Host::didFinishLoading(SubresourceLoader* loader) docLoader->checkForPendingPreloads(); #if REQUEST_DEBUG - KURL u(resource->url()); + KURL u(ParsedURLString, resource->url()); printf("HOST %s COUNT %d RECEIVED %s\n", u.host().latin1().data(), m_requestsLoading.size(), resource->url().latin1().data()); #endif servePendingRequests(); diff --git a/src/3rdparty/webkit/WebCore/loader/loader.h b/src/3rdparty/webkit/WebCore/loader/loader.h index d0a526f..a9de032 100644 --- a/src/3rdparty/webkit/WebCore/loader/loader.h +++ b/src/3rdparty/webkit/WebCore/loader/loader.h @@ -24,6 +24,7 @@ #include "AtomicString.h" #include "AtomicStringImpl.h" +#include "FrameLoaderTypes.h" #include "PlatformString.h" #include "SubresourceLoaderClient.h" #include "Timer.h" @@ -43,7 +44,7 @@ namespace WebCore { Loader(); ~Loader(); - void load(DocLoader*, CachedResource*, bool incremental = true, bool skipCanLoadCheck = false, bool sendResourceLoadCallbacks = true); + void load(DocLoader*, CachedResource*, bool incremental = true, SecurityCheckPolicy = DoSecurityCheck, bool sendResourceLoadCallbacks = true); void cancelRequests(DocLoader*); diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp index 14febe5..b47f4a9 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.cpp @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h index b00af47..2fa322f 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLElement.h @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MathMLElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp index 2bb02f6..019c4ce 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.cpp @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -25,7 +30,7 @@ #include "MathMLInlineContainerElement.h" #include "MathMLNames.h" -#include "RenderObject.h" +#include "RenderMathMLBlock.h" namespace WebCore { @@ -41,10 +46,12 @@ PassRefPtr MathMLInlineContainerElement::create(co return new MathMLInlineContainerElement(tagName, document); } -RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *, RenderStyle* style) +RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena *arena, RenderStyle* style) { // FIXME: This method will contain the specialized renderers based on element name - return RenderObject::createObject(this, style); + RenderObject* object = new (arena) RenderMathMLBlock(this); + object->setStyle(style); + return object; } diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h index 4529d3b..dc78dc4 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLInlineContainerElement.h @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MathMLInlineContainerElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp index 8b083f4..bd3b797 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.cpp @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h index f363cd2..e784524 100644 --- a/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLMathElement.h @@ -1,21 +1,26 @@ /* - * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. - * - * 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; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - * + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MathMLMathElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp b/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp new file mode 100644 index 0000000..11d46c4 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "MathMLTextElement.h" + +#include "MathMLNames.h" +#include "RenderObject.h" + +namespace WebCore { + +using namespace MathMLNames; + +MathMLTextElement::MathMLTextElement(const QualifiedName& tagName, Document* document) + : MathMLElement(tagName, document) +{ +} + +PassRefPtr MathMLTextElement::create(const QualifiedName& tagName, Document* document) +{ + return new MathMLTextElement(tagName, document); +} + +RenderObject* MathMLTextElement::createRenderer(RenderArena* , RenderStyle* style) +{ + return RenderObject::createObject(this, style); +} + + +} + +#endif // ENABLE(MATHML) + diff --git a/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h b/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h new file mode 100644 index 0000000..e647bfa --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/MathMLTextElement.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef MathMLTextElement_h +#define MathMLTextElement_h + +#if ENABLE(MATHML) +#include "MathMLElement.h" + +namespace WebCore { + +class MathMLTextElement : public MathMLElement { +public: + static PassRefPtr create(const QualifiedName& tagName, Document*); + + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + +protected: + MathMLTextElement(const QualifiedName& tagName, Document*); + +}; + +} + +#endif // ENABLE(MATHML) +#endif // MathMLTextElement_h diff --git a/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp b/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp new file mode 100644 index 0000000..a897ff5 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(MATHML) + +#include "RenderMathMLBlock.h" + +#include "FontSelector.h" +#include "GraphicsContext.h" +#include "MathMLNames.h" +#include "RenderInline.h" +#include "RenderText.h" + +namespace WebCore { + +using namespace MathMLNames; + +RenderMathMLBlock::RenderMathMLBlock(Node* container) + : RenderBlock(container) +{ +} + +bool RenderMathMLBlock::isChildAllowed(RenderObject* child, RenderStyle*) const +{ + return child->node() && child->node()->nodeType() == Node::ELEMENT_NODE; +} + +PassRefPtr RenderMathMLBlock::makeBlockStyle() +{ + RefPtr newStyle = RenderStyle::create(); + newStyle->inheritFrom(style()); + newStyle->setDisplay(BLOCK); + return newStyle; +} + +int RenderMathMLBlock::nonOperatorHeight() const +{ + if (!isRenderMathMLOperator()) + return offsetHeight(); + + return 0; +} + +void RenderMathMLBlock::stretchToHeight(int height) +{ + for (RenderObject* current = firstChild(); current; current = current->nextSibling()) + if (current->isRenderMathMLBlock()) { + RenderMathMLBlock* block = toRenderMathMLBlock(current); + block->stretchToHeight(height); + } +} + +#if ENABLE(DEBUG_MATH_LAYOUT) +void RenderMathMLBlock::paint(PaintInfo& info, int tx, int ty) +{ + RenderBlock::paint(info, tx, ty); + + if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground) + return; + + tx += x(); + ty += y(); + + info.context->save(); + + info.context->setStrokeThickness(1.0f); + info.context->setStrokeStyle(SolidStroke); + info.context->setStrokeColor(Color(0, 0, 255), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx + offsetWidth(), ty)); + info.context->drawLine(IntPoint(tx + offsetWidth(), ty), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty + offsetHeight()), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx, ty + offsetHeight())); + + int baseline = baselinePosition(true); + + info.context->setStrokeColor(Color(255, 0, 0), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty + baseline), IntPoint(tx + offsetWidth(), ty + baseline)); + + info.context->restore(); + +} +#endif // ENABLE(DEBUG_MATH_LAYOUT) + + +} + +#endif diff --git a/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h b/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h new file mode 100644 index 0000000..e01a325 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/RenderMathMLBlock.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Alex Milowski (alex@milowski.com). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RenderMathMLBlock_h +#define RenderMathMLBlock_h + +#if ENABLE(MATHML) + +#include "RenderBlock.h" + +#define ENABLE_DEBUG_MATH_LAYOUT 0 + +namespace WebCore { + +class RenderMathMLBlock : public RenderBlock { +public: + RenderMathMLBlock(Node* container); + virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; + + virtual bool isRenderMathMLBlock() const { return true; } + virtual bool isRenderMathMLOperator() const { return false; } + virtual bool isRenderMathMLRow() const { return false; } + virtual bool isRenderMathMLMath() const { return false; } + virtual bool hasBase() const { return false; } + virtual int nonOperatorHeight() const; + virtual void stretchToHeight(int height); + +#if ENABLE(DEBUG_MATH_LAYOUT) + virtual void paint(PaintInfo&, int tx, int ty); +#endif + +protected: + virtual PassRefPtr makeBlockStyle(); + +}; + +inline RenderMathMLBlock* toRenderMathMLBlock(RenderObject* object) +{ + ASSERT(!object || object->isRenderMathMLBlock()); + return static_cast(object); +} + +inline const RenderMathMLBlock* toRenderMathMLBlock(const RenderObject* object) +{ + ASSERT(!object || object->isRenderMathMLBlock()); + return static_cast(object); +} + +} + + +#endif // ENABLE(MATHML) +#endif // RenderMathMLBlock_h diff --git a/src/3rdparty/webkit/WebCore/mathml/mathattrs.in b/src/3rdparty/webkit/WebCore/mathml/mathattrs.in new file mode 100644 index 0000000..df2329a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/mathml/mathattrs.in @@ -0,0 +1,13 @@ +namespace="MathML" +namespaceURI="http://www.w3.org/1998/Math/MathML" +guardFactoryWith="ENABLE(MATHML)" +attrsNullNamespace + +close +denomalign +linethickness +mathsize +numalign +open +separators +stretchy diff --git a/src/3rdparty/webkit/WebCore/mathml/mathtags.in b/src/3rdparty/webkit/WebCore/mathml/mathtags.in index 8704dbf..c853fca 100644 --- a/src/3rdparty/webkit/WebCore/mathml/mathtags.in +++ b/src/3rdparty/webkit/WebCore/mathml/mathtags.in @@ -1,7 +1,6 @@ namespace="MathML" namespaceURI="http://www.w3.org/1998/Math/MathML" guardFactoryWith="ENABLE(MATHML)" -exportStrings math mfrac interfaceName=MathMLInlineContainerElement diff --git a/src/3rdparty/webkit/WebCore/notifications/Notification.cpp b/src/3rdparty/webkit/WebCore/notifications/Notification.cpp index 8dd168f..ed30800 100644 --- a/src/3rdparty/webkit/WebCore/notifications/Notification.cpp +++ b/src/3rdparty/webkit/WebCore/notifications/Notification.cpp @@ -38,7 +38,7 @@ #include "Document.h" #include "EventNames.h" -#include "WorkerContext.h" +#include "WorkerContext.h" namespace WebCore { @@ -48,7 +48,9 @@ Notification::Notification(const String& url, ScriptExecutionContext* context, E , m_isShowing(false) , m_presenter(provider) { - if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) { + ASSERT(m_presenter); + Document* document = context->isDocument() ? static_cast(context) : 0; + if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) { ec = SECURITY_ERR; return; } @@ -67,11 +69,13 @@ Notification::Notification(const NotificationContents& contents, ScriptExecution , m_isShowing(false) , m_presenter(provider) { - if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PermissionAllowed) { + ASSERT(m_presenter); + Document* document = context->isDocument() ? static_cast(context) : 0; + if (m_presenter->checkPermission(context->url(), document) != NotificationPresenter::PermissionAllowed) { ec = SECURITY_ERR; return; } - + KURL icon = context->completeURL(contents.icon()); if (!icon.isEmpty() && !icon.isValid()) { ec = SYNTAX_ERR; diff --git a/src/3rdparty/webkit/WebCore/notifications/Notification.idl b/src/3rdparty/webkit/WebCore/notifications/Notification.idl index ec6a9c8..b17546a 100644 --- a/src/3rdparty/webkit/WebCore/notifications/Notification.idl +++ b/src/3rdparty/webkit/WebCore/notifications/Notification.idl @@ -32,7 +32,8 @@ module threads { interface [ Conditional=NOTIFICATIONS, - EventTarget + EventTarget, + OmitConstructor ] Notification { void show(); void cancel(); diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp index 69b0075..ad9fbec 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.cpp @@ -40,32 +40,24 @@ namespace WebCore { -#if USE(V8) -static bool notificationCenterAvailable = false; - -void NotificationCenter::setIsAvailable(bool available) -{ - notificationCenterAvailable = available; -} - -bool NotificationCenter::isAvailable() -{ - return notificationCenterAvailable; -} -#endif - -NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter) +NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter) : ActiveDOMObject(context, this) , m_scriptExecutionContext(context) , m_notificationPresenter(presenter) {} -int NotificationCenter::checkPermission() +int NotificationCenter::checkPermission() { - return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin()); + if (!presenter()) + return NotificationPresenter::PermissionDenied; + return m_notificationPresenter->checkPermission( + m_scriptExecutionContext->url(), + m_scriptExecutionContext->isDocument() ? static_cast(m_scriptExecutionContext) : 0); } void NotificationCenter::requestPermission(PassRefPtr callback) { + if (!presenter()) + return; m_notificationPresenter->requestPermission(m_scriptExecutionContext->securityOrigin(), callback); } diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h index 1084442..ae3dc02 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.h @@ -47,19 +47,23 @@ namespace WebCore { class NotificationCenter : public RefCounted, public ActiveDOMObject { public: -#if USE(V8) - static void setIsAvailable(bool); - static bool isAvailable(); -#endif static PassRefPtr create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } Notification* createHTMLNotification(const String& URI, ExceptionCode& ec) { + if (!presenter()) { + ec = INVALID_STATE_ERR; + return 0; + } return Notification::create(KURL(ParsedURLString, URI), context(), ec, presenter()); } Notification* createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) { + if (!presenter()) { + ec = INVALID_STATE_ERR; + return 0; + } NotificationContents contents(iconURI, title, body); return Notification::create(contents, context(), ec, presenter()); } @@ -70,6 +74,8 @@ namespace WebCore { int checkPermission(); void requestPermission(PassRefPtr callback); + void disconnectFrame() { m_notificationPresenter = 0; } + private: NotificationCenter(ScriptExecutionContext*, NotificationPresenter*); diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.idl b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.idl index 3f6e369..86420b8 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.idl +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationCenter.idl @@ -31,7 +31,8 @@ module threads { interface [ - Conditional=NOTIFICATIONS + Conditional=NOTIFICATIONS, + OmitConstructor ] NotificationCenter { [V8Custom] Notification createHTMLNotification(in DOMString url) raises(Exception); [V8Custom] Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) raises(Exception); diff --git a/src/3rdparty/webkit/WebCore/notifications/NotificationPresenter.h b/src/3rdparty/webkit/WebCore/notifications/NotificationPresenter.h index d70a3e9..3df03bb 100644 --- a/src/3rdparty/webkit/WebCore/notifications/NotificationPresenter.h +++ b/src/3rdparty/webkit/WebCore/notifications/NotificationPresenter.h @@ -38,39 +38,43 @@ namespace WebCore { + class Document; class Notification; + class KURL; class SecurityOrigin; class String; - + class NotificationPresenter { public: - enum Permission { - PermissionAllowed, // User has allowed notifications - PermissionNotAllowed, // User has not yet allowed - PermissionDenied // User has explictly denied permission + enum Permission { + PermissionAllowed, // User has allowed notifications + PermissionNotAllowed, // User has not yet allowed + PermissionDenied // User has explicitly denied permission }; virtual ~NotificationPresenter() {} // Requests that a notification be shown. - virtual bool show(Notification* object) = 0; + virtual bool show(Notification*) = 0; // Requests that a notification that has already been shown be canceled. - virtual void cancel(Notification* object) = 0; + virtual void cancel(Notification*) = 0; - // Informs the presenter that a Notification object has been destroyed + // Informs the presenter that a Notification object has been destroyed // (such as by a page transition). The presenter may continue showing // the notification, but must not attempt to call the event handlers. - virtual void notificationObjectDestroyed(Notification* object) = 0; + virtual void notificationObjectDestroyed(Notification*) = 0; // Requests user permission to show desktop notifications from a particular - // origin. The callback parameter should be run when the user has + // origin. The callback parameter should be run when the user has // made a decision. - virtual void requestPermission(SecurityOrigin* origin, PassRefPtr callback) = 0; + virtual void requestPermission(SecurityOrigin*, PassRefPtr) = 0; - // Checks the current level of permission. - virtual Permission checkPermission(SecurityOrigin* origin) = 0; + // Checks the current level of permission for the specified URL. If the + // URL is a document (as opposed to a worker or other ScriptExecutionContext), + // |document| will also be provided. + virtual Permission checkPermission(const KURL&, Document*) = 0; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/AbstractView.idl b/src/3rdparty/webkit/WebCore/page/AbstractView.idl index 36865de..290bf48 100644 --- a/src/3rdparty/webkit/WebCore/page/AbstractView.idl +++ b/src/3rdparty/webkit/WebCore/page/AbstractView.idl @@ -28,7 +28,8 @@ module views { // Introduced in DOM Level 2: interface [ - ObjCCustomImplementation + ObjCCustomImplementation, + OmitConstructor ] AbstractView { readonly attribute Document document; readonly attribute Media media; diff --git a/src/3rdparty/webkit/WebCore/page/BarInfo.cpp b/src/3rdparty/webkit/WebCore/page/BarInfo.cpp index 0f6cad5..b6ab686 100644 --- a/src/3rdparty/webkit/WebCore/page/BarInfo.cpp +++ b/src/3rdparty/webkit/WebCore/page/BarInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,23 +60,25 @@ bool BarInfo::visible() const { if (!m_frame) return false; + Page* page = m_frame->page(); + if (!page) + return false; switch (m_type) { case Locationbar: - return m_frame->page()->chrome()->toolbarsVisible(); - case Toolbar: - return m_frame->page()->chrome()->toolbarsVisible(); case Personalbar: - return m_frame->page()->chrome()->toolbarsVisible(); + case Toolbar: + return page->chrome()->toolbarsVisible(); case Menubar: - return m_frame->page()->chrome()->menubarVisible(); + return page->chrome()->menubarVisible(); case Scrollbars: - return m_frame->page()->chrome()->scrollbarsVisible(); + return page->chrome()->scrollbarsVisible(); case Statusbar: - return m_frame->page()->chrome()->statusbarVisible(); - default: - return false; + return page->chrome()->statusbarVisible(); } + + ASSERT_NOT_REACHED(); + return false; } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/BarInfo.idl b/src/3rdparty/webkit/WebCore/page/BarInfo.idl index 42041c5..2089895 100644 --- a/src/3rdparty/webkit/WebCore/page/BarInfo.idl +++ b/src/3rdparty/webkit/WebCore/page/BarInfo.idl @@ -28,7 +28,7 @@ module window { - interface BarInfo { + interface [OmitConstructor] BarInfo { readonly attribute boolean visible; }; diff --git a/src/3rdparty/webkit/WebCore/page/Chrome.cpp b/src/3rdparty/webkit/WebCore/page/Chrome.cpp index 96f0fb7..974a39f 100644 --- a/src/3rdparty/webkit/WebCore/page/Chrome.cpp +++ b/src/3rdparty/webkit/WebCore/page/Chrome.cpp @@ -147,6 +147,11 @@ void Chrome::takeFocus(FocusDirection direction) const m_client->takeFocus(direction); } +void Chrome::focusedNodeChanged(Node* node) const +{ + m_client->focusedNodeChanged(node); +} + Page* Chrome::createWindow(Frame* frame, const FrameLoadRequest& request, const WindowFeatures& features) const { Page* newPage = m_client->createWindow(frame, request, features); @@ -302,6 +307,16 @@ bool Chrome::shouldInterruptJavaScript() return m_client->shouldInterruptJavaScript(); } +void Chrome::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) +{ + m_client->registerProtocolHandler(scheme, baseURL, url, title); +} + +void Chrome::registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title) +{ + m_client->registerContentHandler(mimeType, baseURL, url, title); +} + IntRect Chrome::windowResizerRect() const { return m_client->windowResizerRect(); @@ -392,11 +407,6 @@ void Chrome::print(Frame* frame) void Chrome::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) { - // Defer loads in case the client method runs a new event loop that would - // otherwise cause the load to continue while we're in the middle of executing JavaScript. - PageGroupLoadDeferrer deferrer(m_page, true); - - ASSERT(frame); m_client->requestGeolocationPermissionForFrame(frame, geolocation); } @@ -405,6 +415,11 @@ void Chrome::runOpenPanel(Frame* frame, PassRefPtr fileChooser) m_client->runOpenPanel(frame, fileChooser); } +void Chrome::iconForFiles(const Vector& filenames, PassRefPtr fileChooser) +{ + m_client->iconForFiles(filenames, fileChooser); +} + bool Chrome::setCursor(PlatformCursorHandle cursor) { return m_client->setCursor(cursor); diff --git a/src/3rdparty/webkit/WebCore/page/Chrome.h b/src/3rdparty/webkit/WebCore/page/Chrome.h index 033311d..b37e7eb 100644 --- a/src/3rdparty/webkit/WebCore/page/Chrome.h +++ b/src/3rdparty/webkit/WebCore/page/Chrome.h @@ -42,6 +42,7 @@ namespace WebCore { class Geolocation; class HitTestResult; class IntRect; + class Node; class Page; class String; #if ENABLE(NOTIFICATIONS) @@ -82,6 +83,8 @@ namespace WebCore { bool canTakeFocus(FocusDirection) const; void takeFocus(FocusDirection) const; + void focusedNodeChanged(Node*) const; + Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) const; void show() const; @@ -114,6 +117,9 @@ namespace WebCore { void setStatusbarText(Frame*, const String&); bool shouldInterruptJavaScript(); + void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title); + void registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title); + IntRect windowResizerRect() const; void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); @@ -125,6 +131,7 @@ namespace WebCore { void requestGeolocationPermissionForFrame(Frame*, Geolocation*); void runOpenPanel(Frame*, PassRefPtr); + void iconForFiles(const Vector&, PassRefPtr); bool setCursor(PlatformCursorHandle); diff --git a/src/3rdparty/webkit/WebCore/page/ChromeClient.h b/src/3rdparty/webkit/WebCore/page/ChromeClient.h index 5231603..1421631 100644 --- a/src/3rdparty/webkit/WebCore/page/ChromeClient.h +++ b/src/3rdparty/webkit/WebCore/page/ChromeClient.h @@ -83,6 +83,8 @@ namespace WebCore { virtual bool canTakeFocus(FocusDirection) = 0; virtual void takeFocus(FocusDirection) = 0; + virtual void focusedNodeChanged(Node*) = 0; + // The Frame pointer provides the ChromeClient with context about which // Frame wants to create the new Page. Also, the newly created window // should not be shown to the user until the ChromeClient of the newly @@ -121,6 +123,9 @@ namespace WebCore { virtual bool shouldInterruptJavaScript() = 0; virtual bool tabsToLinks() const = 0; + virtual void registerProtocolHandler(const String&, const String&, const String&, const String&) { } + virtual void registerContentHandler(const String&, const String&, const String&, const String&) { } + virtual IntRect windowResizerRect() const = 0; // Methods used by HostWindow. @@ -180,6 +185,9 @@ namespace WebCore { virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*) = 0; virtual void runOpenPanel(Frame*, PassRefPtr) = 0; + // Asynchronous request to load an icon for specified filenames. + // This is called only if Icon::createIconForFiles() returns 0. + virtual void iconForFiles(const Vector&, PassRefPtr) = 0; virtual bool setCursor(PlatformCursorHandle) = 0; @@ -216,6 +224,10 @@ namespace WebCore { virtual void willPopUpMenu(NSMenu *) { } #endif +#if ENABLE(TOUCH_EVENTS) + virtual void needTouchEvents(bool) = 0; +#endif + protected: virtual ~ChromeClient() { } }; diff --git a/src/3rdparty/webkit/WebCore/page/Console.cpp b/src/3rdparty/webkit/WebCore/page/Console.cpp index 7d0f697..99b3106 100644 --- a/src/3rdparty/webkit/WebCore/page/Console.cpp +++ b/src/3rdparty/webkit/WebCore/page/Console.cpp @@ -30,6 +30,7 @@ #include "Console.h" #include "CString.h" +#include "Chrome.h" #include "ChromeClient.h" #include "ConsoleMessage.h" #include "Frame.h" @@ -40,11 +41,9 @@ #include "PageGroup.h" #include "PlatformString.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) -#include -#endif - #include "ScriptCallStack.h" +#include "ScriptProfile.h" +#include "ScriptProfiler.h" #include #include @@ -191,7 +190,7 @@ void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) { String argAsString; - if (lastCaller.argumentAt(i).getString(argAsString)) + if (lastCaller.argumentAt(i).getString(callStack->state(), argAsString)) printf(" %s", argAsString.utf8().data()); } printf("\n"); @@ -270,6 +269,23 @@ void Console::count(ScriptCallStack* callStack) #endif } +void Console::markTimeline(ScriptCallStack* callStack) +{ +#if ENABLE(INSPECTOR) + Page* page = this->page(); + if (!page) + return; + + const ScriptCallFrame& lastCaller = callStack->at(0); + String message; + getFirstArgumentAsString(callStack->state(), lastCaller, message); + + page->inspectorController()->markTimeline(message); +#else + UNUSED_PARAM(callStack); +#endif +} + #if ENABLE(WML) String Console::lastWMLErrorMessage() const { @@ -298,7 +314,7 @@ String Console::lastWMLErrorMessage() const #if ENABLE(JAVASCRIPT_DEBUGGER) -void Console::profile(const JSC::UString& title, ScriptCallStack* callStack) +void Console::profile(const String& title, ScriptCallStack* callStack) { Page* page = this->page(); if (!page) @@ -311,15 +327,15 @@ void Console::profile(const JSC::UString& title, ScriptCallStack* callStack) return; #endif - JSC::UString resolvedTitle = title; - if (title.isNull()) // no title so give it the next user initiated profile title. + String resolvedTitle = title; + if (title.isNull()) // no title so give it the next user initiated profile title. #if ENABLE(INSPECTOR) resolvedTitle = controller->getCurrentUserInitiatedProfileName(true); #else resolvedTitle = ""; #endif - JSC::Profiler::profiler()->startProfiling(callStack->state(), resolvedTitle); + ScriptProfiler::start(callStack->state(), resolvedTitle); #if ENABLE(INSPECTOR) const ScriptCallFrame& lastCaller = callStack->at(0); @@ -327,22 +343,19 @@ void Console::profile(const JSC::UString& title, ScriptCallStack* callStack) #endif } -void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack) +void Console::profileEnd(const String& title, ScriptCallStack* callStack) { Page* page = this->page(); if (!page) return; - if (!this->page()) - return; - #if ENABLE(INSPECTOR) InspectorController* controller = page->inspectorController(); if (!controller->profilerEnabled()) return; #endif - RefPtr profile = JSC::Profiler::profiler()->stopProfiling(callStack->state(), title); + RefPtr profile = ScriptProfiler::stop(callStack->state(), title); if (!profile) return; diff --git a/src/3rdparty/webkit/WebCore/page/Console.h b/src/3rdparty/webkit/WebCore/page/Console.h index 1b93a4a..9a6d88c 100644 --- a/src/3rdparty/webkit/WebCore/page/Console.h +++ b/src/3rdparty/webkit/WebCore/page/Console.h @@ -31,100 +31,99 @@ #include "PlatformString.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) -#include -#endif +#include "ScriptProfile.h" -#include #include +#include namespace WebCore { #if ENABLE(JAVASCRIPT_DEBUGGER) - typedef Vector > ProfilesArray; +typedef Vector > ProfilesArray; #endif - class Frame; - class Page; - class String; - class ScriptCallStack; - - // Keep in sync with inspector/front-end/Console.js - enum MessageSource { - HTMLMessageSource, - WMLMessageSource, - XMLMessageSource, - JSMessageSource, - CSSMessageSource, - OtherMessageSource - }; - - enum MessageType { - LogMessageType, - ObjectMessageType, - TraceMessageType, - StartGroupMessageType, - EndGroupMessageType, - AssertMessageType - }; - - enum MessageLevel { - TipMessageLevel, - LogMessageLevel, - WarningMessageLevel, - ErrorMessageLevel, - DebugMessageLevel - }; - - class Console : public RefCounted { - public: - static PassRefPtr create(Frame* frame) { return adoptRef(new Console(frame)); } - - Frame* frame() const; - void disconnectFrame(); - - void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - void debug(ScriptCallStack*); - void error(ScriptCallStack*); - void info(ScriptCallStack*); - void log(ScriptCallStack*); - void warn(ScriptCallStack*); - void dir(ScriptCallStack*); - void dirxml(ScriptCallStack*); - void trace(ScriptCallStack*); - void assertCondition(bool condition, ScriptCallStack*); - void count(ScriptCallStack*); +class Frame; +class Page; +class String; +class ScriptCallStack; + +// Keep in sync with inspector/front-end/Console.js +enum MessageSource { + HTMLMessageSource, + WMLMessageSource, + XMLMessageSource, + JSMessageSource, + CSSMessageSource, + OtherMessageSource +}; + +enum MessageType { + LogMessageType, + ObjectMessageType, + TraceMessageType, + StartGroupMessageType, + EndGroupMessageType, + AssertMessageType +}; + +enum MessageLevel { + TipMessageLevel, + LogMessageLevel, + WarningMessageLevel, + ErrorMessageLevel, + DebugMessageLevel +}; + +class Console : public RefCounted { +public: + static PassRefPtr create(Frame* frame) { return adoptRef(new Console(frame)); } + + Frame* frame() const; + void disconnectFrame(); + + void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); + + void debug(ScriptCallStack*); + void error(ScriptCallStack*); + void info(ScriptCallStack*); + void log(ScriptCallStack*); + void warn(ScriptCallStack*); + void dir(ScriptCallStack*); + void dirxml(ScriptCallStack*); + void trace(ScriptCallStack*); + void assertCondition(bool condition, ScriptCallStack*); + void count(ScriptCallStack*); + void markTimeline(ScriptCallStack*); #if ENABLE(WML) - String lastWMLErrorMessage() const; + String lastWMLErrorMessage() const; #endif #if ENABLE(JAVASCRIPT_DEBUGGER) - void profile(const JSC::UString&, ScriptCallStack*); - void profileEnd(const JSC::UString&, ScriptCallStack*); + void profile(const String&, ScriptCallStack*); + void profileEnd(const String&, ScriptCallStack*); #endif - void time(const String&); - void timeEnd(const String&, ScriptCallStack*); - void group(ScriptCallStack*); - void groupEnd(); + void time(const String&); + void timeEnd(const String&, ScriptCallStack*); + void group(ScriptCallStack*); + void groupEnd(); - static bool shouldPrintExceptions(); - static void setShouldPrintExceptions(bool); + static bool shouldPrintExceptions(); + static void setShouldPrintExceptions(bool); #if ENABLE(JAVASCRIPT_DEBUGGER) - const ProfilesArray& profiles() const { return m_profiles; } + const ProfilesArray& profiles() const { return m_profiles; } #endif - private: - inline Page* page() const; - void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false); +private: + inline Page* page() const; + void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false); - Console(Frame*); + Console(Frame*); - Frame* m_frame; + Frame* m_frame; #if ENABLE(JAVASCRIPT_DEBUGGER) - ProfilesArray m_profiles; + ProfilesArray m_profiles; #endif - }; +}; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/Console.idl b/src/3rdparty/webkit/WebCore/page/Console.idl index 0e9f3dc..c08fcc0 100644 --- a/src/3rdparty/webkit/WebCore/page/Console.idl +++ b/src/3rdparty/webkit/WebCore/page/Console.idl @@ -28,9 +28,10 @@ module window { - interface Console { + interface [OmitConstructor] Console { -#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER + // Not enabled in V8 because it requires request-reply style. +#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER && !(defined(V8_BINDING) && V8_BINDING) readonly attribute [CustomGetter] Array profiles; #endif @@ -44,6 +45,7 @@ module window { [CustomArgumentHandling] void trace(); [CustomArgumentHandling, ImplementationFunction=assertCondition] void assert(in boolean condition); [CustomArgumentHandling] void count(); + [CustomArgumentHandling] void markTimeline(); #if defined(ENABLE_WML) && ENABLE_WML [DontEnum] DOMString lastWMLErrorMessage(); diff --git a/src/3rdparty/webkit/WebCore/page/ContextMenuController.cpp b/src/3rdparty/webkit/WebCore/page/ContextMenuController.cpp index 7d773ca..d384b02 100644 --- a/src/3rdparty/webkit/WebCore/page/ContextMenuController.cpp +++ b/src/3rdparty/webkit/WebCore/page/ContextMenuController.cpp @@ -31,6 +31,7 @@ #include "Chrome.h" #include "ContextMenu.h" #include "ContextMenuClient.h" +#include "ContextMenuProvider.h" #include "Document.h" #include "DocumentFragment.h" #include "DocumentLoader.h" @@ -79,13 +80,38 @@ ContextMenuController::~ContextMenuController() void ContextMenuController::clearContextMenu() { m_contextMenu.set(0); + if (m_menuProvider) + m_menuProvider->contextMenuCleared(); + m_menuProvider = 0; } void ContextMenuController::handleContextMenuEvent(Event* event) { - ASSERT(event->type() == eventNames().contextmenuEvent); - if (!event->isMouseEvent()) + m_contextMenu.set(createContextMenu(event)); + if (!m_contextMenu) return; + m_contextMenu->populate(); + showContextMenu(event); +} + +void ContextMenuController::showContextMenu(Event* event, PassRefPtr menuProvider) +{ + m_menuProvider = menuProvider; + + m_contextMenu.set(createContextMenu(event)); + if (!m_contextMenu) { + clearContextMenu(); + return; + } + + m_menuProvider->populateContextMenu(m_contextMenu.get()); + showContextMenu(event); +} + +ContextMenu* ContextMenuController::createContextMenu(Event* event) +{ + if (!event->isMouseEvent()) + return 0; MouseEvent* mouseEvent = static_cast(event); HitTestResult result(mouseEvent->absoluteLocation()); @@ -93,18 +119,18 @@ void ContextMenuController::handleContextMenuEvent(Event* event) result = frame->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation(), false); if (!result.innerNonSharedNode()) - return; + return 0; + return new ContextMenu(result); +} - m_contextMenu.set(new ContextMenu(result)); - m_contextMenu->populate(); +void ContextMenuController::showContextMenu(Event* event) +{ #if ENABLE(INSPECTOR) if (m_page->inspectorController()->enabled()) m_contextMenu->addInspectElementItem(); #endif - PlatformMenuDescription customMenu = m_client->getCustomMenuFromDefaultItems(m_contextMenu.get()); m_contextMenu->setPlatformDescription(customMenu); - event->setDefaultHandled(); } @@ -126,6 +152,12 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) return; } + if (item->action() >= ContextMenuItemBaseCustomTag) { + ASSERT(m_menuProvider); + m_menuProvider->contextMenuItemSelected(item); + return; + } + HitTestResult result = m_contextMenu->hitTestResult(); Frame* frame = result.innerNonSharedNode()->document()->frame(); if (!frame) diff --git a/src/3rdparty/webkit/WebCore/page/ContextMenuController.h b/src/3rdparty/webkit/WebCore/page/ContextMenuController.h index 38095f6..833b909 100644 --- a/src/3rdparty/webkit/WebCore/page/ContextMenuController.h +++ b/src/3rdparty/webkit/WebCore/page/ContextMenuController.h @@ -28,12 +28,15 @@ #include #include +#include +#include namespace WebCore { class ContextMenu; class ContextMenuClient; class ContextMenuItem; + class ContextMenuProvider; class Event; class Page; @@ -48,12 +51,18 @@ namespace WebCore { void clearContextMenu(); void handleContextMenuEvent(Event*); + void showContextMenu(Event*, PassRefPtr); + void contextMenuItemSelected(ContextMenuItem*); private: + ContextMenu* createContextMenu(Event*); + void showContextMenu(Event*); + Page* m_page; ContextMenuClient* m_client; OwnPtr m_contextMenu; + RefPtr m_menuProvider; }; } diff --git a/src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h b/src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h new file mode 100644 index 0000000..57598d1 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/page/ContextMenuProvider.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ContextMenuProvider_h +#define ContextMenuProvider_h + +#include + +namespace WebCore { + +class ContextMenu; +class ContextMenuItem; + +class ContextMenuProvider : public RefCounted { +public: + virtual ~ContextMenuProvider() { }; + + virtual void populateContextMenu(ContextMenu*) = 0; + virtual void contextMenuItemSelected(ContextMenuItem*) = 0; + virtual void contextMenuCleared() = 0; +}; + +} + +#endif // ContextMenuProvider_h diff --git a/src/3rdparty/webkit/WebCore/page/Coordinates.idl b/src/3rdparty/webkit/WebCore/page/Coordinates.idl index f847325..5a5a141 100644 --- a/src/3rdparty/webkit/WebCore/page/Coordinates.idl +++ b/src/3rdparty/webkit/WebCore/page/Coordinates.idl @@ -25,7 +25,7 @@ module core { - interface Coordinates { + interface [OmitConstructor] Coordinates { readonly attribute double latitude; readonly attribute double longitude; readonly attribute [Custom] double altitude; diff --git a/src/3rdparty/webkit/WebCore/page/DOMSelection.idl b/src/3rdparty/webkit/WebCore/page/DOMSelection.idl index be6c2b4..4d0c942 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMSelection.idl +++ b/src/3rdparty/webkit/WebCore/page/DOMSelection.idl @@ -31,7 +31,7 @@ module window { // This is based off of Mozilla's Selection interface // https://developer.mozilla.org/En/DOM/Selection - interface DOMSelection { + interface [OmitConstructor] DOMSelection { readonly attribute Node anchorNode; readonly attribute long anchorOffset; readonly attribute Node focusNode; diff --git a/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp b/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp index 83bcb02..72dc9ac 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMTimer.cpp @@ -43,7 +43,7 @@ double DOMTimer::s_minTimerInterval = 0.010; // 10 milliseconds static int timerNestingLevel = 0; -DOMTimer::DOMTimer(ScriptExecutionContext* context, ScheduledAction* action, int timeout, bool singleShot) +DOMTimer::DOMTimer(ScriptExecutionContext* context, PassOwnPtr action, int timeout, bool singleShot) : ActiveDOMObject(context, this) , m_action(action) , m_nextFireInterval(0) @@ -82,7 +82,7 @@ DOMTimer::~DOMTimer() scriptExecutionContext()->removeTimeout(m_timeoutId); } -int DOMTimer::install(ScriptExecutionContext* context, ScheduledAction* action, int timeout, bool singleShot) +int DOMTimer::install(ScriptExecutionContext* context, PassOwnPtr action, int timeout, bool singleShot) { // DOMTimer constructor links the new timer into a list of ActiveDOMObjects held by the 'context'. // The timer is deleted when context is deleted (DOMTimer::contextDestroyed) or explicitly via DOMTimer::removeById(), @@ -119,8 +119,7 @@ void DOMTimer::fired() timerNestingLevel = m_nestingLevel; #if ENABLE(INSPECTOR) - InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context); - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) timelineAgent->willFireTimer(m_timeoutId); #endif @@ -135,7 +134,7 @@ void DOMTimer::fired() // No access to member variables after this point, it can delete the timer. m_action->execute(context); #if ENABLE(INSPECTOR) - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) timelineAgent->didFireTimer(); #endif return; @@ -149,7 +148,7 @@ void DOMTimer::fired() action->execute(context); #if ENABLE(INSPECTOR) - if (timelineAgent) + if (InspectorTimelineAgent* timelineAgent = InspectorTimelineAgent::retrieve(context)) timelineAgent->didFireTimer(); #endif delete action; diff --git a/src/3rdparty/webkit/WebCore/page/DOMTimer.h b/src/3rdparty/webkit/WebCore/page/DOMTimer.h index 460430f..da38178 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMTimer.h +++ b/src/3rdparty/webkit/WebCore/page/DOMTimer.h @@ -28,20 +28,21 @@ #define DOMTimer_h #include "ActiveDOMObject.h" +#include "ScheduledAction.h" #include "Timer.h" #include +#include namespace WebCore { class InspectorTimelineAgent; - class ScheduledAction; class DOMTimer : public TimerBase, public ActiveDOMObject { public: virtual ~DOMTimer(); // Creates a new timer owned by specified ScriptExecutionContext, starts it // and returns its Id. - static int install(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot); + static int install(ScriptExecutionContext*, PassOwnPtr, int timeout, bool singleShot); static void removeById(ScriptExecutionContext*, int timeoutId); // ActiveDOMObject @@ -59,7 +60,7 @@ namespace WebCore { static void setMinTimerInterval(double value) { s_minTimerInterval = value; } private: - DOMTimer(ScriptExecutionContext*, ScheduledAction*, int timeout, bool singleShot); + DOMTimer(ScriptExecutionContext*, PassOwnPtr, int timeout, bool singleShot); virtual void fired(); int m_timeoutId; diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp index c30b6b9..6af22c3 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp @@ -53,6 +53,7 @@ #include "HTMLFrameOwnerElement.h" #include "History.h" #include "InspectorController.h" +#include "InspectorTimelineAgent.h" #include "Location.h" #include "Media.h" #include "MessageEvent.h" @@ -262,7 +263,7 @@ void DOMWindow::dispatchAllPendingUnloadEvents() if (!set.contains(window)) continue; - window->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, false), window->document()); + window->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), window->document()); window->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), window->document()); } @@ -341,8 +342,6 @@ void DOMWindow::parseModalDialogFeatures(const String& featuresArg, HashMapscript()->processingUserGesture()) - return true; Settings* settings = activeFrame->settings(); return settings && settings->javaScriptCanOpenWindowsAutomatically(); } @@ -441,6 +440,10 @@ void DOMWindow::clear() if (m_location) m_location->disconnectFrame(); m_location = 0; + + if (m_media) + m_media->disconnectFrame(); + m_media = 0; #if ENABLE(DOM_STORAGE) if (m_sessionStorage) @@ -459,6 +462,8 @@ void DOMWindow::clear() #endif #if ENABLE(NOTIFICATIONS) + if (m_notifications) + m_notifications->disconnectFrame(); m_notifications = 0; #endif } @@ -568,14 +573,14 @@ Storage* DOMWindow::sessionStorage() const Document* document = this->document(); if (!document) return 0; + + if (!document->securityOrigin()->canAccessStorage()) + return 0; Page* page = document->page(); if (!page) return 0; - if (!page->settings()->sessionStorageEnabled()) - return 0; - RefPtr storageArea = page->sessionStorage()->storageArea(document->securityOrigin()); #if ENABLE(INSPECTOR) page->inspectorController()->didUseDOMStorage(storageArea.get(), false, m_frame); @@ -593,6 +598,9 @@ Storage* DOMWindow::localStorage() const Document* document = this->document(); if (!document) return 0; + + if (!document->securityOrigin()->canAccessStorage()) + return 0; Page* page = document->page(); if (!page) @@ -625,9 +633,6 @@ NotificationCenter* DOMWindow::webkitNotifications() const if (!page) return 0; - if (!page->settings()->experimentalNotificationsEnabled()) - return 0; - NotificationPresenter* provider = page->chrome()->notificationPresenter(); if (provider) m_notifications = NotificationCenter::create(document, provider); @@ -636,6 +641,13 @@ NotificationCenter* DOMWindow::webkitNotifications() const } #endif +#if ENABLE(INDEXED_DATABASE) +IndexedDatabaseRequest* DOMWindow::indexedDB() const +{ + return 0; +} +#endif + void DOMWindow::postMessage(PassRefPtr message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec) { MessagePortArray ports; @@ -1050,7 +1062,9 @@ Document* DOMWindow::document() const PassRefPtr DOMWindow::media() const { - return Media::create(const_cast(this)); + if (!m_media) + m_media = Media::create(m_frame); + return m_media.get(); } PassRefPtr DOMWindow::getComputedStyle(Element* elt, const String&) const @@ -1078,7 +1092,9 @@ PassRefPtr DOMWindow::webkitConvertPointFromNodeToPage(Node* node, { if (!node || !p) return 0; - + + m_frame->document()->updateLayoutIgnorePendingStylesheets(); + FloatPoint pagePoint(p->x(), p->y()); pagePoint = node->convertToPage(pagePoint); return WebKitPoint::create(pagePoint.x(), pagePoint.y()); @@ -1088,7 +1104,9 @@ PassRefPtr DOMWindow::webkitConvertPointFromPageToNode(Node* node, { if (!node || !p) return 0; - + + m_frame->document()->updateLayoutIgnorePendingStylesheets(); + FloatPoint nodePoint(p->x(), p->y()); nodePoint = node->convertFromPage(nodePoint); return WebKitPoint::create(nodePoint.x(), nodePoint.y()); @@ -1112,13 +1130,15 @@ PassRefPtr DOMWindow::openDatabase(const String& name, const String& v if (!m_frame) return 0; - Document* doc = m_frame->document(); + Document* document = m_frame->document(); + if (!document->securityOrigin()->canAccessDatabase()) + return 0; Settings* settings = m_frame->settings(); if (!settings || !settings->databasesEnabled()) return 0; - return Database::openDatabase(doc, name, version, displayName, estimatedSize, ec); + return Database::openDatabase(document, name, version, displayName, estimatedSize, ec); } #endif @@ -1232,24 +1252,40 @@ void DOMWindow::resizeTo(float width, float height) const page->chrome()->setWindowRect(fr); } -int DOMWindow::setTimeout(ScheduledAction* action, int timeout) +int DOMWindow::setTimeout(PassOwnPtr action, int timeout, ExceptionCode& ec) { - return DOMTimer::install(scriptExecutionContext(), action, timeout, true); + ScriptExecutionContext* context = scriptExecutionContext(); + if (!context) { + ec = INVALID_ACCESS_ERR; + return -1; + } + return DOMTimer::install(context, action, timeout, true); } void DOMWindow::clearTimeout(int timeoutId) { - DOMTimer::removeById(scriptExecutionContext(), timeoutId); + ScriptExecutionContext* context = scriptExecutionContext(); + if (!context) + return; + DOMTimer::removeById(context, timeoutId); } -int DOMWindow::setInterval(ScheduledAction* action, int timeout) +int DOMWindow::setInterval(PassOwnPtr action, int timeout, ExceptionCode& ec) { - return DOMTimer::install(scriptExecutionContext(), action, timeout, false); + ScriptExecutionContext* context = scriptExecutionContext(); + if (!context) { + ec = INVALID_ACCESS_ERR; + return -1; + } + return DOMTimer::install(context, action, timeout, false); } void DOMWindow::clearInterval(int timeoutId) { - DOMTimer::removeById(scriptExecutionContext(), timeoutId); + ScriptExecutionContext* context = scriptExecutionContext(); + if (!context) + return; + DOMTimer::removeById(context, timeoutId); } bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr listener, bool useCapture) @@ -1304,6 +1340,15 @@ void DOMWindow::dispatchLoadEvent() #endif } +#if ENABLE(INSPECTOR) +InspectorTimelineAgent* DOMWindow::inspectorTimelineAgent() +{ + if (frame() && frame()->page()) + return frame()->page()->inspectorTimelineAgent(); + return 0; +} +#endif + bool DOMWindow::dispatchEvent(PassRefPtr prpEvent, PassRefPtr prpTarget) { RefPtr protect = this; @@ -1313,7 +1358,24 @@ bool DOMWindow::dispatchEvent(PassRefPtr prpEvent, PassRefPtrsetCurrentTarget(this); event->setEventPhase(Event::AT_TARGET); - return fireEventListeners(event.get()); +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = inspectorTimelineAgent(); + bool timelineAgentIsActive = timelineAgent && hasEventListeners(event->type()); + if (timelineAgentIsActive) + timelineAgent->willDispatchEvent(*event); +#endif + + bool result = fireEventListeners(event.get()); + +#if ENABLE(INSPECTOR) + if (timelineAgentIsActive) { + timelineAgent = inspectorTimelineAgent(); + if (timelineAgent) + timelineAgent->didDispatchEvent(); + } +#endif + + return result; } void DOMWindow::removeAllEventListeners() diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.h b/src/3rdparty/webkit/WebCore/page/DOMWindow.h index 25eadc8..4452dbb 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.h +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.h @@ -52,6 +52,8 @@ namespace WebCore { class FloatRect; class Frame; class History; + class IndexedDatabaseRequest; + class InspectorTimelineAgent; class Location; class Media; class Navigator; @@ -215,6 +217,10 @@ namespace WebCore { NotificationCenter* webkitNotifications() const; #endif +#if ENABLE(INDEXED_DATABASE) + IndexedDatabaseRequest* indexedDB() const; +#endif + void postMessage(PassRefPtr message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); // FIXME: remove this when we update the ObjC bindings (bug #28774). void postMessage(PassRefPtr message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); @@ -231,9 +237,9 @@ namespace WebCore { void resizeTo(float width, float height) const; // Timers - int setTimeout(ScheduledAction*, int timeout); + int setTimeout(PassOwnPtr, int timeout, ExceptionCode&); void clearTimeout(int timeoutId); - int setInterval(ScheduledAction*, int timeout); + int setInterval(PassOwnPtr, int timeout, ExceptionCode&); void clearInterval(int timeoutId); // Events @@ -247,9 +253,13 @@ namespace WebCore { void dispatchLoadEvent(); DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); + DEFINE_ATTRIBUTE_EVENT_LISTENER(beforeunload); DEFINE_ATTRIBUTE_EVENT_LISTENER(blur); + DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay); + DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough); DEFINE_ATTRIBUTE_EVENT_LISTENER(change); DEFINE_ATTRIBUTE_EVENT_LISTENER(click); + DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); DEFINE_ATTRIBUTE_EVENT_LISTENER(dblclick); DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); @@ -258,13 +268,22 @@ namespace WebCore { DEFINE_ATTRIBUTE_EVENT_LISTENER(dragover); DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); DEFINE_ATTRIBUTE_EVENT_LISTENER(drop); + DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied); + DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); DEFINE_ATTRIBUTE_EVENT_LISTENER(error); DEFINE_ATTRIBUTE_EVENT_LISTENER(focus); DEFINE_ATTRIBUTE_EVENT_LISTENER(hashchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(input); + DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); DEFINE_ATTRIBUTE_EVENT_LISTENER(keypress); DEFINE_ATTRIBUTE_EVENT_LISTENER(keyup); DEFINE_ATTRIBUTE_EVENT_LISTENER(load); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata); + DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(message); DEFINE_ATTRIBUTE_EVENT_LISTENER(mousedown); DEFINE_ATTRIBUTE_EVENT_LISTENER(mousemove); DEFINE_ATTRIBUTE_EVENT_LISTENER(mouseout); @@ -275,39 +294,30 @@ namespace WebCore { DEFINE_ATTRIBUTE_EVENT_LISTENER(online); DEFINE_ATTRIBUTE_EVENT_LISTENER(pagehide); DEFINE_ATTRIBUTE_EVENT_LISTENER(pageshow); + DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); + DEFINE_ATTRIBUTE_EVENT_LISTENER(play); + DEFINE_ATTRIBUTE_EVENT_LISTENER(playing); + DEFINE_ATTRIBUTE_EVENT_LISTENER(popstate); + DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); + DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange); DEFINE_ATTRIBUTE_EVENT_LISTENER(reset); DEFINE_ATTRIBUTE_EVENT_LISTENER(resize); DEFINE_ATTRIBUTE_EVENT_LISTENER(scroll); DEFINE_ATTRIBUTE_EVENT_LISTENER(search); + DEFINE_ATTRIBUTE_EVENT_LISTENER(seeked); + DEFINE_ATTRIBUTE_EVENT_LISTENER(seeking); DEFINE_ATTRIBUTE_EVENT_LISTENER(select); + DEFINE_ATTRIBUTE_EVENT_LISTENER(stalled); DEFINE_ATTRIBUTE_EVENT_LISTENER(storage); DEFINE_ATTRIBUTE_EVENT_LISTENER(submit); - DEFINE_ATTRIBUTE_EVENT_LISTENER(unload); - DEFINE_ATTRIBUTE_EVENT_LISTENER(beforeunload); - DEFINE_ATTRIBUTE_EVENT_LISTENER(canplay); - DEFINE_ATTRIBUTE_EVENT_LISTENER(canplaythrough); - DEFINE_ATTRIBUTE_EVENT_LISTENER(durationchange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(emptied); - DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); - DEFINE_ATTRIBUTE_EVENT_LISTENER(loadeddata); - DEFINE_ATTRIBUTE_EVENT_LISTENER(loadedmetadata); - DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); - DEFINE_ATTRIBUTE_EVENT_LISTENER(play); - DEFINE_ATTRIBUTE_EVENT_LISTENER(playing); - DEFINE_ATTRIBUTE_EVENT_LISTENER(ratechange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(seeked); - DEFINE_ATTRIBUTE_EVENT_LISTENER(seeking); + DEFINE_ATTRIBUTE_EVENT_LISTENER(suspend); DEFINE_ATTRIBUTE_EVENT_LISTENER(timeupdate); + DEFINE_ATTRIBUTE_EVENT_LISTENER(unload); DEFINE_ATTRIBUTE_EVENT_LISTENER(volumechange); DEFINE_ATTRIBUTE_EVENT_LISTENER(waiting); - DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); - DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); - DEFINE_ATTRIBUTE_EVENT_LISTENER(stalled); - DEFINE_ATTRIBUTE_EVENT_LISTENER(suspend); - DEFINE_ATTRIBUTE_EVENT_LISTENER(input); - DEFINE_ATTRIBUTE_EVENT_LISTENER(message); - DEFINE_ATTRIBUTE_EVENT_LISTENER(contextmenu); - DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); + DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitbeginfullscreen); + DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitendfullscreen); + #if ENABLE(ORIENTATION_EVENTS) DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); #endif @@ -317,6 +327,12 @@ namespace WebCore { DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd); DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd); +#if ENABLE(TOUCH_EVENTS) + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); +#endif void captureEvents(); void releaseEvents(); @@ -334,6 +350,7 @@ namespace WebCore { Console* optionalConsole() const { return m_console.get(); } Navigator* optionalNavigator() const { return m_navigator.get(); } Location* optionalLocation() const { return m_location.get(); } + Media* optionalMedia() const { return m_media.get(); } #if ENABLE(DOM_STORAGE) Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } Storage* optionalLocalStorage() const { return m_localStorage.get(); } @@ -352,6 +369,7 @@ namespace WebCore { virtual void derefEventTarget() { deref(); } virtual EventTargetData* eventTargetData(); virtual EventTargetData* ensureEventTargetData(); + InspectorTimelineAgent* inspectorTimelineAgent(); RefPtr m_securityOrigin; KURL m_url; @@ -369,6 +387,7 @@ namespace WebCore { mutable RefPtr m_console; mutable RefPtr m_navigator; mutable RefPtr m_location; + mutable RefPtr m_media; #if ENABLE(DOM_STORAGE) mutable RefPtr m_sessionStorage; mutable RefPtr m_localStorage; diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl index 5addb83..0669ac7 100644 --- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl +++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl @@ -31,15 +31,15 @@ module window { CustomDefineSetter, CustomDeleteProperty, CustomGetOwnPropertySlot, - CustomGetPropertyAttributes, CustomGetPropertyNames, CustomLookupGetter, CustomLookupSetter, CustomMarkFunction, CustomNativeConverter, CustomPutFunction, - ExtendsDOMGlobalObject, EventTarget, + OmitConstructor, + ExtendsDOMGlobalObject, GenerateNativeConverter, LegacyParent=JSDOMWindowBase ] DOMWindow { @@ -157,7 +157,7 @@ module window { WebKitPoint webkitConvertPointFromNodeToPage(in Node node, in WebKitPoint p); #if defined(ENABLE_OFFLINE_WEB_APPLICATIONS) && ENABLE_OFFLINE_WEB_APPLICATIONS - readonly attribute DOMApplicationCache applicationCache; + readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache; #endif #if defined(ENABLE_DATABASE) && ENABLE_DATABASE [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize) @@ -170,6 +170,9 @@ module window { #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif +#if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE + readonly attribute [EnabledAtRuntime] IndexedDatabaseRequest indexedDB; +#endif #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS // This is the interface orientation in degrees. Some examples are: @@ -252,6 +255,7 @@ module window { attribute EventListener onpause; attribute EventListener onplay; attribute EventListener onplaying; + attribute EventListener onpopstate; attribute EventListener onprogress; attribute EventListener onratechange; attribute EventListener onresize; @@ -273,7 +277,6 @@ module window { // attribute EventListener onbeforeprint; // attribute EventListener onformchange; // attribute EventListener onforminput; - // attribute EventListener onpopstate; // attribute EventListener onreadystatechange; // attribute EventListener onredo; // attribute EventListener onshow; @@ -289,6 +292,12 @@ module window { #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS attribute EventListener onorientationchange; #endif + #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS + attribute [DontEnum] EventListener ontouchstart; + attribute [DontEnum] EventListener ontouchmove; + attribute [DontEnum] EventListener ontouchend; + attribute [DontEnum] EventListener ontouchcancel; + #endif // EventTarget interface [Custom] void addEventListener(in DOMString type, @@ -432,17 +441,18 @@ module window { attribute [CustomGetter] HTMLOptionElementConstructor Option; // Usable with new operator attribute CanvasRenderingContext2DConstructor CanvasRenderingContext2D; - attribute [Conditional=3D_CANVAS] CanvasRenderingContext3DConstructor CanvasRenderingContext3D; + attribute ImageDataConstructor ImageData; + attribute [Conditional=3D_CANVAS] WebGLRenderingContextConstructor WebGLRenderingContext; attribute TextMetricsConstructor TextMetrics; - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasArrayBufferConstructor CanvasArrayBuffer; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasByteArrayConstructor CanvasByteArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasUnsignedByteArrayConstructor CanvasUnsignedByteArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasShortArrayConstructor CanvasShortArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasUnsignedShortArrayConstructor CanvasUnsignedShortArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasIntArrayConstructor CanvasIntArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasUnsignedIntArrayConstructor CanvasUnsignedIntArray; // Usable with new operator - attribute [JSCCustomGetter,Conditional=3D_CANVAS] CanvasFloatArrayConstructor CanvasFloatArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLArrayBufferConstructor WebGLArrayBuffer; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLByteArrayConstructor WebGLByteArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLUnsignedByteArrayConstructor WebGLUnsignedByteArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLShortArrayConstructor WebGLShortArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLUnsignedShortArrayConstructor WebGLUnsignedShortArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLIntArrayConstructor WebGLIntArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLUnsignedIntArrayConstructor WebGLUnsignedIntArray; // Usable with new operator + attribute [JSCCustomGetter,Conditional=3D_CANVAS] WebGLFloatArrayConstructor WebGLFloatArray; // Usable with new operator attribute EventConstructor Event; attribute BeforeLoadEventConstructor BeforeLoadEvent; @@ -471,6 +481,7 @@ module window { attribute FileConstructor File; attribute FileListConstructor FileList; + attribute BlobConstructor Blob; attribute NodeFilterConstructor NodeFilter; attribute RangeConstructor Range; @@ -537,35 +548,170 @@ module window { #endif #if defined(ENABLE_SVG) && ENABLE_SVG + // Expose all implemented SVG 1.1 interfaces, excluding the SVG MI interfaces: + // SVGAnimatedPathData, SVGAnimatedPoints, SVGExternalResourcesRequired, + // SVGFilterPrimitiveStandardAttributes, SVGFitToViewBox, SVGLangSpace, SVGLocatable + // SVGStylable, SVGTests, SVGTransformable, SVGURIReference, SVGZoomAndPan + attribute SVGAElementConstructor SVGAElement; attribute SVGAngleConstructor SVGAngle; + attribute SVGAnimatedAngleConstructor SVGAnimatedAngle; + attribute SVGAnimatedBooleanConstructor SVGAnimatedBoolean; + attribute SVGAnimatedEnumerationConstructor SVGAnimatedEnumeration; + attribute SVGAnimatedIntegerConstructor SVGAnimatedInteger; + attribute SVGAnimatedLengthConstructor SVGAnimatedLength; + attribute SVGAnimatedLengthListConstructor SVGAnimatedLengthList; + attribute SVGAnimatedNumberConstructor SVGAnimatedNumber; + attribute SVGAnimatedNumberListConstructor SVGAnimatedNumberList; + attribute SVGAnimatedPreserveAspectRatioConstructor SVGAnimatedPreserveAspectRatio; + attribute SVGAnimatedRectConstructor SVGAnimatedRect; + attribute SVGAnimatedStringConstructor SVGAnimatedString; + attribute SVGAnimatedTransformListConstructor SVGAnimatedTransformList; + attribute SVGCircleElementConstructor SVGCircleElement; + attribute SVGClipPathElementConstructor SVGClipPathElement; attribute SVGColorConstructor SVGColor; + attribute SVGCursorElementConstructor SVGCursorElement; // attribute SVGCSSRuleConstructor SVGCSSRule; + attribute SVGDefsElementConstructor SVGDefsElement; + attribute SVGDescElementConstructor SVGDescElement; + attribute SVGDocumentConstructor SVGDocument; + attribute SVGElementConstructor SVGElement; + attribute SVGElementInstanceConstructor SVGElementInstance; + attribute SVGElementInstanceListConstructor SVGElementInstanceList; + attribute SVGEllipseElementConstructor SVGEllipseElement; attribute SVGExceptionConstructor SVGException; + attribute SVGGElementConstructor SVGGElement; attribute SVGGradientElementConstructor SVGGradientElement; + attribute SVGImageElementConstructor SVGImageElement; attribute SVGLengthConstructor SVGLength; + attribute SVGLengthListConstructor SVGLengthList; + attribute SVGLinearGradientElementConstructor SVGLinearGradientElement; + attribute SVGLineElementConstructor SVGLineElement; attribute SVGMarkerElementConstructor SVGMarkerElement; + attribute SVGMaskElementConstructor SVGMaskElement; + attribute SVGMatrixConstructor SVGMatrix; + attribute SVGMetadataElementConstructor SVGMetadataElement; + attribute SVGNumberConstructor SVGNumber; + attribute SVGNumberListConstructor SVGNumberList; attribute SVGPaintConstructor SVGPaint; + attribute SVGPathElementConstructor SVGPathElement; attribute SVGPathSegConstructor SVGPathSeg; + attribute SVGPathSegArcAbsConstructor SVGPathSegArcAbs; + attribute SVGPathSegArcRelConstructor SVGPathSegArcRel; + attribute SVGPathSegClosePathConstructor SVGPathSegClosePath; + attribute SVGPathSegCurvetoCubicAbsConstructor SVGPathSegCurvetoCubicAbs; + attribute SVGPathSegCurvetoCubicRelConstructor SVGPathSegCurvetoCubicRel; + attribute SVGPathSegCurvetoCubicSmoothAbsConstructor SVGPathSegCurvetoCubicSmoothAbs; + attribute SVGPathSegCurvetoCubicSmoothRelConstructor SVGPathSegCurvetoCubicSmoothRel; + attribute SVGPathSegCurvetoQuadraticAbsConstructor SVGPathSegCurvetoQuadraticAbs; + attribute SVGPathSegCurvetoQuadraticRelConstructor SVGPathSegCurvetoQuadraticRel; + attribute SVGPathSegCurvetoQuadraticSmoothAbsConstructor SVGPathSegCurvetoQuadraticSmoothAbs; + attribute SVGPathSegCurvetoQuadraticSmoothRelConstructor SVGPathSegCurvetoQuadraticSmoothRel; + attribute SVGPathSegLinetoAbsConstructor SVGPathSegLinetoAbs; + attribute SVGPathSegLinetoHorizontalAbsConstructor SVGPathSegLinetoHorizontalAbs; + attribute SVGPathSegLinetoHorizontalRelConstructor SVGPathSegLinetoHorizontalRel; + attribute SVGPathSegLinetoRelConstructor SVGPathSegLinetoRel; + attribute SVGPathSegLinetoVerticalAbsConstructor SVGPathSegLinetoVerticalAbs; + attribute SVGPathSegLinetoVerticalRelConstructor SVGPathSegLinetoVerticalRel; + attribute SVGPathSegListConstructor SVGPathSegList; + attribute SVGPathSegMovetoAbsConstructor SVGPathSegMovetoAbs; + attribute SVGPathSegMovetoRelConstructor SVGPathSegMovetoRel; + attribute SVGPatternElementConstructor SVGPatternElement; + attribute SVGPointConstructor SVGPoint; + attribute SVGPointListConstructor SVGPointList; + attribute SVGPolygonElementConstructor SVGPolygonElement; + attribute SVGPolylineElementConstructor SVGPolylineElement; attribute SVGPreserveAspectRatioConstructor SVGPreserveAspectRatio; + attribute SVGRadialGradientElementConstructor SVGRadialGradientElement; + attribute SVGRectConstructor SVGRect; + attribute SVGRectElementConstructor SVGRectElement; attribute SVGRenderingIntentConstructor SVGRenderingIntent; + attribute SVGScriptElementConstructor SVGScriptElement; + attribute SVGStopElementConstructor SVGStopElement; + attribute SVGStringListConstructor SVGStringList; + attribute SVGStyleElementConstructor SVGStyleElement; + attribute SVGSVGElementConstructor SVGSVGElement; + attribute SVGSwitchElementConstructor SVGSwitchElement; + attribute SVGSymbolElementConstructor SVGSymbolElement; attribute SVGTextContentElementConstructor SVGTextContentElement; + attribute SVGTextElementConstructor SVGTextElement; attribute SVGTextPathElementConstructor SVGTextPathElement; + attribute SVGTextPositioningElementConstructor SVGTextPositioningElement; + attribute SVGTitleElementConstructor SVGTitleElement; attribute SVGTransformConstructor SVGTransform; + attribute SVGTransformListConstructor SVGTransformList; + attribute SVGTRefElementConstructor SVGTRefElement; + attribute SVGTSpanElementConstructor SVGTSpanElement; attribute SVGUnitTypesConstructor SVGUnitTypes; -// attribute SVGZoomAndPanConstructor SVGZoomAndPan; + attribute SVGUseElementConstructor SVGUseElement; + attribute SVGViewElementConstructor SVGViewElement; +// attribute SVGViewSpecConstructor SVGViewSpec; + attribute SVGZoomEventConstructor SVGZoomEvent; + +#if defined(ENABLE_SVG_ANIMATION) && ENABLE_SVG_ANIMATION + attribute SVGAnimateColorElementConstructor SVGAnimateColorElement; + attribute SVGAnimateElementConstructor SVGAnimateElement; +// attribute SVGAnimateMotionElementConstructor SVGAnimateMotionElement; + attribute SVGAnimateTransformElementConstructor SVGAnimateTransformElement; +// attribute SVGMPathElementConstructor SVGMPathElement; + attribute SVGSetElementConstructor SVGSetElement; +#endif + +#if ENABLE_SVG_FONTS && ENABLE_SVG_FONTS +// attribute SVGAltGlyphDefElementConstructor SVGAltGlyphDefElement; + attribute SVGAltGlyphElementConstructor SVGAltGlyphElement; +// attribute SVGAltGlyphItemElementConstructor SVGAltGlyphItemElement; +// attribute SVGDefinitionSrcElementConstructor SVGDefinitionSrcElement; + attribute SVGFontElementConstructor SVGFontElement; + attribute SVGFontFaceElementConstructor SVGFontFaceElement; + attribute SVGFontFaceFormatElementConstructor SVGFontFaceFormatElement; + attribute SVGFontFaceNameElementConstructor SVGFontFaceNameElement; + attribute SVGFontFaceSrcElementConstructor SVGFontFaceSrcElement; + attribute SVGFontFaceUriElementConstructor SVGFontFaceUriElement; + attribute SVGGlyphElementConstructor SVGGlyphElement; +// attribute SVGGlyphRefElementConstructor SVGGlyphRefElement; +// attribute SVGHKernElementConstructor SVGHKernElement; + attribute SVGMissingGlyphElementConstructor SVGMissingGlyphElement; +// attribute SVGVKernElementConstructor SVGVKernElement; +#endif + +#if defined(ENABLE_SVG_FOREIGN_OBJECT) && ENABLE_SVG_FOREIGN_OBJECT + attribute SVGForeignObjectElementConstructor SVGForeignObjectElement; +#endif #if defined(ENABLE_FILTERS) && ENABLE_FILTERS attribute SVGComponentTransferFunctionElementConstructor SVGComponentTransferFunctionElement; attribute SVGFEBlendElementConstructor SVGFEBlendElement; attribute SVGFEColorMatrixElementConstructor SVGFEColorMatrixElement; + attribute SVGFEComponentTransferElementConstructor SVGFEComponentTransferElement; attribute SVGFECompositeElementConstructor SVGFECompositeElement; // attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement; + attribute SVGFEDiffuseLightingElementConstructor SVGFEDiffuseLightingElement; attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement; + attribute SVGFEDistantLightElementConstructor SVGFEDistantLightElement; + attribute SVGFEFloodElementConstructor SVGFEFloodElement; + attribute SVGFEFuncAElementConstructor SVGFEFuncAElement; + attribute SVGFEFuncBElementConstructor SVGFEFuncBElement; + attribute SVGFEFuncGElementConstructor SVGFEFuncGElement; + attribute SVGFEFuncRElementConstructor SVGFEFuncRElement; + attribute SVGFEGaussianBlurElementConstructor SVGFEGaussianBlurElement; + attribute SVGFEImageElementConstructor SVGFEImageElement; + attribute SVGFEMergeElementConstructor SVGFEMergeElement; + attribute SVGFEMergeNodeElementConstructor SVGFEMergeNodeElement; attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement; + attribute SVGFEOffsetElementConstructor SVGFEOffsetElement; + attribute SVGFEPointLightElementConstructor SVGFEPointLightElement; + attribute SVGFESpecularLightingElementConstructor SVGFESpecularLightingElement; + attribute SVGFESpotLightElementConstructor SVGFESpotLightElement; + attribute SVGFETileElementConstructor SVGFETileElement; attribute SVGFETurbulenceElementConstructor SVGFETurbulenceElement; + attribute SVGFilterElementConstructor SVGFilterElement; #endif #endif +#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS + attribute TouchEventConstructor TouchEvent; +#endif + #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING @@ -575,3 +721,4 @@ module window { }; } + diff --git a/src/3rdparty/webkit/WebCore/page/DragController.cpp b/src/3rdparty/webkit/WebCore/page/DragController.cpp index 634595a..18e3195 100644 --- a/src/3rdparty/webkit/WebCore/page/DragController.cpp +++ b/src/3rdparty/webkit/WebCore/page/DragController.cpp @@ -482,21 +482,6 @@ bool DragController::canProcessDrag(DragData* dragData) return true; } -static DragOperation defaultOperationForDrag(DragOperation srcOpMask) -{ - // This is designed to match IE's operation fallback for the case where - // the page calls preventDefault() in a drag event but doesn't set dropEffect. - if (srcOpMask & DragOperationCopy) - return DragOperationCopy; - if (srcOpMask & DragOperationMove || srcOpMask & DragOperationGeneric) - return DragOperationMove; - if (srcOpMask & DragOperationLink) - return DragOperationLink; - - // FIXME: Does IE really return "generic" even if no operations were allowed by the source? - return DragOperationGeneric; -} - bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) { ASSERT(dragData); @@ -517,10 +502,8 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) return false; } - if (!clipboard->destinationOperation(operation)) { - // The element accepted but they didn't pick an operation, so we pick one (to match IE). - operation = defaultOperationForDrag(srcOpMask); - } else if (!(srcOpMask & operation)) { + operation = clipboard->destinationOperation(); + if (!(srcOpMask & operation)) { // The element picked an operation which is not supported by the source operation = DragOperationNone; } @@ -573,14 +556,9 @@ static CachedImage* getCachedImage(Element* element) static Image* getImage(Element* element) { ASSERT(element); - RenderObject* renderer = element->renderer(); - if (!renderer || !renderer->isImage()) - return 0; - - RenderImage* image = toRenderImage(renderer); - if (image->cachedImage() && !image->cachedImage()->errorOccurred()) - return image->cachedImage()->image(); - return 0; + CachedImage* cachedImage = getCachedImage(element); + return (cachedImage && !cachedImage->errorOccurred()) ? + cachedImage->image() : 0; } static void prepareClipboardForImageDrag(Frame* src, Clipboard* clipboard, Element* node, const KURL& linkURL, const KURL& imageURL, const String& label) @@ -714,10 +692,16 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s } doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, clipboard, src, true); } else if (isSelected && (m_dragSourceAction & DragSourceActionSelection)) { - RefPtr selectionRange = src->selection()->toNormalizedRange(); - ASSERT(selectionRange); - if (!clipboard->hasData()) - clipboard->writeRange(selectionRange.get(), src); + if (!clipboard->hasData()) { + if (isNodeInTextFormControl(src->selection()->start().node())) + clipboard->writePlainText(src->selectedText()); + else { + RefPtr selectionRange = src->selection()->toNormalizedRange(); + ASSERT(selectionRange); + + clipboard->writeRange(selectionRange.get(), src); + } + } m_client->willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, clipboard); if (!dragImage) { dragImage = createDragImageForSelection(src); diff --git a/src/3rdparty/webkit/WebCore/page/DragController.h b/src/3rdparty/webkit/WebCore/page/DragController.h index 9472589..3d59ebf 100644 --- a/src/3rdparty/webkit/WebCore/page/DragController.h +++ b/src/3rdparty/webkit/WebCore/page/DragController.h @@ -47,7 +47,7 @@ namespace WebCore { class Range; class SelectionController; - class DragController { + class DragController : public Noncopyable { public: DragController(Page*, DragClient*); ~DragController(); diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp index 4e97aba..0c776db 100644 --- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp +++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp @@ -29,6 +29,7 @@ #include "AXObjectCache.h" #include "CachedImage.h" +#include "Chrome.h" #include "ChromeClient.h" #include "Cursor.h" #include "Document.h" @@ -74,6 +75,11 @@ #include "SVGUseElement.h" #endif +#if ENABLE(TOUCH_EVENTS) +#include "PlatformTouchEvent.h" +#include "TouchEvent.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -120,7 +126,7 @@ static inline void scrollAndAcceptEvent(float delta, ScrollDirection positiveDir e.accept(); } -#if !PLATFORM(MAC) +#if !PLATFORM(MAC) || ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) inline bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&) { @@ -164,7 +170,7 @@ EventHandler::EventHandler(Frame* frame) , m_mouseDownTimestamp(0) , m_useLatchedWheelEventNode(false) , m_widgetIsLatched(false) -#if PLATFORM(MAC) +#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) , m_mouseDownView(nil) , m_sendingEventToSubview(false) , m_activationEventNumber(0) @@ -201,6 +207,7 @@ void EventHandler::clear() m_frameSetBeingResized = 0; #if ENABLE(DRAG_SUPPORT) m_dragTarget = 0; + m_shouldOnlyFireDragOverEvent = false; #endif m_currentMousePosition = IntPoint(); m_mousePressNode = 0; @@ -688,6 +695,14 @@ void EventHandler::autoscrollTimerFired(Timer*) #if ENABLE(PAN_SCROLLING) +void EventHandler::startPanScrolling(RenderObject* renderer) +{ + m_panScrollInProgress = true; + m_panScrollButtonPressed = true; + handleAutoscroll(renderer); + invalidateClick(); +} + void EventHandler::updatePanScrollState() { FrameView* view = m_frame->view(); @@ -1187,25 +1202,6 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) invalidateClick(); return true; } - - if (mouseEvent.button() == MiddleButton && !mev.isOverLink()) { - RenderObject* renderer = mev.targetNode()->renderer(); - - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { - if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) - renderer = renderer->document()->ownerElement()->renderer(); - else - renderer = renderer->parent(); - } - - if (renderer) { - m_panScrollInProgress = true; - m_panScrollButtonPressed = true; - handleAutoscroll(renderer); - invalidateClick(); - return true; - } - } #endif m_clickCount = mouseEvent.clickCount(); @@ -1400,8 +1396,18 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi scrollbar->mouseMoved(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering. if (Page* page = m_frame->page()) { if ((!m_resizeLayer || !m_resizeLayer->inResizeMode()) && !page->mainFrame()->eventHandler()->panScrollInProgress()) { - if (FrameView* view = m_frame->view()) - view->setCursor(selectCursor(mev, scrollbar)); + // Plugins set cursor on their own. The only case WebKit intervenes is resetting cursor to arrow on mouse enter, + // in case the particular plugin doesn't manipulate cursor at all. Thus, even a CSS cursor set on body has no + // effect on plugins (which matches Firefox). + bool overPluginElement = false; + if (mev.targetNode() && mev.targetNode()->isHTMLElement()) { + HTMLElement* el = static_cast(mev.targetNode()); + overPluginElement = el->hasTagName(appletTag) || el->hasTagName(objectTag) || el->hasTagName(embedTag); + } + if (!overPluginElement) { + if (FrameView* view = m_frame->view()) + view->setCursor(selectCursor(mev, scrollbar)); + } } } } @@ -1508,6 +1514,35 @@ bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTa return me->defaultPrevented(); } +bool EventHandler::canHandleDragAndDropForTarget(DragAndDropHandleType type, Node* target, const PlatformMouseEvent& event, Clipboard* clipboard, bool* accepted) +{ + bool canHandle = false; + bool wasAccepted = false; + + if (target->hasTagName(frameTag) || target->hasTagName(iframeTag)) { + Frame* frame = static_cast(target)->contentFrame(); + if (frame) { + switch (type) { + case UpdateDragAndDrop: + wasAccepted = frame->eventHandler()->updateDragAndDrop(event, clipboard); + break; + case CancelDragAndDrop: + frame->eventHandler()->cancelDragAndDrop(event, clipboard); + break; + case PerformDragAndDrop: + wasAccepted = frame->eventHandler()->performDragAndDrop(event, clipboard); + break; + } + } + } else + canHandle = true; + + if (accepted) + *accepted = wasAccepted; + + return canHandle; +} + bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard) { bool accept = false; @@ -1529,28 +1564,34 @@ bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, Clipboard* // FIXME: this ordering was explicitly chosen to match WinIE. However, // it is sometimes incorrect when dragging within subframes, as seen with // LayoutTests/fast/events/drag-in-frames.html. - if (newTarget) { - Frame* frame = (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag)) ? static_cast(newTarget)->contentFrame() : 0; - if (frame) - accept = frame->eventHandler()->updateDragAndDrop(event, clipboard); - else - accept = dispatchDragEvent(eventNames().dragenterEvent, newTarget, event, clipboard); + // + // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. . + if (newTarget && canHandleDragAndDropForTarget(UpdateDragAndDrop, newTarget, event, clipboard, &accept)) { + // As per section 7.9.4 of the HTML 5 spec., we must always fire a drag event before firing a dragenter, dragleave, or dragover event. + if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) { + // for now we don't care if event handler cancels default behavior, since there is none + dispatchDragSrcEvent(eventNames().dragEvent, event); + } + accept = dispatchDragEvent(eventNames().dragenterEvent, newTarget, event, clipboard); } - if (m_dragTarget) { - Frame* frame = (m_dragTarget->hasTagName(frameTag) || m_dragTarget->hasTagName(iframeTag)) ? static_cast(m_dragTarget.get())->contentFrame() : 0; - if (frame) - accept = frame->eventHandler()->updateDragAndDrop(event, clipboard); - else - dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard); + if (m_dragTarget && canHandleDragAndDropForTarget(UpdateDragAndDrop, m_dragTarget.get(), event, clipboard, &accept)) + dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard); + + if (newTarget) { + // We do not explicitly call dispatchDragEvent here because it could ultimately result in the appearance that + // two dragover events fired. So, we mark that we should only fire a dragover event on the next call to this function. + m_shouldOnlyFireDragOverEvent = true; } } else { - if (newTarget) { - Frame* frame = (newTarget->hasTagName(frameTag) || newTarget->hasTagName(iframeTag)) ? static_cast(newTarget)->contentFrame() : 0; - if (frame) - accept = frame->eventHandler()->updateDragAndDrop(event, clipboard); - else - accept = dispatchDragEvent(eventNames().dragoverEvent, newTarget, event, clipboard); + if (newTarget && canHandleDragAndDropForTarget(UpdateDragAndDrop, newTarget, event, clipboard, &accept)) { + // Note, when dealing with sub-frames, we may need to fire only a dragover event as a drag event may have been fired earlier. + if (!m_shouldOnlyFireDragOverEvent && dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) { + // for now we don't care if event handler cancels default behavior, since there is none + dispatchDragSrcEvent(eventNames().dragEvent, event); + } + accept = dispatchDragEvent(eventNames().dragoverEvent, newTarget, event, clipboard); + m_shouldOnlyFireDragOverEvent = false; } } m_dragTarget = newTarget; @@ -1560,13 +1601,10 @@ bool EventHandler::updateDragAndDrop(const PlatformMouseEvent& event, Clipboard* void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard) { - if (m_dragTarget) { - Frame* frame = (m_dragTarget->hasTagName(frameTag) || m_dragTarget->hasTagName(iframeTag)) - ? static_cast(m_dragTarget.get())->contentFrame() : 0; - if (frame) - frame->eventHandler()->cancelDragAndDrop(event, clipboard); - else - dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard); + if (m_dragTarget && canHandleDragAndDropForTarget(CancelDragAndDrop, m_dragTarget.get(), event, clipboard)) { + if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) + dispatchDragSrcEvent(eventNames().dragEvent, event); + dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard); } clearDragState(); } @@ -1574,14 +1612,8 @@ void EventHandler::cancelDragAndDrop(const PlatformMouseEvent& event, Clipboard* bool EventHandler::performDragAndDrop(const PlatformMouseEvent& event, Clipboard* clipboard) { bool accept = false; - if (m_dragTarget) { - Frame* frame = (m_dragTarget->hasTagName(frameTag) || m_dragTarget->hasTagName(iframeTag)) - ? static_cast(m_dragTarget.get())->contentFrame() : 0; - if (frame) - accept = frame->eventHandler()->performDragAndDrop(event, clipboard); - else - accept = dispatchDragEvent(eventNames().dropEvent, m_dragTarget.get(), event, clipboard); - } + if (m_dragTarget && canHandleDragAndDropForTarget(PerformDragAndDrop, m_dragTarget.get(), event, clipboard, &accept)) + dispatchDragEvent(eventNames().dropEvent, m_dragTarget.get(), event, clipboard); clearDragState(); return accept; } @@ -1590,7 +1622,8 @@ void EventHandler::clearDragState() { m_dragTarget = 0; m_capturingMouseEventsNode = 0; -#if PLATFORM(MAC) + m_shouldOnlyFireDragOverEvent = false; +#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) m_sendingEventToSubview = false; #endif } @@ -1763,7 +1796,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe return swallowEvent; } -#if !PLATFORM(GTK) +#if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && OS(LINUX)) bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const { return false; @@ -2186,14 +2219,7 @@ bool EventHandler::shouldDragAutoNode(Node* node, const IntPoint& point) const Page* page = m_frame->page(); return page && page->dragController()->mayStartDragAtEventLocation(m_frame, point); } - -void EventHandler::dragSourceMovedTo(const PlatformMouseEvent& event) -{ - if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) - // for now we don't care if event handler cancels default behavior, since there is none - dispatchDragSrcEvent(eventNames().dragEvent, event); -} - + void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperation operation) { if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) { @@ -2276,9 +2302,11 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event) return !mouseDownMayStartSelect() && !m_mouseDownMayStartAutoscroll; // We are starting a text/image/url drag, so the cursor should be an arrow - if (FrameView* view = m_frame->view()) + if (FrameView* view = m_frame->view()) { + // FIXME : Custom cursors aren't supported during drag and drop (default to pointer). view->setCursor(pointerCursor()); - + } + if (!dragHysteresisExceeded(event.event().pos())) return true; @@ -2317,11 +2345,12 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event) if (m_mouseDownMayStartDrag) { // gather values from DHTML element, if it set any - dragState().m_dragClipboard->sourceOperation(srcOp); + srcOp = dragState().m_dragClipboard->sourceOperation(); - // Yuck, dragSourceMovedTo() can be called as a result of kicking off the drag with - // dragImage! Because of that dumb reentrancy, we may think we've not started the - // drag when that happens. So we have to assume it's started before we kick it off. + // Yuck, a draggedImage:moveTo: message can be fired as a result of kicking off the + // drag with dragImage! Because of that dumb reentrancy, we may think we've not + // started the drag when that happens. So we have to assume it's started before we + // kick it off. dragState().m_dragClipboard->setDragHasStarted(); } } @@ -2517,4 +2546,142 @@ void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL } } +#if ENABLE(TOUCH_EVENTS) +bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) +{ + RefPtr touches = TouchList::create(); + RefPtr pressedTouches = TouchList::create(); + RefPtr releasedTouches = TouchList::create(); + RefPtr movedTouches = TouchList::create(); + RefPtr targetTouches = TouchList::create(); + RefPtr cancelTouches = TouchList::create(); + + const Vector& points = event.touchPoints(); + AtomicString* eventName = 0; + + for (int i = 0; i < points.size(); ++i) { + const PlatformTouchPoint& point = points[i]; + IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos()); + HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false); + Node* target = result.innerNode(); + + // Touch events should not go to text nodes + if (target && target->isTextNode()) + target = target->parentNode(); + + Document* doc = target->document(); + if (!doc) + continue; + if (!doc->hasListenerType(Document::TOUCH_LISTENER)) + continue; + + if (m_frame != doc->frame()) { + // pagePoint should always be relative to the target elements containing frame. + pagePoint = documentPointForWindowPoint(doc->frame(), point.pos()); + } + + int adjustedPageX = lroundf(pagePoint.x() / m_frame->pageZoomFactor()); + int adjustedPageY = lroundf(pagePoint.y() / m_frame->pageZoomFactor()); + + RefPtr touch = Touch::create(doc->frame(), target, point.id(), + point.screenPos().x(), point.screenPos().y(), + adjustedPageX, adjustedPageY); + + if (event.type() == TouchStart && !i) { + m_touchEventTarget = target; + m_firstTouchScreenPos = point.screenPos(); + m_firstTouchPagePos = pagePoint; + } + + if (point.state() == PlatformTouchPoint::TouchReleased) + releasedTouches->append(touch); + else if (point.state() == PlatformTouchPoint::TouchCancelled) + cancelTouches->append(touch); + else { + if (point.state() == PlatformTouchPoint::TouchPressed) + pressedTouches->append(touch); + else { + touches->append(touch); + if (m_touchEventTarget == target) + targetTouches->append(touch); + if (point.state() == PlatformTouchPoint::TouchMoved) + movedTouches->append(touch); + } + } + } + + if (!m_touchEventTarget) + return false; + + bool defaultPrevented = false; + + if (event.type() == TouchCancel) { + eventName = &eventNames().touchcancelEvent; + RefPtr cancelEv = + TouchEvent::create(TouchList::create().get(), TouchList::create().get(), cancelTouches.get(), + *eventName, m_touchEventTarget->document()->defaultView(), + m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), + m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), + event.ctrlKey(), event.altKey(), event.shiftKey(), + event.metaKey()); + + ExceptionCode ec = 0; + m_touchEventTarget->dispatchEvent(cancelEv.get(), ec); + defaultPrevented |= cancelEv->defaultPrevented(); + } + + if (releasedTouches->length() > 0) { + eventName = &eventNames().touchendEvent; + RefPtr endEv = + TouchEvent::create(touches.get(), targetTouches.get(), releasedTouches.get(), + *eventName, m_touchEventTarget->document()->defaultView(), + m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), + m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), + event.ctrlKey(), event.altKey(), event.shiftKey(), + event.metaKey()); + ExceptionCode ec = 0; + m_touchEventTarget->dispatchEvent(endEv.get(), ec); + defaultPrevented = endEv->defaultPrevented(); + } + if (pressedTouches->length() > 0) { + // Add pressed touchpoints to touches and targetTouches + for (int i = 0; i < pressedTouches->length(); ++i) { + touches->append(pressedTouches->item(i)); + if (m_touchEventTarget == pressedTouches->item(i)->target()) + targetTouches->append(pressedTouches->item(i)); + } + + eventName = &eventNames().touchstartEvent; + RefPtr startEv = + TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(), + *eventName, m_touchEventTarget->document()->defaultView(), + m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), + m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), + event.ctrlKey(), event.altKey(), event.shiftKey(), + event.metaKey()); + ExceptionCode ec = 0; + m_touchEventTarget->dispatchEvent(startEv.get(), ec); + defaultPrevented |= startEv->defaultPrevented(); + } + if (movedTouches->length() > 0) { + eventName = &eventNames().touchmoveEvent; + RefPtr moveEv = + TouchEvent::create(touches.get(), targetTouches.get(), movedTouches.get(), + *eventName, m_touchEventTarget->document()->defaultView(), + m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), + m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), + event.ctrlKey(), event.altKey(), event.shiftKey(), + event.metaKey()); + ExceptionCode ec = 0; + m_touchEventTarget->dispatchEvent(moveEv.get(), ec); + defaultPrevented |= moveEv->defaultPrevented(); + } + + if (event.type() == TouchEnd || event.type() == TouchCancel) + m_touchEventTarget = 0; + + return defaultPrevented; +} +#endif + } diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.h b/src/3rdparty/webkit/WebCore/page/EventHandler.h index 0221397..f490073 100644 --- a/src/3rdparty/webkit/WebCore/page/EventHandler.h +++ b/src/3rdparty/webkit/WebCore/page/EventHandler.h @@ -52,6 +52,7 @@ class KeyboardEvent; class MouseEventWithHitTestResults; class Node; class PlatformKeyboardEvent; +class PlatformTouchEvent; class PlatformWheelEvent; class RenderLayer; class RenderObject; @@ -60,6 +61,7 @@ class Scrollbar; class String; class SVGElementInstance; class TextEvent; +class TouchEvent; class Widget; #if ENABLE(DRAG_SUPPORT) @@ -85,6 +87,7 @@ public: Node* mousePressNode() const; void setMousePressNode(PassRefPtr); + void startPanScrolling(RenderObject*); bool panScrollInProgress() { return m_panScrollInProgress; } void setPanScrollInProgress(bool inProgress) { m_panScrollInProgress = inProgress; } @@ -159,7 +162,6 @@ public: #if ENABLE(DRAG_SUPPORT) bool eventMayStartDrag(const PlatformMouseEvent&) const; - void dragSourceMovedTo(const PlatformMouseEvent&); void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); #endif @@ -192,9 +194,19 @@ public: static NSEvent *currentNSEvent(); #endif +#if ENABLE(TOUCH_EVENTS) + bool handleTouchEvent(const PlatformTouchEvent&); +#endif + private: #if ENABLE(DRAG_SUPPORT) - struct EventHandlerDragState { + enum DragAndDropHandleType { + UpdateDragAndDrop, + CancelDragAndDrop, + PerformDragAndDrop + }; + + struct EventHandlerDragState : Noncopyable { RefPtr m_dragSrc; // element that may be a drag source, for the current mouse gesture bool m_dragSrcIsLink; bool m_dragSrcIsImage; @@ -206,6 +218,8 @@ private: }; static EventHandlerDragState& dragState(); static const double TextDragDelay; + + bool canHandleDragAndDropForTarget(DragAndDropHandleType, Node* target, const PlatformMouseEvent&, Clipboard*, bool* accepted = 0); PassRefPtr createDraggingClipboard() const; #endif // ENABLE(DRAG_SUPPORT) @@ -311,7 +325,7 @@ private: bool capturesDragging() const { return m_capturesDragging; } -#if PLATFORM(MAC) && defined(__OBJC__) +#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *mouseDownViewIfStillGood(); PlatformMouseEvent currentPlatformMouseEvent() const; @@ -368,6 +382,7 @@ private: #if ENABLE(DRAG_SUPPORT) RefPtr m_dragTarget; + bool m_shouldOnlyFireDragOverEvent; #endif RefPtr m_frameSetBeingResized; @@ -386,10 +401,17 @@ private: RefPtr m_previousWheelScrolledNode; #if PLATFORM(MAC) +#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *m_mouseDownView; bool m_sendingEventToSubview; +#endif int m_activationEventNumber; #endif +#if ENABLE(TOUCH_EVENTS) + RefPtr m_touchEventTarget; + IntPoint m_firstTouchScreenPos; + IntPoint m_firstTouchPagePos; +#endif }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.cpp b/src/3rdparty/webkit/WebCore/page/EventSource.cpp index 2c9a343..0c79998 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.cpp +++ b/src/3rdparty/webkit/WebCore/page/EventSource.cpp @@ -57,6 +57,7 @@ EventSource::EventSource(const String& url, ScriptExecutionContext* context, Exc : ActiveDOMObject(context, this) , m_state(CONNECTING) , m_reconnectTimer(this, &EventSource::reconnectTimerFired) + , m_discardTrailingNewline(false) , m_failSilently(false) , m_requestInFlight(false) , m_reconnectDelay(defaultReconnectDelay) @@ -210,21 +211,24 @@ void EventSource::parseEventStream() { unsigned int bufPos = 0; unsigned int bufSize = m_receiveBuf.size(); - for (;;) { + while (bufPos < bufSize) { + if (m_discardTrailingNewline) { + if (m_receiveBuf[bufPos] == '\n') + bufPos++; + m_discardTrailingNewline = false; + } + int lineLength = -1; int fieldLength = -1; - int carriageReturn = 0; for (unsigned int i = bufPos; lineLength < 0 && i < bufSize; i++) { switch (m_receiveBuf[i]) { case ':': if (fieldLength < 0) fieldLength = i - bufPos; break; + case '\r': + m_discardTrailingNewline = true; case '\n': - if (i > bufPos && m_receiveBuf[i - 1] == '\r') { - carriageReturn++; - i--; - } lineLength = i - bufPos; break; } @@ -234,7 +238,7 @@ void EventSource::parseEventStream() break; parseEventStreamLine(bufPos, fieldLength, lineLength); - bufPos += lineLength + carriageReturn + 1; + bufPos += lineLength + 1; } if (bufPos == bufSize) diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.h b/src/3rdparty/webkit/WebCore/page/EventSource.h index 5b037a4..d0d45cb 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.h +++ b/src/3rdparty/webkit/WebCore/page/EventSource.h @@ -36,7 +36,6 @@ #include "ActiveDOMObject.h" #include "AtomicStringHash.h" -#include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" #include "KURL.h" @@ -115,6 +114,7 @@ namespace WebCore { RefPtr m_loader; Timer m_reconnectTimer; Vector m_receiveBuf; + bool m_discardTrailingNewline; bool m_failSilently; bool m_requestInFlight; diff --git a/src/3rdparty/webkit/WebCore/page/EventSource.idl b/src/3rdparty/webkit/WebCore/page/EventSource.idl index 561bd68..ec42556 100644 --- a/src/3rdparty/webkit/WebCore/page/EventSource.idl +++ b/src/3rdparty/webkit/WebCore/page/EventSource.idl @@ -33,6 +33,7 @@ module window { interface [ Conditional=EVENTSOURCE, + CustomConstructor, EventTarget, NoStaticTables ] EventSource { diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.cpp b/src/3rdparty/webkit/WebCore/page/FocusController.cpp index 5e78c7d..bdd3151 100644 --- a/src/3rdparty/webkit/WebCore/page/FocusController.cpp +++ b/src/3rdparty/webkit/WebCore/page/FocusController.cpp @@ -38,8 +38,8 @@ #include "EventNames.h" #include "ExceptionCode.h" #include "Frame.h" -#include "FrameView.h" #include "FrameTree.h" +#include "FrameView.h" #include "HTMLFrameOwnerElement.h" #include "HTMLNames.h" #include "KeyboardEvent.h" @@ -72,14 +72,17 @@ FocusController::FocusController(Page* page) : m_page(page) , m_isActive(false) , m_isFocused(false) + , m_isChangingFocusedFrame(false) { } void FocusController::setFocusedFrame(PassRefPtr frame) { - if (m_focusedFrame == frame) + if (m_focusedFrame == frame || m_isChangingFocusedFrame) return; + m_isChangingFocusedFrame = true; + RefPtr oldFrame = m_focusedFrame; RefPtr newFrame = frame; @@ -95,6 +98,8 @@ void FocusController::setFocusedFrame(PassRefPtr frame) newFrame->selection()->setFocused(true); newFrame->document()->dispatchWindowEvent(Event::create(eventNames().focusEvent, false, false)); } + + m_isChangingFocusedFrame = false; } Frame* FocusController::focusedOrMainFrame() diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.h b/src/3rdparty/webkit/WebCore/page/FocusController.h index 33debf1..32d4060 100644 --- a/src/3rdparty/webkit/WebCore/page/FocusController.h +++ b/src/3rdparty/webkit/WebCore/page/FocusController.h @@ -28,40 +28,42 @@ #include "FocusDirection.h" #include +#include #include namespace WebCore { - class Frame; - class KeyboardEvent; - class Node; - class Page; +class Frame; +class KeyboardEvent; +class Node; +class Page; - class FocusController { - public: - FocusController(Page*); +class FocusController : public Noncopyable { +public: + FocusController(Page*); - void setFocusedFrame(PassRefPtr); - Frame* focusedFrame() const { return m_focusedFrame.get(); } - Frame* focusedOrMainFrame(); + void setFocusedFrame(PassRefPtr); + Frame* focusedFrame() const { return m_focusedFrame.get(); } + Frame* focusedOrMainFrame(); - bool setInitialFocus(FocusDirection, KeyboardEvent*); - bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false); + bool setInitialFocus(FocusDirection, KeyboardEvent*); + bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false); - bool setFocusedNode(Node*, PassRefPtr); + bool setFocusedNode(Node*, PassRefPtr); - void setActive(bool); - bool isActive() const { return m_isActive; } + void setActive(bool); + bool isActive() const { return m_isActive; } - void setFocused(bool); - bool isFocused() const { return m_isFocused; } + void setFocused(bool); + bool isFocused() const { return m_isFocused; } - private: - Page* m_page; - RefPtr m_focusedFrame; - bool m_isActive; - bool m_isFocused; - }; +private: + Page* m_page; + RefPtr m_focusedFrame; + bool m_isActive; + bool m_isFocused; + bool m_isChangingFocusedFrame; +}; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/page/Frame.cpp b/src/3rdparty/webkit/WebCore/page/Frame.cpp index fab7e3f..262c56c 100644 --- a/src/3rdparty/webkit/WebCore/page/Frame.cpp +++ b/src/3rdparty/webkit/WebCore/page/Frame.cpp @@ -36,6 +36,7 @@ #include "CSSProperty.h" #include "CSSPropertyNames.h" #include "CachedCSSStyleSheet.h" +#include "Chrome.h" #include "DOMWindow.h" #include "DocLoader.h" #include "DocumentType.h" @@ -74,6 +75,7 @@ #include "TextIterator.h" #include "TextResourceDecoder.h" #include "UserContentURLPattern.h" +#include "XMLNSNames.h" #include "XMLNames.h" #include "htmlediting.h" #include "markup.h" @@ -82,6 +84,10 @@ #include #include +#if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) +#import +#endif + #if USE(JSC) #include "JSDOMWindowShell.h" #include "runtime_root.h" @@ -128,7 +134,6 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* , m_script(this) , m_selectionGranularity(CharacterGranularity) , m_selectionController(this) - , m_caretBlinkTimer(this, &Frame::caretBlinkTimerFired) , m_editor(this) , m_eventHandler(this) , m_animationController(this) @@ -136,8 +141,6 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* #if ENABLE(ORIENTATION_EVENTS) , m_orientation(0) #endif - , m_caretVisible(false) - , m_caretPaint(true) , m_highlightTextMatches(false) , m_inViewSourceMode(false) , m_needsReapplyStyles(false) @@ -165,6 +168,7 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* MathMLNames::init(); #endif + XMLNSNames::init(); XMLNames::init(); if (!ownerElement) @@ -292,7 +296,7 @@ void Frame::sendOrientationChangeEvent(int orientation) { m_orientation = orientation; if (Document* doc = document()) - doc->dispatchWindowEvent(eventNames().orientationchangeEvent, false, false); + doc->dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent, false, false)); } #endif // ENABLE(ORIENTATION_EVENTS) @@ -411,7 +415,7 @@ static RegularExpression* createRegExpForLabels(const Vector& labels) return new RegularExpression(pattern, TextCaseInsensitive); } -String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell) +String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell) { RenderObject* cellRenderer = cell->renderer(); @@ -425,23 +429,30 @@ String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellE if (aboveCell) { // search within the above cell we found for a match + size_t lengthSearched = 0; for (Node* n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) { if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) { // For each text chunk, run the regexp String nodeString = n->nodeValue(); int pos = regExp->searchRev(nodeString); - if (pos >= 0) + if (pos >= 0) { + if (resultDistanceFromStartOfCell) + *resultDistanceFromStartOfCell = lengthSearched; return nodeString.substring(pos, regExp->matchedLength()); + } + lengthSearched += nodeString.length(); } } } } } // Any reason in practice to search all cells in that are above cell? + if (resultDistanceFromStartOfCell) + *resultDistanceFromStartOfCell = notFound; return String(); } -String Frame::searchForLabelsBeforeElement(const Vector& labels, Element* element) +String Frame::searchForLabelsBeforeElement(const Vector& labels, Element* element, size_t* resultDistance, bool* resultIsInCellAbove) { OwnPtr regExp(createRegExpForLabels(labels)); // We stop searching after we've seen this many chars @@ -453,6 +464,11 @@ String Frame::searchForLabelsBeforeElement(const Vector& labels, Element HTMLTableCellElement* startingTableCell = 0; bool searchedCellAbove = false; + if (resultDistance) + *resultDistance = notFound; + if (resultIsInCellAbove) + *resultIsInCellAbove = false; + // walk backwards in the node tree, until another element, or form, or end of tree int unsigned lengthSearched = 0; Node* n; @@ -468,9 +484,12 @@ String Frame::searchForLabelsBeforeElement(const Vector& labels, Element } else if (n->hasTagName(tdTag) && !startingTableCell) { startingTableCell = static_cast(n); } else if (n->hasTagName(trTag) && startingTableCell) { - String result = searchForLabelsAboveCell(regExp.get(), startingTableCell); - if (!result.isEmpty()) + String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance); + if (!result.isEmpty()) { + if (resultIsInCellAbove) + *resultIsInCellAbove = true; return result; + } searchedCellAbove = true; } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) { // For each text chunk, run the regexp @@ -479,38 +498,48 @@ String Frame::searchForLabelsBeforeElement(const Vector& labels, Element if (lengthSearched + nodeString.length() > maxCharsSearched) nodeString = nodeString.right(charsSearchedThreshold - lengthSearched); int pos = regExp->searchRev(nodeString); - if (pos >= 0) + if (pos >= 0) { + if (resultDistance) + *resultDistance = lengthSearched; return nodeString.substring(pos, regExp->matchedLength()); + } lengthSearched += nodeString.length(); } } // If we started in a cell, but bailed because we found the start of the form or the // previous element, we still might need to search the row above us for a label. - if (startingTableCell && !searchedCellAbove) - return searchForLabelsAboveCell(regExp.get(), startingTableCell); + if (startingTableCell && !searchedCellAbove) { + String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance); + if (!result.isEmpty()) { + if (resultIsInCellAbove) + *resultIsInCellAbove = true; + return result; + } + } return String(); } -String Frame::matchLabelsAgainstElement(const Vector& labels, Element* element) +static String matchLabelsAgainstString(const Vector& labels, const String& stringToMatch) { - String name = element->getAttribute(nameAttr); - if (name.isEmpty()) + if (stringToMatch.isEmpty()) return String(); - // Make numbers and _'s in field names behave like word boundaries, e.g., "address2" - replace(name, RegularExpression("\\d", TextCaseSensitive), " "); - name.replace('_', ' '); + String mutableStringToMatch = stringToMatch; + // Make numbers and _'s in field names behave like word boundaries, e.g., "address2" + replace(mutableStringToMatch, RegularExpression("\\d", TextCaseSensitive), " "); + mutableStringToMatch.replace('_', ' '); + OwnPtr regExp(createRegExpForLabels(labels)); - // Use the largest match we can find in the whole name string + // Use the largest match we can find in the whole string int pos; int length; int bestPos = -1; int bestLength = -1; int start = 0; do { - pos = regExp->match(name, start); + pos = regExp->match(mutableStringToMatch, start); if (pos != -1) { length = regExp->matchedLength(); if (length >= bestLength) { @@ -520,11 +549,24 @@ String Frame::matchLabelsAgainstElement(const Vector& labels, Element* e start = pos + 1; } } while (pos != -1); - + if (bestPos != -1) - return name.substring(bestPos, bestLength); + return mutableStringToMatch.substring(bestPos, bestLength); return String(); } + +String Frame::matchLabelsAgainstElement(const Vector& labels, Element* element) +{ + // Match against the name element, then against the id element if no match is found for the name element. + // See 7538330 for one popular site that benefits from the id element check. + // FIXME: This code is mirrored in FrameMac.mm. It would be nice to make the Mac code call the platform-agnostic + // code, which would require converting the NSArray of NSStrings to a Vector of Strings somewhere along the way. + String resultFromNameAttribute = matchLabelsAgainstString(labels, element->getAttribute(nameAttr)); + if (!resultFromNameAttribute.isEmpty()) + return resultFromNameAttribute; + + return matchLabelsAgainstString(labels, element->getAttribute(idAttr)); +} const VisibleSelection& Frame::mark() const { @@ -552,31 +594,6 @@ void Frame::notifyRendererOfSelectionChange(bool userTriggered) toRenderTextControl(renderer)->selectionChanged(userTriggered); } -void Frame::invalidateSelection() -{ - selection()->setNeedsLayout(); - selectionLayoutChanged(); -} - -void Frame::setCaretVisible(bool flag) -{ - if (m_caretVisible == flag) - return; - clearCaretRectIfNeeded(); - m_caretVisible = flag; - selectionLayoutChanged(); -} - -void Frame::clearCaretRectIfNeeded() -{ -#if ENABLE(TEXT_CARET) - if (m_caretPaint) { - m_caretPaint = false; - selection()->invalidateCaretRect(); - } -#endif -} - // Helper function that tells whether a particular node is an element that has an entire // Frame and FrameView, a , + + + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html new file mode 100644 index 0000000..0d3a22f --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/resources/testiframe2.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css deleted file mode 100644 index c05b747..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css +++ /dev/null @@ -1 +0,0 @@ -#idP {color: red !important} diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test1.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test1.html deleted file mode 100644 index b323f96..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test1.html +++ /dev/null @@ -1 +0,0 @@ -

Some text 1

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test2.html deleted file mode 100644 index 63ac1f6..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/test2.html +++ /dev/null @@ -1 +0,0 @@ -

Some text 2

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html deleted file mode 100644 index 9f3ae85..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - -
You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. -You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. -You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. -You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. -You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible. -You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
- - - - \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html deleted file mode 100644 index 1913a89..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -
- - \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 609f8b4..ba684fa 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,40 +38,6 @@ #endif #include "../util.h" -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif - -//TESTED_CLASS= -//TESTED_FILES= - -// Task 160192 -/** - * Starts an event loop that runs until the given signal is received. - Optionally the event loop - * can return earlier on a timeout. - * - * \return \p true if the requested signal was received - * \p false on timeout - */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) -{ - QEventLoop loop; - QObject::connect(obj, signal, &loop, SLOT(quit())); - QTimer timer; - QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); - if (timeout > 0) { - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.setSingleShot(true); - timer.start(timeout); - } - loop.exec(); - return timeoutSpy.isEmpty(); -} - -/* Mostly a test for the JavaScript related parts of QWebFrame */ - - struct CustomType { QString string; }; @@ -100,6 +66,7 @@ class MyQObject : public QObject Q_PROPERTY(int readOnlyProperty READ readOnlyProperty) Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut) Q_PROPERTY(CustomType propWithCustomType READ propWithCustomType WRITE setPropWithCustomType) + Q_PROPERTY(QWebElement webElementProperty READ webElementProperty WRITE setWebElementProperty) Q_ENUMS(Policy Strategy) Q_FLAGS(Ability) @@ -215,6 +182,14 @@ public: m_shortcut = seq; } + QWebElement webElementProperty() const { + return m_webElement; + } + + void setWebElementProperty(const QWebElement& element) { + m_webElement = element; + } + CustomType propWithCustomType() const { return m_customType; } @@ -467,6 +442,10 @@ public Q_SLOTS: m_qtFunctionInvoked = 35; m_actuals << arg; } + void myOverloadedSlot(const QWebElement &arg) { + m_qtFunctionInvoked = 36; + m_actuals << QVariant::fromValue(arg); + } void qscript_call(int arg) { m_qtFunctionInvoked = 40; @@ -501,6 +480,7 @@ private: int m_writeOnlyValue; int m_readOnlyValue; QKeySequence m_shortcut; + QWebElement m_webElement; CustomType m_customType; int m_qtFunctionInvoked; QVariantList m_actuals; @@ -580,6 +560,7 @@ private slots: void enumerate(); void objectDeleted(); void typeConversion(); + void arrayObjectEnumerable(); void symmetricUrl(); void progressSignal(); void urlChange(); @@ -604,9 +585,12 @@ private slots: void hasSetFocus(); void render(); void scrollPosition(); + void scrollToAnchor(); void evaluateWillCauseRepaint(); void qObjectWrapperWithSameIdentity(); void scrollRecursively(); + void introspectQtMethods_data(); + void introspectQtMethods(); private: QString evalJS(const QString&s) { @@ -707,7 +691,6 @@ void tst_QWebFrame::init() m_page = m_view->page(); m_myObject = new MyQObject(); m_page->mainFrame()->addToJavaScriptWindowObject("myObject", m_myObject); - QDir::setCurrent(SRCDIR); } void tst_QWebFrame::cleanup() @@ -718,6 +701,7 @@ void tst_QWebFrame::cleanup() void tst_QWebFrame::getSetStaticProperty() { + m_page->mainFrame()->setHtml(""); QCOMPARE(evalJS("typeof myObject.noSuchProperty"), sUndefined); // initial value (set in MyQObject constructor) @@ -857,6 +841,8 @@ void tst_QWebFrame::getSetStaticProperty() QCOMPARE(evalJS("myObject.stringListProperty[1]"), QLatin1String("two")); QCOMPARE(evalJS("typeof myObject.stringListProperty[2]"), sString); QCOMPARE(evalJS("myObject.stringListProperty[2]"), QLatin1String("true")); + evalJS("myObject.webElementProperty=document.body;"); + QCOMPARE(evalJS("myObject.webElementProperty.tagName"), QLatin1String("BODY")); // try to delete QCOMPARE(evalJS("delete myObject.intProperty"), sFalse); @@ -1919,6 +1905,12 @@ void tst_QWebFrame::overloadedSlots() f.call(QString(), QStringList() << m_engine->newVariant(QVariant("ciao"))); QCOMPARE(m_myObject->qtFunctionInvoked(), 35); */ + + // should pick myOverloadedSlot(QRegExp) + m_myObject->resetQtFunctionInvoked(); + evalJS("myObject.myOverloadedSlot(document.body)"); + QCOMPARE(m_myObject->qtFunctionInvoked(), 36); + // should pick myOverloadedSlot(QObject*) m_myObject->resetQtFunctionInvoked(); evalJS("myObject.myOverloadedSlot(myObject)"); @@ -2102,6 +2094,31 @@ void tst_QWebFrame::typeConversion() // ### RegExps } +class StringListTestObject : public QObject { + Q_OBJECT +public Q_SLOTS: + QVariant stringList() + { + return QStringList() << "Q" << "t"; + }; +}; + +void tst_QWebFrame::arrayObjectEnumerable() +{ + QWebPage page; + QWebFrame* frame = page.mainFrame(); + QObject* qobject = new StringListTestObject(); + frame->addToJavaScriptWindowObject("test", qobject, QScriptEngine::ScriptOwnership); + + const QString script("var stringArray = test.stringList();" + "var result = '';" + "for (var i in stringArray) {" + " result += stringArray[i];" + "}" + "result;"); + QCOMPARE(frame->evaluateJavaScript(script).toString(), QString::fromLatin1("Qt")); +} + void tst_QWebFrame::symmetricUrl() { QVERIFY(m_view->url().isEmpty()); @@ -2245,7 +2262,7 @@ protected: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest& request, QIODevice* outgoingData) { QString url = request.url().toString(); - if (op == QNetworkAccessManager::GetOperation) + if (op == QNetworkAccessManager::GetOperation) { if (url == "qrc:/test1.html" || url == "http://abcdef.abcdef/") return new FakeReply(request, this); #ifndef QT_NO_OPENSSL @@ -2256,6 +2273,7 @@ protected: return reply; } #endif + } return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -2272,19 +2290,19 @@ void tst_QWebFrame::requestedUrl() page.setNetworkAccessManager(networkManager); frame->setUrl(QUrl("qrc:/test1.html")); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.count(), 1); QCOMPARE(frame->requestedUrl(), QUrl("qrc:/test1.html")); QCOMPARE(frame->url(), QUrl("qrc:/test2.html")); frame->setUrl(QUrl("qrc:/non-existent.html")); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.count(), 2); QCOMPARE(frame->requestedUrl(), QUrl("qrc:/non-existent.html")); QCOMPARE(frame->url(), QUrl("qrc:/non-existent.html")); frame->setUrl(QUrl("http://abcdef.abcdef")); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.count(), 3); QCOMPARE(frame->requestedUrl(), QUrl("http://abcdef.abcdef/")); QCOMPARE(frame->url(), QUrl("http://abcdef.abcdef/")); @@ -2295,7 +2313,7 @@ void tst_QWebFrame::requestedUrl() QSignalSpy spy2(page.networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*,QList))); frame->setUrl(QUrl("qrc:/fake-ssl-error.html")); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy2.count(), 1); QCOMPARE(frame->requestedUrl(), QUrl("qrc:/fake-ssl-error.html")); QCOMPARE(frame->url(), QUrl("qrc:/fake-ssl-error.html")); @@ -2353,7 +2371,7 @@ void tst_QWebFrame::setHtmlWithResource() // in few seconds, the image should be completey loaded QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); frame->setHtml(html); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.count(), 1); QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); @@ -2372,7 +2390,7 @@ void tst_QWebFrame::setHtmlWithResource() // in few seconds, the CSS should be completey loaded frame->setHtml(html2); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.size(), 2); QWebElement p = frame->documentElement().findAll("p").at(0); @@ -2381,6 +2399,11 @@ void tst_QWebFrame::setHtmlWithResource() void tst_QWebFrame::setHtmlWithBaseURL() { + if (!QDir(TESTS_SOURCE_DIR).exists()) + QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll); + + QDir::setCurrent(TESTS_SOURCE_DIR); + QString html("

hello world

"); QWebPage page; @@ -2389,8 +2412,8 @@ void tst_QWebFrame::setHtmlWithBaseURL() // in few seconds, the image should be completey loaded QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); - frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); - QTest::qWait(200); + frame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR)); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(spy.count(), 1); QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); @@ -2522,21 +2545,22 @@ void tst_QWebFrame::popupFocus() QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); QComboBox* combo = qobject_cast(webpopup); + QVERIFY(combo != 0); QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup // hide the popup and check if focus is on the page combo->hidePopup(); QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView - // triple the flashing time, should at least blink twice already - int delay = qApp->cursorFlashTime() * 3; + // double the flashing time, should at least blink once already + int delay = qApp->cursorFlashTime() * 2; // focus the lineedit and check if it blinks QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(200, 25)); m_popupTestView = &view; view.installEventFilter( this ); QTest::qWait(delay); - QVERIFY2(m_popupTestPaintCount >= 4, + QVERIFY2(m_popupTestPaintCount >= 3, "The input field should have a blinking caret"); } @@ -2680,7 +2704,7 @@ void tst_QWebFrame::hasSetFocus() QSignalSpy loadSpy(m_page, SIGNAL(loadFinished(bool))); m_page->mainFrame()->setHtml(html); - QTest::qWait(200); + waitForSignal(m_page->mainFrame(), SIGNAL(loadFinished(bool)), 200); QCOMPARE(loadSpy.size(), 1); QList children = m_page->mainFrame()->childFrames(); @@ -2690,7 +2714,7 @@ void tst_QWebFrame::hasSetFocus() ""); frame->setHtml(innerHtml); - QTest::qWait(200); + waitForSignal(frame, SIGNAL(loadFinished(bool)), 200); QCOMPARE(loadSpy.size(), 2); m_page->mainFrame()->setFocus(); @@ -2769,6 +2793,38 @@ void tst_QWebFrame::scrollPosition() QCOMPARE(y, 29); } +void tst_QWebFrame::scrollToAnchor() +{ + QWebPage page; + page.setViewportSize(QSize(480, 800)); + QWebFrame* frame = page.mainFrame(); + + QString html("

Hello.

" + "

This is an anchor

" + "

This is another anchor

" + ""); + frame->setHtml(html); + frame->setScrollPosition(QPoint(0, 0)); + QCOMPARE(frame->scrollPosition().x(), 0); + QCOMPARE(frame->scrollPosition().y(), 0); + + QWebElement fooAnchor = frame->findFirstElement("a[id=foo]"); + + frame->scrollToAnchor("foo"); + QCOMPARE(frame->scrollPosition().y(), fooAnchor.geometry().top()); + + frame->scrollToAnchor("bar"); + frame->scrollToAnchor("foo"); + QCOMPARE(frame->scrollPosition().y(), fooAnchor.geometry().top()); + + frame->scrollToAnchor("top"); + QCOMPARE(frame->scrollPosition().y(), 0); + + frame->scrollToAnchor("bar"); + frame->scrollToAnchor("notexist"); + QVERIFY(frame->scrollPosition().y() != 0); +} + void tst_QWebFrame::evaluateWillCauseRepaint() { QWebView view; @@ -2777,14 +2833,16 @@ void tst_QWebFrame::evaluateWillCauseRepaint() view.setHtml(html); view.show(); - QTest::qWait(200); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QTest::qWaitForWindowShown(&view); +#else + QTest::qWait(2000); +#endif view.page()->mainFrame()->evaluateJavaScript( "document.getElementById('junk').style.display = 'none';"); ::waitForSignal(view.page(), SIGNAL(repaintRequested(QRect))); - - QTest::qWait(2000); } class TestFactory : public QObject @@ -2825,8 +2883,6 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity() QCOMPARE(mainFrame->toPlainText(), QString("test2")); } -bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy); - void tst_QWebFrame::scrollRecursively() { // The test content is @@ -2850,7 +2906,7 @@ void tst_QWebFrame::scrollRecursively() // verify scrolled // verify scroll postion changed QPoint scrollPosition(webPage->mainFrame()->scrollPosition()); - QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 10, 10)); + QVERIFY(webPage->mainFrame()->scrollRecursively(10, 10)); QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); // 2nd test @@ -2860,7 +2916,7 @@ void tst_QWebFrame::scrollRecursively() // verify parent's scroll position did not change scrollPosition = webPage->mainFrame()->scrollPosition(); QPoint childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), 10, 10)); + QVERIFY(children.at(0)->scrollRecursively(10, 10)); QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); @@ -2873,7 +2929,7 @@ void tst_QWebFrame::scrollRecursively() webPage->event(&evpres); scrollPosition = webPage->mainFrame()->scrollPosition(); childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 5, 5)); + QVERIFY(webPage->mainFrame()->scrollRecursively(5, 5)); QVERIFY(childScrollPosition == children.at(0)->scrollPosition()); QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition()); @@ -2883,13 +2939,55 @@ void tst_QWebFrame::scrollRecursively() // verify parent's scroll == true second time // verify parent and childs scroll position changed childScrollPosition = children.at(0)->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); + QVERIFY(children.at(0)->scrollRecursively(-10, -10)); QVERIFY(childScrollPosition != children.at(0)->scrollPosition()); scrollPosition = webPage->mainFrame()->scrollPosition(); - QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10)); + QVERIFY(children.at(0)->scrollRecursively(-10, -10)); QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition()); } +void tst_QWebFrame::introspectQtMethods_data() +{ + QTest::addColumn("objectExpression"); + QTest::addColumn("methodName"); + QTest::addColumn("expectedPropertyNames"); + + QTest::newRow("myObject.mySignal") + << "myObject" << "mySignal" << (QStringList() << "connect" << "disconnect" << "length" << "name"); + QTest::newRow("myObject.mySlot") + << "myObject" << "mySlot" << (QStringList() << "connect" << "disconnect" << "length" << "name"); + QTest::newRow("myObject.myInvokable") + << "myObject" << "myInvokable" << (QStringList() << "connect" << "disconnect" << "length" << "name"); + QTest::newRow("myObject.mySignal.connect") + << "myObject.mySignal" << "connect" << (QStringList() << "length" << "name"); + QTest::newRow("myObject.mySignal.disconnect") + << "myObject.mySignal" << "disconnect" << (QStringList() << "length" << "name"); +} + +void tst_QWebFrame::introspectQtMethods() +{ + QFETCH(QString, objectExpression); + QFETCH(QString, methodName); + QFETCH(QStringList, expectedPropertyNames); + + QString methodLookup = QString::fromLatin1("%0['%1']").arg(objectExpression).arg(methodName); + QCOMPARE(evalJSV(QString::fromLatin1("Object.getOwnPropertyNames(%0).sort()").arg(methodLookup)).toStringList(), expectedPropertyNames); + + for (int i = 0; i < expectedPropertyNames.size(); ++i) { + QString name = expectedPropertyNames.at(i); + QCOMPARE(evalJS(QString::fromLatin1("%0.hasOwnProperty('%1')").arg(methodLookup).arg(name)), sTrue); + evalJS(QString::fromLatin1("var descriptor = Object.getOwnPropertyDescriptor(%0, '%1')").arg(methodLookup).arg(name)); + QCOMPARE(evalJS("typeof descriptor"), QString::fromLatin1("object")); + QCOMPARE(evalJS("descriptor.get"), sUndefined); + QCOMPARE(evalJS("descriptor.set"), sUndefined); + QCOMPARE(evalJS(QString::fromLatin1("descriptor.value === %0['%1']").arg(methodLookup).arg(name)), sTrue); + QCOMPARE(evalJS(QString::fromLatin1("descriptor.enumerable")), sFalse); + QCOMPARE(evalJS(QString::fromLatin1("descriptor.configurable")), sFalse); + } + + QVERIFY(evalJSV("var props=[]; for (var p in myObject.deleteLater) {props.push(p);}; props.sort()").toStringList().isEmpty()); +} + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc new file mode 100644 index 0000000..2a7d0b9 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.qrc @@ -0,0 +1,10 @@ + + +resources/image.png +resources/style.css +resources/test1.html +resources/test2.html +resources/testiframe.html +resources/testiframe2.html + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page1.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page1.html deleted file mode 100644 index 82fa4af..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page1.html +++ /dev/null @@ -1 +0,0 @@ -page1

page1

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page2.html deleted file mode 100644 index 5307bdc..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page2.html +++ /dev/null @@ -1 +0,0 @@ -page2

page2

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page3.html deleted file mode 100644 index 4e5547c..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page3.html +++ /dev/null @@ -1 +0,0 @@ -page3

page3

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page4.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page4.html deleted file mode 100644 index 3c57aed..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page4.html +++ /dev/null @@ -1 +0,0 @@ -page4

page4

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page5.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page5.html deleted file mode 100644 index 8593552..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page5.html +++ /dev/null @@ -1 +0,0 @@ -page5

page5

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page6.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page6.html deleted file mode 100644 index c5bbc6f..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/data/page6.html +++ /dev/null @@ -1 +0,0 @@ -page6

page6

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 7445e3b..4ca2bf6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -1,12 +1 @@ -TEMPLATE = app -TARGET = tst_qwebhistory -include(../../../../WebKit.pri) -SOURCES += tst_qwebhistory.cpp -RESOURCES += tst_qwebhistory.qrc -QT += testlib network -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR - -symbian { - TARGET.UID3 = 0xA000E53B - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} +include(../tests.pri) \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html new file mode 100644 index 0000000..82fa4af --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page1.html @@ -0,0 +1 @@ +page1

page1

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html new file mode 100644 index 0000000..5307bdc --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page2.html @@ -0,0 +1 @@ +page2

page2

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html new file mode 100644 index 0000000..4e5547c --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page3.html @@ -0,0 +1 @@ +page3

page3

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html new file mode 100644 index 0000000..3c57aed --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page4.html @@ -0,0 +1 @@ +page4

page4

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html new file mode 100644 index 0000000..8593552 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page5.html @@ -0,0 +1 @@ +page5

page5

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html new file mode 100644 index 0000000..c5bbc6f --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/resources/page6.html @@ -0,0 +1 @@ +page6

page6

diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index ec2d497..e967dcc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -37,7 +37,7 @@ public: protected : void loadPage(int nr) { - frame->load(QUrl("qrc:/data/page" + QString::number(nr) + ".html")); + frame->load(QUrl("qrc:/resources/page" + QString::number(nr) + ".html")); waitForLoadFinished.exec(); } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc index 7c5ff0e..6e2f50a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.qrc @@ -1,11 +1,11 @@ - data/page1.html - data/page2.html - data/page3.html - data/page4.html - data/page5.html - data/page6.html + resources/page1.html + resources/page2.html + resources/page3.html + resources/page4.html + resources/page5.html + resources/page6.html diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 764f806..4ca2bf6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -1,11 +1 @@ -TEMPLATE = app -TARGET = tst_qwebhistoryinterface -include(../../../../WebKit.pri) -SOURCES += tst_qwebhistoryinterface.cpp -QT += testlib network -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR - -symbian { - TARGET.UID3 = 0xA000E53C - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} +include(../tests.pri) \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro new file mode 100644 index 0000000..e99c7f4 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/qwebinspector.pro @@ -0,0 +1 @@ +include(../tests.pri) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp new file mode 100644 index 0000000..12cd630 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebinspector/tst_qwebinspector.cpp @@ -0,0 +1,68 @@ +/* + 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. +*/ + +#include + +#include +#include +#include +#include + +class tst_QWebInspector : public QObject { + Q_OBJECT + +private slots: + void attachAndDestroy(); +}; + +void tst_QWebInspector::attachAndDestroy() +{ + { // External inspector + manual destruction of page first + QWebPage* page = new QWebPage(); + page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + QWebInspector* inspector = new QWebInspector(); + inspector->setPage(page); + page->updatePositionDependentActions(QPoint(0, 0)); + page->triggerAction(QWebPage::InspectElement); + + delete page; + delete inspector; + } + { // External inspector + manual destruction of inspector first + QWebPage* page = new QWebPage(); + page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + QWebInspector* inspector = new QWebInspector(); + inspector->setPage(page); + page->updatePositionDependentActions(QPoint(0, 0)); + page->triggerAction(QWebPage::InspectElement); + + delete inspector; + delete page; + } + { // Internal inspector + QWebPage page; + page.settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + page.updatePositionDependentActions(QPoint(0, 0)); + page.triggerAction(QWebPage::InspectElement); + } +} + +QTEST_MAIN(tst_QWebInspector) + +#include "tst_qwebinspector.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html deleted file mode 100644 index 9ff68f1..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html +++ /dev/null @@ -1,2 +0,0 @@ -Google -Yahoo diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html deleted file mode 100644 index f17027c..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe.html +++ /dev/null @@ -1,6 +0,0 @@ - - -

top

- - - - diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html deleted file mode 100644 index ed6ac5b..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/iframe3.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

inner

- - diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html deleted file mode 100644 index c53ad09..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 7853b28..4ca2bf6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -1,13 +1 @@ -TEMPLATE = app -TARGET = tst_qwebpage -include(../../../../WebKit.pri) -SOURCES += tst_qwebpage.cpp -RESOURCES += tst_qwebpage.qrc -QT += testlib network -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" - -symbian { - TARGET.UID3 = 0xA000E53E - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} +include(../tests.pri) \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/frame_a.html @@ -0,0 +1,2 @@ +Google +Yahoo diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html new file mode 100644 index 0000000..f17027c --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe.html @@ -0,0 +1,6 @@ + + +

top

+ + + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html new file mode 100644 index 0000000..ed6ac5b --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/iframe3.html @@ -0,0 +1,5 @@ + + +

inner

+ + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/resources/index.html @@ -0,0 +1,4 @@ + + + + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 0e04acc..ba7a87e 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -19,72 +19,24 @@ Boston, MA 02110-1301, USA. */ - +#include "../util.h" +#include +#include +#include +#include +#include #include - #include #include #include +#include +#include #include -#include -#include -#include -#include #include #include -#include -#include -#include -#include +#include #include -#include -#include -#include - -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif - -// Will try to wait for the condition while allowing event processing -#define QTRY_COMPARE(__expr, __expected) \ - do { \ - const int __step = 50; \ - const int __timeout = 5000; \ - if ((__expr) != (__expected)) { \ - QTest::qWait(0); \ - } \ - for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ - QTest::qWait(__step); \ - } \ - QCOMPARE(__expr, __expected); \ - } while(0) - -//TESTED_CLASS= -//TESTED_FILES= - -// Task 160192 -/** - * Starts an event loop that runs until the given signal is received. - Optionally the event loop - * can return earlier on a timeout. - * - * \return \p true if the requested signal was received - * \p false on timeout - */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) -{ - QEventLoop loop; - QObject::connect(obj, signal, &loop, SLOT(quit())); - QTimer timer; - QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); - if (timeout > 0) { - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.setSingleShot(true); - timer.start(timeout); - } - loop.exec(); - return timeoutSpy.isEmpty(); -} +#include class EventSpy : public QObject, public QList { @@ -148,6 +100,8 @@ private slots: void inputMethods(); void defaultTextEncoding(); void errorPageExtension(); + void errorPageExtensionInIFrames(); + void errorPageExtensionInFrameset(); void crashTests_LazyInitializationOfMainFrame(); @@ -156,6 +110,7 @@ private slots: void originatingObjectInNetworkRequests(); void testJSPrompt(); + void showModalDialog(); private: QWebView* m_view; @@ -270,10 +225,8 @@ void tst_QWebPage::loadFinished() ""), QUrl()); QTRY_COMPARE(spyLoadFinished.count(), 1); - QTest::qWait(3000); - - QVERIFY(spyLoadStarted.count() > 1); - QVERIFY(spyLoadFinished.count() > 1); + QTRY_VERIFY(spyLoadStarted.count() > 1); + QTRY_VERIFY(spyLoadFinished.count() > 1); spyLoadFinished.clear(); @@ -520,7 +473,6 @@ void tst_QWebPage::database() // Remove removed test :-) QWebDatabase::removeAllDatabases(); QVERIFY(!origin.databases().size()); - QTest::qWait(1000); } class PluginPage : public QWebPage @@ -1275,7 +1227,7 @@ void tst_QWebPage::backActionUpdate() QAction *action = page->action(QWebPage::Back); QVERIFY(!action->isEnabled()); QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool))); - QUrl url = QUrl("qrc:///frametest/index.html"); + QUrl url = QUrl("qrc:///resources/index.html"); page->mainFrame()->load(url); QTRY_COMPARE(loadSpy.count(), 1); QVERIFY(!action->isEnabled()); @@ -1306,7 +1258,7 @@ void tst_QWebPage::frameAt() QWebView webView; QWebPage* webPage = webView.page(); QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool))); - QUrl url = QUrl("qrc:///frametest/iframe.html"); + QUrl url = QUrl("qrc:///resources/iframe.html"); webPage->mainFrame()->load(url); QTRY_COMPARE(loadSpy.count(), 1); frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos()); @@ -1535,10 +1487,17 @@ void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector() void tst_QWebPage::localURLSchemes() { int i = QWebSecurityOrigin::localSchemes().size(); + QWebSecurityOrigin::removeLocalScheme("file"); QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); QWebSecurityOrigin::addLocalScheme("file"); QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); + + QWebSecurityOrigin::removeLocalScheme("qrc"); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i - 1); + QWebSecurityOrigin::addLocalScheme("qrc"); + QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i); + QString myscheme = "myscheme"; QWebSecurityOrigin::addLocalScheme(myscheme); QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i + 1); @@ -1593,16 +1552,14 @@ void tst_QWebPage::testEnablePersistentStorage() QWebSettings::enablePersistentStorage(); - // Give it some time to initialize - icon database needs it - QTest::qWait(1000); - QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true); - QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true); - QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true); + QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true); + QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true); + QTRY_COMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true); - QVERIFY(!webPage.settings()->offlineStoragePath().isEmpty()); - QVERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty()); - QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty()); + QTRY_VERIFY(!webPage.settings()->offlineStoragePath().isEmpty()); + QTRY_VERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty()); + QTRY_VERIFY(!webPage.settings()->iconDatabasePath().isEmpty()); } void tst_QWebPage::defaultTextEncoding() @@ -1644,15 +1601,10 @@ public: virtual bool extension(Extension, const ExtensionOption* option, ExtensionReturn* output) { - const ErrorPageExtensionOption* info = static_cast(option); ErrorPageExtensionReturn* errorPage = static_cast(output); - if (info->frame == mainFrame()) { - errorPage->content = "data:text/html,error"; - return true; - } - - return false; + errorPage->content = "data:text/html,error"; + return true; } }; @@ -1663,11 +1615,10 @@ void tst_QWebPage::errorPageExtension() QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); - page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); + m_view->setUrl(QUrl("data:text/html,foo")); QTRY_COMPARE(spyLoadFinished.count(), 1); page->mainFrame()->setUrl(QUrl("http://non.existent/url")); - QTest::qWait(2000); QTRY_COMPARE(spyLoadFinished.count(), 2); QCOMPARE(page->mainFrame()->toPlainText(), QString("data:text/html,error")); QCOMPARE(page->history()->count(), 2); @@ -1676,20 +1627,48 @@ void tst_QWebPage::errorPageExtension() QCOMPARE(page->history()->canGoForward(), false); page->triggerAction(QWebPage::Back); - QTest::qWait(2000); - QCOMPARE(page->history()->canGoBack(), false); - QCOMPARE(page->history()->canGoForward(), true); + QTRY_COMPARE(page->history()->canGoBack(), false); + QTRY_COMPARE(page->history()->canGoForward(), true); page->triggerAction(QWebPage::Forward); - QTest::qWait(2000); - QCOMPARE(page->history()->canGoBack(), true); - QCOMPARE(page->history()->canGoForward(), false); + QTRY_COMPARE(page->history()->canGoBack(), true); + QTRY_COMPARE(page->history()->canGoForward(), false); page->triggerAction(QWebPage::Back); - QTest::qWait(2000); - QCOMPARE(page->history()->canGoBack(), false); - QCOMPARE(page->history()->canGoForward(), true); - QCOMPARE(page->history()->currentItem().url(), QUrl("qrc:///frametest/index.html")); + QTRY_COMPARE(page->history()->canGoBack(), false); + QTRY_COMPARE(page->history()->canGoForward(), true); + QTRY_COMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo")); + + m_view->setPage(0); +} + +void tst_QWebPage::errorPageExtensionInIFrames() +{ + ErrorPage* page = new ErrorPage; + m_view->setPage(page); + + m_view->setHtml(QString("data:text/html," + "

h1

" + "" + "")); + QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); + QTRY_COMPARE(spyLoadFinished.count(), 1); + + QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("data:text/html,error")); + + m_view->setPage(0); +} + +void tst_QWebPage::errorPageExtensionInFrameset() +{ + ErrorPage* page = new ErrorPage; + m_view->setPage(page); + + m_view->load(QUrl("qrc:///resources/index.html")); + + QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); + QTRY_COMPARE(spyLoadFinished.count(), 1); + QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("data:text/html,error")); m_view->setPage(0); } @@ -1734,17 +1713,17 @@ void tst_QWebPage::screenshot_data() void tst_QWebPage::screenshot() { - QDir::setCurrent(SRCDIR); + if (!QDir(TESTS_SOURCE_DIR).exists()) + QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll); + + QDir::setCurrent(TESTS_SOURCE_DIR); QFETCH(QString, html); QWebPage* page = new QWebPage; page->settings()->setAttribute(QWebSettings::PluginsEnabled, true); QWebFrame* mainFrame = page->mainFrame(); - mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); - if (html.contains("")) { - // some reasonable time for the PluginStream to feed test.swf to flash and start painting - QTest::qWait(2000); - } + mainFrame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR)); + ::waitForSignal(mainFrame, SIGNAL(loadFinished(bool)), 2000); // take screenshot without a view takeScreenshot(page); @@ -1850,5 +1829,26 @@ void tst_QWebPage::testJSPrompt() QVERIFY(res); } +class TestModalPage : public QWebPage +{ + Q_OBJECT +public: + TestModalPage(QObject* parent = 0) : QWebPage(parent) { + } + virtual QWebPage* createWindow(WebWindowType) { + QWebPage* page = new TestModalPage(); + connect(page, SIGNAL(windowCloseRequested()), page, SLOT(deleteLater())); + return page; + } +}; + +void tst_QWebPage::showModalDialog() +{ + TestModalPage page; + page.mainFrame()->setHtml(QString("")); + QString res = page.mainFrame()->evaluateJavaScript("window.showModalDialog('javascript:window.returnValue=dialogArguments; window.close();', 'This is a test');").toString(); + QCOMPARE(res, QString("This is a test")); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc index 3085ce2..0627cb4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc @@ -1,10 +1,10 @@ - frametest/index.html - frametest/frame_a.html - frametest/iframe.html - frametest/iframe2.html - frametest/iframe3.html + resources/index.html + resources/frame_a.html + resources/iframe.html + resources/iframe2.html + resources/iframe3.html diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 569146a..e99c7f4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -1,11 +1 @@ -TEMPLATE = app -TARGET = tst_qwebplugindatabase -include(../../../../WebKit.pri) -SOURCES += tst_qwebplugindatabase.cpp -QT += testlib network -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR - -symbian { - TARGET.UID3 = 0xA000E540 - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} +include(../tests.pri) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html deleted file mode 100644 index 9ff68f1..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html +++ /dev/null @@ -1,2 +0,0 @@ -Google -Yahoo diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html deleted file mode 100644 index c53ad09..0000000 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index 735537b..4ca2bf6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -1,13 +1 @@ -TEMPLATE = app -TARGET = tst_qwebview -include(../../../../WebKit.pri) -SOURCES += tst_qwebview.cpp -QT += testlib network -QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -RESOURCES += tst_qwebview.qrc -DEFINES += SRCDIR=\\\"$$PWD/\\\" - -symbian { - TARGET.UID3 = 0xA000E53F - TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices -} +include(../tests.pri) \ No newline at end of file diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/frame_a.html @@ -0,0 +1,2 @@ +Google +Yahoo diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/resources/index.html @@ -0,0 +1,4 @@ + + + + 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 27daf38..ebcf4bb 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -30,6 +30,8 @@ #include #include +#include + class tst_QWebView : public QObject { Q_OBJECT @@ -121,7 +123,10 @@ void tst_QWebView::reusePage_data() void tst_QWebView::reusePage() { - QDir::setCurrent(SRCDIR); + if (!QDir(TESTS_SOURCE_DIR).exists()) + QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll); + + QDir::setCurrent(TESTS_SOURCE_DIR); QFETCH(QString, html); QWebView* view1 = new QWebView; @@ -129,21 +134,29 @@ void tst_QWebView::reusePage() view1->setPage(page); page->settings()->setAttribute(QWebSettings::PluginsEnabled, true); QWebFrame* mainFrame = page->mainFrame(); - mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + mainFrame->setHtml(html, QUrl::fromLocalFile(TESTS_SOURCE_DIR)); if (html.contains("")) { // some reasonable time for the PluginStream to feed test.swf to flash and start painting - QTest::qWait(2000); + waitForSignal(view1, SIGNAL(loadFinished(bool)), 2000); } view1->show(); - QTest::qWait(2000); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QTest::qWaitForWindowShown(view1); +#else + QTest::qWait(2000); +#endif delete view1; QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view QWebView *view2 = new QWebView; view2->setPage(page); view2->show(); // in Windowless mode, you should still be able to see the plugin here - QTest::qWait(2000); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QTest::qWaitForWindowShown(view2); +#else + QTest::qWait(2000); +#endif delete view2; delete page; // must not crash @@ -185,7 +198,7 @@ void tst_QWebView::crashTests() // Test page should have frames. QWebView view; WebViewCrashTest tester(&view); - QUrl url("qrc:///data/index.html"); + QUrl url("qrc:///resources/index.html"); view.load(url); QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. } 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 ede34a9..5abc64c 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -1,7 +1,7 @@ - data/index.html - data/frame_a.html + resources/index.html + resources/frame_a.html diff --git a/src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png b/src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png new file mode 100644 index 0000000..8d70364 Binary files /dev/null and b/src/3rdparty/webkit/WebKit/qt/tests/resources/image2.png differ diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pri b/src/3rdparty/webkit/WebKit/qt/tests/tests.pri new file mode 100644 index 0000000..187950a --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pri @@ -0,0 +1,23 @@ +TEMPLATE = app +CONFIG -= app_bundle + +TARGET = tst_$$TARGET +SOURCES += $$_PRO_FILE_PWD_/$${TARGET}.cpp +INCLUDEPATH += \ + $$PWD \ + $$PWD/../Api + +exists($$_PRO_FILE_PWD_/$${TARGET}.qrc):RESOURCES += $$_PRO_FILE_PWD_/$${TARGET}.qrc + +include(../../../WebKit.pri) +QT += testlib network + +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian { + TARGET.CAPABILITY = ReadUserData WriteUserData NetworkServices +} + +# This define is used by some tests to look up resources in the source tree +!symbian: DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\" + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index 939cd22..5e19202 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory -greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory qwebinspector hybridPixmap +greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting benchmarks/loading diff --git a/src/3rdparty/webkit/WebKit/qt/tests/util.h b/src/3rdparty/webkit/WebKit/qt/tests/util.h index 7f7e613..c61bc6b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/util.h +++ b/src/3rdparty/webkit/WebKit/qt/tests/util.h @@ -18,6 +18,37 @@ */ // Functions and macros that really need to be in QTestLib +#include +#include +#include + +#if !defined(TESTS_SOURCE_DIR) +#define TESTS_SOURCE_DIR "" +#endif + +/** + * Starts an event loop that runs until the given signal is received. + * Optionally the event loop + * can return earlier on a timeout. + * + * \return \p true if the requested signal was received + * \p false on timeout + */ +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) +{ + QEventLoop loop; + QObject::connect(obj, signal, &loop, SLOT(quit())); + QTimer timer; + QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); + if (timeout > 0) { + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.setSingleShot(true); + timer.start(timeout); + } + loop.exec(); + return timeoutSpy.isEmpty(); +} + // Will try to wait for the condition while allowing event processing #define QTRY_VERIFY(__expr) \ do { \ @@ -45,4 +76,3 @@ } \ QCOMPARE(__expr, __expected); \ } while(0) - -- cgit v0.12 From 3fb191bbeb0e8a2d49c5107df07c5457872357b3 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 23 Feb 2010 09:46:34 +0100 Subject: Get rid of QmlModulePlugin. --- .../plugins/com/nokia/TimeExample/Clock.qml | 50 ++++++++++ .../plugins/com/nokia/TimeExample/center.png | Bin 0 -> 765 bytes .../plugins/com/nokia/TimeExample/clock.png | Bin 0 -> 20653 bytes .../plugins/com/nokia/TimeExample/hour.png | Bin 0 -> 625 bytes .../plugins/com/nokia/TimeExample/minute.png | Bin 0 -> 625 bytes examples/declarative/plugins/files/Clock.qml | 50 ---------- examples/declarative/plugins/files/center.png | Bin 765 -> 0 bytes examples/declarative/plugins/files/clock.png | Bin 20653 -> 0 bytes examples/declarative/plugins/files/hour.png | Bin 625 -> 0 bytes examples/declarative/plugins/files/minute.png | Bin 625 -> 0 bytes examples/declarative/plugins/plugin.cpp | 14 +-- examples/declarative/plugins/plugins.pro | 13 ++- src/declarative/qml/qml.pri | 2 - src/declarative/qml/qmlengine.cpp | 1 - src/declarative/qml/qmlmoduleplugin.cpp | 111 --------------------- src/declarative/qml/qmlmoduleplugin.h | 86 ---------------- src/multimedia/qml/qml.cpp | 10 +- src/multimedia/qml/qml.h | 4 +- src/plugins/qmlmodules/multimedia/multimedia.cpp | 16 +-- 19 files changed, 79 insertions(+), 278 deletions(-) create mode 100644 examples/declarative/plugins/com/nokia/TimeExample/Clock.qml create mode 100644 examples/declarative/plugins/com/nokia/TimeExample/center.png create mode 100644 examples/declarative/plugins/com/nokia/TimeExample/clock.png create mode 100644 examples/declarative/plugins/com/nokia/TimeExample/hour.png create mode 100644 examples/declarative/plugins/com/nokia/TimeExample/minute.png delete mode 100644 examples/declarative/plugins/files/Clock.qml delete mode 100644 examples/declarative/plugins/files/center.png delete mode 100644 examples/declarative/plugins/files/clock.png delete mode 100644 examples/declarative/plugins/files/hour.png delete mode 100644 examples/declarative/plugins/files/minute.png delete mode 100644 src/declarative/qml/qmlmoduleplugin.cpp delete mode 100644 src/declarative/qml/qmlmoduleplugin.h diff --git a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml new file mode 100644 index 0000000..01ec686 --- /dev/null +++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml @@ -0,0 +1,50 @@ +import Qt 4.6 + +Item { + id: clock + width: 200; height: 200 + + property alias city: cityLabel.text + property var hours + property var minutes + property var shift : 0 + + Image { id: background; source: "clock.png" } + + Image { + x: 92.5; y: 27 + source: "hour.png" + smooth: true + transform: Rotation { + id: hourRotation + origin.x: 7.5; origin.y: 73; angle: 0 + angle: SpringFollow { + spring: 2; damping: 0.2; modulus: 360 + source: (clock.hours * 30) + (clock.minutes * 0.5) + } + } + } + + Image { + x: 93.5; y: 17 + source: "minute.png" + smooth: true + transform: Rotation { + id: minuteRotation + origin.x: 6.5; origin.y: 83; angle: 0 + angle: SpringFollow { + spring: 2; damping: 0.2; modulus: 360 + source: clock.minutes * 6 + } + } + } + + Image { + anchors.centerIn: background; source: "center.png" + } + + Text { + id: cityLabel; font.bold: true; font.pixelSize: 14; y:200; color: "white" + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/declarative/plugins/com/nokia/TimeExample/center.png b/examples/declarative/plugins/com/nokia/TimeExample/center.png new file mode 100644 index 0000000..7fbd802 Binary files /dev/null and b/examples/declarative/plugins/com/nokia/TimeExample/center.png differ diff --git a/examples/declarative/plugins/com/nokia/TimeExample/clock.png b/examples/declarative/plugins/com/nokia/TimeExample/clock.png new file mode 100644 index 0000000..462edac Binary files /dev/null and b/examples/declarative/plugins/com/nokia/TimeExample/clock.png differ diff --git a/examples/declarative/plugins/com/nokia/TimeExample/hour.png b/examples/declarative/plugins/com/nokia/TimeExample/hour.png new file mode 100644 index 0000000..f8061a1 Binary files /dev/null and b/examples/declarative/plugins/com/nokia/TimeExample/hour.png differ diff --git a/examples/declarative/plugins/com/nokia/TimeExample/minute.png b/examples/declarative/plugins/com/nokia/TimeExample/minute.png new file mode 100644 index 0000000..1297ec7 Binary files /dev/null and b/examples/declarative/plugins/com/nokia/TimeExample/minute.png differ diff --git a/examples/declarative/plugins/files/Clock.qml b/examples/declarative/plugins/files/Clock.qml deleted file mode 100644 index 01ec686..0000000 --- a/examples/declarative/plugins/files/Clock.qml +++ /dev/null @@ -1,50 +0,0 @@ -import Qt 4.6 - -Item { - id: clock - width: 200; height: 200 - - property alias city: cityLabel.text - property var hours - property var minutes - property var shift : 0 - - Image { id: background; source: "clock.png" } - - Image { - x: 92.5; y: 27 - source: "hour.png" - smooth: true - transform: Rotation { - id: hourRotation - origin.x: 7.5; origin.y: 73; angle: 0 - angle: SpringFollow { - spring: 2; damping: 0.2; modulus: 360 - source: (clock.hours * 30) + (clock.minutes * 0.5) - } - } - } - - Image { - x: 93.5; y: 17 - source: "minute.png" - smooth: true - transform: Rotation { - id: minuteRotation - origin.x: 6.5; origin.y: 83; angle: 0 - angle: SpringFollow { - spring: 2; damping: 0.2; modulus: 360 - source: clock.minutes * 6 - } - } - } - - Image { - anchors.centerIn: background; source: "center.png" - } - - Text { - id: cityLabel; font.bold: true; font.pixelSize: 14; y:200; color: "white" - anchors.horizontalCenter: parent.horizontalCenter - } -} diff --git a/examples/declarative/plugins/files/center.png b/examples/declarative/plugins/files/center.png deleted file mode 100644 index 7fbd802..0000000 Binary files a/examples/declarative/plugins/files/center.png and /dev/null differ diff --git a/examples/declarative/plugins/files/clock.png b/examples/declarative/plugins/files/clock.png deleted file mode 100644 index 462edac..0000000 Binary files a/examples/declarative/plugins/files/clock.png and /dev/null differ diff --git a/examples/declarative/plugins/files/hour.png b/examples/declarative/plugins/files/hour.png deleted file mode 100644 index f8061a1..0000000 Binary files a/examples/declarative/plugins/files/hour.png and /dev/null differ diff --git a/examples/declarative/plugins/files/minute.png b/examples/declarative/plugins/files/minute.png deleted file mode 100644 index 1297ec7..0000000 Binary files a/examples/declarative/plugins/files/minute.png and /dev/null differ diff --git a/examples/declarative/plugins/plugin.cpp b/examples/declarative/plugins/plugin.cpp index 820d4eb..8e21263 100644 --- a/examples/declarative/plugins/plugin.cpp +++ b/examples/declarative/plugins/plugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -140,19 +140,15 @@ MinuteTimer *Time::timer=0; QML_DECLARE_TYPE(Time); -class QExampleQmlPlugin : public QmlModulePlugin +class QExampleQmlPlugin : public QmlExtensionPlugin { Q_OBJECT public: - QStringList keys() const - { - return QStringList() << QLatin1String("com.nokia.TimeExample"); - } - - void defineModule(const QString& uri) + void initialize(QmlEngine *engine, const char *uri) { + Q_UNUSED(engine); Q_ASSERT(uri == QLatin1String("com.nokia.TimeExample")); - qmlRegisterType