From 655e19b862e54ad61b7b2fa6d05463382c7baa61 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 14 Sep 2009 18:53:49 +0200 Subject: Fix closing the menu of a QMenuBar with the mouse Ammend commit 41dbc4406 and 21cf7b4c431742 We do not always get the mouseReleaseEvent (because the popups grabs the mouse. So set mouseDown to false in the mouseMoveEvent if no buttons are pressed. We also need to call setCurrentAction(0) in the case we are hovering on the empty area with no popup open. (in otder to remove the highlight) The code is now much closer to the code before the two previous commit Reviewed-by: Prasanth --- src/gui/widgets/qmenubar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 8591a77..7b0f37e 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1252,9 +1252,11 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) void QMenuBar::mouseMoveEvent(QMouseEvent *e) { Q_D(QMenuBar); + if (!(e->buttons() & Qt::LeftButton)) + d->mouseDown = false; bool popupState = d->popupState || d->mouseDown; QAction *action = d->actionAt(e->pos()); - if (action && d->isVisible(action)) + if ((action && d->isVisible(action)) || !popupState) d->setCurrentAction(action, popupState); } -- cgit v0.12 From a1d6c4e508cb2ea9a2d33d4f197da416c3f492c8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 14 Sep 2009 20:46:25 +0200 Subject: Remove spurious, wrong semi-colon There should be no semi-colon after Q_DISABLE_COPY. Reviewed-By: Trust Me --- src/gui/widgets/qmenudata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenudata.h b/src/gui/widgets/qmenudata.h index 69f0cbc..c9d8b47 100644 --- a/src/gui/widgets/qmenudata.h +++ b/src/gui/widgets/qmenudata.h @@ -68,7 +68,7 @@ private: void setId(int); void setSignalValue(int); - Q_DISABLE_COPY(QMenuItem); + Q_DISABLE_COPY(QMenuItem) }; QT_END_NAMESPACE -- cgit v0.12 From b2d7bcf1e77e8b9bc8fc1b40777907d7a8d47c09 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 14 Sep 2009 16:39:26 +1000 Subject: Fixes crash when calling numRows on unknown query type (ibase) Reviewed-by: Justin McPherson --- src/sql/drivers/ibase/qsql_ibase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index bde3930..7a4609d 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1262,6 +1262,9 @@ int QIBaseResult::numRowsAffected() case isc_info_sql_stmt_insert: cCountType = isc_info_req_insert_count; break; + default: + qWarning() << "numRowsAffected: Unknown statement type (" << d->queryType << ")"; + return -1; } char acBuffer[33]; -- cgit v0.12 From e6f191185d0a80ced3434a8b378b139386c43760 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 14 Sep 2009 16:45:26 +1000 Subject: Fixes QSqlTableModel: trying to delete the wrong row. Uses the primary key from the index in the query, not the resulting location in the modified dataset. Task-number: 222678 --- src/sql/models/qsqltablemodel.cpp | 9 ++-- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 61 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index a532449..a91dc9f 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -559,7 +559,7 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in if (row.op == QSqlTableModelPrivate::None) { row.op = QSqlTableModelPrivate::Update; row.rec = d->rec; - row.primaryValues = d->primaryValues(indexInQuery(index).row()); + row.primaryValues = d->primaryValues(indexInQuery(index).row()); } row.rec.setValue(index.column(), value); emit dataChanged(index, index); @@ -669,7 +669,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) Q_D(QSqlTableModel); emit beforeDelete(row); - QSqlRecord rec = d->primaryValues(row); + const QSqlRecord whereValues = d->strategy == OnManualSubmit ? d->cache[row].primaryValues : d->primaryValues(row); bool prepStatement = d->db.driver()->hasFeature(QSqlDriver::PreparedQueries); QString stmt = d->db.driver()->sqlStatement(QSqlDriver::DeleteStatement, d->tableName, @@ -677,7 +677,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) prepStatement); QString where = d->db.driver()->sqlStatement(QSqlDriver::WhereStatement, d->tableName, - rec, + whereValues, prepStatement); if (stmt.isEmpty() || where.isEmpty()) { @@ -687,7 +687,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) } stmt.append(QLatin1Char(' ')).append(where); - return d->exec(stmt, prepStatement, rec); + return d->exec(stmt, prepStatement, whereValues); } /*! @@ -1097,6 +1097,7 @@ bool QSqlTableModel::removeRows(int row, int count, const QModelIndex &parent) revertRow(idx); else { d->cache[idx].op = QSqlTableModelPrivate::Delete; + d->cache[idx].primaryValues = d->primaryValues(indexInQuery(createIndex(idx, 0)).row()); emit headerDataChanged(Qt::Vertical, idx, idx); } } diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 15fe686..0369e86 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -119,6 +119,11 @@ private slots: void tableModifyWithBlank_data() { generic_data(); } void tableModifyWithBlank(); // For mail task + void removeColumnAndRow_data() { generic_data(); } + void removeColumnAndRow(); // task 256032 + + void insertBeforeDelete_data() { generic_data(); } + void insertBeforeDelete(); private: void generic_data(const QString& engine=QString()); }; @@ -985,5 +990,61 @@ void tst_QSqlTableModel::tableModifyWithBlank() QCOMPARE(model.record(0).value(1).toString(), QLatin1String("col1ModelData")); } +void tst_QSqlTableModel::removeColumnAndRow() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlTableModel model(0, db); + model.setTable(qTableName("test")); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.columnCount(), 3); + + QVERIFY(model.removeColumn(0)); + QVERIFY(model.removeRow(0)); + QVERIFY(model.submitAll()); + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.columnCount(), 2); + + // check with another table because the model has been modified + // but not the sql table + QSqlTableModel model2(0, db); + model2.setTable(qTableName("test")); + QVERIFY_SQL(model2, select()); + QCOMPARE(model2.rowCount(), 2); + QCOMPARE(model2.columnCount(), 3); +} + +void tst_QSqlTableModel::insertBeforeDelete() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(9, 'andrew', 9)")); + QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(10, 'justin', 10)")); + + QSqlTableModel model(0, db); + model.setTable(qTableName("test")); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); + QVERIFY_SQL(model, select()); + + qDebug() << model.rowCount(); + + QSqlRecord rec = model.record(); + rec.setValue(0, 4); + rec.setValue(1, QString("bill")); + rec.setValue(2, 4); + QVERIFY_SQL(model, insertRecord(4, rec)); + + QVERIFY_SQL(model, removeRow(5)); + QVERIFY_SQL(model, submitAll()); + QCOMPARE(model.rowCount(), 5); +} + QTEST_MAIN(tst_QSqlTableModel) #include "tst_qsqltablemodel.moc" -- cgit v0.12 From afd7ba59f1fd9f14c4b7cd85aba764ef6066d64e Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 15 Sep 2009 16:28:19 +1000 Subject: qdoc: Shift snippets in QGLShaderProgram out into doc/src/snippets --- .../snippets/code/src_opengl_qglshaderprogram.cpp | 92 ++++++++++++++++++++++ src/opengl/qglshaderprogram.cpp | 52 +----------- 2 files changed, 95 insertions(+), 49 deletions(-) create mode 100644 doc/src/snippets/code/src_opengl_qglshaderprogram.cpp diff --git a/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp new file mode 100644 index 0000000..2997297 --- /dev/null +++ b/doc/src/snippets/code/src_opengl_qglshaderprogram.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +//! [0] +QGLShader shader(QGLShader::VertexShader); +shader.compile(code); + +QGLShaderProgram program(context); +program.addShader(shader); +program.link(); + +program.enable(); +//! [0] + +//! [1] +program.addShader(QGLShader::VertexShader, + "attribute highp vec4 vertex;\n" + "attribute mediump mat4 matrix;\n" + "void main(void)\n" + "{\n" + " gl_Position = matrix * vertex;\n" + "}"); +program.addShader(QGLShader::FragmentShader, + "uniform mediump vec4 color;\n" + "void main(void)\n" + "{\n" + " gl_FragColor = color;\n" + "}"); +program.link(); +program.enable(); + +int vertexLocation = program.attributeLocation("vertex"); +int matrixLocation = program.attributeLocation("matrix"); +int colorLocation = program.uniformLocation("color"); +//! [1] + +//! [2] +static GLfloat const triangleVertices[] = { + 60.0f, 10.0f, 0.0f, + 110.0f, 110.0f, 0.0f, + 10.0f, 110.0f, 0.0f +}; + +QColor color(0, 255, 0, 255); + +QMatrix4x4 pmvMatrix; +pmvMatrix.ortho(rect()); + +program.setAttributeArray(vertexLocation, triangleVertices, 3); +program.setUniformValue(matrixLocation, pmvMatrix); +program.setUniformValue(colorLocation, color); + +glDrawArrays(GL_TRIANGLES, 0, 3); +//! [2] diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 0b7fe87..ebcd723 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -70,16 +70,7 @@ QT_BEGIN_NAMESPACE program is activated in the current QGLContext by calling QGLShaderProgram::enable(): - \code - QGLShader shader(QGLShader::VertexShader); - shader.compile(code); - - QGLShaderProgram program(context); - program.addShader(shader); - program.link(); - - program.enable(); - \endcode + \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 0 \section1 Writing portable shaders @@ -107,49 +98,12 @@ QT_BEGIN_NAMESPACE \section1 Simple shader example - \code - program.addShader(QGLShader::VertexShader, - "attribute highp vec4 vertex;\n" - "attribute mediump mat4 matrix;\n" - "void main(void)\n" - "{\n" - " gl_Position = matrix * vertex;\n" - "}"); - program.addShader(QGLShader::FragmentShader, - "uniform mediump vec4 color;\n" - "void main(void)\n" - "{\n" - " gl_FragColor = color;\n" - "}"); - program.link(); - program.enable(); - - int vertexLocation = program.attributeLocation("vertex"); - int matrixLocation = program.attributeLocation("matrix"); - int colorLocation = program.uniformLocation("color"); - \endcode + \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 With the above shader program active, we can draw a green triangle as follows: - \code - static GLfloat const triangleVertices[] = { - 60.0f, 10.0f, 0.0f, - 110.0f, 110.0f, 0.0f, - 10.0f, 110.0f, 0.0f - }; - - QColor color(0, 255, 0, 255); - - QMatrix4x4 pmvMatrix; - pmvMatrix.ortho(rect()); - - program.setAttributeArray(vertexLocation, triangleVertices, 3); - program.setUniformValue(matrixLocation, pmvMatrix); - program.setUniformValue(colorLocation, color); - - glDrawArrays(GL_TRIANGLES, 0, 3); - \endcode + \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 2 \section1 Partial shaders -- cgit v0.12 From e37f8ef98f1c4fe4a45b4579a294e17734d7dff6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 15 Sep 2009 09:22:11 +0200 Subject: Fix update issues in QGraphicsView. The bug appeared only when calling collidingItems right after setPos. When calling setPos on a parent the sceneTransform is mark as dirty, so when we paint the parent and its children if the scene transform of the parent was dirty then we update all children sceneTransform. In our case here, collidingItems call ensureTransform on one of the children which go recursively to the top most dirty item and update the sceneTransform. The problem is that all sibling children are not mark their sceneTransform dirty so next paint will skip them (since the parent is not dirty anymore). Task-number:260711 Reviewed-by:bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 20 ++---- src/gui/graphicsview/qgraphicsitem_p.h | 6 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 86 ++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 15 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9c0c649..5d11ec3 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4830,25 +4830,17 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost return; // Continue backtrack. } + // This item and all its descendants have dirty scene transforms. + // We're about to validate this item's scene transform, so we have to + // invalidate all the children; otherwise there's no way for the descendants + // to detect that the ancestor has changed. + invalidateChildrenSceneTransform(); + // COMBINE my transform with the parent's scene transform. updateSceneTransformFromParent(); Q_ASSERT(!dirtySceneTransform); } -void QGraphicsItemPrivate::ensureSceneTransform() -{ - if (dirtySceneTransform) { - // This item and all its descendants have dirty scene transforms. - // We're about to validate this item's scene transform, so we have to - // invalidate all the children; otherwise there's no way for the descendants - // to detect that the ancestor has changed. - invalidateChildrenSceneTransform(); - } - - QGraphicsItem *that = q_func(); - ensureSceneTransformRecursive(&that); -} - /*! \internal */ diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index b891de3..0b58ad3 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -318,7 +318,11 @@ public: void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem); - void ensureSceneTransform(); + inline void ensureSceneTransform() + { + QGraphicsItem *that = q_func(); + ensureSceneTransformRecursive(&that); + } inline bool hasTranslateOnlySceneTransform() { diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 5e8f4c4..c2acac9 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -293,6 +293,7 @@ private slots: void setActivePanelOnInactiveScene(); void activationOnShowHide(); void moveWhileDeleting(); + void ensureDirtySceneTransform(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -8156,5 +8157,90 @@ void tst_QGraphicsItem::moveWhileDeleting() delete rect; } +class MyRectItem : public QGraphicsWidget +{ + Q_OBJECT +public: + MyRectItem(QGraphicsItem *parent = 0) : QGraphicsWidget(parent) + { + + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + painter->setBrush(brush); + painter->drawRect(boundingRect()); + } + +public slots : + void move() + { + setPos(-100,-100); + topLevel->collidingItems(Qt::IntersectsItemBoundingRect); + } +public: + QGraphicsItem *topLevel; + QBrush brush; +}; + + +void tst_QGraphicsItem::ensureDirtySceneTransform() +{ + QGraphicsScene scene; + + MyRectItem *topLevel = new MyRectItem; + topLevel->setGeometry(0, 0, 100, 100); + topLevel->setPos(-50, -50); + topLevel->brush = QBrush(QColor(Qt::black)); + scene.addItem(topLevel); + + MyRectItem *parent = new MyRectItem; + parent->topLevel = topLevel; + parent->setGeometry(0, 0, 100, 100); + parent->setPos(0, 0); + parent->brush = QBrush(QColor(Qt::magenta)); + parent->setObjectName("parent"); + scene.addItem(parent); + + MyRectItem *child = new MyRectItem(parent); + child->setGeometry(0, 0, 80, 80); + child->setPos(10, 10); + child->setObjectName("child"); + child->brush = QBrush(QColor(Qt::blue)); + + MyRectItem *child2 = new MyRectItem(parent); + child2->setGeometry(0, 0, 80, 80); + child2->setPos(15, 15); + child2->setObjectName("child2"); + child2->brush = QBrush(QColor(Qt::green)); + + MyRectItem *child3 = new MyRectItem(parent); + child3->setGeometry(0, 0, 80, 80); + child3->setPos(20, 20); + child3->setObjectName("child3"); + child3->brush = QBrush(QColor(Qt::gray)); + + QGraphicsView view(&scene); + view.show(); + QTest::qWait(500); + + //We move the parent + parent->move(); + QTest::qWait(500); + + //We check if all items moved + QCOMPARE(child->pos(), QPointF(10, 10)); + QCOMPARE(child2->pos(), QPointF(15, 15)); + QCOMPARE(child3->pos(), QPointF(20, 20)); + + QCOMPARE(child->sceneBoundingRect(), QRectF(-90, -90, 80, 80)); + QCOMPARE(child2->sceneBoundingRect(), QRectF(-85, -85, 80, 80)); + QCOMPARE(child3->sceneBoundingRect(), QRectF(-80, -80, 80, 80)); + + QCOMPARE(child->sceneTransform(), QTransform::fromTranslate(-90, -90)); + QCOMPARE(child2->sceneTransform(), QTransform::fromTranslate(-85, -85)); + QCOMPARE(child3->sceneTransform(), QTransform::fromTranslate(-80, -80)); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 49ea15e0498ba894647a8667148b4ab5dffcb343 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 15 Sep 2009 17:36:51 +1000 Subject: Don't round-trip to GL server for glGetError() in release mode. Reviewed-by: Samuel Reviewed-by: Tom Cooksey --- src/opengl/qglframebufferobject.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 4b8a67e..e4cef5f 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -66,6 +66,11 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); #define QGL_FUNC_CONTEXT QGLContextGroup *ctx = d_ptr->ctx; +#ifndef QT_NO_DEBUG +#define QT_RESET_GLERROR() \ +{ \ + while (glGetError() != GL_NO_ERROR) {} \ +} #define QT_CHECK_GLERROR() \ { \ GLenum err = glGetError(); \ @@ -74,6 +79,10 @@ extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); __FILE__, __LINE__, (int)err); \ } \ } +#else +#define QT_RESET_GLERROR() {} +#define QT_CHECK_GLERROR() {} +#endif /*! \class QGLFramebufferObjectFormat @@ -407,7 +416,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, target = texture_target; // texture dimensions - while (glGetError() != GL_NO_ERROR) {} // reset error state + QT_RESET_GLERROR(); // reset error state glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); -- cgit v0.12 From 62fe4f11e49025156f9f5de2ffcbb9ad65198bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 10:08:25 +0200 Subject: Test if the direction influences the returned graphics anchor object. Pointed out by Caio. --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 059ad33..5bb3746 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1079,9 +1079,15 @@ void tst_QGraphicsAnchorLayout::delete_anchor() QVERIFY(anchor1); QGraphicsAnchor *anchor2 = l->anchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); QVERIFY(anchor2); + QGraphicsAnchor *anchor3 = l->anchor(l, Qt::AnchorRight, w3, Qt::AnchorRight); + QVERIFY(anchor3); + QGraphicsAnchor *anchor4 = l->anchor(l, Qt::AnchorRight, w3, Qt::AnchorRight); + QVERIFY(anchor4); - // should be the same object + // should all be the same object QCOMPARE(anchor1, anchor2); + QCOMPARE(anchor2, anchor3); + QCOMPARE(anchor3, anchor4); // check if removal works delete anchor1; -- cgit v0.12 From b94d6354cb0b24a92e674fc994919394c7549b5a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 15 Sep 2009 09:48:43 +0200 Subject: Added support in qimagereader to base plugin selection on stream content Reviewed-by: Trond --- src/gui/image/qimagereader.cpp | 56 ++++++++++++++++++---- src/gui/image/qimagereader.h | 3 ++ tests/auto/qimagereader/tst_qimagereader.cpp | 71 ++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 10 deletions(-) diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 41df852..5cd768f 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -195,7 +195,9 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { }; static QImageIOHandler *createReadHandlerHelper(QIODevice *device, - const QByteArray &format, bool autoDetectImageFormat) + const QByteArray &format, + bool autoDetectImageFormat, + bool ignoresFormatAndExtension) { if (!autoDetectImageFormat && format.isEmpty()) return 0; @@ -217,7 +219,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) int suffixPluginIndex = -1; - if (device && format.isEmpty() && autoDetectImageFormat) { + if (device && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { // if there's no format, see if \a device is a file, and if so, find // the file suffix and find support for that format among our plugins. // this allows plugins to override our built-in handlers. @@ -241,6 +243,9 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QByteArray testFormat = !form.isEmpty() ? form : suffix; + if (ignoresFormatAndExtension) + testFormat = QByteArray(); + #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) if (suffixPluginIndex != -1) { // check if the plugin that claims support for this format can load @@ -258,7 +263,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, device->seek(pos); } - if (!handler && !testFormat.isEmpty() && autoDetectImageFormat) { + if (!handler && !testFormat.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { // check if any plugin supports the format (they are not allowed to // read from the device yet). const qint64 pos = device ? device->pos() : 0; @@ -315,7 +320,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - if (!handler && autoDetectImageFormat) { + if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { // check if any of our plugins recognize the file from its contents. const qint64 pos = device ? device->pos() : 0; for (int i = 0; i < keys.size(); ++i) { @@ -335,7 +340,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, } #endif - if (!handler && autoDetectImageFormat) { + if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { // check if any of our built-in handlers recognize the file from its // contents. int currentFormat = 0; @@ -434,6 +439,7 @@ public: // device QByteArray format; bool autoDetectImageFormat; + bool ignoresFormatAndExtension; QIODevice *device; bool deleteDevice; QImageIOHandler *handler; @@ -458,7 +464,7 @@ public: \internal */ QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq) - : autoDetectImageFormat(true) + : autoDetectImageFormat(true), ignoresFormatAndExtension(false) { device = 0; deleteDevice = false; @@ -522,7 +528,7 @@ bool QImageReaderPrivate::initHandler() } // assign a handler - if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat)) == 0) { + if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0) { imageReaderError = QImageReader::UnsupportedFormatError; errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unsupported image format")); return false; @@ -664,7 +670,7 @@ QByteArray QImageReader::format() const \o Finally, if all above approaches fail, QImageReader will report failure when trying to read the image. - \endlist + \endlist By disabling image format autodetection, QImageReader will only query the plugins and built-in handlers based on the format string (i.e., no file @@ -681,13 +687,43 @@ void QImageReader::setAutoDetectImageFormat(bool enabled) Returns true if image format autodetection is enabled on this image reader; otherwise returns false. By default, autodetection is enabled. - \sa setAutoDetectImageFormat() + \sa setAutoDetectImageFormat() */ bool QImageReader::autoDetectImageFormat() const { return d->autoDetectImageFormat; } + +/*! + + Specifies that the image reader should decide which plugin to use + solely based on the contents in the datastream. + + Setting this flag means that all image plugins gets loaded. Each + plugin will read the first bytes in the image data and decide if + the plugin is compatible or not. + + This also disables auto detecting image format. +*/ + +void QImageReader::setDecideFormatFromContent(bool ignored) +{ + d->ignoresFormatAndExtension = ignored; +} + + +/*! + Returns wether the image reader should decide which plugin to use + sloley based on the contents of the datastream +*/ + +bool QImageReader::decideFormatFromContent() const +{ + return d->ignoresFormatAndExtension; +} + + /*! Sets QImageReader's device to \a device. If a device has already been set, the old device is removed from QImageReader and is @@ -1309,7 +1345,7 @@ QByteArray QImageReader::imageFormat(const QString &fileName) QByteArray QImageReader::imageFormat(QIODevice *device) { QByteArray format; - QImageIOHandler *handler = createReadHandlerHelper(device, format, /* autoDetectImageFormat = */ true); + QImageIOHandler *handler = createReadHandlerHelper(device, format, /* autoDetectImageFormat = */ true, false); if (handler) { if (handler->canRead()) format = handler->format(); diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h index 86031ec..11affb8 100644 --- a/src/gui/image/qimagereader.h +++ b/src/gui/image/qimagereader.h @@ -81,6 +81,9 @@ public: void setAutoDetectImageFormat(bool enabled); bool autoDetectImageFormat() const; + void setDecideFormatFromContent(bool ignored); + bool decideFormatFromContent() const; + void setDevice(QIODevice *device); QIODevice *device() const; diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 8630021..cab8fda 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -167,6 +167,10 @@ private slots: void task255627_setNullScaledSize_data(); void task255627_setNullScaledSize(); + + void testIgnoresFormatAndExtension_data(); + void testIgnoresFormatAndExtension(); + }; static const QLatin1String prefix(SRCDIR "/images/"); @@ -225,6 +229,7 @@ void tst_QImageReader::readImage_data() QTest::newRow("PPM: runners") << QString("runners.ppm") << true << QByteArray("ppm"); QTest::newRow("PPM: test") << QString("test.ppm") << true << QByteArray("ppm"); QTest::newRow("XBM: gnus") << QString("gnus.xbm") << true << QByteArray("xbm"); + #if defined QTEST_HAVE_JPEG QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg"); #endif @@ -1495,5 +1500,71 @@ void tst_QImageReader::pixelCompareWithBaseline() } } + +void tst_QImageReader::testIgnoresFormatAndExtension_data() +{ + QTest::addColumn("name"); + QTest::addColumn("extension"); + QTest::addColumn("expected"); + + QTest::newRow("black.png") << "black" << "png" << "png"; + QTest::newRow("black.xpm") << "black" << "xpm" << "xpm"; + QTest::newRow("colorful.bmp") << "colorful" << "bmp" << "bmp"; + QTest::newRow("image.ppm") << "image" << "ppm" << "ppm"; + QTest::newRow("image.pbm") << "image" << "pbm" << "pbm"; + QTest::newRow("image.pgm") << "image" << "pgm" << "pgm"; + +#if defined QTEST_HAVE_GIF + QTest::newRow("bat1.gif") << "bat1" << "gif" << "gif"; +#endif + +#if defined QTEST_HAVE_JPEG + QTest::newRow("beavis.jpg") << "beavis" << "jpg" << "jpeg"; +#endif + +#if defined QTEST_HAVE_MNG + QTest::newRow("fire.mng") << "fire" << "mng" << "mng"; +#endif + +#if defined QTEST_HAVE_TIFF + QTest::newRow("image_100dpi.tif") << "image_100dpi" << "tif" << "tiff"; +#endif +} + + +void tst_QImageReader::testIgnoresFormatAndExtension() +{ + QFETCH(QString, name); + QFETCH(QString, extension); + QFETCH(QString, expected); + + QList formats = QImageReader::supportedImageFormats(); + QString fileNameBase = "images/" + name + "."; + + foreach (const QByteArray &f, formats) { + if (f == extension) + continue; + QFile tmp(QDir::tempPath() + "/" + name + "_" + expected + "." + f); + + QFile::copy(fileNameBase + extension, QFileInfo(tmp).absoluteFilePath()); + + QString format; + QImage image; + { + // image reader needs to be scoped for the remove() to work.. + QImageReader r; + r.setFileName(QFileInfo(tmp).absoluteFilePath()); + r.setDecideFormatFromContent(true); + format = r.format(); + r.read(&image); + } + + tmp.remove(); + + QVERIFY(!image.isNull()); + QCOMPARE(format, expected); + } +} + QTEST_MAIN(tst_QImageReader) #include "tst_qimagereader.moc" -- cgit v0.12 From c4f6d22d8bb59560f7a727bb6e08b0ff53793c6e Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 15 Sep 2009 10:39:05 +0200 Subject: Bauhaus widgetbox drag and drop not working in Cocoa Bauhaus uses grabMouse to implement their own Drag and Drop mechanism. Cocoa port never considered the grabber widget. All the mouse events will now be routed to the mouse grabber widget. Task-number: 261245 Reviewed-by: MortenS --- src/gui/kernel/qt_cocoa_helpers_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index d27c775..2b2259c 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -876,6 +876,10 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev QWidget *widgetToGetMouse = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); NSView *tmpView = theView; + if (mac_mouse_grabber && mac_mouse_grabber != widgetToGetMouse) { + widgetToGetMouse = mac_mouse_grabber; + tmpView = qt_mac_nativeview_for(widgetToGetMouse); + } if (popup && popup != qwidget->window()) { widgetToGetMouse = popup; -- cgit v0.12 From cd764477c1fca556db2144769aa5e468f6e24e3c Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 15 Sep 2009 10:49:45 +0200 Subject: Fix auto-test in QGraphicsItem. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index c2acac9..96580f6 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8171,8 +8171,6 @@ public: painter->setBrush(brush); painter->drawRect(boundingRect()); } - -public slots : void move() { setPos(-100,-100); @@ -8222,11 +8220,11 @@ void tst_QGraphicsItem::ensureDirtySceneTransform() QGraphicsView view(&scene); view.show(); - QTest::qWait(500); + QTRY_COMPARE(QApplication::activeWindow(), &view); //We move the parent parent->move(); - QTest::qWait(500); + QApplication::processEvents(); //We check if all items moved QCOMPARE(child->pos(), QPointF(10, 10)); -- cgit v0.12 From 708d3c9e9470a84bce48b26cf747d561a5a4c985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 11:01:59 +0200 Subject: Fix tst_QWidget::inputFocus_task257832 on Windows The widget must be created before calling QInputContext::setFocusWidget. Otherwise we run into an assertion. Yes, this only occurs in debug configuration but its still annoying... Cherry-pick of commit d6b8f81a2440e7a507ecbb1becd90ef284510787 from master. Reviewed-by: thartman Conflicts: tests/auto/qwidget/tst_qwidget.cpp --- tests/auto/qwidget/tst_qwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 86caddb..ad814fd 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9293,6 +9293,7 @@ void tst_QWidget::inputFocus_task257832() if (!context) QSKIP("No input context", SkipSingle); widget->setFocus(); + widget->winId(); // make sure, widget has been created context->setFocusWidget(widget); QCOMPARE(context->focusWidget(), static_cast(widget)); widget->setReadOnly(true); -- cgit v0.12 From 9b579d7821205250b8d64b06a19d5e4fccd56f31 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 11 Sep 2009 09:18:49 +0200 Subject: Remove this line; which no longer has any effect. This line was added to fix crashes when deleting items that had a subFocusItem pointing to a child that was already deleted. This bug was fixed by ebb1162f54a29baeccb71d1e283146892629518f. After this, subFocusItem is always 0 at this point. The original change was eb3d5a73148cd7206c6b3b6672ed47b44611f745. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 2 -- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5d11ec3..9295ee5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1205,8 +1205,6 @@ QGraphicsItem::~QGraphicsItem() Q_ASSERT(d_ptr->children.isEmpty()); } - d_ptr->subFocusItem = 0; - if (d_ptr->scene) { d_ptr->scene->d_func()->removeItemHelper(this); } else { diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 96580f6..6b5e4bb 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -7666,6 +7666,11 @@ void tst_QGraphicsItem::subFocus() QVERIFY(!rect->hasFocus()); QVERIFY(!rect2->hasFocus()); QVERIFY(rect3->hasFocus()); + + delete rect2; + QCOMPARE(text->focusItem(), (QGraphicsItem *)0); + QCOMPARE(text2->focusItem(), (QGraphicsItem *)0); + QCOMPARE(rect->focusItem(), (QGraphicsItem *)0); } void tst_QGraphicsItem::focusProxyDeletion() -- cgit v0.12 From a06c7db92ff13a1f8a353851a586ae12755e7c6c Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 11 Sep 2009 09:30:53 +0200 Subject: Fix bugs in handling of initial focus. Make sure you can't set focus on an inactive scene, allow items with subfocus to gain focus even if added to a scene that's not active, and finally ensure that activating a panel in an active, but unfocused scene, gives focus to the scene. Also added a test that checks adding normal vs. panel items to an active vs. inactive scene, and what happens if you initially say the item should have focus. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsscene.cpp | 7 ++- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 58 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index fbd78d9..97bc010 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -581,6 +581,9 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin return; } + // Ensure the scene has focus when we change panel activation. + q->setFocus(Qt::ActiveWindowFocusReason); + // Find the item's panel. QGraphicsItem *panel = item ? item->panel() : 0; lastActivePanel = panel ? activePanel : 0; @@ -2431,7 +2434,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. - if (!d->focusItem && item->focusItem() && item->isActive()) + if (!d->focusItem && item->focusItem()) item->focusItem()->setFocus(); d->updateInputMethodSensitivityInViews(); @@ -2780,7 +2783,7 @@ bool QGraphicsScene::hasFocus() const void QGraphicsScene::setFocus(Qt::FocusReason focusReason) { Q_D(QGraphicsScene); - if (d->hasFocus) + if (d->hasFocus || !isActive()) return; QFocusEvent event(QEvent::FocusIn, focusReason); QCoreApplication::sendEvent(this, &event); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 6998684..07d7cce 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -264,6 +264,8 @@ private slots: void inputMethod_data(); void inputMethod(); void dispatchHoverOnPress(); + void initialFocus_data(); + void initialFocus(); // task specific tests below me void task139710_bspTreeCrash(); @@ -3822,5 +3824,61 @@ void tst_QGraphicsScene::dispatchHoverOnPress() } } +void tst_QGraphicsScene::initialFocus_data() +{ + QTest::addColumn("activeScene"); + QTest::addColumn("explicitSetFocus"); + QTest::addColumn("isPanel"); + QTest::addColumn("shouldHaveFocus"); + + QTest::newRow("inactive scene, normal item") << false << false << false << false; + QTest::newRow("inactive scene, panel item") << false << false << true << false; + QTest::newRow("inactive scene, normal item, explicit focus") << false << true << false << true; + QTest::newRow("inactive scene, panel, explicit focus") << false << true << true << true; + QTest::newRow("active scene, normal item") << true << false << false << false; + QTest::newRow("active scene, panel item") << true << false << true << false; + QTest::newRow("active scene, normal item, explicit focus") << true << true << false << true; + QTest::newRow("active scene, panel, explicit focus") << true << true << true << true; +} + +void tst_QGraphicsScene::initialFocus() +{ + QFETCH(bool, activeScene); + QFETCH(bool, explicitSetFocus); + QFETCH(bool, isPanel); + QFETCH(bool, shouldHaveFocus); + + QGraphicsRectItem *rect = new QGraphicsRectItem; + rect->setFlag(QGraphicsItem::ItemIsFocusable); + QVERIFY(!rect->hasFocus()); + + if (isPanel) + rect->setFlag(QGraphicsItem::ItemIsPanel); + + // Setting focus on an item before adding to the scene will ensure + // it gets focus when the scene is activated. + if (explicitSetFocus) + rect->setFocus(); + + QGraphicsScene scene; + QVERIFY(!scene.isActive()); + + if (activeScene) { + QEvent windowActivate(QEvent::WindowActivate); + qApp->sendEvent(&scene, &windowActivate); + scene.setFocus(); + } + + scene.addItem(rect); + + if (!activeScene) { + QEvent windowActivate(QEvent::WindowActivate); + qApp->sendEvent(&scene, &windowActivate); + scene.setFocus(); + } + + QCOMPARE(rect->hasFocus(), shouldHaveFocus); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -- cgit v0.12 From c8bf9bd17a4520eefe4306b7b1bb4f93fb296d80 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Fri, 11 Sep 2009 14:10:12 +0200 Subject: Support for focus scopes: QGraphicsItem::ItemIsFocusScope. This feature is essential for Declarative UI, but does not add much value for C++ developers. A FocusScope provides a stack of focused widgets, and it ensures that the topmost item on the stack has focus if any of the items in the stack gains focus. When the topmost loses focus, focus is passed to the "parent" focus scope, and so on. You can get almost the same behavior using panels (ItemIsPanel), except panels impose other behavior, like stopping clickfocus propagation, and stopping event propagation in general. In a QML world you would typically use FocusScope for controlling focus locally, and panels when you need to maintain separate focus stacks. Reviewed-by: akennedy --- src/gui/graphicsview/qgraphicsitem.cpp | 183 +++++++++++++++++++++---- src/gui/graphicsview/qgraphicsitem.h | 5 +- src/gui/graphicsview/qgraphicsitem_p.h | 8 +- src/gui/graphicsview/qgraphicsscene.cpp | 13 +- src/gui/graphicsview/qgraphicsview.cpp | 4 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 89 ++++++++++++ 6 files changed, 266 insertions(+), 36 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9295ee5..838bd34 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -341,6 +341,8 @@ activates all non-panel items. Window items (i.e., QGraphicsItem::isWindow() returns true) are panels. This flag was introduced in Qt 4.6. + + \omitvalue ItemIsFocusScope Internal only (for now). */ /*! @@ -929,12 +931,9 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant); } - QGraphicsItem *lastSubFocusItem = subFocusItem; - if (subFocusItem) { - // Update the child focus chain; when reparenting an item that has a - // focus child, ensure that that focus child clears its focus child - // chain from our parents before it's reparented. - subFocusItem->clearFocus(); + if (subFocusItem && parent) { + // Make sure none of the old parents point to this guy. + subFocusItem->d_ptr->clearSubFocus(parent); } // We anticipate geometry changes. If the item is deleted, it will be @@ -960,6 +959,41 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) } } + // Ensure any last parent focus scope does not point to this item or any of + // its descendents. + QGraphicsItem *p = parent; + QGraphicsItem *parentFocusScopeItem = 0; + while (p) { + if (p->flags() & QGraphicsItem::ItemIsFocusScope) { + // If this item's focus scope's focus scope item points + // to this item or a descendent, then clear it. + QGraphicsItem *fsi = p->d_ptr->focusScopeItem; + if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) { + parentFocusScopeItem = fsi; + p->d_ptr->focusScopeItem = 0; + } + break; + } + p = p->d_ptr->parent; + } + + // Update focus scope item ptr in new scope. + if (newParent) { + QGraphicsItem *p = newParent; + while (p) { + if (p->flags() & QGraphicsItem::ItemIsFocusScope) { + // ### We really want the parent's focus scope item to point + // to this item's focusItem... + if (q_ptr->flags() & QGraphicsItem::ItemIsFocusScope) + p->d_ptr->focusScopeItem = q_ptr; + else + p->d_ptr->focusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem; + break; + } + p = p->d_ptr->parent; + } + } + if ((parent = newParent)) { bool implicitUpdate = false; if (parent->d_func()->scene && parent->d_func()->scene != scene) { @@ -1026,11 +1060,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) dirtySceneTransform = 1; // Restore the sub focus chain. - if (lastSubFocusItem) { + if (subFocusItem) { + subFocusItem->d_ptr->setSubFocus(newParent); if (parent && parent->isActive()) - lastSubFocusItem->setFocus(); - else - lastSubFocusItem->d_ptr->setSubFocus(); + subFocusItem->setFocus(); } // Deliver post-change notification @@ -1199,6 +1232,17 @@ QGraphicsItem::~QGraphicsItem() clearFocus(); + // Update focus scope item ptr. + QGraphicsItem *p = d_ptr->parent; + while (p) { + if (p->flags() & ItemIsFocusScope) { + if (p->d_ptr->focusScopeItem == this) + p->d_ptr->focusScopeItem = 0; + break; + } + p = p->d_ptr->parent; + } + if (!d_ptr->children.isEmpty()) { QList oldChildren = d_ptr->children; qDeleteAll(oldChildren); @@ -1938,11 +1982,28 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo } // Enable subfocus - if (newVisible && isWidget) { - QGraphicsWidget *widget = static_cast(q_ptr); - QGraphicsWidget *fw = widget->focusWidget(); - if (fw && fw != scene->focusItem()) - scene->setFocusItem(fw); + if (newVisible) { + QGraphicsItem *p = parent; + bool done = false; + while (p) { + if (p->flags() & QGraphicsItem::ItemIsFocusScope) { + QGraphicsItem *fsi = p->d_ptr->focusScopeItem; + if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) { + done = true; + while (fsi->d_ptr->focusScopeItem && fsi->d_ptr->focusScopeItem->isVisible()) + fsi = fsi->d_ptr->focusScopeItem; + scene->setFocusItem(fsi); + } + break; + } + p = p->d_ptr->parent; + } + if (!done) { + QGraphicsItem *fi = subFocusItem; + if (fi && fi != scene->focusItem()) { + scene->setFocusItem(fi); + } + } } // Deliver post-change notification. @@ -2730,28 +2791,53 @@ bool QGraphicsItem::hasFocus() const */ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) { + d_ptr->setFocusHelper(focusReason, /* climb = */ true); +} + +/*! + \internal +*/ +void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb) +{ // Disabled / unfocusable items cannot accept focus. - if (!isEnabled() || !(d_ptr->flags & QGraphicsItem::ItemIsFocusable)) + if (!q_ptr->isEnabled() || !(flags & QGraphicsItem::ItemIsFocusable)) return; // Find focus proxy. - QGraphicsItem *f = this; + QGraphicsItem *f = q_ptr; while (f->d_ptr->focusProxy) f = f->d_ptr->focusProxy; // Return if it already has focus. - if (d_ptr->scene && d_ptr->scene->focusItem() == f) + if (scene && scene->focusItem() == f) return; // Update the child focus chain. - d_ptr->setSubFocus(); + setSubFocus(); + + // Update focus scope item ptr. + QGraphicsItem *p = parent; + while (p) { + if (p->flags() & QGraphicsItem::ItemIsFocusScope) { + p->d_ptr->focusScopeItem = q_ptr; + if (!q_ptr->isActive()) + return; + break; + } + p = p->d_ptr->parent; + } + + if (climb) { + while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) + f = f->d_ptr->focusScopeItem; + } // Update the scene's focus item. - if (d_ptr->scene) { - QGraphicsItem *p = panel(); - if ((!p && d_ptr->scene->isActive()) || (p && p->isActive())) { + if (scene) { + QGraphicsItem *p = q_ptr->panel(); + if ((!p && scene->isActive()) || (p && p->isActive())) { // Visible items immediately gain focus from scene. - d_ptr->scene->d_func()->setFocusItemHelper(f, focusReason); + scene->d_func()->setFocusItemHelper(f, focusReason); } } } @@ -2769,8 +2855,18 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) */ void QGraphicsItem::clearFocus() { + // Pass focus to the closest parent focus scope. + QGraphicsItem *p = d_ptr->parent; + while (p) { + if (p->flags() & ItemIsFocusScope) { + p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false); + return; + } + p = p->d_ptr->parent; + } + // Invisible items with focus must explicitly clear subfocus. - d_ptr->clearSubFocus(); + d_ptr->clearSubFocus(this); if (hasFocus()) { // If this item has the scene's input focus, clear it. @@ -2854,6 +2950,16 @@ QGraphicsItem *QGraphicsItem::focusItem() const } /*! + \internal + + Returns this item's focus scope item. +*/ +QGraphicsItem *QGraphicsItem::focusScopeItem() const +{ + return d_ptr->focusScopeItem; +} + +/*! \since 4.4 Grabs the mouse input. @@ -4842,11 +4948,11 @@ void QGraphicsItemPrivate::ensureSceneTransformRecursive(QGraphicsItem **topMost /*! \internal */ -void QGraphicsItemPrivate::setSubFocus() +void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem) { // Update focus child chain. Stop at panels, or if this item // is hidden, stop at the first item with a visible parent. - QGraphicsItem *parent = q_ptr; + QGraphicsItem *parent = rootItem ? rootItem : q_ptr; do { // Clear any existing ancestor's subFocusItem. if (parent != q_ptr && parent->d_ptr->subFocusItem) { @@ -4855,23 +4961,25 @@ void QGraphicsItemPrivate::setSubFocus() parent->d_ptr->subFocusItem->d_ptr->clearSubFocus(); } parent->d_ptr->subFocusItem = q_ptr; + parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible)); - if (!parent && scene && !scene->isActive()) - scene->d_func()->lastFocusItem = q_ptr; + if (scene && !scene->isActive()) + scene->d_func()->lastFocusItem = subFocusItem; } /*! \internal */ -void QGraphicsItemPrivate::clearSubFocus() +void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem) { // Reset sub focus chain. - QGraphicsItem *parent = q_ptr; + QGraphicsItem *parent = rootItem ? rootItem : q_ptr; do { if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; + subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } @@ -4891,6 +4999,16 @@ void QGraphicsItemPrivate::resetFocusProxy() /*! \internal + Subclasses can reimplement this function to be notified when subFocusItem + changes. +*/ +void QGraphicsItemPrivate::subFocusItemChange() +{ +} + +/*! + \internal + Tells us if it is a proxy widget */ bool QGraphicsItemPrivate::isProxyWidget() const @@ -5799,6 +5917,8 @@ bool QGraphicsItem::isAncestorOf(const QGraphicsItem *child) const { if (!child || child == this) return false; + if (child->d_ptr->depth() < d_ptr->depth()) + return false; const QGraphicsItem *ancestor = child; while ((ancestor = ancestor->d_ptr->parent)) { if (ancestor == this) @@ -10547,6 +10667,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemIsPanel: str = "ItemIsPanel"; break; + case QGraphicsItem::ItemIsFocusScope: + str = "ItemIsFocusScope"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 1c969ba..bc0f30f 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -104,7 +104,8 @@ public: ItemSendsGeometryChanges = 0x800, ItemAcceptsInputMethod = 0x1000, ItemNegativeZStacksBehindParent = 0x2000, - ItemIsPanel = 0x4000 + ItemIsPanel = 0x4000, + ItemIsFocusScope = 0x8000 // internal // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) @@ -244,6 +245,7 @@ public: void setFocusProxy(QGraphicsItem *item); QGraphicsItem *focusItem() const; + QGraphicsItem *focusScopeItem() const; void grabMouse(); void ungrabMouse(); @@ -549,6 +551,7 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); + void focusChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 0b58ad3..fd2ff34 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -129,6 +129,7 @@ public: itemDepth(-1), focusProxy(0), subFocusItem(0), + focusScopeItem(0), imHints(Qt::ImhNone), acceptedMouseButtons(0x1f), visible(1), @@ -412,9 +413,11 @@ public: || (childrenCombineOpacity() && isFullyTransparent()); } - void setSubFocus(); - void clearSubFocus(); + void setFocusHelper(Qt::FocusReason focusReason, bool climb); + void setSubFocus(QGraphicsItem *rootItem = 0); + void clearSubFocus(QGraphicsItem *rootItem = 0); void resetFocusProxy(); + virtual void subFocusItemChange(); inline QTransform transformToParent() const; inline void ensureSortedChildren(); @@ -439,6 +442,7 @@ public: QGraphicsItem *focusProxy; QList focusProxyRefs; QGraphicsItem *subFocusItem; + QGraphicsItem *focusScopeItem; Qt::InputMethodHints imHints; // Packed 32 bits diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 97bc010..f6e0aaf 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -2434,8 +2434,17 @@ void QGraphicsScene::addItem(QGraphicsItem *item) // Ensure that newly added items that have subfocus set, gain // focus automatically if there isn't a focus item already. - if (!d->focusItem && item->focusItem()) - item->focusItem()->setFocus(); + if (!d->focusItem) { + if (item->focusItem() == item && item != d->lastFocusItem) { + QGraphicsItem *fi = item->focusItem() ? item->focusItem() : item->focusScopeItem(); + if (fi) { + QGraphicsItem *fsi; + while ((fsi = fi->focusScopeItem()) && fsi->isVisible()) + fi = fsi; + fi->setFocus(); + } + } + } d->updateInputMethodSensitivityInViews(); } diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 1ea0a33..b0829c5 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1537,6 +1537,9 @@ void QGraphicsView::setScene(QGraphicsScene *scene) } d->updateInputMethodSensitivity(); + + if (d->scene && hasFocus()) + d->scene->setFocus(); } /*! @@ -2607,7 +2610,6 @@ bool QGraphicsView::event(QEvent *event) bool QGraphicsView::viewportEvent(QEvent *event) { Q_D(QGraphicsView); - if (!d->scene) return QAbstractScrollArea::viewportEvent(event); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 6b5e4bb..0744fa5 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -294,6 +294,7 @@ private slots: void activationOnShowHide(); void moveWhileDeleting(); void ensureDirtySceneTransform(); + void focusScope(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -8245,5 +8246,93 @@ void tst_QGraphicsItem::ensureDirtySceneTransform() QCOMPARE(child3->sceneTransform(), QTransform::fromTranslate(-80, -80)); } +void tst_QGraphicsItem::focusScope() +{ + // ItemIsFocusScope is an internal feature (for now). + QGraphicsScene scene; + + QGraphicsRectItem *scope3 = new QGraphicsRectItem; + scope3->setData(0, "scope3"); + scope3->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scope3->setFocus(); + QVERIFY(!scope3->focusScopeItem()); + QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3); + + QGraphicsRectItem *scope2 = new QGraphicsRectItem; + scope2->setData(0, "scope2"); + scope2->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scope2->setFocus(); + QVERIFY(!scope2->focusScopeItem()); + scope3->setParentItem(scope2); + QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope2->focusItem(), (QGraphicsItem *)scope3); + + QGraphicsRectItem *scope1 = new QGraphicsRectItem; + scope1->setData(0, "scope1"); + scope1->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scope1->setFocus(); + QVERIFY(!scope1->focusScopeItem()); + scope2->setParentItem(scope1); + + QCOMPARE(scope1->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope2->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2); + QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); + + scene.addItem(scope1); + + QEvent windowActivate(QEvent::WindowActivate); + qApp->sendEvent(&scene, &windowActivate); + scene.setFocus(); + + QCOMPARE(scope1->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope2->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2); + QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3); + QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); + + QVERIFY(scope3->hasFocus()); + + scope3->hide(); + QVERIFY(scope2->hasFocus()); + scope2->hide(); + QVERIFY(scope1->hasFocus()); + scope2->show(); + QVERIFY(scope2->hasFocus()); + scope3->show(); + QVERIFY(scope3->hasFocus()); + scope1->hide(); + QVERIFY(!scope3->hasFocus()); + scope1->show(); + QVERIFY(scope3->hasFocus()); + scope3->clearFocus(); + QVERIFY(scope2->hasFocus()); + scope2->clearFocus(); + QVERIFY(scope1->hasFocus()); + scope2->hide(); + scope2->show(); + QVERIFY(!scope2->hasFocus()); + QVERIFY(scope3->hasFocus()); + + QGraphicsRectItem *rect4 = new QGraphicsRectItem; + rect4->setData(0, "rect4"); + rect4->setParentItem(scope3); + + QGraphicsRectItem *rect5 = new QGraphicsRectItem; + rect5->setData(0, "rect5"); + rect5->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + rect5->setFocus(); + rect5->setParentItem(rect4); + QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)rect5); + QVERIFY(rect5->hasFocus()); + + rect4->setParentItem(0); + QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); + QVERIFY(!scope3->hasFocus()); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 86e1b289c8246befc37455e7caa101fc20e0bc97 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Sep 2009 11:13:23 +0200 Subject: Make the test work with shadow builds. Reviewed-by: Jesper --- tests/auto/uic/tst_uic.cpp | 18 +++++++++--------- tests/auto/uic/uic.pro | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/auto/uic/tst_uic.cpp b/tests/auto/uic/tst_uic.cpp index c4759e2..60367b9 100644 --- a/tests/auto/uic/tst_uic.cpp +++ b/tests/auto/uic/tst_uic.cpp @@ -55,16 +55,16 @@ class tst_uic : public QObject public: tst_uic(); - + private Q_SLOTS: void initTestCase(); - + void run(); void run_data() const; void compare(); void compare_data() const; - + void cleanupTestCase(); private: @@ -105,8 +105,8 @@ void tst_uic::initTestCase() qDebug() << msg; process.terminate(); - QCOMPARE(QFileInfo(QLatin1String("baseline")).exists(), true); - QCOMPARE(QFileInfo(QLatin1String("generated_ui")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "baseline")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "generated_ui")).exists(), true); } void tst_uic::run() @@ -163,23 +163,23 @@ void tst_uic::compare() QFile genFile(generatedFile); if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(orgFile.fileName()).toUtf8()); } if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(genFile.fileName()).toUtf8()); } originalFile = orgFile.readAll(); originalFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); originalFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + generatedFile = genFile.readAll(); generatedFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); generatedFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + QCOMPARE(generatedFile, originalFile); } diff --git a/tests/auto/uic/uic.pro b/tests/auto/uic/uic.pro index 411a993..355cb56 100644 --- a/tests/auto/uic/uic.pro +++ b/tests/auto/uic/uic.pro @@ -5,4 +5,4 @@ SOURCES += tst_uic.cpp TARGET = tst_uic # This test is not run on wince (I think) -DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD/\\\" -- cgit v0.12 From 541ff2c0ffbe13424b212bcab145214d5725d49e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 15 Sep 2009 11:44:42 +0200 Subject: Make test pass on Windows Reviewed-by: Jan-Arve --- tests/auto/qwidget/tst_qwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ad814fd..04b7b39 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9236,13 +9236,15 @@ void tst_QWidget::destroyBackingStore() w.reset(); w.update(); - QApplication::processEvents(); delete qt_widget_private(&w)->topData()->backingStore; qt_widget_private(&w)->topData()->backingStore = 0; qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w); w.update(); QApplication::processEvents(); +#ifdef Q_WS_QWS + QApplication::processEvents(); +#endif QCOMPARE(w.numPaintEvents, 1); // Check one more time, because the second time around does more caching. -- cgit v0.12 From 4a7e5c25339a7d52cbcd7d4c6ff792f7d991a70c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Sep 2009 12:02:19 +0200 Subject: Export again qt_set_sequence_auto_mnemonic Became unexported from commit bcd23411c8 Task-number: 261250 --- src/gui/kernel/qkeysequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 2530f38..aec757f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -145,7 +145,7 @@ static int qtkeyForMacSymbol(const QChar ch) #else static bool qt_sequence_no_mnemonics = false; #endif -void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } +void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } /*! \class QKeySequence -- cgit v0.12 From f60e8c21c1d031daa8984461f9e5a6988e3ce2e7 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 15 Sep 2009 12:05:50 +0200 Subject: doc: Fixed some qdoc errors. --- src/gui/effects/qgraphicseffect.cpp | 12 +++++++ src/gui/graphicsview/qgraphicsanchorlayout.cpp | 45 ++------------------------ src/svg/qgraphicssvgitem.cpp | 17 ++++++++-- 3 files changed, 29 insertions(+), 45 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 26489c5..c0877a4 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -493,6 +493,12 @@ void QGraphicsGrayscaleEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsGrayscaleEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the grayscale + strength property. \a strength contains the new strength value of + the grayscale effect. + */ + /*! \reimp */ @@ -602,6 +608,12 @@ void QGraphicsColorizeEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsColorizeEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the colorize + strength property. \a strength contains the new strength value of + the colorize effect. + */ + /*! \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index f57f65f..5897ae4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -257,9 +257,9 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem, } /*! - Anchors two or four edges of \a firstItem with the corresponding edges of \secondItem, - so that \a firstItem has the same size as \a secondItem in the dimensions specified by - \a orientation. + Anchors two or four edges of \a firstItem with the corresponding + edges of \a secondItem, so that \a firstItem has the same size as + \a secondItem in the dimensions specified by \a orientations. Calling this convenience function with the following arguments \code @@ -288,45 +288,6 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, } /*! - \fn QGraphicsAnchorLayout::addLeftAndRightAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the left and right edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorLeft, secondItem, Qt::AnchorLeft); - l->addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addTopAndBottomAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the top and bottom edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorTop, secondItem, Qt::AnchorTop); - l->addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addAllAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors all edges (left, right, top and bottom) of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addLeftAndRightAnchors(firstItem, secondItem); - l->addTopAndBottomAnchors(firstItem, secondItem); - \endcode -*/ - -/*! Sets the default horizontal spacing for the anchor layout to \a spacing. \sa horizontalSpacing(), setVerticalSpacing(), setSpacing() diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index ea26c78..bcdd821 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -265,6 +265,12 @@ int QGraphicsSvgItem::type() const return Type; } +/*! + \property QGraphicsSvgItem::maximumCacheSize + + This property holds the maximum size of the device coordinate cache + for this item. + */ /*! Sets the maximum device coordinate cache size of the item to \a size. @@ -305,8 +311,13 @@ QSize QGraphicsSvgItem::maximumCacheSize() const } /*! - Sets the XML ID of the element that this item should render to \a - id. + \property QGraphicsSvgItem::elementId + + This property holds the element's XML ID. + */ + +/*! + Sets the XML ID of the element to \a id. */ void QGraphicsSvgItem::setElementId(const QString &id) { @@ -318,7 +329,7 @@ void QGraphicsSvgItem::setElementId(const QString &id) /*! Returns the XML ID the element that is currently - being renderer. Returns an empty string if the whole + being rendered. Returns an empty string if the whole file is being rendered. */ QString QGraphicsSvgItem::elementId() const -- cgit v0.12 From af1cfbc945c7c01adea09d3d369699f4dd0daab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 12:27:37 +0200 Subject: Fixed rendering errors in blurpicker with -graphicssystem opengl 1) Need to transfer to brush drawing mode when switching active engine, to make sure we reset the vertex / texture coordinate pointers for image drawing. 2) QGLPixmapGLPaintDevice::beginPaint() was changed to use QGLContext::drawTexture() for blitting the old texture contents to the render FBO, which means that we also need to set up viewport, modelview, and projection matrices, and ensure that clipping / stencil testing is disabled. 3) Make sure stencil testing is disabled when clearing the FBO. Reviewed-by: Tom --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 1 + src/opengl/qpixmapdata_gl.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 5e790cf..e41d0b4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1385,6 +1385,7 @@ void QGL2PaintEngineEx::ensureActive() d->device->ensureActiveTarget(); if (d->needsSync) { + d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); glDepthMask(false); glDepthFunc(GL_LESS); diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 0bc46e1..d5398a9 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -149,6 +149,7 @@ void QGLPixmapGLPaintDevice::beginPaint() if (data->needsFill()) { const QColor &c = data->fillColor(); float alpha = c.alphaF(); + glDisable(GL_SCISSOR_TEST); glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); glClear(GL_COLOR_BUFFER_BIT); } @@ -157,8 +158,21 @@ void QGLPixmapGLPaintDevice::beginPaint() // uploaded from an image or rendered into before), we need to // copy it from the texture to the render FBO. + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + glMatrixMode(GL_MODELVIEW_MATRIX); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION_MATRIX); + glLoadIdentity(); + glOrtho(0, data->width(), data->height(), 0, -999999, 999999); + + glViewport(0, 0, data->width(), data->height()); + // Pass false to bind so it doesn't copy the FBO into the texture! - context()->drawTexture(QPointF(0.0, 0.0), data->bind(false)); + context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); } } -- cgit v0.12 From 6a90f032d160f35058373fce16efd1b5d2190bf1 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 15 Sep 2009 12:32:42 +0200 Subject: Fixed QLineEdit to pass the tst_QLineEdit::displayText() autotest. Fetch the correct password character from the style. Reviewed-by: Olivier --- src/gui/widgets/qlineedit.cpp | 6 +++++- src/gui/widgets/qlineedit_p.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index a55ca8e..37e57cf 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2047,7 +2047,11 @@ void QLineEdit::changeEvent(QEvent *ev) d->control->setFont(font()); break; case QEvent::StyleChange: - d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + { + QStyleOptionFrameV2 opt; + initStyleOption(&opt); + d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); + } update(); break; case QEvent::LayoutDirectionChange: diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 4fe02a2..148da1b 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -159,7 +159,10 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(updateNeeded(const QRect &)), q, SLOT(update())); - control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + + QStyleOptionFrameV2 opt; + q->initStyleOption(&opt); + control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q)); #ifndef QT_NO_CURSOR q->setCursor(Qt::IBeamCursor); #endif -- cgit v0.12 From 2b21c3f4022c64ee6f0178b1866f22639c377ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 12:35:17 +0200 Subject: Made QGraphicsBlurEffect use the high blur quality setting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This greatly increases the blur quality in the OpenGL implementation, and doesn't affect the performance of the raster implementation. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index c0877a4..ee87323 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -794,6 +794,8 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { + Q_D(QGraphicsBlurEffect); + d->filter->setQuality(Qt::SmoothTransformation); } /*! -- cgit v0.12 From cd5f0f868bc830c6b350e8263fd53597f52e1146 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 15 Sep 2009 13:01:45 +0200 Subject: Doc: Added some snippets to the multimedia audio docs. --- doc/src/snippets/audio/main.cpp | 109 ++++++++++++++++++++++++++++++ src/multimedia/audio/qaudiodeviceinfo.cpp | 6 +- src/multimedia/audio/qaudioformat.cpp | 3 +- src/multimedia/audio/qaudioinput.cpp | 7 +- src/multimedia/audio/qaudiooutput.cpp | 7 +- 5 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 doc/src/snippets/audio/main.cpp diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp new file mode 100644 index 0000000..a215d43 --- /dev/null +++ b/doc/src/snippets/audio/main.cpp @@ -0,0 +1,109 @@ + +#include + +#include +#include +#include + +class Window2 : public QWidget +{ + Q_OBJECT + +public slots: +//![0] + void stateChanged(QAudio::State newState) + { + switch(newState) { + case QAudio::StopState: + if (input->error() != QAudio::NoError) { + // Error handling + } else { + + } + break; +//![0] + default: + ; + } + } + +private: + QAudioInput *input; + +}; + +class Window : public QWidget +{ + Q_OBJECT + +public: + Window() + { + output = new QAudioOutput; + connect(output, SIGNAL(stateChanged(QAudio::State)), + this, SLOT(stateChanged(QAudio::State))); + } + +private: + void setupFormat() + { +//![1] + QAudioFormat format; + format.setFrequency(44100); +//![1] + format.setChannels(2); + format.setSampleSize(16); + format.setCodec("audio/pcm"); + format.setByteOrder(QAudioFormat::LittleEndian); +//![2] + format.setSampleType(QAudioFormat::SignedInt); + + QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice(); + QAudioDeviceInfo info(id); + + if (!info.isFormatSupported(format)) + format = info.nearestFormat(format); +//![2] + } + +public slots: +//![3] + void stateChanged(QAudio::State newState) + { + switch (newState) { + case QAudio::StopState: + if (output->error() != QAudio::NoError) { + // Do your error handlin + } else { + // Normal stop + } + break; +//![3] + + // Handle + case QAudio::ActiveState: + // Handle active state... + break; + break; + default: + ; + } + } + +private: + QAudioOutput *output; +}; + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Window window; + window.show(); + + return app.exec(); +} + + +#include "main.moc" + diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index e349733..e38a91e 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -71,7 +71,11 @@ QT_BEGIN_NAMESPACE audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a supported format that is as close as possible to the format with - nearestFormat(). + nearestFormat(). For instance: + + \snippet doc/src/snippets/audio/main.cpp 1 + \dots 8 + \snippet doc/src/snippets/audio/main.cpp 2 A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is an identifier for a physical device. It is used by Qt to construct diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index ddfcc2c..c23e454 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -134,7 +134,8 @@ public: through functions in QAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See the QAudioDeviceInfo class - description for details. + description for details. You need to know the format of the audio + streams you wish to play. Qt does not set up formats for you. */ /*! diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index edf6dd6..3c0d98e 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -128,7 +128,12 @@ QT_BEGIN_NAMESPACE which states the QAudioInput has been in. If an error should occur, you can fetch its reason with error(). - The possible error reasons are described by the QAudio::Error enum. + The possible error reasons are described by the QAudio::Error + enum. The QAudioInput will enter the \l{QAudio::}{StopState} when + an error is encountered. Connect to the stateChanged() signal to + handle the error: + + \snippet doc/src/snippets/audio/main.cpp 0 \sa QAudioOutput, QAudioDeviceInfo */ diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 556b616..8a8edb4 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -129,9 +129,12 @@ QT_BEGIN_NAMESPACE If an error occurs, you can fetch the \l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum - for a description of the possible errors that are reported. + for a description of the possible errors that are reported. When + an error is encountered, the state changes to QAudio::StopState. + You can check for errors by connecting to the stateChanged() + signal: - If an error is encountered state changes to QAudio::StopState. + \snippet doc/src/snippets/audio/main.cpp 3 \sa QAudioInput, QAudioDeviceInfo */ -- cgit v0.12 From afb6c4935dc6a7be0f9de092003477692559815c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Sep 2009 14:19:43 +0200 Subject: Fix ambiguous overload for QTileRules constructor Also fix the relations in the documentation Reviewed-by: David Boddie --- src/corelib/tools/qmargins.cpp | 2 ++ src/gui/painting/qdrawutil.cpp | 6 ++++-- src/gui/painting/qdrawutil.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index f5441a3..58cef4a 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE QMargin objects can be streamed as well as compared. + \sa qDrawBorderPixmap + */ diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 17cf196..7be8e04 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1044,7 +1044,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, Holds the rules used to draw a pixmap or image split into nine segments, similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}. - \sa Qt::TileRule, QMargins + \sa Qt::TileRule, QMargins, qDrawBorderPixmap */ /*! \fn QTileRules::QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) @@ -1060,7 +1060,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, /*! \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \since 4.6 - \relates QMargins + \relates QPainter Draws the given \a pixmap into the given \a target rectangle, using the given \a painter. The pixmap will be split into nine segments and drawn @@ -1156,6 +1156,8 @@ static inline void qDrawHorizontallyRoundedPixmap(QPainter *painter, const QRect /*! \since 4.6 + \relates QPainter + Draws the indicated \a sourceRect rectangle from the given \a pixmap into the given \a targetRect rectangle, using the given \a painter. The pixmap will be split into nine segments according to the given \a targetMargins diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index ce89e22..3a2dd0e 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -135,7 +135,7 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU struct QTileRules { - inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule = Qt::Stretch) + inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) : horizontal(horizontalRule), vertical(verticalRule) {} inline QTileRules(Qt::TileRule rule = Qt::Stretch) : horizontal(rule), vertical(rule) {} -- cgit v0.12 From d9597782202b2be117874330ceee95040c7365cb Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 15 Sep 2009 12:14:03 +0200 Subject: Don't do pixel tests in QGraphicsEffect on other than 32-bit display. Reviewed-by: Paul Olav Tvete --- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index d5205cd..ba3783b 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -41,6 +41,7 @@ #include +#include #include #include #include @@ -369,6 +370,11 @@ void tst_QGraphicsEffect::opacity() void tst_QGraphicsEffect::grayscale() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); @@ -412,6 +418,11 @@ void tst_QGraphicsEffect::grayscale() void tst_QGraphicsEffect::colorize() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); -- cgit v0.12 From 14b0db1a93deb0fd13dd27c1d6bda9d78b544b68 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 15 Sep 2009 13:04:11 +0200 Subject: QNativeSocketEngine on Windows: don't bail out on non-fatal error receiving the WSAEMSGSIZE error means we could not read all the data because the buffer was too small, but still we should return the number of bytes read and not return -1 Reviewed-by: Marius Storm-Olsen --- src/network/socket/qnativesocketengine_win.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 3478130..63fe78e 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -917,9 +917,15 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, &aa.a, &sz,0,0); if (wsaRet == SOCKET_ERROR) { int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); - ret = -1; + if (err == WSAEMSGSIZE) { + // it is ok the buffer was to small if bytesRead is larger than + // maxLength then assume bytes read is really maxLenth + ret = qint64(bytesRead) > maxLength ? maxLength : qint64(bytesRead); + } else { + WS_ERROR_DEBUG(err); + setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); + ret = -1; + } } else { ret = qint64(bytesRead); } -- cgit v0.12 From 57e0656e92ac8e8dac1a6d6f1e434a78d641e05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 14:19:57 +0200 Subject: Removed GL1 pixmap filters and ported colorize filter to GL2 engine. The GL1 engine will use the raster fall back for pixmap filters. We anyhow use GLSL for the filters, which requires OpenGL 2 support, and in that case the GL2 engine is the default. Reviewed-by: Gunnar Sletta --- src/opengl/qglpixmapfilter.cpp | 67 +++++++++++++------------------------- src/opengl/qpaintengine_opengl.cpp | 14 -------- src/opengl/qpaintengine_opengl_p.h | 2 -- 3 files changed, 22 insertions(+), 61 deletions(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 6ebc397..7876661 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -68,17 +68,16 @@ void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const processGL(painter, pos, src, source); } -class QGLPixmapColorizeFilter: public QGLPixmapFilter +class QGLPixmapColorizeFilter: public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapColorizeFilter(); + void setUniforms(QGLShaderProgram *program); protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; private: - mutable QGLShaderProgram m_program; - int m_colorUniform; + mutable QGLShader *m_shader; }; class QGLPixmapConvolutionFilter: public QGLPixmapFilter @@ -104,9 +103,6 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: - QGLPixmapBlurFilter(); - ~QGLPixmapBlurFilter(); - void setUniforms(QGLShaderProgram *program); protected: @@ -120,8 +116,6 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; - - QGLShaderProgram *m_program; }; extern QGLWidget *qt_gl_share_widget(); @@ -183,41 +177,34 @@ static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, con } static const char *qt_gl_colorize_filter = - "uniform sampler2D texture;" - "uniform vec3 color;" - "void main(void)" + "uniform lowp vec4 colorizeColor;" + "uniform lowp float colorizeStrength;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" "{" - " vec2 coords = gl_TexCoord[0].st;" - " vec4 src = texture2D(texture, coords);" - " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));" - " vec3 colorizeed = 1.0-((1.0-gray)*(1.0-color));" - " gl_FragColor = vec4(colorizeed, src.a);" + " lowp vec4 srcPixel = texture2D(src, srcCoords);" + " lowp float gray = dot(srcPixel.rgb, vec3(0.212671, 0.715160, 0.072169));" + " lowp vec3 colorized = 1.0-((1.0-gray)*(1.0-colorizeColor.rgb));" + " return vec4(mix(srcPixel.rgb, colorized * srcPixel.a, colorizeStrength), srcPixel.a);" "}"; -QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() +bool QGLPixmapColorizeFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { - m_program.addShader(QGLShader::FragmentShader, qt_gl_colorize_filter); - m_program.link(); - m_program.enable(); - m_program.setUniformValue(m_program.uniformLocation("texture"), GLint(0)); // GL_TEXTURE_0 - m_colorUniform = m_program.uniformLocation("color"); -} + QGLPixmapColorizeFilter *filter = const_cast(this); + filter->setSource(qt_gl_colorize_filter); -bool QGLPixmapColorizeFilter::processGL(QPainter *, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - bindTexture(src); - - QColor col = color(); - m_program.enable(); - m_program.setUniformValue(m_colorUniform, col.redF(), col.greenF(), col.blueF()); - - QRectF target = (srcRect.isNull() ? QRectF(src.rect()) : srcRect).translated(pos); - qgl_drawTexture(target, src.width(), src.height(), srcRect); - m_program.disable(); + filter->setOnPainter(painter); + painter->drawPixmap(pos, src); + filter->removeFromPainter(painter); return true; } +void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program) +{ + program->setUniformValue("colorizeColor", color()); + program->setUniformValue("colorizeStrength", float(strength())); +} + // generates convolution filter code for arbitrary sized kernel QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { QByteArray code; @@ -310,14 +297,6 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const return true; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter() -{ -} - -QGLPixmapBlurFilter::~QGLPixmapBlurFilter() -{ -} - bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast(this); @@ -384,8 +363,6 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) program->setUniformValue("delta", 1.0, 0.0); else program->setUniformValue("delta", 0.0, 1.0); - - m_program = program; } static inline qreal gaussian(qreal dx, qreal sigma) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index ff00f29..bd3883a 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -5625,20 +5625,6 @@ void QOpenGLPaintEnginePrivate::ensureDrawableTexture() #endif } -QPixmapFilter *QOpenGLPaintEngine::createPixmapFilter(int type) const -{ -#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) - if (QGLContext::currentContext()) - return QGLContext::currentContext()->d_func()->createPixmapFilter(type); - else - return 0; -#else - Q_UNUSED(type); - return 0; -#endif -} - - QT_END_NAMESPACE #include "qpaintengine_opengl.moc" diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index c8f460a..4fea638 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -136,8 +136,6 @@ public: void drawEllipse(const QRectF &rect); - QPixmapFilter *createPixmapFilter(int type) const; - #ifdef Q_WS_WIN HDC handle() const; #else -- cgit v0.12 From 0b2b41f11b5e037f93480a1af2c84c59739f685d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 14:32:40 +0200 Subject: Fix linenumbers. --- .../auto/linguist/lupdate/testdata/good/backslashes/project.ts.result | 2 +- tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result index f2d109b..d3a5fdf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result @@ -4,7 +4,7 @@ QApplication - + QT_LAYOUT_DIRECTION Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index 93adae4..b27d239 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ FindDialog - + Qt Assistant - Finn text - + Finn tekst - Der Bjørn möchte auch mal. -- cgit v0.12 From 59aa130bb9209aa1809c7bd31f694265eeb1baf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 14:33:18 +0200 Subject: When parsing a java file do not simply ignore the first character. If the file started with a comment (/* .. */) the parser would not see the first '/' character, thus it would not treat it as a comment. This was because we called getChar() just before we called parse(), and just after we had entered parse(). --- tools/linguist/lupdate/java.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 05b1987..3f532d5 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -631,7 +631,6 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c yyFileName = filename; yyCurLineNo = 1; yyParenLineNo = 1; - yyCh = getChar(); parse(&translator); -- cgit v0.12 From 85c79e53208b0171198cb748ad85b5be1af7a558 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 15 Sep 2009 14:55:13 +0200 Subject: doc: Fixed some qdoc errors. --- doc/src/frameworks-technologies/gestures.qdoc | 41 ++++++++++++++------------- src/gui/image/qimagereader.cpp | 3 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 57f25ba..a0eab21 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -58,21 +58,21 @@ \section1 Overview - QGesture is the central class in Qt's gesture framework, providing the API - used by classes that represent specific gestures, such as QPanGesture, - QPinchGesture, and QSwipeGesture. These standard classes are ready to use, - and each exposes functions and properties that give gesture-specific - information about the user's input. This is described in the - \l{#Using Standard Gestures}{Using Standard Gestures} section. - - QGesture is also designed to be subclassed and extended so that support for - new gestures can be implemented by developers. Adding support for a new - gesture involves implementing code to recognize the gesture from incoming - events. This is described in the - \l{#Creating Your Own Gesture Recognizer}{Creating Your Own Gesture Recognizer} - section. - - \section1 Using Standard Gestures with Widgets + QGesture is the central class in Qt's gesture framework, providing + the API used by classes that represent specific gestures, such as + QPanGesture, QPinchGesture, and QSwipeGesture. These standard + classes are ready to use, and each exposes functions and + properties that give gesture-specific information about the user's + input. This is described in the section \l{Using Standard Gestures + With Widgets}. + + QGesture is also designed to be subclassed and extended so that + support for new gestures can be implemented by developers. Adding + support for a new gesture involves implementing code to recognize + the gesture from incoming events. This is described in the section + \l{Creating Your Own Gesture Recognizer}. + + \section1 Using Standard Gestures With Widgets Gesture objects are applied directly to widgets and other controls that accept user input \mdash these are the \e{target objects}. When a gesture object is @@ -91,10 +91,11 @@ \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture - Here, the \l{QGesture::}{triggered()} signal is used to inform the application - that a gesture was used. More precise monitoring of a gesture can be implemented - by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and - \l{QGesture::}{finished()} signals to slots. + Here, the \l{QGesture::} {triggered()} signal is used to inform + the application that a gesture was used. More precise monitoring + of a gesture can be implemented by connecting its \l{QGesture::} + {started()}, \l{QGesture::} {canceled()} and \l{QGesture::} + {finished()} signals to slots. Responding to a signal is simply a matter of obtaining the gesture that sent it and examining the information it contains. @@ -141,7 +142,7 @@ \table \header \o New State \o Description \o QGesture Actions on Entering this State - \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{cancelled()} + \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()} \row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()} \row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()} \row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()} diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5cd768f..aff186b 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -696,13 +696,12 @@ bool QImageReader::autoDetectImageFormat() const /*! - Specifies that the image reader should decide which plugin to use solely based on the contents in the datastream. Setting this flag means that all image plugins gets loaded. Each plugin will read the first bytes in the image data and decide if - the plugin is compatible or not. + the plugin is compatible or not. The flag is set to \a ignored. This also disables auto detecting image format. */ -- cgit v0.12 From 38cc0e34757d05e88d50275d8a9856347c053995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 15 Sep 2009 15:07:57 +0200 Subject: Removed a debug output that was a bit annoying Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy_mac.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 9e2b0e4..2c7e250 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -170,8 +170,7 @@ QList macQueryInternal(const QNetworkProxyQuery &query) (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); QString url = QCFString::toQString(pacUrl); - // ### Use PAC somehow - qDebug("Mac system proxy: found PAC script at \"%s\"", qPrintable(url)); + // ### TODO: Use PAC somehow } } -- cgit v0.12 From fd8be39b40467be69a7cd9c5a009c5a47c6a4e9b Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 15 Sep 2009 15:02:36 +0200 Subject: Remove unused signal declaration. This came in with change c8bf9bd17a4520eefe4306b7b1bb4f93fb296d80, by accident - it was a leftover after debugging. Reviewed-by: Martin Smith --- src/gui/graphicsview/qgraphicsitem.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index bc0f30f..665f33f 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -551,7 +551,6 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); - void focusChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); -- cgit v0.12 From 4c779ca7cd74b77ec5f7e480b9762acccce3c4ad Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 15 Sep 2009 15:12:52 +0200 Subject: Fix a bug in FocusScopes; ensure subFocus is set correctly. The bug was triggered by setting focus on a parent scope (which then passes focus to the innermost scope). Subfocus was set up for the first scope, but not the inner scopes. Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 4 +++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 838bd34..81eeb39 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2830,6 +2830,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (climb) { while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) f = f->d_ptr->focusScopeItem; + if (f != q_ptr) + f->d_ptr->setSubFocus(); } // Update the scene's focus item. @@ -4979,7 +4981,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem) if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; - subFocusItemChange(); + parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 0744fa5..304330e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8332,6 +8332,22 @@ void tst_QGraphicsItem::focusScope() rect4->setParentItem(0); QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); QVERIFY(!scope3->hasFocus()); + + QGraphicsRectItem *rectA = new QGraphicsRectItem; + QGraphicsRectItem *scopeA = new QGraphicsRectItem(rectA); + scopeA->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeA->setFocus(); + QGraphicsRectItem *scopeB = new QGraphicsRectItem(scopeA); + scopeB->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeB->setFocus(); + + scene.addItem(rectA); + QVERIFY(rect5->hasFocus()); + QVERIFY(!scopeB->hasFocus()); + + scopeA->setFocus(); + QVERIFY(scopeB->hasFocus()); + QCOMPARE(scopeB->focusItem(), (QGraphicsItem *)scopeB); } QTEST_MAIN(tst_QGraphicsItem) -- cgit v0.12 From f42f5c457b3368adb4c92e521dc56969f138bdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 15 Sep 2009 15:23:07 +0200 Subject: Make the scrollUpdate test function work. We could sometimes have more than two paint events even before reaching QTRY_COMPARE, thus it would fail. The test failed on Windows. --- tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 626a691..c86d9e3 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1507,7 +1507,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTRY_COMPARE(view.npaints, 1); + QTRY_VERIFY(view.npaints >= 1); QTest::qWait(20); widget->paintEventRegion = QRegion(); widget->npaints = 0; -- cgit v0.12 From 72fc24222ab7f89dc9e606e315ebfb134ba157a8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 15 Sep 2009 15:22:10 +0200 Subject: Fix drawing text in QPicture and printing in right-to-left mode Change 979d1d3bbc0c68789edbe93f03464d41d7a8469a requires qt_format_text() to honor the Qt::TextForceLeftToRight flag. Without this, the text will be laid out RTL twice, and the output will be broken. Since printing is done through QPicture, this fixes printing when the UI is reversed. Task-number: 261033 Reviewed-by: Trond --- src/gui/painting/qpainter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 358e856..97f3dd4 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7469,7 +7469,11 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, bool hidemnmemonic = (tf & Qt::TextHideMnemonic); Qt::LayoutDirection layout_direction; - if(option) + if (tf & Qt::TextForceLeftToRight) + layout_direction = Qt::LeftToRight; + else if (tf & Qt::TextForceRightToLeft) + layout_direction = Qt::RightToLeft; + else if (option) layout_direction = option->textDirection(); else if (painter) layout_direction = painter->layoutDirection(); -- cgit v0.12 From 60d2026c8fc9295df2777a84e7831dbea07560d8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 15 Sep 2009 14:17:22 +0200 Subject: Silenced GLSL compiler warning on Mac OS X --- src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 4 +++- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 2502069..fec1973 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -282,7 +282,8 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS // We have to bind the vertex attribute names before the program is linked: cached.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); - cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + if (cached.useTextureCoords) + cached.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); cached.program->link(); if (!cached.program->isLinked()) { @@ -491,6 +492,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg() QGLEngineShaderProg requiredProgram; requiredProgram.program = 0; + requiredProgram.useTextureCoords = useTextureCoords; // Choose vertex shader main function QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 423df99..0bb580d 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -245,6 +245,8 @@ struct QGLEngineShaderProg QVector uniformLocations; + bool useTextureCoords; + bool operator==(const QGLEngineShaderProg& other) { // We don't care about the program return ( mainVertexShader == other.mainVertexShader && -- cgit v0.12 From 56cec4cf9a8b04c979ced28cab89ce6232d4184a Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 15 Sep 2009 14:12:08 +0200 Subject: QCursor support for Symbian OS Reviewed-By: Jason Barron Reviewed-By: Alessandro Portale Summary: QT_NO_CURSOR is now not defined for symbian builds Existing QCursor APIs are all supported New public API, QApplication::setNavigationMode, to allow the navigation mode to be set. I.E. on an S60 3.2 phone, some applications will want a virtual mouse cursor (web browser), while others are designed for keypad navigation. Symbian HAL is used for detecting input capabilities. Fix DND, code cleanup & comment QCursor visibility now uses a refcount, and is called from DND and the setNavigationMode so they are both simpler and don't interfere with each other. QApplication::setNavigationMode New public API for configuring cursor/keypad navi style. This links in with ongoing work on the 4-way keypad navi branch, but 2-way and 4-way modes both act as 2-way mode until that is integrated Some of the demos/examples have cursor switched on (those that were not usable with keypad) Virtual mouse support for non touch, non mouse phones (tested on N78) add *.d and .metadata (carbide debug file / workspace dir) to .gitignore System pointers are unavailable when using sprite workaround, so the system cursor shapes are compiled into qtgui as resources. MAC port does this also for shapes that aren't standard on the MAC. Refactor Drag'n'Drop to use QCursor Add test case to check all system cursor shapes Simply a mainwindow containing a label widget for each cursor shape, with the cursor property set appropriately QCursor(QBitmap,QBitmap) supported Fixed problem with the image & mask being inverted when using the QCursor constructor that takes two mono bitmaps. add .make.cache files to .gitignore Correct implementation of QApplication::setOverrideCursor QApplication::restoreOverrideCursor and QApplication::setOverrideCursor are now working correctly on Symbian platform. Performance will be slower compared with other platforms, because the Symbian window server has a cursor associated with each native window. Add test case for custom cursors Create a pixmap cursor and associate it with a widget. No changes to production code, since test passed 1st time ;) Add manual test for QCursor Make cursor independent of construction order Updated to work around window server issue where contruction order affects what cursor is displayed in child windows. Also changed to effectiveWinId following review comments Also fixed a problem which would make qcursor not link if configured with QT_NO_CURSOR Moved some multiply declared extern functions from cpp to _p.h files Implemented Symbian versions of the cursor functions. Merged in work I'd done based on tower. Fill in bits of stub functions based on windows port Removed QT_NO_CURSOR from list of config options forced on symbian Recompiled configure.exe Added stub functions for the missing functions in s60 port --- .gitignore | 2 + configure.exe | Bin 1165824 -> 2038784 bytes demos/deform/main.cpp | 3 + demos/embedded/anomaly/src/Main.cpp | 3 + demos/embedded/embeddedsvgviewer/main.cpp | 3 + demos/embedded/flightinfo/flightinfo.pro | 2 +- demos/embedded/lightmaps/lightmaps.pro | 2 +- demos/embedded/weatherinfo/weatherinfo.pro | 2 +- demos/pathstroke/main.cpp | 3 + examples/animation/animatedtiles/main.cpp | 3 + examples/draganddrop/fridgemagnets/main.cpp | 3 + src/corelib/global/qglobal.h | 5 + src/corelib/global/qnamespace.h | 8 + src/corelib/global/qnamespace.qdoc | 26 ++ src/gui/image/qpixmap_s60.cpp | 10 +- src/gui/kernel/qapplication.cpp | 90 +++- src/gui/kernel/qapplication.h | 4 +- src/gui/kernel/qapplication_p.h | 16 +- src/gui/kernel/qapplication_s60.cpp | 307 +++++++++++++- src/gui/kernel/qapplication_x11.cpp | 2 - src/gui/kernel/qcursor.h | 18 +- src/gui/kernel/qcursor_p.h | 14 +- src/gui/kernel/qcursor_qws.cpp | 2 - src/gui/kernel/qcursor_s60.cpp | 471 ++++++++++++++++++++- src/gui/kernel/qcursor_win.cpp | 2 - src/gui/kernel/qcursor_x11.cpp | 3 +- src/gui/kernel/qdnd_p.h | 7 +- src/gui/kernel/qdnd_s60.cpp | 148 +++---- src/gui/kernel/qt_s60_p.h | 23 + src/gui/kernel/qwidget.cpp | 1 - src/gui/kernel/qwidget_s60.cpp | 77 +++- src/gui/kernel/qwidget_win.cpp | 2 - src/gui/kernel/symbian.pri | 1 + src/gui/symbian/images/blank.png | Bin 0 -> 91 bytes src/gui/symbian/images/busy12.png | Bin 0 -> 253 bytes src/gui/symbian/images/busy3.png | Bin 0 -> 251 bytes src/gui/symbian/images/busy6.png | Bin 0 -> 253 bytes src/gui/symbian/images/busy9.png | Bin 0 -> 255 bytes src/gui/symbian/images/closehand.png | Bin 0 -> 190 bytes src/gui/symbian/images/cross.png | Bin 0 -> 145 bytes src/gui/symbian/images/forbidden.png | Bin 0 -> 256 bytes src/gui/symbian/images/handpoint.png | Bin 0 -> 230 bytes src/gui/symbian/images/ibeam.png | Bin 0 -> 176 bytes src/gui/symbian/images/openhand.png | Bin 0 -> 201 bytes src/gui/symbian/images/pointer.png | Bin 0 -> 222 bytes src/gui/symbian/images/sizeall.png | Bin 0 -> 188 bytes src/gui/symbian/images/sizebdiag.png | Bin 0 -> 192 bytes src/gui/symbian/images/sizefdiag.png | Bin 0 -> 197 bytes src/gui/symbian/images/sizehor.png | Bin 0 -> 175 bytes src/gui/symbian/images/sizever.png | Bin 0 -> 171 bytes src/gui/symbian/images/splith.png | Bin 0 -> 206 bytes src/gui/symbian/images/splitv.png | Bin 0 -> 205 bytes src/gui/symbian/images/uparrow.png | Bin 0 -> 157 bytes src/gui/symbian/images/wait1.png | Bin 0 -> 219 bytes src/gui/symbian/images/wait10.png | Bin 0 -> 220 bytes src/gui/symbian/images/wait11.png | Bin 0 -> 220 bytes src/gui/symbian/images/wait12.png | Bin 0 -> 213 bytes src/gui/symbian/images/wait2.png | Bin 0 -> 219 bytes src/gui/symbian/images/wait3.png | Bin 0 -> 210 bytes src/gui/symbian/images/wait4.png | Bin 0 -> 215 bytes src/gui/symbian/images/wait5.png | Bin 0 -> 217 bytes src/gui/symbian/images/wait6.png | Bin 0 -> 213 bytes src/gui/symbian/images/wait7.png | Bin 0 -> 215 bytes src/gui/symbian/images/wait8.png | Bin 0 -> 217 bytes src/gui/symbian/images/wait9.png | Bin 0 -> 209 bytes src/gui/symbian/images/whatsthis.png | Bin 0 -> 254 bytes src/gui/symbian/symbianresources.qrc | 37 ++ src/qbase.pri | 8 + src/testlib/qtest.h | 2 +- src/testlib/qtestcase.cpp | 2 +- tests/manual/qcursor/allcursors/allcursors.pro | 16 + tests/manual/qcursor/allcursors/main.cpp | 13 + tests/manual/qcursor/allcursors/mainwindow.cpp | 43 ++ tests/manual/qcursor/allcursors/mainwindow.h | 28 ++ tests/manual/qcursor/allcursors/mainwindow.ui | 210 +++++++++ .../qcursor/grab_override/data/monkey_on_64x64.png | Bin 0 -> 3479 bytes .../manual/qcursor/grab_override/grab_override.pro | 18 + tests/manual/qcursor/grab_override/images.qrc | 6 + tests/manual/qcursor/grab_override/main.cpp | 13 + tests/manual/qcursor/grab_override/mainwindow.cpp | 100 +++++ tests/manual/qcursor/grab_override/mainwindow.h | 35 ++ tests/manual/qcursor/grab_override/mainwindow.ui | 97 +++++ tests/manual/qcursor/qcursor.pro | 3 + tools/configure/configureapp.cpp | 1 - 84 files changed, 1719 insertions(+), 176 deletions(-) create mode 100644 src/gui/symbian/images/blank.png create mode 100644 src/gui/symbian/images/busy12.png create mode 100644 src/gui/symbian/images/busy3.png create mode 100644 src/gui/symbian/images/busy6.png create mode 100644 src/gui/symbian/images/busy9.png create mode 100644 src/gui/symbian/images/closehand.png create mode 100644 src/gui/symbian/images/cross.png create mode 100644 src/gui/symbian/images/forbidden.png create mode 100644 src/gui/symbian/images/handpoint.png create mode 100644 src/gui/symbian/images/ibeam.png create mode 100644 src/gui/symbian/images/openhand.png create mode 100644 src/gui/symbian/images/pointer.png create mode 100644 src/gui/symbian/images/sizeall.png create mode 100644 src/gui/symbian/images/sizebdiag.png create mode 100644 src/gui/symbian/images/sizefdiag.png create mode 100644 src/gui/symbian/images/sizehor.png create mode 100644 src/gui/symbian/images/sizever.png create mode 100644 src/gui/symbian/images/splith.png create mode 100644 src/gui/symbian/images/splitv.png create mode 100644 src/gui/symbian/images/uparrow.png create mode 100644 src/gui/symbian/images/wait1.png create mode 100644 src/gui/symbian/images/wait10.png create mode 100644 src/gui/symbian/images/wait11.png create mode 100644 src/gui/symbian/images/wait12.png create mode 100644 src/gui/symbian/images/wait2.png create mode 100644 src/gui/symbian/images/wait3.png create mode 100644 src/gui/symbian/images/wait4.png create mode 100644 src/gui/symbian/images/wait5.png create mode 100644 src/gui/symbian/images/wait6.png create mode 100644 src/gui/symbian/images/wait7.png create mode 100644 src/gui/symbian/images/wait8.png create mode 100644 src/gui/symbian/images/wait9.png create mode 100644 src/gui/symbian/images/whatsthis.png create mode 100644 src/gui/symbian/symbianresources.qrc create mode 100644 tests/manual/qcursor/allcursors/allcursors.pro create mode 100644 tests/manual/qcursor/allcursors/main.cpp create mode 100644 tests/manual/qcursor/allcursors/mainwindow.cpp create mode 100644 tests/manual/qcursor/allcursors/mainwindow.h create mode 100644 tests/manual/qcursor/allcursors/mainwindow.ui create mode 100644 tests/manual/qcursor/grab_override/data/monkey_on_64x64.png create mode 100644 tests/manual/qcursor/grab_override/grab_override.pro create mode 100644 tests/manual/qcursor/grab_override/images.qrc create mode 100644 tests/manual/qcursor/grab_override/main.cpp create mode 100644 tests/manual/qcursor/grab_override/mainwindow.cpp create mode 100644 tests/manual/qcursor/grab_override/mainwindow.h create mode 100644 tests/manual/qcursor/grab_override/mainwindow.ui create mode 100644 tests/manual/qcursor/qcursor.pro diff --git a/.gitignore b/.gitignore index 282c8bc..feb1ea4 100644 --- a/.gitignore +++ b/.gitignore @@ -174,6 +174,7 @@ doc/qch doc-build .rcc .pch +.metadata # Symbian build system generated files # --------------------- @@ -199,6 +200,7 @@ plugin_commonU.def .project .cproject .make.cache +*.d qtc-debugging-helper src/corelib/lib diff --git a/configure.exe b/configure.exe index 4c095d2..2c5b717 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/demos/deform/main.cpp b/demos/deform/main.cpp index cb92a21..6110a76 100644 --- a/demos/deform/main.cpp +++ b/demos/deform/main.cpp @@ -68,5 +68,8 @@ int main(int argc, char **argv) else deformWidget.show(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif return app.exec(); } diff --git a/demos/embedded/anomaly/src/Main.cpp b/demos/embedded/anomaly/src/Main.cpp index f9610d3..cf32420 100644 --- a/demos/embedded/anomaly/src/Main.cpp +++ b/demos/embedded/anomaly/src/Main.cpp @@ -67,5 +67,8 @@ int main(int argc, char *argv[]) app.setStyle("windows"); #endif +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif return app.exec(); } diff --git a/demos/embedded/embeddedsvgviewer/main.cpp b/demos/embedded/embeddedsvgviewer/main.cpp index 10c7d76..9c91fb7 100644 --- a/demos/embedded/embeddedsvgviewer/main.cpp +++ b/demos/embedded/embeddedsvgviewer/main.cpp @@ -64,5 +64,8 @@ int main(int argc, char** argv) viewer.showFullScreen(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif return app.exec(); } diff --git a/demos/embedded/flightinfo/flightinfo.pro b/demos/embedded/flightinfo/flightinfo.pro index 461c701..2f36cb8 100644 --- a/demos/embedded/flightinfo/flightinfo.pro +++ b/demos/embedded/flightinfo/flightinfo.pro @@ -9,6 +9,6 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.UID3 = 0xA000CF74 HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h - LIBS += -lesock -lconnmon + LIBS += -lesock -lconnmon -linsock TARGET.CAPABILITY = NetworkServices } diff --git a/demos/embedded/lightmaps/lightmaps.pro b/demos/embedded/lightmaps/lightmaps.pro index 137183a..d4168b1 100644 --- a/demos/embedded/lightmaps/lightmaps.pro +++ b/demos/embedded/lightmaps/lightmaps.pro @@ -6,7 +6,7 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.UID3 = 0xA000CF75 HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h - LIBS += -lesock -lconnmon + LIBS += -lesock -lconnmon -linsock TARGET.CAPABILITY = NetworkServices TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/demos/embedded/weatherinfo/weatherinfo.pro b/demos/embedded/weatherinfo/weatherinfo.pro index 0a579b0..7bff6e9 100644 --- a/demos/embedded/weatherinfo/weatherinfo.pro +++ b/demos/embedded/weatherinfo/weatherinfo.pro @@ -8,6 +8,6 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.UID3 = 0xA000CF77 HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h - LIBS += -lesock -lconnmon + LIBS += -lesock -lconnmon -linsock TARGET.CAPABILITY = NetworkServices } diff --git a/demos/pathstroke/main.cpp b/demos/pathstroke/main.cpp index 7c4ad83..60520f1 100644 --- a/demos/pathstroke/main.cpp +++ b/demos/pathstroke/main.cpp @@ -65,5 +65,8 @@ int main(int argc, char **argv) else pathStrokeWidget.show(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif return app.exec(); } diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp index dfdaf73..ca52f47 100644 --- a/examples/animation/animatedtiles/main.cpp +++ b/examples/animation/animatedtiles/main.cpp @@ -274,6 +274,9 @@ int main(int argc, char **argv) timer.setSingleShot(true); rootState->addTransition(&timer, SIGNAL(timeout()), ellipseState); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif return app.exec(); } diff --git a/examples/draganddrop/fridgemagnets/main.cpp b/examples/draganddrop/fridgemagnets/main.cpp index eed8f70..6cff7c5c 100644 --- a/examples/draganddrop/fridgemagnets/main.cpp +++ b/examples/draganddrop/fridgemagnets/main.cpp @@ -51,6 +51,9 @@ int main(int argc, char *argv[]) smallScreen = true; QApplication app(argc, argv); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); +#endif DragWidget window; if (smallScreen) window.showFullScreen(); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 897dcea..6a781e8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2386,6 +2386,11 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #if defined(Q_OS_SYMBIAN) +#ifdef SYMBIAN_GRAPHICS_USE_GCE +//RWsPointerCursor is fixed, so don't use low performance sprites +#define Q_SYMBIAN_FIXED_POINTER_CURSORS +#endif + //Symbian does not support data imports from a DLL #define Q_NO_DATA_RELOCATION diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index c8e30d4..c39e602 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1618,6 +1618,14 @@ public: GestureFinished = 3 }; + enum NavigationMode + { + NavigationModeNone, + NavigationModeKeypadTabOrder, + NavigationModeKeypadDirectional, + NavigationModeCursorAuto, + NavigationModeCursorForceVisible + }; } #ifdef Q_MOC_RUN ; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 52fed47..314dfb2 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2781,3 +2781,29 @@ \sa QGesture */ + +/*! + \enum Qt::NavigationMode + \since 4.6 + + This enum type describes the mode for moving focus. + + \value NavigationModeNone Only the touch screen is used. + \value NavigationModeKeypadTabOrder Qt::Key_Up and Qt::Key_Down are used to change focus. + \value NavigationModeKeypadDirectional Qt::Key_Up, Qt::Key_Down, Qt::Key_Left and Qt::Key_Right are used to change focus. + \value NavigationModeCursorAuto The mouse cursor is used to change focus, + it is displayed only on non touchscreen devices. + The keypad is used to implement a virtual cursor, unless + the device has an analog mouse type of input device (e.g. touchpad). + This is the recommended setting for an application such as a web browser that + needs pointer control on both touch and non-touch devices. + \value NavigationModeCursorForceVisible The mouse cursor is used to change focus, + it is displayed regardless of device type. + The keypad is used to implement a virtual cursor, unless + the device has an analog mouse type of input device (e.g. touchpad) + + \note: in 4.6, cursor navigation is only implemented for Symbian OS. + On other platforms, it behaves as NavigationModeNone. + \sa QApplication::setNavigationMode + \sa QApplication::navigationMode +*/ diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 493e440..666e557 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -178,7 +178,12 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const return 0; } - const QImage converted = img.convertToFormat(destFormat); + QImage converted = img.convertToFormat(destFormat); + + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + if (mode == EGray2) + converted.invertPixels(); bitmap->LockHeap(); const uchar *sptr = converted.bits(); @@ -220,6 +225,9 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) image.setNumColors(2); image.setColor(0, QColor(Qt::color0).rgba()); image.setColor(1, QColor(Qt::color1).rgba()); + //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid + //So invert mono bitmaps so that masks work correctly. + image.invertPixels(); } else if (displayMode == EGray256) { for (int i=0; i < 256; ++i) image.setColor(i, qRgb(i, i, i)); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index a19e022..1fd2d39 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -458,10 +458,10 @@ bool QApplicationPrivate::widgetCount = false; bool QApplicationPrivate::inSizeMove = false; #endif #ifdef QT_KEYPAD_NAVIGATION -# if defined(Q_OS_SYMBIAN) -bool QApplicationPrivate::keypadNavigation = true; +# ifdef Q_OS_SYMBIAN +Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; # else -bool QApplicationPrivate::keypadNavigation = false; +Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadTabOrder; # endif QWidget *QApplicationPrivate::oldEditFocus = 0; #endif @@ -2521,12 +2521,6 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool Creates the proper Enter/Leave event when widget \a enter is entered and widget \a leave is left. */ -#if defined(Q_WS_WIN) - extern void qt_win_set_cursor(QWidget *, bool); -#elif defined(Q_WS_X11) - extern void qt_x11_enforce_cursor(QWidget *, bool); -#endif - void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { #if 0 if (leave) { @@ -2676,6 +2670,8 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_win_set_cursor(cursorWidget, true); #elif defined(Q_WS_X11) qt_x11_enforce_cursor(cursorWidget, true); +#elif defined(Q_WS_S60) + qt_symbian_set_cursor(cursorWidget, true); #endif } } @@ -4777,10 +4773,36 @@ void QApplicationPrivate::emitLastWindowClosed() #ifdef QT_KEYPAD_NAVIGATION /*! - Sets whether Qt should use focus navigation suitable for use with a - minimal keypad. + Sets what kind of focus navigation Qt should use. + + This feature is available in Qt for Embedded Linux, Symbian and Windows CE + only. + + \note On Windows CE this feature is disabled by default for touch device + mkspecs. To enable keypad navigation, build Qt with + QT_KEYPAD_NAVIGATION defined. + + \note On Symbian, setting the mode to Qt::NavigationModeCursorAuto will enable a + virtual mouse cursor on non touchscreen devices, which is controlled + by the cursor keys if there is no analog pointer device. + On other platforms and on touchscreen devices, it has the same + meaning as Qt::NavigationModeNone. + + \since 4.6 + + \sa keypadNavigationEnabled() +*/ +void QApplication::setNavigationMode(Qt::NavigationMode mode) +{ +#ifdef Q_OS_SYMBIAN + QApplicationPrivate::setNavigationMode(mode); +#else + QApplicationPrivate::navigationMode = mode; +#endif +} - If \a enable is true, Qt::Key_Up and Qt::Key_Down are used to change focus. +/*! + Returns what kind of focus navigation Qt is using. This feature is available in Qt for Embedded Linux, Symbian and Windows CE only. @@ -4788,12 +4810,47 @@ void QApplicationPrivate::emitLastWindowClosed() \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. + + \note On Symbian, the default mode is Qt::NavigationModeNone for touch + devices, and Qt::NavigationModeKeypadDirectional. + + \since 4.6 \sa keypadNavigationEnabled() */ +Qt::NavigationMode QApplication::navigationMode() +{ + return QApplicationPrivate::navigationMode; +} + +/*! + Sets whether Qt should use focus navigation suitable for use with a + minimal keypad. + + This feature is available in Qt for Embedded Linux, Symbian and Windows CE + only. + + + \note On Windows CE this feature is disabled by default for touch device + mkspecs. To enable keypad navigation, build Qt with + QT_KEYPAD_NAVIGATION defined. + + \deprecated + + \sa setNavigationMode() +*/ void QApplication::setKeypadNavigationEnabled(bool enable) { - QApplicationPrivate::keypadNavigation = enable; + if (enable) { +#ifdef Q_OS_SYMBIAN + QApplication::setNavigationMode(Qt::NavigationModeKeypadDirectional); +#else + QApplication::setNavigationMode(Qt::NavigationModeKeypadTabOrder); +#endif + } + else { + QApplication::setNavigationMode(Qt::NavigationModeNone); + } } /*! @@ -4806,12 +4863,15 @@ void QApplication::setKeypadNavigationEnabled(bool enable) \note On Windows CE this feature is disabled by default for touch device mkspecs. To enable keypad navigation, build Qt with QT_KEYPAD_NAVIGATION defined. + + \deprecated - \sa setKeypadNavigationEnabled() + \sa navigationMode() */ bool QApplication::keypadNavigationEnabled() { - return QApplicationPrivate::keypadNavigation; + return QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadTabOrder || + QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadDirectional; } #endif diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 216cfff..0562251 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -272,8 +272,10 @@ public: static bool quitOnLastWindowClosed(); #ifdef QT_KEYPAD_NAVIGATION - static void setKeypadNavigationEnabled(bool); + static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool); static bool keypadNavigationEnabled(); + static void setNavigationMode(Qt::NavigationMode mode); + static Qt::NavigationMode navigationMode(); #endif Q_SIGNALS: diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index c33eb1a..707caaa 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -71,6 +71,9 @@ #include "QtGui/qscreen_qws.h" #include #endif +#ifdef Q_OS_SYMBIAN +#include +#endif QT_BEGIN_NAMESPACE @@ -492,8 +495,8 @@ public: static int app_compile_version; #ifdef QT_KEYPAD_NAVIGATION - static bool keypadNavigation; static QWidget *oldEditFocus; + static Qt::NavigationMode navigationMode; #endif #if defined(Q_WS_MAC) || defined(Q_WS_X11) @@ -511,7 +514,9 @@ public: QWidget *native, QWidget **buttonDown, QPointer &lastMouseReceiver, bool spontaneous = true); #ifdef Q_OS_SYMBIAN + static void setNavigationMode(Qt::NavigationMode mode); static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); + QSet nativeWindows; #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) void sendSyntheticEnterLeave(QWidget *widget); @@ -595,6 +600,15 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QTouchEvent::DeviceType deviceType, const QList &touchPoints); +#if defined(Q_WS_WIN) + extern void qt_win_set_cursor(QWidget *, bool); +#elif defined(Q_WS_X11) + extern void qt_x11_enforce_cursor(QWidget *, bool); + extern void qt_x11_enforce_cursor(QWidget *); +#elif defined(Q_OS_SYMBIAN) + extern void qt_symbian_set_cursor(QWidget *, bool); +#endif + QT_END_NAMESPACE #endif // QAPPLICATION_P_H diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 00932a0..fd889fc 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -73,6 +73,9 @@ #include "private/qstylesheetstyle_p.h" +#include +#include + QT_BEGIN_NAMESPACE #if defined(QT_DEBUG) @@ -151,21 +154,21 @@ void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) void QS60Beep::Play() { - if(iState!=EBeepNotPrepared){ - if(iState==EBeepPlaying) { + if (iState != EBeepNotPrepared) { + if (iState == EBeepPlaying) { iToneUtil->CancelPlay(); - iState=EBeepPrepared; + iState = EBeepPrepared; } } iToneUtil->Play(); - iState=EBeepPlaying; + iState = EBeepPlaying; } void QS60Beep::MatoPrepareComplete(TInt aError) { - if(aError==KErrNone) { - iState=EBeepPrepared; + if (aError == KErrNone) { + iState = EBeepPrepared; } } @@ -320,8 +323,9 @@ void QSymbianControl::ConstructL(bool topLevel, bool desktop) { if (!desktop) { - if (topLevel) + if (topLevel) { CreateWindowL(S60->windowGroup()); + } SetFocusing(true); m_longTapDetector = QLongTapTimer::NewL(this); @@ -330,6 +334,8 @@ void QSymbianControl::ConstructL(bool topLevel, bool desktop) QSymbianControl::~QSymbianControl() { + if (S60->curWin == this) + S60->curWin = 0; S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; } @@ -392,14 +398,15 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick) + if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove) { - // get the button press target + // get the widget where the event happened alienWidget = qwidget->childAt(widgetPos); if (!alienWidget) alienWidget = qwidget; S60->mousePressTarget = alienWidget; } + alienWidget = S60->mousePressTarget; if (alienWidget != S60->lastPointerEventTarget) @@ -412,12 +419,30 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); events.append(Event(S60->lastPointerEventTarget,mEventLeave)); } - QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); - - events.append(Event(alienWidget,mEventEnter)); + if (alienWidget) { + QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), + globalPos, button, QApplicationPrivate::mouse_buttons, mapToQtModifiers( + pEvent.iModifiers)); + + events.append(Event(alienWidget, mEventEnter)); +#ifndef QT_NO_CURSOR + S60->curWin = alienWidget->effectiveWinId(); + if (!QApplication::overrideCursor()) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_set_pointer_sprite(alienWidget->cursor()); + else +#endif + qt_symbian_setWindowCursor(alienWidget->cursor(), S60->curWin); + } +#endif + } } S60->lastCursorPos = globalPos; +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_move_cursor_sprite(); +#endif S60->lastPointerEventPos = widgetPos; S60->lastPointerEventTarget = alienWidget; if (alienWidget) @@ -494,6 +519,82 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod // Special S60 keys. keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym); } + +#ifndef QT_NO_CURSOR + if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) { + //translate keys to pointer + if (keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down || keyCode == Qt::Key_Select) { + /*Explanation about virtualMouseAccel: + Tapping an arrow key allows precise pixel positioning + Holding an arrow key down, acceleration is applied to allow cursor + to be quickly moved to another part of the screen by key repeats. + */ + if (S60->virtualMouseLastKey == keyCode) { + S60->virtualMouseAccel *= 2; + if (S60->virtualMouseAccel > S60->virtualMouseMaxAccel) + S60->virtualMouseAccel = S60->virtualMouseMaxAccel; + } + else + S60->virtualMouseAccel = 1; + S60->virtualMouseLastKey = keyCode; + + QPoint pos = QCursor::pos(); + TPointerEvent fakeEvent; + TInt x = pos.x(); + TInt y = pos.y(); + if (type == EEventKeyUp) { + if (keyCode == Qt::Key_Select) + fakeEvent.iType = TPointerEvent::EButton1Up; + S60->virtualMouseAccel = 1; + S60->virtualMouseLastKey = 0; + } + else if (type == EEventKey) { + switch (keyCode) { + case Qt::Key_Left: + x -= S60->virtualMouseAccel; + fakeEvent.iType = TPointerEvent::EMove; + break; + case Qt::Key_Right: + x += S60->virtualMouseAccel; + fakeEvent.iType = TPointerEvent::EMove; + break; + case Qt::Key_Up: + y -= S60->virtualMouseAccel; + fakeEvent.iType = TPointerEvent::EMove; + break; + case Qt::Key_Down: + y += S60->virtualMouseAccel; + fakeEvent.iType = TPointerEvent::EMove; + break; + case Qt::Key_Select: + fakeEvent.iType = TPointerEvent::EButton1Down; + break; + } + } + //clip to screen size (window server allows a sprite hotspot to be outside the screen) + if (x < 0) + x = 0; + else if (x >= S60->screenWidthInPixels) + x = S60->screenWidthInPixels - 1; + if (y < 0) + y = 0; + else if (y >= S60->screenHeightInPixels) + y = S60->screenHeightInPixels - 1; + TPoint epos(x, y); + TPoint cpos = epos - PositionRelativeToScreen(); + fakeEvent.iModifiers = keyEvent.iModifiers; + fakeEvent.iPosition = cpos; + fakeEvent.iParentPosition = epos; + HandlePointerEvent(fakeEvent); + return EKeyWasConsumed; + } + else { + S60->virtualMouseLastKey = keyCode; + S60->virtualMouseAccel = 1; + } + } +#endif + Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), @@ -557,7 +658,7 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) #if !defined(QT_NO_IM) && defined(Q_WS_S60) if (widget && widget->isEnabled() && widget->testAttribute(Qt::WA_InputMethodEnabled)) { QInputContext *qic = widget->inputContext(); - if(qic && qic->filterEvent(keyEvent)) + if (qic && qic->filterEvent(keyEvent)) return EKeyWasConsumed; } #endif // !defined(QT_NO_IM) && defined(Q_WS_S60) @@ -574,11 +675,10 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const { QWidget *w = 0; - if(qwidget->hasFocus()) { + if (qwidget->hasFocus()) w = qwidget; - } else { + else w = qwidget->focusWidget(); - } QCoeFepInputContext *ic; if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled) @@ -749,6 +849,70 @@ void qt_init(QApplicationPrivate * /* priv */, int) TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); + // enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app, + // and for dimming behind modal windows + S60->windowGroup().EnableFocusChangeEvents(); + + //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this) + const TInt KMachineUidSamsungI8510 = 0x2000C51E; + const TInt KMachineUidSamsungI550 = 0x2000A678; + TInt machineUID; + TInt mouse; + TInt touch; + TInt err; + err = HAL::Get(HALData::EMouse, mouse); + if (err != KErrNone) + mouse = 0; + err = HAL::Get(HALData::EMachineUid, machineUID); + if (err != KErrNone) + machineUID = 0; + err = HAL::Get(HALData::EPen, touch); + if (err != KErrNone) + touch = 0; + if (mouse || machineUID == KMachineUidSamsungI8510) { + S60->hasTouchscreen = false; + S60->virtualMouseRequired = false; + } + else if (!touch) { + S60->hasTouchscreen = false; + S60->virtualMouseRequired = true; + } + else { + S60->hasTouchscreen = true; + S60->virtualMouseRequired = false; + } + + if (touch) { + QApplicationPrivate::navigationMode = Qt::NavigationModeNone; + } else { + QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; + } + + //Check if window server pointer cursors are supported or not +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + //In generic binary, use the HAL and OS version + //Any other known good phones should be added here. + if (machineUID == KMachineUidSamsungI8510 || (QSysInfo::symbianVersion() != QSysInfo::SV_9_4 + && QSysInfo::symbianVersion() != QSysInfo::SV_9_3 && QSysInfo::symbianVersion() + != QSysInfo::SV_9_2)) { + S60->brokenPointerCursors = false; + qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup()); + } + else + S60->brokenPointerCursors = true; +#endif + + if (S60->mouseInteractionEnabled) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) { + qt_symbian_set_pointer_sprite(Qt::ArrowCursor); + qt_symbian_show_pointer_sprite(); + } + else +#endif + S60->wsSession().SetPointerCursorMode(EPointerCursorNormal); + } + /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; @@ -785,6 +949,9 @@ void qt_cleanup() // it dies. delete QApplicationPrivate::inputContext; QApplicationPrivate::inputContext = 0; + + //Change mouse pointer back + S60->wsSession().SetPointerCursorMode(EPointerCursorNone); if (S60->qtOwnsS60Environment) { CEikonEnv* coe = CEikonEnv::Static(); @@ -1016,9 +1183,8 @@ void QApplication::beep() TTimeIntervalMicroSeconds duration(500000); QS60Beep* beep=NULL; TRAPD(err, beep=QS60Beep::NewL(frequency, duration)); - if(!err) { + if (!err) beep->Play(); - } delete beep; beep=NULL; } @@ -1108,7 +1274,31 @@ int QApplication::s60ProcessEvent(TWsEvent *event) return 1; } break; - default: + case EEventFocusGained: + RDebug::Printf("focus gained %x", control); + //re-enable mouse interaction + if (S60->mouseInteractionEnabled) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_show_pointer_sprite(); + else +#endif + S60->wsSession().SetPointerCursorMode(EPointerCursorNormal); + } + break; + case EEventFocusLost: + RDebug::Printf("focus lost %x", control); + //disable mouse as may be moving to application that does not support it + if (S60->mouseInteractionEnabled) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_hide_pointer_sprite(); + else +#endif + S60->wsSession().SetPointerCursorMode(EPointerCursorNone); + } + break; + default: break; } @@ -1279,4 +1469,81 @@ void QSessionManager::cancel() } #endif //QT_NO_SESSIONMANAGER + +#ifdef QT_KEYPAD_NAVIGATION +/* + * Show/Hide the mouse cursor depending on phone type and chosen mode + */ +void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode) +{ +#ifndef QT_NO_CURSOR + const bool wasCursorOn = (QApplicationPrivate::navigationMode == Qt::NavigationModeCursorAuto + && !S60->hasTouchscreen) + || QApplicationPrivate::navigationMode == Qt::NavigationModeCursorForceVisible; + const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto + && !S60->hasTouchscreen) + || mode == Qt::NavigationModeCursorForceVisible; + + if (!wasCursorOn && isCursorOn) { + //Show the cursor, when changing from another mode to cursor mode + qt_symbian_set_cursor_visible(true); + } + else if (wasCursorOn && !isCursorOn) { + //Hide the cursor, when leaving cursor mode + qt_symbian_set_cursor_visible(false); + } +#endif + QApplicationPrivate::navigationMode = mode; +} +#endif + +#ifndef QT_NO_CURSOR +/***************************************************************************** + QApplication cursor stack + *****************************************************************************/ + +void QApplication::setOverrideCursor(const QCursor &cursor) +{ + qApp->d_func()->cursor_list.prepend(cursor); + qt_symbian_setGlobalCursor(cursor); +} + +void QApplication::restoreOverrideCursor() +{ + if (qApp->d_func()->cursor_list.isEmpty()) + return; + qApp->d_func()->cursor_list.removeFirst(); + + if (!qApp->d_func()->cursor_list.isEmpty()) { + qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first()); + } + else { + //determine which widget has focus + QWidget *w = QApplication::widgetAt(QCursor::pos()); +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) { + qt_symbian_set_pointer_sprite(w ? w->cursor() : Qt::ArrowCursor); + } + else +#endif + { + //because of the internals of window server, we need to force the cursor + //to be set in all child windows too, otherwise when the cursor is over + //the child window it may show a widget cursor or arrow cursor instead, + //depending on construction order. + QListIterator iter(QWidgetPrivate::mapper->uniqueKeys()); + while (iter.hasNext()) { + CCoeControl *ctrl = iter.next(); + ctrl->DrawableWindow()->ClearPointerCursor(); + } + if (w) + qt_symbian_setWindowCursor(w->cursor(), w->effectiveWinId()); + else + qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup()); + } + } +} + +#endif // QT_NO_CURSOR + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 1ce799c..601cd11 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2820,8 +2820,6 @@ void QApplicationPrivate::applyX11SpecificCommandLineArguments(QWidget *main_wid QApplication cursor stack *****************************************************************************/ -extern void qt_x11_enforce_cursor(QWidget * w); - void QApplication::setOverrideCursor(const QCursor &cursor) { qApp->d_func()->cursor_list.prepend(cursor); diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 389a110..2b2aa4a 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -72,13 +72,19 @@ private: #ifndef QT_NO_CURSOR -struct QCursorData; +class QCursorData; class QBitmap; class QPixmap; #if defined(Q_WS_MAC) void qt_mac_set_cursor(const QCursor *c, const QPoint &p); #endif +#if defined(Q_OS_SYMBIAN) +extern void qt_symbian_show_pointer_sprite(); +extern void qt_symbian_hide_pointer_sprite(); +extern void qt_symbian_set_pointer_sprite(const QCursor& cursor); +extern void qt_symbian_move_cursor_sprite(); +#endif class Q_GUI_EXPORT QCursor { @@ -103,7 +109,7 @@ public: static QPoint pos(); static void setPos(int x, int y); inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); } - + #ifdef qdoc HCURSOR_or_HANDLE handle() const; QCursor(HCURSOR cursor); @@ -122,6 +128,8 @@ public: Qt::HANDLE handle() const; #elif defined(Q_WS_QWS) int handle() const; +#elif defined(Q_OS_SYMBIAN) + Qt::HANDLE handle() const; #endif #endif @@ -131,6 +139,12 @@ private: friend void *qt_mac_nsCursorForQCursor(const QCursor &c); friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p); #endif +#if defined(Q_OS_SYMBIAN) + friend void qt_symbian_show_pointer_sprite(); + friend void qt_symbian_hide_pointer_sprite(); + friend void qt_symbian_set_pointer_sprite(const QCursor& cursor); + friend void qt_symbian_move_cursor_sprite(); +#endif }; #ifdef QT3_SUPPORT diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index aa4f4b2..12166c8 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -64,6 +64,8 @@ # include "private/qt_x11_p.h" # elif defined(Q_WS_WIN) # include "QtCore/qt_windows.h" +# elif defined(Q_OS_SYMBIAN) +# include "private/qt_s60_p.h" #endif QT_BEGIN_NAMESPACE @@ -74,7 +76,8 @@ class QMacAnimateCursor; #endif class QBitmap; -struct QCursorData { +class QCursorData { +public: QCursorData(Qt::CursorShape s = Qt::ArrowCursor); ~QCursorData(); @@ -111,12 +114,21 @@ struct QCursorData { } curs; void initCursorFromBitmap(); void initCursorFromPixmap(); +#elif defined Q_OS_SYMBIAN + void loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval=0); + void constructShapeSprite(RWsSpriteBase& target); + void constructCursorSprite(RWsSpriteBase& target); + RWsPointerCursor pcurs; + RWsSprite scurs; + RPointerArray nativeSpriteMembers; #endif static bool initialized; void update(); static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY); }; +extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp + QT_END_NAMESPACE #endif // QCURSOR_P_H diff --git a/src/gui/kernel/qcursor_qws.cpp b/src/gui/kernel/qcursor_qws.cpp index eda826b..0eeb187 100644 --- a/src/gui/kernel/qcursor_qws.cpp +++ b/src/gui/kernel/qcursor_qws.cpp @@ -78,8 +78,6 @@ QCursorData::~QCursorData() Global cursors *****************************************************************************/ -extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp - int QCursor::handle() const { return d->id; diff --git a/src/gui/kernel/qcursor_s60.cpp b/src/gui/kernel/qcursor_s60.cpp index b812994..757eaa8 100644 --- a/src/gui/kernel/qcursor_s60.cpp +++ b/src/gui/kernel/qcursor_s60.cpp @@ -40,12 +40,22 @@ ****************************************************************************/ #include +#include +#include +#include #include #include +#include +#include +#include +#include -#ifdef QT_NO_CURSOR QT_BEGIN_NAMESPACE +static QCursor cursorSprite; +static int cursorSpriteVisible; + +//pos and setpos are required whether cursors are configured or not. QPoint QCursor::pos() { return S60->lastCursorPos; @@ -53,8 +63,467 @@ QPoint QCursor::pos() void QCursor::setPos(int x, int y) { + //clip to screen size (window server allows a sprite hotspot to be outside the screen) + if (x < 0) + x=0; + else if (x >= S60->screenWidthInPixels) + x = S60->screenWidthInPixels - 1; + if (y < 0) + y = 0; + else if (y >= S60->screenHeightInPixels) + y = S60->screenHeightInPixels - 1; + +#ifndef QT_NO_CURSOR +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors && cursorSpriteVisible) + cursorSprite.d->scurs.SetPosition(TPoint(x,y)); + else +#endif + S60->wsSession().SetPointerCursorPosition(TPoint(x, y)); +#endif S60->lastCursorPos = QPoint(x, y); + //send a fake mouse move event, so that enter/leave events go to the widget hierarchy + QWidget *w = QApplication::topLevelAt(S60->lastCursorPos); + if (w) { + CCoeControl* ctrl = w->effectiveWinId(); + TPoint epos(x, y); + TPoint cpos = epos - ctrl->PositionRelativeToScreen(); + TPointerEvent fakeEvent; + fakeEvent.iType = TPointerEvent::EMove; + fakeEvent.iModifiers = 0U; + fakeEvent.iPosition = cpos; + fakeEvent.iParentPosition = epos; + ctrl->HandlePointerEventL(fakeEvent); + } +} + +#ifndef QT_NO_CURSOR +/* + * Request cursor to be turned on or off. + * Reference counted, so 2 on + 1 off = on, for example + */ +void qt_symbian_set_cursor_visible(bool visible) { + if (visible) + cursorSpriteVisible++; + else + cursorSpriteVisible--; + Q_ASSERT(cursorSpriteVisible >=0); + + if (cursorSpriteVisible && !S60->mouseInteractionEnabled) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_show_pointer_sprite(); + else +#endif + S60->wsSession().SetPointerCursorMode(EPointerCursorNormal); + } else if (!cursorSpriteVisible && S60->mouseInteractionEnabled) { +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_hide_pointer_sprite(); + else +#endif + S60->wsSession().SetPointerCursorMode(EPointerCursorNone); + } + S60->mouseInteractionEnabled = ((cursorSpriteVisible > 0) ? true : false); +} + +/* + * Check if the cursor is on or off + */ +bool qt_symbian_is_cursor_visible() { + return S60->mouseInteractionEnabled; +} + +QCursorData::QCursorData(Qt::CursorShape s) : + cshape(s), bm(0), bmm(0), hx(0), hy(0), pcurs() +{ + ref = 1; +} + +QCursorData::~QCursorData() +{ + for(int i=0;iiBitmap; + delete nativeSpriteMembers[i]->iMaskBitmap; + } + nativeSpriteMembers.ResetAndDestroy(); + pcurs.Close(); + delete bm; + delete bmm; +} + +/* Create a bitmap cursor, this is called by public constructors in the + * generic QCursor code. + */ +QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) +{ + if (!QCursorData::initialized) + QCursorData::initialize(); + if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) { + qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); + QCursorData *c = qt_cursorTable[0]; + c->ref.ref(); + return c; + } + QCursorData *d = new QCursorData; + d->bm = new QBitmap(bitmap); + d->bmm = new QBitmap(mask); + d->cshape = Qt::BitmapCursor; + d->hx = hotX >= 0 ? hotX : bitmap.width() / 2; + d->hy = hotY >= 0 ? hotY : bitmap.height() / 2; + return d; +} + +/* + * returns an opaque native handle to a cursor. + * It happens to be the address of the native handle, as window server handles + * are not POD types. Note there is no QCursor(HANDLE) constructor on Symbian, + * Mac or QWS. + */ +Qt::HANDLE QCursor::handle() const +{ + if (d->pcurs.WsHandle()) + return reinterpret_cast (&(d->pcurs)); + +#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS + // don't construct shape cursors, QApplication_s60 will use the system cursor instead + if (!(d->bm)) + return 0; +#endif + + d->pcurs = RWsPointerCursor(S60->wsSession()); + d->pcurs.Construct(0); + d->constructCursorSprite(d->pcurs); + d->pcurs.Activate(); + + return reinterpret_cast (&(d->pcurs)); +} + +#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS +/* + * Loads a single cursor shape from resources and appends it to a native sprite. + * Animated cursors (e.g. the busy cursor) have multiple members. + */ +void QCursorData::loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval) +{ + QPixmap pix; + CFbsBitmap* native; + QScopedPointer member(new TSpriteMember); + member->iInterval = interval; + member->iInvertMask = false; + member->iMaskBitmap = 0; // all shapes are RGBA + member->iDrawMode = CGraphicsContext::EDrawModePEN; + member->iOffset = TPoint(-hx, -hy); + QString res(QLatin1String(":/trolltech/symbian/cursors/images/%1.png")); + pix.load(res.arg(resource)); + native = pix.toSymbianCFbsBitmap(); + member->iBitmap = native; + qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data())); + target.AppendMember(*(member.take())); +} + +//TODO: after 4.6, connect with style & skins? +/* + * Constructs the native cursor from resources compiled into QtGui + * This is needed only when the platform doesn't have system cursors. + * + * System cursors are higher performance, since they are constructed once + * and shared by all applications by specifying the shape number. + * Due to symbian platform security considerations, and the fact most + * existing phones have a broken RWsPointerCursor, system cursors are not + * being used. + */ +void QCursorData::constructShapeSprite(RWsSpriteBase& target) +{ + int i; + switch (cshape) { + default: + qWarning("QCursorData::constructShapeSprite unknown shape %d", cshape); + //fall through and give arrow cursor + case Qt::ArrowCursor: + loadShapeFromResource(target, QLatin1String("pointer"), 1, 1); + break; + case Qt::UpArrowCursor: + loadShapeFromResource(target, QLatin1String("uparrow"), 4, 0); + break; + case Qt::CrossCursor: + loadShapeFromResource(target, QLatin1String("cross"), 7, 7); + break; + case Qt::WaitCursor: + for (i = 1; i <= 12; i++) { + loadShapeFromResource(target, QString(QLatin1String("wait%1")).arg(i), 7, 7, 1000000); + } + break; + case Qt::IBeamCursor: + loadShapeFromResource(target, QLatin1String("ibeam"), 3, 10); + break; + case Qt::SizeVerCursor: + loadShapeFromResource(target, QLatin1String("sizever"), 4, 8); + break; + case Qt::SizeHorCursor: + loadShapeFromResource(target, QLatin1String("sizehor"), 8, 4); + break; + case Qt::SizeBDiagCursor: + loadShapeFromResource(target, QLatin1String("sizebdiag"), 8, 8); + break; + case Qt::SizeFDiagCursor: + loadShapeFromResource(target, QLatin1String("sizefdiag"), 8, 8); + break; + case Qt::SizeAllCursor: + loadShapeFromResource(target, QLatin1String("sizeall"), 7, 7); + break; + case Qt::BlankCursor: + loadShapeFromResource(target, QLatin1String("blank"), 0, 0); + break; + case Qt::SplitVCursor: + loadShapeFromResource(target, QLatin1String("splitv"), 7, 7); + break; + case Qt::SplitHCursor: + loadShapeFromResource(target, QLatin1String("splith"), 7, 7); + break; + case Qt::PointingHandCursor: + loadShapeFromResource(target, QLatin1String("handpoint"), 5, 0); + break; + case Qt::ForbiddenCursor: + loadShapeFromResource(target, QLatin1String("forbidden"), 7, 7); + break; + case Qt::WhatsThisCursor: + loadShapeFromResource(target, QLatin1String("whatsthis"), 1, 1); + break; + case Qt::BusyCursor: + loadShapeFromResource(target, QLatin1String("busy3"), 1, 1, 1000000); + loadShapeFromResource(target, QLatin1String("busy6"), 1, 1, 1000000); + loadShapeFromResource(target, QLatin1String("busy9"), 1, 1, 1000000); + loadShapeFromResource(target, QLatin1String("busy12"), 1, 1, 1000000); + break; + case Qt::OpenHandCursor: + loadShapeFromResource(target, QLatin1String("openhand"), 7, 7); + break; + case Qt::ClosedHandCursor: + loadShapeFromResource(target, QLatin1String("closehand"), 7, 7); + break; + } +} +#endif + +/* + * Common code between the sprite workaround and standard modes of operation. + * RWsSpriteBase is the base class for both RWsSprite and RWsPointerCursor. + * It is called from both handle() and qt_s60_show_pointer_sprite() + */ +void QCursorData::constructCursorSprite(RWsSpriteBase& target) +{ + int count = nativeSpriteMembers.Count(); + if (count) { + // already constructed + for (int i = 0; i < count; i++) + target.AppendMember(*(nativeSpriteMembers[i])); + + return; + } + if (pixmap.isNull() && !bm) { +#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS + //shape cursor + constructShapeSprite(target); +#endif + return; + } + QScopedPointer member(new TSpriteMember); + if (pixmap.isNull()) { + //construct mono cursor + member->iBitmap = bm->toSymbianCFbsBitmap(); + member->iMaskBitmap = bmm->toSymbianCFbsBitmap(); + } + else { + //construct normal cursor + member->iBitmap = pixmap.toSymbianCFbsBitmap(); + if (pixmap.hasAlphaChannel()) { + member->iMaskBitmap = 0; //use alpha blending + } + else if (pixmap.hasAlpha()) { + member->iMaskBitmap = pixmap.mask().toSymbianCFbsBitmap(); + } + else { + member->iMaskBitmap = pixmap.createHeuristicMask().toSymbianCFbsBitmap(); + } + } + + member->iDrawMode = CGraphicsContext::EDrawModePEN; + member->iInvertMask = EFalse; + member->iInterval = 0; + member->iOffset = TPoint(-(hx), -(hy)); //Symbian hotspot coordinates are negative + qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data())); + target.AppendMember(*(member.take())); +} + +/* + * shows the pointer sprite by constructing a native handle, and registering + * it with the window server. + * Only used when the sprite workaround is in use. + */ +void qt_symbian_show_pointer_sprite() +{ + if (cursorSprite.d) { + if (cursorSprite.d->scurs.WsHandle()) + cursorSprite.d->scurs.Close(); + } else { + cursorSprite = QCursor(Qt::ArrowCursor); + } + + cursorSprite.d->scurs = RWsSprite(S60->wsSession()); + QPoint pos = QCursor::pos(); + cursorSprite.d->scurs.Construct(S60->windowGroup(), TPoint(pos.x(), pos.y()), ESpriteNoChildClip | ESpriteNoShadows); + + cursorSprite.d->constructCursorSprite(cursorSprite.d->scurs); + cursorSprite.d->scurs.Activate(); +} + +/* + * hides the pointer sprite by closing the native handle. + * Only used when the sprite workaround is in use. + */ +void qt_symbian_hide_pointer_sprite() +{ + if (cursorSprite.d) { + cursorSprite.d->scurs.Close(); + } +} + +/* + * Changes the cursor sprite to the cursor specified. + * Only used when the sprite workaround is in use. + */ +void qt_symbian_set_pointer_sprite(const QCursor& cursor) +{ + if (S60->mouseInteractionEnabled) + qt_symbian_hide_pointer_sprite(); + cursorSprite = cursor; + if (S60->mouseInteractionEnabled) + qt_symbian_show_pointer_sprite(); +} + +/* + * When using sprites as a workaround on phones that have a broken + * RWsPointerCursor, this function is called in response to pointer events + * and when QCursor::setPos() is called. + * Performance is worse than a real pointer cursor, due to extra context + * switches vs. the window server moving the cursor by itself. + */ +void qt_symbian_move_cursor_sprite() +{ + if (S60->mouseInteractionEnabled) { + cursorSprite.d->scurs.SetPosition(TPoint(S60->lastCursorPos.x(), S60->lastCursorPos.y())); + } +} + +/* + * Translate from Qt::CursorShape to OS system pointer cursor list index. + * Currently we control the implementation of the system pointer cursor list, + * so this function is trivial. That may not always be the case. + */ +TInt qt_symbian_translate_cursor_shape(Qt::CursorShape shape) +{ + return (TInt) shape; +} + +/* + Internal function called from QWidget::setCursor() + force is true if this function is called from dispatchEnterLeave, it means that the + mouse is actually directly under this widget. +*/ +void qt_symbian_set_cursor(QWidget *w, bool force) +{ + static QPointer lastUnderMouse = 0; + if (force) { + lastUnderMouse = w; + } + else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse + && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { + w = lastUnderMouse; + } + + if (!S60->curWin && w && w->internalWinId()) + return; + QWidget* cW = w && !w->internalWinId() ? w : QWidget::find(S60->curWin); + if (!cW || cW->window() != w->window() || !cW->isVisible() || !cW->underMouse() + || QApplication::overrideCursor()) + return; + +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) + qt_symbian_set_pointer_sprite(cW->cursor()); + else +#endif + qt_symbian_setWindowCursor(cW->cursor(), w->effectiveWinId()); } +/* + * Makes the specified cursor appear above a specific native window group + * Called from QSymbianControl and QApplication::restoreOverrideCursor + * + * Window server is needed for this, so there is no equivalent when using + * the sprite workaround. + */ +void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node) +{ + Qt::HANDLE handle = cursor.handle(); + if (handle) { + RWsPointerCursor *pcurs = reinterpret_cast (handle); + node.SetCustomPointerCursor(*pcurs); + } +#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS + else { + TInt shape = qt_symbian_translate_cursor_shape(cursor.shape()); + node.SetPointerCursor(shape); + } +#else + qWarning("qt_s60_setWindowGroupCursor - null handle"); +#endif +} + +/* + * Makes the specified cursor appear above a specific native window + * Called from QSymbianControl and QApplication::restoreOverrideCursor + * + * Window server is needed for this, so there is no equivalent when using + * the sprite workaround. + */ +void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid) +{ + //find the window for this control + while (!wid->OwnsWindow()) { + wid = wid->Parent(); + if (!wid) + return; + } + RWindowTreeNode *node = wid->DrawableWindow(); + qt_symbian_setWindowGroupCursor(cursor, *node); +} + +/* + * Makes the specified cursor appear everywhere. + * Called from QApplication::setOverrideCursor + */ +void qt_symbian_setGlobalCursor(const QCursor &cursor) +{ +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + if (S60->brokenPointerCursors) { + qt_symbian_set_pointer_sprite(cursor); + } else +#endif + { + //because of the internals of window server, we need to force the cursor + //to be set in all child windows too, otherwise when the cursor is over + //the child window it may show a widget cursor or arrow cursor instead, + //depending on construction order. + QListIterator iter(QWidgetPrivate::mapper->uniqueKeys()); + while(iter.hasNext()) + { + CCoeControl *ctrl = iter.next(); + RWindowTreeNode *node = ctrl->DrawableWindow(); + qt_symbian_setWindowGroupCursor(cursor, *node); + } + } +} QT_END_NAMESPACE #endif // QT_NO_CURSOR diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp index 430f587..26cde1a 100644 --- a/src/gui/kernel/qcursor_win.cpp +++ b/src/gui/kernel/qcursor_win.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp - /***************************************************************************** Internal QCursorData class *****************************************************************************/ diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/gui/kernel/qcursor_x11.cpp index d8cc2fc..3e53f04 100644 --- a/src/gui/kernel/qcursor_x11.cpp +++ b/src/gui/kernel/qcursor_x11.cpp @@ -63,8 +63,6 @@ QT_BEGIN_NAMESPACE // Define QT_USE_APPROXIMATE_CURSORS when compiling if you REALLY want to // use the ugly X11 cursors. -extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp - /***************************************************************************** Internal QCursorData class *****************************************************************************/ @@ -100,6 +98,7 @@ QCursor::QCursor(Qt::HANDLE cursor) d = new QCursorData(Qt::CustomCursor); d->hcurs = cursor; } + #endif QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 4ee484c..b635685 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -58,6 +58,7 @@ #include "QtGui/qmime.h" #include "QtGui/qdrag.h" #include "QtGui/qpixmap.h" +#include "QtGui/qcursor.h" #include "QtCore/qpoint.h" #include "private/qobject_p.h" #ifdef Q_WS_MAC @@ -265,7 +266,11 @@ private: #ifdef Q_WS_QWS Qt::DropAction currentActionForOverrideCursor; #endif - +#ifdef Q_OS_SYMBIAN +#ifndef QT_NO_CURSOR + QCursor overrideCursor; +#endif +#endif QWidget *currentDropTarget; static QDragManager *instance; diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp index fb2e426..2456185 100644 --- a/src/gui/kernel/qdnd_s60.cpp +++ b/src/gui/kernel/qdnd_s60.cpp @@ -50,11 +50,14 @@ #include "qevent.h" #include "qpainter.h" #include "qdnd_p.h" +#include "qt_s60_p.h" #include // pointer cursor #include #include +#include + QT_BEGIN_NAMESPACE //### artistic impression of Symbians default DnD cursor ? @@ -89,82 +92,24 @@ static bool qt_symbian_dnd_dragging = false; static Qt::KeyboardModifiers oldstate; -class QShapedPixmapWidget -{ -public: - QShapedPixmapWidget(RWsSession aWsSession,RWindowTreeNode* aNode) - { - sprite = RWsSprite(aWsSession); - cursorSprite.iBitmap = 0; - cursorSprite.iMaskBitmap = 0; - cursorSprite.iInvertMask = EFalse; - cursorSprite.iOffset = TPoint(0,0); - cursorSprite.iInterval = TTimeIntervalMicroSeconds32(0); - cursorSprite.iDrawMode = CGraphicsContext::EDrawModePEN; - sprite.Construct(*aNode,TPoint(0,0), ESpriteNoShadows | ESpriteNoChildClip); - sprite.AppendMember(cursorSprite); - sprite.Activate(); - } - ~QShapedPixmapWidget() - { - sprite.Close(); - cursorSprite.iBitmap = 0; - delete cursorBitmap; - cursorBitmap = 0; //redundant... - } - void disableCursor() - { - cursorSprite.iBitmap = 0; - sprite.UpdateMember(0,cursorSprite); - } - void enableCursor() - { - cursorSprite.iBitmap = cursorBitmap; - sprite.UpdateMember(0,cursorSprite); - } - void setPixmap(QPixmap pm) - { - //### heaplock centralized. - QImage temp = pm.toImage(); - QSize size = pm.size(); - temp.bits(); - CFbsBitmap *curbm = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new - curbm->Create(TSize(size.width(),size.height()),EColor16MA); - curbm->LockHeap(ETrue); - memcpy((uchar*)curbm->DataAddress(),temp.bits(),temp.numBytes()); - curbm->UnlockHeap(ETrue); - delete cursorSprite.iBitmap; - cursorSprite.iBitmap = curbm; - cursorBitmap = curbm; - sprite.UpdateMember(0,cursorSprite); - } - CFbsBitmap *cursorBitmap; - RWsPointerCursor pointerCursor; - RWsSprite sprite; - TSpriteMember cursorSprite; - -}; - - -static QShapedPixmapWidget *qt_symbian_dnd_deco = 0; - void QDragManager::updatePixmap() { - if (qt_symbian_dnd_deco) { - QPixmap pm; - QPoint pm_hot(default_pm_hotx,default_pm_hoty); - if (drag_object) { - pm = drag_object->pixmap(); - if (!pm.isNull()) - pm_hot = drag_object->hotSpot(); - } - if (pm.isNull()) { - if (!defaultPm) - defaultPm = new QPixmap(default_pm); - pm = *defaultPm; - } - qt_symbian_dnd_deco->setPixmap(pm); + QPixmap pm; + QPoint pm_hot(default_pm_hotx,default_pm_hoty); + if (drag_object) { + pm = drag_object->pixmap(); + if (!pm.isNull()) + pm_hot = drag_object->hotSpot(); + } + if (pm.isNull()) { + if (!defaultPm) + defaultPm = new QPixmap(default_pm); + pm = *defaultPm; } +#ifndef QT_NO_CURSOR + QCursor cursor(pm, pm_hot.x(), pm_hot.y()); + overrideCursor = cursor; +#endif } void QDragManager::timerEvent(QTimerEvent *) { } @@ -174,6 +119,16 @@ void QDragManager::move(const QPoint&) { void QDragManager::updateCursor() { +#ifndef QT_NO_CURSOR + QCursor cursor = willDrop ? overrideCursor : Qt::ForbiddenCursor; + if (!restoreCursor) { + QApplication::setOverrideCursor(cursor); + restoreCursor = true; + } + else { + QApplication::changeOverrideCursor(cursor); + } +#endif } @@ -210,20 +165,19 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) // map the Coords relative to the window. if (!cw) return true; - TPoint windowPos = cw->effectiveWinId()->PositionRelativeToScreen(); - qt_symbian_dnd_deco->sprite.SetPosition(TPoint(me->globalX()- windowPos.iX,me->globalY()- windowPos.iY)); while (cw && !cw->acceptDrops() && !cw->isWindow()) cw = cw->parentWidget(); + bool oldWillDrop = willDrop; if (object->target() != cw) { if (object->target()) { QDragLeaveEvent dle; QApplication::sendEvent(object->target(), &dle); willDrop = false; global_accepted_action = Qt::IgnoreAction; - updateCursor(); - restoreCursor = true; + if (oldWillDrop != willDrop) + updateCursor(); object->d_func()->target = 0; } if (cw && cw->acceptDrops()) { @@ -233,8 +187,8 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) QApplication::sendEvent(object->target(), &dee); willDrop = dee.isAccepted() && dee.dropAction() != Qt::IgnoreAction; global_accepted_action = willDrop ? dee.dropAction() : Qt::IgnoreAction; - updateCursor(); - restoreCursor = true; + if (oldWillDrop != willDrop) + updateCursor(); } } else if (cw) { QDragMoveEvent dme(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData, @@ -246,8 +200,10 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) QApplication::sendEvent(cw, &dme); willDrop = dme.isAccepted(); global_accepted_action = willDrop ? dme.dropAction() : Qt::IgnoreAction; - updatePixmap(); - updateCursor(); + if (oldWillDrop != willDrop) { + updatePixmap(); + updateCursor(); + } } if (global_accepted_action != prevAction) emitActionChanged(global_accepted_action); @@ -259,7 +215,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) { qApp->removeEventFilter(this); if (restoreCursor) { - qt_symbian_dnd_deco->disableCursor(); + QApplication::restoreOverrideCursor(); willDrop = false; restoreCursor = false; } @@ -305,23 +261,15 @@ Qt::DropAction QDragManager::drag(QDrag *o) } object = drag_object = o; - RWsSession winSession = o->source()->effectiveWinId()->ControlEnv()->WsSession(); - Q_ASSERT(!qt_symbian_dnd_deco); - qt_symbian_dnd_deco = new QShapedPixmapWidget(winSession, o->source()->effectiveWinId()->DrawableWindow()); oldstate = Qt::NoModifier; // #### Should use state that caused the drag willDrop = false; updatePixmap(); updateCursor(); - restoreCursor = true; - object->d_func()->target = 0; - TPoint windowPos = source()->effectiveWinId()->PositionRelativeToScreen(); - qt_symbian_dnd_deco->sprite.SetPosition(TPoint(QCursor::pos().x()- windowPos.iX ,QCursor::pos().y() - windowPos.iY)); + qt_symbian_set_cursor_visible(true); //force cursor on even for touch phone - QPoint hotspot = drag_object->hotSpot(); - qt_symbian_dnd_deco->cursorSprite.iOffset = TPoint(- hotspot.x(),- hotspot.y()); - qt_symbian_dnd_deco->sprite.UpdateMember(0,qt_symbian_dnd_deco->cursorSprite); + object->d_func()->target = 0; qApp->installEventFilter(this); @@ -334,11 +282,11 @@ Qt::DropAction QDragManager::drag(QDrag *o) delete eventLoop; eventLoop = 0; - delete qt_symbian_dnd_deco; - qt_symbian_dnd_deco = 0; + qt_symbian_set_cursor_visible(false); + + overrideCursor = QCursor(); //deref the cursor data qt_symbian_dnd_dragging = false; - return global_accepted_action; } @@ -358,8 +306,10 @@ void QDragManager::cancel(bool deleteSource) drag_object = object = 0; } - delete qt_symbian_dnd_deco; - qt_symbian_dnd_deco = 0; + if (restoreCursor) { + QApplication::restoreOverrideCursor(); + restoreCursor = false; + } global_accepted_action = Qt::IgnoreAction; } @@ -367,6 +317,10 @@ void QDragManager::cancel(bool deleteSource) void QDragManager::drop() { + if (restoreCursor) { + QApplication::restoreOverrideCursor(); + restoreCursor = false; + } } QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type type) const diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index d85023b..794d15a 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -83,6 +83,7 @@ const TInt KInternalStatusPaneChange = 0x50000000; class QS60Data { public: + QS60Data(); TUid uid; int screenDepth; QPoint lastCursorPos; @@ -95,6 +96,16 @@ public: int screenHeightInTwips; int defaultDpiX; int defaultDpiY; + WId curWin; + int virtualMouseLastKey; + int virtualMouseAccel; + int virtualMouseMaxAccel; +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + bool brokenPointerCursors; +#endif + bool hasTouchscreen; + bool mouseInteractionEnabled; + bool virtualMouseRequired; int qtOwnsS60Environment : 1; static inline void updateScreenSize(); static inline RWsSession& wsSession(); @@ -164,6 +175,11 @@ private: bool m_previousEventLongTap; }; +inline QS60Data::QS60Data() +{ + memclr(this, sizeof(QS60Data)); //zero init data +} + inline void QS60Data::updateScreenSize() { TPixelsTwipsAndRotation params; @@ -173,6 +189,8 @@ inline void QS60Data::updateScreenSize() S60->screenHeightInPixels = params.iPixelSize.iHeight; S60->screenWidthInTwips = params.iTwipsSize.iWidth; S60->screenHeightInTwips = params.iTwipsSize.iHeight; + + S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 20; TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch; S60->defaultDpiY = S60->screenHeightInPixels / inches; @@ -286,6 +304,11 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) return format; } +void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid); +void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node); +void qt_symbian_setGlobalCursor(const QCursor &cursor); +void qt_symbian_set_cursor_visible(bool visible); +bool qt_symbian_is_cursor_visible(); QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fd89cb9..c86012d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -3048,7 +3048,6 @@ void QWidgetPrivate::setEnabled_helper(bool enable) if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) { // enforce the windows behavior of clearing the cursor on // disabled widgets - extern void qt_x11_enforce_cursor(QWidget * w); // defined in qwidget_x11.cpp qt_x11_enforce_cursor(q); } #endif diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 744d20f..522ce33 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -188,7 +188,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (isResize) data.window_state &= ~Qt::WindowMaximized; - if(q->isWindow()) { + if (q->isWindow()) { if (w == 0 || h == 0) { q->setAttribute(Qt::WA_OutsideWSRange, true); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) @@ -287,7 +287,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de TSize screenSize = S60->screenDevice()->SizeInPixels(); data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight); q->setAttribute(Qt::WA_DontShowOnScreen); - } else if(topLevel && !q->testAttribute(Qt::WA_Resized)){ + } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){ int width = sw; int height = sh; if (extra) { @@ -300,7 +300,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de CCoeControl *destroyw = 0; createExtra(); - if(window) { + if (window) { if (destroyOldWindow) destroyw = data.winid; id = window; @@ -416,7 +416,7 @@ void QWidgetPrivate::hide_sys() deactivateWidgetCleanup(); WId id = q->internalWinId(); if (q->isWindow() && id) { - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); if (QWidgetBackingStore *bs = maybeBackingStore()) @@ -432,7 +432,7 @@ void QWidgetPrivate::setFocus_sys() { Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup) - if(!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged() q->effectiveWinId()->SetFocus(true); } @@ -482,7 +482,7 @@ void QWidgetPrivate::lower_sys() if (q->internalWinId() && tlwExtra) { tlwExtra->rwindow->SetOrdinalPosition(-1); } - if(!q->isWindow()) + if (!q->isWindow()) invalidateBuffer(q->rect()); } @@ -499,7 +499,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) QTLWExtra *tlwExtraSibling = w->d_func()->maybeTopData(); if (q->internalWinId() && tlwExtra && w->internalWinId() && tlwExtraSibling) tlwExtra->rwindow->SetOrdinalPosition(tlwExtraSibling->rwindow->OrdinalPosition() + 1); - if(!q->isWindow() || !w->internalWinId()) + if (!q->isWindow() || !w->internalWinId()) invalidateBuffer(q->rect()); } @@ -553,7 +553,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { old_winid->MakeVisible(false); - if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -660,7 +660,7 @@ CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) fbsBitmap->LockHeap(); QImage image = pixmap.toImage(); - if(invert) + if (invert) image.invertPixels(); int height = pixmap.size().height(); @@ -764,8 +764,8 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); CAknTitlePane* titlePane = S60->titlePane(); - if(titlePane) { - if(caption.isEmpty()) { + if (titlePane) { + if (caption.isEmpty()) { QT_TRAP_THROWING(titlePane->SetTextToDefaultL()); } else { QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); @@ -996,7 +996,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // The window decoration visibility has to be changed before doing actual // window state change since in that order the availableGeometry will return // directly the right size and we will avoid unnecessarty redraws - if((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || + if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || oldstate == Qt::WindowNoState) { CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); @@ -1061,7 +1061,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowMinimized) { if (isVisible()) { WId id = effectiveWinId(); - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); } @@ -1069,7 +1069,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (isVisible()) { WId id = effectiveWinId(); id->MakeVisible(true); - if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(true); } const QRect normalGeometry = geometry(); @@ -1111,6 +1111,10 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } #endif + if (QWidgetPrivate::mouseGrabber == this) + releaseMouse(); + if (QWidgetPrivate::keyboardGrabber == this) + releaseKeyboard(); setAttribute(Qt::WA_WState_Created, false); QObjectList childList = children(); for (int i = 0; i < childList.size(); ++i) { // destroy all widget children @@ -1119,12 +1123,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) static_cast(obj)->destroy(destroySubWindows, destroySubWindows); } - if (QWidgetPrivate::mouseGrabber == this) - releaseMouse(); - if (QWidgetPrivate::keyboardGrabber == this) - releaseKeyboard(); if (destroyWindow && !(windowType() == Qt::Desktop) && id) { - if(id->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged() id->SetFocus(false); id->ControlEnv()->AppUi()->RemoveFromStack(id); @@ -1192,8 +1192,28 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; + +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(cursor()); +#endif + } +} + +#ifndef QT_NO_CURSOR +void QWidget::grabMouse(const QCursor &cursor) +{ + if (!qt_nograb()) { + if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this) + QWidgetPrivate::mouseGrabber->releaseMouse(); + Q_ASSERT(testAttribute(Qt::WA_WState_Created)); + WId id = effectiveWinId(); + id->SetPointerCapture(true); + QWidgetPrivate::mouseGrabber = this; + + QApplication::setOverrideCursor(cursor); } } +#endif void QWidget::releaseMouse() { @@ -1202,6 +1222,8 @@ void QWidget::releaseMouse() WId id = effectiveWinId(); id->SetPointerCapture(false); QWidgetPrivate::mouseGrabber = 0; + + QApplication::restoreOverrideCursor(); } } @@ -1215,4 +1237,21 @@ void QWidget::activateWindow() id->SetFocus(true); } } + +#ifndef QT_NO_CURSOR + +void QWidgetPrivate::setCursor_sys(const QCursor &cursor) +{ + Q_UNUSED(cursor); + Q_Q(QWidget); + qt_symbian_set_cursor(q, false); +} + +void QWidgetPrivate::unsetCursor_sys() +{ + Q_Q(QWidget); + qt_symbian_set_cursor(q, false); +} +#endif + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index c9ebccf..211e9d4 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -722,8 +722,6 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const void QWidgetPrivate::updateSystemBackground() {} -extern void qt_win_set_cursor(QWidget *, bool); // qapplication_win.cpp - #ifndef QT_NO_CURSOR void QWidgetPrivate::setCursor_sys(const QCursor &cursor) { diff --git a/src/gui/kernel/symbian.pri b/src/gui/kernel/symbian.pri index d267a53..5497ccb 100644 --- a/src/gui/kernel/symbian.pri +++ b/src/gui/kernel/symbian.pri @@ -1,3 +1,4 @@ symbian { contains(QT_CONFIG, s60): LIBS+= $$QMAKE_LIBS_S60 + RESOURCES += symbian/symbianresources.qrc } diff --git a/src/gui/symbian/images/blank.png b/src/gui/symbian/images/blank.png new file mode 100644 index 0000000..bd396de Binary files /dev/null and b/src/gui/symbian/images/blank.png differ diff --git a/src/gui/symbian/images/busy12.png b/src/gui/symbian/images/busy12.png new file mode 100644 index 0000000..909e70f Binary files /dev/null and b/src/gui/symbian/images/busy12.png differ diff --git a/src/gui/symbian/images/busy3.png b/src/gui/symbian/images/busy3.png new file mode 100644 index 0000000..983f5d8 Binary files /dev/null and b/src/gui/symbian/images/busy3.png differ diff --git a/src/gui/symbian/images/busy6.png b/src/gui/symbian/images/busy6.png new file mode 100644 index 0000000..b2e8780 Binary files /dev/null and b/src/gui/symbian/images/busy6.png differ diff --git a/src/gui/symbian/images/busy9.png b/src/gui/symbian/images/busy9.png new file mode 100644 index 0000000..e093d01 Binary files /dev/null and b/src/gui/symbian/images/busy9.png differ diff --git a/src/gui/symbian/images/closehand.png b/src/gui/symbian/images/closehand.png new file mode 100644 index 0000000..05534f5 Binary files /dev/null and b/src/gui/symbian/images/closehand.png differ diff --git a/src/gui/symbian/images/cross.png b/src/gui/symbian/images/cross.png new file mode 100644 index 0000000..50da7aa Binary files /dev/null and b/src/gui/symbian/images/cross.png differ diff --git a/src/gui/symbian/images/forbidden.png b/src/gui/symbian/images/forbidden.png new file mode 100644 index 0000000..a3a0fd6 Binary files /dev/null and b/src/gui/symbian/images/forbidden.png differ diff --git a/src/gui/symbian/images/handpoint.png b/src/gui/symbian/images/handpoint.png new file mode 100644 index 0000000..a221548 Binary files /dev/null and b/src/gui/symbian/images/handpoint.png differ diff --git a/src/gui/symbian/images/ibeam.png b/src/gui/symbian/images/ibeam.png new file mode 100644 index 0000000..ace2fad Binary files /dev/null and b/src/gui/symbian/images/ibeam.png differ diff --git a/src/gui/symbian/images/openhand.png b/src/gui/symbian/images/openhand.png new file mode 100644 index 0000000..6f232f0 Binary files /dev/null and b/src/gui/symbian/images/openhand.png differ diff --git a/src/gui/symbian/images/pointer.png b/src/gui/symbian/images/pointer.png new file mode 100644 index 0000000..677404e Binary files /dev/null and b/src/gui/symbian/images/pointer.png differ diff --git a/src/gui/symbian/images/sizeall.png b/src/gui/symbian/images/sizeall.png new file mode 100644 index 0000000..2950067 Binary files /dev/null and b/src/gui/symbian/images/sizeall.png differ diff --git a/src/gui/symbian/images/sizebdiag.png b/src/gui/symbian/images/sizebdiag.png new file mode 100644 index 0000000..f565a3a Binary files /dev/null and b/src/gui/symbian/images/sizebdiag.png differ diff --git a/src/gui/symbian/images/sizefdiag.png b/src/gui/symbian/images/sizefdiag.png new file mode 100644 index 0000000..9493f12 Binary files /dev/null and b/src/gui/symbian/images/sizefdiag.png differ diff --git a/src/gui/symbian/images/sizehor.png b/src/gui/symbian/images/sizehor.png new file mode 100644 index 0000000..217bf39 Binary files /dev/null and b/src/gui/symbian/images/sizehor.png differ diff --git a/src/gui/symbian/images/sizever.png b/src/gui/symbian/images/sizever.png new file mode 100644 index 0000000..2c99038 Binary files /dev/null and b/src/gui/symbian/images/sizever.png differ diff --git a/src/gui/symbian/images/splith.png b/src/gui/symbian/images/splith.png new file mode 100644 index 0000000..343bed5 Binary files /dev/null and b/src/gui/symbian/images/splith.png differ diff --git a/src/gui/symbian/images/splitv.png b/src/gui/symbian/images/splitv.png new file mode 100644 index 0000000..69ee416 Binary files /dev/null and b/src/gui/symbian/images/splitv.png differ diff --git a/src/gui/symbian/images/uparrow.png b/src/gui/symbian/images/uparrow.png new file mode 100644 index 0000000..92dd933 Binary files /dev/null and b/src/gui/symbian/images/uparrow.png differ diff --git a/src/gui/symbian/images/wait1.png b/src/gui/symbian/images/wait1.png new file mode 100644 index 0000000..5aebaab Binary files /dev/null and b/src/gui/symbian/images/wait1.png differ diff --git a/src/gui/symbian/images/wait10.png b/src/gui/symbian/images/wait10.png new file mode 100644 index 0000000..3b549b0 Binary files /dev/null and b/src/gui/symbian/images/wait10.png differ diff --git a/src/gui/symbian/images/wait11.png b/src/gui/symbian/images/wait11.png new file mode 100644 index 0000000..24a943f Binary files /dev/null and b/src/gui/symbian/images/wait11.png differ diff --git a/src/gui/symbian/images/wait12.png b/src/gui/symbian/images/wait12.png new file mode 100644 index 0000000..15afd4d Binary files /dev/null and b/src/gui/symbian/images/wait12.png differ diff --git a/src/gui/symbian/images/wait2.png b/src/gui/symbian/images/wait2.png new file mode 100644 index 0000000..f2022b2 Binary files /dev/null and b/src/gui/symbian/images/wait2.png differ diff --git a/src/gui/symbian/images/wait3.png b/src/gui/symbian/images/wait3.png new file mode 100644 index 0000000..5b73e57 Binary files /dev/null and b/src/gui/symbian/images/wait3.png differ diff --git a/src/gui/symbian/images/wait4.png b/src/gui/symbian/images/wait4.png new file mode 100644 index 0000000..17a0339 Binary files /dev/null and b/src/gui/symbian/images/wait4.png differ diff --git a/src/gui/symbian/images/wait5.png b/src/gui/symbian/images/wait5.png new file mode 100644 index 0000000..16a5c23 Binary files /dev/null and b/src/gui/symbian/images/wait5.png differ diff --git a/src/gui/symbian/images/wait6.png b/src/gui/symbian/images/wait6.png new file mode 100644 index 0000000..2870093 Binary files /dev/null and b/src/gui/symbian/images/wait6.png differ diff --git a/src/gui/symbian/images/wait7.png b/src/gui/symbian/images/wait7.png new file mode 100644 index 0000000..54f75a1 Binary files /dev/null and b/src/gui/symbian/images/wait7.png differ diff --git a/src/gui/symbian/images/wait8.png b/src/gui/symbian/images/wait8.png new file mode 100644 index 0000000..1d370c7 Binary files /dev/null and b/src/gui/symbian/images/wait8.png differ diff --git a/src/gui/symbian/images/wait9.png b/src/gui/symbian/images/wait9.png new file mode 100644 index 0000000..c28096f Binary files /dev/null and b/src/gui/symbian/images/wait9.png differ diff --git a/src/gui/symbian/images/whatsthis.png b/src/gui/symbian/images/whatsthis.png new file mode 100644 index 0000000..3386ef0 Binary files /dev/null and b/src/gui/symbian/images/whatsthis.png differ diff --git a/src/gui/symbian/symbianresources.qrc b/src/gui/symbian/symbianresources.qrc new file mode 100644 index 0000000..0a4fc36 --- /dev/null +++ b/src/gui/symbian/symbianresources.qrc @@ -0,0 +1,37 @@ + + + images/blank.png + images/busy3.png + images/busy6.png + images/busy9.png + images/busy12.png + images/closehand.png + images/cross.png + images/forbidden.png + images/handpoint.png + images/ibeam.png + images/openhand.png + images/pointer.png + images/sizeall.png + images/sizebdiag.png + images/sizefdiag.png + images/sizehor.png + images/sizever.png + images/splith.png + images/splitv.png + images/uparrow.png + images/wait1.png + images/wait2.png + images/wait3.png + images/wait4.png + images/wait5.png + images/wait6.png + images/wait7.png + images/wait8.png + images/wait9.png + images/wait10.png + images/wait11.png + images/wait12.png + images/whatsthis.png + + diff --git a/src/qbase.pri b/src/qbase.pri index 27e4992..4639ca1 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -101,7 +101,15 @@ symbian { "DEFFILE ../s60installs/eabi/$${TARGET}.def" \ "$${LITERAL_HASH}endif" + #with defBlock enabled, removed exported symbols are treated as errors + #and there is binary compatibility between successive builds. + #with defBlock disabled, binary compatibility is broken every time you build #MMP_RULES += defBlock + + #with EXPORTUNFROZEN enabled, new exports are included in the dll without + #needing to run abld freeze, however binary compatibility is only maintained + #for symbols that are frozen (and only if defBlock is also enabled) + #the downside of EXPORTUNFROZEN is that the linker gets run twice MMP_RULES += EXPORTUNFROZEN } load(armcc_warnings) diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 5171d3a..f2d865b 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) \ #include #ifdef QT_KEYPAD_NAVIGATION -# define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setKeypadNavigationEnabled(false); +# define QTEST_DISABLE_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeNone); #else # define QTEST_DISABLE_KEYPAD_NAVIGATION #endif diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index b7b2327..74c3af9 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -311,7 +311,7 @@ QT_BEGIN_NAMESPACE Example: \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 11 - \sa QTEST_APPLESS_MAIN(), QTest::qExec(), QApplication::setKeypadNavigationEnabled() + \sa QTEST_APPLESS_MAIN(), QTest::qExec(), QApplication::setNavigationMode() */ /*! \macro QTEST_APPLESS_MAIN(TestClass) diff --git a/tests/manual/qcursor/allcursors/allcursors.pro b/tests/manual/qcursor/allcursors/allcursors.pro new file mode 100644 index 0000000..8e7da30 --- /dev/null +++ b/tests/manual/qcursor/allcursors/allcursors.pro @@ -0,0 +1,16 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2009-08-05T17:13:23 +# +#------------------------------------------------- + +TARGET = tst_allcursors +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += mainwindow.ui diff --git a/tests/manual/qcursor/allcursors/main.cpp b/tests/manual/qcursor/allcursors/main.cpp new file mode 100644 index 0000000..9fb7510 --- /dev/null +++ b/tests/manual/qcursor/allcursors/main.cpp @@ -0,0 +1,13 @@ +#include +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.showFullScreen(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorForceVisible); +#endif + return a.exec(); +} diff --git a/tests/manual/qcursor/allcursors/mainwindow.cpp b/tests/manual/qcursor/allcursors/mainwindow.cpp new file mode 100644 index 0000000..0046ddb --- /dev/null +++ b/tests/manual/qcursor/allcursors/mainwindow.cpp @@ -0,0 +1,43 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include +#include +#include +#include +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +void MainWindow::keyPressEvent(QKeyEvent* event) +{ + QPoint off(0, 0); + switch (event->key()) { + case Qt::Key_Up: + off.setY(-4); + break; + case Qt::Key_Down: + off.setY(4); + break; + case Qt::Key_Left: + off.setX(-4); + break; + case Qt::Key_Right: + off.setX(4); + break; + default: + return QMainWindow::keyPressEvent(event); + } + off += QCursor::pos(); + QCursor::setPos(off); +} diff --git a/tests/manual/qcursor/allcursors/mainwindow.h b/tests/manual/qcursor/allcursors/mainwindow.h new file mode 100644 index 0000000..e5c731c --- /dev/null +++ b/tests/manual/qcursor/allcursors/mainwindow.h @@ -0,0 +1,28 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class QTimer; + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + void keyPressEvent(QKeyEvent* event); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/tests/manual/qcursor/allcursors/mainwindow.ui b/tests/manual/qcursor/allcursors/mainwindow.ui new file mode 100644 index 0000000..55ff78c --- /dev/null +++ b/tests/manual/qcursor/allcursors/mainwindow.ui @@ -0,0 +1,210 @@ + + + MainWindow + + + + 0 + 0 + 240 + 320 + + + + MainWindow + + + + + + + Arrow + + + + + + + UpArrowCursor + + + up arrow + + + + + + + CrossCursor + + + cross + + + + + + + WaitCursor + + + wait + + + + + + + IBeamCursor + + + ibeam + + + + + + + SizeVerCursor + + + sizever + + + + + + + SizeHorCursor + + + sizehor + + + + + + + SizeFDiagCursor + + + sizebdiag + + + + + + + SizeBDiagCursor + + + sizefdiag + + + + + + + SizeAllCursor + + + sizeall + + + + + + + BlankCursor + + + blank + + + + + + + SplitVCursor + + + splitv + + + + + + + SplitHCursor + + + splith + + + + + + + PointingHandCursor + + + pointhand + + + + + + + ForbiddenCursor + + + forbidden + + + + + + + WhatsThisCursor + + + whatsthis + + + + + + + BusyCursor + + + busy + + + + + + + OpenHandCursor + + + openhand + + + + + + + ClosedHandCursor + + + closehand + + + + + + + + + diff --git a/tests/manual/qcursor/grab_override/data/monkey_on_64x64.png b/tests/manual/qcursor/grab_override/data/monkey_on_64x64.png new file mode 100644 index 0000000..990f604 Binary files /dev/null and b/tests/manual/qcursor/grab_override/data/monkey_on_64x64.png differ diff --git a/tests/manual/qcursor/grab_override/grab_override.pro b/tests/manual/qcursor/grab_override/grab_override.pro new file mode 100644 index 0000000..c0f69be --- /dev/null +++ b/tests/manual/qcursor/grab_override/grab_override.pro @@ -0,0 +1,18 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2009-08-05T17:13:23 +# +#------------------------------------------------- + +TARGET = t_cursors +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += mainwindow.ui + +RESOURCES += images.qrc diff --git a/tests/manual/qcursor/grab_override/images.qrc b/tests/manual/qcursor/grab_override/images.qrc new file mode 100644 index 0000000..1d0cb92 --- /dev/null +++ b/tests/manual/qcursor/grab_override/images.qrc @@ -0,0 +1,6 @@ + + + + data/monkey_on_64x64.png + + diff --git a/tests/manual/qcursor/grab_override/main.cpp b/tests/manual/qcursor/grab_override/main.cpp new file mode 100644 index 0000000..9fb7510 --- /dev/null +++ b/tests/manual/qcursor/grab_override/main.cpp @@ -0,0 +1,13 @@ +#include +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.showFullScreen(); +#ifdef QT_KEYPAD_NAVIGATION + QApplication::setNavigationMode(Qt::NavigationModeCursorForceVisible); +#endif + return a.exec(); +} diff --git a/tests/manual/qcursor/grab_override/mainwindow.cpp b/tests/manual/qcursor/grab_override/mainwindow.cpp new file mode 100644 index 0000000..27dd0e7 --- /dev/null +++ b/tests/manual/qcursor/grab_override/mainwindow.cpp @@ -0,0 +1,100 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +#include +#include +#include +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), ui(new Ui::MainWindow) +{ + ui->setupUi(this); + QPixmap pix(":/data/monkey_on_64x64.png"); + + QImage mask(16, 16, QImage::Format_MonoLSB); + QImage bw(16, 16, QImage::Format_MonoLSB); + mask.fill(0); + bw.fill(0); + for (int x = 0; x < 16; x++) { + bw.setPixel(x, x, 1); + bw.setPixel(x, 15 - x, 1); + mask.setPixel(x, x, 1); + mask.setPixel(x, 15 - x, 1); + if (x > 0 && x < 15) { + mask.setPixel(x - 1, x, 1); + mask.setPixel(x + 1, x, 1); + mask.setPixel(x - 1, 15 - x, 1); + mask.setPixel(x + 1, 15 - x, 1); + } + } + + ccurs = QCursor(pix); + bcurs = QCursor(QBitmap::fromImage(bw), QBitmap::fromImage(mask)); + ui->label->setCursor(ccurs); + + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(toggleOverrideCursor())); + timer->start(2000); + + override = 0; +} + +MainWindow::~MainWindow() +{ + delete timer; + delete ui; +} + +void MainWindow::toggleOverrideCursor() +{ + switch (override) { + case 0: + QApplication::setOverrideCursor(Qt::BusyCursor); + break; + case 1: + QApplication::restoreOverrideCursor(); + break; + case 2: + ui->label->grabMouse(Qt::ForbiddenCursor); + break; + case 3: + case 5: + ui->label->releaseMouse(); + break; + case 4: + ui->label->grabMouse(); + break; + case 6: + ui->label->setCursor(bcurs); + break; + case 7: + ui->label->setCursor(ccurs); + break; + } + override = (override + 1) % 8; +} + +void MainWindow::keyPressEvent(QKeyEvent* event) +{ + QPoint off(0, 0); + switch (event->key()) { + case Qt::Key_Up: + off.setY(-4); + break; + case Qt::Key_Down: + off.setY(4); + break; + case Qt::Key_Left: + off.setX(-4); + break; + case Qt::Key_Right: + off.setX(4); + break; + default: + return QMainWindow::keyPressEvent(event); + } + off += QCursor::pos(); + QCursor::setPos(off); +} diff --git a/tests/manual/qcursor/grab_override/mainwindow.h b/tests/manual/qcursor/grab_override/mainwindow.h new file mode 100644 index 0000000..0b1f694 --- /dev/null +++ b/tests/manual/qcursor/grab_override/mainwindow.h @@ -0,0 +1,35 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class QTimer; + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private slots: + void toggleOverrideCursor(); + +private: + void keyPressEvent(QKeyEvent* event); + + Ui::MainWindow *ui; + QTimer *timer; + int override; + + QCursor ccurs; + QCursor bcurs; +}; + +#endif // MAINWINDOW_H diff --git a/tests/manual/qcursor/grab_override/mainwindow.ui b/tests/manual/qcursor/grab_override/mainwindow.ui new file mode 100644 index 0000000..bf35536 --- /dev/null +++ b/tests/manual/qcursor/grab_override/mainwindow.ui @@ -0,0 +1,97 @@ + + + MainWindow + + + + 0 + 0 + 240 + 320 + + + + MainWindow + + + + + + + QFrame::NoFrame + + + 1 + + + Qt::Vertical + + + + QFrame::Box + + + Custom + + + + + QFrame::NoFrame + + + 1 + + + Qt::Horizontal + + + + ForbiddenCursor + + + QFrame::Box + + + Forbidden + + + + + WaitCursor + + + QFrame::Box + + + Wait + + + + + + + + + + + 0 + 0 + 240 + 21 + + + + + + TopToolBarArea + + + false + + + + + + + + diff --git a/tests/manual/qcursor/qcursor.pro b/tests/manual/qcursor/qcursor.pro new file mode 100644 index 0000000..af082a4 --- /dev/null +++ b/tests/manual/qcursor/qcursor.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS = allcursors grab_override diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ecccfb4..c8e369e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2788,7 +2788,6 @@ static void applyTemporarySymbianFlags(QStringList &qconfigList) // This is removed because it uses UNIX signals which are not implemented yet qconfigList += "QT_NO_CRASHHANDLER"; qconfigList += "QT_NO_PRINTER"; - qconfigList += "QT_NO_CURSOR"; qconfigList += "QT_NO_SYSTEMTRAYICON"; } -- cgit v0.12 From ff3ce998bea1ef49c2e9548fb54e37292a121ec8 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 15 Sep 2009 14:53:43 +0200 Subject: Change compile options for configure so it can be built using msvc2008 Use the -MT command line option so it links statically with libc. The reason for this is that not all windows versions have the DLL "out of the box". Reviewed-by: Marius Storm-Olsen --- tools/configure/configure.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 06e9fe0..243183c 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -12,9 +12,13 @@ win32-g++ : LIBS += -luuid win32-msvc* { QMAKE_CFLAGS_RELEASE -= -MD + QMAKE_CFLAGS_RELEASE += -MT QMAKE_CFLAGS_DEBUG -= -MDd + QMAKE_CFLAGS_DEBUG += -MTd QMAKE_CXXFLAGS_RELEASE -= -MD + QMAKE_CXXFLAGS_RELEASE += -MT QMAKE_CXXFLAGS_DEBUG -= -MDd + QMAKE_CXXFLAGS_DEBUG += -MTd } PRECOMPILED_HEADER = configure_pch.h -- cgit v0.12 From dc6e88c0dc5be96423498850c519afbad6e13989 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 15 Sep 2009 13:29:04 +0200 Subject: Fix QGraphicsView::scrollAfterResize autotest on Mac. The auto-test was failing because it calculate the scrollbar indent using style primitives. It's very fragile and doesn't work on MacOS style (and may not work on other style too). Since we don't test style stuff here, we can just apply the plastique style for this test. Reviewed-by:TrustMe --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 6c1ac54..3bed9ce 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3072,9 +3072,11 @@ void tst_QGraphicsView::scrollAfterResize_data() QTest::addColumn("x2"); QTest::addColumn("x3"); - int frameWidth = qApp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - int extent = qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent); - int inside = qApp->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); + QPlastiqueStyle *style = new QPlastiqueStyle; + + int frameWidth = style->pixelMetric(QStyle::PM_DefaultFrameWidth); + int extent = style->pixelMetric(QStyle::PM_ScrollBarExtent); + int inside = style->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); int viewportWidth = 300; int scrollBarIndent = viewportWidth - extent - (inside ? 4 : 2)*frameWidth; @@ -3096,6 +3098,7 @@ void tst_QGraphicsView::scrollAfterResize() QFETCH(QTransform, x3); QGraphicsView view; + view.setStyle(new QPlastiqueStyle); if (reverse) view.setLayoutDirection(Qt::RightToLeft); -- cgit v0.12 From 5af2150b1a8a2e8ca89c52c796da6112cac98231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 15 Sep 2009 15:11:01 +0200 Subject: Increased performance of blurpicker example with GL 2 engine. Slightly increase threshold for when to shrink an FBO, and reduce the number of calls to glBindFramebuffer. Reviewed-by: Tom --- src/opengl/qpixmapdata_gl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index d5398a9..5eff237 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -98,7 +98,7 @@ QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize sz.setHeight(qMax(requestSize.height(), qRound(sz.height() * 1.5))); // wasting too much space? - if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 2.5) + if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 4) sz = requestSize; if (sz != fboSize) { @@ -183,12 +183,11 @@ void QGLPixmapGLPaintDevice::endPaint() data->copyBackFromRenderFbo(false); - data->m_renderFbo->release(); - qgl_fbo_pool()->release(data->m_renderFbo); - data->m_renderFbo = 0; - // Base's endPaint will restore the previous FBO binding QGLPaintDevice::endPaint(); + + qgl_fbo_pool()->release(data->m_renderFbo); + data->m_renderFbo = 0; } QGLContext* QGLPixmapGLPaintDevice::context() const @@ -466,8 +465,8 @@ void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const if (!ctx->d_ptr->fbo) glGenFramebuffers(1, &ctx->d_ptr->fbo); - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); + glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture.id, 0); const int x0 = 0; @@ -475,7 +474,8 @@ void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const const int y0 = 0; const int y1 = h; - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle()); + if (!m_renderFbo->isBound()) + glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle()); glDisable(GL_SCISSOR_TEST); -- cgit v0.12 From 9b42435b18ba7a593524bcd9fb0936e08a5a2462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 10 Sep 2009 18:31:39 +0200 Subject: I don't think this was intentional... Wonder how it survived for so long. Reviewed-by: Peter Hartmann --- src/corelib/tools/qhash.h | 1 - src/corelib/tools/qmap.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 06f6688..b65f1d3 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -52,7 +52,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -#undef QT_QHASH_DEBUG QT_MODULE(Core) class QBitArray; diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 18d1f5c..c1be49a 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -51,7 +51,6 @@ #endif #include -#undef QT_MAP_DEBUG QT_BEGIN_HEADER -- cgit v0.12 From 76311598fa9d7681316e590797bc402889dcb909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 15 Sep 2009 17:01:18 +0200 Subject: Increasing a timeout on QProcess tests Not a proper fix, but let's see if this increases reliability of the results. --- tests/auto/qprocess/tst_qprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 0291f66..cff6487 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1164,7 +1164,7 @@ void tst_QProcess::softExitInSlots() SoftExitProcess proc(i); proc.start(appName); proc.write("OLEBOLE", 8); // include the \0 - QTestEventLoop::instance().enterLoop(1); + QTestEventLoop::instance().enterLoop(10); QCOMPARE(proc.state(), QProcess::NotRunning); QVERIFY(proc.waitedForFinished); } -- cgit v0.12 From a17103fb41c8f53e29b4abe26a45b8ba2cd460a4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 15 Sep 2009 17:17:07 +0200 Subject: Doc: Cleaned up the Designer main window and Embedded Linux pages. Reviewed-by: Trust Me --- doc/src/development/designer-manual.qdoc | 258 +++++++++++++-------- .../designer-adding-toolbar-action1.png | Bin 14911 -> 21640 bytes .../qtopiacore/qt-embedded-linux-architecture.sk | 5 +- doc/src/frameworks-technologies/gestures.qdoc | 36 +-- doc/src/getting-started/examples.qdoc | 53 +++-- doc/src/images/designer-action-editor.png | Bin 46233 -> 28378 bytes doc/src/images/designer-adding-menu-action.png | Bin 6168 -> 9962 bytes doc/src/images/designer-adding-toolbar-action.png | Bin 5644 -> 7428 bytes doc/src/images/qt-embedded-linux-architecture.png | Bin 22979 -> 23199 bytes 9 files changed, 223 insertions(+), 129 deletions(-) diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index ff05228..bdadcf7 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -1520,26 +1520,34 @@ \target CreatingAMenu - \table - \row - \i \inlineimage designer-creating-menu1.png - \i \inlineimage designer-creating-menu2.png - \i \bold{Creating a Menu} - - Double-click the placeholder item to begin editing. The menu text, - displayed using a line edit, can be modified. - - \row - \i \inlineimage designer-creating-menu3.png - \i \inlineimage designer-creating-menu4.png - \i Insert the required text for the new menu. Inserting an - ampersand character (&) causes the letter following it to be - used as a mnemonic for the menu. - - Press \key Return or \key Enter to accept the new text, or press - \key Escape to reject it. You can undo the editing operation later if - required. - \endtable + \raw HTML +
+ \endraw + \inlineimage designer-creating-menu1.png + \inlineimage designer-creating-menu2.png + \br + \inlineimage designer-creating-menu3.png + \inlineimage designer-creating-menu4.png + \raw HTML +
+ \endraw + + \section2 Creating a Menu + + Double-click the placeholder item to begin editing. The menu text, + displayed using a line edit, can be modified. + + Insert the required text for the new menu. Inserting an + ampersand character (&) causes the letter following it to be + used as a mnemonic for the menu. + + Press \key Return or \key Enter to accept the new text, or press + \key Escape to reject it. You can undo the editing operation later if + required. + + \raw HTML +
+ \endraw Menus can also be rearranged in the menu bar simply by dragging and dropping them in the preferred location. A vertical red line indicates the @@ -1550,31 +1558,40 @@ navigating the menu structure in the usual way. \target CreatingAMenuEntry + \raw HTML +
+ \endraw + \inlineimage designer-creating-menu-entry1.png + \inlineimage designer-creating-menu-entry2.png + \br + \inlineimage designer-creating-menu-entry3.png + \inlineimage designer-creating-menu-entry4.png + \raw HTML +
+ \endraw \table - \row - \i \inlineimage designer-creating-menu-entry1.png - \i \inlineimage designer-creating-menu-entry2.png - \i \bold{Creating a Menu Entry} - Double-click the \gui{new action} placeholder to begin editing, or - double-click \gui{new separator} to insert a new separator line after - the last entry in the menu. + \section2 Creating a Menu Entry - The menu entry's text is displayed using a line edit, and can be - modified. + Double-click the \gui{new action} placeholder to begin editing, or + double-click \gui{new separator} to insert a new separator line after + the last entry in the menu. - \row - \i \inlineimage designer-creating-menu-entry3.png - \i \inlineimage designer-creating-menu-entry4.png - \i Insert the required text for the new entry, optionally using - the ampersand character (&) to mark the letter to use as a - mnemonic for the entry. + The menu entry's text is displayed using a line edit, and can be + modified. - Press \key Return or \key Enter to accept the new text, or press - \key Escape to reject it. The action created for this menu entry will - be accessible via the \l{#TheActionEditor}{Action Editor}, and any - associated keyboard shortcut can be set there. - \endtable + Insert the required text for the new entry, optionally using + the ampersand character (&) to mark the letter to use as a + mnemonic for the entry. + + Press \key Return or \key Enter to accept the new text, or press + \key Escape to reject it. The action created for this menu entry will + be accessible via the \l{#TheActionEditor}{Action Editor}, and any + associated keyboard shortcut can be set there. + + \raw HTML +
+ \endraw Just like with menus, entries can be moved around simply by dragging and dropping them in the preferred location. When an entry is dragged over a @@ -1582,53 +1599,92 @@ menu entries are based on actions, they can also be dropped onto toolbars, where they will be displayed as toolbar buttons. - \section1 Toolbars + \raw HTML +
+ \endraw + \inlineimage designer-creating-toolbar.png + \raw HTML +
+ \endraw - ### SCREENSHOT + \section2 Creating and Removing a Toolbar - Toolbars ared added to a main window in a similar way to the menu bar: + Toolbars are added to a main window in a similar way to the menu bar: Select the \gui{Add Tool Bar} option from the form's context menu. Alternatively, if there is an existing toolbar in the main window, you can click the arrow on its right end to create a new toolbar. - Toolbar buttons are created using the action system to populate each - toolbar, rather than by using specific button widgets from the widget box. - Since actions can be represented by menu entries and toolbar buttons, they - can be moved between menus and toolbars. To share an action between a menu - and a toolbar, drag its icon from the \l{#TheActionEditor}{Action Editor} - to the toolbar rather than from the menu where its entry is located. + Toolbars are removed from the form via an entry in the toolbar's context + menu. + + \raw HTML +
+ \endraw - New actions for menus and toolbars can be created in the - \l{#TheActionEditor}{Action Editor}. + \section2 Adding and Removing Toolbar Buttons + Toolbar buttons are created as actions in the + \l{#TheActionEditor}{Action Editor} and dragged onto the toolbar. + Since actions can be represented by menu entries and toolbar buttons, + they can be moved between menus and toolbars. + + \target AddingAnAction + \raw HTML +
+ \endraw + \inlineimage designer-adding-toolbar-action.png + \inlineimage designer-removing-toolbar-action.png + \raw HTML +
+ \endraw + + To share an action between a menu and a toolbar, drag its icon from the + action editor to the toolbar rather than from the menu where its entry is + located. See \l{#Adding an Action}{Adding an Action} for more information + about this process. + + Toolbar buttons are removed via the toolbar's context menu. + + \raw HTML +
+ \endraw \section1 Actions With the menu bar and the toolbars in place, it's time to populate them - with action: \QD provides an action editor to simplify the creation and - management of actions. - + with actions. New actions for both menus and toolbars are created in the + action editor window, simplifying the creation and management of actions. \target TheActionEditor - \table - \row - \i \inlineimage designer-action-editor.png - \i \bold{The Action Editor} + \raw HTML +
+ \endraw + \inlineimage designer-action-editor.png + \raw HTML +
+ \endraw - Enable the action editor by opening the \gui Tools menu, and switching - on the \gui{Action Editor} option. + \section2 The Action Editor - The action editor allows you to create \gui New actions and \gui Delete - actions. It also provides a search function, \gui Filter, using the - action's text. + Enable the action editor by opening the \gui Tools menu, and switching + on the \gui{Action Editor} option. - \QD's action editor can be viewed in the classic \gui{Icon View} and - \gui{Detailed View}. The screenshot below shows the action editor in - \gui{Detailed View}. You can also copy and paste actions between menus, - toolbars and forms. - \endtable + The action editor allows you to create \gui New actions and \gui Delete + actions. It also provides a search function, \gui Filter, using the + action's text. + + \QD's action editor can be viewed in the classic \gui{Icon View} and + \gui{Detailed View}. The screenshot below shows the action editor in + \gui{Detailed View}. You can also copy and paste actions between menus, + toolbars and forms. + + \raw HTML +
+ \endraw + + \section2 Creating an Action To create an action, use the action editor's \gui New button, which will then pop up an input dialog. Provide the new action with a \gui Text -- @@ -1641,23 +1697,33 @@ Once the action is created, it can be used wherever actions are applicable. + \raw HTML +
+ \endraw \target AddingAnAction - \table - \row - \i \inlineimage designer-adding-menu-action.png - \i \inlineimage designer-adding-toolbar-action.png - \i \bold{Adding an Action} + \raw HTML +
+ \endraw + \inlineimage designer-adding-menu-action.png + \inlineimage designer-adding-toolbar-action.png + \raw HTML +
+ \endraw - To add an action to a menu or a toolbar, simply press the left mouse - button over the action in the action editor, and drag it to the - preferred location. + \section2 Adding an Action - \QD provides highlighted guide lines that tell you where the action - will be added. Release the mouse button to add the action when you have - found the right spot. - \endtable + To add an action to a menu or a toolbar, simply press the left mouse + button over the action in the action editor, and drag it to the + preferred location. + + \QD provides highlighted guide lines that tell you where the action + will be added. Release the mouse button to add the action when you have + found the right spot. + \raw HTML +
+ \endraw \section1 Dock Widgets @@ -1668,21 +1734,29 @@ and choose an appropriate value for its \gui{dockWidgetArea} property. \target AddingADockWidget - \table - \row - \i \inlineimage designer-adding-dockwidget.png - \i \bold{Adding a Dock Widget} - To add a dock widget, simply drag one from the \gui Containers section - of the widget box, and drop it onto the main form area. Just like other - widgets, its properties can be modified with the \gui{Property Editor}. + \raw HTML +
+ \endraw + \inlineimage designer-adding-dockwidget.png + \raw HTML +
+ \endraw - Dock widgets can be optionally floated as indpendent tool windows. - Hence, it is useful to give them window titles by setting their - \gui{windowTitle} property. This also helps to identify them on the - form. + \section2 Adding a Dock Widget - \endtable + To add a dock widget, simply drag one from the \gui Containers section + of the widget box, and drop it onto the main form area. Just like other + widgets, its properties can be modified with the \gui{Property Editor}. + + Dock widgets can be optionally floated as indpendent tool windows. + Hence, it is useful to give them window titles by setting their + \gui{windowTitle} property. This also helps to identify them on the + form. + + \raw HTML +
+ \endraw */ diff --git a/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png b/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png index 6b82373..4d28722 100644 Binary files a/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png and b/doc/src/diagrams/designer-manual/designer-adding-toolbar-action1.png differ diff --git a/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk b/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk index ee60589..3c00b17 100644 --- a/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk +++ b/doc/src/diagrams/qtopiacore/qt-embedded-linux-architecture.sk @@ -295,6 +295,9 @@ txt('Graphics',(222.876,42.6)) G_() fp((1,1,1)) Fn('Helvetica') -txt('Qt for Embedded Linux',(85.802,85.126)) +txt('Qt for Embedded Linux',(85.802,86.934)) +le() +lw(1) +r(280,0,0,-125,7.5,157.5) guidelayer('Guide Lines',1,0,0,1,(0,0,1)) grid((0,0,2.5,2.5),1,(0,0,1),'Grid') diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index a0eab21..b9b7771 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -63,16 +63,16 @@ QPanGesture, QPinchGesture, and QSwipeGesture. These standard classes are ready to use, and each exposes functions and properties that give gesture-specific information about the user's - input. This is described in the section \l{Using Standard Gestures - With Widgets}. + input. This is described in the \l{Using Standard Gestures With Widgets} + section. QGesture is also designed to be subclassed and extended so that support for new gestures can be implemented by developers. Adding support for a new gesture involves implementing code to recognize - the gesture from incoming events. This is described in the section - \l{Creating Your Own Gesture Recognizer}. + the gesture from incoming events. This is described in the + \l{Creating Your Own Gesture Recognizer} section. - \section1 Using Standard Gestures With Widgets + \section1 Using Standard Gestures with Widgets Gesture objects are applied directly to widgets and other controls that accept user input \mdash these are the \e{target objects}. When a gesture object is @@ -91,11 +91,10 @@ \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture - Here, the \l{QGesture::} {triggered()} signal is used to inform - the application that a gesture was used. More precise monitoring - of a gesture can be implemented by connecting its \l{QGesture::} - {started()}, \l{QGesture::} {canceled()} and \l{QGesture::} - {finished()} signals to slots. + Here, the \l{QGesture::}{triggered()} signal is used to inform the application + that a gesture was used. More precise monitoring of a gesture can be implemented + by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and + \l{QGesture::}{finished()} signals to slots. Responding to a signal is simply a matter of obtaining the gesture that sent it and examining the information it contains. @@ -132,9 +131,18 @@ likely scenario. To find how to connect a source of events to automatically feed into the recognizer see the QGesture documentation. - Recognizers based on QGesture can emit any of the following signals: + Recognizers based on QGesture can emit any of the following signals to + indicate their progress in recognizing user input: - \snippet doc/src/snippets/gestures/qgesture.h qgesture-signals + \list + \o \l{QGesture::}{triggered()} is emitted when a gesture is recognized. + \o \l{QGesture::}{started()} indicates that the gesture object has started + to recognize user input. + \o \l{QGesture::}{finished()} is emitted when the gesture object has + recognized the user input as a gesture, and finished handling it. + \o \l{QGesture::}{canceled()} indicates that the gesture was canceled, + either by the user or by the application. + \endlist These signals are emitted when the state changes with the call to \l{QGesture::}{updateState()}, more than one signal may @@ -224,8 +232,4 @@ \o The signals are caught by the defined slots in ImageWidget \o The widget logic changes and an update() results in a paint event. \endlist - - - */ - diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 81a8363..1ed1b30 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -1051,7 +1051,7 @@ \previouspage State Machine Examples \contentspage Qt Examples - \nextpage Qt for Embedded Linux Examples + \nextpage Gestures Examples \image animation-examples.png Animation @@ -1066,10 +1066,40 @@ */ /*! + \page examples-gestures.html + \title Gestures Examples + + \previouspage Animation Framework Examples + \contentspage Qt Examples + \nextpage D-Bus Examples + + \list + \o \l{gestures/imageviewer}{Image Viewer} + \endlist +*/ + +/*! + \page examples-dbus.html + \title D-Bus Examples + + \previouspage Gestures Examples + \contentspage Qt Examples + \nextpage Qt for Embedded Linux Examples + + \list + \o \l{dbus/dbus-chat}{Chat} + \o \l{dbus/complexpingpong}{Complex Ping Pong} + \o \l{dbus/listnames}{List Names} + \o \l{dbus/pingpong}{Ping Pong} + \o \l{dbus/remotecontrolledcar}{Remote Controlled Car} + \endlist +*/ + +/*! \page examples-embeddedlinux.html \title Qt for Embedded Linux Examples - \previouspage Animation Framework Examples + \previouspage D-Bus Examples \contentspage Qt Examples \nextpage ActiveQt Examples @@ -1094,7 +1124,7 @@ \previouspage Qt for Embedded Linux Examples \contentspage Qt Examples - \nextpage D-Bus Examples + \nextpage Qt Quarterly \image activeqt-examples.png ActiveQt @@ -1111,20 +1141,3 @@ \o \l{activeqt/wrapper}{Wrapper}\raisedaster \endlist */ - -/*! - \page examples-dbus.html - \title D-Bus Examples - - \previouspage ActiveQt Examples - \contentspage Qt Examples - \nextpage Qt Quarterly - - \list - \o \l{dbus/dbus-chat}{Chat} - \o \l{dbus/complexpingpong}{Complex Ping Pong} - \o \l{dbus/listnames}{List Names} - \o \l{dbus/pingpong}{Ping Pong} - \o \l{dbus/remotecontrolledcar}{Remote Controlled Car} - \endlist -*/ diff --git a/doc/src/images/designer-action-editor.png b/doc/src/images/designer-action-editor.png index 7d17573..1e99706 100644 Binary files a/doc/src/images/designer-action-editor.png and b/doc/src/images/designer-action-editor.png differ diff --git a/doc/src/images/designer-adding-menu-action.png b/doc/src/images/designer-adding-menu-action.png index cf2a9c9..595dd8e 100644 Binary files a/doc/src/images/designer-adding-menu-action.png and b/doc/src/images/designer-adding-menu-action.png differ diff --git a/doc/src/images/designer-adding-toolbar-action.png b/doc/src/images/designer-adding-toolbar-action.png index e2201cb..404ad0d 100644 Binary files a/doc/src/images/designer-adding-toolbar-action.png and b/doc/src/images/designer-adding-toolbar-action.png differ diff --git a/doc/src/images/qt-embedded-linux-architecture.png b/doc/src/images/qt-embedded-linux-architecture.png index abf5bd8..b5e3b6c 100644 Binary files a/doc/src/images/qt-embedded-linux-architecture.png and b/doc/src/images/qt-embedded-linux-architecture.png differ -- cgit v0.12 From 74d5999800d16e73b67e9b747fb22cec3366c548 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 15 Sep 2009 17:21:24 +0200 Subject: Doc: Created a new Drawing Utility Functions page. Reviewed-by: Trust Me Inspired-by: Olivier Goffart's earlier change Pain-by: Git --- src/gui/painting/qdrawutil.cpp | 35 ++++++++++++++++++++--------------- src/gui/painting/qpainter.cpp | 3 ++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 7be8e04..c4a9373 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -49,10 +49,17 @@ QT_BEGIN_NAMESPACE /*! + \headerfile + \title Drawing Utility Functions + + \sa QPainter +*/ + +/*! \fn void qDrawShadeLine(QPainter *painter, int x1, int y1, int x2, int y2, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth) - \relates QPainter + \relates Draws a horizontal (\a y1 == \a y2) or vertical (\a x1 == \a x2) shaded line using the given \a painter. Note that nothing is @@ -166,7 +173,7 @@ void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill) - \relates QPainter + \relates Draws the shaded rectangle beginning at (\a x, \a y) with the given \a width and \a height using the provided \a painter. @@ -270,7 +277,7 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, \fn void qDrawShadePanel(QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, int lineWidth, const QBrush *fill) - \relates QPainter + \relates Draws the shaded panel beginning at (\a x, \a y) with the given \a width and \a height using the provided \a painter and the given \a @@ -406,7 +413,7 @@ static void qDrawWinShades(QPainter *p, \fn void qDrawWinButton(QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, const QBrush *fill) - \relates QPainter + \relates Draws the Windows-style button specified by the given point (\a x, \a y}, \a width and \a height using the provided \a painter with a @@ -444,7 +451,7 @@ void qDrawWinButton(QPainter *p, int x, int y, int w, int h, \fn void qDrawWinPanel(QPainter *painter, int x, int y, int width, int height, const QPalette &palette, bool sunken, const QBrush *fill) - \relates QPainter + \relates Draws the Windows-style panel specified by the given point(\a x, \a y), \a width and \a height using the provided \a painter with a @@ -483,7 +490,7 @@ void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, /*! \fn void qDrawPlainRect(QPainter *painter, int x, int y, int width, int height, const QColor &lineColor, int lineWidth, const QBrush *fill) - \relates QPainter + \relates Draws the plain rectangle beginning at (\a x, \a y) with the given \a width and \a height, using the specified \a painter, \a lineColor @@ -532,7 +539,7 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, /*! \fn void qDrawShadeLine(QPainter *painter, const QPoint &p1, const QPoint &p2, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth) - \relates QPainter + \relates \overload Draws a horizontal or vertical shaded line between \a p1 and \a p2 @@ -572,7 +579,7 @@ void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, /*! \fn void qDrawShadeRect(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill) - \relates QPainter + \relates \overload Draws the shaded rectangle specified by \a rect using the given \a painter. @@ -612,7 +619,7 @@ void qDrawShadeRect(QPainter *p, const QRect &r, /*! \fn void qDrawShadePanel(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, int lineWidth, const QBrush *fill) - \relates QPainter + \relates \overload Draws the shaded panel at the rectangle specified by \a rect using the @@ -648,7 +655,7 @@ void qDrawShadePanel(QPainter *p, const QRect &r, /*! \fn void qDrawWinButton(QPainter *painter, const QRect &rect, const QPalette &palette, bool sunken, const QBrush *fill) - \relates QPainter + \relates \overload Draws the Windows-style button at the rectangle specified by \a rect using @@ -706,7 +713,7 @@ void qDrawWinPanel(QPainter *p, const QRect &r, /*! \fn void qDrawPlainRect(QPainter *painter, const QRect &rect, const QColor &lineColor, int lineWidth, const QBrush *fill) - \relates QPainter + \relates \overload Draws the plain rectangle specified by \a rect using the given \a painter, @@ -1044,7 +1051,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, Holds the rules used to draw a pixmap or image split into nine segments, similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}. - \sa Qt::TileRule, QMargins, qDrawBorderPixmap + \sa Qt::TileRule, QMargins */ /*! \fn QTileRules::QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) @@ -1060,7 +1067,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, /*! \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \since 4.6 - \relates QPainter + \relates Draws the given \a pixmap into the given \a target rectangle, using the given \a painter. The pixmap will be split into nine segments and drawn @@ -1156,8 +1163,6 @@ static inline void qDrawHorizontallyRoundedPixmap(QPainter *painter, const QRect /*! \since 4.6 - \relates QPainter - Draws the indicated \a sourceRect rectangle from the given \a pixmap into the given \a targetRect rectangle, using the given \a painter. The pixmap will be split into nine segments according to the given \a targetMargins diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index beda9d6..b3aef71 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1317,7 +1317,8 @@ void QPainterPrivate::updateState(QPainterState *newState) Another workaround is to convert the paths to polygons first and then draw the polygons instead. - \sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example} + \sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example}, + {Drawing Utility Functions} */ /*! -- cgit v0.12 From e7042dea2431b8f64574d4e97eb896285b328c8b Mon Sep 17 00:00:00 2001 From: andyc Date: Fri, 3 Jul 2009 17:25:25 -0400 Subject: Added autotest to demonstrate clipping path problem --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index d6605db..391ccf8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -194,6 +194,7 @@ private slots: void itemClipsToShape(); void itemClipsChildrenToShape(); void itemClipsChildrenToShape2(); + void itemClipsChildrenToShape3(); void itemClipsTextChildToShape(); void itemClippingDiscovery(); void ancestorFlags(); @@ -4691,6 +4692,37 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2() #endif } +void tst_QGraphicsItem::itemClipsChildrenToShape3() +{ + // Construct a scene with nested children, each 50 pixels offset from the elder. + // Set a top-level clipping flag + QGraphicsScene scene; + QGraphicsRectItem *parent = scene.addRect( 0, 0, 150, 150 ); + QGraphicsRectItem *child = scene.addRect( 0, 0, 150, 150 ); + QGraphicsRectItem *grandchild = scene.addRect( 0, 0, 150, 150 ); + child->setParentItem(parent); + grandchild->setParentItem(child); + child->setPos( 50, 50 ); + grandchild->setPos( 50, 50 ); + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent); + QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child); + QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); + QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); + + // Move child to fully overlap the parent. The grandchild should + // now occupy two-thirds of the scene + child->prepareGeometryChange(); + child->setPos( 0, 0 ); + + QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child); + QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild); + QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); + QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); +} + + void tst_QGraphicsItem::itemClipsTextChildToShape() { // Construct a scene with a rect that clips its children, with one text -- cgit v0.12 From f5b1f78ca9353eff60a87c50eb6c720e810e59bb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 15 Sep 2009 17:49:37 +0200 Subject: Doc: Added missing files for the Designer manual. Reviewed-by: Trust Me Overcomplicated-workflow-by: Git --- doc/src/diagrams/designer-adding-actions.txt | 15 --------------- doc/src/diagrams/designer-adding-dynamic-property.png | Bin 9568 -> 0 bytes .../designer-manual/designer-adding-actions.txt | 15 +++++++++++++++ .../designer-adding-dynamic-property.png | Bin 0 -> 9568 bytes doc/src/images/designer-creating-toolbar.png | Bin 0 -> 18194 bytes doc/src/images/designer-removing-toolbar-action.png | Bin 0 -> 15500 bytes doc/src/images/designer-removing-toolbar.png | Bin 0 -> 13074 bytes 7 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 doc/src/diagrams/designer-adding-actions.txt delete mode 100644 doc/src/diagrams/designer-adding-dynamic-property.png create mode 100644 doc/src/diagrams/designer-manual/designer-adding-actions.txt create mode 100644 doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png create mode 100644 doc/src/images/designer-creating-toolbar.png create mode 100644 doc/src/images/designer-removing-toolbar-action.png create mode 100644 doc/src/images/designer-removing-toolbar.png diff --git a/doc/src/diagrams/designer-adding-actions.txt b/doc/src/diagrams/designer-adding-actions.txt deleted file mode 100644 index 4124ecc..0000000 --- a/doc/src/diagrams/designer-adding-actions.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Cropping and fading the Qt Designer action images. - -cropimage.py designer-adding-menu-action1.png designer-adding-menu-action1-crop.png left 57 -cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png top 41 -cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png right -180 -cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png bottom -124 -fadeedges.py designer-adding-menu-action1-crop.png ../images/designer-adding-menu-action.png right,bottom 16 -rm designer-adding-menu-action1-crop.png - -cropimage.py designer-adding-toolbar-action1.png designer-adding-toolbar-action1-crop.png left 57 -cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png top 41 -cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png right -144 -cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png bottom -124 -fadeedges.py designer-adding-toolbar-action1-crop.png ../images/designer-adding-toolbar-action.png right,bottom 16 -rm designer-adding-toolbar-action1-crop.png diff --git a/doc/src/diagrams/designer-adding-dynamic-property.png b/doc/src/diagrams/designer-adding-dynamic-property.png deleted file mode 100644 index 8e81dd9..0000000 Binary files a/doc/src/diagrams/designer-adding-dynamic-property.png and /dev/null differ diff --git a/doc/src/diagrams/designer-manual/designer-adding-actions.txt b/doc/src/diagrams/designer-manual/designer-adding-actions.txt new file mode 100644 index 0000000..4124ecc --- /dev/null +++ b/doc/src/diagrams/designer-manual/designer-adding-actions.txt @@ -0,0 +1,15 @@ +# Cropping and fading the Qt Designer action images. + +cropimage.py designer-adding-menu-action1.png designer-adding-menu-action1-crop.png left 57 +cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png top 41 +cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png right -180 +cropimage.py designer-adding-menu-action1-crop.png designer-adding-menu-action1-crop.png bottom -124 +fadeedges.py designer-adding-menu-action1-crop.png ../images/designer-adding-menu-action.png right,bottom 16 +rm designer-adding-menu-action1-crop.png + +cropimage.py designer-adding-toolbar-action1.png designer-adding-toolbar-action1-crop.png left 57 +cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png top 41 +cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png right -144 +cropimage.py designer-adding-toolbar-action1-crop.png designer-adding-toolbar-action1-crop.png bottom -124 +fadeedges.py designer-adding-toolbar-action1-crop.png ../images/designer-adding-toolbar-action.png right,bottom 16 +rm designer-adding-toolbar-action1-crop.png diff --git a/doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png b/doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png new file mode 100644 index 0000000..8e81dd9 Binary files /dev/null and b/doc/src/diagrams/designer-manual/designer-adding-dynamic-property.png differ diff --git a/doc/src/images/designer-creating-toolbar.png b/doc/src/images/designer-creating-toolbar.png new file mode 100644 index 0000000..32a949a Binary files /dev/null and b/doc/src/images/designer-creating-toolbar.png differ diff --git a/doc/src/images/designer-removing-toolbar-action.png b/doc/src/images/designer-removing-toolbar-action.png new file mode 100644 index 0000000..12c68a1 Binary files /dev/null and b/doc/src/images/designer-removing-toolbar-action.png differ diff --git a/doc/src/images/designer-removing-toolbar.png b/doc/src/images/designer-removing-toolbar.png new file mode 100644 index 0000000..a65b170 Binary files /dev/null and b/doc/src/images/designer-removing-toolbar.png differ -- cgit v0.12 From fec8f32f86fe60a4012c67b1b5b110dc3f816c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 15 Sep 2009 18:04:55 +0200 Subject: Fix macplist autotest This goes to show that once a test is running no one will look at the results... --- tests/auto/macplist/tst_macplist.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/macplist/tst_macplist.cpp b/tests/auto/macplist/tst_macplist.cpp index 7a2b1d8..aa52b95 100644 --- a/tests/auto/macplist/tst_macplist.cpp +++ b/tests/auto/macplist/tst_macplist.cpp @@ -171,7 +171,6 @@ void tst_MacPlist::test_plist() QVERIFY(dir.cdUp()); QVERIFY(dir.cdUp()); QVERIFY(dir.cdUp()); - QVERIFY(dir.cdUp()); QVERIFY(dir.cd(QLatin1String("app"))); QVERIFY(dir.cd(QLatin1String("app.app"))); QVERIFY(dir.cd(QLatin1String("Contents"))); -- cgit v0.12 From e727dafd5e1f28901176e42008ebc0a334d052e6 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 15 Sep 2009 18:41:51 +0200 Subject: Slightly better code for the test. Then the test doesn't leak. Reviewed-by:ogoffart --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 3bed9ce..5cb9173 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3072,11 +3072,11 @@ void tst_QGraphicsView::scrollAfterResize_data() QTest::addColumn("x2"); QTest::addColumn("x3"); - QPlastiqueStyle *style = new QPlastiqueStyle; + QPlastiqueStyle style; - int frameWidth = style->pixelMetric(QStyle::PM_DefaultFrameWidth); - int extent = style->pixelMetric(QStyle::PM_ScrollBarExtent); - int inside = style->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); + int frameWidth = style.pixelMetric(QStyle::PM_DefaultFrameWidth); + int extent = style.pixelMetric(QStyle::PM_ScrollBarExtent); + int inside = style.styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); int viewportWidth = 300; int scrollBarIndent = viewportWidth - extent - (inside ? 4 : 2)*frameWidth; @@ -3097,8 +3097,9 @@ void tst_QGraphicsView::scrollAfterResize() QFETCH(QTransform, x2); QFETCH(QTransform, x3); + QPlastiqueStyle style; QGraphicsView view; - view.setStyle(new QPlastiqueStyle); + view.setStyle(&style); if (reverse) view.setLayoutDirection(Qt::RightToLeft); -- cgit v0.12 From a9086411e13a247c30992c4f6ab85620bffba895 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Sep 2009 17:48:12 +0200 Subject: Stabilize tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup --- tests/auto/qcombobox/tst_qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 810be04..da97c7d 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2371,7 +2371,7 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup() comboBox.showPopup(); QTest::qWait(100); - QVERIFY(style.discoveredRect.width() <= comboBox.width()); + QTRY_VERIFY(style.discoveredRect.width() <= comboBox.width()); } } -- cgit v0.12 From d58494bf7b136c2c41f0fd219038c316f954f76f Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 14 Sep 2009 11:23:09 -0700 Subject: Fix a bug in surfaceForWidget I had the logic of the assert wrong with the isAncestorOf call. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index ff9f7bd..ccbaf21 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -411,7 +411,8 @@ IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); } } - Q_ASSERT(win == widget || widget->isAncestorOf(win)); + + Q_ASSERT(win == widget || win->isAncestorOf(widget)); return dfbSurface; } -- cgit v0.12 From 6b359f3bc3b87a7e5e2b971712ec8a4b8afccdc9 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 14 Sep 2009 11:02:11 -0700 Subject: Export two functions for getting a surface in dfb When building DirectFB as part of QtGui and not as a plugin this patch will export two global functions for getting a surface given a widget. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/directfb.pro | 2 +- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index d397050..0706f01 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -11,5 +11,5 @@ SOURCES += qdirectfbscreenplugin.cpp QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB LIBS += $$QT_LIBS_DIRECTFB -DEFINES += $$QT_DEFINES_DIRECTFB +DEFINES += $$QT_DEFINES_DIRECTFB QT_DIRECTFB_PLUGIN contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 4413858..79a401c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1687,6 +1687,19 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co } #endif +#ifndef QT_DIRECTFB_PLUGIN +Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_widget(const QWidget *widget, QRect *rect) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->surfaceForWidget(widget, rect) : 0; +} +#ifdef QT_DIRECTFB_SUBSURFACE +Q_GUI_EXPORT IDirectFBSurface *qt_directfb_subsurface_for_widget(const QWidget *widget, const QRect &area) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->subSurfaceForWidget(widget, area) : 0; +} +#endif +#endif + QT_END_NAMESPACE #include "qdirectfbscreen.moc" -- cgit v0.12 From d67d287c0fdff332cda673a18e0bb1617c3d2e17 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 15 Sep 2009 11:28:07 -0700 Subject: Export a function for getting a IDirectFBWindow This function is only exported when DirectFB is built into QtGui. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 20 ++++++++++++++++++++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 5 +++-- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 12 ++++++++---- .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 3 +++ 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 79a401c..0f7a6de 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1652,6 +1652,19 @@ void QDirectFBScreen::waitIdle() d_ptr->dfb->WaitIdle(d_ptr->dfb); } +#ifdef QT_DIRECTFB_WM +IDirectFBWindow *QDirectFBScreen::windowForWidget(const QWidget *widget) const +{ + if (widget) { + const QWSWindowSurface *surface = static_cast(widget->windowSurface()); + if (surface && surface->key() == QLatin1String("directfb")) { + return static_cast(surface)->directFBWindow(); + } + } + return 0; +} +#endif + IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); @@ -1698,6 +1711,13 @@ Q_GUI_EXPORT IDirectFBSurface *qt_directfb_subsurface_for_widget(const QWidget * return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->subSurfaceForWidget(widget, area) : 0; } #endif +#ifdef QT_DIRECTFB_WM +Q_GUI_EXPORT IDirectFBWindow *qt_directfb_window_for_widget(const QWidget *widget) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->windowForWidget(widget) : 0; +} + +#endif #endif QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 79a01d3..febb2b2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -174,9 +174,10 @@ public: #ifdef QT_DIRECTFB_SUBSURFACE IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; #endif - IDirectFB *dfb(); -#ifdef QT_NO_DIRECTFB_WM +#ifdef QT_DIRECTFB_WM + IDirectFBWindow *windowForWidget(const QWidget *widget) const; +#else IDirectFBSurface *primarySurface(); #endif #ifndef QT_NO_DIRECTFB_LAYER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index ccbaf21..4cebc96 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -113,13 +113,17 @@ bool QDirectFBWindowSurface::isValid() const #ifdef QT_DIRECTFB_WM void QDirectFBWindowSurface::raise() { - if (dfbWindow) { - dfbWindow->RaiseToTop(dfbWindow); - } else if (sibling && (!sibling->sibling || sibling->dfbWindow)) { - sibling->raise(); + if (IDirectFBWindow *window = directFBWindow()) { + window->RaiseToTop(window); } } +IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const +{ + return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0)); +} + + void QDirectFBWindowSurface::createWindow(const QRect &rect) { IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 036830a..0dd3a3b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -93,6 +93,9 @@ public: IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; IDirectFBSurface *directFBSurface() const; +#ifdef QT_DIRECTFB_WM + IDirectFBWindow *directFBWindow() const; +#endif private: void updateFormat(); void releaseSurface(); -- cgit v0.12 From 115dc0d8337049b54dd9e7527cb68ace841e6df3 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 08:31:47 +1000 Subject: Compilation fix for OpenGL/ES 2.0 Matrix functions do not exist under OpenGL/ES 2.0. Reviewed-by: trustme --- src/opengl/qpixmapdata_gl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 5eff237..4351c0b 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -162,12 +162,14 @@ void QGLPixmapGLPaintDevice::beginPaint() glDisable(GL_SCISSOR_TEST); glDisable(GL_BLEND); +#if !defined(QT_OPENGL_ES_2) glMatrixMode(GL_MODELVIEW_MATRIX); glLoadIdentity(); glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); glOrtho(0, data->width(), data->height(), 0, -999999, 999999); +#endif glViewport(0, 0, data->width(), data->height()); -- cgit v0.12 From 669afa2337ad5791502fe3af2e3de648cb60ea9b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 08:40:46 +1000 Subject: Fix glMatrixMode() arguments for desktop OpenGL The defines are GL_MODELVIEW/GL_PROJECTION, not GL_MODELVIEW_MATRIX/etc. The _MATRIX defines are for fetching the matrix, not setting it. Reviewed-by: trustme --- src/opengl/qpixmapdata_gl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 4351c0b..3bc0d4f 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -163,10 +163,10 @@ void QGLPixmapGLPaintDevice::beginPaint() glDisable(GL_BLEND); #if !defined(QT_OPENGL_ES_2) - glMatrixMode(GL_MODELVIEW_MATRIX); + glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glMatrixMode(GL_PROJECTION_MATRIX); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, data->width(), data->height(), 0, -999999, 999999); #endif -- cgit v0.12 From d0742b84e085fb1f38cd127c43da07275f5553ac Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 08:55:41 +1000 Subject: Remove unnecessary definitions in GL pixmap filter code. The code does not use QGLShader directly any more. Reviewed-by: trustme --- src/opengl/qglpixmapfilter.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 7876661..e4df69e 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -75,9 +75,6 @@ public: protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; - -private: - mutable QGLShader *m_shader; }; class QGLPixmapConvolutionFilter: public QGLPixmapFilter @@ -111,8 +108,6 @@ protected: private: static QByteArray generateBlurShader(int radius, bool gaussianBlur); - mutable QGLShader *m_shader; - mutable QSize m_textureSize; mutable bool m_horizontalBlur; -- cgit v0.12 From dcd4b15595a63864ee59a19d80f1ba33b4821aa3 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 09:31:01 +1000 Subject: Only regenerate pixmap filter source if the parameters have changed. Reviewed-by: trustme --- src/opengl/qglpixmapfilter.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index e4df69e..43f1990 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -71,6 +71,8 @@ void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const class QGLPixmapColorizeFilter: public QGLCustomShaderStage, public QGLPixmapFilter { public: + QGLPixmapColorizeFilter(); + void setUniforms(QGLShaderProgram *program); protected: @@ -100,6 +102,8 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter { public: + QGLPixmapBlurFilter(); + void setUniforms(QGLShaderProgram *program); protected: @@ -111,6 +115,10 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; + + mutable bool m_haveCached; + mutable int m_cachedRadius; + mutable Qt::TransformationMode m_cachedQuality; }; extern QGLWidget *qt_gl_share_widget(); @@ -182,10 +190,14 @@ static const char *qt_gl_colorize_filter = " return vec4(mix(srcPixel.rgb, colorized * srcPixel.a, colorizeStrength), srcPixel.a);" "}"; +QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() +{ + setSource(qt_gl_colorize_filter); +} + bool QGLPixmapColorizeFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapColorizeFilter *filter = const_cast(this); - filter->setSource(qt_gl_colorize_filter); filter->setOnPainter(painter); painter->drawPixmap(pos, src); @@ -292,10 +304,27 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const return true; } +QGLPixmapBlurFilter::QGLPixmapBlurFilter() + : m_haveCached(false), m_cachedRadius(5), + m_cachedQuality(Qt::FastTransformation) +{ +} + bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast(this); - filter->setSource(generateBlurShader(radius(), quality() == Qt::SmoothTransformation)); + + int radius = this->radius(); + Qt::TransformationMode quality = this->quality(); + + if (!m_haveCached || radius != m_cachedRadius || + quality != m_cachedQuality) { + // Only regenerate the shader from source if parameters have changed. + m_haveCached = true; + m_cachedRadius = radius; + m_cachedQuality = quality; + filter->setSource(generateBlurShader(radius, quality == Qt::SmoothTransformation)); + } QGLFramebufferObjectFormat format; format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB)); -- cgit v0.12 From adfb5c6160b37a917f20b301366567c208ae52a0 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 16 Sep 2009 09:43:45 +1000 Subject: Fix QLineEdit::setPalette QLineControl has a separate palette that wasn't getting updated. Task-number: 261239 Reviewed-by: mbm --- src/gui/widgets/qlinecontrol_p.h | 13 +++++++++++++ src/gui/widgets/qlineedit.cpp | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 8ad0452..68898b6 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -220,6 +220,9 @@ public: QString cancelText() const; void setCancelText(const QString &text); + const QPalette &palette() const; + void setPalette(const QPalette &); + enum DrawFlags { DrawText = 0x01, DrawSelections = 0x02, @@ -741,6 +744,16 @@ inline void QLineControl::setCancelText(const QString &text) m_cancelText = text; } +inline const QPalette & QLineControl::palette() const +{ + return m_palette; +} + +inline void QLineControl::setPalette(const QPalette &p) +{ + m_palette = p; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index a55ca8e..b4cea1b 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1851,8 +1851,12 @@ void QLineEdit::paintEvent(QPaintEvent *) #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || hasEditFocus()) #endif - if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())) + if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){ flags |= QLineControl::DrawSelections; + // Palette only used for selections/mask and may not be in sync + if(d->control->palette() != pal) + d->control->setPalette(pal); + } // Asian users see an IM selection text as cursor on candidate // selection phase of input method, so the ordinary cursor should be -- cgit v0.12 From c878fde1d0ddd54c8dff485e7c7146b3d8962fb9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 16 Sep 2009 09:52:04 +1000 Subject: Fix QLineEdit drag'n'drop QLineEdit shouldn't have been moving the text cursor while dragging. Task-number: 260457 Reviewed-by: mbm --- src/gui/widgets/qlineedit.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index e536928..629e839 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1434,7 +1434,6 @@ void QLineEdit::mousePressEvent(QMouseEvent* e) #ifndef QT_NO_DRAGANDDROP if (!mark && d->dragEnabled && d->control->echoMode() == Normal && e->button() == Qt::LeftButton && d->control->inSelection(e->pos().x())) { - d->control->moveCursor(cursor); d->dndPos = e->pos(); if (!d->dndTimer.isActive()) d->dndTimer.start(QApplication::startDragTime(), this); -- cgit v0.12 From dd6cf1a26fdf371a2cd394bd282b6190458e961a Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 11:11:41 +1000 Subject: Fix crash in QVGSharedContext shutdown The reference count was reducing down to zero during paint engine cleanup when we weren't ready to destroy the context. Artificially increase it to prevent the early context destroy. Reviewed-by: Sarah Smith --- src/openvg/qwindowsurface_vgegl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 1365344..06759d4 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -139,6 +139,10 @@ QVGSharedContext::QVGSharedContext() QVGSharedContext::~QVGSharedContext() { + // Don't accidentally destroy the QEglContext if the reference + // count falls to zero while deleting the paint engine. + ++refCount; + if (context) qt_vg_make_current(context, qt_vg_shared_surface()); delete engine; -- cgit v0.12 From 10e1d939d6bf08249304cb2c555be2f74c3a0f02 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 16 Sep 2009 11:46:41 +1000 Subject: Reduce overhead of paint engine-specific pixmap filters Engine-specific pixmap filters were being created, used, and destroyed every time draw() was called on QPixmapColorizeFilter, QPixmapBlurFilter, and so on. This had a heavy performance penalty and made it difficult for the GL paint engine to cache shaders from one request to the next. A generic filter can request an engine-specific filter that matches its parameters. The engine can either create a new one or return a previously allocated filter object. Ownership of engine-specific pixmap filter objects is moved to the paint engine itself. Reviewed-by: Andrew den Exter Reviewed-by: Michael Brasser Reviewed-by: Michael Goddard Reviewed-by: Sarah Smith --- src/gui/image/qpixmapfilter.cpp | 9 ++--- src/gui/painting/qpaintengineex_p.h | 7 +++- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 8 ----- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 7 +++- src/opengl/qgl_p.h | 2 -- src/opengl/qglpixmapfilter.cpp | 21 +++++++----- src/openvg/qpaintengine_vg.cpp | 38 +++++++++++++++------- src/openvg/qpaintengine_vg_p.h | 2 +- 8 files changed, 56 insertions(+), 38 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 4fa2e6c..4fb650f 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -418,13 +418,12 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q return; QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->createPixmapFilter(type()) : 0; + static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapConvolutionFilter *convolutionFilter = static_cast(filter); if (convolutionFilter) { convolutionFilter->setConvolutionKernel(d->convolutionKernel, d->kernelWidth, d->kernelHeight); convolutionFilter->d_func()->convoluteAlpha = d->convoluteAlpha; convolutionFilter->draw(painter, p, src, srcRect); - delete convolutionFilter; return; } @@ -669,13 +668,12 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap } QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->createPixmapFilter(type()) : 0; + static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapBlurFilter *blurFilter = static_cast(filter); if (blurFilter) { blurFilter->setRadius(d->radius); blurFilter->setQuality(d->quality); blurFilter->draw(painter, p, src, srcRect); - delete blurFilter; return; } @@ -836,13 +834,12 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q { Q_D(const QPixmapColorizeFilter); QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast(painter->paintEngine())->createPixmapFilter(type()) : 0; + static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapColorizeFilter *colorizeFilter = static_cast(filter); if (colorizeFilter) { colorizeFilter->setColor(d->color); colorizeFilter->setStrength(d->strength); colorizeFilter->draw(painter, dest, src, srcRect); - delete colorizeFilter; return; } diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 9f0d84a..a12a71f 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -207,7 +207,12 @@ public: virtual void beginNativePainting() {} virtual void endNativePainting() {} - virtual QPixmapFilter *createPixmapFilter(int /*type*/) const { return 0; } + // Return a pixmap filter of "type" that can render the parameters + // in "prototype". The returned filter is owned by the engine and + // will be destroyed when the engine is destroyed. The "prototype" + // allows the engine to pick different filters based on the parameters + // that will be requested, and not just the "type". + virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; } // These flags are needed in the implementation of paint buffers. enum Flags diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e41d0b4..2ee92c3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1769,14 +1769,6 @@ QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() { } -QPixmapFilter *QGL2PaintEngineEx::createPixmapFilter(int type) const -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) - return ctx->d_func()->createPixmapFilter(type); - return 0; -} - QT_END_NAMESPACE #include "qpaintengineex_opengl2.moc" diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 34f4eb8..a44be90 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -59,6 +59,7 @@ #include #include #include +#include enum EngineMode { ImageDrawingMode, @@ -140,7 +141,7 @@ public: const QGLContext* context(); - QPixmapFilter *createPixmapFilter(int type) const; + QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype); void setRenderTextActive(bool); @@ -264,6 +265,10 @@ public: bool inRenderText; float textureInvertedY; + + QScopedPointer convolutionFilter; + QScopedPointer colorizeFilter; + QScopedPointer blurFilter; }; QT_END_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 2b74e69..7269195 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -352,8 +352,6 @@ public: #endif static void setCurrentContext(QGLContext *context); - - QPixmapFilter *createPixmapFilter(int type) const; }; // ### make QGLContext a QObject in 5.0 and remove the proxy stuff diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 43f1990..b48c497 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -123,23 +123,28 @@ private: extern QGLWidget *qt_gl_share_widget(); -QPixmapFilter *QGLContextPrivate::createPixmapFilter(int type) const +QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *prototype) { + Q_D(QGL2PaintEngineEx); switch (type) { case QPixmapFilter::ColorizeFilter: - return new QGLPixmapColorizeFilter; + if (!d->colorizeFilter) + d->colorizeFilter.reset(new QGLPixmapColorizeFilter); + return d->colorizeFilter.data(); case QPixmapFilter::BlurFilter: - return new QGLPixmapBlurFilter; + if (!d->blurFilter) + d->blurFilter.reset(new QGLPixmapBlurFilter); + return d->blurFilter.data(); case QPixmapFilter::ConvolutionFilter: - return new QGLPixmapConvolutionFilter; + if (!d->convolutionFilter) + d->convolutionFilter.reset(new QGLPixmapConvolutionFilter); + return d->convolutionFilter.data(); - default: - return 0; - break; + default: break; } - return 0; + return QPaintEngineEx::pixmapFilter(type, prototype); } extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 972f4a1..d87ac40 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -211,6 +211,11 @@ public: QVGFontEngineCleaner *fontEngineCleaner; #endif + QScopedPointer convolutionFilter; + QScopedPointer colorizeFilter; + QScopedPointer dropShadowFilter; + QScopedPointer blurFilter; + // Ensure that the path transform is properly set in the VG context // before we perform a vgDrawPath() operation. inline void ensurePathTransform() @@ -3110,20 +3115,31 @@ void QVGPaintEngine::endNativePainting() vgSetPaint(d->brushPaint, VG_FILL_PATH); } -QPixmapFilter *QVGPaintEngine::createPixmapFilter(int type) const +QPixmapFilter *QVGPaintEngine::pixmapFilter(int type, const QPixmapFilter *prototype) { #if !defined(QT_SHIVAVG) - if (type == QPixmapFilter::ConvolutionFilter) - return new QVGPixmapConvolutionFilter; - else if (type == QPixmapFilter::ColorizeFilter) - return new QVGPixmapColorizeFilter; - else if (type == QPixmapFilter::DropShadowFilter) - return new QVGPixmapDropShadowFilter; - else if (type == QPixmapFilter::BlurFilter) - return new QVGPixmapBlurFilter; - else + Q_D(QVGPaintEngine); + switch (type) { + case QPixmapFilter::ConvolutionFilter: + if (!d->convolutionFilter) + d->convolutionFilter.reset(new QVGPixmapConvolutionFilter); + return d->convolutionFilter.data(); + case QPixmapFilter::ColorizeFilter: + if (!d->colorizeFilter) + d->colorizeFilter.reset(new QVGPixmapColorizeFilter); + return d->colorizeFilter.data(); + case QPixmapFilter::DropShadowFilter: + if (!d->dropShadowFilter) + d->dropShadowFilter.reset(new QVGPixmapDropShadowFilter); + return d->dropShadowFilter.data(); + case QPixmapFilter::BlurFilter: + if (!d->blurFilter) + d->blurFilter.reset(new QVGPixmapBlurFilter); + return d->blurFilter.data(); + default: break; + } #endif - return QPaintEngineEx::createPixmapFilter(type); + return QPaintEngineEx::pixmapFilter(type, prototype); } void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty) diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 4ae06bc..5c0f525 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -143,7 +143,7 @@ public: void beginNativePainting(); void endNativePainting(); - QPixmapFilter *createPixmapFilter(int type) const; + QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype); QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; } -- cgit v0.12 From db8f89cdb4fcb0d8436db80d50221308900dca01 Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Wed, 16 Sep 2009 07:53:15 +0200 Subject: Improve font handling on Mac/Cocoa. The Mac/Cocoa font database currently relies on two APIs, ATSUI (old) and CoreText (new). These are interchangable and work on the same font database. Some differences do exist, in particular ATSFontFamilyGetName seems to return the same as ATSFontGetName for some fonts - the font name, not the family name. In any case, the old ATS code path is initializing QFontDatabase::familes() with the font name. This causes a naming mismatch with code that uses CoreText and gets the proper family name, in this case in initializeDb(). The fix is to make sure the correct family name is used by using the CoreText API to access it. RevBy: TrustMe --- src/gui/text/qfontdatabase_mac.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp index d65910c..2584003 100644 --- a/src/gui/text/qfontdatabase_mac.cpp +++ b/src/gui/text/qfontdatabase_mac.cpp @@ -308,6 +308,21 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (familyRef) { fontRef = ATSFontFindFromName(QCFString(db->families[k]->name), kATSOptionFlagsDefault); goto FamilyFound; + } else { +#if defined(QT_MAC_USE_COCOA) + // ATS and CT disagrees on what the family name should be, + // use CT to look up the font if ATS fails. + QCFString familyName = QString::fromAscii(family_name); + QCFType CTfontRef = CTFontCreateWithName(familyName, 12, NULL); + QCFType fontDescriptor = CTFontCopyFontDescriptor(CTfontRef); + QCFString displayName = (CFStringRef)CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontDisplayNameAttribute); + + familyRef = ATSFontFamilyFindFromName(displayName, kATSOptionFlagsDefault); + if (familyRef) { + fontRef = ATSFontFindFromName(displayName, kATSOptionFlagsDefault); + goto FamilyFound; + } +#endif } } } @@ -456,11 +471,27 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) return; fnt->families.clear(); +#if defined(QT_MAC_USE_COCOA) + // Make sure that the family name set on the font matches what + // kCTFontFamilyNameAttribute returns in initializeDb(). + // So far the best solution seems find the installed font + // using CoreText and get the family name from it. + // (ATSFontFamilyGetName appears to be the correct API, but also + // returns the font display name.) + for(int i = 0; i < containedFonts.size(); ++i) { + QCFString fontPostScriptName; + ATSFontGetPostScriptName(containedFonts[i], kATSOptionFlagsDefault, &fontPostScriptName); + QCFType font = CTFontDescriptorCreateWithNameAndSize(fontPostScriptName, 14); + QCFString familyName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); + fnt->families.append(familyName); + } +#else for(int i = 0; i < containedFonts.size(); ++i) { QCFString family; ATSFontGetName(containedFonts[i], kATSOptionFlagsDefault, &family); fnt->families.append(family); } +#endif fnt->handle = handle; } -- cgit v0.12 From ec6c31b95c8c83d785ae884a5522a82351610461 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 16 Sep 2009 08:18:10 +0200 Subject: Fixed glsl warnings on mac and stop using texturecoords when not needed The setTextureCoordsEnabled was enabled in two places, but never disabled causing it to always be used. When using a varying in a vertex shader and not using it again in the fragment shader this produces a warning, and rightly so. Since the property is 100% detectable based on the fragment shader used, move the logic into the shader selection code and kill the property all together. This should also speed up solid filling a bit... --- .../gl2paintengineex/qglengineshadermanager.cpp | 42 +++++++++++----------- .../gl2paintengineex/qglengineshadermanager_p.h | 2 -- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 2 -- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index fec1973..b3458af 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -332,7 +332,6 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context) srcPixelType(Qt::NoBrush), useGlobalOpacity(false), maskType(NoMask), - useTextureCoords(false), compositionMode(QPainter::CompositionMode_SourceOver), customSrcStage(0), currentShaderProg(0), @@ -407,15 +406,6 @@ void QGLEngineShaderManager::setSrcPixelType(PixelSrcType type) shaderProgNeedsChanging = true; //### } -void QGLEngineShaderManager::setTextureCoordsEnabled(bool enabled) -{ - if (useTextureCoords == enabled) - return; - - useTextureCoords = enabled; - shaderProgNeedsChanging = true; //### -} - void QGLEngineShaderManager::setUseGlobalOpacity(bool useOpacity) { if (useGlobalOpacity == useOpacity) @@ -492,15 +482,8 @@ bool QGLEngineShaderManager::useCorrectShaderProg() QGLEngineShaderProg requiredProgram; requiredProgram.program = 0; - requiredProgram.useTextureCoords = useTextureCoords; - // Choose vertex shader main function - QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; - if (useTextureCoords) - mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; - else - mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader; - requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader); + bool texCoords = false; // Choose vertex shader shader position function (which typically also sets // varyings) and the source pixel (srcPixel) fragment shader function: @@ -523,14 +506,17 @@ bool QGLEngineShaderManager::useCorrectShaderProg() case QGLEngineShaderManager::ImageSrc: srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcFragmentShader; positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; break; case QGLEngineShaderManager::NonPremultipliedImageSrc: srcPixelFragShaderName = QGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; break; case QGLEngineShaderManager::PatternSrc: srcPixelFragShaderName = QGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; positionVertexShaderName = QGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; break; case QGLEngineShaderManager::TextureSrcWithPattern: srcPixelFragShaderName = QGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; @@ -598,14 +584,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg() if (hasMask) { QGLEngineSharedShaders::ShaderName maskShaderName = QGLEngineSharedShaders::InvalidShaderName; - if (maskType == PixelMask) + if (maskType == PixelMask) { maskShaderName = QGLEngineSharedShaders::MaskFragmentShader; - else if (maskType == SubPixelMask) + texCoords = true; + } else if (maskType == SubPixelMask) { maskShaderName = QGLEngineSharedShaders::RgbMaskFragmentShader; - else if (maskType == SubPixelWithGammaMask) + } else if (maskType == SubPixelWithGammaMask) { maskShaderName = QGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; - else + } else { qCritical("QGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); + } requiredProgram.maskFragShader = sharedShaders->compileNamedShader(maskShaderName, QGLShader::PartialFragmentShader); } else { @@ -656,6 +644,16 @@ bool QGLEngineShaderManager::useCorrectShaderProg() requiredProgram.compositionFragShader = 0; } + // Choose vertex shader main function + QGLEngineSharedShaders::ShaderName mainVertexShaderName = QGLEngineSharedShaders::InvalidShaderName; + if (texCoords) + mainVertexShaderName = QGLEngineSharedShaders::MainWithTexCoordsVertexShader; + else + mainVertexShaderName = QGLEngineSharedShaders::MainVertexShader; + requiredProgram.mainVertexShader = sharedShaders->compileNamedShader(mainVertexShaderName, QGLShader::PartialVertexShader); + requiredProgram.useTextureCoords = texCoords; + + // At this point, requiredProgram is fully populated so try to find the program in the cache currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 0bb580d..3c5a5f5 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -410,7 +410,6 @@ public: void optimiseForBrushTransform(const QTransform &transform); void setSrcPixelType(Qt::BrushStyle); void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images - void setTextureCoordsEnabled(bool); // For images & text glyphs void setUseGlobalOpacity(bool); void setMaskType(MaskType); void setCompositionMode(QPainter::CompositionMode); @@ -452,7 +451,6 @@ private: int srcPixelType; bool useGlobalOpacity; MaskType maskType; - bool useTextureCoords; QPainter::CompositionMode compositionMode; QGLCustomShaderStage* customSrcStage; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e41d0b4..70e7ef3 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -668,7 +668,6 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s { // Setup for texture drawing shaderManager->setSrcPixelType(pattern ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc); - shaderManager->setTextureCoordsEnabled(true); if (prepareForDraw(opaque)) shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); @@ -1241,7 +1240,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte else if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) shaderManager->setMaskType(QGLEngineShaderManager::SubPixelMask); //### TODO: Gamma correction - shaderManager->setTextureCoordsEnabled(true); int margin = cache->glyphMargin(); -- cgit v0.12 From 6a0ccd3477b0ddb0a550b56bdc41e8ae1cf740a6 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Wed, 16 Sep 2009 16:55:29 +1000 Subject: Fixes: Fixed incorrect tracks number calculation with phonon/gst RevBy: Andrew den Exter Details: gst_element_query_duration(element,format,duration) doesn't always return duration in format being asked for (tracks in this case), it can also return duration in format it can (Time) and modify format parameter, so check the format is still the same as requested is necessary. This bug prevented Phonon to emit finished() signal with some files, since it expected next tracks to exist. --- src/3rdparty/phonon/gstreamer/mediaobject.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/phonon/gstreamer/mediaobject.cpp b/src/3rdparty/phonon/gstreamer/mediaobject.cpp index 74fc1b4..13f9734 100644 --- a/src/3rdparty/phonon/gstreamer/mediaobject.cpp +++ b/src/3rdparty/phonon/gstreamer/mediaobject.cpp @@ -965,11 +965,15 @@ void MediaObject::getStreamInfo() gint64 titleCount; GstFormat format = gst_format_get_by_nick("track"); if (gst_element_query_duration (m_pipeline, &format, &titleCount)) { - int oldAvailableTitles = m_availableTitles; - m_availableTitles = (int)titleCount; - if (m_availableTitles != oldAvailableTitles) { - emit availableTitlesChanged(m_availableTitles); - m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + //check if returned format is still "track", + //gstreamer sometimes returns the total time, if tracks information is not available. + if (qstrcmp(gst_format_get_name(format), "track") == 0) { + int oldAvailableTitles = m_availableTitles; + m_availableTitles = (int)titleCount; + if (m_availableTitles != oldAvailableTitles) { + emit availableTitlesChanged(m_availableTitles); + m_backend->logMessage(QString("Available titles changed: %0").arg(m_availableTitles), Backend::Info, this); + } } } -- cgit v0.12 From dc1f76eb8a577aaa4a8342f5444b62a339d405cf Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 16 Sep 2009 08:54:20 +0200 Subject: doc: Fixed some qdoc errors. --- src/corelib/tools/qmargins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 58cef4a..72fbd61 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QMargin objects can be streamed as well as compared. - \sa qDrawBorderPixmap + \sa qDrawBorderPixmap() */ -- cgit v0.12 From 314e5680c8276d539b596927874036a873966d8f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 16 Sep 2009 09:10:34 +0200 Subject: Hide getStaticMetaObject() on platforms without Q_NO_DATA_RELOCATION getStaticMetaObject() is a workaround for linkage problems on symbian platform, so it does not exist on other platforms. This change makes the forward declaration inside Q_OBJECT only present when Q_NO_DATA_RELOCATION is defined Reviewed-by: axis --- src/corelib/kernel/qobjectdefs.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 63502cc..6a9cead 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -145,12 +145,18 @@ template inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} #endif // QT_NO_MEMBER_TEMPLATES +#ifdef Q_NO_DATA_RELOCATION +#define Q_OBJECT_GETSTATICMETAOBJECT static const QMetaObject &getStaticMetaObject(); +#else +#define Q_OBJECT_GETSTATICMETAOBJECT +#endif + /* tmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ Q_OBJECT_CHECK \ static const QMetaObject staticMetaObject; \ - static const QMetaObject &getStaticMetaObject(); \ + Q_OBJECT_GETSTATICMETAOBJECT \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ QT_TR_FUNCTIONS \ @@ -162,7 +168,7 @@ private: #define Q_GADGET \ public: \ static const QMetaObject staticMetaObject; \ - static const QMetaObject &getStaticMetaObject(); \ + Q_OBJECT_GETSTATICMETAOBJECT \ private: #else // Q_MOC_RUN #define slots slots -- cgit v0.12 From ce17ae5a6159d8ce3a5d2cc98f804a2debb860e5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 16 Sep 2009 09:55:52 +0200 Subject: qdoc: Added the "All Functions" link back into the header. --- tools/qdoc3/test/qt-html-templates.qdocconf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index f9e3c35..7ceacb2 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -10,6 +10,8 @@ HTML.postheader = "Home ·" \ " " \ "All Classes ·" \ + " " \ + "All Functions ·" \ " " \ "Overviews" \ "" \ -- cgit v0.12 From 120329adb47dba60f532c1c2fd2ad0f37b812437 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 16 Sep 2009 09:51:00 +0200 Subject: Separate the copy of JavaScriptCore that QtScript uses from the copy that QtWebKit uses. This is needed to decouple QtScript from QtWebKit, as discussed in the WebKit team. Reviewed-by: Kent Hansen --- .../javascriptcore/JavaScriptCore/API/APICast.h | 133 + .../javascriptcore/JavaScriptCore/API/JSBase.cpp | 116 + .../javascriptcore/JavaScriptCore/API/JSBase.h | 144 + .../JavaScriptCore/API/JSBasePrivate.h | 52 + .../JavaScriptCore/API/JSCallbackConstructor.cpp | 86 + .../JavaScriptCore/API/JSCallbackConstructor.h | 57 + .../JavaScriptCore/API/JSCallbackFunction.cpp | 78 + .../JavaScriptCore/API/JSCallbackFunction.h | 58 + .../JavaScriptCore/API/JSCallbackObject.cpp | 41 + .../JavaScriptCore/API/JSCallbackObject.h | 114 + .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 570 + .../JavaScriptCore/API/JSClassRef.cpp | 244 + .../javascriptcore/JavaScriptCore/API/JSClassRef.h | 122 + .../JavaScriptCore/API/JSContextRef.cpp | 154 + .../JavaScriptCore/API/JSContextRef.h | 132 + .../JavaScriptCore/API/JSObjectRef.cpp | 517 + .../JavaScriptCore/API/JSObjectRef.h | 695 + .../JavaScriptCore/API/JSProfilerPrivate.cpp | 46 + .../JavaScriptCore/API/JSProfilerPrivate.h | 63 + .../JavaScriptCore/API/JSRetainPtr.h | 173 + .../JavaScriptCore/API/JSStringRef.cpp | 112 + .../JavaScriptCore/API/JSStringRef.h | 144 + .../JavaScriptCore/API/JSStringRefBSTR.cpp | 42 + .../JavaScriptCore/API/JSStringRefBSTR.h | 62 + .../JavaScriptCore/API/JSStringRefCF.cpp | 57 + .../JavaScriptCore/API/JSStringRefCF.h | 60 + .../JavaScriptCore/API/JSValueRef.cpp | 322 + .../javascriptcore/JavaScriptCore/API/JSValueRef.h | 278 + .../javascriptcore/JavaScriptCore/API/JavaScript.h | 36 + .../JavaScriptCore/API/JavaScriptCore.h | 32 + .../JavaScriptCore/API/OpaqueJSString.cpp | 55 + .../JavaScriptCore/API/OpaqueJSString.h | 81 + .../JavaScriptCore/API/WebKitAvailability.h | 764 + src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS | 2 + .../javascriptcore/JavaScriptCore/COPYING.LIB | 488 + .../javascriptcore/JavaScriptCore/ChangeLog | 2726 ++ .../JavaScriptCore/ChangeLog-2002-12-03 | 2271 ++ .../JavaScriptCore/ChangeLog-2003-10-25 | 1483 + .../JavaScriptCore/ChangeLog-2007-10-14 | 26221 ++++++++++++ .../JavaScriptCore/ChangeLog-2008-08-10 | 31482 +++++++++++++++ .../JavaScriptCore/ChangeLog-2009-06-16 | 39978 +++++++++++++++++++ .../JavaScriptCore/DerivedSources.make | 76 + .../ForwardingHeaders/JavaScriptCore/APICast.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSBase.h | 1 + .../JavaScriptCore/JSContextRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSObjectRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSRetainPtr.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSStringRef.h | 1 + .../JavaScriptCore/JSStringRefCF.h | 1 + .../ForwardingHeaders/JavaScriptCore/JSValueRef.h | 1 + .../ForwardingHeaders/JavaScriptCore/JavaScript.h | 1 + .../JavaScriptCore/JavaScriptCore.h | 1 + .../JavaScriptCore/OpaqueJSString.h | 1 + .../JavaScriptCore/WebKitAvailability.h | 1 + .../javascriptcore/JavaScriptCore/Info.plist | 24 + .../JavaScriptCore/JavaScriptCore.gypi | 452 + .../JavaScriptCore/JavaScriptCore.order | 1965 + .../JavaScriptCore/JavaScriptCore.pri | 254 + .../JavaScriptCore/JavaScriptCore.pro | 73 + .../JavaScriptCore/JavaScriptCorePrefix.h | 35 + src/3rdparty/javascriptcore/JavaScriptCore/THANKS | 8 + .../JavaScriptCore/assembler/ARMAssembler.cpp | 353 + .../JavaScriptCore/assembler/ARMAssembler.h | 706 + .../JavaScriptCore/assembler/ARMv7Assembler.h | 1759 + .../assembler/AbstractMacroAssembler.h | 541 + .../JavaScriptCore/assembler/AssemblerBuffer.h | 173 + .../assembler/AssemblerBufferWithConstantPool.h | 305 + .../JavaScriptCore/assembler/CodeLocation.h | 186 + .../JavaScriptCore/assembler/LinkBuffer.h | 195 + .../JavaScriptCore/assembler/MacroAssembler.h | 347 + .../JavaScriptCore/assembler/MacroAssemblerARM.h | 797 + .../JavaScriptCore/assembler/MacroAssemblerARMv7.h | 1082 + .../assembler/MacroAssemblerCodeRef.h | 188 + .../JavaScriptCore/assembler/MacroAssemblerX86.h | 191 + .../assembler/MacroAssemblerX86Common.h | 780 + .../assembler/MacroAssemblerX86_64.h | 480 + .../JavaScriptCore/assembler/RepatchBuffer.h | 136 + .../JavaScriptCore/assembler/X86Assembler.h | 1926 + .../JavaScriptCore/bytecode/CodeBlock.cpp | 1755 + .../JavaScriptCore/bytecode/CodeBlock.h | 580 + .../JavaScriptCore/bytecode/EvalCodeCache.h | 87 + .../JavaScriptCore/bytecode/Instruction.h | 167 + .../JavaScriptCore/bytecode/JumpTable.cpp | 45 + .../JavaScriptCore/bytecode/JumpTable.h | 103 + .../JavaScriptCore/bytecode/Opcode.cpp | 186 + .../JavaScriptCore/bytecode/Opcode.h | 238 + .../JavaScriptCore/bytecode/SamplingTool.cpp | 406 + .../JavaScriptCore/bytecode/SamplingTool.h | 412 + .../JavaScriptCore/bytecode/StructureStubInfo.cpp | 80 + .../JavaScriptCore/bytecode/StructureStubInfo.h | 156 + .../bytecompiler/BytecodeGenerator.cpp | 1961 + .../bytecompiler/BytecodeGenerator.h | 492 + .../JavaScriptCore/bytecompiler/Label.h | 92 + .../JavaScriptCore/bytecompiler/LabelScope.h | 79 + .../JavaScriptCore/bytecompiler/RegisterID.h | 121 + .../javascriptcore/JavaScriptCore/config.h | 76 + .../JavaScriptCore/create_hash_table | 274 + .../JavaScriptCore/debugger/Debugger.cpp | 70 + .../JavaScriptCore/debugger/Debugger.h | 110 + .../JavaScriptCore/debugger/DebuggerActivation.cpp | 103 + .../JavaScriptCore/debugger/DebuggerActivation.h | 63 + .../JavaScriptCore/debugger/DebuggerCallFrame.cpp | 92 + .../JavaScriptCore/debugger/DebuggerCallFrame.h | 70 + .../JavaScriptCore/docs/make-bytecode-docs.pl | 42 + .../JavaScriptCore/generated/ArrayPrototype.lut.h | 34 + .../JavaScriptCore/generated/DatePrototype.lut.h | 59 + .../JavaScriptCore/generated/Grammar.cpp | 5597 +++ .../JavaScriptCore/generated/Grammar.h | 173 + .../JavaScriptCore/generated/JSONObject.lut.h | 15 + .../JavaScriptCore/generated/Lexer.lut.h | 49 + .../JavaScriptCore/generated/MathObject.lut.h | 31 + .../generated/NumberConstructor.lut.h | 18 + .../generated/RegExpConstructor.lut.h | 34 + .../JavaScriptCore/generated/RegExpObject.lut.h | 18 + .../JavaScriptCore/generated/StringPrototype.lut.h | 45 + .../JavaScriptCore/generated/chartables.c | 96 + .../javascriptcore/JavaScriptCore/headers.pri | 9 + .../JavaScriptCore/interpreter/CachedCall.h | 70 + .../JavaScriptCore/interpreter/CallFrame.cpp | 52 + .../JavaScriptCore/interpreter/CallFrame.h | 150 + .../JavaScriptCore/interpreter/CallFrameClosure.h | 60 + .../JavaScriptCore/interpreter/Interpreter.cpp | 3995 ++ .../JavaScriptCore/interpreter/Interpreter.h | 166 + .../JavaScriptCore/interpreter/Register.h | 241 + .../JavaScriptCore/interpreter/RegisterFile.cpp | 59 + .../JavaScriptCore/interpreter/RegisterFile.h | 257 + .../JavaScriptCore/jit/ExecutableAllocator.cpp | 38 + .../JavaScriptCore/jit/ExecutableAllocator.h | 249 + .../jit/ExecutableAllocatorFixedVMPool.cpp | 447 + .../jit/ExecutableAllocatorPosix.cpp | 82 + .../JavaScriptCore/jit/ExecutableAllocatorWin.cpp | 60 + .../javascriptcore/JavaScriptCore/jit/JIT.cpp | 942 + .../javascriptcore/JavaScriptCore/jit/JIT.h | 728 + .../JavaScriptCore/jit/JITArithmetic.cpp | 1378 + .../javascriptcore/JavaScriptCore/jit/JITCall.cpp | 323 + .../javascriptcore/JavaScriptCore/jit/JITCode.h | 122 + .../JavaScriptCore/jit/JITInlineMethods.h | 475 + .../JavaScriptCore/jit/JITOpcodes.cpp | 1187 + .../JavaScriptCore/jit/JITPropertyAccess.cpp | 839 + .../JavaScriptCore/jit/JITStubCall.h | 170 + .../javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 2801 ++ .../javascriptcore/JavaScriptCore/jit/JITStubs.h | 346 + src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp | 590 + src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro | 31 + .../JavaScriptCore/make-generated-sources.sh | 11 + .../JavaScriptCore/os-win32/stdbool.h | 45 + .../JavaScriptCore/os-win32/stdint.h | 66 + .../JavaScriptCore/os-wince/ce_time.cpp | 677 + .../JavaScriptCore/os-wince/ce_time.h | 16 + .../javascriptcore/JavaScriptCore/parser/Grammar.y | 2093 + .../JavaScriptCore/parser/Keywords.table | 72 + .../javascriptcore/JavaScriptCore/parser/Lexer.cpp | 997 + .../javascriptcore/JavaScriptCore/parser/Lexer.h | 149 + .../JavaScriptCore/parser/NodeConstructors.h | 900 + .../JavaScriptCore/parser/NodeInfo.h | 63 + .../javascriptcore/JavaScriptCore/parser/Nodes.cpp | 2215 + .../javascriptcore/JavaScriptCore/parser/Nodes.h | 1734 + .../JavaScriptCore/parser/Parser.cpp | 108 + .../javascriptcore/JavaScriptCore/parser/Parser.h | 122 + .../JavaScriptCore/parser/ParserArena.cpp | 78 + .../JavaScriptCore/parser/ParserArena.h | 64 + .../JavaScriptCore/parser/ResultType.h | 182 + .../JavaScriptCore/parser/SourceCode.h | 99 + .../JavaScriptCore/parser/SourcePoolQt.cpp | 109 + .../JavaScriptCore/parser/SourcePoolQt.h | 93 + .../JavaScriptCore/parser/SourceProvider.h | 85 + .../javascriptcore/JavaScriptCore/pcre/AUTHORS | 12 + .../javascriptcore/JavaScriptCore/pcre/COPYING | 35 + .../javascriptcore/JavaScriptCore/pcre/dftables | 272 + .../javascriptcore/JavaScriptCore/pcre/pcre.h | 68 + .../javascriptcore/JavaScriptCore/pcre/pcre.pri | 35 + .../JavaScriptCore/pcre/pcre_compile.cpp | 2706 ++ .../JavaScriptCore/pcre/pcre_exec.cpp | 2177 + .../JavaScriptCore/pcre/pcre_internal.h | 455 + .../JavaScriptCore/pcre/pcre_tables.cpp | 72 + .../JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp | 99 + .../JavaScriptCore/pcre/pcre_xclass.cpp | 115 + .../JavaScriptCore/pcre/ucpinternal.h | 126 + .../JavaScriptCore/pcre/ucptable.cpp | 2968 ++ .../JavaScriptCore/profiler/CallIdentifier.h | 98 + .../JavaScriptCore/profiler/HeavyProfile.cpp | 0 .../JavaScriptCore/profiler/HeavyProfile.h | 0 .../JavaScriptCore/profiler/Profile.cpp | 136 + .../JavaScriptCore/profiler/Profile.h | 72 + .../JavaScriptCore/profiler/ProfileGenerator.cpp | 169 + .../JavaScriptCore/profiler/ProfileGenerator.h | 77 + .../JavaScriptCore/profiler/ProfileNode.cpp | 346 + .../JavaScriptCore/profiler/ProfileNode.h | 168 + .../JavaScriptCore/profiler/Profiler.cpp | 159 + .../JavaScriptCore/profiler/Profiler.h | 75 + .../JavaScriptCore/profiler/ProfilerServer.h | 35 + .../JavaScriptCore/profiler/ProfilerServer.mm | 115 + .../JavaScriptCore/profiler/TreeProfile.cpp | 0 .../JavaScriptCore/profiler/TreeProfile.h | 0 .../JavaScriptCore/runtime/ArgList.cpp | 83 + .../JavaScriptCore/runtime/ArgList.h | 230 + .../JavaScriptCore/runtime/Arguments.cpp | 284 + .../JavaScriptCore/runtime/Arguments.h | 247 + .../JavaScriptCore/runtime/ArrayConstructor.cpp | 85 + .../JavaScriptCore/runtime/ArrayConstructor.h | 40 + .../JavaScriptCore/runtime/ArrayPrototype.cpp | 1055 + .../JavaScriptCore/runtime/ArrayPrototype.h | 41 + .../runtime/BatchedTransitionOptimizer.h | 55 + .../JavaScriptCore/runtime/BooleanConstructor.cpp | 78 + .../JavaScriptCore/runtime/BooleanConstructor.h | 44 + .../JavaScriptCore/runtime/BooleanObject.cpp | 35 + .../JavaScriptCore/runtime/BooleanObject.h | 46 + .../JavaScriptCore/runtime/BooleanPrototype.cpp | 83 + .../JavaScriptCore/runtime/BooleanPrototype.h | 35 + .../JavaScriptCore/runtime/CallData.cpp | 65 + .../JavaScriptCore/runtime/CallData.h | 91 + .../JavaScriptCore/runtime/ClassInfo.h | 62 + .../JavaScriptCore/runtime/Collector.cpp | 1376 + .../JavaScriptCore/runtime/Collector.h | 287 + .../JavaScriptCore/runtime/CollectorHeapIterator.h | 90 + .../JavaScriptCore/runtime/CommonIdentifiers.cpp | 39 + .../JavaScriptCore/runtime/CommonIdentifiers.h | 91 + .../JavaScriptCore/runtime/Completion.cpp | 86 + .../JavaScriptCore/runtime/Completion.h | 63 + .../JavaScriptCore/runtime/ConstructData.cpp | 65 + .../JavaScriptCore/runtime/ConstructData.h | 96 + .../JavaScriptCore/runtime/DateConstructor.cpp | 183 + .../JavaScriptCore/runtime/DateConstructor.h | 43 + .../JavaScriptCore/runtime/DateConversion.cpp | 101 + .../JavaScriptCore/runtime/DateConversion.h | 60 + .../JavaScriptCore/runtime/DateInstance.cpp | 118 + .../JavaScriptCore/runtime/DateInstance.h | 67 + .../JavaScriptCore/runtime/DatePrototype.cpp | 1105 + .../JavaScriptCore/runtime/DatePrototype.h | 47 + .../JavaScriptCore/runtime/Error.cpp | 128 + .../javascriptcore/JavaScriptCore/runtime/Error.h | 73 + .../JavaScriptCore/runtime/ErrorConstructor.cpp | 73 + .../JavaScriptCore/runtime/ErrorConstructor.h | 44 + .../JavaScriptCore/runtime/ErrorInstance.cpp | 33 + .../JavaScriptCore/runtime/ErrorInstance.h | 38 + .../JavaScriptCore/runtime/ErrorPrototype.cpp | 68 + .../JavaScriptCore/runtime/ErrorPrototype.h | 37 + .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 211 + .../JavaScriptCore/runtime/ExceptionHelpers.h | 57 + .../JavaScriptCore/runtime/FunctionConstructor.cpp | 133 + .../JavaScriptCore/runtime/FunctionConstructor.h | 48 + .../JavaScriptCore/runtime/FunctionPrototype.cpp | 148 + .../JavaScriptCore/runtime/FunctionPrototype.h | 46 + .../JavaScriptCore/runtime/GetterSetter.cpp | 84 + .../JavaScriptCore/runtime/GetterSetter.h | 75 + .../JavaScriptCore/runtime/GlobalEvalFunction.cpp | 49 + .../JavaScriptCore/runtime/GlobalEvalFunction.h | 46 + .../JavaScriptCore/runtime/Identifier.cpp | 268 + .../JavaScriptCore/runtime/Identifier.h | 144 + .../JavaScriptCore/runtime/InitializeThreading.cpp | 72 + .../JavaScriptCore/runtime/InitializeThreading.h | 40 + .../JavaScriptCore/runtime/InternalFunction.cpp | 71 + .../JavaScriptCore/runtime/InternalFunction.h | 66 + .../JavaScriptCore/runtime/JSActivation.cpp | 184 + .../JavaScriptCore/runtime/JSActivation.h | 98 + .../JavaScriptCore/runtime/JSArray.cpp | 1073 + .../JavaScriptCore/runtime/JSArray.h | 130 + .../JavaScriptCore/runtime/JSByteArray.cpp | 97 + .../JavaScriptCore/runtime/JSByteArray.h | 115 + .../JavaScriptCore/runtime/JSCell.cpp | 210 + .../javascriptcore/JavaScriptCore/runtime/JSCell.h | 300 + .../JavaScriptCore/runtime/JSFunction.cpp | 215 + .../JavaScriptCore/runtime/JSFunction.h | 138 + .../JavaScriptCore/runtime/JSGlobalData.cpp | 254 + .../JavaScriptCore/runtime/JSGlobalData.h | 164 + .../JavaScriptCore/runtime/JSGlobalObject.cpp | 464 + .../JavaScriptCore/runtime/JSGlobalObject.h | 426 + .../runtime/JSGlobalObjectFunctions.cpp | 439 + .../runtime/JSGlobalObjectFunctions.h | 60 + .../JavaScriptCore/runtime/JSImmediate.cpp | 103 + .../JavaScriptCore/runtime/JSImmediate.h | 790 + .../JavaScriptCore/runtime/JSLock.cpp | 254 + .../javascriptcore/JavaScriptCore/runtime/JSLock.h | 104 + .../JavaScriptCore/runtime/JSNotAnObject.cpp | 124 + .../JavaScriptCore/runtime/JSNotAnObject.h | 97 + .../JavaScriptCore/runtime/JSNumberCell.cpp | 137 + .../JavaScriptCore/runtime/JSNumberCell.h | 480 + .../JavaScriptCore/runtime/JSONObject.cpp | 766 + .../JavaScriptCore/runtime/JSONObject.h | 58 + .../JavaScriptCore/runtime/JSObject.cpp | 546 + .../JavaScriptCore/runtime/JSObject.h | 629 + .../runtime/JSPropertyNameIterator.cpp | 90 + .../runtime/JSPropertyNameIterator.h | 116 + .../JavaScriptCore/runtime/JSStaticScopeObject.cpp | 79 + .../JavaScriptCore/runtime/JSStaticScopeObject.h | 68 + .../JavaScriptCore/runtime/JSString.cpp | 171 + .../JavaScriptCore/runtime/JSString.h | 218 + .../javascriptcore/JavaScriptCore/runtime/JSType.h | 42 + .../JavaScriptCore/runtime/JSTypeInfo.h | 72 + .../JavaScriptCore/runtime/JSValue.cpp | 87 + .../JavaScriptCore/runtime/JSValue.h | 420 + .../JavaScriptCore/runtime/JSVariableObject.cpp | 70 + .../JavaScriptCore/runtime/JSVariableObject.h | 164 + .../JavaScriptCore/runtime/JSWrapperObject.cpp | 36 + .../JavaScriptCore/runtime/JSWrapperObject.h | 59 + .../JavaScriptCore/runtime/LiteralParser.cpp | 449 + .../JavaScriptCore/runtime/LiteralParser.h | 110 + .../JavaScriptCore/runtime/Lookup.cpp | 82 + .../javascriptcore/JavaScriptCore/runtime/Lookup.h | 265 + .../JavaScriptCore/runtime/MathObject.cpp | 242 + .../JavaScriptCore/runtime/MathObject.h | 45 + .../runtime/NativeErrorConstructor.cpp | 73 + .../runtime/NativeErrorConstructor.h | 51 + .../runtime/NativeErrorPrototype.cpp | 43 + .../JavaScriptCore/runtime/NativeErrorPrototype.h | 44 + .../JavaScriptCore/runtime/NativeFunctionWrapper.h | 39 + .../JavaScriptCore/runtime/NumberConstructor.cpp | 123 + .../JavaScriptCore/runtime/NumberConstructor.h | 55 + .../JavaScriptCore/runtime/NumberObject.cpp | 51 + .../JavaScriptCore/runtime/NumberObject.h | 44 + .../JavaScriptCore/runtime/NumberPrototype.cpp | 445 + .../JavaScriptCore/runtime/NumberPrototype.h | 35 + .../JavaScriptCore/runtime/ObjectConstructor.cpp | 73 + .../JavaScriptCore/runtime/ObjectConstructor.h | 41 + .../JavaScriptCore/runtime/ObjectPrototype.cpp | 135 + .../JavaScriptCore/runtime/ObjectPrototype.h | 37 + .../JavaScriptCore/runtime/Operations.cpp | 121 + .../JavaScriptCore/runtime/Operations.h | 334 + .../JavaScriptCore/runtime/PropertyMapHashTable.h | 90 + .../JavaScriptCore/runtime/PropertyNameArray.cpp | 50 + .../JavaScriptCore/runtime/PropertyNameArray.h | 113 + .../JavaScriptCore/runtime/PropertySlot.cpp | 45 + .../JavaScriptCore/runtime/PropertySlot.h | 203 + .../JavaScriptCore/runtime/Protect.h | 215 + .../JavaScriptCore/runtime/PrototypeFunction.cpp | 57 + .../JavaScriptCore/runtime/PrototypeFunction.h | 45 + .../JavaScriptCore/runtime/PutPropertySlot.h | 77 + .../JavaScriptCore/runtime/RegExp.cpp | 283 + .../javascriptcore/JavaScriptCore/runtime/RegExp.h | 89 + .../JavaScriptCore/runtime/RegExpConstructor.cpp | 392 + .../JavaScriptCore/runtime/RegExpConstructor.h | 82 + .../JavaScriptCore/runtime/RegExpMatchesArray.h | 87 + .../JavaScriptCore/runtime/RegExpObject.cpp | 168 + .../JavaScriptCore/runtime/RegExpObject.h | 83 + .../JavaScriptCore/runtime/RegExpPrototype.cpp | 123 + .../JavaScriptCore/runtime/RegExpPrototype.h | 38 + .../JavaScriptCore/runtime/ScopeChain.cpp | 68 + .../JavaScriptCore/runtime/ScopeChain.h | 240 + .../JavaScriptCore/runtime/ScopeChainMark.h | 39 + .../JavaScriptCore/runtime/SmallStrings.cpp | 128 + .../JavaScriptCore/runtime/SmallStrings.h | 74 + .../JavaScriptCore/runtime/StringConstructor.cpp | 91 + .../JavaScriptCore/runtime/StringConstructor.h | 40 + .../JavaScriptCore/runtime/StringObject.cpp | 112 + .../JavaScriptCore/runtime/StringObject.h | 73 + .../StringObjectThatMasqueradesAsUndefined.h | 55 + .../JavaScriptCore/runtime/StringPrototype.cpp | 895 + .../JavaScriptCore/runtime/StringPrototype.h | 42 + .../JavaScriptCore/runtime/Structure.cpp | 1156 + .../JavaScriptCore/runtime/Structure.h | 242 + .../JavaScriptCore/runtime/StructureChain.cpp | 66 + .../JavaScriptCore/runtime/StructureChain.h | 52 + .../runtime/StructureTransitionTable.h | 73 + .../JavaScriptCore/runtime/SymbolTable.h | 126 + .../JavaScriptCore/runtime/TimeoutChecker.cpp | 159 + .../JavaScriptCore/runtime/TimeoutChecker.h | 76 + .../JavaScriptCore/runtime/Tracing.d | 40 + .../JavaScriptCore/runtime/Tracing.h | 50 + .../JavaScriptCore/runtime/UString.cpp | 1781 + .../JavaScriptCore/runtime/UString.h | 604 + .../JavaScriptCore/wrec/CharacterClass.cpp | 140 + .../JavaScriptCore/wrec/CharacterClass.h | 68 + .../wrec/CharacterClassConstructor.cpp | 257 + .../wrec/CharacterClassConstructor.h | 99 + .../javascriptcore/JavaScriptCore/wrec/Escapes.h | 150 + .../JavaScriptCore/wrec/Quantifier.h | 66 + .../javascriptcore/JavaScriptCore/wrec/WREC.cpp | 86 + .../javascriptcore/JavaScriptCore/wrec/WREC.h | 54 + .../JavaScriptCore/wrec/WRECFunctors.cpp | 80 + .../JavaScriptCore/wrec/WRECFunctors.h | 109 + .../JavaScriptCore/wrec/WRECGenerator.cpp | 653 + .../JavaScriptCore/wrec/WRECGenerator.h | 128 + .../JavaScriptCore/wrec/WRECParser.cpp | 643 + .../JavaScriptCore/wrec/WRECParser.h | 214 + .../javascriptcore/JavaScriptCore/wtf/ASCIICType.h | 166 + .../javascriptcore/JavaScriptCore/wtf/AVLTree.h | 959 + .../JavaScriptCore/wtf/AlwaysInline.h | 63 + .../JavaScriptCore/wtf/Assertions.cpp | 207 + .../javascriptcore/JavaScriptCore/wtf/Assertions.h | 249 + .../JavaScriptCore/wtf/ByteArray.cpp | 38 + .../javascriptcore/JavaScriptCore/wtf/ByteArray.h | 80 + .../JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 | 137 + .../JavaScriptCore/wtf/CrossThreadRefCounted.h | 169 + .../JavaScriptCore/wtf/CurrentTime.cpp | 232 + .../JavaScriptCore/wtf/CurrentTime.h | 47 + .../javascriptcore/JavaScriptCore/wtf/DateMath.cpp | 917 + .../javascriptcore/JavaScriptCore/wtf/DateMath.h | 192 + .../javascriptcore/JavaScriptCore/wtf/Deque.h | 669 + .../JavaScriptCore/wtf/DisallowCType.h | 74 + .../JavaScriptCore/wtf/FastAllocBase.h | 403 + .../JavaScriptCore/wtf/FastMalloc.cpp | 4148 ++ .../javascriptcore/JavaScriptCore/wtf/FastMalloc.h | 193 + .../javascriptcore/JavaScriptCore/wtf/Forward.h | 43 + .../javascriptcore/JavaScriptCore/wtf/GOwnPtr.cpp | 65 + .../javascriptcore/JavaScriptCore/wtf/GOwnPtr.h | 98 + .../javascriptcore/JavaScriptCore/wtf/GetPtr.h | 33 + .../JavaScriptCore/wtf/HashCountedSet.h | 205 + .../JavaScriptCore/wtf/HashFunctions.h | 186 + .../JavaScriptCore/wtf/HashIterators.h | 216 + .../javascriptcore/JavaScriptCore/wtf/HashMap.h | 337 + .../javascriptcore/JavaScriptCore/wtf/HashSet.h | 278 + .../JavaScriptCore/wtf/HashTable.cpp | 69 + .../javascriptcore/JavaScriptCore/wtf/HashTable.h | 1158 + .../javascriptcore/JavaScriptCore/wtf/HashTraits.h | 115 + .../JavaScriptCore/wtf/ListHashSet.h | 616 + .../javascriptcore/JavaScriptCore/wtf/ListRefPtr.h | 61 + .../javascriptcore/JavaScriptCore/wtf/Locker.h | 47 + .../JavaScriptCore/wtf/MainThread.cpp | 133 + .../javascriptcore/JavaScriptCore/wtf/MainThread.h | 59 + .../JavaScriptCore/wtf/MallocZoneSupport.h | 65 + .../javascriptcore/JavaScriptCore/wtf/MathExtras.h | 178 + .../JavaScriptCore/wtf/MessageQueue.h | 183 + .../JavaScriptCore/wtf/Noncopyable.h | 52 + .../javascriptcore/JavaScriptCore/wtf/NotFound.h | 37 + .../JavaScriptCore/wtf/OwnArrayPtr.h | 75 + .../JavaScriptCore/wtf/OwnFastMallocPtr.h | 52 + .../javascriptcore/JavaScriptCore/wtf/OwnPtr.h | 142 + .../JavaScriptCore/wtf/OwnPtrCommon.h | 61 + .../JavaScriptCore/wtf/OwnPtrWin.cpp | 76 + .../javascriptcore/JavaScriptCore/wtf/PassOwnPtr.h | 177 + .../javascriptcore/JavaScriptCore/wtf/PassRefPtr.h | 195 + .../javascriptcore/JavaScriptCore/wtf/Platform.h | 787 + .../JavaScriptCore/wtf/PtrAndFlags.h | 64 + .../JavaScriptCore/wtf/RandomNumber.cpp | 102 + .../JavaScriptCore/wtf/RandomNumber.h | 42 + .../JavaScriptCore/wtf/RandomNumberSeed.h | 89 + .../javascriptcore/JavaScriptCore/wtf/RefCounted.h | 137 + .../JavaScriptCore/wtf/RefCountedLeakCounter.cpp | 100 + .../JavaScriptCore/wtf/RefCountedLeakCounter.h | 48 + .../javascriptcore/JavaScriptCore/wtf/RefPtr.h | 206 + .../JavaScriptCore/wtf/RefPtrHashMap.h | 350 + .../javascriptcore/JavaScriptCore/wtf/RetainPtr.h | 203 + .../JavaScriptCore/wtf/SegmentedVector.h | 252 + .../JavaScriptCore/wtf/StdLibExtras.h | 63 + .../JavaScriptCore/wtf/StringExtras.h | 88 + .../JavaScriptCore/wtf/TCPackedCache.h | 234 + .../javascriptcore/JavaScriptCore/wtf/TCPageMap.h | 316 + .../javascriptcore/JavaScriptCore/wtf/TCSpinLock.h | 239 + .../JavaScriptCore/wtf/TCSystemAlloc.cpp | 469 + .../JavaScriptCore/wtf/TCSystemAlloc.h | 75 + .../JavaScriptCore/wtf/ThreadSpecific.h | 266 + .../JavaScriptCore/wtf/ThreadSpecificWin.cpp | 54 + .../JavaScriptCore/wtf/Threading.cpp | 97 + .../javascriptcore/JavaScriptCore/wtf/Threading.h | 332 + .../JavaScriptCore/wtf/ThreadingNone.cpp | 59 + .../JavaScriptCore/wtf/ThreadingPthreads.cpp | 375 + .../JavaScriptCore/wtf/ThreadingWin.cpp | 493 + .../JavaScriptCore/wtf/TypeTraits.cpp | 120 + .../javascriptcore/JavaScriptCore/wtf/TypeTraits.h | 339 + .../JavaScriptCore/wtf/UnusedParam.h | 29 + .../javascriptcore/JavaScriptCore/wtf/VMTags.h | 55 + .../javascriptcore/JavaScriptCore/wtf/Vector.h | 1014 + .../JavaScriptCore/wtf/VectorTraits.h | 102 + .../javascriptcore/JavaScriptCore/wtf/dtoa.cpp | 2379 ++ .../javascriptcore/JavaScriptCore/wtf/dtoa.h | 37 + .../JavaScriptCore/wtf/qt/MainThreadQt.cpp | 74 + .../JavaScriptCore/wtf/qt/ThreadingQt.cpp | 271 + .../JavaScriptCore/wtf/unicode/Collator.h | 67 + .../JavaScriptCore/wtf/unicode/CollatorDefault.cpp | 75 + .../JavaScriptCore/wtf/unicode/UTF8.cpp | 303 + .../JavaScriptCore/wtf/unicode/UTF8.h | 75 + .../JavaScriptCore/wtf/unicode/Unicode.h | 39 + .../wtf/unicode/glib/UnicodeGLib.cpp | 214 + .../JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h | 238 + .../wtf/unicode/glib/UnicodeMacrosFromICU.h | 69 + .../JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp | 150 + .../JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h | 230 + .../JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h | 545 + .../JavaScriptCore/wtf/wince/FastMallocWince.h | 177 + .../JavaScriptCore/wtf/wince/MemoryManager.cpp | 171 + .../JavaScriptCore/wtf/wince/MemoryManager.h | 80 + .../JavaScriptCore/wtf/wince/mt19937ar.c | 170 + .../JavaScriptCore/yarr/RegexCompiler.cpp | 728 + .../JavaScriptCore/yarr/RegexCompiler.h | 45 + .../JavaScriptCore/yarr/RegexInterpreter.cpp | 1638 + .../JavaScriptCore/yarr/RegexInterpreter.h | 337 + .../JavaScriptCore/yarr/RegexJIT.cpp | 1418 + .../javascriptcore/JavaScriptCore/yarr/RegexJIT.h | 91 + .../JavaScriptCore/yarr/RegexParser.h | 854 + .../JavaScriptCore/yarr/RegexPattern.h | 356 + src/script/script.pro | 2 +- 481 files changed, 238766 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2002-12-03 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2003-10-25 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2007-10-14 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2008-08-10 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog-2009-06-16 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/DerivedSources.make create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/APICast.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSContextRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSObjectRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSRetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSStringRefCF.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JSValueRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScript.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/JavaScriptCore.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/OpaqueJSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/Info.plist create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.gypi create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.order create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pro create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCorePrefix.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/THANKS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/ARMv7Assembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AbstractMacroAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/CodeLocation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/LinkBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARM.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerARMv7.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerCodeRef.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86Common.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/MacroAssemblerX86_64.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/RepatchBuffer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/assembler/X86Assembler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/EvalCodeCache.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Instruction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/JumpTable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/JumpTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/Opcode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecode/StructureStubInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/Label.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/LabelScope.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/RegisterID.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/config.h create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/create_hash_table create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/Debugger.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerActivation.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerActivation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/debugger/DebuggerCallFrame.h create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/docs/make-bytecode-docs.pl create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/ArrayPrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/DatePrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Grammar.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Grammar.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/JSONObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/Lexer.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/MathObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/NumberConstructor.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/RegExpConstructor.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/RegExpObject.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/StringPrototype.lut.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/generated/chartables.c create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/headers.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CachedCall.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrameClosure.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Register.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/RegisterFile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/interpreter/RegisterFile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorPosix.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITArithmetic.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCall.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITCode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITInlineMethods.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITOpcodes.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITPropertyAccess.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubCall.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jsc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/jsc.pro create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/make-generated-sources.sh create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-win32/stdbool.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-win32/stdint.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/os-wince/ce_time.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Grammar.y create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Keywords.table create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/NodeConstructors.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/NodeInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ParserArena.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ParserArena.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/ResultType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourceCode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourcePoolQt.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/parser/SourceProvider.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/AUTHORS create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/COPYING create mode 100755 src/3rdparty/javascriptcore/JavaScriptCore/pcre/dftables create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre.pri create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_compile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_internal.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_tables.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_xclass.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/ucpinternal.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/pcre/ucptable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/CallIdentifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/HeavyProfile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/HeavyProfile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileNode.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfileNode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profiler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/Profiler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfilerServer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/ProfilerServer.mm create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/TreeProfile.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/profiler/TreeProfile.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArgList.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArgList.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ArrayPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BatchedTransitionOptimizer.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/BooleanPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ClassInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CollectorHeapIterator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CommonIdentifiers.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/CommonIdentifiers.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Completion.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ConstructData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ConstructData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConversion.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Error.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorInstance.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorInstance.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ErrorPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ExceptionHelpers.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ExceptionHelpers.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/FunctionPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GetterSetter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GetterSetter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GlobalEvalFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/GlobalEvalFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InitializeThreading.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InitializeThreading.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InternalFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/InternalFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSActivation.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSActivation.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSByteArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSByteArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSCell.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSLock.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSLock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNotAnObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNotAnObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNumberCell.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNumberCell.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSPropertyNameIterator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSPropertyNameIterator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSStaticScopeObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSStaticScopeObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSTypeInfo.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSVariableObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSVariableObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSWrapperObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSWrapperObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/LiteralParser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/LiteralParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeErrorPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NativeFunctionWrapper.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ObjectPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Operations.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyMapHashTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertySlot.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertySlot.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Protect.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PrototypeFunction.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PrototypeFunction.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/PutPropertySlot.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExp.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExp.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpMatchesArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/RegExpPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChain.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/ScopeChainMark.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SmallStrings.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SmallStrings.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObject.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObject.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Structure.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureChain.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureChain.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/StructureTransitionTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/SymbolTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/TimeoutChecker.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Tracing.d create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/Tracing.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClass.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClass.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClassConstructor.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/CharacterClassConstructor.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/Escapes.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/Quantifier.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WREC.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WREC.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECFunctors.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECFunctors.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECGenerator.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECGenerator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECParser.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wrec/WRECParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ASCIICType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/AVLTree.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ByteArray.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ByteArray.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32 create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CrossThreadRefCounted.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CurrentTime.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/CurrentTime.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Deque.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/DisallowCType.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Forward.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GOwnPtr.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GOwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/GetPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashCountedSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashFunctions.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashIterators.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ListHashSet.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ListRefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Locker.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MainThread.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MainThread.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MallocZoneSupport.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/MessageQueue.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Noncopyable.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/NotFound.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnArrayPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnFastMallocPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtrCommon.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnPtrWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PassOwnPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PassRefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/PtrAndFlags.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumber.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RandomNumberSeed.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCounted.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCountedLeakCounter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefCountedLeakCounter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtrHashMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/RetainPtr.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/SegmentedVector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/StdLibExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/StringExtras.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPackedCache.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCPageMap.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSpinLock.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TCSystemAlloc.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecific.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadSpecificWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingNone.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingWin.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/VMTags.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/VectorTraits.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/qt/MainThreadQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/qt/ThreadingQt.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/Collator.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/CollatorDefault.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/Unicode.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/FastMallocWince.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/MemoryManager.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/MemoryManager.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/wtf/wince/mt19937ar.c create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexParser.h create mode 100644 src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h new file mode 100644 index 0000000..762a15e --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/APICast.h @@ -0,0 +1,133 @@ +/* + * 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. + */ + +#ifndef APICast_h +#define APICast_h + +#include "JSNumberCell.h" +#include "JSValue.h" +#include +#include + +namespace JSC { + class ExecState; + class PropertyNameArray; + class JSGlobalData; + class JSObject; + class JSValue; +} + +typedef const struct OpaqueJSContextGroup* JSContextGroupRef; +typedef const struct OpaqueJSContext* JSContextRef; +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef; +typedef const struct OpaqueJSValue* JSValueRef; +typedef struct OpaqueJSValue* JSObjectRef; + +/* Opaque typing convenience methods */ + +inline JSC::ExecState* toJS(JSContextRef c) +{ + return reinterpret_cast(const_cast(c)); +} + +inline JSC::ExecState* toJS(JSGlobalContextRef c) +{ + return reinterpret_cast(c); +} + +inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) +{ + JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast(const_cast(v))); +#if USE(ALTERNATE_JSIMMEDIATE) + UNUSED_PARAM(exec); +#else + if (jsValue && jsValue.isNumber()) { + ASSERT(jsValue.isAPIMangledNumber()); + return JSC::jsNumber(exec, jsValue.uncheckedGetNumber()); + } +#endif + return jsValue; +} + +inline JSC::JSObject* toJS(JSObjectRef o) +{ + return reinterpret_cast(o); +} + +inline JSC::PropertyNameArray* toJS(JSPropertyNameAccumulatorRef a) +{ + return reinterpret_cast(a); +} + +inline JSC::JSGlobalData* toJS(JSContextGroupRef g) +{ + return reinterpret_cast(const_cast(g)); +} + +inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v) +{ +#if USE(ALTERNATE_JSIMMEDIATE) + UNUSED_PARAM(exec); +#else + if (v && v.isNumber()) { + ASSERT(!v.isAPIMangledNumber()); + return reinterpret_cast(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber()))); + } +#endif + return reinterpret_cast(JSC::JSValue::encode(v)); +} + +inline JSObjectRef toRef(JSC::JSObject* o) +{ + return reinterpret_cast(o); +} + +inline JSObjectRef toRef(const JSC::JSObject* o) +{ + return reinterpret_cast(const_cast(o)); +} + +inline JSContextRef toRef(JSC::ExecState* e) +{ + return reinterpret_cast(e); +} + +inline JSGlobalContextRef toGlobalRef(JSC::ExecState* e) +{ + return reinterpret_cast(e); +} + +inline JSPropertyNameAccumulatorRef toRef(JSC::PropertyNameArray* l) +{ + return reinterpret_cast(l); +} + +inline JSContextGroupRef toRef(JSC::JSGlobalData* g) +{ + return reinterpret_cast(g); +} + +#endif // APICast_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp new file mode 100644 index 0000000..4a32d35 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2006, 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. + * + * 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 "JSBase.h" +#include "JSBasePrivate.h" + +#include "APICast.h" +#include "Completion.h" +#include "OpaqueJSString.h" +#include "SourceCode.h" +#include +#include +#include +#include +#include +#include + +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); + + JSObject* jsThisObject = toJS(thisObject); + + // evaluate sets "this" to the global object if it is NULL + JSGlobalObject* globalObject = exec->dynamicGlobalObject(); + SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber); + Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), source, jsThisObject); + + if (completion.complType() == Throw) { + if (exception) + *exception = toRef(exec, completion.value()); + return 0; + } + + if (completion.value()) + return toRef(exec, completion.value()); + + // happens, for example, when the only statement is an empty (';') statement + return toRef(exec, jsUndefined()); +} + +bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber); + Completion completion = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source); + if (completion.complType() == Throw) { + if (exception) + *exception = toRef(exec, completion.value()); + return false; + } + + return true; +} + +void JSGarbageCollect(JSContextRef ctx) +{ + // We used to recommend passing NULL as an argument here, which caused the only heap to be collected. + // As there is no longer a shared heap, the previously recommended usage became a no-op (but the GC + // will happen when the context group is destroyed). + // Because the function argument was originally ignored, some clients may pass their released context here, + // in which case there is a risk of crashing if another thread performs GC on the same heap in between. + if (!ctx) + return; + + ExecState* exec = toJS(ctx); + JSGlobalData& globalData = exec->globalData(); + + JSLock lock(globalData.isSharedInstance ? LockForReal : SilenceAssertionsOnly); + + if (!globalData.heap.isBusy()) + globalData.heap.collect(); + + // FIXME: Perhaps we should trigger a second mark and sweep + // once the garbage collector is done if this is called when + // the collector is busy. +} + +void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + exec->globalData().heap.reportExtraMemoryCost(size); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h new file mode 100644 index 0000000..9f3d88e --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBase.h @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#ifndef JSBase_h +#define JSBase_h + +#ifndef __cplusplus +#include +#endif + +/* JavaScript engine interface */ + +/*! @typedef JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects. */ +typedef const struct OpaqueJSContextGroup* JSContextGroupRef; + +/*! @typedef JSContextRef A JavaScript execution context. Holds the global object and other execution state. */ +typedef const struct OpaqueJSContext* JSContextRef; + +/*! @typedef JSGlobalContextRef A global JavaScript execution context. A JSGlobalContext is a JSContext. */ +typedef struct OpaqueJSContext* JSGlobalContextRef; + +/*! @typedef JSStringRef A UTF16 character buffer. The fundamental string representation in JavaScript. */ +typedef struct OpaqueJSString* JSStringRef; + +/*! @typedef JSClassRef A JavaScript class. Used with JSObjectMake to construct objects with custom behavior. */ +typedef struct OpaqueJSClass* JSClassRef; + +/*! @typedef JSPropertyNameArrayRef An array of JavaScript property names. */ +typedef struct OpaqueJSPropertyNameArray* JSPropertyNameArrayRef; + +/*! @typedef JSPropertyNameAccumulatorRef An ordered set used to collect the names of a JavaScript object's properties. */ +typedef struct OpaqueJSPropertyNameAccumulator* JSPropertyNameAccumulatorRef; + + +/* JavaScript data types */ + +/*! @typedef JSValueRef A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them. */ +typedef const struct OpaqueJSValue* JSValueRef; + +/*! @typedef JSObjectRef A JavaScript object. A JSObject is a JSValue. */ +typedef struct OpaqueJSValue* JSObjectRef; + +/* JavaScript symbol exports */ + +#undef JS_EXPORT +#if defined(BUILDING_WX__) + #define JS_EXPORT +#elif defined(__GNUC__) + #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 + */ + #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) + #define JS_EXPORT __declspec(dllexport) + #else + #define JS_EXPORT __declspec(dllimport) + #endif +#else + #define JS_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Script Evaluation */ + +/*! +@function JSEvaluateScript +@abstract Evaluates a string of JavaScript. +@param ctx The execution context to use. +@param script A JSString containing the script to evaluate. +@param thisObject The object to use as "this," or NULL to use the global object as "this." +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSValue that results from evaluating script, or NULL if an exception is thrown. +*/ +JS_EXPORT JSValueRef JSEvaluateScript(JSContextRef ctx, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function JSCheckScriptSyntax +@abstract Checks for syntax errors in a string of JavaScript. +@param ctx The execution context to use. +@param script A JSString containing the script to check for syntax errors. +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. +@result true if the script is syntactically correct, otherwise false. +*/ +JS_EXPORT bool JSCheckScriptSyntax(JSContextRef ctx, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function JSGarbageCollect +@abstract Performs a JavaScript garbage collection. +@param ctx The execution context to use. +@discussion JavaScript values that are on the machine stack, in a register, + protected by JSValueProtect, set as the global object of an execution context, + or reachable from any such value will not be collected. + + During JavaScript execution, you are not required to call this function; the + JavaScript engine will garbage collect as needed. JavaScript values created + within a context group are automatically destroyed when the last reference + to the context group is released. +*/ +JS_EXPORT void JSGarbageCollect(JSContextRef ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* JSBase_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h new file mode 100644 index 0000000..befa316 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSBasePrivate.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 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 JSBasePrivate_h +#define JSBasePrivate_h + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Reports an object's non-GC memory payload to the garbage collector. +@param ctx The execution context to use. +@param size The payload's size, in bytes. +@discussion Use this function to notify the garbage collector that a GC object +owns a large non-GC memory region. Calling this function will encourage the +garbage collector to collect soon, hoping to reclaim that large non-GC memory +region. +*/ +JS_EXPORT void JSReportExtraMemoryCost(JSContextRef ctx, size_t size) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +#ifdef __cplusplus +} +#endif + +#endif /* JSBasePrivate_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp new file mode 100644 index 0000000..64c83cb --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2006, 2007, 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 "JSCallbackConstructor.h" + +#include "APICast.h" +#include +#include +#include +#include + +namespace JSC { + +const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 }; + +JSCallbackConstructor::JSCallbackConstructor(PassRefPtr structure, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback) + : JSObject(structure) + , m_class(jsClass) + , m_callback(callback) +{ + if (m_class) + JSClassRetain(jsClass); +} + +JSCallbackConstructor::~JSCallbackConstructor() +{ + if (m_class) + JSClassRelease(m_class); +} + +static JSObject* constructJSCallback(ExecState* exec, JSObject* constructor, const ArgList& args) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef constructorRef = toRef(constructor); + + JSObjectCallAsConstructorCallback callback = static_cast(constructor)->callback(); + if (callback) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + + JSValueRef exception = 0; + JSObjectRef result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception); + } + if (exception) + exec->setException(toJS(exec, exception)); + return toJS(result); + } + + return toJS(JSObjectMake(ctx, static_cast(constructor)->classRef(), 0)); +} + +ConstructType JSCallbackConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructJSCallback; + return ConstructTypeHost; +} + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h new file mode 100644 index 0000000..1f06249 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackConstructor.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 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. + */ + +#ifndef JSCallbackConstructor_h +#define JSCallbackConstructor_h + +#include "JSObjectRef.h" +#include + +namespace JSC { + +class JSCallbackConstructor : public JSObject { +public: + JSCallbackConstructor(PassRefPtr, JSClassRef, JSObjectCallAsConstructorCallback); + virtual ~JSCallbackConstructor(); + JSClassRef classRef() const { return m_class; } + JSObjectCallAsConstructorCallback callback() const { return m_callback; } + static const ClassInfo info; + + static PassRefPtr createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot)); + } + +private: + virtual ConstructType getConstructData(ConstructData&); + virtual const ClassInfo* classInfo() const { return &info; } + + JSClassRef m_class; + JSObjectCallAsConstructorCallback m_callback; +}; + +} // namespace JSC + +#endif // JSCallbackConstructor_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp new file mode 100644 index 0000000..1b3217b --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 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 +#include "JSCallbackFunction.h" + +#include "APICast.h" +#include "JSFunction.h" +#include "FunctionPrototype.h" +#include +#include +#include + +namespace JSC { + +ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction); + +const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunction::info, 0, 0 }; + +JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name) + : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject()->callbackFunctionStructure(), name) + , m_callback(callback) +{ +} + +JSValue JSCallbackFunction::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef functionRef = toRef(functionObject); + JSObjectRef thisObjRef = toRef(thisValue.toThisObject(exec)); + + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + + JSValueRef exception = 0; + JSValueRef result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = static_cast(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); + } + if (exception) + exec->setException(toJS(exec, exception)); + + return toJS(exec, result); +} + +CallType JSCallbackFunction::getCallData(CallData& callData) +{ + callData.native.function = call; + return CallTypeHost; +} + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h new file mode 100644 index 0000000..7dd87b5 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackFunction.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 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. + */ + +#ifndef JSCallbackFunction_h +#define JSCallbackFunction_h + +#include "InternalFunction.h" +#include "JSObjectRef.h" + +namespace JSC { + +class JSCallbackFunction : public InternalFunction { +public: + JSCallbackFunction(ExecState*, JSObjectCallAsFunctionCallback, const Identifier& name); + + static const ClassInfo info; + + // InternalFunction mish-mashes constructor and function behavior -- we should + // refactor the code so this override isn't necessary + static PassRefPtr createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + } + +private: + virtual CallType getCallData(CallData&); + virtual const ClassInfo* classInfo() const { return &info; } + + static JSValue JSC_HOST_CALL call(ExecState*, JSObject*, JSValue, const ArgList&); + + JSObjectCallAsFunctionCallback m_callback; +}; + +} // namespace JSC + +#endif // JSCallbackFunction_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp new file mode 100644 index 0000000..2fde0f8 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * 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 "JSCallbackObject.h" + +#include "Collector.h" + +namespace JSC { + +ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); +ASSERT_CLASS_FITS_IN_CELL(JSCallbackObject); + +// Define the two types of JSCallbackObjects we support. +template <> const ClassInfo JSCallbackObject::info = { "CallbackObject", 0, 0, 0 }; +template <> const ClassInfo JSCallbackObject::info = { "CallbackGlobalObject", 0, 0, 0 }; + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h new file mode 100644 index 0000000..4360baa --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObject.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * 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 JSCallbackObject_h +#define JSCallbackObject_h + +#include "JSObjectRef.h" +#include "JSValueRef.h" +#include "JSObject.h" + +namespace JSC { + +template +class JSCallbackObject : public Base { +public: + JSCallbackObject(ExecState*, PassRefPtr, JSClassRef, void* data); + JSCallbackObject(JSClassRef); + virtual ~JSCallbackObject(); + + void setPrivate(void* data); + void* getPrivate(); + + static const ClassInfo info; + + JSClassRef classRef() const { return m_callbackObjectData->jsClass; } + bool inherits(JSClassRef) const; + + static PassRefPtr createStructure(JSValue proto) + { + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | OverridesHasInstance)); + } + +private: + virtual UString className() const; + + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual bool getOwnPropertySlot(ExecState*, unsigned, PropertySlot&); + + virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&); + + virtual bool deleteProperty(ExecState*, const Identifier&, bool checkDontDelete = true); + virtual bool deleteProperty(ExecState*, unsigned, bool checkDontDelete = true); + + virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto); + + virtual void getPropertyNames(ExecState*, PropertyNameArray&, unsigned listedAttributes = Structure::Prototype); + + virtual double toNumber(ExecState*) const; + virtual UString toString(ExecState*) const; + + virtual ConstructType getConstructData(ConstructData&); + virtual CallType getCallData(CallData&); + virtual const ClassInfo* classInfo() const { return &info; } + + void init(ExecState*); + + static JSCallbackObject* asCallbackObject(JSValue); + + static JSValue JSC_HOST_CALL call(ExecState*, JSObject* functionObject, JSValue thisValue, const ArgList&); + static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&); + + static JSValue staticValueGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue staticFunctionGetter(ExecState*, const Identifier&, const PropertySlot&); + static JSValue callbackGetter(ExecState*, const Identifier&, const PropertySlot&); + + struct JSCallbackObjectData { + JSCallbackObjectData(void* privateData, JSClassRef jsClass) + : privateData(privateData) + , jsClass(jsClass) + { + JSClassRetain(jsClass); + } + + ~JSCallbackObjectData() + { + JSClassRelease(jsClass); + } + + void* privateData; + JSClassRef jsClass; + }; + + OwnPtr m_callbackObjectData; +}; + +} // namespace JSC + +// include the actual template class implementation +#include "JSCallbackObjectFunctions.h" + +#endif // JSCallbackObject_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h new file mode 100644 index 0000000..669b3cd --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -0,0 +1,570 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Eric Seidel + * + * 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 "APICast.h" +#include "Error.h" +#include "JSCallbackFunction.h" +#include "JSClassRef.h" +#include "JSGlobalObject.h" +#include "JSLock.h" +#include "JSObjectRef.h" +#include "JSString.h" +#include "JSStringRef.h" +#include "OpaqueJSString.h" +#include "PropertyNameArray.h" +#include + +namespace JSC { + +template +inline JSCallbackObject* JSCallbackObject::asCallbackObject(JSValue value) +{ + ASSERT(asObject(value)->inherits(&info)); + return static_cast(asObject(value)); +} + +template +JSCallbackObject::JSCallbackObject(ExecState* exec, PassRefPtr structure, JSClassRef jsClass, void* data) + : Base(structure) + , m_callbackObjectData(new JSCallbackObjectData(data, jsClass)) +{ + init(exec); +} + +// Global object constructor. +// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one. +template +JSCallbackObject::JSCallbackObject(JSClassRef jsClass) + : Base() + , m_callbackObjectData(new JSCallbackObjectData(0, jsClass)) +{ + ASSERT(Base::isGlobalObject()); + init(static_cast(this)->globalExec()); +} + +template +void JSCallbackObject::init(ExecState* exec) +{ + ASSERT(exec); + + Vector initRoutines; + JSClassRef jsClass = classRef(); + do { + if (JSObjectInitializeCallback initialize = jsClass->initialize) + initRoutines.append(initialize); + } while ((jsClass = jsClass->parentClass)); + + // initialize from base to derived + for (int i = static_cast(initRoutines.size()) - 1; i >= 0; i--) { + JSLock::DropAllLocks dropAllLocks(exec); + JSObjectInitializeCallback initialize = initRoutines[i]; + initialize(toRef(exec), toRef(this)); + } +} + +template +JSCallbackObject::~JSCallbackObject() +{ + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (JSObjectFinalizeCallback finalize = jsClass->finalize) + finalize(thisRef); +} + +template +UString JSCallbackObject::className() const +{ + UString thisClassName = classRef()->className(); + if (!thisClassName.isEmpty()) + return thisClassName; + + return Base::className(); +} + +template +bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr propertyNameRef; + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + // optional optimization to bypass getProperty in cases when we only need to know if the property exists + if (JSObjectHasPropertyCallback hasProperty = jsClass->hasProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSLock::DropAllLocks dropAllLocks(exec); + if (hasProperty(ctx, thisRef, propertyNameRef.get())) { + slot.setCustom(this, callbackGetter); + return true; + } + } else if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + JSValueRef value; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (value) { + slot.setValue(toJS(exec, value)); + return true; + } + if (exception) { + slot.setValue(jsUndefined()); + return true; + } + } + + if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { + if (staticValues->contains(propertyName.ustring().rep())) { + slot.setCustom(this, staticValueGetter); + return true; + } + } + + if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { + if (staticFunctions->contains(propertyName.ustring().rep())) { + slot.setCustom(this, staticFunctionGetter); + return true; + } + } + } + + return Base::getOwnPropertySlot(exec, propertyName, slot); +} + +template +bool JSCallbackObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) +{ + return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); +} + +template +void JSCallbackObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr propertyNameRef; + JSValueRef valueRef = toRef(exec, value); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + bool result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); + } + exec->setException(toJS(exec, exception)); + if (result || exception) + return; + } + + if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { + if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { + if (entry->attributes & kJSPropertyAttributeReadOnly) + return; + if (JSObjectSetPropertyCallback setProperty = entry->setProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + bool result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception); + } + exec->setException(toJS(exec, exception)); + if (result || exception) + return; + } else + throwError(exec, ReferenceError, "Attempt to set a property that is not settable."); + } + } + + if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { + if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { + if (entry->attributes & kJSPropertyAttributeReadOnly) + return; + JSCallbackObject::putDirect(propertyName, value); // put as override property + return; + } + } + } + + return Base::put(exec, propertyName, value, slot); +} + +template +bool JSCallbackObject::deleteProperty(ExecState* exec, const Identifier& propertyName, bool checkDontDelete) +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + RefPtr propertyNameRef; + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + bool result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (result || exception) + return true; + } + + if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { + if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) { + if (entry->attributes & kJSPropertyAttributeDontDelete) + return false; + return true; + } + } + + if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { + if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { + if (entry->attributes & kJSPropertyAttributeDontDelete) + return false; + return true; + } + } + } + + return Base::deleteProperty(exec, propertyName, checkDontDelete); +} + +template +bool JSCallbackObject::deleteProperty(ExecState* exec, unsigned propertyName, bool checkDontDelete) +{ + return deleteProperty(exec, Identifier::from(exec, propertyName), checkDontDelete); +} + +template +ConstructType JSCallbackObject::getConstructData(ConstructData& constructData) +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (jsClass->callAsConstructor) { + constructData.native.function = construct; + return ConstructTypeHost; + } + } + return ConstructTypeNone; +} + +template +JSObject* JSCallbackObject::construct(ExecState* exec, JSObject* constructor, const ArgList& args) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef constructorRef = toRef(constructor); + + for (JSClassRef jsClass = static_cast*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + JSValueRef exception = 0; + JSObject* result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception)); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + + ASSERT_NOT_REACHED(); // getConstructData should prevent us from reaching here + return 0; +} + +template +bool JSCallbackObject::hasInstance(ExecState* exec, JSValue value, JSValue) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) { + JSValueRef exception = 0; + bool result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = hasInstance(execRef, thisRef, toRef(exec, value), &exception); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + return false; +} + +template +CallType JSCallbackObject::getCallData(CallData& callData) +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) { + if (jsClass->callAsFunction) { + callData.native.function = call; + return CallTypeHost; + } + } + return CallTypeNone; +} + +template +JSValue JSCallbackObject::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) +{ + JSContextRef execRef = toRef(exec); + JSObjectRef functionRef = toRef(functionObject); + JSObjectRef thisObjRef = toRef(thisValue.toThisObject(exec)); + + for (JSClassRef jsClass = static_cast*>(functionObject)->classRef(); jsClass; jsClass = jsClass->parentClass) { + if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) { + int argumentCount = static_cast(args.size()); + Vector arguments(argumentCount); + for (int i = 0; i < argumentCount; i++) + arguments[i] = toRef(exec, args.at(i)); + JSValueRef exception = 0; + JSValue result; + { + JSLock::DropAllLocks dropAllLocks(exec); + result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); + } + exec->setException(toJS(exec, exception)); + return result; + } + } + + ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here + return JSValue(); +} + +template +void JSCallbackObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, unsigned listedAttributes) +{ + 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); + getPropertyNames(execRef, thisRef, toRef(&propertyNames), listedAttributes); + } + + if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) { + typedef OpaqueJSClassStaticValuesTable::const_iterator iterator; + iterator end = staticValues->end(); + for (iterator it = staticValues->begin(); it != end; ++it) { + UString::Rep* name = it->first.get(); + StaticValueEntry* entry = it->second; + if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum)) + propertyNames.add(Identifier(exec, name)); + } + } + + if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { + typedef OpaqueJSClassStaticFunctionsTable::const_iterator iterator; + iterator end = staticFunctions->end(); + for (iterator it = staticFunctions->begin(); it != end; ++it) { + UString::Rep* name = it->first.get(); + StaticFunctionEntry* entry = it->second; + if (!(entry->attributes & kJSPropertyAttributeDontEnum)) + propertyNames.add(Identifier(exec, name)); + } + } + } + + Base::getPropertyNames(exec, propertyNames, listedAttributes); +} + +template +double JSCallbackObject::toNumber(ExecState* exec) const +{ + // We need this check to guard against the case where this object is rhs of + // a binary expression where lhs threw an exception in its conversion to + // primitive + if (exec->hadException()) + return NaN; + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) { + JSValueRef exception = 0; + JSValueRef value; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); + } + exec->setException(toJS(exec, exception)); + if (value) { + double dValue; + return toJS(exec, value).getNumber(dValue) ? dValue : NaN; + } + } + + return Base::toNumber(exec); +} + +template +UString JSCallbackObject::toString(ExecState* exec) const +{ + JSContextRef ctx = toRef(exec); + JSObjectRef thisRef = toRef(this); + + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) { + JSValueRef exception = 0; + JSValueRef value; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = convertToType(ctx, thisRef, kJSTypeString, &exception); + } + exec->setException(toJS(exec, exception)); + if (value) + return toJS(exec, value).getString(); + if (exception) + return ""; + } + + return Base::toString(exec); +} + +template +void JSCallbackObject::setPrivate(void* data) +{ + m_callbackObjectData->privateData = data; +} + +template +void* JSCallbackObject::getPrivate() +{ + return m_callbackObjectData->privateData; +} + +template +bool JSCallbackObject::inherits(JSClassRef c) const +{ + for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) + if (jsClass == c) + return true; + + return false; +} + +template +JSValue JSCallbackObject::staticValueGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); + + JSObjectRef thisRef = toRef(thisObj); + RefPtr propertyNameRef; + + for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) + if (OpaqueJSClassStaticValuesTable* staticValues = jsClass->staticValues(exec)) + if (StaticValueEntry* entry = staticValues->get(propertyName.ustring().rep())) + if (JSObjectGetPropertyCallback getProperty = entry->getProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + JSValueRef value; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + if (value) + return toJS(exec, value); + if (exception) + return jsUndefined(); + } + + return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback."); +} + +template +JSValue JSCallbackObject::staticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); + + // Check for cached or override property. + PropertySlot slot2(thisObj); + if (thisObj->Base::getOwnPropertySlot(exec, propertyName, slot2)) + return slot2.getValue(exec, propertyName); + + for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) { + if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { + if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { + if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { + JSObject* o = new (exec) JSCallbackFunction(exec, callAsFunction, propertyName); + thisObj->putDirect(propertyName, o, entry->attributes); + return o; + } + } + } + } + + return throwError(exec, ReferenceError, "Static function property defined with NULL callAsFunction callback."); +} + +template +JSValue JSCallbackObject::callbackGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot) +{ + JSCallbackObject* thisObj = asCallbackObject(slot.slotBase()); + + JSObjectRef thisRef = toRef(thisObj); + RefPtr propertyNameRef; + + for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) + if (JSObjectGetPropertyCallback getProperty = jsClass->getProperty) { + if (!propertyNameRef) + propertyNameRef = OpaqueJSString::create(propertyName.ustring()); + JSValueRef exception = 0; + JSValueRef value; + { + JSLock::DropAllLocks dropAllLocks(exec); + value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception); + } + exec->setException(toJS(exec, exception)); + 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."); +} + +} // namespace JSC diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp new file mode 100644 index 0000000..afde7ce --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.cpp @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2006, 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. + * + * 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 "JSClassRef.h" + +#include "APICast.h" +#include "JSCallbackObject.h" +#include "JSObjectRef.h" +#include +#include +#include +#include + +using namespace JSC; + +const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass) + : parentClass(definition->parentClass) + , prototypeClass(0) + , initialize(definition->initialize) + , finalize(definition->finalize) + , hasProperty(definition->hasProperty) + , getProperty(definition->getProperty) + , setProperty(definition->setProperty) + , deleteProperty(definition->deleteProperty) + , getPropertyNames(definition->getPropertyNames) + , callAsFunction(definition->callAsFunction) + , callAsConstructor(definition->callAsConstructor) + , hasInstance(definition->hasInstance) + , convertToType(definition->convertToType) + , m_className(UString::Rep::createFromUTF8(definition->className)) + , m_staticValues(0) + , m_staticFunctions(0) +{ + initializeThreading(); + + if (const JSStaticValue* staticValue = definition->staticValues) { + m_staticValues = new OpaqueJSClassStaticValuesTable(); + while (staticValue->name) { + m_staticValues->add(UString::Rep::createFromUTF8(staticValue->name), + new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes)); + ++staticValue; + } + } + + if (const JSStaticFunction* staticFunction = definition->staticFunctions) { + m_staticFunctions = new OpaqueJSClassStaticFunctionsTable(); + while (staticFunction->name) { + m_staticFunctions->add(UString::Rep::createFromUTF8(staticFunction->name), + new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes)); + ++staticFunction; + } + } + + if (protoClass) + prototypeClass = JSClassRetain(protoClass); +} + +OpaqueJSClass::~OpaqueJSClass() +{ + ASSERT(!m_className.rep()->identifierTable()); + + 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()); + delete it->second; + } + delete m_staticValues; + } + + 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()); + delete it->second; + } + delete m_staticFunctions; + } + + if (prototypeClass) + JSClassRelease(prototypeClass); +} + +PassRefPtr OpaqueJSClass::createNoAutomaticPrototype(const JSClassDefinition* definition) +{ + return adoptRef(new OpaqueJSClass(definition, 0)); +} + +static void clearReferenceToPrototype(JSObjectRef prototype) +{ + OpaqueJSClassContextData* jsClassData = static_cast(JSObjectGetPrivate(prototype)); + ASSERT(jsClassData); + jsClassData->cachedPrototype = 0; +} + +PassRefPtr OpaqueJSClass::create(const JSClassDefinition* definition) +{ + 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; + + return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass.get())); + } + + return adoptRef(new OpaqueJSClass(definition, 0)); +} + +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()); + staticValues->add(UString::Rep::createCopying(it->first->data(), it->first->size()), + new StaticValueEntry(it->second->getProperty, it->second->setProperty, it->second->attributes)); + } + + } 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()); + staticFunctions->add(UString::Rep::createCopying(it->first->data(), it->first->size()), + new StaticFunctionEntry(it->second->callAsFunction, it->second->attributes)); + } + + } else + staticFunctions = 0; +} + +OpaqueJSClassContextData::~OpaqueJSClassContextData() +{ + if (staticValues) { + deleteAllValues(*staticValues); + delete staticValues; + } + + if (staticFunctions) { + deleteAllValues(*staticFunctions); + delete staticFunctions; + } +} + +OpaqueJSClassContextData& OpaqueJSClass::contextData(ExecState* exec) +{ + OpaqueJSClassContextData*& contextData = exec->globalData().opaqueJSClassData.add(this, 0).first->second; + if (!contextData) + contextData = new OpaqueJSClassContextData(this); + return *contextData; +} + +UString OpaqueJSClass::className() +{ + // Make a deep copy, so that the caller has no chance to put the original into IdentifierTable. + return UString(m_className.data(), m_className.size()); +} + +OpaqueJSClassStaticValuesTable* OpaqueJSClass::staticValues(JSC::ExecState* exec) +{ + OpaqueJSClassContextData& jsClassData = contextData(exec); + return jsClassData.staticValues; +} + +OpaqueJSClassStaticFunctionsTable* OpaqueJSClass::staticFunctions(JSC::ExecState* exec) +{ + OpaqueJSClassContextData& jsClassData = contextData(exec); + return jsClassData.staticFunctions; +} + +/*! +// Doc here in case we make this public. (Hopefully we won't.) +@function + @abstract Returns the prototype that will be used when constructing an object with a given class. + @param ctx The execution context to use. + @param jsClass A JSClass whose prototype you want to get. + @result The JSObject prototype that was automatically generated for jsClass, or NULL if no prototype was automatically generated. This is the prototype that will be used when constructing an object using jsClass. +*/ +JSObject* OpaqueJSClass::prototype(ExecState* exec) +{ + /* Class (C++) and prototype (JS) inheritance are parallel, so: + * (C++) | (JS) + * ParentClass | ParentClassPrototype + * ^ | ^ + * | | | + * DerivedClass | DerivedClassPrototype + */ + + if (!prototypeClass) + return 0; + + OpaqueJSClassContextData& jsClassData = contextData(exec); + + if (!jsClassData.cachedPrototype) { + // Recursive, but should be good enough for our purposes + jsClassData.cachedPrototype = new (exec) JSCallbackObject(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData); // set jsClassData as the object's private data, so it can clear our reference on destruction + if (parentClass) { + if (JSObject* prototype = parentClass->prototype(exec)) + jsClassData.cachedPrototype->setPrototype(prototype); + } + } + return jsClassData.cachedPrototype; +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h new file mode 100644 index 0000000..c742d96 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSClassRef.h @@ -0,0 +1,122 @@ +/* + * 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. + */ + +#ifndef JSClassRef_h +#define JSClassRef_h + +#include "JSObjectRef.h" + +#include +#include +#include +#include +#include + +struct StaticValueEntry : FastAllocBase { + StaticValueEntry(JSObjectGetPropertyCallback _getProperty, JSObjectSetPropertyCallback _setProperty, JSPropertyAttributes _attributes) + : getProperty(_getProperty), setProperty(_setProperty), attributes(_attributes) + { + } + + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSPropertyAttributes attributes; +}; + +struct StaticFunctionEntry : FastAllocBase { + StaticFunctionEntry(JSObjectCallAsFunctionCallback _callAsFunction, JSPropertyAttributes _attributes) + : callAsFunction(_callAsFunction), attributes(_attributes) + { + } + + JSObjectCallAsFunctionCallback callAsFunction; + JSPropertyAttributes attributes; +}; + +typedef HashMap, StaticValueEntry*> OpaqueJSClassStaticValuesTable; +typedef HashMap, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTable; + +class OpaqueJSClass; + +// An OpaqueJSClass (JSClass) is created without a context, so it can be used with any context, even across context groups. +// This structure holds data members that vary across context groups. +struct OpaqueJSClassContextData : Noncopyable { + OpaqueJSClassContextData(OpaqueJSClass*); + ~OpaqueJSClassContextData(); + + // It is necessary to keep OpaqueJSClass alive because of the following rare scenario: + // 1. A class is created and used, so its context data is stored in JSGlobalData hash map. + // 2. The class is released, and when all JS objects that use it are collected, OpaqueJSClass + // is deleted (that's the part prevented by this RefPtr). + // 3. Another class is created at the same address. + // 4. When it is used, the old context data is found in JSGlobalData and used. + RefPtr m_class; + + OpaqueJSClassStaticValuesTable* staticValues; + OpaqueJSClassStaticFunctionsTable* staticFunctions; + JSC::JSObject* cachedPrototype; +}; + +struct OpaqueJSClass : public ThreadSafeShared { + static PassRefPtr create(const JSClassDefinition*); + static PassRefPtr createNoAutomaticPrototype(const JSClassDefinition*); + ~OpaqueJSClass(); + + JSC::UString className(); + OpaqueJSClassStaticValuesTable* staticValues(JSC::ExecState*); + OpaqueJSClassStaticFunctionsTable* staticFunctions(JSC::ExecState*); + JSC::JSObject* prototype(JSC::ExecState*); + + OpaqueJSClass* parentClass; + OpaqueJSClass* prototypeClass; + + JSObjectInitializeCallback initialize; + JSObjectFinalizeCallback finalize; + JSObjectHasPropertyCallback hasProperty; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSObjectDeletePropertyCallback deleteProperty; + JSObjectGetPropertyNamesCallback getPropertyNames; + JSObjectCallAsFunctionCallback callAsFunction; + JSObjectCallAsConstructorCallback callAsConstructor; + JSObjectHasInstanceCallback hasInstance; + JSObjectConvertToTypeCallback convertToType; + +private: + friend struct OpaqueJSClassContextData; + + OpaqueJSClass(); + OpaqueJSClass(const OpaqueJSClass&); + OpaqueJSClass(const JSClassDefinition*, OpaqueJSClass* protoClass); + + OpaqueJSClassContextData& contextData(JSC::ExecState*); + + // UStrings in these data members should not be put into any IdentifierTable. + JSC::UString m_className; + OpaqueJSClassStaticValuesTable* m_staticValues; + OpaqueJSClassStaticFunctionsTable* m_staticFunctions; +}; + +#endif // JSClassRef_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp new file mode 100644 index 0000000..c358a84 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2006, 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. + * + * 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 "JSContextRef.h" + +#include "APICast.h" +#include "InitializeThreading.h" +#include "JSCallbackObject.h" +#include "JSClassRef.h" +#include "JSGlobalObject.h" +#include "JSObject.h" +#include + +#if PLATFORM(DARWIN) +#include + +static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 +#endif + +using namespace JSC; + +JSContextGroupRef JSContextGroupCreate() +{ + initializeThreading(); + return toRef(JSGlobalData::create().releaseRef()); +} + +JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) +{ + toJS(group)->ref(); + return group; +} + +void JSContextGroupRelease(JSContextGroupRef group) +{ + toJS(group)->deref(); +} + +JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) +{ + initializeThreading(); +#if PLATFORM(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) + if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) { +#else + { +#endif + JSLock lock(LockForReal); + return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); + } +#endif // PLATFORM(DARWIN) + + return JSGlobalContextCreateInGroup(0, globalObjectClass); +} + +JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) +{ + initializeThreading(); + + JSLock lock(LockForReal); + + RefPtr globalData = group ? PassRefPtr(toJS(group)) : JSGlobalData::create(); + +#if ENABLE(JSC_MULTIPLE_THREADS) + globalData->makeUsableFromMultipleThreads(); +#endif + + if (!globalObjectClass) { + JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject; + return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec())); + } + + JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject(globalObjectClass); + ExecState* exec = globalObject->globalExec(); + JSValue prototype = globalObjectClass->prototype(exec); + if (!prototype) + prototype = jsNull(); + globalObject->resetPrototype(prototype); + return JSGlobalContextRetain(toGlobalRef(exec)); +} + +JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx) +{ + ExecState* exec = toJS(ctx); + JSLock lock(exec); + + JSGlobalData& globalData = exec->globalData(); + + globalData.heap.registerThread(); + + gcProtect(exec->dynamicGlobalObject()); + globalData.ref(); + return ctx; +} + +void JSGlobalContextRelease(JSGlobalContextRef ctx) +{ + ExecState* exec = toJS(ctx); + JSLock lock(exec); + + 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.deref(); +} + +JSObjectRef JSContextGetGlobalObject(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + // It is necessary to call toThisObject to get the wrapper object when used with WebCore. + return toRef(exec->lexicalGlobalObject()->toThisObject(exec)); +} + +JSContextGroupRef JSContextGetGroup(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + return toRef(&exec->globalData()); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h new file mode 100644 index 0000000..c5c8a71 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSContextRef.h @@ -0,0 +1,132 @@ +/* + * 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. + */ + +#ifndef JSContextRef_h +#define JSContextRef_h + +#include +#include +#include + +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Creates a JavaScript context group. +@discussion A JSContextGroup associates JavaScript contexts with one another. + Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging + JavaScript objects between contexts in different groups will produce undefined behavior. + When objects from the same context group are used in multiple threads, explicit + synchronization is required. +@result The created JSContextGroup. +*/ +JS_EXPORT JSContextGroupRef JSContextGroupCreate() AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Retains a JavaScript context group. +@param group The JSContextGroup to retain. +@result A JSContextGroup that is the same as group. +*/ +JS_EXPORT JSContextGroupRef JSContextGroupRetain(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Releases a JavaScript context group. +@param group The JSContextGroup to release. +*/ +JS_EXPORT void JSContextGroupRelease(JSContextGroupRef group) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Creates a global JavaScript execution context. +@discussion JSGlobalContextCreate allocates a global object and populates it with all the + built-in JavaScript objects, such as Object, Function, String, and Array. + + In WebKit version 4.0 and later, the context is created in a unique context group. + Therefore, scripts may execute in it concurrently with scripts executing in other contexts. + However, you may not use values created in the context in other contexts. +@param globalObjectClass The class to use when creating the global object. Pass + NULL to use the default object class. +@result A JSGlobalContext with a global object of class globalObjectClass. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; + +/*! +@function +@abstract Creates a global JavaScript execution context in the context group provided. +@discussion JSGlobalContextCreateInGroup allocates a global object and populates it with + all the built-in JavaScript objects, such as Object, Function, String, and Array. +@param globalObjectClass The class to use when creating the global object. Pass + NULL to use the default object class. +@param group The context group to use. The created global context retains the group. + Pass NULL to create a unique group for the context. +@result A JSGlobalContext with a global object of class globalObjectClass and a context + group equal to group. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClassRef globalObjectClass) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Retains a global JavaScript execution context. +@param ctx The JSGlobalContext to retain. +@result A JSGlobalContext that is the same as ctx. +*/ +JS_EXPORT JSGlobalContextRef JSGlobalContextRetain(JSGlobalContextRef ctx); + +/*! +@function +@abstract Releases a global JavaScript execution context. +@param ctx The JSGlobalContext to release. +*/ +JS_EXPORT void JSGlobalContextRelease(JSGlobalContextRef ctx); + +/*! +@function +@abstract Gets the global object of a JavaScript execution context. +@param ctx The JSContext whose global object you want to get. +@result ctx's global object. +*/ +JS_EXPORT JSObjectRef JSContextGetGlobalObject(JSContextRef ctx); + +/*! +@function +@abstract Gets the context group to which a JavaScript execution context belongs. +@param ctx The JSContext whose group you want to get. +@result ctx's group. +*/ +JS_EXPORT JSContextGroupRef JSContextGetGroup(JSContextRef ctx) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +#ifdef __cplusplus +} +#endif + +#endif /* JSContextRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp new file mode 100644 index 0000000..87d36ec --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp @@ -0,0 +1,517 @@ +/* + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) + * + * 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 "JSObjectRef.h" + +#include "APICast.h" +#include "DateConstructor.h" +#include "ErrorConstructor.h" +#include "FunctionConstructor.h" +#include "Identifier.h" +#include "InitializeThreading.h" +#include "JSArray.h" +#include "JSCallbackConstructor.h" +#include "JSCallbackFunction.h" +#include "JSCallbackObject.h" +#include "JSClassRef.h" +#include "JSFunction.h" +#include "JSGlobalObject.h" +#include "JSObject.h" +#include "JSRetainPtr.h" +#include "JSString.h" +#include "JSValueRef.h" +#include "ObjectPrototype.h" +#include "PropertyNameArray.h" +#include "RegExpConstructor.h" +#include + +using namespace JSC; + +JSClassRef JSClassCreate(const JSClassDefinition* definition) +{ + initializeThreading(); + RefPtr jsClass = (definition->attributes & kJSClassAttributeNoAutomaticPrototype) + ? OpaqueJSClass::createNoAutomaticPrototype(definition) + : OpaqueJSClass::create(definition); + + return jsClass.release().releaseRef(); +} + +JSClassRef JSClassRetain(JSClassRef jsClass) +{ + jsClass->ref(); + return jsClass; +} + +void JSClassRelease(JSClassRef jsClass) +{ + jsClass->deref(); +} + +JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + if (!jsClass) + return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient + + JSCallbackObject* object = new (exec) JSCallbackObject(exec, exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); + if (JSObject* prototype = jsClass->prototype(exec)) + object->setPrototype(prototype); + + return toRef(object); +} + +JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); + + return toRef(new (exec) JSCallbackFunction(exec, callAsFunction, nameID)); +} + +JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0; + if (!jsPrototype) + jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); + + JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor); + constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); + return toRef(constructor); +} + +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); + + Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); + + MarkedArgumentBuffer args; + for (unsigned i = 0; i < parameterCount; i++) + args.append(jsString(exec, parameterNames[i]->ustring())); + args.append(jsString(exec, body->ustring())); + + JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + return toRef(result); +} + +JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* result; + if (argumentCount) { + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; ++i) + argList.append(toJS(exec, arguments[i])); + + result = constructArray(exec, argList); + } else + result = constructEmptyArray(exec); + + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + + return toRef(result); +} + +JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; ++i) + argList.append(toJS(exec, arguments[i])); + + JSObject* result = constructDate(exec, argList); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + + return toRef(result); +} + +JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; ++i) + argList.append(toJS(exec, arguments[i])); + + JSObject* result = constructError(exec, argList); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + + return toRef(result); +} + +JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; ++i) + argList.append(toJS(exec, arguments[i])); + + JSObject* result = constructRegExp(exec, argList); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + + return toRef(result); +} + +JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + return toRef(exec, jsObject->prototype()); +} + +void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + JSValue jsValue = toJS(exec, value); + + jsObject->setPrototype(jsValue.isObject() ? jsValue : jsNull()); +} + +bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + + return jsObject->hasProperty(exec, propertyName->identifier(&exec->globalData())); +} + +JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + + JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData())); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } + return toRef(exec, jsValue); +} + +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); + + JSObject* jsObject = toJS(object); + Identifier name(propertyName->identifier(&exec->globalData())); + JSValue jsValue = toJS(exec, value); + + if (attributes && !jsObject->hasProperty(exec, name)) + jsObject->putWithAttributes(exec, name, jsValue, attributes); + else { + PutPropertySlot slot; + jsObject->put(exec, name, jsValue, slot); + } + + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } +} + +JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + + JSValue jsValue = jsObject->get(exec, propertyIndex); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } + return toRef(exec, jsValue); +} + + +void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + JSValue jsValue = toJS(exec, value); + + jsObject->put(exec, propertyIndex, jsValue); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } +} + +bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSObject* jsObject = toJS(object); + + bool result = jsObject->deleteProperty(exec, propertyName->identifier(&exec->globalData())); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } + return result; +} + +void* JSObjectGetPrivate(JSObjectRef object) +{ + JSObject* jsObject = toJS(object); + + if (jsObject->inherits(&JSCallbackObject::info)) + return static_cast*>(jsObject)->getPrivate(); + else if (jsObject->inherits(&JSCallbackObject::info)) + return static_cast*>(jsObject)->getPrivate(); + + return 0; +} + +bool JSObjectSetPrivate(JSObjectRef object, void* data) +{ + JSObject* jsObject = toJS(object); + + if (jsObject->inherits(&JSCallbackObject::info)) { + static_cast*>(jsObject)->setPrivate(data); + return true; + } else if (jsObject->inherits(&JSCallbackObject::info)) { + static_cast*>(jsObject)->setPrivate(data); + return true; + } + + return false; +} + +bool JSObjectIsFunction(JSContextRef, JSObjectRef object) +{ + CallData callData; + return toJS(object)->getCallData(callData) != CallTypeNone; +} + +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); + + JSObject* jsObject = toJS(object); + JSObject* jsThisObject = toJS(thisObject); + + if (!jsThisObject) + jsThisObject = exec->globalThisValue(); + + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; i++) + argList.append(toJS(exec, arguments[i])); + + CallData callData; + CallType callType = jsObject->getCallData(callData); + if (callType == CallTypeNone) + return 0; + + JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList)); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + return result; +} + +bool JSObjectIsConstructor(JSContextRef, JSObjectRef object) +{ + JSObject* jsObject = toJS(object); + ConstructData constructData; + return jsObject->getConstructData(constructData) != ConstructTypeNone; +} + +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); + + JSObject* jsObject = toJS(object); + + ConstructData constructData; + ConstructType constructType = jsObject->getConstructData(constructData); + if (constructType == ConstructTypeNone) + return 0; + + MarkedArgumentBuffer argList; + for (size_t i = 0; i < argumentCount; i++) + argList.append(toJS(exec, arguments[i])); + JSObjectRef result = toRef(construct(exec, jsObject, constructType, constructData, argList)); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + result = 0; + } + return result; +} + +struct OpaqueJSPropertyNameArray : FastAllocBase { + OpaqueJSPropertyNameArray(JSGlobalData* globalData) + : refCount(0) + , globalData(globalData) + { + } + + unsigned refCount; + JSGlobalData* globalData; + Vector > array; +}; + +JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object) +{ + JSObject* jsObject = toJS(object); + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSGlobalData* globalData = &exec->globalData(); + + JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(globalData); + PropertyNameArray array(globalData); + jsObject->getPropertyNames(exec, array); + + size_t size = array.size(); + propertyNames->array.reserveInitialCapacity(size); + for (size_t i = 0; i < size; ++i) + propertyNames->array.append(JSRetainPtr(Adopt, OpaqueJSString::create(array[i].ustring()).releaseRef())); + + return JSPropertyNameArrayRetain(propertyNames); +} + +JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) +{ + ++array->refCount; + return array; +} + +void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) +{ + if (--array->refCount == 0) { + JSLock lock(array->globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + delete array; + } +} + +size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array) +{ + return array->array.size(); +} + +JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index) +{ + return array->array[static_cast(index)].get(); +} + +void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) +{ + PropertyNameArray* propertyNames = toJS(array); + + propertyNames->globalData()->heap.registerThread(); + JSLock lock(propertyNames->globalData()->isSharedInstance ? LockForReal : SilenceAssertionsOnly); + + propertyNames->add(propertyName->identifier(propertyNames->globalData())); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h new file mode 100644 index 0000000..86921bd --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h @@ -0,0 +1,695 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com) + * + * 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 JSObjectRef_h +#define JSObjectRef_h + +#include +#include +#include + +#ifndef __cplusplus +#include +#endif +#include /* for size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@enum JSPropertyAttribute +@constant kJSPropertyAttributeNone Specifies that a property has no special attributes. +@constant kJSPropertyAttributeReadOnly Specifies that a property is read-only. +@constant kJSPropertyAttributeDontEnum Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops. +@constant kJSPropertyAttributeDontDelete Specifies that the delete operation should fail on a property. +*/ +enum { + kJSPropertyAttributeNone = 0, + kJSPropertyAttributeReadOnly = 1 << 1, + kJSPropertyAttributeDontEnum = 1 << 2, + kJSPropertyAttributeDontDelete = 1 << 3 +}; + +/*! +@typedef JSPropertyAttributes +@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSPropertyAttributes; + +/*! +@enum JSClassAttribute +@constant kJSClassAttributeNone Specifies that a class has no special attributes. +@constant kJSClassAttributeNoAutomaticPrototype Specifies that a class should not automatically generate a shared prototype for its instance objects. Use kJSClassAttributeNoAutomaticPrototype in combination with JSObjectSetPrototype to manage prototypes manually. +*/ +enum { + kJSClassAttributeNone = 0, + kJSClassAttributeNoAutomaticPrototype = 1 << 1 +}; + +/*! +@typedef JSClassAttributes +@abstract A set of JSClassAttributes. Combine multiple attributes by logically ORing them together. +*/ +typedef unsigned JSClassAttributes; + +/*! +@typedef JSObjectInitializeCallback +@abstract The callback invoked when an object is first created. +@param ctx The execution context to use. +@param object The JSObject being created. +@discussion If you named your function Initialize, you would declare it like this: + +void Initialize(JSContextRef ctx, JSObjectRef object); + +Unlike the other object callbacks, the initialize callback is called on the least +derived class (the parent class) first, and the most derived class last. +*/ +typedef void +(*JSObjectInitializeCallback) (JSContextRef ctx, JSObjectRef object); + +/*! +@typedef JSObjectFinalizeCallback +@abstract The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. +@param object The JSObject being finalized. +@discussion If you named your function Finalize, you would declare it like this: + +void Finalize(JSObjectRef object); + +The finalize callback is called on the most derived class first, and the least +derived class (the parent class) last. + +You must not call any function that may cause a garbage collection or an allocation +of a garbage collected object from within a JSObjectFinalizeCallback. This includes +all functions that have a JSContextRef parameter. +*/ +typedef void +(*JSObjectFinalizeCallback) (JSObjectRef object); + +/*! +@typedef JSObjectHasPropertyCallback +@abstract The callback invoked when determining whether an object has a property. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property look up. +@result true if object has the property, otherwise false. +@discussion If you named your function HasProperty, you would declare it like this: + +bool HasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +If this function returns false, the hasProperty request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. + +This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive. + +If this callback is NULL, the getProperty callback will be used to service hasProperty requests. +*/ +typedef bool +(*JSObjectHasPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@typedef JSObjectGetPropertyCallback +@abstract The callback invoked when getting a property's value. +@param ctx The execution context to use. +@param object The JSObject to search for the property. +@param propertyName A JSString containing the name of the property to get. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The property's value if object has the property, otherwise NULL. +@discussion If you named your function GetProperty, you would declare it like this: + +JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns NULL, the get request forwards to object's statically declared properties, then its parent class chain (which includes the default object class), then its prototype chain. +*/ +typedef JSValueRef +(*JSObjectGetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectSetPropertyCallback +@abstract The callback invoked when setting a property's value. +@param ctx The execution context to use. +@param object The JSObject on which to set the property's value. +@param propertyName A JSString containing the name of the property to set. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if the property was set, otherwise false. +@discussion If you named your function SetProperty, you would declare it like this: + +bool SetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +If this function returns false, the set request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectSetPropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + +/*! +@typedef JSObjectDeletePropertyCallback +@abstract The callback invoked when deleting a property. +@param ctx The execution context to use. +@param object The JSObject in which to delete the property. +@param propertyName A JSString containing the name of the property to delete. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if propertyName was successfully deleted, otherwise false. +@discussion If you named your function DeleteProperty, you would declare it like this: + +bool DeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +If this function returns false, the delete request forwards to object's statically declared properties, then its parent class chain (which includes the default object class). +*/ +typedef bool +(*JSObjectDeletePropertyCallback) (JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@typedef JSObjectGetPropertyNamesCallback +@abstract The callback invoked when collecting the names of an object's properties. +@param ctx The execution context to use. +@param object The JSObject whose property names are being collected. +@param accumulator A JavaScript property name accumulator in which to accumulate the names of object's properties. +@param flag Specify which property should be included +@discussion If you named your function GetPropertyNames, you would declare it like this: + +void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); + +Property name accumulators are used by JSObjectCopyPropertyNames and JavaScript for...in loops. + +Use JSPropertyNameAccumulatorAddName to add property names to accumulator. A class's getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. Other properties, including statically declared properties, properties vended by other classes, and properties belonging to object's prototype, are added independently. +*/ +typedef void +(*JSObjectGetPropertyNamesCallback) (JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames, unsigned flag); + +/*! +@typedef JSObjectCallAsFunctionCallback +@abstract The callback invoked when an object is called as a function. +@param ctx The execution context to use. +@param function A JSObject that is the function being called. +@param thisObject A JSObject that is the 'this' variable in the function's scope. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSValue that is the function's return value. +@discussion If you named your function CallAsFunction, you would declare it like this: + +JSValueRef CallAsFunction(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'myObject.myFunction()', function would be set to myFunction, and thisObject would be set to myObject. + +If this callback is NULL, calling your object as a function will throw an exception. +*/ +typedef JSValueRef +(*JSObjectCallAsFunctionCallback) (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectCallAsConstructorCallback +@abstract The callback invoked when an object is used as a constructor in a 'new' expression. +@param ctx The execution context to use. +@param constructor A JSObject that is the constructor being called. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of the arguments passed to the function. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result A JSObject that is the constructor's return value. +@discussion If you named your function CallAsConstructor, you would declare it like this: + +JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor. + +If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. +*/ +typedef JSObjectRef +(*JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@typedef JSObjectHasInstanceCallback +@abstract hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@param ctx The execution context to use. +@param constructor The JSObject that is the target of the 'instanceof' expression. +@param possibleInstance The JSValue being tested to determine if it is an instance of constructor. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result true if possibleInstance is an instance of constructor, otherwise false. +@discussion If you named your function HasInstance, you would declare it like this: + +bool HasInstance(JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +If your callback were invoked by the JavaScript expression 'someValue instanceof myObject', constructor would be set to myObject and possibleInstance would be set to someValue. + +If this callback is NULL, 'instanceof' expressions that target your object will return false. + +Standard JavaScript practice calls for objects that implement the callAsConstructor callback to implement the hasInstance callback as well. +*/ +typedef bool +(*JSObjectHasInstanceCallback) (JSContextRef ctx, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); + +/*! +@typedef JSObjectConvertToTypeCallback +@abstract The callback invoked when converting an object to a particular JavaScript type. +@param ctx The execution context to use. +@param object The JSObject to convert. +@param type A JSType specifying the JavaScript type to convert to. +@param exception A pointer to a JSValueRef in which to return an exception, if any. +@result The objects's converted value, or NULL if the object was not converted. +@discussion If you named your function ConvertToType, you would declare it like this: + +JSValueRef ConvertToType(JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class). + +This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself. +*/ +typedef JSValueRef +(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); + +/*! +@struct JSStaticValue +@abstract This structure describes a statically declared value property. +@field name A null-terminated UTF8 string containing the property's name. +@field getProperty A JSObjectGetPropertyCallback to invoke when getting the property's value. +@field setProperty A JSObjectSetPropertyCallback to invoke when setting the property's value. May be NULL if the ReadOnly attribute is set. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSPropertyAttributes attributes; +} JSStaticValue; + +/*! +@struct JSStaticFunction +@abstract This structure describes a statically declared function property. +@field name A null-terminated UTF8 string containing the property's name. +@field callAsFunction A JSObjectCallAsFunctionCallback to invoke when the property is called as a function. +@field attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +typedef struct { + const char* const name; + JSObjectCallAsFunctionCallback callAsFunction; + JSPropertyAttributes attributes; +} JSStaticFunction; + +/*! +@struct JSClassDefinition +@abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. +@field version The version number of this structure. The current version is 0. +@field attributes A logically ORed set of JSClassAttributes to give to the class. +@field className A null-terminated UTF8 string containing the class's name. +@field parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class. +@field staticValues A JSStaticValue array containing the class's statically declared value properties. Pass NULL to specify no statically declared value properties. The array must be terminated by a JSStaticValue whose name field is NULL. +@field staticFunctions A JSStaticFunction array containing the class's statically declared function properties. Pass NULL to specify no statically declared function properties. The array must be terminated by a JSStaticFunction whose name field is NULL. +@field initialize The callback invoked when an object is first created. Use this callback to initialize the object. +@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for the object, and perform other cleanup. +@field hasProperty The callback invoked when determining whether an object has a property. If this field is NULL, getProperty is called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value is expensive. +@field getProperty The callback invoked when getting a property's value. +@field setProperty The callback invoked when setting a property's value. +@field deleteProperty The callback invoked when deleting a property. +@field getPropertyNames The callback invoked when collecting the names of an object's properties. +@field callAsFunction The callback invoked when an object is called as a function. +@field hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. +@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' expression. +@field convertToType The callback invoked when converting an object to a particular JavaScript type. +@discussion The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time. + +If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this: + +JSStaticValue StaticValueArray[] = { + { "X", GetX, SetX, kJSPropertyAttributeNone }, + { 0, 0, 0, 0 } +}; + +Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects. + +A NULL callback specifies that the default object callback should substitute, except in the case of hasProperty, where it specifies that getProperty should substitute. +*/ +typedef struct { + int version; /* current (and only) version is 0 */ + JSClassAttributes attributes; + + const char* className; + JSClassRef parentClass; + + const JSStaticValue* staticValues; + const JSStaticFunction* staticFunctions; + + JSObjectInitializeCallback initialize; + JSObjectFinalizeCallback finalize; + JSObjectHasPropertyCallback hasProperty; + JSObjectGetPropertyCallback getProperty; + JSObjectSetPropertyCallback setProperty; + JSObjectDeletePropertyCallback deleteProperty; + JSObjectGetPropertyNamesCallback getPropertyNames; + JSObjectCallAsFunctionCallback callAsFunction; + JSObjectCallAsConstructorCallback callAsConstructor; + JSObjectHasInstanceCallback hasInstance; + JSObjectConvertToTypeCallback convertToType; +} JSClassDefinition; + +/*! +@const kJSClassDefinitionEmpty +@abstract A JSClassDefinition structure of the current version, filled with NULL pointers and having no attributes. +@discussion Use this constant as a convenience when creating class definitions. For example, to create a class definition with only a finalize method: + +JSClassDefinition definition = kJSClassDefinitionEmpty; +definition.finalize = Finalize; +*/ +JS_EXPORT extern const JSClassDefinition kJSClassDefinitionEmpty; + +/*! +@function +@abstract Creates a JavaScript class suitable for use with JSObjectMake. +@param definition A JSClassDefinition that defines the class. +@result A JSClass with the given definition. Ownership follows the Create Rule. +*/ +JS_EXPORT JSClassRef JSClassCreate(const JSClassDefinition* definition); + +/*! +@function +@abstract Retains a JavaScript class. +@param jsClass The JSClass to retain. +@result A JSClass that is the same as jsClass. +*/ +JS_EXPORT JSClassRef JSClassRetain(JSClassRef jsClass); + +/*! +@function +@abstract Releases a JavaScript class. +@param jsClass The JSClass to release. +*/ +JS_EXPORT void JSClassRelease(JSClassRef jsClass); + +/*! +@function +@abstract Creates a JavaScript object. +@param ctx The execution context to use. +@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class. +@param data A void* to set as the object's private data. Pass NULL to specify no private data. +@result A JSObject with the given class and private data. +@discussion The default object class does not allocate storage for private data, so you must provide a non-NULL jsClass to JSObjectMake if you want your object to be able to store private data. + +data is set on the created object before the intialize methods in its class chain are called. This enables the initialize methods to retrieve and manipulate data through JSObjectGetPrivate. +*/ +JS_EXPORT JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data); + +/*! +@function +@abstract Convenience method for creating a JavaScript function with a given callback as its implementation. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param callAsFunction The JSObjectCallAsFunctionCallback to invoke when the function is called. +@result A JSObject that is a function. The object's prototype will be the default function prototype. +*/ +JS_EXPORT JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction); + +/*! +@function +@abstract Convenience method for creating a JavaScript constructor. +@param ctx The execution context to use. +@param jsClass A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class. +@param callAsConstructor A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor. +@result A JSObject that is a constructor. The object's prototype will be the default object prototype. +@discussion The default object constructor takes no arguments and constructs an object of class jsClass with no private data. +*/ +JS_EXPORT JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor); + +/*! + @function + @abstract Creates a JavaScript Array object. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of data to populate the Array with. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is an Array. + @discussion The behavior of this function does not exactly match the behavior of the built-in Array constructor. Specifically, if one argument + is supplied, this function returns an array with one element. + */ +JS_EXPORT JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript Date object, as if by invoking the built-in Date constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the Date Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a Date. + */ +JS_EXPORT JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript Error object, as if by invoking the built-in Error constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the Error Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a Error. + */ +JS_EXPORT JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! + @function + @abstract Creates a JavaScript RegExp object, as if by invoking the built-in RegExp constructor. + @param ctx The execution context to use. + @param argumentCount An integer count of the number of arguments in arguments. + @param arguments A JSValue array of arguments to pass to the RegExp Constructor. Pass NULL if argumentCount is 0. + @param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. + @result A JSObject that is a RegExp. + */ +JS_EXPORT JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) AVAILABLE_IN_WEBKIT_VERSION_4_0; + +/*! +@function +@abstract Creates a function with a given script as its body. +@param ctx The execution context to use. +@param name A JSString containing the function's name. This will be used when converting the function to string. Pass NULL to create an anonymous function. +@param parameterCount An integer count of the number of parameter names in parameterNames. +@param parameterNames A JSString array containing the names of the function's parameters. Pass NULL if parameterCount is 0. +@param body A JSString containing the script to use as the function's body. +@param sourceURL A JSString containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. +@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. +@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. +@result A JSObject that is a function, or NULL if either body or parameterNames contains a syntax error. The object's prototype will be the default function prototype. +@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution. +*/ +JS_EXPORT JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's prototype. +@param ctx The execution context to use. +@param object A JSObject whose prototype you want to get. +@result A JSValue that is the object's prototype. +*/ +JS_EXPORT JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Sets an object's prototype. +@param ctx The execution context to use. +@param object The JSObject whose prototype you want to set. +@param value A JSValue to set as the object's prototype. +*/ +JS_EXPORT void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value); + +/*! +@function +@abstract Tests whether an object has a given property. +@param object The JSObject to test. +@param propertyName A JSString containing the property's name. +@result true if the object has a property whose name matches propertyName, otherwise false. +*/ +JS_EXPORT bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName); + +/*! +@function +@abstract Gets a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +*/ +JS_EXPORT JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyName A JSString containing the property's name. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@param attributes A logically ORed set of JSPropertyAttributes to give to the property. +*/ +JS_EXPORT void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception); + +/*! +@function +@abstract Deletes a property from an object. +@param ctx The execution context to use. +@param object The JSObject whose property you want to delete. +@param propertyName A JSString containing the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set). +*/ +JS_EXPORT bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); + +/*! +@function +@abstract Gets a property from an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to get. +@param propertyIndex An integer value that is the property's name. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The property's value if object has the property, otherwise the undefined value. +@discussion Calling JSObjectGetPropertyAtIndex is equivalent to calling JSObjectGetProperty with a string containing propertyIndex, but JSObjectGetPropertyAtIndex provides optimized access to numeric properties. +*/ +JS_EXPORT JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception); + +/*! +@function +@abstract Sets a property on an object by numeric index. +@param ctx The execution context to use. +@param object The JSObject whose property you want to set. +@param propertyIndex The property's name as a number. +@param value A JSValue to use as the property's value. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@discussion Calling JSObjectSetPropertyAtIndex is equivalent to calling JSObjectSetProperty with a string containing propertyIndex, but JSObjectSetPropertyAtIndex provides optimized access to numeric properties. +*/ +JS_EXPORT void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Gets an object's private data. +@param object A JSObject whose private data you want to get. +@result A void* that is the object's private data, if the object has private data, otherwise NULL. +*/ +JS_EXPORT void* JSObjectGetPrivate(JSObjectRef object); + +/*! +@function +@abstract Sets a pointer to private data on an object. +@param object The JSObject whose private data you want to set. +@param data A void* to set as the object's private data. +@result true if object can store private data, otherwise false. +@discussion The default object class does not allocate storage for private data. Only objects created with a non-NULL JSClass can store private data. +*/ +JS_EXPORT bool JSObjectSetPrivate(JSObjectRef object, void* data); + +/*! +@function +@abstract Tests whether an object can be called as a function. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a function, otherwise false. +*/ +JS_EXPORT bool JSObjectIsFunction(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a function. +@param ctx The execution context to use. +@param object The JSObject to call as a function. +@param thisObject The object to use as "this," or NULL to use the global object as "this." +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the function. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSValue that results from calling object as a function, or NULL if an exception is thrown or object is not a function. +*/ +JS_EXPORT JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Tests whether an object can be called as a constructor. +@param ctx The execution context to use. +@param object The JSObject to test. +@result true if the object can be called as a constructor, otherwise false. +*/ +JS_EXPORT bool JSObjectIsConstructor(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Calls an object as a constructor. +@param ctx The execution context to use. +@param object The JSObject to call as a constructor. +@param argumentCount An integer count of the number of arguments in arguments. +@param arguments A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor. +*/ +JS_EXPORT JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); + +/*! +@function +@abstract Gets the names of an object's enumerable properties. +@param ctx The execution context to use. +@param object The object whose property names you want to get. +@result A JSPropertyNameArray containing the names object's enumerable properties. Ownership follows the Create Rule. +*/ +JS_EXPORT JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef object); + +/*! +@function +@abstract Retains a JavaScript property name array. +@param array The JSPropertyNameArray to retain. +@result A JSPropertyNameArray that is the same as array. +*/ +JS_EXPORT JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Releases a JavaScript property name array. +@param array The JSPropetyNameArray to release. +*/ +JS_EXPORT void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a count of the number of items in a JavaScript property name array. +@param array The array from which to retrieve the count. +@result An integer count of the number of names in array. +*/ +JS_EXPORT size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array); + +/*! +@function +@abstract Gets a property name at a given index in a JavaScript property name array. +@param array The array from which to retrieve the property name. +@param index The index of the property name to retrieve. +@result A JSStringRef containing the property name. +*/ +JS_EXPORT JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index); + +/*! +@function +@abstract Adds a property name to a JavaScript property name accumulator. +@param accumulator The accumulator object to which to add the property name. +@param propertyName The property name to add. +*/ +JS_EXPORT void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef accumulator, JSStringRef propertyName); + +#ifdef __cplusplus +} +#endif + +#endif /* JSObjectRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp new file mode 100644 index 0000000..ea277f0 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.cpp @@ -0,0 +1,46 @@ +/* + * 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 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 "JSProfilerPrivate.h" + +#include "APICast.h" +#include "OpaqueJSString.h" +#include "Profiler.h" + +using namespace JSC; + +void JSStartProfiling(JSContextRef ctx, JSStringRef title) +{ + Profiler::profiler()->startProfiling(toJS(ctx), title->ustring()); +} + +void JSEndProfiling(JSContextRef ctx, JSStringRef title) +{ + ExecState* exec = toJS(ctx); + Profiler* profiler = Profiler::profiler(); + profiler->stopProfiling(exec, title->ustring()); +} + diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h new file mode 100644 index 0000000..b3fe533 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSProfilerPrivate.h @@ -0,0 +1,63 @@ +/* + * 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 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 JSProfiler_h +#define JSProfiler_h + +#include + +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function JSStartProfiling +@abstract Enables the profler. +@param ctx The execution context to use. +@param title The title of the profile. +@result The profiler is turned on. +*/ +JS_EXPORT void JSStartProfiling(JSContextRef ctx, JSStringRef title); + +/*! +@function JSEndProfiling +@abstract Disables the profler. +@param ctx The execution context to use. +@param title The title of the profile. +@result The profiler is turned off. If there is no name, the most recently started + profile is stopped. If the name does not match any profile then no profile + is stopped. +*/ +JS_EXPORT void JSEndProfiling(JSContextRef ctx, JSStringRef title); + +#ifdef __cplusplus +} +#endif + +#endif /* JSProfiler_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h new file mode 100644 index 0000000..69c6de1 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSRetainPtr.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2005, 2006, 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 JSRetainPtr_h +#define JSRetainPtr_h + +#include +#include + +inline void JSRetain(JSStringRef string) { JSStringRetain(string); } +inline void JSRelease(JSStringRef string) { JSStringRelease(string); } + +enum AdoptTag { Adopt }; + +template class JSRetainPtr { +public: + JSRetainPtr() : m_ptr(0) {} + JSRetainPtr(T ptr) : m_ptr(ptr) { if (ptr) JSRetain(ptr); } + + JSRetainPtr(AdoptTag, T ptr) : m_ptr(ptr) { } + + JSRetainPtr(const JSRetainPtr& o) : m_ptr(o.m_ptr) { if (T ptr = m_ptr) JSRetain(ptr); } + + ~JSRetainPtr() { if (T ptr = m_ptr) JSRelease(ptr); } + + template JSRetainPtr(const JSRetainPtr& o) : m_ptr(o.get()) { if (T ptr = m_ptr) JSRetain(ptr); } + + T get() const { return m_ptr; } + + T releaseRef() { T tmp = m_ptr; m_ptr = 0; return tmp; } + + T operator->() const { 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 JSRetainPtr::*UnspecifiedBoolType; + operator UnspecifiedBoolType() const { return m_ptr ? &JSRetainPtr::m_ptr : 0; } + + JSRetainPtr& operator=(const JSRetainPtr&); + template JSRetainPtr& operator=(const JSRetainPtr&); + JSRetainPtr& operator=(T); + template JSRetainPtr& operator=(U*); + + void adopt(T); + + void swap(JSRetainPtr&); + +private: + T m_ptr; +}; + +template inline JSRetainPtr& JSRetainPtr::operator=(const JSRetainPtr& o) +{ + T optr = o.get(); + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template template inline JSRetainPtr& JSRetainPtr::operator=(const JSRetainPtr& o) +{ + T optr = o.get(); + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline JSRetainPtr& JSRetainPtr::operator=(T optr) +{ + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline void JSRetainPtr::adopt(T optr) +{ + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); +} + +template template inline JSRetainPtr& JSRetainPtr::operator=(U* optr) +{ + if (optr) + JSRetain(optr); + T ptr = m_ptr; + m_ptr = optr; + if (ptr) + JSRelease(ptr); + return *this; +} + +template inline void JSRetainPtr::swap(JSRetainPtr& o) +{ + std::swap(m_ptr, o.m_ptr); +} + +template inline void swap(JSRetainPtr& a, JSRetainPtr& b) +{ + a.swap(b); +} + +template inline bool operator==(const JSRetainPtr& a, const JSRetainPtr& b) +{ + return a.get() == b.get(); +} + +template inline bool operator==(const JSRetainPtr& a, U* b) +{ + return a.get() == b; +} + +template inline bool operator==(T* a, const JSRetainPtr& b) +{ + return a == b.get(); +} + +template inline bool operator!=(const JSRetainPtr& a, const JSRetainPtr& b) +{ + return a.get() != b.get(); +} + +template inline bool operator!=(const JSRetainPtr& a, U* b) +{ + return a.get() != b; +} + +template inline bool operator!=(T* a, const JSRetainPtr& b) +{ + return a != b.get(); +} + + +#endif // JSRetainPtr_h diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp new file mode 100644 index 0000000..8e236e4 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2006, 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. + * + * 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 "JSStringRef.h" + +#include "InitializeThreading.h" +#include "OpaqueJSString.h" +#include + +using namespace JSC; +using namespace WTF::Unicode; + +JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars) +{ + initializeThreading(); + return OpaqueJSString::create(chars, numChars).releaseRef(); +} + +JSStringRef JSStringCreateWithUTF8CString(const char* string) +{ + initializeThreading(); + if (string) { + size_t length = strlen(string); + Vector buffer(length); + UChar* p = buffer.data(); + if (conversionOK == convertUTF8ToUTF16(&string, string + length, &p, p + length)) + return OpaqueJSString::create(buffer.data(), p - buffer.data()).releaseRef(); + } + + // Null string. + return OpaqueJSString::create().releaseRef(); +} + +JSStringRef JSStringRetain(JSStringRef string) +{ + string->ref(); + return string; +} + +void JSStringRelease(JSStringRef string) +{ + string->deref(); +} + +size_t JSStringGetLength(JSStringRef string) +{ + return string->length(); +} + +const JSChar* JSStringGetCharactersPtr(JSStringRef string) +{ + return string->characters(); +} + +size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string) +{ + // Any UTF8 character > 3 bytes encodes as a UTF16 surrogate pair. + return string->length() * 3 + 1; // + 1 for terminating '\0' +} + +size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize) +{ + if (!bufferSize) + return 0; + + char* p = buffer; + const UChar* d = string->characters(); + ConversionResult result = convertUTF16ToUTF8(&d, d + string->length(), &p, p + bufferSize - 1, true); + *p++ = '\0'; + if (result != conversionOK && result != targetExhausted) + return 0; + + return p - buffer; +} + +bool JSStringIsEqual(JSStringRef a, JSStringRef b) +{ + unsigned len = a->length(); + return len == b->length() && 0 == memcmp(a->characters(), b->characters(), len * sizeof(UChar)); +} + +bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b) +{ + JSStringRef bBuf = JSStringCreateWithUTF8CString(b); + bool result = JSStringIsEqual(a, bBuf); + JSStringRelease(bBuf); + + return result; +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h new file mode 100644 index 0000000..8b17ee2 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRef.h @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#ifndef JSStringRef_h +#define JSStringRef_h + +#include + +#ifndef __cplusplus +#include +#endif +#include /* for size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(WIN32) && !defined(_WIN32) +/*! +@typedef JSChar +@abstract A Unicode character. +*/ + typedef unsigned short JSChar; +#else + typedef wchar_t JSChar; +#endif + +/*! +@function +@abstract Creates a JavaScript string from a buffer of Unicode characters. +@param chars The buffer of Unicode characters to copy into the new JSString. +@param numChars The number of characters to copy from the buffer pointed to by chars. +@result A JSString containing chars. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars); +/*! +@function +@abstract Creates a JavaScript string from a null-terminated UTF8 string. +@param string The null-terminated UTF8 string to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithUTF8CString(const char* string); + +/*! +@function +@abstract Retains a JavaScript string. +@param string The JSString to retain. +@result A JSString that is the same as string. +*/ +JS_EXPORT JSStringRef JSStringRetain(JSStringRef string); +/*! +@function +@abstract Releases a JavaScript string. +@param string The JSString to release. +*/ +JS_EXPORT void JSStringRelease(JSStringRef string); + +/*! +@function +@abstract Returns the number of Unicode characters in a JavaScript string. +@param string The JSString whose length (in Unicode characters) you want to know. +@result The number of Unicode characters stored in string. +*/ +JS_EXPORT size_t JSStringGetLength(JSStringRef string); +/*! +@function +@abstract Returns a pointer to the Unicode character buffer that + serves as the backing store for a JavaScript string. +@param string The JSString whose backing store you want to access. +@result A pointer to the Unicode character buffer that serves as string's + backing store, which will be deallocated when string is deallocated. +*/ +JS_EXPORT const JSChar* JSStringGetCharactersPtr(JSStringRef string); + +/*! +@function +@abstract Returns the maximum number of bytes a JavaScript string will + take up if converted into a null-terminated UTF8 string. +@param string The JSString whose maximum converted size (in bytes) you + want to know. +@result The maximum number of bytes that could be required to convert string into a + null-terminated UTF8 string. The number of bytes that the conversion actually ends + up requiring could be less than this, but never more. +*/ +JS_EXPORT size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string); +/*! +@function +@abstract Converts a JavaScript string into a null-terminated UTF8 string, + and copies the result into an external byte buffer. +@param string The source JSString. +@param buffer The destination byte buffer into which to copy a null-terminated + UTF8 representation of string. On return, buffer contains a UTF8 string + representation of string. If bufferSize is too small, buffer will contain only + partial results. If buffer is not at least bufferSize bytes in size, + behavior is undefined. +@param bufferSize The size of the external buffer in bytes. +@result The number of bytes written into buffer (including the null-terminator byte). +*/ +JS_EXPORT size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize); + +/*! +@function +@abstract Tests whether two JavaScript strings match. +@param a The first JSString to test. +@param b The second JSString to test. +@result true if the two strings match, otherwise false. +*/ +JS_EXPORT bool JSStringIsEqual(JSStringRef a, JSStringRef b); +/*! +@function +@abstract Tests whether a JavaScript string matches a null-terminated UTF8 string. +@param a The JSString to test. +@param b The null-terminated UTF8 string to test. +@result true if the two strings match, otherwise false. +*/ +JS_EXPORT bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b); + +#ifdef __cplusplus +} +#endif + +#endif /* JSStringRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp new file mode 100644 index 0000000..a7d3e99 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.cpp @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#include "config.h" +#include "JSStringRefBSTR.h" + +#include "JSStringRef.h" + +JSStringRef JSStringCreateWithBSTR(BSTR string) +{ + return JSStringCreateWithCharacters(string ? string : L"", string ? SysStringLen(string) : 0); +} + +BSTR JSStringCopyBSTR(const JSStringRef string) +{ + return SysAllocStringLen(JSStringGetCharactersPtr(string), JSStringGetLength(string)); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h new file mode 100644 index 0000000..59f19b7 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefBSTR.h @@ -0,0 +1,62 @@ +/* + * 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 JSStringRefBSTR_h +#define JSStringRefBSTR_h + +#include "JSBase.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* COM convenience methods */ + +/*! +@function +@abstract Creates a JavaScript string from a BSTR. +@param string The BSTR to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithBSTR(const BSTR string); + +/*! +@function +@abstract Creates a BSTR from a JavaScript string. +@param string The JSString to copy into the new BSTR. +@result A BSTR containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT BSTR JSStringCopyBSTR(const JSStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* JSStringRefBSTR_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp new file mode 100644 index 0000000..d1f6fe3 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2006, 2007 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 "JSStringRefCF.h" + +#include "APICast.h" +#include "InitializeThreading.h" +#include "JSStringRef.h" +#include "OpaqueJSString.h" +#include +#include +#include + +JSStringRef JSStringCreateWithCFString(CFStringRef string) +{ + JSC::initializeThreading(); + + // We cannot use CFIndex here since CFStringGetLength can return values larger than + // it can hold. () + size_t length = CFStringGetLength(string); + if (length) { + OwnArrayPtr buffer(new UniChar[length]); + CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get()); + COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size); + return OpaqueJSString::create(reinterpret_cast(buffer.get()), length).releaseRef(); + } else { + return OpaqueJSString::create(0, 0).releaseRef(); + } +} + +CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string) +{ + return CFStringCreateWithCharacters(alloc, reinterpret_cast(string->characters()), string->length()); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h new file mode 100644 index 0000000..a424765 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSStringRefCF.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2006, 2007 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 JSStringRefCF_h +#define JSStringRefCF_h + +#include "JSBase.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* CFString convenience methods */ + +/*! +@function +@abstract Creates a JavaScript string from a CFString. +@discussion This function is optimized to take advantage of cases when + CFStringGetCharactersPtr returns a valid pointer. +@param string The CFString to copy into the new JSString. +@result A JSString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSStringCreateWithCFString(CFStringRef string); +/*! +@function +@abstract Creates a CFString from a JavaScript string. +@param alloc The alloc parameter to pass to CFStringCreate. +@param string The JSString to copy into the new CFString. +@result A CFString containing string. Ownership follows the Create Rule. +*/ +JS_EXPORT CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string); + +#ifdef __cplusplus +} +#endif + +#endif /* JSStringRefCF_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp new file mode 100644 index 0000000..2207181 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2006, 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. + * + * 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 "JSValueRef.h" + +#include +#include "APICast.h" +#include "JSCallbackObject.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include // for std::min + +JSType JSValueGetType(JSContextRef ctx, JSValueRef value) +{ + JSC::ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSC::JSLock lock(exec); + + JSC::JSValue jsValue = toJS(exec, value); + + if (jsValue.isUndefined()) + return kJSTypeUndefined; + if (jsValue.isNull()) + return kJSTypeNull; + if (jsValue.isBoolean()) + return kJSTypeBoolean; + if (jsValue.isNumber()) + return kJSTypeNumber; + if (jsValue.isString()) + return kJSTypeString; + ASSERT(jsValue.isObject()); + 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); + + JSValue jsValue = toJS(exec, value); + return jsValue.isUndefined(); +} + +bool JSValueIsNull(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isNull(); +} + +bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isBoolean(); +} + +bool JSValueIsNumber(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isNumber(); +} + +bool JSValueIsString(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isString(); +} + +bool JSValueIsObject(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.isObject(); +} + +bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + if (JSObject* o = jsValue.getObject()) { + if (o->inherits(&JSCallbackObject::info)) + return static_cast*>(o)->inherits(jsClass); + else if (o->inherits(&JSCallbackObject::info)) + return static_cast*>(o)->inherits(jsClass); + } + return false; +} + +bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsA = toJS(exec, a); + JSValue jsB = toJS(exec, b); + + bool result = JSValue::equal(exec, jsA, jsB); // false if an exception is thrown + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } + return result; +} + +bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsA = toJS(exec, a); + JSValue jsB = toJS(exec, b); + + return JSValue::strictEqual(jsA, jsB); +} + +bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + JSObject* jsConstructor = toJS(constructor); + if (!jsConstructor->structure()->typeInfo().implementsHasInstance()) + return false; + bool result = jsConstructor->hasInstance(exec, jsValue, jsConstructor->get(exec, exec->propertyNames().prototype)); // false if an exception is thrown + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + } + return result; +} + +JSValueRef JSValueMakeUndefined(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsUndefined()); +} + +JSValueRef JSValueMakeNull(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsNull()); +} + +JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsBoolean(value)); +} + +JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsNumber(exec, value)); +} + +JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toRef(exec, jsString(exec, string->ustring())); +} + +bool JSValueToBoolean(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + return jsValue.toBoolean(exec); +} + +double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + double number = jsValue.toNumber(exec); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + number = NaN; + } + return number; +} + +JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + RefPtr stringRef(OpaqueJSString::create(jsValue.toString(exec))); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + stringRef.clear(); + } + return stringRef.release().releaseRef(); +} + +JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + + JSObjectRef objectRef = toRef(jsValue.toObject(exec)); + if (exec->hadException()) { + if (exception) + *exception = toRef(exec, exec->exception()); + exec->clearException(); + objectRef = 0; + } + return objectRef; +} + +void JSValueProtect(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + gcProtect(jsValue); +} + +void JSValueUnprotect(JSContextRef ctx, JSValueRef value) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + JSValue jsValue = toJS(exec, value); + gcUnprotect(jsValue); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h new file mode 100644 index 0000000..7a7bf93 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h @@ -0,0 +1,278 @@ +/* + * 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. + */ + +#ifndef JSValueRef_h +#define JSValueRef_h + +#include + +#ifndef __cplusplus +#include +#endif + +/*! +@enum JSType +@abstract A constant identifying the type of a JSValue. +@constant kJSTypeUndefined The unique undefined value. +@constant kJSTypeNull The unique null value. +@constant kJSTypeBoolean A primitive boolean value, one of true or false. +@constant kJSTypeNumber A primitive number value. +@constant kJSTypeString A primitive string value. +@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef). +*/ +typedef enum { + kJSTypeUndefined, + kJSTypeNull, + kJSTypeBoolean, + kJSTypeNumber, + kJSTypeString, + kJSTypeObject +} JSType; + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Returns a JavaScript value's type. +@param ctx The execution context to use. +@param value The JSValue whose type you want to obtain. +@result A value of type JSType that identifies value's type. +*/ +JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the undefined type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the undefined type, otherwise false. +*/ +JS_EXPORT bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the null type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the null type, otherwise false. +*/ +JS_EXPORT bool JSValueIsNull(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the boolean type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the boolean type, otherwise false. +*/ +JS_EXPORT bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the number type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the number type, otherwise false. +*/ +JS_EXPORT bool JSValueIsNumber(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the string type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the string type, otherwise false. +*/ +JS_EXPORT bool JSValueIsString(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value's type is the object type. +@param ctx The execution context to use. +@param value The JSValue to test. +@result true if value's type is the object type, otherwise false. +*/ +JS_EXPORT bool JSValueIsObject(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Tests whether a JavaScript value is an object with a given class in its class chain. +@param ctx The execution context to use. +@param value The JSValue to test. +@param jsClass The JSClass to test against. +@result true if value is an object and has jsClass in its class chain, otherwise false. +*/ +JS_EXPORT bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass); + +/* Comparing values */ + +/*! +@function +@abstract Tests whether two JavaScript values are equal, as compared by the JS == operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if the two values are equal, false if they are not equal or an exception is thrown. +*/ +JS_EXPORT bool JSValueIsEqual(JSContextRef ctx, JSValueRef a, JSValueRef b, JSValueRef* exception); + +/*! +@function +@abstract Tests whether two JavaScript values are strict equal, as compared by the JS === operator. +@param ctx The execution context to use. +@param a The first value to test. +@param b The second value to test. +@result true if the two values are strict equal, otherwise false. +*/ +JS_EXPORT bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b); + +/*! +@function +@abstract Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator. +@param ctx The execution context to use. +@param value The JSValue to test. +@param constructor The constructor to test against. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false. +*/ +JS_EXPORT bool JSValueIsInstanceOfConstructor(JSContextRef ctx, JSValueRef value, JSObjectRef constructor, JSValueRef* exception); + +/* Creating values */ + +/*! +@function +@abstract Creates a JavaScript value of the undefined type. +@param ctx The execution context to use. +@result The unique undefined value. +*/ +JS_EXPORT JSValueRef JSValueMakeUndefined(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the null type. +@param ctx The execution context to use. +@result The unique null value. +*/ +JS_EXPORT JSValueRef JSValueMakeNull(JSContextRef ctx); + +/*! +@function +@abstract Creates a JavaScript value of the boolean type. +@param ctx The execution context to use. +@param boolean The bool to assign to the newly created JSValue. +@result A JSValue of the boolean type, representing the value of boolean. +*/ +JS_EXPORT JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool boolean); + +/*! +@function +@abstract Creates a JavaScript value of the number type. +@param ctx The execution context to use. +@param number The double to assign to the newly created JSValue. +@result A JSValue of the number type, representing the value of number. +*/ +JS_EXPORT JSValueRef JSValueMakeNumber(JSContextRef ctx, double number); + +/*! +@function +@abstract Creates a JavaScript value of the string type. +@param ctx The execution context to use. +@param string The JSString to assign to the newly created JSValue. The + newly created JSValue retains string, and releases it upon garbage collection. +@result A JSValue of the string type, representing the value of string. +*/ +JS_EXPORT JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string); + +/* Converting to primitive values */ + +/*! +@function +@abstract Converts a JavaScript value to boolean and returns the resulting boolean. +@param ctx The execution context to use. +@param value The JSValue to convert. +@result The boolean result of conversion. +*/ +JS_EXPORT bool JSValueToBoolean(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Converts a JavaScript value to number and returns the resulting number. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The numeric result of conversion, or NaN if an exception is thrown. +*/ +JS_EXPORT double JSValueToNumber(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to string and copies the result into a JavaScript string. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule. +*/ +JS_EXPORT JSStringRef JSValueToStringCopy(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/*! +@function +@abstract Converts a JavaScript value to object and returns the resulting object. +@param ctx The execution context to use. +@param value The JSValue to convert. +@param exception A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. +@result The JSObject result of conversion, or NULL if an exception is thrown. +*/ +JS_EXPORT JSObjectRef JSValueToObject(JSContextRef ctx, JSValueRef value, JSValueRef* exception); + +/* Garbage collection */ +/*! +@function +@abstract Protects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to protect. +@discussion Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it. + +A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection. +*/ +JS_EXPORT void JSValueProtect(JSContextRef ctx, JSValueRef value); + +/*! +@function +@abstract Unprotects a JavaScript value from garbage collection. +@param ctx The execution context to use. +@param value The JSValue to unprotect. +@discussion A value may be protected multiple times and must be unprotected an + equal number of times before becoming eligible for garbage collection. +*/ +JS_EXPORT void JSValueUnprotect(JSContextRef ctx, JSValueRef value); + +#ifdef __cplusplus +} +#endif + +#endif /* JSValueRef_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h new file mode 100644 index 0000000..f8d92d8 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScript.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2006 Apple Inc. All rights reserved. + * Copyright (C) 2008 Alp Toker + * + * 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 JavaScript_h +#define JavaScript_h + +#include +#include +#include +#include +#include + +#endif /* JavaScript_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h new file mode 100644 index 0000000..87d6018 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JavaScriptCore.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 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. + */ + +#ifndef JavaScriptCore_h +#define JavaScriptCore_h + +#include +#include + +#endif /* JavaScriptCore_h */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp new file mode 100644 index 0000000..7c7b1af --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.cpp @@ -0,0 +1,55 @@ +/* + * 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 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 "OpaqueJSString.h" + +#include +#include +#include + +using namespace JSC; + +PassRefPtr OpaqueJSString::create(const UString& ustring) +{ + if (!ustring.isNull()) + return adoptRef(new OpaqueJSString(ustring.data(), ustring.size())); + return 0; +} + +UString OpaqueJSString::ustring() const +{ + if (this && m_characters) + return UString(m_characters, m_length, true); + return UString::null(); +} + +Identifier OpaqueJSString::identifier(JSGlobalData* globalData) const +{ + if (!this || !m_characters) + return Identifier(globalData, static_cast(0)); + + return Identifier(globalData, m_characters, m_length); +} diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h new file mode 100644 index 0000000..473c815 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/OpaqueJSString.h @@ -0,0 +1,81 @@ +/* + * 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 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 OpaqueJSString_h +#define OpaqueJSString_h + +#include + +namespace JSC { + class Identifier; + class JSGlobalData; +} + +struct OpaqueJSString : public ThreadSafeShared { + + static PassRefPtr create() // null + { + return adoptRef(new OpaqueJSString); + } + + static PassRefPtr create(const UChar* characters, unsigned length) + { + return adoptRef(new OpaqueJSString(characters, length)); + } + + static PassRefPtr create(const JSC::UString&); + + UChar* characters() { return this ? m_characters : 0; } + unsigned length() { return this ? m_length : 0; } + + JSC::UString ustring() const; + JSC::Identifier identifier(JSC::JSGlobalData*) const; + +private: + friend class WTF::ThreadSafeShared; + + OpaqueJSString() + : m_characters(0) + , m_length(0) + { + } + + OpaqueJSString(const UChar* characters, unsigned length) + : m_length(length) + { + m_characters = new UChar[length]; + memcpy(m_characters, characters, length * sizeof(UChar)); + } + + ~OpaqueJSString() + { + delete[] m_characters; + } + + UChar* m_characters; + unsigned m_length; +}; + +#endif diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h new file mode 100644 index 0000000..8402528 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/WebKitAvailability.h @@ -0,0 +1,764 @@ +/* + * 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 __WebKitAvailability__ +#define __WebKitAvailability__ + +/* The structure of this header is based on AvailabilityMacros.h. The major difference is that the availability + macros are defined in terms of WebKit version numbers rather than Mac OS X system version numbers, as WebKit + releases span multiple versions of Mac OS X. +*/ + +#define WEBKIT_VERSION_1_0 0x0100 +#define WEBKIT_VERSION_1_1 0x0110 +#define WEBKIT_VERSION_1_2 0x0120 +#define WEBKIT_VERSION_1_3 0x0130 +#define WEBKIT_VERSION_2_0 0x0200 +#define WEBKIT_VERSION_3_0 0x0300 +#define WEBKIT_VERSION_3_1 0x0310 +#define WEBKIT_VERSION_4_0 0x0400 +#define WEBKIT_VERSION_LATEST 0x9999 + +#ifdef __APPLE__ +#import +#else +/* + * For non-Mac platforms, require the newest version. + */ +#define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST +/* + * only certain compilers support __attribute__((deprecated)) + */ +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) + #define DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else + #define DEPRECATED_ATTRIBUTE +#endif +#endif + +/* The versions of GCC that shipped with Xcode prior to 3.0 (GCC build number < 5400) did not support attributes on methods. + If we are building with one of these versions, we need to omit the attribute. We achieve this by wrapping the annotation + in WEBKIT_OBJC_METHOD_ANNOTATION, which will remove the annotation when an old version of GCC is in use and will otherwise + expand to the annotation. The same is needed for protocol methods. +*/ +#if defined(__APPLE_CC__) && __APPLE_CC__ < 5400 + #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) +#else + #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION +#endif + + +/* If minimum WebKit version is not specified, assume the version that shipped with the target Mac OS X version */ +#ifndef WEBKIT_VERSION_MIN_REQUIRED + #if !defined(MAC_OS_X_VERSION_10_2) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2 + #error WebKit was not available prior to Mac OS X 10.2 + #elif !defined(MAC_OS_X_VERSION_10_3) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 + /* WebKit 1.0 is the only version available on Mac OS X 10.2. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_0 + #elif !defined(MAC_OS_X_VERSION_10_4) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 + /* WebKit 1.1 is the version that shipped on Mac OS X 10.3. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_1_1 + #elif !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + /* WebKit 2.0 is the version that shipped on Mac OS X 10.4. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_2_0 + #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 + /* WebKit 3.0 is the version that shipped on Mac OS X 10.5. */ + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_3_0 + #else + #define WEBKIT_VERSION_MIN_REQUIRED WEBKIT_VERSION_LATEST + #endif +#endif + + +/* If maximum WebKit version is not specified, assume largerof(latest, minimum) */ +#ifndef WEBKIT_VERSION_MAX_ALLOWED + #if WEBKIT_VERSION_MIN_REQUIRED > WEBKIT_VERSION_LATEST + #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_MIN_REQUIRED + #else + #define WEBKIT_VERSION_MAX_ALLOWED WEBKIT_VERSION_LATEST + #endif +#endif + + +/* Sanity check the configured values */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_MIN_REQUIRED + #error WEBKIT_VERSION_MAX_ALLOWED must be >= WEBKIT_VERSION_MIN_REQUIRED +#endif +#if WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_0 + #error WEBKIT_VERSION_MIN_REQUIRED must be >= WEBKIT_VERSION_1_0 +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER + * + * Used on functions introduced in WebKit 1.0 + */ +#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED + * + * Used on functions introduced in WebKit 1.0, + * and deprecated in WebKit 1.0 + */ +#define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER + * + * Used on types deprecated in WebKit 1.0 + */ +#define DEPRECATED_IN_WEBKIT_VERSION_1_0_AND_LATER DEPRECATED_ATTRIBUTE + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER + * + * Used on declarations introduced in WebKit 1.1 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.1, + * and deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER + * + * Used on types deprecated in WebKit 1.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_1 + #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_1_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER + * + * Used on declarations introduced in WebKit 1.2 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.2, + * and deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_2 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER + * + * Used on types deprecated in WebKit 1.2 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_2 + #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_2_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER + * + * Used on declarations introduced in WebKit 1.3 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 1.3, + * and deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_1_3 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER + * + * Used on types deprecated in WebKit 1.3 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_1_3 + #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_1_3_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER + * + * Used on declarations introduced in WebKit 2.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 2.0, + * and deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_2_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER + * + * Used on types deprecated in WebKit 2.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_2_0 + #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_2_0_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER + * + * Used on declarations introduced in WebKit 3.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 3.0, + * and deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER + * + * Used on types deprecated in WebKit 3.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_0 + #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_3_0_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER + * + * Used on declarations introduced in WebKit 3.1 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 3.1, + * and deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 + * + * Used on declarations introduced in WebKit 3.0, + * but later deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_3_1 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER + * + * Used on types deprecated in WebKit 3.1 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_3_1 + #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_3_1_AND_LATER +#endif + + + + + + +/* + * AVAILABLE_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 4.0 + */ +#if WEBKIT_VERSION_MAX_ALLOWED < WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 UNAVAILABLE_ATTRIBUTE +#elif WEBKIT_VERSION_MIN_REQUIRED < WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 WEAK_IMPORT_ATTRIBUTE +#else + #define AVAILABLE_IN_WEBKIT_VERSION_4_0 +#endif + +/* + * AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED + * + * Used on declarations introduced in WebKit 4.0, + * and deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_IN_WEBKIT_VERSION_4_0_BUT_DEPRECATED AVAILABLE_IN_WEBKIT_VERSION_4_0 +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.1, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_1_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.2, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_2_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 1.3, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_1_3_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 2.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_2_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 3.0, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER +#endif + +/* + * AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on declarations introduced in WebKit 3.1, + * but later deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER_BUT_DEPRECATED_IN_WEBKIT_VERSION_4_0 AVAILABLE_WEBKIT_VERSION_3_1_AND_LATER +#endif + +/* + * DEPRECATED_IN_WEBKIT_VERSION_4_0 + * + * Used on types deprecated in WebKit 4.0 + */ +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST + #define DEPRECATED_IN_WEBKIT_VERSION_4_0 DEPRECATED_ATTRIBUTE +#else + #define DEPRECATED_IN_WEBKIT_VERSION_4_0 +#endif + + +#endif /* __WebKitAvailability__ */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS b/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS new file mode 100644 index 0000000..e50da8c --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/AUTHORS @@ -0,0 +1,2 @@ +Harri Porten (porten@kde.org) +Peter Kelly (pmk@post.com) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB b/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB new file mode 100644 index 0000000..87c4a33 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/COPYING.LIB @@ -0,0 +1,488 @@ + + +NOTE! The LGPL below is copyrighted by the Free Software Foundation, but +the instance of code that it refers to (the kde libraries) are copyrighted +by the authors who actually wrote it. + +--------------------------------------------------------------------------- + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog new file mode 100644 index 0000000..24fc7e7 --- /dev/null +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog @@ -0,0 +1,2726 @@ +2009-07-28 Xan Lopez + + Add new files, fixes distcheck. + + * GNUmakefile.am: + +2009-07-28 Csaba Osztrogonac + + Reviewed by Simon Hausmann. + + [Qt] Determining whether to use JIT or interpreter + moved from JavaScriptCore.pri to Platform.h + + * JavaScriptCore.pri: + * wtf/Platform.h: + +2009-07-27 Brian Weinstein + + Fix of misuse of sort command. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-27 Brian Weinstein + + Build fix for Windows. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-27 Gavin Barraclough + + Rubber stamped by Oliver Hunt. + + Fix tyop in JIT, renamed preverveReturnAddressAfterCall -> preserveReturnAddressAfterCall. + + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + (JSC::JIT::privateCompileCTIMachineTrampolines): + * jit/JIT.h: + * jit/JITInlineMethods.h: + (JSC::JIT::preserveReturnAddressAfterCall): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::privateCompilePutByIdTransition): + +2009-07-27 Alexey Proskuryakov + + Gtk build fix. + + * runtime/JSLock.cpp: (JSC::JSLock::JSLock): Fix "no threading" case. + +2009-07-27 Alexey Proskuryakov + + Release build fix. + + * runtime/JSLock.h: (JSC::JSLock::~JSLock): + +2009-07-27 Alexey Proskuryakov + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27735 + Give a helpful name to JSLock constructor argument + + * API/JSBase.cpp: + (JSGarbageCollect): + * API/JSContextRef.cpp: + * API/JSObjectRef.cpp: + (JSPropertyNameArrayRelease): + (JSPropertyNameAccumulatorAddName): + * JavaScriptCore.exp: + * jsc.cpp: + (functionGC): + (cleanupGlobalData): + (jscmain): + * runtime/Collector.cpp: + (JSC::Heap::destroy): + * runtime/JSLock.cpp: + (JSC::JSLock::JSLock): + (JSC::JSLock::lock): + (JSC::JSLock::unlock): + (JSC::JSLock::DropAllLocks::DropAllLocks): + (JSC::JSLock::DropAllLocks::~DropAllLocks): + * runtime/JSLock.h: + (JSC::): + (JSC::JSLock::JSLock): + (JSC::JSLock::~JSLock): + +2009-07-25 Zoltan Horvath + + Reviewed by Eric Seidel. + + Allow custom memory allocation control for OpaqueJSPropertyNameArray struct + https://bugs.webkit.org/show_bug.cgi?id=27342 + + Inherits OpaqueJSPropertyNameArray struct from FastAllocBase because it has been + instantiated by 'new' JavaScriptCore/API/JSObjectRef.cpp:473. + + * API/JSObjectRef.cpp: + +2009-07-24 Ada Chan + + In preparation for https://bugs.webkit.org/show_bug.cgi?id=27236: + Remove TCMALLOC_TRACK_DECOMMITED_SPANS. We'll always track decommitted spans. + We have tested this and show it has little impact on performance. + + Reviewed by Mark Rowe. + + * wtf/FastMalloc.cpp: + (WTF::TCMalloc_PageHeap::New): + (WTF::TCMalloc_PageHeap::AllocLarge): + (WTF::propagateDecommittedState): + (WTF::mergeDecommittedStates): + (WTF::TCMalloc_PageHeap::Delete): + (WTF::TCMalloc_PageHeap::IncrementalScavenge): + +2009-07-24 Csaba Osztrogonac + + Reviewed by Darin Adler and Adam Barth. + + Build fix for x86 platforms. + https://bugs.webkit.org/show_bug.cgi?id=27602 + + * jit/JIT.cpp: + +2009-07-23 Kevin Ollivier + + wx build fix, adding missing header. + + * jit/JIT.cpp: + +2009-07-22 Yong Li + + Reviewed by George Staikos. + + Add wince specific memory files into wtf/wince + https://bugs.webkit.org/show_bug.cgi?id=27550 + + * wtf/wince/FastMallocWince.h: Added. + * wtf/wince/MemoryManager.cpp: Added. + * wtf/wince/MemoryManager.h: Added. + +2009-07-23 Norbert Leser + + Reviewed by Simon Hausmann. + + Fix for missing mmap features in Symbian + https://bugs.webkit.org/show_bug.cgi?id=24540 + + Fix, conditionally for PLATFORM(SYMBIAN), as an alternative + to missing support for the MAP_ANON property flag in mmap. + It utilizes Symbian specific memory allocation features. + + * runtime/Collector.cpp + +2009-07-22 Gavin Barraclough + + Reviewed by Sam Weinig. + + With ENABLE(ASSEMBLER_WX_EXCLUSIVE), only change permissions once per repatch event. + ( https://bugs.webkit.org/show_bug.cgi?id=27564 ) + + Currently we change permissions forwards and backwards for each instruction modified, + instead we should only change permissions once per complete repatching event. + + 2.5% progression running with ENABLE(ASSEMBLER_WX_EXCLUSIVE) enabled, + which recoups 1/3 of the penalty of running with this mode enabled. + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::linkBranch): + - Replace usage of MakeWritable with cacheFlush. + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::patchPointerInternal): + (JSC::ARMAssembler::repatchLoadPtrToLEA): + - Replace usage of MakeWritable with cacheFlush. + + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::relinkJump): + (JSC::ARMv7Assembler::relinkCall): + (JSC::ARMv7Assembler::repatchInt32): + (JSC::ARMv7Assembler::repatchPointer): + (JSC::ARMv7Assembler::repatchLoadPtrToLEA): + (JSC::ARMv7Assembler::setInt32): + - Replace usage of MakeWritable with cacheFlush. + + * assembler/LinkBuffer.h: + (JSC::LinkBuffer::performFinalization): + - Make explicit call to cacheFlush. + + * assembler/MacroAssemblerCodeRef.h: + (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef): + - Make size always available. + + * assembler/RepatchBuffer.h: + (JSC::RepatchBuffer::RepatchBuffer): + (JSC::RepatchBuffer::~RepatchBuffer): + - Add calls to MakeWritable & makeExecutable. + + * assembler/X86Assembler.h: + (JSC::X86Assembler::relinkJump): + (JSC::X86Assembler::relinkCall): + (JSC::X86Assembler::repatchInt32): + (JSC::X86Assembler::repatchPointer): + (JSC::X86Assembler::repatchLoadPtrToLEA): + - Remove usage of MakeWritable. + + * bytecode/CodeBlock.h: + (JSC::CodeBlock::getJITCode): + - Provide access to CodeBlock's JITCode. + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::makeExecutable): + (JSC::ExecutableAllocator::cacheFlush): + - Remove MakeWritable, make cacheFlush public. + + * jit/JIT.cpp: + (JSC::ctiPatchNearCallByReturnAddress): + (JSC::ctiPatchCallByReturnAddress): + (JSC::JIT::privateCompile): + (JSC::JIT::unlinkCall): + (JSC::JIT::linkCall): + - Add CodeBlock argument to RepatchBuffer. + + * jit/JIT.h: + - Pass CodeBlock argument for use by RepatchBuffer. + + * jit/JITCode.h: + (JSC::JITCode::start): + (JSC::JITCode::size): + - Provide access to code start & size. + + * jit/JITPropertyAccess.cpp: + (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): + - Add CodeBlock argument to RepatchBuffer. + + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): + (JSC::JITStubs::DEFINE_STUB_FUNCTION): + - Pass CodeBlock argument for use by RepatchBuffer. + +2009-07-21 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + Cache not only the structure of the method, but the + structure of its prototype as well. + https://bugs.webkit.org/show_bug.cgi?id=27077 + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::~CodeBlock): + * bytecode/CodeBlock.h: + (JSC::MethodCallLinkInfo::MethodCallLinkInfo): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::patchMethodCallProto): + +2009-07-21 Gavin Barraclough + + Reviewed by Sam Weinig. + + Move call linking / repatching down from AbstractMacroAssembler into MacroAssemblerARCH classes. + ( https://bugs.webkit.org/show_bug.cgi?id=27527 ) + + This allows the implementation to be defined per architecture. Specifically this addresses the + fact that x86-64 MacroAssembler implements far calls as a load to register, followed by a call + to register. Patching the call actually requires the pointer load to be patched, rather than + the call to be patched. This is implementation detail specific to MacroAssemblerX86_64, and as + such is best handled there. + + * assembler/AbstractMacroAssembler.h: + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::linkCall): + (JSC::MacroAssemblerARM::repatchCall): + * assembler/MacroAssemblerARMv7.h: + (JSC::MacroAssemblerARMv7::linkCall): + (JSC::MacroAssemblerARMv7::repatchCall): + * assembler/MacroAssemblerX86.h: + (JSC::MacroAssemblerX86::linkCall): + (JSC::MacroAssemblerX86::repatchCall): + * assembler/MacroAssemblerX86_64.h: + (JSC::MacroAssemblerX86_64::linkCall): + (JSC::MacroAssemblerX86_64::repatchCall): + +2009-07-21 Adam Treat + + Reviewed by George Staikos. + + Every wtf file includes other wtf files with <> style includes + except this one. Fix the exception. + + * wtf/ByteArray.h: + +2009-07-21 Gavin Barraclough + + Reviewed by Oliver Hunt. + + Move LinkBuffer/RepatchBuffer out of AbstractMacroAssembler. + ( https://bugs.webkit.org/show_bug.cgi?id=27485 ) + + This change is the first step in a process to move code that should be in + the architecture-specific MacroAssembler classes up out of Assmbler and + AbstractMacroAssembler. + + * JavaScriptCore.xcodeproj/project.pbxproj: + - added new files + + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::linkPointer): + - rename patchPointer to bring it in line with the current link/repatch naming scheme + + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::linkCall): + (JSC::ARMv7Assembler::linkPointer): + (JSC::ARMv7Assembler::relinkCall): + (JSC::ARMv7Assembler::repatchInt32): + (JSC::ARMv7Assembler::repatchPointer): + (JSC::ARMv7Assembler::setInt32): + (JSC::ARMv7Assembler::setPointer): + - rename patchPointer to bring it in line with the current link/repatch naming scheme + + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::linkJump): + (JSC::AbstractMacroAssembler::linkCall): + (JSC::AbstractMacroAssembler::linkPointer): + (JSC::AbstractMacroAssembler::getLinkerAddress): + (JSC::AbstractMacroAssembler::getLinkerCallReturnOffset): + (JSC::AbstractMacroAssembler::repatchJump): + (JSC::AbstractMacroAssembler::repatchCall): + (JSC::AbstractMacroAssembler::repatchNearCall): + (JSC::AbstractMacroAssembler::repatchInt32): + (JSC::AbstractMacroAssembler::repatchPointer): + (JSC::AbstractMacroAssembler::repatchLoadPtrToLEA): + - remove the LinkBuffer/RepatchBuffer classes, but leave a set of (private, friended) methods to interface to the Assembler + + * assembler/LinkBuffer.h: Added. + (JSC::LinkBuffer::LinkBuffer): + (JSC::LinkBuffer::~LinkBuffer): + (JSC::LinkBuffer::link): + (JSC::LinkBuffer::patch): + (JSC::LinkBuffer::locationOf): + (JSC::LinkBuffer::locationOfNearCall): + (JSC::LinkBuffer::returnAddressOffset): + (JSC::LinkBuffer::finalizeCode): + (JSC::LinkBuffer::finalizeCodeAddendum): + (JSC::LinkBuffer::code): + (JSC::LinkBuffer::performFinalization): + - new file containing the LinkBuffer class, previously a member of AbstractMacroAssembler + + * assembler/RepatchBuffer.h: Added. + (JSC::RepatchBuffer::RepatchBuffer): + (JSC::RepatchBuffer::relink): + (JSC::RepatchBuffer::repatch): + (JSC::RepatchBuffer::repatchLoadPtrToLEA): + (JSC::RepatchBuffer::relinkCallerToTrampoline): + (JSC::RepatchBuffer::relinkCallerToFunction): + (JSC::RepatchBuffer::relinkNearCallerToTrampoline): + - new file containing the RepatchBuffer class, previously a member of AbstractMacroAssembler + + * assembler/X86Assembler.h: + (JSC::X86Assembler::linkJump): + (JSC::X86Assembler::linkCall): + (JSC::X86Assembler::linkPointerForCall): + (JSC::X86Assembler::linkPointer): + (JSC::X86Assembler::relinkJump): + (JSC::X86Assembler::relinkCall): + (JSC::X86Assembler::repatchInt32): + (JSC::X86Assembler::repatchPointer): + (JSC::X86Assembler::setPointer): + (JSC::X86Assembler::setInt32): + (JSC::X86Assembler::setRel32): + - rename patchPointer to bring it in line with the current link/repatch naming scheme + + * jit/JIT.cpp: + (JSC::ctiPatchNearCallByReturnAddress): + (JSC::ctiPatchCallByReturnAddress): + - include new headers + - remove MacroAssembler:: specification from RepatchBuffer usage + + * jit/JITPropertyAccess.cpp: + * yarr/RegexJIT.cpp: + - include new headers + +2009-07-21 Robert Agoston + + Reviewed by David Levin. + + Fixed #undef typo. + https://bugs.webkit.org/show_bug.cgi?id=27506 + + * bytecode/Opcode.h: + +2009-07-21 Adam Roben + + Roll out r46153, r46154, and r46155 + + These changes were causing build failures and assertion failures on + Windows. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSArray.cpp: + * runtime/StringPrototype.cpp: + * runtime/UString.cpp: + * runtime/UString.h: + * wtf/FastMalloc.cpp: + * wtf/FastMalloc.h: + * wtf/Platform.h: + * wtf/PossiblyNull.h: Removed. + +2009-07-21 Roland Steiner + + Reviewed by David Levin. + + Add ENABLE_RUBY to list of build options + https://bugs.webkit.org/show_bug.cgi?id=27324 + + * Configurations/FeatureDefines.xcconfig: Added flag ENABLE_RUBY. + +2009-07-20 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Build fix attempt #2 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-20 Oliver Hunt + + Reviewed by NOBODY (Build fix). + + Build fix attempt #1 + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-07-20 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Make it harder to misuse try* allocation routines + https://bugs.webkit.org/show_bug.cgi?id=27469 + + Jump through a few hoops to make it much harder to accidentally + miss null-checking of values returned by the try-* allocation + routines. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSArray.cpp: + (JSC::JSArray::putSlowCase): + (JSC::JSArray::increaseVectorLength): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncLink): + * runtime/UString.cpp: + (JSC::allocChars): + (JSC::reallocChars): + (JSC::expandCapacity): + (JSC::UString::Rep::reserveCapacity): + (JSC::UString::expandPreCapacity): + (JSC::createRep): + (JSC::concatenate): + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + (JSC::UString::append): + (JSC::UString::operator=): + * runtime/UString.h: + (JSC::UString::Rep::createEmptyBuffer): + * wtf/FastMalloc.cpp: + (WTF::tryFastZeroedMalloc): + (WTF::tryFastMalloc): + (WTF::tryFastCalloc): + (WTF::tryFastRealloc): + (WTF::TCMallocStats::tryFastMalloc): + (WTF::TCMallocStats::tryFastCalloc): + (WTF::TCMallocStats::tryFastRealloc): + * wtf/FastMalloc.h: + (WTF::TryMallocReturnValue::TryMallocReturnValue): + (WTF::TryMallocReturnValue::~TryMallocReturnValue): + (WTF::TryMallocReturnValue::operator Maybe): + (WTF::TryMallocReturnValue::getValue): + * wtf/PossiblyNull.h: + (WTF::PossiblyNull::PossiblyNull): + (WTF::PossiblyNull::~PossiblyNull): + (WTF::PossiblyNull::getValue): + * wtf/Platform.h: + +2009-07-20 Gavin Barraclough + + RS Oliver Hunt. + + Add ARM assembler files to xcodeproj, for convenience editing. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-07-20 Jessie Berlin + + Reviewed by David Levin. + + Fix an incorrect assertion in Vector::remove. + + https://bugs.webkit.org/show_bug.cgi?id=27477 + + * wtf/Vector.h: + (WTF::::remove): + Assert that the position at which to start removing elements + the + length (the number of elements to remove) is less than or equal to the + size of the entire Vector. + +2009-07-20 Peter Kasting + + Reviewed by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=27468 + Back out r46060, which caused problems for some Apple developers. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2009-07-20 Zoltan Horvath + + Reviewed by Oliver Hunt. + + Allow custom memory allocation control in NewThreadContext + https://bugs.webkit.org/show_bug.cgi?id=27338 + + Inherits NewThreadContext struct from FastAllocBase because it + has been instantiated by 'new' JavaScriptCore/wtf/Threading.cpp:76. + + * wtf/Threading.cpp: + +2009-07-20 Zoltan Horvath + + Reviewed by Oliver Hunt. + + Allow custom memory allocation control in JavaScriptCore's JSClassRef.h + https://bugs.webkit.org/show_bug.cgi?id=27340 + + Inherit StaticValueEntry and StaticFunctionEntry struct from FastAllocBase because these + have been instantiated by 'new' in JavaScriptCore/API/JSClassRef.cpp:153 + and in JavaScriptCore/API/JSClassRef.cpp:166. + + * API/JSClassRef.h: + +2009-07-20 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control in JavaScriptCore's RegexPattern.h + https://bugs.webkit.org/show_bug.cgi?id=27343 + + Inherits RegexPattern.h's structs (which have been instantiated by operator new) from FastAllocBase: + + CharacterClass (new call: JavaScriptCore/yarr/RegexCompiler.cpp:144) + PatternAlternative (new call: JavaScriptCore/yarr/RegexPattern.h:221) + PatternDisjunction (new call: JavaScriptCore/yarr/RegexCompiler.cpp:446) + + * yarr/RegexPattern.h: + +2009-07-20 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's MatchFrame struct + https://bugs.webkit.org/show_bug.cgi?id=27344 + + Inherits MatchFrame struct from FastAllocBase because it has + been instantiated by 'new' JavaScriptCore/pcre/pcre_exec.cpp:359. + + * pcre/pcre_exec.cpp: + +2009-07-20 Laszlo Gombos + + Reviewed by Holger Freyther. + + Remove some outdated S60 platform specific code + https://bugs.webkit.org/show_bug.cgi?id=27423 + + * wtf/Platform.h: + +2009-07-20 Csaba Osztrogonac + + Reviewed by Simon Hausmann. + + Qt build fix with MSVC and MinGW. + + * jsc.pro: Make sure jsc is a console application, and turn off + exceptions and stl support to fix the build. + +2009-07-20 Xan Lopez + + Reviewed by Gustavo Noronha. + + Do not use C++-style comments in preprocessor directives. + + GCC does not like this in some configurations, using C-style + comments is safer. + + * wtf/Platform.h: + +2009-07-17 Peter Kasting + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2009-07-17 Gabor Loki + + Reviewed by Gavin Barraclough. + + Add YARR support for generic ARM platforms (disabled by default). + https://bugs.webkit.org/show_bug.cgi?id=24986 + + Add generic ARM port for MacroAssembler. It supports the whole + MacroAssembler functionality except floating point. + + The class JmpSrc is extended with a flag which enables to patch + the jump destination offset during execution. This feature is + required for generic ARM port. + + Signed off by Zoltan Herczeg + Signed off by Gabor Loki + + * JavaScriptCore.pri: + * assembler/ARMAssembler.cpp: Added. + (JSC::ARMAssembler::getLdrImmAddress): + (JSC::ARMAssembler::linkBranch): + (JSC::ARMAssembler::patchConstantPoolLoad): + (JSC::ARMAssembler::getOp2): + (JSC::ARMAssembler::genInt): + (JSC::ARMAssembler::getImm): + (JSC::ARMAssembler::moveImm): + (JSC::ARMAssembler::dataTransfer32): + (JSC::ARMAssembler::baseIndexTransfer32): + (JSC::ARMAssembler::executableCopy): + * assembler/ARMAssembler.h: Added. + (JSC::ARM::): + (JSC::ARMAssembler::ARMAssembler): + (JSC::ARMAssembler::): + (JSC::ARMAssembler::JmpSrc::JmpSrc): + (JSC::ARMAssembler::JmpSrc::enableLatePatch): + (JSC::ARMAssembler::JmpDst::JmpDst): + (JSC::ARMAssembler::JmpDst::isUsed): + (JSC::ARMAssembler::JmpDst::used): + (JSC::ARMAssembler::emitInst): + (JSC::ARMAssembler::and_r): + (JSC::ARMAssembler::ands_r): + (JSC::ARMAssembler::eor_r): + (JSC::ARMAssembler::eors_r): + (JSC::ARMAssembler::sub_r): + (JSC::ARMAssembler::subs_r): + (JSC::ARMAssembler::rsb_r): + (JSC::ARMAssembler::rsbs_r): + (JSC::ARMAssembler::add_r): + (JSC::ARMAssembler::adds_r): + (JSC::ARMAssembler::adc_r): + (JSC::ARMAssembler::adcs_r): + (JSC::ARMAssembler::sbc_r): + (JSC::ARMAssembler::sbcs_r): + (JSC::ARMAssembler::rsc_r): + (JSC::ARMAssembler::rscs_r): + (JSC::ARMAssembler::tst_r): + (JSC::ARMAssembler::teq_r): + (JSC::ARMAssembler::cmp_r): + (JSC::ARMAssembler::orr_r): + (JSC::ARMAssembler::orrs_r): + (JSC::ARMAssembler::mov_r): + (JSC::ARMAssembler::movs_r): + (JSC::ARMAssembler::bic_r): + (JSC::ARMAssembler::bics_r): + (JSC::ARMAssembler::mvn_r): + (JSC::ARMAssembler::mvns_r): + (JSC::ARMAssembler::mul_r): + (JSC::ARMAssembler::muls_r): + (JSC::ARMAssembler::mull_r): + (JSC::ARMAssembler::ldr_imm): + (JSC::ARMAssembler::ldr_un_imm): + (JSC::ARMAssembler::dtr_u): + (JSC::ARMAssembler::dtr_ur): + (JSC::ARMAssembler::dtr_d): + (JSC::ARMAssembler::dtr_dr): + (JSC::ARMAssembler::ldrh_r): + (JSC::ARMAssembler::ldrh_d): + (JSC::ARMAssembler::ldrh_u): + (JSC::ARMAssembler::strh_r): + (JSC::ARMAssembler::push_r): + (JSC::ARMAssembler::pop_r): + (JSC::ARMAssembler::poke_r): + (JSC::ARMAssembler::peek_r): + (JSC::ARMAssembler::clz_r): + (JSC::ARMAssembler::bkpt): + (JSC::ARMAssembler::lsl): + (JSC::ARMAssembler::lsr): + (JSC::ARMAssembler::asr): + (JSC::ARMAssembler::lsl_r): + (JSC::ARMAssembler::lsr_r): + (JSC::ARMAssembler::asr_r): + (JSC::ARMAssembler::size): + (JSC::ARMAssembler::ensureSpace): + (JSC::ARMAssembler::label): + (JSC::ARMAssembler::align): + (JSC::ARMAssembler::jmp): + (JSC::ARMAssembler::patchPointerInternal): + (JSC::ARMAssembler::patchConstantPoolLoad): + (JSC::ARMAssembler::patchPointer): + (JSC::ARMAssembler::repatchInt32): + (JSC::ARMAssembler::repatchPointer): + (JSC::ARMAssembler::repatchLoadPtrToLEA): + (JSC::ARMAssembler::linkJump): + (JSC::ARMAssembler::relinkJump): + (JSC::ARMAssembler::linkCall): + (JSC::ARMAssembler::relinkCall): + (JSC::ARMAssembler::getRelocatedAddress): + (JSC::ARMAssembler::getDifferenceBetweenLabels): + (JSC::ARMAssembler::getCallReturnOffset): + (JSC::ARMAssembler::getOp2Byte): + (JSC::ARMAssembler::placeConstantPoolBarrier): + (JSC::ARMAssembler::RM): + (JSC::ARMAssembler::RS): + (JSC::ARMAssembler::RD): + (JSC::ARMAssembler::RN): + (JSC::ARMAssembler::getConditionalField): + * assembler/ARMv7Assembler.h: + (JSC::ARMv7Assembler::JmpSrc::enableLatePatch): + * assembler/AbstractMacroAssembler.h: + (JSC::AbstractMacroAssembler::Call::enableLatePatch): + (JSC::AbstractMacroAssembler::Jump::enableLatePatch): + * assembler/MacroAssembler.h: + * assembler/MacroAssemblerARM.h: Added. + (JSC::MacroAssemblerARM::): + (JSC::MacroAssemblerARM::add32): + (JSC::MacroAssemblerARM::and32): + (JSC::MacroAssemblerARM::lshift32): + (JSC::MacroAssemblerARM::mul32): + (JSC::MacroAssemblerARM::not32): + (JSC::MacroAssemblerARM::or32): + (JSC::MacroAssemblerARM::rshift32): + (JSC::MacroAssemblerARM::sub32): + (JSC::MacroAssemblerARM::xor32): + (JSC::MacroAssemblerARM::load32): + (JSC::MacroAssemblerARM::load32WithAddressOffsetPatch): + (JSC::MacroAssemblerARM::loadPtrWithPatchToLEA): + (JSC::MacroAssemblerARM::load16): + (JSC::MacroAssemblerARM::store32WithAddressOffsetPatch): + (JSC::MacroAssemblerARM::store32): + (JSC::MacroAssemblerARM::pop): + (JSC::MacroAssemblerARM::push): + (JSC::MacroAssemblerARM::move): + (JSC::MacroAssemblerARM::swap): + (JSC::MacroAssemblerARM::signExtend32ToPtr): + (JSC::MacroAssemblerARM::zeroExtend32ToPtr): + (JSC::MacroAssemblerARM::branch32): + (JSC::MacroAssemblerARM::branch16): + (JSC::MacroAssemblerARM::branchTest32): + (JSC::MacroAssemblerARM::jump): + (JSC::MacroAssemblerARM::branchAdd32): + (JSC::MacroAssemblerARM::mull32): + (JSC::MacroAssemblerARM::branchMul32): + (JSC::MacroAssemblerARM::branchSub32): + (JSC::MacroAssemblerARM::breakpoint): + (JSC::MacroAssemblerARM::nearCall): + (JSC::MacroAssemblerARM::call): + (JSC::MacroAssemblerARM::ret): + (JSC::MacroAssemblerARM::set32): + (JSC::MacroAssemblerARM::setTest32): + (JSC::MacroAssemblerARM::tailRecursiveCall): + (JSC::MacroAssemblerARM::makeTailRecursiveCall): + (JSC::MacroAssemblerARM::moveWithPatch): + (JSC::MacroAssemblerARM::branchPtrWithPatch): + (JSC::MacroAssemblerARM::storePtrWithPatch): + (JSC::MacroAssemblerARM::supportsFloatingPoint): + (JSC::MacroAssemblerARM::supportsFloatingPointTruncate): + (JSC::MacroAssemblerARM::loadDouble): + (JSC::MacroAssemblerARM::storeDouble): + (JSC::MacroAssemblerARM::addDouble): + (JSC::MacroAssemblerARM::subDouble): + (JSC::MacroAssemblerARM::mulDouble): + (JSC::MacroAssemblerARM::convertInt32ToDouble): + (JSC::MacroAssemblerARM::branchDouble): + (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32): + (JSC::MacroAssemblerARM::ARMCondition): + (JSC::MacroAssemblerARM::prepareCall): + (JSC::MacroAssemblerARM::call32): + * assembler/X86Assembler.h: + (JSC::X86Assembler::JmpSrc::enableLatePatch): + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + * wtf/Platform.h: + * yarr/RegexJIT.cpp: + (JSC::Yarr::RegexGenerator::generateEnter): + (JSC::Yarr::RegexGenerator::generateReturn): + +2009-07-17 Gabor Loki + + Reviewed by Gavin Barraclough. + + Extend AssemblerBuffer with constant pool handling mechanism. + https://bugs.webkit.org/show_bug.cgi?id=24986 + + Add a platform independed constant pool framework. + This pool can store 32 or 64 bits values which is enough to hold + any integer, pointer or double constant. + + * assembler/AssemblerBuffer.h: + (JSC::AssemblerBuffer::putIntUnchecked): + (JSC::AssemblerBuffer::putInt64Unchecked): + (JSC::AssemblerBuffer::append): + (JSC::AssemblerBuffer::grow): + * assembler/AssemblerBufferWithConstantPool.h: Added. + (JSC::): + +2009-07-17 Eric Roman + + Reviewed by Darin Adler. + + Build fix for non-Darwin. + Add a guard for inclusion of RetainPtr.h which includes CoreFoundation.h + + https://bugs.webkit.org/show_bug.cgi?id=27382 + + * wtf/unicode/icu/CollatorICU.cpp: + +2009-07-17 Alexey Proskuryakov + + Reviewed by John Sullivan. + + Get user default collation order via a CFLocale API when available. + + * wtf/unicode/icu/CollatorICU.cpp: (WTF::Collator::userDefault): + +2009-07-17 Laszlo Gombos + + Reviewed by Simon Hausmann. + + [Qt] Fix the include path for the Symbian port + https://bugs.webkit.org/show_bug.cgi?id=27358 + + * JavaScriptCore.pri: + +2009-07-17 Csaba Osztrogonac + + Reviewed by David Levin. + + Build fix on platforms don't have MMAP. + https://bugs.webkit.org/show_bug.cgi?id=27365 + + * interpreter/RegisterFile.h: Including stdio.h irrespectively of HAVE(MMAP) + +2009-07-16 Fumitoshi Ukai + + Reviewed by David Levin. + + Add --web-sockets flag and ENABLE_WEB_SOCKETS define. + https://bugs.webkit.org/show_bug.cgi?id=27206 + + Add ENABLE_WEB_SOCKETS + + * Configurations/FeatureDefines.xcconfig: add ENABLE_WEB_SOCKETS + +2009-07-16 Maxime Simon + + Reviewed by Eric Seidel. + + Added Haiku-specific files for JavaScriptCore. + https://bugs.webkit.org/show_bug.cgi?id=26620 + + * wtf/haiku/MainThreadHaiku.cpp: Added. + (WTF::initializeMainThreadPlatform): + (WTF::scheduleDispatchFunctionsOnMainThread): + +2009-07-16 Gavin Barraclough + + RS by Oliver Hunt. + + Revert r45969, this fix does not appear to be valid. + https://bugs.webkit.org/show_bug.cgi?id=27077 + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::~CodeBlock): + (JSC::CodeBlock::unlinkCallers): + * jit/JIT.cpp: + * jit/JIT.h: + +2009-07-16 Zoltan Horvath + + Reviewed by Oliver Hunt. + + Allow custom memory allocation control in ExceptionInfo and RareData struct + https://bugs.webkit.org/show_bug.cgi?id=27336 + + Inherits ExceptionInfo and RareData struct from FastAllocBase because these + have been instantiated by 'new' in JavaScriptCore/bytecode/CodeBlock.cpp:1289 and + in JavaScriptCore/bytecode/CodeBlock.h:453. + + Remove unnecessary WTF:: namespace from CodeBlock inheritance. + + * bytecode/CodeBlock.h: + +2009-07-16 Mark Rowe + + Rubber-stamped by Geoff Garen. + + Fix FeatureDefines.xcconfig to not be out of sync with the rest of the world. + + * Configurations/FeatureDefines.xcconfig: + +2009-07-16 Yong Li + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=27320 + _countof is only included in CE6; for CE5 we need to define it ourself + + * wtf/Platform.h: + +2009-07-16 Zoltan Herczeg + + Reviewed by Oliver Hunt. + + Workers + garbage collector: weird crashes + https://bugs.webkit.org/show_bug.cgi?id=27077 + + We need to unlink cached method call sites when a function is destroyed. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::~CodeBlock): + (JSC::CodeBlock::unlinkCallers): + * jit/JIT.cpp: + (JSC::JIT::unlinkMethodCall): + * jit/JIT.h: + +2009-07-15 Steve Falkenburg + + Windows Build fix. + + Visual Studio reset our intermediate directory on us. + This sets it back. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.vcproj/testapi/testapi.vcproj: + +2009-07-15 Kwang Yul Seo + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=26794 + Make Yacc-generated parsers to use fastMalloc/fastFree. + + Define YYMALLOC and YYFREE to fastMalloc and fastFree + respectively. + + * parser/Grammar.y: + +2009-07-15 Darin Adler + + Fix a build for a particular Apple configuration. + + * wtf/FastAllocBase.h: Change include to use "" style for + including another wtf header. This is the style we use for + including other public headers in the same directory. + +2009-07-15 George Staikos + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27303 + Implement createThreadInternal for WinCE. + Contains changes by George Staikos and Joe Mason + + * wtf/ThreadingWin.cpp: + (WTF::createThreadInternal): + +2009-07-15 Joe Mason + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=27298 + Platform defines for WINCE. + Contains changes by Yong Li , + George Staikos and Joe Mason + + * wtf/Platform.h: + +2009-07-15 Yong Li + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27306 + Use RegisterClass instead of RegisterClassEx on WinCE. + + * wtf/win/MainThreadWin.cpp: + (WTF::initializeMainThreadPlatform): + +2009-07-15 Yong Li + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=27301 + Use OutputDebugStringW on WinCE since OutputDebugStringA is not supported + Originally written by Yong Li and refactored by + Joe Mason + + * wtf/Assertions.cpp: vprintf_stderr_common + +2009-07-15 Yong Li + + Reviewed by George Staikos. + + https://bugs.webkit.org/show_bug.cgi?id=27020 + msToGregorianDateTime should set utcOffset to 0 when outputIsUTC is false + + * wtf/DateMath.cpp: + (WTF::gregorianDateTimeToMS): + +2009-07-15 Laszlo Gombos + + Reviewed by Simon Hausmann. + + [Qt] Cleanup - Remove obsolete code from the make system + https://bugs.webkit.org/show_bug.cgi?id=27299 + + * JavaScriptCore.pro: + * jsc.pro: + +2009-07-07 Norbert Leser + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=27056 + + Alternate bool operator for codewarrior compiler (WINSCW). + Compiler (latest b482) reports error for UnspecifiedBoolType construct: + "illegal explicit conversion from 'WTF::OwnArrayPtr' to 'bool'" + + Same fix as in r38391. + + * JavaScriptCore/wtf/OwnArrayPtr.h: + +2009-07-15 Norbert Leser + + Reviewed by Darin Adler. + + Qualify include path with wtf to fix compilation + on Symbian. + https://bugs.webkit.org/show_bug.cgi?id=27055 + + * interpreter/Interpreter.h: + +2009-07-15 Laszlo Gombos + + Reviewed by Dave Kilzer. + + Turn off non-portable date manipulations for SYMBIAN + https://bugs.webkit.org/show_bug.cgi?id=27064 + + Introduce HAVE(TM_GMTOFF), HAVE(TM_ZONE) and HAVE(TIMEGM) guards + and place the rules for controlling the guards in Platform.h. + Turn off these newly introduced guards for SYMBIAN. + + * wtf/DateMath.cpp: + (WTF::calculateUTCOffset): + * wtf/DateMath.h: + (WTF::GregorianDateTime::GregorianDateTime): + (WTF::GregorianDateTime::operator tm): + * wtf/Platform.h: + +2009-07-15 Norbert Leser + + Reviewed by Simon Hausmann. + + Undef ASSERT on Symbian, to avoid excessive warnings + https://bugs.webkit.org/show_bug.cgi?id=27052 + + * wtf/Assertions.h: + +2009-07-15 Oliver Hunt + + Reviewed by Simon Hausmann. + + REGRESSION: fast/js/postfix-syntax.html fails with interpreter + https://bugs.webkit.org/show_bug.cgi?id=27294 + + When postfix operators operating on locals assign to the same local + the order of operations has to be to store the incremented value, then + store the unmodified number. Rather than implementing this subtle + semantic in the interpreter I've just made the logic explicit in the + bytecode generator, so x=x++ effectively becomes x=ToNumber(x) (for a + local var x). + + * parser/Nodes.cpp: + (JSC::emitPostIncOrDec): + +2009-07-15 Oliver Hunt + + Reviewed by Simon Hausmann. + + REGRESSION(43559): fast/js/kde/arguments-scope.html fails with interpreter + https://bugs.webkit.org/show_bug.cgi?id=27259 + + The interpreter was incorrectly basing its need to create the arguments object + based on the presence of the callframe's argument reference rather than the local + arguments reference. Based on this it then overrode the local variable reference. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + +2009-07-14 Steve Falkenburg + + Reorganize JavaScriptCore headers into: + API: include/JavaScriptCore/ + Private: include/private/JavaScriptCore/ + + Reviewed by Darin Adler. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: + * JavaScriptCore.vcproj/testapi/testapi.vcproj: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Change JSCell's superclass to NoncopyableCustomAllocated + https://bugs.webkit.org/show_bug.cgi?id=27248 + + JSCell class customizes operator new, since Noncopyable will be + inherited from FastAllocBase, NoncopyableCustomAllocated has + to be used. + + * runtime/JSCell.h: + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Change all Noncopyable inheriting visibility to public. + https://bugs.webkit.org/show_bug.cgi?id=27225 + + Change all Noncopyable inheriting visibility to public because + it is needed to the custom allocation framework (bug #20422). + + * bytecode/SamplingTool.h: + * bytecompiler/RegisterID.h: + * interpreter/CachedCall.h: + * interpreter/RegisterFile.h: + * parser/Lexer.h: + * parser/Parser.h: + * runtime/ArgList.h: + * runtime/BatchedTransitionOptimizer.h: + * runtime/Collector.h: + * runtime/CommonIdentifiers.h: + * runtime/JSCell.h: + * runtime/JSGlobalObject.h: + * runtime/JSLock.h: + * runtime/JSONObject.cpp: + * runtime/SmallStrings.cpp: + * runtime/SmallStrings.h: + * wtf/CrossThreadRefCounted.h: + * wtf/GOwnPtr.h: + * wtf/Locker.h: + * wtf/MessageQueue.h: + * wtf/OwnArrayPtr.h: + * wtf/OwnFastMallocPtr.h: + * wtf/OwnPtr.h: + * wtf/RefCounted.h: + * wtf/ThreadSpecific.h: + * wtf/Threading.h: + * wtf/Vector.h: + * wtf/unicode/Collator.h: + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Change ParserArenaRefCounted's superclass to RefCountedCustomAllocated + https://bugs.webkit.org/show_bug.cgi?id=27249 + + ParserArenaDeletable customizes operator new, to avoid double inheritance + ParserArenaDeletable's superclass has been changed to RefCountedCustomAllocated. + + * parser/Nodes.h: + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Add RefCountedCustomAllocated to RefCounted.h + https://bugs.webkit.org/show_bug.cgi?id=27232 + + Some class which are inherited from RefCounted customize + operator new, but RefCounted is inherited from Noncopyable + which will be inherited from FastAllocBase. To avoid + conflicts Noncopyable inheriting was moved down to RefCounted + and to avoid double inheritance this class has been added. + + * wtf/RefCounted.h: + (WTF::RefCountedCustomAllocated::deref): + (WTF::RefCountedCustomAllocated::~RefCountedCustomAllocated): + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Add NoncopyableCustomAllocated to Noncopyable.h. + https://bugs.webkit.org/show_bug.cgi?id=27228 + + Some classes which inherited from Noncopyable overrides operator new + since Noncopyable'll be inherited from FastAllocBase, Noncopyable.h + needs to be extended with this new class to support the overriding. + + * wtf/Noncopyable.h: + (WTFNoncopyable::NoncopyableCustomAllocated::NoncopyableCustomAllocated): + (WTFNoncopyable::NoncopyableCustomAllocated::~NoncopyableCustomAllocated): + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's IdentifierTable class + https://bugs.webkit.org/show_bug.cgi?id=27260 + + Inherits IdentifierTable class from FastAllocBase because it has been + instantiated by 'new' in JavaScriptCore/runtime/Identifier.cpp:70. + + * runtime/Identifier.cpp: + +2009-07-14 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's Profiler class + https://bugs.webkit.org/show_bug.cgi?id=27253 + + Inherits Profiler class from FastAllocBase because it has been instantiated by + 'new' in JavaScriptCore/profiler/Profiler.cpp:56. + + * profiler/Profiler.h: + +2009-07-06 George Staikos + + Reviewed by Adam Treat. + + Authors: George Staikos , Joe Mason , Makoto Matsumoto , Takuji Nishimura + + https://bugs.webkit.org/show_bug.cgi?id=27030 + Implement custom RNG for WinCE using Mersenne Twister + + * wtf/RandomNumber.cpp: + (WTF::randomNumber): + * wtf/RandomNumberSeed.h: + (WTF::initializeRandomNumberGenerator): + * wtf/wince/mt19937ar.c: Added. + (init_genrand): + (init_by_array): + (genrand_int32): + (genrand_int31): + (genrand_real1): + (genrand_real2): + (genrand_real3): + (genrand_res53): + +2009-07-13 Gustavo Noronha Silva + + Unreviewed make dist build fix. + + * GNUmakefile.am: + +2009-07-13 Drew Wilson + + Reviewed by David Levin. + + Add ENABLE(SHARED_WORKERS) flag and define SharedWorker APIs + https://bugs.webkit.org/show_bug.cgi?id=26932 + + Added ENABLE(SHARED_WORKERS) flag (off by default). + + * Configurations/FeatureDefines.xcconfig: + +2009-07-07 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27058 + + Removed superfluous parenthesis around single expression. + Compilers on Symbian platform fail to properly parse and compile. + + * JavaScriptCore/wtf/Platform.h: + +2009-07-13 Norbert Leser + + Reviewed by Maciej Stachoviak. + + https://bugs.webkit.org/show_bug.cgi?id=27054 + + Renamed Translator to HashTranslator + + Codewarrior compiler (WINSCW) latest b482 cannot resolve typename + mismatch between template declaration and definition + (HashTranslator / Translator) + + * wtf/HashSet.h: + +2009-07-13 Norbert Leser + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=27053 + + Ambiguity in LabelScope initialization + + Codewarrior compiler (WINSCW) latest b482 on Symbian cannot resolve + type of "0" unambiguously. Set expression explicitly to + PassRefPtr