From a210a1efb3a255235ab22e618c61d0aaccba3d9f Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 20 Oct 2009 10:39:56 +0200 Subject: QToolButton popup menu is shown at wrong position when embedded in a QGraphicsView. The main problem here is that QWidget assume that they are in the screen somewhere, which means inside the available geometry provided by QDesktopWidget. But in QGraphicsView the button can be in a position that is way bigger than the screen resolution. Lot of widgets make this assumption when positionning subpopups or submenus. Instead of applying the same code on tons of QWidgets, it's better to have an helper function in desktop widget which catch this case. It's not pretty (since it has nothing to do with QDesktopWidget) but we don't have better solution. Task-number:QTBUG-3822 Reviewed-by:brad --- src/gui/kernel/kernel.pri | 1 + src/gui/kernel/qdesktopwidget.cpp | 67 +++++++++++++++++++++++++++++++++++++++ src/gui/kernel/qdesktopwidget.h | 6 ++-- src/gui/kernel/qwidget.cpp | 22 ++----------- src/gui/kernel/qwidget_p.h | 53 +++++++++++++++++++++++++++++-- src/gui/widgets/qmenu.cpp | 31 +++++++++++++++--- src/gui/widgets/qmenu_p.h | 3 +- src/gui/widgets/qpushbutton.cpp | 4 +-- 8 files changed, 155 insertions(+), 32 deletions(-) create mode 100644 src/gui/kernel/qdesktopwidget.cpp diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 53c2611..8859358 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -84,6 +84,7 @@ SOURCES += \ kernel/qgesturerecognizer.cpp \ kernel/qgesturemanager.cpp \ kernel/qsoftkeymanager.cpp \ + kernel/qdesktopwidget.cpp \ kernel/qguiplatformplugin.cpp win32 { diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp new file mode 100644 index 0000000..b1e1008 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qglobal.h" + +QT_BEGIN_NAMESPACE + +#include "qdesktopwidget.h" +#include "qwidget_p.h" + +const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const +{ + QRect rect = QWidgetPrivate::screenGeometry(widget); + if (rect.isNull()) + return screenGeometry(screenNumber(widget)); + else return rect; +} + +const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const +{ + QRect rect = QWidgetPrivate::screenGeometry(widget); + if (rect.isNull()) + return availableGeometry(screenNumber(widget)); + else + return rect; +} + +QT_END_NAMESPACE + diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h index 85f479e..6e3447c 100644 --- a/src/gui/kernel/qdesktopwidget.h +++ b/src/gui/kernel/qdesktopwidget.h @@ -75,14 +75,12 @@ public: QWidget *screen(int screen = -1); const QRect screenGeometry(int screen = -1) const; - const QRect screenGeometry(const QWidget *widget) const - { return screenGeometry(screenNumber(widget)); } + const QRect screenGeometry(const QWidget *widget) const; const QRect screenGeometry(const QPoint &point) const { return screenGeometry(screenNumber(point)); } const QRect availableGeometry(int screen = -1) const; - const QRect availableGeometry(const QWidget *widget) const - { return availableGeometry(screenNumber(widget)); } + const QRect availableGeometry(const QWidget *widget) const; const QRect availableGeometry(const QPoint &point) const { return availableGeometry(screenNumber(point)); } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7dc3ae9..e561aca 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -149,24 +149,6 @@ static inline bool hasBackingStoreSupport() #endif } -/*! - \internal - - Returns true if \a p or any of its parents enable the - Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and - QWidget::setParent() to determine whether it's necessary to embed the - widget into a QGraphicsProxyWidget or not. -*/ -static inline bool bypassGraphicsProxyWidget(QWidget *p) -{ - while (p) { - if (p->windowFlags() & Qt::BypassGraphicsProxyWidget) - return true; - p = p->parentWidget(); - } - return false; -} - #ifdef Q_WS_MAC # define QT_NO_PAINT_DEBUG #endif @@ -5473,6 +5455,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * return pixmap; } +#ifndef QT_NO_GRAPHICSVIEW /*! \internal @@ -5481,7 +5464,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * If successful, the function returns the proxy that embeds the widget, or 0 if no embedded widget was found. */ -QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origin) +QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin) { if (origin) { QWExtra *extra = origin->d_func()->extra; @@ -5491,6 +5474,7 @@ QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origi } return 0; } +#endif /*! \property QWidget::locale diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index a549740..2132474 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -63,7 +63,9 @@ #include "QtGui/qstyle.h" #include "QtGui/qapplication.h" #include - +#include "QtGui/qgraphicsproxywidget.h" +#include "QtGui/qgraphicsscene.h" +#include "QtGui/qgraphicsview.h" #include #ifdef Q_WS_WIN @@ -180,7 +182,9 @@ struct QWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). void *glContext; // if the widget is hijacked by QGLWindowSurface QTLWExtra *topextra; // only useful for TLWs +#ifndef QT_NO_GRAPHICSVIEW QGraphicsProxyWidget *proxyWidget; // if the widget is embedded +#endif #ifndef QT_NO_CURSOR QCursor *curs; #endif @@ -235,6 +239,24 @@ struct QWExtra { #endif }; +/*! + \internal + + Returns true if \a p or any of its parents enable the + Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and + QWidget::setParent() to determine whether it's necessary to embed the + widget into a QGraphicsProxyWidget or not. +*/ +static inline bool bypassGraphicsProxyWidget(const QWidget *p) +{ + while (p) { + if (p->windowFlags() & Qt::BypassGraphicsProxyWidget) + return true; + p = p->parentWidget(); + } + return false; +} + class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWidget) @@ -344,7 +366,9 @@ public: QPainter *beginSharedPainter(); bool endSharedPainter(); - static QGraphicsProxyWidget * nearestGraphicsProxyWidget(QWidget *origin); +#ifndef QT_NO_GRAPHICSVIEW + static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin); +#endif QWindowSurface *createDefaultWindowSurface(); QWindowSurface *createDefaultWindowSurface_sys(); void repaint_sys(const QRegion &rgn); @@ -441,6 +465,31 @@ public: void setModal_sys(); + // This is an helper function that return the available geometry for + // a widget and takes care is this one is in QGraphicsView. + // If the widget is not embed in a scene then the geometry available is + // null, we let QDesktopWidget decide for us. + static QRect screenGeometry(const QWidget *widget) + { + QRect screen; +#ifndef QT_NO_GRAPHICSVIEW + QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); + //It's embedded if it has an ancestor + if (ancestorProxy) { + if (!bypassGraphicsProxyWidget(widget)) { + // One view, let be smart and return the viewport rect then the popup is aligned + if (ancestorProxy->scene()->views().size() == 1) { + QGraphicsView *view = ancestorProxy->scene()->views().at(0); + screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect(); + } else { + screen = ancestorProxy->scene()->sceneRect().toRect(); + } + } + } +#endif + return screen; + } + inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) { Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 687e1bc..324bc90 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -180,6 +180,21 @@ int QMenuPrivate::scrollerHeight() const } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't +QRect QMenuPrivate::popupGeometry(const QWidget *widget) const +{ +#ifdef Q_WS_WIN + return QApplication::desktop()->screenGeometry(widget); +#elif defined Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE) + return QApplication::desktop()->screenGeometry(widget); + else + return QApplication::desktop()->availableGeometry(widget); +#else + return QApplication::desktop()->availableGeometry(widget); +#endif +} + +//Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { #ifdef Q_WS_WIN @@ -234,7 +249,7 @@ void QMenuPrivate::updateActionRects() const } int max_column_width = 0, - dh = popupGeometry(QApplication::desktop()->screenNumber(q)).height(), + dh = popupGeometry(q).height(), y = 0; QStyle *style = q->style(); QStyleOption opt; @@ -744,7 +759,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc if (newScrollFlags & QMenuScroller::ScrollUp) newOffset -= vmargin; - QRect screen = popupGeometry(QApplication::desktop()->screenNumber(q)); + QRect screen = popupGeometry(q); const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q); if (q->height() < screen.height()-(desktopFrame*2)-1) { QRect geom = q->geometry(); @@ -1789,7 +1804,15 @@ void QMenu::popup(const QPoint &p, QAction *atAction) d->updateActionRects(); QPoint pos = p; QSize size = sizeHint(); - QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); + QRect screen; +#ifndef QT_NO_GRAPHICSVIEW + bool isEmbedded = d->nearestGraphicsProxyWidget(this); + if (isEmbedded) + screen = d->popupGeometry(this); + else +#endif + screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); + const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this); bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); #ifdef QT_KEYPAD_NAVIGATION @@ -2927,7 +2950,7 @@ void QMenu::internalDelayedPopup() QPoint pos(rightPos); QMenu *caused = qobject_cast(d->activeMenu->d_func()->causedPopup.widget); - const QRect availGeometry(d->popupGeometry(QApplication::desktop()->screenNumber(caused))); + const QRect availGeometry(d->popupGeometry(caused)); if (isRightToLeft()) { pos = leftPos; if ((caused && caused->x() < x()) || pos.x() < availGeometry.left()) { diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 9c4f260..6a8e4b0 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -192,7 +192,8 @@ public: mutable QVector actionRects; mutable QWidgetList widgetItems; void updateActionRects() const; - QRect popupGeometry(int screen=-1) const; + QRect popupGeometry(const QWidget *widget) const; + QRect popupGeometry(int screen = -1) const; mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 1352e1b..eb34336 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -590,7 +590,7 @@ void QPushButtonPrivate::_q_popupPressed() int x = globalPos.x(); int y = globalPos.y(); if (horizontal) { - if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->height()) { + if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->availableGeometry(q).height()) { y += rect.height(); } else { y -= menuSize.height(); @@ -598,7 +598,7 @@ void QPushButtonPrivate::_q_popupPressed() if (q->layoutDirection() == Qt::RightToLeft) x += rect.width() - menuSize.width(); } else { - if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->width()) + if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->availableGeometry(q).width()) x += rect.width(); else x -= menuSize.width(); -- cgit v0.12 From 6c1388ee5a3c4796d7ce09f0cbbc1700ab574ce4 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 20 Oct 2009 10:39:42 +0200 Subject: Fixed wrong scrolling in QListView with hidden rows in ListMode The flow positions in ScrollPerItem mode did not take the hidden rows into account when configuring the vertical scroll bar. A mapping between the scroll bar value and the flow position has been added. Auto-test included. Task-number: QTBUG-2233 Reviewed-by: Thierry --- src/gui/itemviews/qlistview.cpp | 24 +++++++++++++++++------- src/gui/itemviews/qlistview_p.h | 1 + tests/auto/qlistview/tst_qlistview.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 1d9b6e0..88002e0 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1900,7 +1900,7 @@ void QListModeViewBase::updateVerticalScrollBar(const QSize &step) if (verticalScrollMode() == QAbstractItemView::ScrollPerItem && ((flow() == QListView::TopToBottom && !isWrapping()) || (flow() == QListView::LeftToRight && isWrapping()))) { - const int steps = (flow() == QListView::TopToBottom ? flowPositions : segmentPositions).count() - 1; + const int steps = (flow() == QListView::TopToBottom ? scrollValueMap : segmentPositions).count() - 1; if (steps > 0) { const int pageSteps = perItemScrollingPageSteps(viewport()->height(), contentsSize.height(), isWrapping()); verticalScrollBar()->setSingleStep(1); @@ -1939,7 +1939,7 @@ int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hi bool above, bool below, const QRect &area, const QRect &rect) const { if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { - int value = qBound(0, verticalScrollBar()->value(), flowPositions.count() - 1); + int value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()), flowPositions.count() - 1); if (above) hint = QListView::PositionAtTop; else if (below) @@ -1986,9 +1986,9 @@ int QListModeViewBase::verticalOffset() const } } else if (flow() == QListView::TopToBottom && !flowPositions.isEmpty()) { int value = verticalScrollBar()->value(); - if (value > flowPositions.count()) + if (value > scrollValueMap.count()) return 0; - return flowPositions.at(value) - spacing(); + return flowPositions.at(scrollValueMap.at(value)) - spacing(); } } return QCommonListViewBase::verticalOffset(); @@ -2043,8 +2043,8 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) if (vertical && flow() == QListView::TopToBottom && dy != 0) { int currentValue = qBound(0, verticalValue, max); int previousValue = qBound(0, currentValue + dy, max); - int currentCoordinate = flowPositions.at(currentValue); - int previousCoordinate = flowPositions.at(previousValue); + int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue)); + int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue)); dy = previousCoordinate - currentCoordinate; } else if (horizontal && flow() == QListView::LeftToRight && dx != 0) { int currentValue = qBound(0, horizontalValue, max); @@ -2113,6 +2113,7 @@ QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info) segmentPositions.clear(); segmentStartRows.clear(); segmentExtents.clear(); + scrollValueMap.clear(); x = info.bounds.left() + info.spacing; y = info.bounds.top() + info.spacing; segmentPositions.append(info.flow == QListView::LeftToRight ? y : x); @@ -2204,6 +2205,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) deltaSegPosition = 0; } // save the flow position of this item + scrollValueMap.append(flowPositions.count()); flowPositions.append(flowPosition); // prepare for the next item deltaSegPosition = qMax(deltaSegHint, deltaSegPosition); @@ -2229,6 +2231,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) // if it is the last batch, save the end of the segments if (info.last == info.max) { segmentExtents.append(flowPosition); + scrollValueMap.append(flowPositions.count()); flowPositions.append(flowPosition); segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : INT_MAX); } @@ -2306,7 +2309,14 @@ QRect QListModeViewBase::mapToViewport(const QRect &rect) const int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wrap) const { - const QVector positions = (wrap ? segmentPositions : flowPositions); + QVector positions; + if (wrap) + positions = segmentPositions; + else { + positions.reserve(scrollValueMap.size()); + foreach (int itemShown, scrollValueMap) + positions.append(flowPositions.at(itemShown)); + } if (positions.isEmpty() || bounds <= length) return positions.count(); if (uniformItemSizes()) { diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index b6785da..de4c7f3 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -205,6 +205,7 @@ public: QVector segmentPositions; QVector segmentStartRows; QVector segmentExtents; + QVector scrollValueMap; // used when laying out in batches int batchSavedPosition; diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 3ee6889..ed02317 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -117,6 +117,7 @@ private slots: void shiftSelectionWithNonUniformItemSizes(); void clickOnViewportClearsSelection(); void task262152_setModelColumnNavigate(); + void taskQTBUG_2233_scrollHiddenRows(); }; // Testing get/set functions @@ -1790,7 +1791,31 @@ void tst_QListView::task262152_setModelColumnNavigate() } +void tst_QListView::taskQTBUG_2233_scrollHiddenRows() +{ + const int rowCount = 200; + + QListView view; + QStringListModel model(&view); + QStringList list; + for (int i = 0; i < rowCount; ++i) + list << QString::fromAscii("Item %1").arg(i); + + model.setStringList(list); + view.setModel(&model); + view.setViewMode(QListView::ListMode); + view.setFlow(QListView::TopToBottom); + for (int i = 0; i < rowCount / 2; ++i) + view.setRowHidden(2 * i, true); + view.resize(250, 130); + for (int i = 0; i < 10; ++i) { + view.verticalScrollBar()->setValue(i); + QModelIndex index = view.indexAt(QPoint(20,0)); + QVERIFY(index.isValid()); + QCOMPARE(index.row(), 2 * i + 1); + } +} QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12 From 63b574ee1539b34ac7df890a7941320deb1c258e Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 20 Oct 2009 11:52:38 +0200 Subject: Fix bug in embedded dialog demo with tab focus. On embedded dialog pressing tab stop changing the focus when the focus was given to QFontComboBox. It's because QFontComboBox embed a QLineEdit in order to allow editing. But this QLineEdit is a focus proxy so we need to special case that. The logic is the same in QApplication. Be careful when changing one of them. Task-number:QTBUG-4818 Reviewed-by:jan-arve Reviewed-by:ogoffart --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 15 ++++++-- src/gui/kernel/qapplication.cpp | 1 + .../tst_qgraphicsproxywidget.cpp | 45 +++++++++++++++++++++- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index b7a3962..64c51ad 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -57,6 +57,9 @@ #include #include #include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -86,7 +89,9 @@ QT_BEGIN_NAMESPACE of embedded widgets through creating a child proxy for each popup. This means that when an embedded QComboBox shows its popup list, a new QGraphicsProxyWidget is created automatically, embedding the popup, and - positioning it correctly. + positioning it correctly. This only works if the popup is child of the + embedded widget (for example QToolButton::setMenu() requires the QMenu instance + to be child of the QToolButton). \section1 Embedding a Widget with QGraphicsProxyWidget @@ -184,6 +189,7 @@ QT_BEGIN_NAMESPACE */ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); +extern bool qt_tab_all_widgets; /*! \internal @@ -369,6 +375,7 @@ QVariant QGraphicsProxyWidgetPrivate::inputMethodQueryHelper(Qt::InputMethodQuer /*! \internal + Some of the logic is shared with QApplicationPrivate::focusNextPrevChild_helper */ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) const { @@ -382,14 +389,16 @@ QWidget *QGraphicsProxyWidgetPrivate::findFocusChild(QWidget *child, bool next) child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; if ((next && child == widget) || (!next && child == widget->d_func()->focus_prev)) { return 0; - } + } } QWidget *oldChild = child; + uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus; do { if (child->isEnabled() && child->isVisibleTo(widget) - && (child->focusPolicy() & Qt::TabFocus)) { + && (child->focusPolicy() & focus_flag == focus_flag) + && !(child->d_func()->extra && child->d_func()->extra->focus_proxy)) { return child; } child = next ? child->d_func()->focus_next : child->d_func()->focus_prev; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index f48c551..c4249d9 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2495,6 +2495,7 @@ void QApplication::setActiveWindow(QWidget* act) /*!internal * Helper function that returns the new focus widget, but does not set the focus reason. * Returns 0 if a new focus widget could not be found. + * Shared with QGraphicsProxyWidgetPrivate::findFocusChild() */ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next) { diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 2426ce9..9269164 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -2007,8 +2007,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit1->setText("QLineEdit 1"); QLineEdit *edit2 = new QLineEdit; edit2->setText("QLineEdit 2"); + QFontComboBox *fontComboBox = new QFontComboBox; QVBoxLayout *vlayout = new QVBoxLayout; vlayout->addWidget(edit1); + vlayout->addWidget(fontComboBox); vlayout->addWidget(edit2); QGroupBox *box = new QGroupBox("QGroupBox"); @@ -2020,8 +2022,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit1_2->setText("QLineEdit 1_2"); QLineEdit *edit2_2 = new QLineEdit; edit2_2->setText("QLineEdit 2_2"); + QFontComboBox *fontComboBox2 = new QFontComboBox; vlayout = new QVBoxLayout; vlayout->addWidget(edit1_2); + vlayout->addWidget(fontComboBox2); vlayout->addWidget(edit2_2); QGroupBox *box_2 = new QGroupBox("QGroupBox 2"); @@ -2062,8 +2066,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() EventSpy eventSpy(edit1); EventSpy eventSpy2(edit2); + EventSpy eventSpy3(fontComboBox); EventSpy eventSpy1_2(edit1_2); EventSpy eventSpy2_2(edit2_2); + EventSpy eventSpy2_3(fontComboBox2); EventSpy eventSpyBox(box); // Tab into group box @@ -2084,11 +2090,24 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy.counts[QEvent::FocusOut], 0); + // Tab to the font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); + QApplication::processEvents(); + fontComboBox->hasFocus(); + QVERIFY(!edit2->hasFocus()); + QCOMPARE(eventSpy3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 0); + QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1); + // Tab into line edit 2 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); QApplication::processEvents(); edit2->hasFocus(); QVERIFY(!edit1->hasFocus()); + QCOMPARE(eventSpy2.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2.counts[QEvent::FocusOut], 0); + QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 1); QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1); @@ -2106,6 +2125,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 0); + // Tab into right font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); + QApplication::processEvents(); + QVERIFY(!edit1_2->hasFocus()); + fontComboBox2->hasFocus(); + QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 0); + // Tab into right bottom line edit QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); QApplication::processEvents(); @@ -2113,6 +2142,8 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() edit2_2->hasFocus(); QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1); + QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 1); QCOMPARE(eventSpy2_2.counts[QEvent::FocusIn], 1); QCOMPARE(eventSpy2_2.counts[QEvent::FocusOut], 0); @@ -2129,6 +2160,12 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QVERIFY(!rightDial->hasFocus()); edit2_2->hasFocus(); + // Backtab into the right font combobox + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); + QApplication::processEvents(); + QVERIFY(!edit2_2->hasFocus()); + fontComboBox2->hasFocus(); + // Backtab into line edit 1 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); QApplication::processEvents(); @@ -2147,10 +2184,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets() QVERIFY(!rightDial->hasFocus()); edit2->hasFocus(); - // Backtab into line edit 1 + // Backtab into the font combobox QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); QApplication::processEvents(); QVERIFY(!edit2->hasFocus()); + fontComboBox->hasFocus(); + + // Backtab into line edit 1 + QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); + QApplication::processEvents(); + QVERIFY(!fontComboBox->hasFocus()); edit1->hasFocus(); // Backtab into line box -- cgit v0.12 From 27df4f3fe6c290f22d509f677e46c7096156817b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:46:43 +0200 Subject: Make the total duration of animation be 0 if duration is 0 --- src/corelib/animation/qabstractanimation.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index c775a00..e83fad7 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -328,9 +328,9 @@ int QUnifiedTimer::closestPauseAnimationTimeToFinish() int timeToFinish; if (animation->direction() == QAbstractAnimation::Forward) - timeToFinish = animation->totalDuration() - QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + timeToFinish = animation->duration() - animation->currentTime(); else - timeToFinish = QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + timeToFinish = animation->currentTime(); if (timeToFinish < closestTimeToFinish) closestTimeToFinish = timeToFinish; @@ -648,13 +648,13 @@ int QAbstractAnimation::currentLoop() const */ int QAbstractAnimation::totalDuration() const { - Q_D(const QAbstractAnimation); - if (d->loopCount < 0) - return -1; int dura = duration(); - if (dura == -1) + if (dura <= 0) + return dura; + int loopcount = loopCount(); + if (loopcount < 0) return -1; - return dura * d->loopCount; + return dura * loopcount; } /*! @@ -685,7 +685,7 @@ void QAbstractAnimation::setCurrentTime(int msecs) // Calculate new time and loop. int dura = duration(); - int totalDura = (d->loopCount < 0 || dura == -1) ? -1 : dura * d->loopCount; + int totalDura = dura <= 0 ? dura : ((d->loopCount < 0) ? -1 : dura * d->loopCount); if (totalDura != -1) msecs = qMin(totalDura, msecs); d->totalCurrentTime = msecs; -- cgit v0.12 From 8b0e59706f0d7a68446b6ff5c646e2bbdef5f496 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:48:24 +0200 Subject: Make the default duration of pause animations 250ms --- src/corelib/animation/qpauseanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index d90f001..21e5b08 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE class QPauseAnimationPrivate : public QAbstractAnimationPrivate { public: - QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(0) + QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(250) { isPause = true; } @@ -114,6 +114,7 @@ QPauseAnimation::~QPauseAnimation() \brief the duration of the pause. The duration of the pause. The duration should not be negative. + The default duration is 250 milliseconds. */ int QPauseAnimation::duration() const { -- cgit v0.12 From 462b2eae2386d22709943187820ec3f071399682 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 12:53:04 +0200 Subject: adding autotests --- tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 51ef2da..7dd17e5 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -130,6 +130,7 @@ private slots: void valueChanged(); void twoAnimations(); void deletedInUpdateCurrentTime(); + void totalDuration(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -1199,5 +1200,18 @@ void tst_QPropertyAnimation::deletedInUpdateCurrentTime() QCOMPARE(o.value(), 1000); } +void tst_QPropertyAnimation::totalDuration() +{ + QPropertyAnimation anim; + QCOMPARE(anim.totalDuration(), 250); + anim.setLoopCount(2); + QCOMPARE(anim.totalDuration(), 2*250); + anim.setLoopCount(-1); + QCOMPARE(anim.totalDuration(), -1); + anim.setDuration(0); + QCOMPARE(anim.totalDuration(), 0); +} + + QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" -- cgit v0.12 From e0aeecfa8cc41a476bef070b349683be9aec2243 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 13:19:33 +0200 Subject: QPauseAnimation autotests fixed --- tests/auto/qpauseanimation/tst_qpauseanimation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp index 62b43c4..b11efa0 100644 --- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp @@ -169,7 +169,7 @@ void tst_QPauseAnimation::noTimerUpdates() animation.start(); QTest::qWait(animation.totalDuration() + 100); QVERIFY(animation.state() == QAbstractAnimation::Stopped); - QCOMPARE(animation.m_updateCurrentTimeCount, 2); + QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount); timer->setConsistentTiming(false); } @@ -399,6 +399,7 @@ void tst_QPauseAnimation::multipleSequentialGroups() void tst_QPauseAnimation::zeroDuration() { TestablePauseAnimation animation; + animation.setDuration(0); animation.start(); QTest::qWait(animation.totalDuration() + 100); QVERIFY(animation.state() == QAbstractAnimation::Stopped); -- cgit v0.12 From e64b5fa1312f42fa6377e28c11f8aa3a3413280f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 13:20:31 +0200 Subject: Fixed a bug in that could unregister not-registered animations --- src/corelib/animation/qabstractanimation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index e83fad7..0d5f278 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -278,11 +278,11 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) { - unregisterRunningAnimation(animation); - if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer) return; + unregisterRunningAnimation(animation); + int idx = animations.indexOf(animation); if (idx != -1) { animations.removeAt(idx); @@ -318,6 +318,7 @@ void QUnifiedTimer::unregisterRunningAnimation(QAbstractAnimation *animation) runningPauseAnimations.removeOne(animation); else runningLeafAnimations--; + Q_ASSERT(runningLeafAnimations >= 0); } int QUnifiedTimer::closestPauseAnimationTimeToFinish() -- cgit v0.12 From 77f055ab9474ec4d3311884c293af7ee4a2a7cb3 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 15:52:38 +0200 Subject: Fixed QTreeView trying to animate when parent item has no child We now check that the item has children before animating. Reviewed-by: Alexis --- src/gui/itemviews/qtreeview.cpp | 6 +++--- tests/auto/qtreeview/tst_qtreeview.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 210534e..d597f5c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2908,15 +2908,15 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) layout(item); q->setState(oldState); + if (model->canFetchMore(index)) + model->fetchMore(index); if (emitSignal) { emit q->expanded(index); #ifndef QT_NO_ANIMATION - if (animationsEnabled) + if (animationsEnabled && model->hasChildren(index)) beginAnimatedOperation(); #endif //QT_NO_ANIMATION } - if (model->canFetchMore(index)) - model->fetchMore(index); } void QTreeViewPrivate::collapse(int item, bool emitSignal) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 91b2cc5..da58725 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -172,6 +172,7 @@ private slots: void expandAndCollapse_data(); void expandAndCollapse(); void expandAndCollapseAll(); + void expandWithNoChildren(); void keyboardNavigation(); void headerSections(); void moveCursor_data(); @@ -1548,6 +1549,19 @@ void tst_QTreeView::expandAndCollapseAll() // QCOMPARE(collapsedSpy.count(), count); } +void tst_QTreeView::expandWithNoChildren() +{ + QTreeView tree; + QStandardItemModel model(1,1); + tree.setModel(&model); + tree.setAnimated(true); + tree.doItemsLayout(); + //this test should not output warnings + tree.expand(model.index(0,0)); +} + + + void tst_QTreeView::keyboardNavigation() { const int rows = 10; -- cgit v0.12 From d4dd08918082372d3df7be2d3a6671cbd7bc7fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 20 Oct 2009 15:52:56 +0200 Subject: Add some docs that explicitly mentions how we handle cycles in the tree This was reported for QGraphicsAnchorLayout, but affects all QGraphicsLayout subclasses. However, since it is not even handled properly in QGraphicsItem::setParentItem() it should be fine that we don't try to deal with this issue. Thus, the layouts are "consistent" with graphics items when it comes to detection of cycles in the tree. --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 3 +++ src/gui/graphicsview/qgraphicsitem.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index c39e8a6..cb8ccc1 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -215,6 +215,9 @@ QGraphicsAnchorLayout::~QGraphicsAnchorLayout() The spacing can also be set manually by using QGraphicsAnchor::setSpacing() method. + Calling this function where \a firstItem or \a secondItem are ancestors of the layout have + undefined behaviour. + \sa addCornerAnchors(), addAnchors() */ QGraphicsAnchor * diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 45627f6..1ebee45 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1511,6 +1511,8 @@ const QGraphicsObject *QGraphicsItem::toGraphicsObject() const the parent. You should not \l{QGraphicsScene::addItem()}{add} the item to the scene yourself. + Calling this function on an item that is an ancestor of \a parent have undefined behaviour. + \sa parentItem(), childItems() */ void QGraphicsItem::setParentItem(QGraphicsItem *parent) -- cgit v0.12 From cbca69bb0c7e3c42bf7d2d964057f38263de0553 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 20 Oct 2009 15:59:40 +0200 Subject: fix for QTreeView to not animate if there are no visible children --- src/gui/itemviews/qtreeview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index d597f5c..f37d8c7 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2913,7 +2913,7 @@ void QTreeViewPrivate::expand(int item, bool emitSignal) if (emitSignal) { emit q->expanded(index); #ifndef QT_NO_ANIMATION - if (animationsEnabled && model->hasChildren(index)) + if (animationsEnabled) beginAnimatedOperation(); #endif //QT_NO_ANIMATION } @@ -3005,10 +3005,12 @@ void QTreeViewPrivate::beginAnimatedOperation() animatedOperation.setEndValue(animatedOperation.top() + h); } - animatedOperation.after = renderTreeToPixmapForAnimation(rect); + if (!rect.isEmpty()) { + animatedOperation.after = renderTreeToPixmapForAnimation(rect); - q->setState(QAbstractItemView::AnimatingState); - animatedOperation.start(); //let's start the animation + q->setState(QAbstractItemView::AnimatingState); + animatedOperation.start(); //let's start the animation + } } void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const -- cgit v0.12 From 6f5d69a0400229b0637242c2457b8cb88090785f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 20 Oct 2009 15:30:59 +0200 Subject: Extended commit 6c1388ee for LeftToRight flow Auto-test updated. As a bonus, stabilized tst_QListView::task262152_setModelColumnNavigate. Reviewed-by: Thierry --- src/gui/itemviews/qlistview.cpp | 12 ++++++------ tests/auto/qlistview/tst_qlistview.cpp | 30 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 88002e0..b6e0ab7 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1921,7 +1921,7 @@ void QListModeViewBase::updateHorizontalScrollBar(const QSize &step) if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem && ((flow() == QListView::TopToBottom && isWrapping()) || (flow() == QListView::LeftToRight && !isWrapping()))) { - int steps = (flow() == QListView::TopToBottom ? segmentPositions : flowPositions).count() - 1; + int steps = (flow() == QListView::TopToBottom ? segmentPositions : scrollValueMap).count() - 1; if (steps > 0) { const int pageSteps = perItemScrollingPageSteps(viewport()->width(), contentsSize.width(), isWrapping()); horizontalScrollBar()->setSingleStep(1); @@ -1966,8 +1966,8 @@ int QListModeViewBase::horizontalOffset() const return (isRightToLeft() ? maximum - position : position); } } else if (flow() == QListView::LeftToRight && !flowPositions.isEmpty()) { - int position = flowPositions.at(horizontalScrollBar()->value()); - int maximum = flowPositions.at(horizontalScrollBar()->maximum()); + int position = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->value())); + int maximum = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->maximum())); return (isRightToLeft() ? maximum - position : position); } } @@ -2000,7 +2000,7 @@ int QListModeViewBase::horizontalScrollToValue(int index, QListView::ScrollHint if (horizontalScrollMode() != QAbstractItemView::ScrollPerItem) return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect); - int value = qBound(0, horizontalScrollBar()->value(), flowPositions.count() - 1); + int value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1); if (leftOf) hint = QListView::PositionAtTop; else if (rightOf) @@ -2049,8 +2049,8 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) } else if (horizontal && flow() == QListView::LeftToRight && dx != 0) { int currentValue = qBound(0, horizontalValue, max); int previousValue = qBound(0, currentValue + dx, max); - int currentCoordinate = flowPositions.at(currentValue); - int previousCoordinate = flowPositions.at(previousValue); + int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue)); + int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue)); dx = previousCoordinate - currentCoordinate; } } diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index ed02317..6e211ae 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -117,7 +117,8 @@ private slots: void shiftSelectionWithNonUniformItemSizes(); void clickOnViewportClearsSelection(); void task262152_setModelColumnNavigate(); - void taskQTBUG_2233_scrollHiddenRows(); + void taskQTBUG_2233_scrollHiddenItems_data(); + void taskQTBUG_2233_scrollHiddenItems(); }; // Testing get/set functions @@ -1781,18 +1782,27 @@ void tst_QListView::task262152_setModelColumnNavigate() view.setModelColumn(1); view.show(); - QTest::qWait(30); + QTest::qWait(100); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(10); + QTest::qWait(100); QCOMPARE(view.currentIndex(), model.index(1,1)); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(10); + QTest::qWait(100); QCOMPARE(view.currentIndex(), model.index(2,1)); } -void tst_QListView::taskQTBUG_2233_scrollHiddenRows() +void tst_QListView::taskQTBUG_2233_scrollHiddenItems_data() { + QTest::addColumn("flow"); + + QTest::newRow("TopToBottom") << static_cast(QListView::TopToBottom); + QTest::newRow("LeftToRight") << static_cast(QListView::LeftToRight); +} + +void tst_QListView::taskQTBUG_2233_scrollHiddenItems() +{ + QFETCH(int, flow); const int rowCount = 200; QListView view; @@ -1804,14 +1814,16 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenRows() model.setStringList(list); view.setModel(&model); view.setViewMode(QListView::ListMode); - view.setFlow(QListView::TopToBottom); for (int i = 0; i < rowCount / 2; ++i) view.setRowHidden(2 * i, true); - view.resize(250, 130); + view.setFlow(static_cast(flow)); + view.resize(130, 130); for (int i = 0; i < 10; ++i) { - view.verticalScrollBar()->setValue(i); - QModelIndex index = view.indexAt(QPoint(20,0)); + (view.flow() == QListView::TopToBottom + ? view.verticalScrollBar() + : view.horizontalScrollBar())->setValue(i); + QModelIndex index = view.indexAt(QPoint(0,0)); QVERIFY(index.isValid()); QCOMPARE(index.row(), 2 * i + 1); } -- cgit v0.12 From af17ea048179ea0c21a897f803e79f825a9d13b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 20 Oct 2009 13:04:56 +0200 Subject: Make adjustSize work even if there is a pending LayoutRequest event. The original report was that the customer did resize(main.sizeHint()) instead of the main.adjustSize(); Note that resize(main.sizeHint() still does not work. However, calling main.adjustSize() should now do what the original reporter wanted. The problem was that the resize did not work, because at the point of the resize the minimumHeight of main was still 22 (8+6+8), and we tried to resize it with a new height of 10. The resize would bound the height up to 22, and the main widget would then get a size of (200x22). The reason why it still had a minimumHeight of 22 was that it was the minimumSize of the previous layout configuration. Unfortunately the new minimumSize of the widget hadn't been updated yet because there was a LayoutRequest event in the queue that hadn't been processed yet. (This LayoutRequest was triggered by that we called invalidate() from hide()). Thus, processing the event queue immediately after the hide() could also have been a workaround for this issue. There is no really good fix for this issue (and it does not seem to be a common problem) without introducing a risk for regressions. Due to that we therefore decided to provide a fix in QWidget::adjustSize(). Reviewed-by: paul --- src/gui/kernel/qwidget.cpp | 4 ++++ tests/auto/qlayout/tst_qlayout.cpp | 28 ++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7dc3ae9..64b18ce 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7726,6 +7726,10 @@ void QWidget::adjustSize() Q_D(QWidget); ensurePolished(); QSize s = d->adjustedSize(); + + if (d->layout) + d->layout->activate(); + if (s.isValid()) resize(s); } diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp index 9d6110d..efe14c3 100644 --- a/tests/auto/qlayout/tst_qlayout.cpp +++ b/tests/auto/qlayout/tst_qlayout.cpp @@ -83,6 +83,7 @@ private slots: void layoutItemRect(); void warnIfWrongParent(); void controlTypes(); + void adjustSizeShouldMakeSureLayoutIsActivated(); }; tst_QLayout::tst_QLayout() @@ -110,8 +111,8 @@ void tst_QLayout::getSetCheck() class SizeHinterFrame : public QFrame { public: - SizeHinterFrame(const QSize &s) - : QFrame(0), sh(s) { + SizeHinterFrame(const QSize &sh, const QSize &msh = QSize()) + : QFrame(0), sh(sh), msh(msh) { setFrameStyle(QFrame::Box | QFrame::Plain); } @@ -119,9 +120,11 @@ public: void setSizeHint(const QSize &s) { sh = s; } QSize sizeHint() const { return sh; } + QSize minimumSizeHint() const { return msh; } private: QSize sh; + QSize msh; }; @@ -333,5 +336,26 @@ void tst_QLayout::controlTypes() } +void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() +{ + QWidget main; + + QVBoxLayout *const layout = new QVBoxLayout(&main); + layout->setMargin(0); + SizeHinterFrame *frame = new SizeHinterFrame(QSize(200, 10), QSize(200, 8)); + frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + layout->addWidget(frame); + + SizeHinterFrame *frame2 = new SizeHinterFrame(QSize(200, 10), QSize(200, 8)); + frame2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + layout->addWidget(frame2); + + main.show(); + + frame2->hide(); + main.adjustSize(); + QCOMPARE(main.size(), QSize(200, 10)); +} + QTEST_MAIN(tst_QLayout) #include "tst_qlayout.moc" -- cgit v0.12 From a6b0316c2418a90cb754132a678c38027009e875 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 20 Oct 2009 15:33:29 +0200 Subject: Moved private function to test which graphic items is in front of the other This function is moved to graphicsitem private because it is needed by multi-touch event handling and is not specific to bsptreeindex. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- src/gui/graphicsview/qgraphicsitem_p.h | 68 +++++++++++++++++++++- .../graphicsview/qgraphicsscenebsptreeindex.cpp | 68 +--------------------- .../graphicsview/qgraphicsscenebsptreeindex_p.h | 2 - tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 43 ++++++++++++++ 5 files changed, 113 insertions(+), 70 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 1ebee45..4b2ff52 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4737,7 +4737,7 @@ bool QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const { if (!item) return false; - return QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(item, this) + return qt_closestItemFirst(item, this) && qt_QGraphicsItem_isObscured(this, item, boundingRect()); } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 6550362..38145ac 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -623,6 +623,72 @@ public: /*! + Returns true if \a item1 is on top of \a item2. + The items dont need to be siblings. + + \internal +*/ +inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + // Siblings? Just check their z-values. + const QGraphicsItemPrivate *d1 = item1->d_ptr.data(); + const QGraphicsItemPrivate *d2 = item2->d_ptr.data(); + if (d1->parent == d2->parent) + return qt_closestLeaf(item1, item2); + + // Find common ancestor, and each item's ancestor closest to the common + // ancestor. + int item1Depth = d1->depth(); + int item2Depth = d2->depth(); + const QGraphicsItem *p = item1; + const QGraphicsItem *t1 = item1; + while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { + if (p == item2) { + // item2 is one of item1's ancestors; item1 is on top + return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t1 = p; + --item1Depth; + } + p = item2; + const QGraphicsItem *t2 = item2; + while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { + if (p == item1) { + // item1 is one of item2's ancestors; item1 is not on top + return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); + } + t2 = p; + --item2Depth; + } + + // item1Ancestor is now at the same level as item2Ancestor, but not the same. + const QGraphicsItem *a1 = t1; + const QGraphicsItem *a2 = t2; + while (a1) { + const QGraphicsItem *p1 = a1; + const QGraphicsItem *p2 = a2; + a1 = a1->parentItem(); + a2 = a2->parentItem(); + if (a1 && a1 == a2) + return qt_closestLeaf(p1, p2); + } + + // No common ancestor? Then just compare the items' toplevels directly. + return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); +} + +/*! + Returns true if \a item2 is on top of \a item1. + The items dont need to be siblings. + + \internal +*/ +inline bool qt_closestItemLast(const QGraphicsItem *item1, const QGraphicsItem *item2) +{ + return qt_closestItemFirst(item2, item1); +} + +/*! \internal */ inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) @@ -642,7 +708,7 @@ inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item /*! \internal */ -static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) +inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) { return qt_closestLeaf(item2, item1); } /* diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index e21183a..47ae3f1 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -405,70 +405,6 @@ QList QGraphicsSceneBspTreeIndexPrivate::estimateItems(const QR } /*! - Returns true if \a item1 is on top of \a item2. - - \internal -*/ -bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - // Siblings? Just check their z-values. - const QGraphicsItemPrivate *d1 = item1->d_ptr.data(); - const QGraphicsItemPrivate *d2 = item2->d_ptr.data(); - if (d1->parent == d2->parent) - return qt_closestLeaf(item1, item2); - - // Find common ancestor, and each item's ancestor closest to the common - // ancestor. - int item1Depth = d1->depth(); - int item2Depth = d2->depth(); - const QGraphicsItem *p = item1; - const QGraphicsItem *t1 = item1; - while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { - if (p == item2) { - // item2 is one of item1's ancestors; item1 is on top - return !(t1->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t1 = p; - --item1Depth; - } - p = item2; - const QGraphicsItem *t2 = item2; - while (item2Depth > item1Depth && (p = p->d_ptr->parent)) { - if (p == item1) { - // item1 is one of item2's ancestors; item1 is not on top - return (t2->d_ptr->flags & QGraphicsItem::ItemStacksBehindParent); - } - t2 = p; - --item2Depth; - } - - // item1Ancestor is now at the same level as item2Ancestor, but not the same. - const QGraphicsItem *a1 = t1; - const QGraphicsItem *a2 = t2; - while (a1) { - const QGraphicsItem *p1 = a1; - const QGraphicsItem *p2 = a2; - a1 = a1->parentItem(); - a2 = a2->parentItem(); - if (a1 && a1 == a2) - return qt_closestLeaf(p1, p2); - } - - // No common ancestor? Then just compare the items' toplevels directly. - return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); -} - -/*! - Returns true if \a item2 is on top of \a item1. - - \internal -*/ -bool QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) -{ - return closestItemFirst_withoutCache(item2, item1); -} - -/*! Sort a list of \a itemList in a specific \a order and use the cache if requested. \internal @@ -495,9 +431,9 @@ void QGraphicsSceneBspTreeIndexPrivate::sortItems(QList *itemLi } } else { if (order == Qt::DescendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemFirst_withoutCache); + qSort(itemList->begin(), itemList->end(), qt_closestItemFirst); } else if (order == Qt::AscendingOrder) { - qSort(itemList->begin(), itemList->end(), closestItemLast_withoutCache); + qSort(itemList->begin(), itemList->end(), qt_closestItemLast); } } } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 0a86bb7..c130190 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -145,8 +145,6 @@ public: QList estimateItems(const QRectF &, Qt::SortOrder, bool b = false); static void climbTree(QGraphicsItem *item, int *stackingOrder); - static bool closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); - static bool closestItemLast_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2); static inline bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2) { diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 0a6f60e..dcad8e1 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -398,6 +398,7 @@ private slots: void modality_mouseGrabber(); void modality_clickFocus(); void modality_keyEvents(); + void itemIsInFront(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -9541,5 +9542,47 @@ void tst_QGraphicsItem::modality_keyEvents() QCOMPARE(rect1Spy.counts[QEvent::KeyRelease], 0); } +void tst_QGraphicsItem::itemIsInFront() +{ + QGraphicsScene scene; + QGraphicsRectItem *rect1 = new QGraphicsRectItem; + rect1->setData(0, "rect1"); + scene.addItem(rect1); + + QGraphicsRectItem *rect1child1 = new QGraphicsRectItem(rect1); + rect1child1->setZValue(1); + rect1child1->setData(0, "rect1child1"); + + QGraphicsRectItem *rect1child2 = new QGraphicsRectItem(rect1); + rect1child2->setParentItem(rect1); + rect1child2->setData(0, "rect1child2"); + + QGraphicsRectItem *rect1child1_1 = new QGraphicsRectItem(rect1child1); + rect1child1_1->setData(0, "rect1child1_1"); + + QGraphicsRectItem *rect1child1_2 = new QGraphicsRectItem(rect1child1); + rect1child1_2->setFlag(QGraphicsItem::ItemStacksBehindParent); + rect1child1_2->setData(0, "rect1child1_2"); + + QGraphicsRectItem *rect2 = new QGraphicsRectItem; + rect2->setData(0, "rect2"); + scene.addItem(rect2); + + QGraphicsRectItem *rect2child1 = new QGraphicsRectItem(rect2); + rect2child1->setData(0, "rect2child1"); + + QCOMPARE(qt_closestItemFirst(rect1, rect1), false); + QCOMPARE(qt_closestItemFirst(rect1, rect2), false); + QCOMPARE(qt_closestItemFirst(rect1child1, rect2child1), false); + QCOMPARE(qt_closestItemFirst(rect1child1, rect1child2), true); + QCOMPARE(qt_closestItemFirst(rect1child1_1, rect1child2), true); + QCOMPARE(qt_closestItemFirst(rect1child1_1, rect1child1), true); + QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1child2), true); + QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1child1), false); + QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1), true); + QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2), false); + QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2child1), false); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From ed2ff6553ec481bd489df096d5ec1cdb545ebb33 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 20 Oct 2009 16:12:55 +0200 Subject: Optimization in qt_closestItemFirst private function No need to traverse the tree again to access the topLevelItem in case there is no common ancestor. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem_p.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 38145ac..8621b11 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -662,19 +662,18 @@ inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem } // item1Ancestor is now at the same level as item2Ancestor, but not the same. - const QGraphicsItem *a1 = t1; - const QGraphicsItem *a2 = t2; - while (a1) { - const QGraphicsItem *p1 = a1; - const QGraphicsItem *p2 = a2; - a1 = a1->parentItem(); - a2 = a2->parentItem(); - if (a1 && a1 == a2) - return qt_closestLeaf(p1, p2); + const QGraphicsItem *p1 = t1; + const QGraphicsItem *p2 = t2; + while (t1 && t1 != t2) { + p1 = t1; + p2 = t2; + t1 = t1->d_ptr->parent; + t2 = t2->d_ptr->parent; } - // No common ancestor? Then just compare the items' toplevels directly. - return qt_closestLeaf(t1->topLevelItem(), t2->topLevelItem()); + // in case we have a common ancestor, we compare the immediate children in the ancestor's path. + // otherwise we compare the respective items' topLevelItems directly. + return qt_closestLeaf(p1, p2); } /*! -- cgit v0.12 From 619d049371ac8a180de3d91140bf252f44c25dad Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 21 Oct 2009 10:15:19 +0200 Subject: Improve performance when starting a lot of animations We avoid stopping/starting the timer over and over again Patch suggested by Aaron. Reviewed-by: Aaron Kennedy --- src/corelib/animation/qabstractanimation.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 0d5f278..2f776d3 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -272,7 +272,8 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer); QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; animationsToStart << animation; - startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + if (!startStopAnimationTimer.isActive()) + startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } } @@ -290,7 +291,7 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) if (idx <= currentAnimationIdx) --currentAnimationIdx; - if (animations.isEmpty()) + if (animations.isEmpty() && !startStopAnimationTimer.isActive()) startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } else { animationsToStart.removeOne(animation); -- cgit v0.12 From a072ddb5072d837ff6d2ff1f09800e8e3917f034 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 21 Oct 2009 10:49:42 +0200 Subject: Fixes to the way animations are registered to the timer It could happen that an animation would be unregistered when it shouldn't. Reviewed-by: Leo Cunha --- src/corelib/animation/qabstractanimation.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 2f776d3..f83c2a1 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -279,11 +279,11 @@ void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopL void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) { + unregisterRunningAnimation(animation); + if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer) return; - unregisterRunningAnimation(animation); - int idx = animations.indexOf(animation); if (idx != -1) { animations.removeAt(idx); @@ -384,25 +384,20 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) QUnifiedTimer::instance()->ensureTimerUpdate(q); if (!guard) return; + //here we're sure that we were in running state before and that the + //animation is currently registered QUnifiedTimer::instance()->unregisterAnimation(q); break; case QAbstractAnimation::Running: { bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped; + QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); // this ensures that the value is updated now that the animation is running if (oldState == QAbstractAnimation::Stopped) { if (isTopLevel) // currentTime needs to be updated if pauseTimer is active QUnifiedTimer::instance()->ensureTimerUpdate(q); - if (!guard) - return; - } - - // test needed in case we stop in the setCurrentTime inside ensureTimerUpdate (zero duration) - if (state == QAbstractAnimation::Running) { - // register timer if our parent is not running - QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); } } break; @@ -415,7 +410,8 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) if (deleteWhenStopped) q->deleteLater(); - QUnifiedTimer::instance()->unregisterAnimation(q); + if (oldState == QAbstractAnimation::Running) + QUnifiedTimer::instance()->unregisterAnimation(q); if (dura == -1 || loopCount < 0 || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)) @@ -462,7 +458,8 @@ QAbstractAnimation::~QAbstractAnimation() QAbstractAnimation::State oldState = d->state; d->state = Stopped; emit stateChanged(oldState, d->state); - QUnifiedTimer::instance()->unregisterAnimation(this); + if (oldState == QAbstractAnimation::Running) + QUnifiedTimer::instance()->unregisterAnimation(this); } } -- cgit v0.12 From 7b09b0eda2f3e5bc34150669157287ccb85c8d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 20 Oct 2009 13:17:58 +0200 Subject: Group the spacing functions together, and add a sizePolicy property. Improve the documentation for size policy. --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 22 ++++++++++++++++------ src/gui/graphicsview/qgraphicsanchorlayout.h | 3 ++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index c39e8a6..c7d2bb7 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -118,16 +118,26 @@ QGraphicsAnchor::~QGraphicsAnchor() } /*! - Sets the size policy of the anchor to \a policy. + \property QGraphicsAnchor::sizePolicy + \brief the size policy for the QGraphicsAnchor. + + By setting the size policy on an anchor you can configure how the item can resize itself + from its preferred spacing. For instance, if the anchor has the size policy + QSizePolicy::Minimum, the spacing is the minimum size of the anchor. However, its size + can grow up to the anchors maximum size. If the default size policy is QSizePolicy::Fixed, + the anchor can neither grow or shrink, which means that the only size the anchor can have + is the spacing. QSizePolicy::Fixed is the default size policy. + QGraphicsAnchor always has a minimum spacing of 0 and a very large maximum spacing. + + \sa QGraphicsAnchor::spacing */ + void QGraphicsAnchor::setSizePolicy(QSizePolicy::Policy policy) { Q_D(QGraphicsAnchor); d->setSizePolicy(policy); } -/*! - Returns the size policy of the anchor. The default size policy is QSizePolicy::Fixed -*/ + QSizePolicy::Policy QGraphicsAnchor::sizePolicy() const { Q_D(const QGraphicsAnchor); @@ -136,12 +146,12 @@ QSizePolicy::Policy QGraphicsAnchor::sizePolicy() const /*! \property QGraphicsAnchor::spacing - \brief the space between items in the QGraphicsAnchorLayout. + \brief the preferred space between items in the QGraphicsAnchorLayout. Depending on the anchor type, the default spacing is either 0 or a value returned from the style. - \sa QGraphicsAnchorLayout::anchor() + \sa QGraphicsAnchorLayout::addAnchor() */ void QGraphicsAnchor::setSpacing(qreal spacing) { diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h index f09ac43..01c3a86 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout.h @@ -62,12 +62,13 @@ class Q_GUI_EXPORT QGraphicsAnchor : public QObject { Q_OBJECT Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing) + Q_PROPERTY(QSizePolicy::Policy sizePolicy READ sizePolicy WRITE setSizePolicy) public: void setSpacing(qreal spacing); void unsetSpacing(); + qreal spacing() const; void setSizePolicy(QSizePolicy::Policy policy); QSizePolicy::Policy sizePolicy() const; - qreal spacing() const; ~QGraphicsAnchor(); private: QGraphicsAnchor(QGraphicsAnchorLayout *parent); -- cgit v0.12 From 140d5af0f8635397c48f160bb8a33861b332c171 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 21 Oct 2009 11:04:32 +0200 Subject: Clips color interpolation to range [0, 255] This avoid warnings when using easing curves that progress outside the range [0.0, 1.0]. Patch proposed by warwick. Reviewed-by: Warwick Allison --- src/gui/animation/qguivariantanimation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp index 0ae79b6..1e9c166 100644 --- a/src/gui/animation/qguivariantanimation.cpp +++ b/src/gui/animation/qguivariantanimation.cpp @@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE template<> Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f,const QColor &t, qreal progress) { - return QColor(_q_interpolate(f.red(), t.red(), progress), - _q_interpolate(f.green(), t.green(), progress), - _q_interpolate(f.blue(), t.blue(), progress), - _q_interpolate(f.alpha(), t.alpha(), progress)); + return QColor(qBound(0,_q_interpolate(f.red(), t.red(), progress),255), + qBound(0,_q_interpolate(f.green(), t.green(), progress),255), + qBound(0,_q_interpolate(f.blue(), t.blue(), progress),255), + qBound(0,_q_interpolate(f.alpha(), t.alpha(), progress),255)); } template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,const QQuaternion &t, qreal progress) -- cgit v0.12 From cdb98c137db4d051e4b41c9fa4626c4c369cc0b1 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 21 Oct 2009 13:24:06 +0200 Subject: Improved QFontInfo::pointSize() slightly on X11. In non-GUI applications on X11, QFont and QFontInfo return different point size because for QFontInfo, the point size is converted to pixel size and back, but with different dpis. This commit improves the situation for the case where font config is used, but the bug still needs to be fixed properly by using the same dpi for all point<->pixel size conversions. Reviewed-by: Trond --- src/gui/text/qfontdatabase_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 382c4fe..27ff003 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -752,7 +752,7 @@ QFontDef qt_FcPatternToQFontDef(FcPattern *pattern, const QFontDef &request) if (X11->display) dpi = QX11Info::appDpiY(); else - dpi = 96; // #### + dpi = qt_defaultDpiY(); } double size; -- cgit v0.12 From 0bf8f2cbc596280b86d53e19b2bde316c2cafe3f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 21 Oct 2009 14:26:33 +0200 Subject: Added doc warning about ARGB32 image drawing and fixed format docs --- src/gui/image/qimage.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 21ab40c..571ef9d 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -546,11 +546,7 @@ bool QImageData::checkForAlphaPixels() const Each pixel stored in a QImage is represented by an integer. The size of the integer varies depending on the format. QImage supports several image formats described by the \l Format - enum. The monochrome (1-bit), 8-bit and 32-bit images are - available in all versions of Qt. In addition Qt for Embedded Linux - also supports 2-bit, 4-bit, and 16-bit images. For more information - about the Qt Extended specific formats, see the documentation of the \l - Format enum. + enum. Monochrome images are stored using 1-bit indexes into a color table with at most two colors. There are two different types of @@ -707,9 +703,20 @@ bool QImageData::checkForAlphaPixels() const packed with the most significant bit (MSB) first. \value Format_MonoLSB The image is stored using 1-bit per pixel. Bytes are packed with the less significant bit (LSB) first. - \value Format_Indexed8 The image is stored using 8-bit indexes into a colormap. + + \value Format_Indexed8 The image is stored using 8-bit indexes + into a colormap. \warning Drawing into a + QImage with Indexed8 format is not + supported. + \value Format_RGB32 The image is stored using a 32-bit RGB format (0xffRRGGBB). - \value Format_ARGB32 The image is stored using a 32-bit ARGB format (0xAARRGGBB). + + \value Format_ARGB32 The image is stored using a 32-bit ARGB + format (0xAARRGGBB). \warning Do not + render into ARGB32 images using + QPainter. Format_ARGB32_Premultiplied is + significantly faster. + \value Format_ARGB32_Premultiplied The image is stored using a premultiplied 32-bit ARGB format (0xAARRGGBB), i.e. the red, green, and blue channels are multiplied @@ -718,7 +725,9 @@ bool QImageData::checkForAlphaPixels() const undefined.) Certain operations (such as image composition using alpha blending) are faster using premultiplied ARGB32 than with plain ARGB32. + \value Format_RGB16 The image is stored using a 16-bit RGB format (5-6-5). + \value Format_ARGB8565_Premultiplied The image is stored using a premultiplied 24-bit ARGB format (8-5-6-5). \value Format_RGB666 The image is stored using a 24-bit RGB format (6-6-6). -- cgit v0.12 From 95e438189a36c71d632099b3873557103697bc3b Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Wed, 21 Oct 2009 14:46:52 +0200 Subject: Make QMenu::activateCausedStack() exception safe. Use an internal class to reset the activationRecursionGuard when the scope is closed. Reviewed-by: Leo Cunha --- src/gui/widgets/qmenu.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 324bc90..ea25901 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -975,10 +975,19 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) return false; } +class ExceptionGuard +{ +public: + inline ExceptionGuard(bool *w = 0) : watched(w) { Q_ASSERT(!(*watched)); *watched = true; } + inline ~ExceptionGuard() { *watched = false; } + inline operator bool() { return *watched; } +private: + bool *watched; +}; + void QMenuPrivate::activateCausedStack(const QList > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self) { - Q_ASSERT(!activationRecursionGuard); - activationRecursionGuard = true; + ExceptionGuard guard(&activationRecursionGuard); #ifdef QT3_SUPPORT const int actionId = q_func()->findIdForAction(action); #endif @@ -1023,7 +1032,6 @@ void QMenuPrivate::activateCausedStack(const QList > &causedSt #endif } } - activationRecursionGuard = false; } void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e, bool self) -- cgit v0.12 From 27abb4acf6fec8d9c2f18242ce539ebbc905eefc Mon Sep 17 00:00:00 2001 From: Marius Bugge Monsen Date: Wed, 21 Oct 2009 16:11:45 +0200 Subject: The QMenuPrivate::activationRecursionGuard has to be a boolean. Reviewed-by: Trust Me --- src/gui/widgets/qmenu_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 6a8e4b0..9348f7b 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -197,7 +197,7 @@ public: mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; - uint activationRecursionGuard : 1; + bool activationRecursionGuard; //selection static QPointer mouseDown; -- cgit v0.12 From 9c136d34c1d15d077ab5103a84dfb2449b796d1f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 21 Oct 2009 17:31:18 +0200 Subject: Fixed crash in tst_qabstractitemview. Reviewed-by: trust-me --- src/gui/itemviews/qlistview.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index b6e0ab7..f58f458 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1939,7 +1939,11 @@ int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hi bool above, bool below, const QRect &area, const QRect &rect) const { if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { - int value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()), flowPositions.count() - 1); + int value; + if (scrollValueMap.isEmpty()) + value = 0; + else + value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()), flowPositions.count() - 1); if (above) hint = QListView::PositionAtTop; else if (below) @@ -2000,7 +2004,11 @@ int QListModeViewBase::horizontalScrollToValue(int index, QListView::ScrollHint if (horizontalScrollMode() != QAbstractItemView::ScrollPerItem) return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect); - int value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1); + int value; + if (scrollValueMap.isEmpty()) + value = 0; + else + value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1); if (leftOf) hint = QListView::PositionAtTop; else if (rightOf) @@ -2312,7 +2320,7 @@ int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wr QVector positions; if (wrap) positions = segmentPositions; - else { + else if (!flowPositions.isEmpty()) { positions.reserve(scrollValueMap.size()); foreach (int itemShown, scrollValueMap) positions.append(flowPositions.at(itemShown)); -- cgit v0.12 From 5f8978a02bde7f84dc48b63d3722b925730790f0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 22 Oct 2009 10:34:44 +0200 Subject: move default QAbstractButton font setup on Win mobile to QApplication The original approach of modifying the font for QAbstractButtons in QWindowsMobileStyle::polish broke the autotest tst_qstylesheetstyle::fontPropagation. Reviewed-by: thartman --- src/gui/kernel/qapplication_win.cpp | 2 ++ src/gui/styles/qwindowsmobilestyle.cpp | 25 +------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 1babb69..5a4f4e6 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -624,6 +624,8 @@ static void qt_set_windows_font_resources() if (qt_wince_is_mobile()) { smallerFont.setPointSize(systemFont.pointSize()-1); QApplication::setFont(smallerFont, "QTabBar"); + smallerFont.setBold(true); + QApplication::setFont(smallerFont, "QAbstractButton"); } #endif// Q_OS_WINCE } diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index 32e39b2..f04a4b2 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -3130,34 +3130,11 @@ void QWindowsMobileStyle::polish(QWidget *widget) { else #endif //QT_NO_TOOLBAR -#ifndef QT_NO_PROPERTIES - if (QAbstractButton *pushButton = qobject_cast(widget)) { - QVariant oldFont = widget->property("_q_styleWindowsMobileFont"); - if (!oldFont.isValid()) { - QFont f = pushButton->font(); - widget->setProperty("_q_styleWindowsMobileFont", f); - f.setBold(true); - int p = f.pointSize(); - if (p > 2) - f.setPointSize(p-1); - pushButton->setFont(f); - } - } -#endif - QWindowsStyle::polish(widget); + QWindowsStyle::polish(widget); } void QWindowsMobileStyle::unpolish(QWidget *widget) { -#ifndef QT_NO_PROPERTIES - if (QAbstractButton *pushButton = qobject_cast(widget)) { - QVariant oldFont = widget->property("_q_styleWindowsMobileFont"); - if (oldFont.isValid()) { - widget->setFont(qVariantValue(oldFont)); - widget->setProperty("_q_styleWindowsMobileFont", QVariant()); - } - } -#endif QWindowsStyle::unpolish(widget); } -- cgit v0.12 From 03b19d156948e561c45724524467cc26bb7c4055 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 22 Oct 2009 10:55:04 +0200 Subject: Added license headers to new files --- .../gl2paintengineex/qtriangulatingstroker.cpp | 41 ++++++++++++++++++++++ .../gl2paintengineex/qtriangulatingstroker_p.h | 41 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index 250dab6..a3c8266 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtriangulatingstroker_p.h" #include diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index a28fc45..b7354db 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTRIANGULATINGSTROKER_P_H #define QTRIANGULATINGSTROKER_P_H -- cgit v0.12 From a7f377e8a20ee35d8bda55b2b13c9607f9ddfb3a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 22 Oct 2009 10:55:26 +0200 Subject: updated documentation for QPixmap::fromImage() --- src/gui/image/qpixmap.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f94552d..a3b7516 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -470,9 +470,11 @@ QPixmap::operator QVariant() const conversion fails. If the pixmap has 1-bit depth, the returned image will also be 1 - bit deep. If the pixmap has 2- to 8-bit depth, the returned image - has 8-bit depth. If the pixmap has greater than 8-bit depth, the - returned image has 32-bit depth. + bit deep. Images with more bits will be returned in a format + closely represents the underlying system. Usually this will be + QImage::Format_ARGB32_Premultiplied for pixmaps with an alpha and + QImage::Format_RGB32 or QImage::Format_RGB16 for pixmaps without + alpha. Note that for the moment, alpha masks on monochrome images are ignored. @@ -1704,8 +1706,8 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) In addition, on Symbian, the QPixmap class supports conversion to and from CFbsBitmap: the toSymbianCFbsBitmap() function creates - CFbsBitmap equivalent to the QPixmap, based on given mode and returns - a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a + CFbsBitmap equivalent to the QPixmap, based on given mode and returns + a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a QPixmap that is equivalent to the given bitmap and given mode. \section1 Pixmap Transformations -- cgit v0.12 From adc8f1b1e7a91c3807b074a43c18d2b0e31c9a9d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 22 Oct 2009 11:00:25 +0200 Subject: QWindowsMobileStyle::drawPrimitive(PE_Frame) background color fixed The background color of PE_Frame was palette().light() and has been changed to use palette().background() now. This fixes the autotest tst_QStyleSheetStyle::task188195_baseBackground for Windows mobile. Reviewed-by: thartman --- src/gui/styles/qwindowsmobilestyle.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index f04a4b2..886301b 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -1460,10 +1460,8 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp painter->drawLines(a); break; } case PE_Frame: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,&option->palette.light()); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,&option->palette.light()); + qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), + d->doubleControls ? 2 : 1, &option->palette.background()); break; case PE_FrameLineEdit: case PE_FrameMenu: -- cgit v0.12 From 62cf25df02d2cce8957c5942b467dbbf050a763d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 21 Oct 2009 16:58:44 +0200 Subject: Fixed regression in translucent window creation on X11. When setting the TranslucentBackground flag after the window has been created, we should check whether the widget has a native window id, and not the WA_NativeWindow attribute which doesn't seem to be set by default for top-level widgets. Reviewed-by: Trond --- src/gui/kernel/qwidget_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 663178f..28676da 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -950,7 +950,7 @@ static void qt_x11_recreateWidget(QWidget *widget) static void qt_x11_recreateNativeWidgetsRecursive(QWidget *widget) { - if (widget->testAttribute(Qt::WA_NativeWindow)) + if (widget->internalWinId()) qt_x11_recreateWidget(widget); const QObjectList &children = widget->children(); -- cgit v0.12 From f51e6e91c92810deff7029c8d1edf9b11f03a908 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 22 Oct 2009 12:05:41 +0200 Subject: Add Windows 7 with VC++2008 as a Tier 2 supported platform. --- doc/src/platforms/supported-platforms.qdoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 4c3929a..302ecb4 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -106,10 +106,8 @@ \o Compilers \row \o Windows XP, Vista \o gcc 3.4.2 (MinGW) - \omit \row \o Windows 7 \o MSVC 2008 - \endomit \row \o Apple Mac OS X 10.6 "Snow Leopard" \o As provided by Apple \row \o Apple Mac OS X 10.4 "Tiger" -- cgit v0.12 From 079202d135908444c418b064928117b4a273e075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 22 Oct 2009 10:46:32 +0200 Subject: QWidget painting regression on Windows. Problem occurred on Windows due to a call to repaint() on a top-level window from setDisabledStyle() in qwidget.cpp. This function is called whenever a window is blocking. In this particular case the children of the repainted window are opaque, and should therefore not be repainted, which also means that the top-level have to subtract the region of the opaque children when filling the background. This region is cached, and the problem was that the cached region was wrong. It was wrong because it was not invalidated properly. Task: QTBUG-4245 Reviewed-by: Paul --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3e65101..85c1955 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6954,7 +6954,7 @@ void QWidget::setVisible(bool visible) break; parent = parent->parentWidget(); } - if (parent && !d->getOpaqueRegion().isEmpty()) + if (parent) parent->d_func()->setDirtyOpaqueRegion(); } -- cgit v0.12 From abae4e913e91e64153edcc8cb771393062432ea2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 22 Oct 2009 14:59:56 +0300 Subject: Lowering toplevel widget puts app to background. Since raising toplevel widget nowdays brings the whole app to top, logically lowering toplevel widget should put the app to background. Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index abf5ba5..cb615fe 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -564,8 +564,13 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - if (q->internalWinId()) - q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1); + if (q->internalWinId()) { + // If toplevel widget, lower app to background + if (q->isWindow()) + S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), -1); + else + q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1); + } if (!q->isWindow()) invalidateBuffer(q->rect()); -- cgit v0.12 From dbff78d964d1a034459074f168b505b41bab0c98 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 22 Oct 2009 14:27:33 +0200 Subject: Use the qsreal type instead of double when working with QtScript numbers The idea is that qsreal can be typedef'ed to float on platforms where it's appropriate. Since the QScriptValue ctor takes a qsreal, we should not convert it to a double internally. Reviewed-by: Olivier Goffart --- src/script/api/qscriptengine.cpp | 2 +- src/script/api/qscriptengine_p.h | 2 +- src/script/api/qscriptvalue.cpp | 6 +++--- src/script/api/qscriptvalue_p.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index c3c8caf..3f2c9b4 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2577,7 +2577,7 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr) #endif break; case QMetaType::Double: - result = QScriptValue(*reinterpret_cast(ptr)); + result = QScriptValue(qsreal(*reinterpret_cast(ptr))); break; case QMetaType::QString: result = QScriptValue(q_func(), *reinterpret_cast(ptr)); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index cde116d..3766559 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -451,7 +451,7 @@ inline void QScriptValuePrivate::initFrom(JSC::JSValue value) engine->registerScriptValue(this); } -inline void QScriptValuePrivate::initFrom(double value) +inline void QScriptValuePrivate::initFrom(qsreal value) { type = Number; numberValue = value; diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index b8340a7..26cd314 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -213,7 +213,7 @@ qint32 ToInt32(qsreal n) if (qIsNaN(n) || qIsInf(n) || (n == 0)) return 0; - double sign = (n < 0) ? -1.0 : 1.0; + qsreal sign = (n < 0) ? -1.0 : 1.0; qsreal abs_n = fabs(n); n = ::fmod(sign * ::floor(abs_n), D32); @@ -233,7 +233,7 @@ quint32 ToUint32(qsreal n) if (qIsNaN(n) || qIsInf(n) || (n == 0)) return 0; - double sign = (n < 0) ? -1.0 : 1.0; + qsreal sign = (n < 0) ? -1.0 : 1.0; qsreal abs_n = fabs(n); n = ::fmod(sign * ::floor(abs_n), D32); @@ -251,7 +251,7 @@ quint16 ToUint16(qsreal n) if (qIsNaN(n) || qIsInf(n) || (n == 0)) return 0; - double sign = (n < 0) ? -1.0 : 1.0; + qsreal sign = (n < 0) ? -1.0 : 1.0; qsreal abs_n = fabs(n); n = ::fmod(sign * ::floor(abs_n), D16); diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 77b5084..9634515 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -81,7 +81,7 @@ public: inline ~QScriptValuePrivate(); inline void initFrom(JSC::JSValue value); - inline void initFrom(double value); + inline void initFrom(qsreal value); inline void initFrom(const QString &value); inline bool isJSC() const; @@ -124,7 +124,7 @@ public: QScriptEnginePrivate *engine; Type type; JSC::JSValue jscValue; - double numberValue; + qsreal numberValue; QString stringValue; // linked list of engine's script values -- cgit v0.12 From b63fc1726fe3df49c6577d8ac26095d0c8738925 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Oct 2009 14:53:17 +0200 Subject: Honor graphics system on Mac/Cocoa when exposing and resizing window When exposing or resizing a previously hidden window on Cocoa, we would go through the CoreGraphicsPaintEngine even when a different graphics system was set. This was because there were two different paths from the windowing system into our paint event. The one going through the virtual drawRect function in QCocoaView did not honor the graphics system. This patch makes sure the backing store is used for these types of events as well. Done with: Gunnar Reviewed-by: MortenS --- src/gui/kernel/qcocoaview_mac.mm | 8 ++++++++ src/gui/painting/qbackingstore_p.h | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 4c2a14a..417d54c 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -503,6 +504,13 @@ extern "C" { - (void)drawRect:(NSRect)aRect { + qDebug("drawRect"); + if (QApplicationPrivate::graphicsSystem() != 0) { + if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) + bs->markDirty(qwidget->rect(), qwidget); + qwidgetprivate->syncBackingStore(qwidget->rect()); + return; + } CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; qwidgetprivate->hd = cg; CGContextSaveGState(cg); diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 94d756e..63518fb 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -1,4 +1,4 @@ -/**************************************************************************** + /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -97,6 +97,12 @@ public: ); } + // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). + void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately = false, + bool invalidateBuffer = false); + void markDirty(const QRect &rect, QWidget *widget, bool updateImmediately = false, + bool invalidateBuffer = false); + private: QWidget *tlw; QRegion dirtyOnScreen; // needsFlush @@ -126,11 +132,6 @@ private: QRegion dirtyRegion(QWidget *widget = 0) const; QRegion staticContents(QWidget *widget = 0, const QRect &withinClipRect = QRect()) const; - // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). - void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately = false, - bool invalidateBuffer = false); - void markDirty(const QRect &rect, QWidget *widget, bool updateImmediately = false, - bool invalidateBuffer = false); void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset); void removeDirtyWidget(QWidget *w); -- cgit v0.12 From 792e3b4402954bb68fcc2c44e8e3f1fa7e2fe77b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Oct 2009 15:11:36 +0200 Subject: Remove debug output Oops. Reviewed-by: Trust me --- src/gui/kernel/qcocoaview_mac.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 417d54c..d49c150 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -504,7 +504,6 @@ extern "C" { - (void)drawRect:(NSRect)aRect { - qDebug("drawRect"); if (QApplicationPrivate::graphicsSystem() != 0) { if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) bs->markDirty(qwidget->rect(), qwidget); -- cgit v0.12 From a392366b164081fe3b75c806dbf2030e64754eaf Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Oct 2009 15:13:03 +0200 Subject: Remove whitespace before license header in qbackingstore_p.h This extra whitespace was introduced by mistake in a previous commit. Remove it again. Reviewed-by: Trust me --- src/gui/painting/qbackingstore_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 63518fb..3288dae 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -1,4 +1,4 @@ - /**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -- cgit v0.12 From cbbd7e084c7e46fd906db26b13032b8368c59093 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 22 Oct 2009 13:26:45 +0200 Subject: QtGui release/debug binary compatibility QtGui had some debug functions only exported in the debug build. Now these are exported in release mode as well, but as stubs (i.e. no debug output is generated). Reviewed-by: Thiago Macieira --- src/gui/graphicsview/qgraphicslinearlayout.cpp | 10 +++++----- src/gui/graphicsview/qgraphicslinearlayout.h | 2 -- src/gui/styles/qstyle.cpp | 4 ++-- src/gui/styles/qstyle.h | 2 -- src/gui/styles/qstyleoption.cpp | 10 +++++----- src/gui/styles/qstyleoption.h | 2 -- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 7ff7c9b..5684f0e 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -59,7 +59,7 @@ You can add widgets, layouts, stretches (addStretch(), insertStretch() or setStretchFactor()), and spacings (setItemSpacing()) to a linear - layout. The layout takes ownership of the items. In some cases when the layout + layout. The layout takes ownership of the items. In some cases when the layout item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a ambiguity in ownership because the layout item belongs to two ownership hierarchies. See the documentation of QGraphicsLayoutItem::setOwnedByLayout() how to handle @@ -208,7 +208,7 @@ QGraphicsLinearLayout::~QGraphicsLinearLayout() for (int i = count() - 1; i >= 0; --i) { QGraphicsLayoutItem *item = itemAt(i); // The following lines can be removed, but this removes the item - // from the layout more efficiently than the implementation of + // from the layout more efficiently than the implementation of // ~QGraphicsLayoutItem. removeAt(i); if (item) { @@ -542,18 +542,18 @@ void QGraphicsLinearLayout::invalidate() QGraphicsLayout::invalidate(); } -#ifdef QT_DEBUG void QGraphicsLinearLayout::dump(int indent) const { +#ifdef QT_DEBUG if (qt_graphicsLayoutDebug()) { Q_D(const QGraphicsLinearLayout); qDebug("%*s%s layout", indent, "", d->orientation == Qt::Horizontal ? "Horizontal" : "Vertical"); d->engine.dump(indent + 1); } -} #endif +} QT_END_NAMESPACE - + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicslinearlayout.h b/src/gui/graphicsview/qgraphicslinearlayout.h index 742392e..15fe81a 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.h +++ b/src/gui/graphicsview/qgraphicslinearlayout.h @@ -97,9 +97,7 @@ public: Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const; #endif -#ifdef QT_DEBUG void dump(int indent = 0) const; -#endif protected: #if 0 diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index eef1573..ec238a9 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -2417,13 +2417,13 @@ int QStyle::layoutSpacingImplementation(QSizePolicy::ControlType /* control1 */, return -1; } -#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) QT_BEGIN_INCLUDE_NAMESPACE #include QT_END_INCLUDE_NAMESPACE QDebug operator<<(QDebug debug, QStyle::State state) { +#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) debug << "QStyle::State("; QStringList states; @@ -2455,9 +2455,9 @@ QDebug operator<<(QDebug debug, QStyle::State state) qSort(states); debug << states.join(QLatin1String(" | ")); debug << ')'; +#endif return debug; } -#endif /*! \since 4.6 diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h index 1f8d5c8..0014954 100644 --- a/src/gui/styles/qstyle.h +++ b/src/gui/styles/qstyle.h @@ -878,9 +878,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DEBUG) Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); -#endif QT_END_NAMESPACE diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index 10a6b5b..061afcc 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -45,9 +45,7 @@ # include "private/qt_mac_p.h" # include "qmacstyle_mac.h" #endif -#ifndef QT_NO_DEBUG #include -#endif #include QT_BEGIN_NAMESPACE @@ -1254,7 +1252,7 @@ QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version) \brief the features of the group box frame The frame is flat by default. - + \sa QStyleOptionFrameV2::FrameFeature */ @@ -5298,9 +5296,9 @@ QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, T Returns a T or 0 depending on the type of \a hint. */ -#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) { +#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) switch (optionType) { case QStyleOption::SO_Default: debug << "SO_Default"; break; @@ -5361,19 +5359,21 @@ QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) case QStyleOption::SO_GraphicsItem: debug << "SO_GraphicsItem"; break; } +#endif return debug; } QDebug operator<<(QDebug debug, const QStyleOption &option) { +#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) debug << "QStyleOption("; debug << QStyleOption::OptionType(option.type); debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight"); debug << ',' << option.state; debug << ',' << option.rect; debug << ')'; +#endif return debug; } -#endif QT_END_NAMESPACE diff --git a/src/gui/styles/qstyleoption.h b/src/gui/styles/qstyleoption.h index 2860664..bf8b479 100644 --- a/src/gui/styles/qstyleoption.h +++ b/src/gui/styles/qstyleoption.h @@ -938,10 +938,8 @@ T qstyleoption_cast(QStyleHintReturn *hint) return 0; } -#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DEBUG) Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); -#endif QT_END_NAMESPACE -- cgit v0.12 From bff3c3daf29e581cd0b8b990491ff9444c63a3e9 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 22 Oct 2009 16:09:43 +0200 Subject: Update 4.6 def files Reviewed-by: TrustMe --- src/s60installs/eabi/QtCoreu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 44 ++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 2ecc48f..33df9fe 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3577,4 +3577,6 @@ EXPORTS uncompress @ 3576 NONAME zError @ 3577 NONAME zlibVersion @ 3578 NONAME + _ZNSsC1EPKcRKSaIcE @ 3579 NONAME + _ZNSsC2EPKcRKSaIcE @ 3580 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 1f4be7a..0c47232 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -1511,13 +1511,13 @@ EXPORTS _ZN12QApplication13startDragTimeEv @ 1510 NONAME _ZN12QApplication14navigationModeEv @ 1511 NONAME _ZN12QApplication14overrideCursorEv @ 1512 NONAME - _ZN12QApplication14s60EventFilterEP8TWsEvent @ 1513 NONAME + _ZN12QApplication14s60EventFilterEP8TWsEvent @ 1513 NONAME ABSENT _ZN12QApplication14setGlobalStrutERK5QSize @ 1514 NONAME _ZN12QApplication15closeAllWindowsEv @ 1515 NONAME _ZN12QApplication15cursorFlashTimeEv @ 1516 NONAME _ZN12QApplication15isEffectEnabledEN2Qt8UIEffectE @ 1517 NONAME _ZN12QApplication15layoutDirectionEv @ 1518 NONAME - _ZN12QApplication15s60ProcessEventEP8TWsEvent @ 1519 NONAME + _ZN12QApplication15s60ProcessEventEP8TWsEvent @ 1519 NONAME ABSENT _ZN12QApplication15setActiveWindowEP7QWidget @ 1520 NONAME _ZN12QApplication15setInputContextEP13QInputContext @ 1521 NONAME _ZN12QApplication15topLevelWidgetsEv @ 1522 NONAME @@ -1546,10 +1546,10 @@ EXPORTS _ZN12QApplication20changeOverrideCursorERK7QCursor @ 1545 NONAME _ZN12QApplication20desktopSettingsAwareEv @ 1546 NONAME _ZN12QApplication20setStartDragDistanceEi @ 1547 NONAME - _ZN12QApplication20symbianHandleCommandEi @ 1548 NONAME + _ZN12QApplication20symbianHandleCommandEi @ 1548 NONAME ABSENT _ZN12QApplication21keyboardInputIntervalEv @ 1549 NONAME _ZN12QApplication21restoreOverrideCursorEv @ 1550 NONAME - _ZN12QApplication21symbianResourceChangeEi @ 1551 NONAME + _ZN12QApplication21symbianResourceChangeEi @ 1551 NONAME ABSENT _ZN12QApplication22keyboardInputDirectionEv @ 1552 NONAME _ZN12QApplication22quitOnLastWindowClosedEv @ 1553 NONAME _ZN12QApplication22setDoubleClickIntervalEi @ 1554 NONAME @@ -2458,7 +2458,7 @@ EXPORTS _ZN13QInputContext11qt_metacallEN11QMetaObject4CallEiPPv @ 2457 NONAME _ZN13QInputContext11qt_metacastEPKc @ 2458 NONAME _ZN13QInputContext12mouseHandlerEiP11QMouseEvent @ 2459 NONAME - _ZN13QInputContext14s60FilterEventEP7QWidgetP8TWsEvent @ 2460 NONAME + _ZN13QInputContext14s60FilterEventEP7QWidgetP8TWsEvent @ 2460 NONAME ABSENT _ZN13QInputContext14setFocusWidgetEP7QWidget @ 2461 NONAME _ZN13QInputContext15widgetDestroyedEP7QWidget @ 2462 NONAME _ZN13QInputContext16staticMetaObjectE @ 2463 NONAME DATA 16 @@ -5215,11 +5215,11 @@ EXPORTS _ZN24QGraphicsSceneWheelEventD1Ev @ 5214 NONAME _ZN24QGraphicsSceneWheelEventD2Ev @ 5215 NONAME _ZN24QImagePixmapCleanupHooks12addImageHookEPFvxE @ 5216 NONAME - _ZN24QImagePixmapCleanupHooks13addPixmapHookEPFvP7QPixmapE @ 5217 NONAME + _ZN24QImagePixmapCleanupHooks13addPixmapHookEPFvP7QPixmapE @ 5217 NONAME ABSENT _ZN24QImagePixmapCleanupHooks15removeImageHookEPFvxE @ 5218 NONAME - _ZN24QImagePixmapCleanupHooks16removePixmapHookEPFvP7QPixmapE @ 5219 NONAME + _ZN24QImagePixmapCleanupHooks16removePixmapHookEPFvP7QPixmapE @ 5219 NONAME ABSENT _ZN24QImagePixmapCleanupHooks17executeImageHooksEx @ 5220 NONAME - _ZN24QImagePixmapCleanupHooks18executePixmapHooksEP7QPixmap @ 5221 NONAME + _ZN24QImagePixmapCleanupHooks18executePixmapHooksEP7QPixmap @ 5221 NONAME ABSENT _ZN24QImagePixmapCleanupHooks8instanceEv @ 5222 NONAME _ZN24QImagePixmapCleanupHooksC1Ev @ 5223 NONAME _ZN24QImagePixmapCleanupHooksC2Ev @ 5224 NONAME @@ -11585,4 +11585,32 @@ EXPORTS _ZN14QWidgetPrivate17_q_delayedDestroyEP11CCoeControl @ 11584 NONAME _ZN14QWidgetPrivate21activateSymbianWindowEP11CCoeControl @ 11585 NONAME _ZNK17QRasterPixmapData26createCompatiblePixmapDataEv @ 11586 NONAME + _ZN12QApplication18symbianEventFilterEPK13QSymbianEvent @ 11587 NONAME + _ZN12QApplication19symbianProcessEventEPK13QSymbianEvent @ 11588 NONAME + _ZN13QInputContext18symbianFilterEventEP7QWidgetPK13QSymbianEvent @ 11589 NONAME + _ZN13QSymbianEventC1ENS_4TypeEi @ 11590 NONAME + _ZN13QSymbianEventC1EPK8TWsEvent @ 11591 NONAME + _ZN13QSymbianEventC2ENS_4TypeEi @ 11592 NONAME + _ZN13QSymbianEventC2EPK8TWsEvent @ 11593 NONAME + _ZN13QSymbianEventD1Ev @ 11594 NONAME + _ZN13QSymbianEventD2Ev @ 11595 NONAME + _ZN15QGraphicsAnchor13setSizePolicyEN11QSizePolicy6PolicyE @ 11596 NONAME + _ZN19QApplicationPrivate20symbianHandleCommandEi @ 11597 NONAME + _ZN19QApplicationPrivate21symbianProcessWsEventEPK8TWsEvent @ 11598 NONAME + _ZN19QApplicationPrivate21symbianResourceChangeEi @ 11599 NONAME + _ZN24QImagePixmapCleanupHooks24addPixmapDestructionHookEPFvP7QPixmapE @ 11600 NONAME + _ZN24QImagePixmapCleanupHooks25addPixmapModificationHookEPFvP7QPixmapE @ 11601 NONAME + _ZN24QImagePixmapCleanupHooks27removePixmapDestructionHookEPFvP7QPixmapE @ 11602 NONAME + _ZN24QImagePixmapCleanupHooks28removePixmapModificationHookEPFvP7QPixmapE @ 11603 NONAME + _ZN24QImagePixmapCleanupHooks29executePixmapDestructionHooksEP7QPixmap @ 11604 NONAME + _ZN24QImagePixmapCleanupHooks30executePixmapModificationHooksEP7QPixmap @ 11605 NONAME + _ZNK11QPixmapData26createCompatiblePixmapDataEv @ 11606 NONAME + _ZNK13QSymbianEvent17windowServerEventEv @ 11607 NONAME + _ZNK13QSymbianEvent18resourceChangeTypeEv @ 11608 NONAME + _ZNK13QSymbianEvent7commandEv @ 11609 NONAME + _ZNK15QGraphicsAnchor10sizePolicyEv @ 11610 NONAME + _ZNK21QGraphicsLinearLayout4dumpEi @ 11611 NONAME + _Zls6QDebug6QFlagsIN6QStyle9StateFlagEE @ 11612 NONAME + _Zls6QDebugRK12QStyleOption @ 11613 NONAME + _Zls6QDebugRKN12QStyleOption10OptionTypeE @ 11614 NONAME -- cgit v0.12 From a96c204078122b8dd06ac5bb4d49b76f87f686f5 Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 22 Oct 2009 16:43:56 +0200 Subject: Description: Auto test fixes for Windows Mobile platform Reviewed-by: Joerg --- tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 48 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index 18f94a9..83ddd39 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -136,7 +136,10 @@ private: }; tst_QFiledialog::tst_QFiledialog() -{ +{ +#if defined(Q_OS_WINCE) + qApp->setAutoMaximizeThreshold(-1); +#endif } tst_QFiledialog::~tst_QFiledialog() @@ -168,13 +171,21 @@ void tst_QFiledialog::cleanup() void tst_QFiledialog::listRoot() { #if defined QT_BUILD_INTERNAL + QFileInfoGatherer fileInfoGatherer; + fileInfoGatherer.start(); + QTest::qWait(1500); + QFileInfoGatherer::fetchedRoot = false; QString dir(QDir::currentPath()); QNonNativeFileDialog fd(0, QString(), dir); fd.show(); QCOMPARE(QFileInfoGatherer::fetchedRoot,false); fd.setDirectory(""); +#ifdef Q_OS_WINCE + QTest::qWait(1500); +#else QTest::qWait(500); +#endif QCOMPARE(QFileInfoGatherer::fetchedRoot,true); #endif } @@ -297,6 +308,7 @@ void tst_QFiledialog::emptyUncPath() void tst_QFiledialog::task178897_minimumSize() { QNonNativeFileDialog fd; + QSize oldMs = fd.layout()->minimumSize(); QStringList history = fd.history(); history << QDir::toNativeSeparators("/verylongdirectory/" "aaaaaaaaaabbbbbbbbcccccccccccddddddddddddddeeeeeeeeeeeeffffffffffgggtggggggggghhhhhhhhiiiiiijjjk"); @@ -304,7 +316,7 @@ void tst_QFiledialog::task178897_minimumSize() fd.show(); QSize ms = fd.layout()->minimumSize(); - QVERIFY(ms.width() < 400); + QVERIFY(ms.width() <= oldMs.width()); } void tst_QFiledialog::task180459_lastDirectory_data() @@ -653,22 +665,33 @@ void tst_QFiledialog::task228844_ensurePreviousSorting() fd.setDirectory(current.absolutePath()); fd.setViewMode(QFileDialog::Detail); fd.show(); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); +#endif QTreeView *tree = qFindChild(&fd, "treeView"); tree->header()->setSortIndicator(3,Qt::DescendingOrder); QTest::qWait(200); QDialogButtonBox *buttonBox = qFindChild(&fd, "buttonBox"); QPushButton *button = buttonBox->button(QDialogButtonBox::Open); QTest::mouseClick(button, Qt::LeftButton); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); - +#endif QNonNativeFileDialog fd2; fd2.setFileMode(QFileDialog::Directory); fd2.restoreState(fd.saveState()); current.cd("aaaaaaaaaaaaaaaaaa"); fd2.setDirectory(current.absolutePath()); fd2.show(); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); +#endif QTreeView *tree2 = qFindChild(&fd2, "treeView"); tree2->setFocus(); @@ -678,15 +701,22 @@ void tst_QFiledialog::task228844_ensurePreviousSorting() QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open); fd2.selectFile("g"); QTest::mouseClick(button2, Qt::LeftButton); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); - +#endif QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g")); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); fd3.setFileMode(QFileDialog::Directory); fd3.show(); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); +#endif QTreeView *tree3 = qFindChild(&fd3, "treeView"); tree3->setFocus(); @@ -695,8 +725,11 @@ void tst_QFiledialog::task228844_ensurePreviousSorting() QDialogButtonBox *buttonBox3 = qFindChild(&fd3, "buttonBox"); QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open); QTest::mouseClick(button3, Qt::LeftButton); +#if defined(Q_OS_WINCE) + QTest::qWait(1500); +#else QTest::qWait(500); - +#endif QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName()); current.cd("aaaaaaaaaaaaaaaaaa"); @@ -777,7 +810,12 @@ void tst_QFiledialog::task251321_sideBarHiddenEntries() sidebar->setFocus(); sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath())); QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center()); + // give the background processes more time on windows mobile +#ifdef Q_OS_WINCE + QTest::qWait(1000); +#else QTest::qWait(250); +#endif QFileSystemModel *model = qFindChild(&fd, "qt_filesystem_model"); QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2); -- cgit v0.12 From 8a64af9c24c5c275cba22240760d9239d4b3fd6f Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 22 Oct 2009 16:50:46 +0200 Subject: Changed qsrand() behavior for Windows to match the linux version A problem occurred related to the createUUid function on Windows Mobile. Calling rand() before srand() resulted in identical pseudo random sequences for different threads. Reviewed-by: Joerg --- src/corelib/global/qglobal.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5a7b559..7d47944 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2479,7 +2479,7 @@ bool qputenv(const char *varName, const QByteArray& value) #endif } -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) +#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) # if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500) // older versions of INTEGRITY used a long instead of a uint for the seed. @@ -2535,20 +2535,35 @@ void qsrand(uint seed) */ void qsrand() { -#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) +#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) SeedStorageType *pseed = randTLS()->localData(); if (pseed) { // already seeded return; } randTLS()->setLocalData(pseed = new SeedStorageType); - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0); + // start beyond 1 to avoid the sequence reset + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); *pseed = QDateTime::currentDateTime().toTime_t() + quintptr(&pseed) + serial.fetchAndAddRelaxed(1); -#else - // On Windows, we assume that rand() already does the right thing +#if defined(Q_OS_WIN) + // for Windows the srand function must still be called. + srand(*pseed); #endif + +#elif defined(Q_OS_WIN) + static unsigned int seed = 0; + + if (seed) + return; + + seed = GetTickCount(); + srand(seed); +#else + // Symbian? + +#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) } /*! -- cgit v0.12 From 630df1da5d49ed6984dcaffdc5860598b143f66c Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 22 Oct 2009 16:52:18 +0200 Subject: update QtGui def file One private export has been changed from non-const to const pointer parameter Reviewed-by: TrustMe --- src/s60installs/eabi/QtGuiu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 0c47232..0e1bc43 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -3141,7 +3141,7 @@ EXPORTS _ZN14QWidgetPrivate25setLayoutDirection_helperEN2Qt15LayoutDirectionE @ 3140 NONAME _ZN14QWidgetPrivate26adjustQuitOnCloseAttributeEv @ 3141 NONAME _ZN14QWidgetPrivate26createDefaultWindowSurfaceEv @ 3142 NONAME - _ZN14QWidgetPrivate26nearestGraphicsProxyWidgetEP7QWidget @ 3143 NONAME + _ZN14QWidgetPrivate26nearestGraphicsProxyWidgetEPK7QWidget @ 3143 NONAME _ZN14QWidgetPrivate27widgetInNavigationDirectionENS_9DirectionE @ 3144 NONAME _ZN14QWidgetPrivate29invalidateBuffer_resizeHelperERK6QPointRK5QSize @ 3145 NONAME _ZN14QWidgetPrivate30createDefaultWindowSurface_sysEv @ 3146 NONAME -- cgit v0.12 From 1b154ddf00473700d697411304804ac065ef32ac Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 12 Oct 2009 16:54:52 +0200 Subject: Extended an autotest for gestures. Make sure that when a gesture recognizer explicitely sets the targetObject to a QGraphicsObject, we deliver it only to the object and will not try to propagate. Reviewed-by: trustme --- tests/auto/gestures/tst_gestures.cpp | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 46ed45e..baf90fa 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -241,6 +241,16 @@ static void sendCustomGesture(QObject *object) QApplication::sendEvent(object, &ev); } } +static void sendCustomGesture(QObject *object, QObject *target) +{ + CustomEvent ev; + ev.targetObject = target; + for (int i = CustomGesture::SerialMaybeThreshold; + i <= CustomGesture::SerialFinishedThreshold; ++i) { + ev.serial = i; + QApplication::sendEvent(object, &ev); + } +} class tst_Gestures : public QObject { @@ -265,6 +275,7 @@ private slots: void finishedWithoutStarted(); void unknownGesture(); void graphicsItemGesture(); + void explicitGraphicsObjectTarget(); }; tst_Gestures::tst_Gestures() @@ -624,5 +635,50 @@ void tst_Gestures::graphicsItemGesture() QCOMPARE(item->events.canceled.size(), 0); } +void tst_Gestures::explicitGraphicsObjectTarget() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + GestureItem *item1 = new GestureItem; + scene.addItem(item1); + item1->setPos(100, 100); + item1->grabGesture(CustomGesture::GestureType); + + GestureItem *item2 = new GestureItem; + scene.addItem(item2); + item2->setPos(100, 100); + item2->grabGesture(CustomGesture::GestureType); + + GestureItem *item3 = new GestureItem; + scene.addItem(item3); + item3->setParentItem(item2); + item3->setPos(0, 0); + item3->grabGesture(CustomGesture::GestureType); + + // sending events to item1, but the targetObject for the gesture is item2. + sendCustomGesture(item1, item3); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + QCOMPARE(item1->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item3->customEventsReceived, 0); + QCOMPARE(item3->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item3->gestureOverrideEventsReceived, 0); + QCOMPARE(item3->events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < item3->events.all.size(); ++i) + QCOMPARE(item3->events.all.at(i), CustomGesture::GestureType); + QCOMPARE(item3->events.started.size(), 1); + QCOMPARE(item3->events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(item3->events.finished.size(), 1); + QCOMPARE(item3->events.canceled.size(), 0); + QCOMPARE(item2->customEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, 0); + QCOMPARE(item2->gestureOverrideEventsReceived, 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From d1a60dcbddbae46aaea655bb55c0c8fd46f38b2c Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 13 Oct 2009 10:11:54 +0200 Subject: Improved gesture event filtering inside QGraphicsView for QGraphicObjects Reviewed-by: trustme --- src/corelib/global/qnamespace.h | 5 +- src/gui/graphicsview/qgraphicsitem.h | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 40 +++++- src/gui/graphicsview/qgraphicsscene_p.h | 2 + src/gui/graphicsview/qgraphicsview.cpp | 13 ++ src/gui/kernel/qapplication.cpp | 9 +- src/gui/kernel/qevent.cpp | 16 +++ src/gui/kernel/qevent.h | 5 + src/gui/kernel/qgesture.cpp | 10 -- src/gui/kernel/qgesture.h | 4 - src/gui/kernel/qgesturemanager.cpp | 226 +++++++++++++++++--------------- src/gui/kernel/qgesturemanager_p.h | 10 +- tests/auto/gestures/tst_gestures.cpp | 215 ++++++++++++++++++++++-------- 13 files changed, 372 insertions(+), 185 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index f28f94e..2b62c6b 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1631,7 +1631,10 @@ public: enum GestureContext { WidgetGesture = 0, - WidgetWithChildrenGesture = 3 + WidgetWithChildrenGesture = 3, + + ItemGesture = WidgetGesture, + ItemWithChildrenGesture = WidgetWithChildrenGesture }; enum NavigationMode diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 2665235..54a7a64 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -555,7 +555,7 @@ public: using QObject::children; #endif - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); Q_SIGNALS: void parentChanged(); diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a624b10..373ee89 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -242,7 +242,6 @@ #include #include #include -#include #include #include #include @@ -251,6 +250,7 @@ #include #endif #include +#include QT_BEGIN_NAMESPACE @@ -1052,6 +1052,14 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) */ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) { + if (QGraphicsObject *object = item->toGraphicsObject()) { + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); + if (qAppPriv->gestureManager) { + if (qAppPriv->gestureManager->filterEvent(object, event)) + return true; + } + } + if (filterEvent(item, event)) return false; if (filterDescendantEvent(item, event)) @@ -3365,6 +3373,10 @@ bool QGraphicsScene::event(QEvent *event) case QEvent::TouchEnd: d->touchEventHandler(static_cast(event)); break; + case QEvent::Gesture: + case QEvent::GestureOverride: + d->gestureEventHandler(static_cast(event)); + break; default: return QObject::event(event); } @@ -5699,6 +5711,32 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) dispatchHoverEvent(&hoverEvent); } +void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) +{ + QWidget *viewport = event->widget(); + QList gestures = event->allGestures(); + for (int i = 0; i < gestures.size(); ++i) { + QGesture *gesture = gestures.at(i); + Qt::GestureType gestureType = gesture->gestureType(); + QPoint screenPos = gesture->hotSpot().toPoint(); + QList items = itemsAtPosition(screenPos, QPointF(), viewport); + for (int j = 0; j < items.size(); ++j) { + QGraphicsObject *item = items.at(j)->toGraphicsObject(); + if (!item) + continue; + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + if (d->gestureContext.contains(gestureType)) { + QGestureEvent ev(QList() << gesture); + ev.t = event->t; + ev.spont = event->spont; + ev.setWidget(event->widget()); + sendEvent(item, &ev); + break; + } + } + } +} + QT_END_NAMESPACE #include "moc_qgraphicsscene.cpp" diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 8073695..4c82b49 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -282,6 +282,8 @@ public: bool allItemsIgnoreTouchEvents; void enableTouchEventsOnViews(); + void gestureEventHandler(QGestureEvent *event); + void updateInputMethodSensitivityInViews(); QList modalPanels; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 32747cc..710c745 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2701,6 +2701,19 @@ bool QGraphicsView::viewportEvent(QEvent *event) return true; } + case QEvent::Gesture: + case QEvent::GestureOverride: + { + if (!isEnabled()) + return false; + + if (d->scene && d->sceneInteractionAllowed) { + QGestureEvent *gestureEvent = static_cast(event); + gestureEvent->setWidget(viewport()); + (void) QApplication::sendEvent(d->scene, gestureEvent); + } + return true; + } default: break; } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index c4249d9..30440eb 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3639,8 +3639,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // walk through parents and check for gestures if (d->gestureManager) { - if (d->gestureManager->filterEvent(receiver, e)) - return true; + if (receiver->isWidgetType()) { + if (d->gestureManager->filterEvent(static_cast(receiver), e)) + return true; + } else if (QGesture *gesture = qobject_cast(receiver)) { + if (d->gestureManager->filterEvent(gesture, e)) + return true; + } } diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2ff6d65..e49de02 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4318,6 +4318,22 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const return gesture ? gesture->d_func()->accept : false; } +/*! + \internal +*/ +void QGestureEvent::setWidget(QWidget *widget) +{ + widget_ = widget; +} + +/*! + \internal +*/ +QWidget *QGestureEvent::widget() const +{ + return widget_; +} + #ifdef Q_NO_USING_KEYWORD /*! \fn void QGestureEvent::setAccepted(bool accepted) diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 3516222..6cba5fb 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -849,8 +849,13 @@ public: void ignore(QGesture *); bool isAccepted(QGesture *) const; + // internal + void setWidget(QWidget *widget); + QWidget *widget() const; + private: QList gestures_; + QWidget *widget_; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index fc8df49..e48fd8e 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -154,16 +154,6 @@ Qt::GestureState QGesture::state() const return d_func()->state; } -QObject *QGesture::targetObject() const -{ - return d_func()->targetObject; -} - -void QGesture::setTargetObject(QObject *value) -{ - d_func()->targetObject = value; -} - QPointF QGesture::hotSpot() const { return d_func()->hotSpot; diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 02eb526..9d1c11e 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -67,7 +67,6 @@ class Q_GUI_EXPORT QGesture : public QObject Q_PROPERTY(Qt::GestureType gestureType READ gestureType) Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot) Q_PROPERTY(bool hasHotSpot READ hasHotSpot) - Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject) public: explicit QGesture(QObject *parent = 0); @@ -77,9 +76,6 @@ public: Qt::GestureState state() const; - QObject *targetObject() const; - void setTargetObject(QObject *value); - QPointF hotSpot() const; void setHotSpot(const QPointF &value); bool hasHotSpot() const; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 0f0aef2..4f8a911 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -88,7 +88,8 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r { QGesture *dummy = recognizer->createGesture(0); if (!dummy) { - qWarning("QGestureManager::registerGestureRecognizer: the recognizer doesn't provide gesture object"); + qWarning("QGestureManager::registerGestureRecognizer: " + "the recognizer doesn't provide gesture object"); return Qt::GestureType(0); } Qt::GestureType type = dummy->gestureType(); @@ -107,7 +108,7 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType) } -QGesture* QGestureManager::getState(QObject *object, Qt::GestureType type) +QGesture *QGestureManager::getState(QObject *object, Qt::GestureType type) { // if the widget is being deleted we should be carefull and not to // create a new state, as it will create QWeakPointer which doesnt work @@ -115,9 +116,14 @@ QGesture* QGestureManager::getState(QObject *object, Qt::GestureType type) if (object->isWidgetType()) { if (static_cast(object)->d_func()->data.in_destructor) return 0; + } else if (QGesture *g = qobject_cast(object)) { + return g; + } else { + Q_ASSERT(qobject_cast(object)); } - QWeakPointer state = objectGestures.value(QGestureManager::ObjectGesture(object, type)); + QWeakPointer state = + objectGestures.value(QGestureManager::ObjectGesture(object, type)); if (!state) { QGestureRecognizer *recognizer = recognizers.value(type); if (recognizer) { @@ -136,7 +142,9 @@ QGesture* QGestureManager::getState(QObject *object, Qt::GestureType type) return state.data(); } -bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) +bool QGestureManager::filterEventThroughContexts(const QMap &contexts, + QObject *receiver, QEvent *event) { QSet triggeredGestures; QSet finishedGestures; @@ -144,93 +152,20 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) QSet canceledGestures; QSet notGestures; - QGraphicsObject *graphicsObject = qobject_cast(receiver); - if (receiver->isWidgetType() || graphicsObject) { - QMap contexts; - if (receiver->isWidgetType()) { - QWidget *w = static_cast(receiver); - if (!w->d_func()->gestureContext.isEmpty()) { - typedef QMap::const_iterator ContextIterator; - for(ContextIterator it = w->d_func()->gestureContext.begin(), - e = w->d_func()->gestureContext.end(); it != e; ++it) { - contexts.insertMulti(w, it.key()); - } - } - // find all gesture contexts for the widget tree - w = w->parentWidget(); - while (w) - { - typedef QMap::const_iterator ContextIterator; - for (ContextIterator it = w->d_func()->gestureContext.begin(), - e = w->d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) - contexts.insertMulti(w, it.key()); - } - w = w->parentWidget(); - } - } else { - QGraphicsObject *item = graphicsObject; - if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { - typedef QMap::const_iterator ContextIterator; - for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), - e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - contexts.insertMulti(item, it.key()); - } - } - // find all gesture contexts for the widget tree - item = item->parentObject(); - while (item) - { - typedef QMap::const_iterator ContextIterator; - for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), - e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) - contexts.insertMulti(item, it.key()); - } - item = item->parentObject(); - } - } - // filter the event through recognizers - typedef QMap::const_iterator ContextIterator; - for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) { - Qt::GestureType gestureType = cit.value(); - QMap::const_iterator - rit = recognizers.lowerBound(gestureType), - re = recognizers.upperBound(gestureType); - for (; rit != re; ++rit) { - QGestureRecognizer *recognizer = rit.value(); - QObject *target = cit.key(); - QGesture *state = getState(target, gestureType); - if (!state) - continue; - QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event); - QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; - if (type == QGestureRecognizer::GestureTriggered) { - DEBUG() << "QGestureManager: gesture triggered: " << state; - triggeredGestures << state; - } else if (type == QGestureRecognizer::GestureFinished) { - DEBUG() << "QGestureManager: gesture finished: " << state; - finishedGestures << state; - } else if (type == QGestureRecognizer::MaybeGesture) { - DEBUG() << "QGestureManager: maybe gesture: " << state; - newMaybeGestures << state; - } else if (type == QGestureRecognizer::NotGesture) { - DEBUG() << "QGestureManager: not gesture: " << state; - notGestures << state; - } else if (type == QGestureRecognizer::Ignore) { - DEBUG() << "QGestureManager: gesture ignored the event: " << state; - } else { - DEBUG() << "QGestureManager: hm, lets assume the recognizer ignored the event: " << state; - } - if (result & QGestureRecognizer::ConsumeEventHint) { - DEBUG() << "QGestureManager: we were asked to consume the event: " << state; - //TODO: consume events if asked - } - } - } - } else if (QGesture *state = qobject_cast(receiver)) { - if (QGestureRecognizer *recognizer = gestureToRecognizer.value(state)) { - QGestureRecognizer::Result result = recognizer->filterEvent(state, state, event); + // filter the event through recognizers + typedef QMap::const_iterator ContextIterator; + for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) { + Qt::GestureType gestureType = cit.value(); + QMap::const_iterator + rit = recognizers.lowerBound(gestureType), + re = recognizers.upperBound(gestureType); + for (; rit != re; ++rit) { + QGestureRecognizer *recognizer = rit.value(); + QObject *target = cit.key(); + QGesture *state = getState(target, gestureType); + if (!state) + continue; + QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event); QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; if (type == QGestureRecognizer::GestureTriggered) { DEBUG() << "QGestureManager: gesture triggered: " << state; @@ -247,11 +182,15 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) } else if (type == QGestureRecognizer::Ignore) { DEBUG() << "QGestureManager: gesture ignored the event: " << state; } else { - DEBUG() << "QGestureManager: hm, lets assume the recognizer ignored the event: " << state; + DEBUG() << "QGestureManager: hm, lets assume the recognizer" + << "ignored the event: " << state; + } + if (result & QGestureRecognizer::ConsumeEventHint) { + DEBUG() << "QGestureManager: we were asked to consume the event: " + << state; + //TODO: consume events if asked } } - } else { - return false; } QSet startedGestures = triggeredGestures - activeGestures; @@ -260,7 +199,8 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) // check if a running gesture switched back to maybe state QSet activeToMaybeGestures = activeGestures & newMaybeGestures; - // check if a running gesture switched back to not gesture state, i.e. were canceled + // check if a running gesture switched back to not gesture state, + // i.e. were canceled QSet activeToCancelGestures = activeGestures & notGestures; canceledGestures += activeToCancelGestures; @@ -271,7 +211,9 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) timer.start(3000, this); } // kill timers for gestures that were in maybe state - QSet notMaybeGestures = (startedGestures | triggeredGestures | finishedGestures | canceledGestures | notGestures); + QSet notMaybeGestures = (startedGestures | triggeredGestures + | finishedGestures | canceledGestures + | notGestures); foreach(QGesture *gesture, notMaybeGestures) { QMap::iterator it = maybeGestures.find(gesture); @@ -294,7 +236,9 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) // probably those are "singleshot" gestures so we'll fake the started state. foreach (QGesture *gesture, notStarted) gesture->d_func()->state = Qt::GestureStarted; - deliverEvents(notStarted, receiver); + QSet undeliveredGestures; + deliverEvents(notStarted, receiver, &undeliveredGestures); + finishedGestures -= undeliveredGestures; } activeGestures += startedGestures; @@ -328,10 +272,15 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) << "\n\tcanceled:" << canceledGestures; } - deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures, receiver); + QSet undeliveredGestures; + deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures, + receiver, &undeliveredGestures); + + activeGestures -= undeliveredGestures; // reset gestures that ended - QSet endedGestures = finishedGestures + canceledGestures; + QSet endedGestures = + finishedGestures + canceledGestures + undeliveredGestures; foreach (QGesture *gesture, endedGestures) { if (QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0)) { recognizer->reset(gesture); @@ -341,7 +290,68 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event) return false; } -void QGestureManager::deliverEvents(const QSet &gestures, QObject *lastReceiver) +bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) +{ + QMap contexts; + QWidget *w = receiver; + if (!w->d_func()->gestureContext.isEmpty()) { + typedef QMap::const_iterator ContextIterator; + for(ContextIterator it = w->d_func()->gestureContext.begin(), + e = w->d_func()->gestureContext.end(); it != e; ++it) { + contexts.insertMulti(w, it.key()); + } + } + // find all gesture contexts for the widget tree + w = w->parentWidget(); + while (w) + { + typedef QMap::const_iterator ContextIterator; + for (ContextIterator it = w->d_func()->gestureContext.begin(), + e = w->d_func()->gestureContext.end(); it != e; ++it) { + if (it.value() == Qt::WidgetWithChildrenGesture) + contexts.insertMulti(w, it.key()); + } + w = w->parentWidget(); + } + return filterEventThroughContexts(contexts , receiver, event); +} + +bool QGestureManager::filterEvent(QGraphicsObject *graphicsObject, QEvent *event) +{ + QMap contexts; + QGraphicsObject *item = graphicsObject; + if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { + typedef QMap::const_iterator ContextIterator; + for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), + e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + contexts.insertMulti(item, it.key()); + } + } + // find all gesture contexts for the graphics object tree + item = item->parentObject(); + while (item) + { + typedef QMap::const_iterator ContextIterator; + for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), + e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + if (it.value() == Qt::ItemWithChildrenGesture) + contexts.insertMulti(item, it.key()); + } + item = item->parentObject(); + } + return filterEventThroughContexts(contexts, graphicsObject, event); +} + +bool QGestureManager::filterEvent(QGesture *state, QEvent *event) +{ + QMap contexts; + contexts.insert(state, state->gestureType()); + return filterEventThroughContexts(contexts, 0, event); +} + +void QGestureManager::deliverEvents(const QSet &gestures, + QObject *lastReceiver, + QSet *undeliveredGestures) { if (gestures.isEmpty()) return; @@ -360,16 +370,12 @@ void QGestureManager::deliverEvents(const QSet &gestures, QObject *la if (gesture->hasHotSpot()) { // guess the target using the hotspot of the gesture QPoint pt = gesture->hotSpot().toPoint(); - if (!pt.isNull()) { - if (QWidget *w = qApp->topLevelAt(pt)) - target = w->childAt(w->mapFromGlobal(pt)); + if (QWidget *w = qApp->topLevelAt(pt)) { + target = w->childAt(w->mapFromGlobal(pt)); } } - if (!target) { - target = gesture->targetObject(); - if (!target) - target = lastReceiver; - } + if (!target) + target = lastReceiver; } if (target) { gestureTargets.insert(gesture, target); @@ -379,11 +385,13 @@ void QGestureManager::deliverEvents(const QSet &gestures, QObject *la } else { qWarning() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType(); + undeliveredGestures->insert(gesture); } } typedef QMultiHash::const_iterator ObjectGesturesIterator; - for (ObjectGesturesIterator it = objectGestures.begin(), e = objectGestures.end(); it != e; ++it) { + for (ObjectGesturesIterator it = objectGestures.begin(), + e = objectGestures.end(); it != e; ++it) { QObject *object1 = it.key(); QWidget *widget1 = qobject_cast(object1); QGraphicsObject *item1 = qobject_cast(object1); diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index c61819f..5fc02ab 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QBasicTimer; +class QGraphicsObject; class QGestureManager : public QObject { Q_OBJECT @@ -71,13 +72,17 @@ public: Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); void unregisterGestureRecognizer(Qt::GestureType type); - bool filterEvent(QObject *receiver, QEvent *event); + bool filterEvent(QWidget *receiver, QEvent *event); + bool filterEvent(QGesture *receiver, QEvent *event); + bool filterEvent(QGraphicsObject *receiver, QEvent *event); // declared in qapplication.cpp static QGestureManager* instance(); protected: void timerEvent(QTimerEvent *event); + bool filterEventThroughContexts(const QMap &contexts, + QObject *receiver, QEvent *event); private: QMultiMap recognizers; @@ -117,7 +122,8 @@ private: int lastCustomGestureId; QGesture *getState(QObject *widget, Qt::GestureType gesture); - void deliverEvents(const QSet &gestures, QObject *lastReceiver); + void deliverEvents(const QSet &gestures, QObject *lastReceiver, + QSet *undeliveredGestures); }; QT_END_NAMESPACE diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index baf90fa..3ce5b86 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -56,6 +56,11 @@ //TESTED_CLASS= //TESTED_FILES= +static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view) +{ + return view->mapToGlobal(view->mapFromScene(item->mapToScene(pt))); +} + class CustomGesture : public QGesture { Q_OBJECT @@ -63,11 +68,10 @@ public: static Qt::GestureType GestureType; CustomGesture(QObject *parent = 0) - : QGesture(parent), target(0), serial(0) + : QGesture(parent), serial(0) { } - QObject *target; int serial; static const int SerialMaybeThreshold; @@ -86,13 +90,13 @@ public: CustomEvent(int serial_ = 0) : QEvent(QEvent::Type(CustomEvent::EventType)), - serial(serial_), targetObject(0) + serial(serial_), hasHotSpot(false) { } int serial; - QObject *targetObject; - QPoint hotSpot; + QPointF hotSpot; + bool hasHotSpot; }; int CustomEvent::EventType = 0; @@ -117,8 +121,8 @@ public: CustomGesture *g = static_cast(state); CustomEvent *e = static_cast(event); g->serial = e->serial; - g->setTargetObject(e->targetObject); - g->setHotSpot(e->hotSpot); + if (e->hasHotSpot) + g->setHotSpot(e->hotSpot); ++eventsCounter; if (g->serial >= CustomGesture::SerialFinishedThreshold) result |= QGestureRecognizer::GestureFinished; @@ -231,24 +235,15 @@ protected: } }; -static void sendCustomGesture(QObject *object) +static void sendCustomGesture(CustomEvent *event, QObject *object, QGraphicsScene *scene = 0) { - CustomEvent ev; - ev.targetObject = object; for (int i = CustomGesture::SerialMaybeThreshold; i <= CustomGesture::SerialFinishedThreshold; ++i) { - ev.serial = i; - QApplication::sendEvent(object, &ev); - } -} -static void sendCustomGesture(QObject *object, QObject *target) -{ - CustomEvent ev; - ev.targetObject = target; - for (int i = CustomGesture::SerialMaybeThreshold; - i <= CustomGesture::SerialFinishedThreshold; ++i) { - ev.serial = i; - QApplication::sendEvent(object, &ev); + event->serial = i; + if (scene) + scene->sendEvent(qobject_cast(object), event); + else + QApplication::sendEvent(object, event); } } @@ -276,6 +271,7 @@ private slots: void unknownGesture(); void graphicsItemGesture(); void explicitGraphicsObjectTarget(); + void gestureOverChildGraphicsItem(); }; tst_Gestures::tst_Gestures() @@ -309,7 +305,8 @@ void tst_Gestures::customGesture() { GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - sendCustomGesture(&widget); + CustomEvent event; + sendCustomGesture(&event, &widget); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -354,7 +351,8 @@ void tst_Gestures::gestureOverChild() widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - sendCustomGesture(child); + CustomEvent event; + sendCustomGesture(&event, child); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -372,7 +370,7 @@ void tst_Gestures::gestureOverChild() widget.reset(); child->reset(); - sendCustomGesture(child); + sendCustomGesture(&event, child); QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(widget.customEventsReceived, 0); @@ -403,7 +401,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; // sending events to the child and making sure there is no conflict - sendCustomGesture(child); + CustomEvent event; + sendCustomGesture(&event, child); QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); QCOMPARE(parent.customEventsReceived, 0); @@ -416,7 +415,7 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() child->reset(); // same for the parent widget - sendCustomGesture(&parent); + sendCustomGesture(&event, &parent); QCOMPARE(child->customEventsReceived, 0); QCOMPARE(parent.customEventsReceived, TotalCustomEventsCount); @@ -443,7 +442,8 @@ void tst_Gestures::conflictingGestures() child->acceptGestureOverride = true; // sending events to the child and making sure there is no conflict - sendCustomGesture(child); + CustomEvent event; + sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureEventsReceived, 0); @@ -458,7 +458,7 @@ void tst_Gestures::conflictingGestures() child->acceptGestureOverride = false; // sending events to the child and making sure there is no conflict - sendCustomGesture(child); + sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureEventsReceived, 0); @@ -473,7 +473,7 @@ void tst_Gestures::conflictingGestures() child->acceptGestureOverride = false; // sending events to the child and making sure there is no conflict - sendCustomGesture(child); + sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); @@ -508,7 +508,8 @@ void tst_Gestures::unknownGesture() widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture); widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture); - sendCustomGesture(&widget); + CustomEvent event; + sendCustomGesture(&event, &widget); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -554,6 +555,15 @@ public: QRectF size; + void reset() + { + customEventsReceived = 0; + gestureEventsReceived = 0; + gestureOverrideEventsReceived = 0; + events.clear(); + overrideEvents.clear(); + } + protected: QRectF boundingRect() const { @@ -616,13 +626,37 @@ void tst_Gestures::graphicsItemGesture() scene.addItem(item); item->setPos(100, 100); - item->grabGesture(CustomGesture::GestureType); + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); - sendCustomGesture(item); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + item->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + CustomEvent event; + sendCustomGesture(&event, item, &scene); + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); + QCOMPARE(item->events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < item->events.all.size(); ++i) + QCOMPARE(item->events.all.at(i), CustomGesture::GestureType); + QCOMPARE(item->events.started.size(), 1); + QCOMPARE(item->events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(item->events.finished.size(), 1); + QCOMPARE(item->events.canceled.size(), 0); + + item->reset(); + + // make sure the event is properly delivered if only the hotspot is set. + event.hotSpot = mapToGlobal(QPointF(10, 10), item, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item, &scene); + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item->gestureOverrideEventsReceived, 0); @@ -643,41 +677,112 @@ void tst_Gestures::explicitGraphicsObjectTarget() GestureItem *item1 = new GestureItem; scene.addItem(item1); item1->setPos(100, 100); - item1->grabGesture(CustomGesture::GestureType); GestureItem *item2 = new GestureItem; scene.addItem(item2); item2->setPos(100, 100); - item2->grabGesture(CustomGesture::GestureType); - GestureItem *item3 = new GestureItem; - scene.addItem(item3); - item3->setParentItem(item2); - item3->setPos(0, 0); - item3->grabGesture(CustomGesture::GestureType); + GestureItem *item2_child1 = new GestureItem; + scene.addItem(item2_child1); + item2_child1->setParentItem(item2); + item2_child1->setPos(10, 10); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); - // sending events to item1, but the targetObject for the gesture is item2. - sendCustomGesture(item1, item3); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + item1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); + item2->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); + item2_child1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; - static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; - QCOMPARE(item1->customEventsReceived, TotalCustomEventsCount); + // sending events to item1, but the hotSpot is set to item2 + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(15, 15), item2, &view); + event.hasHotSpot = true; + + sendCustomGesture(&event, item1, &scene); + QCOMPARE(item1->gestureEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 0); - QCOMPARE(item3->customEventsReceived, 0); - QCOMPARE(item3->gestureEventsReceived, TotalGestureEventsCount); - QCOMPARE(item3->gestureOverrideEventsReceived, 0); - QCOMPARE(item3->events.all.size(), TotalGestureEventsCount); - for(int i = 0; i < item3->events.all.size(); ++i) - QCOMPARE(item3->events.all.at(i), CustomGesture::GestureType); - QCOMPARE(item3->events.started.size(), 1); - QCOMPARE(item3->events.updated.size(), TotalGestureEventsCount - 2); - QCOMPARE(item3->events.finished.size(), 1); - QCOMPARE(item3->events.canceled.size(), 0); - QCOMPARE(item2->customEventsReceived, 0); + QCOMPARE(item2_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2_child1->events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < item2_child1->events.all.size(); ++i) + QCOMPARE(item2_child1->events.all.at(i), CustomGesture::GestureType); + QCOMPARE(item2_child1->events.started.size(), 1); + QCOMPARE(item2_child1->events.updated.size(), TotalGestureEventsCount - 2); + QCOMPARE(item2_child1->events.finished.size(), 1); + QCOMPARE(item2_child1->events.canceled.size(), 0); + QCOMPARE(item2->gestureEventsReceived, 0); + QCOMPARE(item2->gestureOverrideEventsReceived, 0); +} + +void tst_Gestures::gestureOverChildGraphicsItem() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + GestureItem *item0 = new GestureItem; + scene.addItem(item0); + item0->setPos(0, 0); + + GestureItem *item1 = new GestureItem; + scene.addItem(item1); + item1->setPos(100, 100); + + GestureItem *item2 = new GestureItem; + scene.addItem(item2); + item2->setPos(100, 100); + + GestureItem *item2_child1 = new GestureItem; + scene.addItem(item2_child1); + item2_child1->setParentItem(item2); + item2_child1->setPos(0, 0); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + item1->grabGesture(CustomGesture::GestureType); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, 0); QCOMPARE(item2->gestureOverrideEventsReceived, 0); + QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); + QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); + QCOMPARE(item2->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureEventsReceived, 0); + QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); + QCOMPARE(item1->gestureOverrideEventsReceived, TotalGestureEventsCount); } QTEST_MAIN(tst_Gestures) -- cgit v0.12 From c5c1b878891b5ace5a71b95ea62229e26722fdba Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 14 Oct 2009 14:45:27 +0200 Subject: Fixed gesture event delivery when several gestures are triggered. When there are two different gestures are being triggered and they are supposed to be sent to different widgets, don't stop event "propagation" when the first event is successfully delivered. Reviewed-by: trustme --- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qgesturemanager.cpp | 41 +++++++++++++++----------------- tests/auto/gestures/tst_gestures.cpp | 45 +++++++++++++++++++++++++++++++----- 3 files changed, 59 insertions(+), 29 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 30440eb..aee8afc 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4183,7 +4183,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(w, &ge); gestureEvent->spont = false; eventAccepted = ge.isAccepted(); - if (res && eventAccepted) + if (res && eventAccepted && allGestures.isEmpty()) break; if (!eventAccepted) { // ### two ways to ignore the event/gesture diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 4f8a911..8928d1c 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -361,7 +361,8 @@ void QGestureManager::deliverEvents(const QSet &gestures, GesturesPerReceiver groupedGestures; // for conflicted gestures the key is always the innermost widget (i.e. the child) GesturesPerReceiver conflictedGestures; - QMultiHash objectGestures; + typedef QMultiHash WidgetMultiGestures; + WidgetMultiGestures widgetMultiGestures; foreach (QGesture *gesture, gestures) { QObject *target = gestureTargets.value(gesture, 0); @@ -380,7 +381,7 @@ void QGestureManager::deliverEvents(const QSet &gestures, if (target) { gestureTargets.insert(gesture, target); if (target->isWidgetType()) - objectGestures.insert(target, gesture); + widgetMultiGestures.insert(static_cast(target), gesture); groupedGestures[target].append(gesture); } else { qWarning() << "QGestureManager::deliverEvent: could not find the target for gesture" @@ -389,30 +390,26 @@ void QGestureManager::deliverEvents(const QSet &gestures, } } - typedef QMultiHash::const_iterator ObjectGesturesIterator; - for (ObjectGesturesIterator it = objectGestures.begin(), - e = objectGestures.end(); it != e; ++it) { - QObject *object1 = it.key(); - QWidget *widget1 = qobject_cast(object1); - QGraphicsObject *item1 = qobject_cast(object1); + typedef WidgetMultiGestures::const_iterator WidgetMultiGesturesIterator; + for (WidgetMultiGesturesIterator it = widgetMultiGestures.begin(), + e = widgetMultiGestures.end(); it != e; ++it) { + QWidget *widget1 = it.key(); QGesture *gesture1 = it.value(); - ObjectGesturesIterator cit = it; + WidgetMultiGesturesIterator cit = it; for (++cit; cit != e; ++cit) { - QObject *object2 = cit.key(); - QWidget *widget2 = qobject_cast(object2); - QGraphicsObject *item2 = qobject_cast(object2); + QWidget *widget2 = cit.key(); QGesture *gesture2 = cit.value(); + if (gesture1->gestureType() != gesture2->gestureType()) + continue; // TODO: ugly, rewrite this. - if ((widget1 && widget2 && widget2->isAncestorOf(widget1)) || - (item1 && item2 && item2->isAncestorOf(item1))) { - groupedGestures[object2].removeOne(gesture2); - groupedGestures[object1].removeOne(gesture1); - conflictedGestures[object1].append(gesture1); - } else if ((widget1 && widget2 && widget1->isAncestorOf(widget2)) || - (item1 && item2 && item1->isAncestorOf(item2))) { - groupedGestures[object2].removeOne(gesture2); - groupedGestures[object1].removeOne(gesture1); - conflictedGestures[object2].append(gesture2); + if ((widget1 && widget2 && widget2->isAncestorOf(widget1))) { + groupedGestures[widget2].removeOne(gesture2); + groupedGestures[widget1].removeOne(gesture1); + conflictedGestures[widget1].append(gesture1); + } else if ((widget1 && widget2 && widget1->isAncestorOf(widget2))) { + groupedGestures[widget2].removeOne(gesture2); + groupedGestures[widget1].removeOne(gesture1); + conflictedGestures[widget2].append(gesture2); } } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 3ce5b86..a5e66cf 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -105,8 +105,8 @@ class CustomGestureRecognizer : public QGestureRecognizer public: CustomGestureRecognizer() { - CustomEvent::EventType = QEvent::registerEventType(); - eventsCounter = 0; + if (!CustomEvent::EventType) + CustomEvent::EventType = QEvent::registerEventType(); } QGesture* createGesture(QObject *) @@ -123,7 +123,6 @@ public: g->serial = e->serial; if (e->hasHotSpot) g->setHotSpot(e->hotSpot); - ++eventsCounter; if (g->serial >= CustomGesture::SerialFinishedThreshold) result |= QGestureRecognizer::GestureFinished; else if (g->serial >= CustomGesture::SerialStartedThreshold) @@ -143,9 +142,6 @@ public: g->serial = 0; QGestureRecognizer::reset(state); } - - int eventsCounter; - QString name; }; class GestureWidget : public QWidget @@ -272,6 +268,7 @@ private slots: void graphicsItemGesture(); void explicitGraphicsObjectTarget(); void gestureOverChildGraphicsItem(); + void multipleGestures(); }; tst_Gestures::tst_Gestures() @@ -785,5 +782,41 @@ void tst_Gestures::gestureOverChildGraphicsItem() QCOMPARE(item1->gestureOverrideEventsReceived, TotalGestureEventsCount); } +void tst_Gestures::multipleGestures() +{ + GestureWidget parent("parent"); + QVBoxLayout *l = new QVBoxLayout(&parent); + GestureWidget *child = new GestureWidget("child"); + l->addWidget(child); + + Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + + parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); + + CustomEvent event; + // sending events that form a gesture to one widget, but they will be + // filtered by two different gesture recognizers and will generate two + // QGesture objects. Check that those gesture objects are delivered to + // different widgets properly. + sendCustomGesture(&event, child); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + QCOMPARE(child->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureOverrideEventsReceived, 0); + QCOMPARE(child->events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < child->events.all.size(); ++i) + QCOMPARE(child->events.all.at(i), SecondGesture); + + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 0); + QCOMPARE(parent.events.all.size(), TotalGestureEventsCount); + for(int i = 0; i < child->events.all.size(); ++i) + QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 0b61c5e284462376afab15ac9189d759b859ec46 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 15 Oct 2009 21:00:24 +0200 Subject: Improving gesture event delivery for widgets. Reviewed-by: trustme --- src/gui/kernel/qapplication.cpp | 1 + src/gui/kernel/qevent.h | 2 + src/gui/kernel/qgesturemanager.cpp | 214 ++++++++++++++++++++++------------- src/gui/kernel/qgesturemanager_p.h | 12 +- tests/auto/gestures/tst_gestures.cpp | 184 ++++++++++++++++++++++++++++-- 5 files changed, 324 insertions(+), 89 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index aee8afc..af1c1c8 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4204,6 +4204,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) w = w->parentWidget(); } gestureEvent->m_accept = eventAccepted; + gestureEvent->gestures_ = allGestures; } else { res = d->notify_helper(receiver, e); } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 6cba5fb..1ba2d41 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -856,6 +856,8 @@ public: private: QList gestures_; QWidget *widget_; + + friend class QApplication; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 8928d1c..f8e1e49 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -122,7 +122,7 @@ QGesture *QGestureManager::getState(QObject *object, Qt::GestureType type) Q_ASSERT(qobject_cast(object)); } - QWeakPointer state = + QGesture *state = objectGestures.value(QGestureManager::ObjectGesture(object, type)); if (!state) { QGestureRecognizer *recognizer = recognizers.value(type); @@ -130,21 +130,25 @@ QGesture *QGestureManager::getState(QObject *object, Qt::GestureType type) state = recognizer->createGesture(object); if (!state) return 0; - if (state.data()->gestureType() == Qt::CustomGesture) { + if (state->gestureType() == Qt::CustomGesture) { // if the recognizer didn't fill in the gesture type, then this // is a custom gesture with autogenerated it and we fill it. - state.data()->d_func()->gestureType = type; + state->d_func()->gestureType = type; +#if defined(GESTURE_DEBUG) + state->setObjectName(QString::number((int)type)); +#endif } objectGestures.insert(QGestureManager::ObjectGesture(object, type), state); - gestureToRecognizer[state.data()] = recognizer; + gestureToRecognizer[state] = recognizer; + gestureOwners[state] = object; } } - return state.data(); + return state; } bool QGestureManager::filterEventThroughContexts(const QMap &contexts, - QObject *receiver, QEvent *event) + QEvent *event) { QSet triggeredGestures; QSet finishedGestures; @@ -152,6 +156,9 @@ bool QGestureManager::filterEventThroughContexts(const QMap canceledGestures; QSet notGestures; + // TODO: sort contexts by the gesture type and check if one of the contexts + // is already active. + // filter the event through recognizers typedef QMap::const_iterator ContextIterator; for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) { @@ -237,7 +244,7 @@ bool QGestureManager::filterEventThroughContexts(const QMapd_func()->state = Qt::GestureStarted; QSet undeliveredGestures; - deliverEvents(notStarted, receiver, &undeliveredGestures); + deliverEvents(notStarted, &undeliveredGestures); finishedGestures -= undeliveredGestures; } @@ -274,7 +281,7 @@ bool QGestureManager::filterEventThroughContexts(const QMap undeliveredGestures; deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures, - receiver, &undeliveredGestures); + &undeliveredGestures); activeGestures -= undeliveredGestures; @@ -292,38 +299,47 @@ bool QGestureManager::filterEventThroughContexts(const QMap types; QMap contexts; QWidget *w = receiver; + typedef QMap::const_iterator ContextIterator; if (!w->d_func()->gestureContext.isEmpty()) { - typedef QMap::const_iterator ContextIterator; for(ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { + types.insert(it.key()); contexts.insertMulti(w, it.key()); } } // find all gesture contexts for the widget tree - w = w->parentWidget(); + w = w->isWindow() ? 0 : w->parentWidget(); while (w) { - typedef QMap::const_iterator ContextIterator; for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) - contexts.insertMulti(w, it.key()); + if (it.value() == Qt::WidgetWithChildrenGesture) { + if (!types.contains(it.key())) { + types.insert(it.key()); + contexts.insertMulti(w, it.key()); + } + } } + if (w->isWindow()) + break; w = w->parentWidget(); } - return filterEventThroughContexts(contexts , receiver, event); + return filterEventThroughContexts(contexts, event); } -bool QGestureManager::filterEvent(QGraphicsObject *graphicsObject, QEvent *event) +bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) { + QSet types; QMap contexts; - QGraphicsObject *item = graphicsObject; + QGraphicsObject *item = receiver; if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { typedef QMap::const_iterator ContextIterator; for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { + types.insert(it.key()); contexts.insertMulti(item, it.key()); } } @@ -334,55 +350,110 @@ bool QGestureManager::filterEvent(QGraphicsObject *graphicsObject, QEvent *event typedef QMap::const_iterator ContextIterator; for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(), e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::ItemWithChildrenGesture) - contexts.insertMulti(item, it.key()); + if (it.value() == Qt::ItemWithChildrenGesture) { + if (!types.contains(it.key())) + contexts.insertMulti(item, it.key()); + } } item = item->parentObject(); } - return filterEventThroughContexts(contexts, graphicsObject, event); + return filterEventThroughContexts(contexts, event); } bool QGestureManager::filterEvent(QGesture *state, QEvent *event) { QMap contexts; contexts.insert(state, state->gestureType()); - return filterEventThroughContexts(contexts, 0, event); + return filterEventThroughContexts(contexts, event); +} + +void QGestureManager::getGestureTargets(const QSet &gestures, + QMap > *conflicts, + QMap > *normal) +{ + typedef QHash > GestureByTypes; + GestureByTypes gestureByTypes; + + // sort gestures by types + foreach (QGesture *gesture, gestures) { + QWidget *receiver = gestureTargets.value(gesture, 0); + Q_ASSERT(receiver); + gestureByTypes[gesture->gestureType()].insert(receiver, gesture); + } + + // for each gesture type + foreach (Qt::GestureType type, gestureByTypes.keys()) { + QHash gestures = gestureByTypes.value(type); + foreach (QWidget *widget, gestures.keys()) { + QWidget *w = widget->parentWidget(); + while (w) { + QMap::const_iterator it + = w->d_func()->gestureContext.find(type); + if (it != w->d_func()->gestureContext.end()) { + // i.e. 'w' listens to gesture 'type' + Qt::GestureContext context = it.value(); + if (context == Qt::WidgetWithChildrenGesture && w != widget) { + // conflicting gesture! + (*conflicts)[widget].append(gestures[widget]); + break; + } + } + if (w->isWindow()) { + w = 0; + break; + } + w = w->parentWidget(); + } + if (!w) + (*normal)[widget].append(gestures[widget]); + } + } } -void QGestureManager::deliverEvents(const QSet &gestures, - QObject *lastReceiver, +void QGestureManager::deliverEvents(const QSet &gestures, QSet *undeliveredGestures) { if (gestures.isEmpty()) return; - // group gestures by widgets - typedef QMap > GesturesPerReceiver; - GesturesPerReceiver groupedGestures; - // for conflicted gestures the key is always the innermost widget (i.e. the child) - GesturesPerReceiver conflictedGestures; - typedef QMultiHash WidgetMultiGestures; - WidgetMultiGestures widgetMultiGestures; + typedef QMap > GesturesPerWidget; + GesturesPerWidget conflictedGestures; + GesturesPerWidget normalStartedGestures; - foreach (QGesture *gesture, gestures) { - QObject *target = gestureTargets.value(gesture, 0); + QSet startedGestures; + // first figure out the initial receivers of gestures + for (QSet::const_iterator it = gestures.begin(), + e = gestures.end(); it != e; ++it) { + QGesture *gesture = *it; + QWidget *target = gestureTargets.value(gesture, 0); if (!target) { + // the gesture has just started and doesn't have a target yet. Q_ASSERT(gesture->state() == Qt::GestureStarted); if (gesture->hasHotSpot()) { - // guess the target using the hotspot of the gesture + // guess the target widget using the hotspot of the gesture QPoint pt = gesture->hotSpot().toPoint(); if (QWidget *w = qApp->topLevelAt(pt)) { target = w->childAt(w->mapFromGlobal(pt)); } + } else { + // or use the context of the gesture + QObject *context = gestureOwners.value(gesture, 0); + if (context->isWidgetType()) + target = static_cast(context); } - if (!target) - target = lastReceiver; + if (target) + gestureTargets.insert(gesture, target); } + + Qt::GestureType gestureType = gesture->gestureType(); + Q_ASSERT(gestureType != Qt::CustomGesture); + if (target) { - gestureTargets.insert(gesture, target); - if (target->isWidgetType()) - widgetMultiGestures.insert(static_cast(target), gesture); - groupedGestures[target].append(gesture); + if (gesture->state() == Qt::GestureStarted) { + startedGestures.insert(gesture); + } else { + normalStartedGestures[target].append(gesture); + } } else { qWarning() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType(); @@ -390,56 +461,44 @@ void QGestureManager::deliverEvents(const QSet &gestures, } } - typedef WidgetMultiGestures::const_iterator WidgetMultiGesturesIterator; - for (WidgetMultiGesturesIterator it = widgetMultiGestures.begin(), - e = widgetMultiGestures.end(); it != e; ++it) { - QWidget *widget1 = it.key(); - QGesture *gesture1 = it.value(); - WidgetMultiGesturesIterator cit = it; - for (++cit; cit != e; ++cit) { - QWidget *widget2 = cit.key(); - QGesture *gesture2 = cit.value(); - if (gesture1->gestureType() != gesture2->gestureType()) - continue; - // TODO: ugly, rewrite this. - if ((widget1 && widget2 && widget2->isAncestorOf(widget1))) { - groupedGestures[widget2].removeOne(gesture2); - groupedGestures[widget1].removeOne(gesture1); - conflictedGestures[widget1].append(gesture1); - } else if ((widget1 && widget2 && widget1->isAncestorOf(widget2))) { - groupedGestures[widget2].removeOne(gesture2); - groupedGestures[widget1].removeOne(gesture1); - conflictedGestures[widget2].append(gesture2); - } - } - } - - DEBUG() << "deliverEvents: conflicted =" << conflictedGestures.values() - << " grouped =" << groupedGestures.values(); + getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures); + DEBUG() << "QGestureManager::deliverEvents:" + << "\nstarted: " << startedGestures + << "\nconflicted: " << conflictedGestures + << "\nnormal: " << normalStartedGestures + << "\n"; // if there are conflicting gestures, send the GestureOverride event - for (GesturesPerReceiver::const_iterator it = conflictedGestures.begin(), + for (GesturesPerWidget::const_iterator it = conflictedGestures.begin(), e = conflictedGestures.end(); it != e; ++it) { + QWidget *receiver = it.key(); + QList gestures = it.value(); DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to" - << it.key() - << " gestures:" << it.value(); - QGestureEvent event(it.value()); + << receiver + << "gestures:" << gestures; + QGestureEvent event(gestures); event.t = QEvent::GestureOverride; event.ignore(); - QApplication::sendEvent(it.key(), &event); + QApplication::sendEvent(receiver, &event); if (!event.isAccepted()) { - // nobody accepted the GestureOverride, put it back to deliver to - // the closest context (i.e. to the inner-most widget). - DEBUG() <<" override was not accepted"; - groupedGestures[it.key()].append(it.value()); + // nobody accepted the GestureOverride, put gestures that were not + // accepted back to deliver as usual + QList &gestures = normalStartedGestures[receiver]; + foreach(QGesture *gesture, event.allGestures()) { + if (!event.isAccepted(gesture)) { + DEBUG() << "override event wasn't accepted. putting back:" << gesture; + gestures.append(gesture); + } + } } } - for (GesturesPerReceiver::const_iterator it = groupedGestures.begin(), - e = groupedGestures.end(); it != e; ++it) { + // delivering gestures that are not in conflicted state + for (GesturesPerWidget::const_iterator it = normalStartedGestures.begin(), + e = normalStartedGestures.end(); it != e; ++it) { if (!it.value().isEmpty()) { DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key() - << " gestures:" << it.value(); + << "gestures:" << it.value(); QGestureEvent event(it.value()); QApplication::sendEvent(it.key(), &event); } @@ -457,7 +516,8 @@ void QGestureManager::timerEvent(QTimerEvent *event) timer.stop(); QGesture *gesture = it.key(); it = maybeGestures.erase(it); - DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" << gesture; + DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" + << gesture; QGestureRecognizer *recognizer = gestureToRecognizer.value(gesture, 0); if (recognizer) recognizer->reset(gesture); diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index 5fc02ab..f0e7225 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -82,7 +82,7 @@ public: protected: void timerEvent(QTimerEvent *event); bool filterEventThroughContexts(const QMap &contexts, - QObject *receiver, QEvent *event); + QEvent *event); private: QMultiMap recognizers; @@ -114,16 +114,20 @@ private: } }; - QMap > objectGestures; + QMap objectGestures; QMap gestureToRecognizer; + QHash gestureOwners; - QHash gestureTargets; + QHash gestureTargets; int lastCustomGestureId; QGesture *getState(QObject *widget, Qt::GestureType gesture); - void deliverEvents(const QSet &gestures, QObject *lastReceiver, + void deliverEvents(const QSet &gestures, QSet *undeliveredGestures); + void getGestureTargets(const QSet &gestures, + QMap > *conflicts, + QMap > *normal); }; QT_END_NAMESPACE diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index a5e66cf..4d072bc 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -148,7 +148,8 @@ class GestureWidget : public QWidget { Q_OBJECT public: - GestureWidget(const char *name = 0) + GestureWidget(const char *name = 0, QWidget *parent = 0) + : QWidget(parent) { if (name) setObjectName(QLatin1String(name)); @@ -186,14 +187,18 @@ public: } events, overrideEvents; bool acceptGestureOverride; + QSet ignoredGestures; protected: bool event(QEvent *event) { Events *eventsPtr = 0; if (event->type() == QEvent::Gesture) { + QGestureEvent *e = static_cast(event); ++gestureEventsReceived; eventsPtr = &events; + foreach(Qt::GestureType type, ignoredGestures) + e->ignore(e->gesture(type)); } else if (event->type() == QEvent::GestureOverride) { ++gestureOverrideEventsReceived; eventsPtr = &overrideEvents; @@ -268,7 +273,9 @@ private slots: void graphicsItemGesture(); void explicitGraphicsObjectTarget(); void gestureOverChildGraphicsItem(); - void multipleGestures(); + void twoGesturesOnDifferentLevel(); + void multipleGesturesInTree(); + void multipleGesturesInComplexTree(); }; tst_Gestures::tst_Gestures() @@ -442,7 +449,7 @@ void tst_Gestures::conflictingGestures() CustomEvent event; sendCustomGesture(&event, child); - QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, 0); QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); @@ -457,9 +464,9 @@ void tst_Gestures::conflictingGestures() // sending events to the child and making sure there is no conflict sendCustomGesture(&event, child); - QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, 0); - QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, 0); parent.reset(); @@ -472,9 +479,9 @@ void tst_Gestures::conflictingGestures() // sending events to the child and making sure there is no conflict sendCustomGesture(&event, child); - QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); - QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, 0); } @@ -782,7 +789,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() QCOMPARE(item1->gestureOverrideEventsReceived, TotalGestureEventsCount); } -void tst_Gestures::multipleGestures() +void tst_Gestures::twoGesturesOnDifferentLevel() { GestureWidget parent("parent"); QVBoxLayout *l = new QVBoxLayout(&parent); @@ -818,5 +825,166 @@ void tst_Gestures::multipleGestures() QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType); } +void tst_Gestures::multipleGesturesInTree() +{ + GestureWidget a("A"); + GestureWidget *A = &a; + GestureWidget *B = new GestureWidget("B", A); + GestureWidget *C = new GestureWidget("C", B); + GestureWidget *D = new GestureWidget("D", C); + + Qt::GestureType FirstGesture = CustomGesture::GestureType; + Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + + A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3] + A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | + B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // B [ 2 3] + B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | + C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // C [1 2 3] + C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | + C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // D [1 3] + D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); + D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + + // make sure all widgets ignore events, so they get propagated. + A->ignoredGestures << FirstGesture << ThirdGesture; + B->ignoredGestures << SecondGesture << ThirdGesture; + C->ignoredGestures << FirstGesture << SecondGesture << ThirdGesture; + D->ignoredGestures << FirstGesture << ThirdGesture; + + CustomEvent event; + sendCustomGesture(&event, D); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + // gesture override events + QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0); + QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(C->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(C->overrideEvents.all.count(SecondGesture), 1); + QCOMPARE(C->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(B->overrideEvents.all.count(FirstGesture), 0); + QCOMPARE(B->overrideEvents.all.count(SecondGesture), 1); + QCOMPARE(B->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(A->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(A->overrideEvents.all.count(SecondGesture), 0); + QCOMPARE(A->overrideEvents.all.count(ThirdGesture), 1); + + // normal gesture events + QCOMPARE(D->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(D->events.all.count(SecondGesture), 0); + QCOMPARE(D->events.all.count(ThirdGesture), TotalGestureEventsCount); + + QCOMPARE(C->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(SecondGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(ThirdGesture), TotalGestureEventsCount); + + QCOMPARE(B->events.all.count(FirstGesture), 0); + QCOMPARE(B->events.all.count(SecondGesture), TotalGestureEventsCount); + QCOMPARE(B->events.all.count(ThirdGesture), TotalGestureEventsCount); + + QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(A->events.all.count(SecondGesture), 0); + QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount); +} + +void tst_Gestures::multipleGesturesInComplexTree() +{ + GestureWidget a("A"); + GestureWidget *A = &a; + GestureWidget *B = new GestureWidget("B", A); + GestureWidget *C = new GestureWidget("C", B); + GestureWidget *D = new GestureWidget("D", C); + + Qt::GestureType FirstGesture = CustomGesture::GestureType; + Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType FourthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType FifthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType SixthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType SeventhGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer); + + A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4] + A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | + A->grabGesture(FourthGesture, Qt::WidgetWithChildrenGesture); // B [2,3,5] + B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | + B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // C [1,2,3,6] + B->grabGesture(FifthGesture, Qt::WidgetWithChildrenGesture); // | + C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // D [1,3,7] + C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); + C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + C->grabGesture(SixthGesture, Qt::WidgetWithChildrenGesture); + D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); + D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + D->grabGesture(SeventhGesture, Qt::WidgetWithChildrenGesture); + + // make sure all widgets ignore events, so they get propagated. + QSet allGestureTypes; + allGestureTypes << FirstGesture << SecondGesture << ThirdGesture + << FourthGesture << FifthGesture << SixthGesture << SeventhGesture; + A->ignoredGestures = B->ignoredGestures = allGestureTypes; + C->ignoredGestures = D->ignoredGestures = allGestureTypes; + + CustomEvent event; + sendCustomGesture(&event, D); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + // gesture override events + QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0); + QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(C->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(C->overrideEvents.all.count(SecondGesture), 1); + QCOMPARE(C->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(B->overrideEvents.all.count(FirstGesture), 0); + QCOMPARE(B->overrideEvents.all.count(SecondGesture), 1); + QCOMPARE(B->overrideEvents.all.count(ThirdGesture), 1); + + QCOMPARE(A->overrideEvents.all.count(FirstGesture), 1); + QCOMPARE(A->overrideEvents.all.count(SecondGesture), 0); + QCOMPARE(A->overrideEvents.all.count(ThirdGesture), 1); + + // normal gesture events + QCOMPARE(D->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(D->events.all.count(SecondGesture), 0); + QCOMPARE(D->events.all.count(ThirdGesture), TotalGestureEventsCount); + QCOMPARE(D->events.all.count(FourthGesture), 0); + QCOMPARE(D->events.all.count(FifthGesture), 0); + QCOMPARE(D->events.all.count(SixthGesture), 0); + QCOMPARE(D->events.all.count(SeventhGesture), TotalGestureEventsCount); + + QCOMPARE(C->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(SecondGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(ThirdGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(FourthGesture), 0); + QCOMPARE(C->events.all.count(FifthGesture), 0); + QCOMPARE(C->events.all.count(SixthGesture), TotalGestureEventsCount); + QCOMPARE(C->events.all.count(SeventhGesture), 0); + + QCOMPARE(B->events.all.count(FirstGesture), 0); + QCOMPARE(B->events.all.count(SecondGesture), TotalGestureEventsCount); + QCOMPARE(B->events.all.count(ThirdGesture), TotalGestureEventsCount); + QCOMPARE(B->events.all.count(FourthGesture), 0); + QCOMPARE(B->events.all.count(FifthGesture), TotalGestureEventsCount); + QCOMPARE(B->events.all.count(SixthGesture), 0); + QCOMPARE(B->events.all.count(SeventhGesture), 0); + + QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount); + QCOMPARE(A->events.all.count(SecondGesture), 0); + QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount); + QCOMPARE(A->events.all.count(FourthGesture), TotalGestureEventsCount); + QCOMPARE(A->events.all.count(FifthGesture), 0); + QCOMPARE(A->events.all.count(SixthGesture), 0); + QCOMPARE(A->events.all.count(SeventhGesture), 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 0c7254e1c5a20450495afe80c1ad5246e5e48314 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 19 Oct 2009 14:20:02 +0200 Subject: Improvements for gesture event delivery When delivering GestureOverride events by default both the event and individual gestures will be ignored. We also store the acceptance state of individual gesture in the event and not in the gesture object, along with its target. Reviewed-by: Thomas Zander --- src/gui/kernel/qapplication.cpp | 32 ++++++++--------- src/gui/kernel/qevent.cpp | 48 ++++++++++++++++++++------ src/gui/kernel/qevent.h | 7 ++-- src/gui/kernel/qevent_p.h | 14 ++++++++ src/gui/kernel/qgesture_p.h | 3 +- src/gui/kernel/qgesturemanager.cpp | 28 ++++++++++----- tests/auto/gestures/tst_gestures.cpp | 66 ++++++++++++++++++++++++++++++++++-- 7 files changed, 156 insertions(+), 42 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index af1c1c8..7c38d4b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4170,41 +4170,41 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (wd->gestureContext.contains(type)) { allGestures.removeAt(i); gestures.append(g); - gestureEvent->setAccepted(g, false); } else { ++i; } } - if (!gestures.isEmpty()) { + if (!gestures.isEmpty()) { // we have gestures for this w QGestureEvent ge(gestures); ge.t = gestureEvent->t; ge.spont = gestureEvent->spont; ge.m_accept = wasAccepted; + ge.d_func()->accepted = gestureEvent->d_func()->accepted; res = d->notify_helper(w, &ge); gestureEvent->spont = false; eventAccepted = ge.isAccepted(); - if (res && eventAccepted && allGestures.isEmpty()) - break; - if (!eventAccepted) { - // ### two ways to ignore the event/gesture - - // if the whole event wasn't accepted, put back those - // gestures that were not accepted. - for (int i = 0; i < gestures.size(); ++i) { - QGesture *g = gestures.at(i); - if (!ge.isAccepted(g)) - allGestures.append(g); + for (int i = 0; i < gestures.size(); ++i) { + QGesture *g = gestures.at(i); + if ((res && eventAccepted) || (!eventAccepted && ge.isAccepted(g))) { + // if the gesture was accepted, mark the target widget for it + gestureEvent->d_func()->targetWidgets[g->gestureType()] = w; + gestureEvent->setAccepted(g, true); + } else if (!eventAccepted && !ge.isAccepted(g)) { + // if the gesture was explicitly ignored by the application, + // put it back so a parent can get it + allGestures.append(g); } } } - if (allGestures.isEmpty()) + if (allGestures.isEmpty()) // everything delivered break; if (w->isWindow()) break; w = w->parentWidget(); } - gestureEvent->m_accept = eventAccepted; - gestureEvent->gestures_ = allGestures; + foreach (QGesture *g, allGestures) + gestureEvent->setAccepted(g, false); + gestureEvent->m_accept = false; // to make sure we check individual gestures } else { res = d->notify_helper(receiver, e); } diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e49de02..1c6a820 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4223,8 +4223,17 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T Creates new QGestureEvent containing a list of \a gestures. */ QGestureEvent::QGestureEvent(const QList &gestures) - : QEvent(QEvent::Gesture), gestures_(gestures) + : QEvent(QEvent::Gesture) { + d = reinterpret_cast(new QGestureEventPrivate(gestures)); +} + +/*! + Destroys QGestureEvent. +*/ +QGestureEvent::~QGestureEvent() +{ + delete reinterpret_cast(d); } /*! @@ -4232,7 +4241,7 @@ QGestureEvent::QGestureEvent(const QList &gestures) */ QList QGestureEvent::allGestures() const { - return gestures_; + return d_func()->gestures; } /*! @@ -4240,9 +4249,10 @@ QList QGestureEvent::allGestures() const */ QGesture *QGestureEvent::gesture(Qt::GestureType type) const { - for(int i = 0; i < gestures_.size(); ++i) - if (gestures_.at(i)->gestureType() == type) - return gestures_.at(i); + const QGestureEventPrivate *d = d_func(); + for(int i = 0; i < d->gestures.size(); ++i) + if (d->gestures.at(i)->gestureType() == type) + return d->gestures.at(i); return 0; } @@ -4251,7 +4261,7 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const */ QList QGestureEvent::activeGestures() const { - return gestures_; + return d_func()->gestures; } /*! @@ -4259,7 +4269,7 @@ QList QGestureEvent::activeGestures() const */ QList QGestureEvent::canceledGestures() const { - return gestures_; + return d_func()->gestures; } /*! @@ -4279,7 +4289,7 @@ void QGestureEvent::setAccepted(QGesture *gesture, bool value) { setAccepted(false); if (gesture) - gesture->d_func()->accept = value; + d_func()->accepted[gesture->gestureType()] = value; } /*! @@ -4315,7 +4325,7 @@ void QGestureEvent::ignore(QGesture *gesture) */ bool QGestureEvent::isAccepted(QGesture *gesture) const { - return gesture ? gesture->d_func()->accept : false; + return gesture ? d_func()->accepted.value(gesture->gestureType(), true) : false; } /*! @@ -4323,7 +4333,7 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const */ void QGestureEvent::setWidget(QWidget *widget) { - widget_ = widget; + d_func()->widget = widget; } /*! @@ -4331,7 +4341,23 @@ void QGestureEvent::setWidget(QWidget *widget) */ QWidget *QGestureEvent::widget() const { - return widget_; + return d_func()->widget; +} + +/*! + \internal +*/ +QGestureEventPrivate *QGestureEvent::d_func() +{ + return reinterpret_cast(d); +} + +/*! + \internal +*/ +const QGestureEventPrivate *QGestureEvent::d_func() const +{ + return reinterpret_cast(d); } #ifdef Q_NO_USING_KEYWORD diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 1ba2d41..5eefc2d 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -820,10 +820,12 @@ protected: }; class QGesture; +class QGestureEventPrivate; class Q_GUI_EXPORT QGestureEvent : public QEvent { public: QGestureEvent(const QList &gestures); + ~QGestureEvent(); QList allGestures() const; QGesture *gesture(Qt::GestureType type) const; @@ -854,10 +856,11 @@ public: QWidget *widget() const; private: - QList gestures_; - QWidget *widget_; + QGestureEventPrivate *d_func(); + const QGestureEventPrivate *d_func() const; friend class QApplication; + friend class QGestureManager; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index c7a4975..6e6ab01 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -150,6 +150,20 @@ public: #endif }; +class QGestureEventPrivate +{ +public: + inline QGestureEventPrivate(const QList &list) + : gestures(list), widget(0) + { + } + + QList gestures; + QWidget *widget; + QMap accepted; + QMap targetWidgets; +}; + QT_END_NAMESPACE #endif // QEVENT_P_H diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 7f69a4e..10887f6 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -68,7 +68,7 @@ class QGesturePrivate : public QObjectPrivate public: QGesturePrivate() : gestureType(Qt::CustomGesture), state(Qt::NoGesture), isHotSpotSet(false), - targetObject(0), accept(true) + targetObject(0) { } @@ -77,7 +77,6 @@ public: QPointF hotSpot; bool isHotSpotSet; QObject *targetObject; - bool accept; }; class QPanGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index f8e1e49..b4913f0 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -44,6 +44,7 @@ #include "private/qwidget_p.h" #include "private/qgesture_p.h" #include "private/qgraphicsitem_p.h" +#include "private/qevent_p.h" #include "qgesture.h" #include "qevent.h" #include "qgraphicsitem.h" @@ -478,17 +479,26 @@ void QGestureManager::deliverEvents(const QSet &gestures, << "gestures:" << gestures; QGestureEvent event(gestures); event.t = QEvent::GestureOverride; + // mark event and individual gestures as ignored event.ignore(); + foreach(QGesture *g, gestures) + event.setAccepted(g, false); + QApplication::sendEvent(receiver, &event); - if (!event.isAccepted()) { - // nobody accepted the GestureOverride, put gestures that were not - // accepted back to deliver as usual - QList &gestures = normalStartedGestures[receiver]; - foreach(QGesture *gesture, event.allGestures()) { - if (!event.isAccepted(gesture)) { - DEBUG() << "override event wasn't accepted. putting back:" << gesture; - gestures.append(gesture); - } + bool eventAccepted = event.isAccepted(); + foreach(QGesture *gesture, event.allGestures()) { + if (eventAccepted || event.isAccepted(gesture)) { + QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); + Q_ASSERT(w); + DEBUG() << "override event: gesture was accepted:" << gesture << w; + QList &gestures = normalStartedGestures[w]; + gestures.append(gesture); + // override the target + gestureTargets[gesture] = w; + } else { + DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture; + QList &gestures = normalStartedGestures[receiver]; + gestures.append(gesture); } } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 4d072bc..28dd40c 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -144,6 +144,49 @@ public: } }; +// same as CustomGestureRecognizer but triggers early without the maybe state +class CustomContinuousGestureRecognizer : public QGestureRecognizer +{ +public: + CustomContinuousGestureRecognizer() + { + if (!CustomEvent::EventType) + CustomEvent::EventType = QEvent::registerEventType(); + } + + QGesture* createGesture(QObject *) + { + return new CustomGesture; + } + + QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + { + if (event->type() == CustomEvent::EventType) { + QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; + CustomGesture *g = static_cast(state); + CustomEvent *e = static_cast(event); + g->serial = e->serial; + if (e->hasHotSpot) + g->setHotSpot(e->hotSpot); + if (g->serial >= CustomGesture::SerialFinishedThreshold) + result |= QGestureRecognizer::GestureFinished; + else if (g->serial >= CustomGesture::SerialMaybeThreshold) + result |= QGestureRecognizer::GestureTriggered; + else + result = QGestureRecognizer::NotGesture; + return result; + } + return QGestureRecognizer::Ignore; + } + + void reset(QGesture *state) + { + CustomGesture *g = static_cast(state); + g->serial = 0; + QGestureRecognizer::reset(state); + } +}; + class GestureWidget : public QWidget { Q_OBJECT @@ -163,6 +206,7 @@ public: gestureOverrideEventsReceived = 0; events.clear(); overrideEvents.clear(); + ignoredGestures.clear(); } int customEventsReceived; @@ -450,7 +494,7 @@ void tst_Gestures::conflictingGestures() sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, 1); - QCOMPARE(child->gestureEventsReceived, 0); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); @@ -467,7 +511,7 @@ void tst_Gestures::conflictingGestures() QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, 0); QCOMPARE(parent.gestureOverrideEventsReceived, 1); - QCOMPARE(parent.gestureEventsReceived, 0); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); parent.reset(); child->reset(); @@ -475,6 +519,7 @@ void tst_Gestures::conflictingGestures() // nobody accepts the override, we will send normal events to the closest context (to the child) parent.acceptGestureOverride = false; child->acceptGestureOverride = false; + child->ignoredGestures << CustomGesture::GestureType; // sending events to the child and making sure there is no conflict sendCustomGesture(&event, child); @@ -482,6 +527,23 @@ void tst_Gestures::conflictingGestures() QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + + parent.reset(); + child->reset(); + + Qt::GestureType ContinuousGesture = qApp->registerGestureRecognizer(new CustomContinuousGestureRecognizer); + static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + child->grabGesture(ContinuousGesture); + // child accepts override. And it also receives another custom gesture. + parent.acceptGestureOverride = false; + child->acceptGestureOverride = true; + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); + QVERIFY(child->gestureEventsReceived > TotalGestureEventsCount); + QCOMPARE(child->events.all.count(), TotalGestureEventsCount + ContinuousGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); } -- cgit v0.12 From 75599a71e957cae29ddd4d3df9e89d9d4edc0b3d Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 19 Oct 2009 17:21:59 +0200 Subject: Fix for the gestures autotest. Reviewed-by: trustme --- src/gui/kernel/qgesturemanager.cpp | 3 ++- tests/auto/gestures/tst_gestures.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index b4913f0..6f1aec4 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -456,8 +456,9 @@ void QGestureManager::deliverEvents(const QSet &gestures, normalStartedGestures[target].append(gesture); } } else { - qWarning() << "QGestureManager::deliverEvent: could not find the target for gesture" + DEBUG() << "QGestureManager::deliverEvent: could not find the target for gesture" << gesture->gestureType(); + qWarning("QGestureManager::deliverEvent: could not find the target for gesture"); undeliveredGestures->insert(gesture); } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 28dd40c..0c09265 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -703,18 +703,16 @@ void tst_Gestures::graphicsItemGesture() static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; CustomEvent event; + // gesture without hotspot should not be delivered to items in the view + QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture"); + QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture"); + QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture"); + QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture"); sendCustomGesture(&event, item, &scene); QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); - QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureEventsReceived, 0); QCOMPARE(item->gestureOverrideEventsReceived, 0); - QCOMPARE(item->events.all.size(), TotalGestureEventsCount); - for(int i = 0; i < item->events.all.size(); ++i) - QCOMPARE(item->events.all.at(i), CustomGesture::GestureType); - QCOMPARE(item->events.started.size(), 1); - QCOMPARE(item->events.updated.size(), TotalGestureEventsCount - 2); - QCOMPARE(item->events.finished.size(), 1); - QCOMPARE(item->events.canceled.size(), 0); item->reset(); -- cgit v0.12 From 0f1f53414de3e7d1b62149ee42a334c6f2d01f78 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 19 Oct 2009 19:11:19 +0200 Subject: Add QGestureEvent::mapToScene for better graphicsView integration --- src/gui/kernel/qevent.cpp | 18 ++++++++++++++++++ src/gui/kernel/qevent.h | 2 ++ src/gui/kernel/qgesture.cpp | 4 ++++ tests/auto/gestures/tst_gestures.cpp | 26 ++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 1c6a820..ef74f06 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -45,6 +45,7 @@ #include "private/qapplication_p.h" #include "private/qkeysequence_p.h" #include "qwidget.h" +#include "qgraphicsview.h" #include "qdebug.h" #include "qmime.h" #include "qdnd_p.h" @@ -4345,6 +4346,23 @@ QWidget *QGestureEvent::widget() const } /*! + Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view. + + \sa QPointF::isNull(). +*/ +QPointF QGestureEvent::mapToScene(const QPointF &gesturePoint) const +{ + QWidget *w = widget(); + if (w) // we get the viewport as widget, not the graphics view + w = w->parentWidget(); + QGraphicsView *view = qobject_cast(w); + if (view) { + return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint())); + } + return QPointF(); +} + +/*! \internal */ QGestureEventPrivate *QGestureEvent::d_func() diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 5eefc2d..249c45a 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -855,6 +855,8 @@ public: void setWidget(QWidget *widget); QWidget *widget() const; + QPointF mapToScene(const QPointF &gesturePoint) const; + private: QGestureEventPrivate *d_func(); const QGestureEventPrivate *d_func() const; diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index e48fd8e..f044c09 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -129,6 +129,10 @@ QGesture::~QGesture() \brief The point that is used to find the receiver for the gesture event. + The hot-spot is a point in the global coordinate system, use + QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a + local hot-spot. + If the hot-spot is not set, the targetObject is used as the receiver of the gesture event. */ diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 0c09265..09da7d6 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -320,6 +320,7 @@ private slots: void twoGesturesOnDifferentLevel(); void multipleGesturesInTree(); void multipleGesturesInComplexTree(); + void testMapToScene(); }; tst_Gestures::tst_Gestures() @@ -1046,5 +1047,30 @@ void tst_Gestures::multipleGesturesInComplexTree() QCOMPARE(A->events.all.count(SeventhGesture), 0); } +void tst_Gestures::testMapToScene() +{ + QGesture gesture; + QList list; + list << &gesture; + QGestureEvent event(list); + QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much + + QGraphicsScene scene; + QGraphicsView view(&scene); + + GestureItem *item0 = new GestureItem; + scene.addItem(item0); + item0->setPos(14, 16); + + view.show(); // need to show to give it a global coordinate + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + QPoint origin = view.mapToGlobal(QPoint()); + event.setWidget(view.viewport()); + + QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 6406a786990a7526120871dceb318ff788d609e2 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 20 Oct 2009 21:01:02 +0200 Subject: Added debug operator for QGraphicsObject Reviewed-by: Alexis Menard --- src/gui/graphicsview/qgraphicsitem.cpp | 17 +++++++++++++++++ src/gui/graphicsview/qgraphicsitem.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 4b2ff52..709066c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10742,6 +10742,23 @@ QDebug operator<<(QDebug debug, QGraphicsItem *item) return debug; } +QDebug operator<<(QDebug debug, QGraphicsObject *item) +{ + if (!item) { + debug << "QGraphicsObject(0)"; + return debug; + } + + debug.nospace() << item->metaObject()->className() << '(' << (void*)item; + if (!item->objectName().isEmpty()) + debug << ", name = " << item->objectName(); + debug.nospace() << ", parent = " << ((void*)item->parentItem()) + << ", pos = " << item->pos() + << ", z = " << item->zValue() << ", flags = " + << item->flags() << ')'; + return debug.space(); +} + QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change) { const char *str = "UnknownChange"; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 54a7a64..f3fe99c 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -1120,6 +1120,7 @@ template inline T qgraphicsitem_cast(const QGraphicsItem *item) #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); +Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags); -- cgit v0.12 From 9cf2b77328fce9b7663876966112af6ed374df5b Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 20 Oct 2009 21:01:56 +0200 Subject: Implemented gesture event delivery and propagation inside QGraphicsView. Reviewed-by: Thomas Zander --- src/gui/graphicsview/qgraphicsscene.cpp | 249 +++++++++++++++++++++++++++++--- src/gui/graphicsview/qgraphicsscene_p.h | 5 + tests/auto/gestures/tst_gestures.cpp | 134 ++++++++++++++--- 3 files changed, 350 insertions(+), 38 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 373ee89..005563e 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -252,6 +252,13 @@ #include #include +// #define GESTURE_DEBUG +#ifndef GESTURE_DEBUG +# define DEBUG if (0) qDebug +#else +# define DEBUG qDebug +#endif + QT_BEGIN_NAMESPACE bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); @@ -5711,28 +5718,234 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel) dispatchHoverEvent(&hoverEvent); } +void QGraphicsScenePrivate::getGestureTargets(const QSet &gestures, + QWidget *viewport, + QMap *conflictedGestures, + QList > *conflictedItems, + QHash *normalGestures) +{ + foreach (QGesture *gesture, gestures) { + Qt::GestureType gestureType = gesture->gestureType(); + if (gesture->hasHotSpot()) { + QPoint screenPos = gesture->hotSpot().toPoint(); + QList items = itemsAtPosition(screenPos, QPointF(), viewport); + QList result; + for (int j = 0; j < items.size(); ++j) { + QGraphicsObject *item = items.at(j)->toGraphicsObject(); + if (!item) + continue; + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + if (d->gestureContext.contains(gestureType)) { + result.append(item); + } + } + DEBUG() << "QGraphicsScenePrivate::getGestureTargets:" + << gesture << result; + if (result.size() == 1) { + normalGestures->insert(gesture, result.first()); + } else if (!result.isEmpty()) { + conflictedGestures->insert(gestureType, gesture); + conflictedItems->append(result); + } + } + } +} + void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) { QWidget *viewport = event->widget(); - QList gestures = event->allGestures(); - for (int i = 0; i < gestures.size(); ++i) { - QGesture *gesture = gestures.at(i); - Qt::GestureType gestureType = gesture->gestureType(); - QPoint screenPos = gesture->hotSpot().toPoint(); - QList items = itemsAtPosition(screenPos, QPointF(), viewport); - for (int j = 0; j < items.size(); ++j) { - QGraphicsObject *item = items.at(j)->toGraphicsObject(); - if (!item) - continue; - QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); - if (d->gestureContext.contains(gestureType)) { - QGestureEvent ev(QList() << gesture); - ev.t = event->t; - ev.spont = event->spont; - ev.setWidget(event->widget()); - sendEvent(item, &ev); - break; + if (!viewport) + return; + QList allGestures = event->allGestures(); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "Delivering gestures:" << allGestures; + + typedef QHash > GesturesPerItem; + GesturesPerItem gesturesPerItem; + + QSet startedGestures; + foreach (QGesture *gesture, allGestures) { + QGraphicsObject *target = gestureTargets.value(gesture, 0); + if (!target) { + // when we are not in started mode but don't have a target + // then the only one interested in gesture is the view/scene + if (gesture->state() == Qt::GestureStarted) + startedGestures.insert(gesture); + } else { + gesturesPerItem[target].append(gesture); + } + } + + QMap conflictedGestures; + QList > conflictedItems; + QHash normalGestures; + getGestureTargets(startedGestures, viewport, &conflictedGestures, &conflictedItems, + &normalGestures); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "Conflicting gestures:" << conflictedGestures.values() << conflictedItems; + Q_ASSERT((conflictedGestures.isEmpty() && conflictedItems.isEmpty()) || + (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty())); + + // gestures that were sent as override events, but no one accepted them + QHash ignoredConflictedGestures; + + // deliver conflicted gestures as override events first + while (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()) { + // get the topmost item to deliver the override event + Q_ASSERT(!conflictedItems.isEmpty()); + Q_ASSERT(!conflictedItems.first().isEmpty()); + QGraphicsObject *topmost = conflictedItems.first().first(); + for (int i = 1; i < conflictedItems.size(); ++i) { + QGraphicsObject *item = conflictedItems.at(i).first(); + if (qt_closestItemFirst(item, topmost)) { + topmost = item; + } + } + // get a list of gestures to send to the item + QList grabbedGestures = + topmost->QGraphicsItem::d_func()->gestureContext.keys(); + QList gestures; + for (int i = 0; i < grabbedGestures.size(); ++i) { + if (QGesture *g = conflictedGestures.value(grabbedGestures.at(i), 0)) { + gestures.append(g); + if (!ignoredConflictedGestures.contains(g)) + ignoredConflictedGestures.insert(g, topmost); + } + } + + // send gesture override to the topmost item + QGestureEvent ev(gestures); + ev.t = QEvent::GestureOverride; + ev.setWidget(event->widget()); + // mark event and individual gestures as ignored + ev.ignore(); + foreach(QGesture *g, gestures) + ev.setAccepted(g, false); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "delivering override to" + << topmost << gestures; + sendEvent(topmost, &ev); + // mark all accepted gestures to deliver them as normal gesture events + foreach (QGesture *g, gestures) { + if (ev.isAccepted() || ev.isAccepted(g)) { + conflictedGestures.remove(g->gestureType()); + gestureTargets.remove(g); + // add the gesture to the list of normal delivered gestures + normalGestures.insert(g, topmost); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "override was accepted:" + << g << topmost; + ignoredConflictedGestures.remove(g); + } + } + // remove the item that we've already delivered from the list + for (int i = 0; i < conflictedItems.size(); ) { + QList &items = conflictedItems[i]; + if (items.first() == topmost) { + items.removeFirst(); + if (items.isEmpty()) { + conflictedItems.removeAt(i); + continue; + } } + ++i; + } + } + + // put back those started gestures that are not in the conflicted state + // and remember their targets + QHash::const_iterator it = normalGestures.begin(), + e = normalGestures.end(); + for (; it != e; ++it) { + QGesture *g = it.key(); + QGraphicsObject *receiver = it.value(); + Q_ASSERT(!gestureTargets.contains(g)); + gestureTargets.insert(g, receiver); + gesturesPerItem[receiver].append(g); + } + it = ignoredConflictedGestures.begin(); + e = ignoredConflictedGestures.end(); + for (; it != e; ++it) { + QGesture *g = it.key(); + QGraphicsObject *receiver = it.value(); + Q_ASSERT(!gestureTargets.contains(g)); + gestureTargets.insert(g, receiver); + gesturesPerItem[receiver].append(g); + } + + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "Started gestures:" << normalGestures.keys() + << "All gestures:" << gesturesPerItem.values(); + + // deliver all events + QList alreadyIgnoredGestures; + QHash > itemIgnoredGestures; + QList targetItems = gesturesPerItem.keys(); + qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst); + for (int i = 0; i < targetItems.size(); ++i) { + QGraphicsObject *item = targetItems.at(i); + QList gestures = gesturesPerItem.value(item); + // remove gestures that were already delivered once and were ignored + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "already ignored gestures for item" + << item << ":" << itemIgnoredGestures.value(item); + + if (itemIgnoredGestures.contains(item)) // don't deliver twice to the same item + continue; + + QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); + foreach(QGesture *g, alreadyIgnoredGestures) { + if (gid->gestureContext.contains(g->gestureType())) + gestures += g; + } + if (gestures.isEmpty()) + continue; + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "delivering to" + << item << gestures; + QGestureEvent ev(gestures); + ev.setWidget(event->widget()); + sendEvent(item, &ev); + QSet ignoredGestures; + foreach (QGesture *g, gestures) { + if (!ev.isAccepted() && !ev.isAccepted(g)) + ignoredGestures.insert(g); + } + if (!ignoredGestures.isEmpty()) { + // get a list of items under the (current) hotspot of each ignored + // gesture and start delivery again from the beginning + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "item has ignored the event, will propagate." + << item << ignoredGestures; + itemIgnoredGestures[item] += ignoredGestures; + QMap conflictedGestures; + QList > itemsForConflictedGestures; + QHash normalGestures; + getGestureTargets(ignoredGestures, viewport, + &conflictedGestures, &itemsForConflictedGestures, + &normalGestures); + QSet itemsSet = targetItems.toSet(); + for (int k = 0; k < itemsForConflictedGestures.size(); ++k) + itemsSet += itemsForConflictedGestures.at(k).toSet(); + targetItems = itemsSet.toList(); + qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst); + alreadyIgnoredGestures = conflictedGestures.values(); + DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" + << "new targets:" << targetItems; + i = -1; // start delivery again + continue; + } + } + + // forget about targets for gestures that have ended + foreach (QGesture *g, allGestures) { + switch (g->state()) { + case Qt::GestureFinished: + case Qt::GestureCanceled: + gestureTargets.remove(g); + break; + default: + break; } } } diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 4c82b49..cd20fd0 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -282,7 +282,12 @@ public: bool allItemsIgnoreTouchEvents; void enableTouchEventsOnViews(); + QHash gestureTargets; void gestureEventHandler(QGestureEvent *event); + void getGestureTargets(const QSet &gestures, QWidget *viewport, + QMap *conflictedGestures, + QList > *conflictedItems, + QHash *normalGestures); void updateInputMethodSensitivityInViews(); diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 09da7d6..92f979f 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -315,6 +315,7 @@ private slots: void finishedWithoutStarted(); void unknownGesture(); void graphicsItemGesture(); + void graphicsItemTreeGesture(); void explicitGraphicsObjectTarget(); void gestureOverChildGraphicsItem(); void twoGesturesOnDifferentLevel(); @@ -583,11 +584,20 @@ void tst_Gestures::unknownGesture() QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount); } +static const QColor InstanceColors[] = { + Qt::blue, Qt::red, Qt::green, Qt::gray, Qt::yellow +}; + class GestureItem : public QGraphicsObject { + static int InstanceCount; + public: - GestureItem() + GestureItem(const char *name = 0) { + instanceNumber = InstanceCount++; + if (name) + setObjectName(QLatin1String(name)); size = QRectF(0, 0, 100, 100); customEventsReceived = 0; gestureEventsReceived = 0; @@ -596,6 +606,10 @@ public: overrideEvents.clear(); acceptGestureOverride = false; } + ~GestureItem() + { + --InstanceCount; + } int customEventsReceived; int gestureEventsReceived; @@ -619,8 +633,10 @@ public: } events, overrideEvents; bool acceptGestureOverride; + QSet ignoredGestures; QRectF size; + int instanceNumber; void reset() { @@ -629,6 +645,7 @@ public: gestureOverrideEventsReceived = 0; events.clear(); overrideEvents.clear(); + ignoredGestures.clear(); } protected: @@ -638,7 +655,8 @@ protected: } void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { - p->fillRect(boundingRect(), Qt::blue); + QColor color = InstanceColors[instanceNumber % (sizeof(InstanceColors)/sizeof(InstanceColors[0]))]; + p->fillRect(boundingRect(), color); } bool event(QEvent *event) @@ -647,6 +665,9 @@ protected: if (event->type() == QEvent::Gesture) { ++gestureEventsReceived; eventsPtr = &events; + QGestureEvent *e = static_cast(event); + foreach(Qt::GestureType type, ignoredGestures) + e->ignore(e->gesture(type)); } else if (event->type() == QEvent::GestureOverride) { ++gestureOverrideEventsReceived; eventsPtr = &overrideEvents; @@ -683,13 +704,14 @@ protected: return true; } }; +int GestureItem::InstanceCount = 0; void tst_Gestures::graphicsItemGesture() { QGraphicsScene scene; QGraphicsView view(&scene); - GestureItem *item = new GestureItem; + GestureItem *item = new GestureItem("item"); scene.addItem(item); item->setPos(100, 100); @@ -732,6 +754,75 @@ void tst_Gestures::graphicsItemGesture() QCOMPARE(item->events.updated.size(), TotalGestureEventsCount - 2); QCOMPARE(item->events.finished.size(), 1); QCOMPARE(item->events.canceled.size(), 0); + + item->reset(); + + // send gesture to the item which ignores it. + item->ignoredGestures << CustomGesture::GestureType; + + event.hotSpot = mapToGlobal(QPointF(10, 10), item, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item, &scene); + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); +} + +void tst_Gestures::graphicsItemTreeGesture() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + GestureItem *item1 = new GestureItem("item1"); + item1->setPos(100, 100); + item1->size = QRectF(0, 0, 350, 200); + scene.addItem(item1); + + GestureItem *item1_child1 = new GestureItem("item1_child1"); + item1_child1->setPos(50, 50); + item1_child1->size = QRectF(0, 0, 100, 100); + item1_child1->setParentItem(item1); + + GestureItem *item1_child2 = new GestureItem("item1_child2"); + item1_child2->size = QRectF(0, 0, 100, 100); + item1_child2->setPos(200, 50); + item1_child2->setParentItem(item1); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + item1->grabGesture(CustomGesture::GestureType); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(10, 10), item1_child1, &view); + event.hasHotSpot = true; + + item1->ignoredGestures << CustomGesture::GestureType; + sendCustomGesture(&event, item1_child1, &scene); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child2->gestureEventsReceived, 0); + QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + + item1->reset(); item1_child1->reset(); item1_child2->reset(); + + item1_child1->grabGesture(CustomGesture::GestureType); + + item1->ignoredGestures << CustomGesture::GestureType; + item1_child1->ignoredGestures << CustomGesture::GestureType; + sendCustomGesture(&event, item1_child1, &scene); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_child2->gestureEventsReceived, 0); + QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); } void tst_Gestures::explicitGraphicsObjectTarget() @@ -739,15 +830,17 @@ void tst_Gestures::explicitGraphicsObjectTarget() QGraphicsScene scene; QGraphicsView view(&scene); - GestureItem *item1 = new GestureItem; + GestureItem *item1 = new GestureItem("item1"); scene.addItem(item1); item1->setPos(100, 100); + item1->setZValue(1); - GestureItem *item2 = new GestureItem; + GestureItem *item2 = new GestureItem("item2"); scene.addItem(item2); item2->setPos(100, 100); + item2->setZValue(5); - GestureItem *item2_child1 = new GestureItem; + GestureItem *item2_child1 = new GestureItem("item2_child1"); scene.addItem(item2_child1); item2_child1->setParentItem(item2); item2_child1->setPos(10, 10); @@ -771,9 +864,9 @@ void tst_Gestures::explicitGraphicsObjectTarget() sendCustomGesture(&event, item1, &scene); QCOMPARE(item1->gestureEventsReceived, 0); - QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); QCOMPARE(item2_child1->gestureEventsReceived, TotalGestureEventsCount); - QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 1); QCOMPARE(item2_child1->events.all.size(), TotalGestureEventsCount); for(int i = 0; i < item2_child1->events.all.size(); ++i) QCOMPARE(item2_child1->events.all.at(i), CustomGesture::GestureType); @@ -782,7 +875,7 @@ void tst_Gestures::explicitGraphicsObjectTarget() QCOMPARE(item2_child1->events.finished.size(), 1); QCOMPARE(item2_child1->events.canceled.size(), 0); QCOMPARE(item2->gestureEventsReceived, 0); - QCOMPARE(item2->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); } void tst_Gestures::gestureOverChildGraphicsItem() @@ -790,19 +883,23 @@ void tst_Gestures::gestureOverChildGraphicsItem() QGraphicsScene scene; QGraphicsView view(&scene); - GestureItem *item0 = new GestureItem; + GestureItem *item0 = new GestureItem("item0"); scene.addItem(item0); item0->setPos(0, 0); + item0->grabGesture(CustomGesture::GestureType); + item0->setZValue(1); - GestureItem *item1 = new GestureItem; + GestureItem *item1 = new GestureItem("item1"); scene.addItem(item1); item1->setPos(100, 100); + item1->setZValue(5); - GestureItem *item2 = new GestureItem; + GestureItem *item2 = new GestureItem("item2"); scene.addItem(item2); item2->setPos(100, 100); + item2->setZValue(10); - GestureItem *item2_child1 = new GestureItem; + GestureItem *item2_child1 = new GestureItem("item2_child1"); scene.addItem(item2_child1); item2_child1->setParentItem(item2); item2_child1->setPos(0, 0); @@ -827,12 +924,12 @@ void tst_Gestures::gestureOverChildGraphicsItem() QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, 0); QCOMPARE(item2->gestureOverrideEventsReceived, 0); - QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(item1->gestureOverrideEventsReceived, 0); item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); event.hasHotSpot = true; @@ -841,13 +938,10 @@ void tst_Gestures::gestureOverChildGraphicsItem() QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); - QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); - QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); - QCOMPARE(item2->gestureOverrideEventsReceived, TotalGestureEventsCount); - QCOMPARE(item1->gestureEventsReceived, 0); - QEXPECT_FAIL("", "need to fix gesture event propagation inside graphicsview", Continue); - QCOMPARE(item1->gestureOverrideEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); } void tst_Gestures::twoGesturesOnDifferentLevel() -- cgit v0.12 From 6c7d3f73e361c460ad5523f1d9c9d9d6ebc81299 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 21 Oct 2009 16:33:11 +0200 Subject: Fixed the gestures/graphicsview manualtest --- tests/manual/gestures/graphicsview/main.cpp | 2 ++ .../graphicsview/mousepangesturerecognizer.cpp | 25 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index 263a963..b4d74e4 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -126,6 +126,8 @@ public: scene = new QGraphicsScene(this); scene->setSceneRect(-2000, -2000, 4000, 4000); view = new QGraphicsView(scene, 0); + view->viewport()->grabGesture(Qt::PanGesture); + view->viewport()->grabGesture(ThreeFingerSlideGesture::Type); QVBoxLayout *l = new QVBoxLayout(this); l->addWidget(view); } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index 0e7f538..acd525f 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -42,6 +42,8 @@ #include "mousepangesturerecognizer.h" #include +#include +#include #include #include @@ -57,16 +59,31 @@ QGesture* MousePanGestureRecognizer::createGesture(QObject *) QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast(state); - QMouseEvent *me = static_cast(event); + QPoint globalPos; + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMouseRelease: + globalPos = static_cast(event)->screenPos(); + break; + case QEvent::MouseButtonPress: + case QEvent::MouseMove: + case QEvent::MouseButtonRelease: + globalPos = static_cast(event)->globalPos(); + break; + default: + break; + } if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) { - g->setHotSpot(me->globalPos()); - g->setProperty("lastPos", me->globalPos()); + g->setHotSpot(globalPos); + g->setProperty("lastPos", globalPos); g->setProperty("pressed", QVariant::fromValue(true)); return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = me->globalPos(); + QPoint pos = globalPos; QPoint lastPos = g->property("lastPos").toPoint(); g->setLastOffset(g->offset()); lastPos = pos - lastPos; -- cgit v0.12 From ee6d3a13a04c2fb5cfef8a18fd370ef1f605555a Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 20 Oct 2009 15:09:58 +0200 Subject: Make the already-public calls be documented and public --- src/gui/kernel/qevent.cpp | 4 ++-- src/gui/kernel/qevent.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ef74f06..065bd09 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4330,7 +4330,7 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const } /*! - \internal + Sets the widget for this event. */ void QGestureEvent::setWidget(QWidget *widget) { @@ -4338,7 +4338,7 @@ void QGestureEvent::setWidget(QWidget *widget) } /*! - \internal + Returns the widget on which the event occurred. */ QWidget *QGestureEvent::widget() const { diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 249c45a..b7370fd 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -851,7 +851,6 @@ public: void ignore(QGesture *); bool isAccepted(QGesture *) const; - // internal void setWidget(QWidget *widget); QWidget *widget() const; -- cgit v0.12 From 04302702c5e7938fb4ae8bc41d78486725e62ae7 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 20 Oct 2009 15:43:05 +0200 Subject: Change API; the pan gesture now has points for distance, not size. --- src/gui/kernel/qgesture.cpp | 12 ++++++------ src/gui/kernel/qgesture.h | 18 +++++++++--------- src/gui/kernel/qgesture_p.h | 6 +++--- src/gui/kernel/qstandardgestures.cpp | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index f044c09..ecdd661 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -235,17 +235,17 @@ QPanGesture::QPanGesture(QObject *parent) d_func()->gestureType = Qt::PanGesture; } -QSizeF QPanGesture::totalOffset() const +QPointF QPanGesture::totalOffset() const { return d_func()->totalOffset; } -QSizeF QPanGesture::lastOffset() const +QPointF QPanGesture::lastOffset() const { return d_func()->lastOffset; } -QSizeF QPanGesture::offset() const +QPointF QPanGesture::offset() const { return d_func()->offset; } @@ -256,17 +256,17 @@ qreal QPanGesture::acceleration() const } -void QPanGesture::setTotalOffset(const QSizeF &value) +void QPanGesture::setTotalOffset(const QPointF &value) { d_func()->totalOffset = value; } -void QPanGesture::setLastOffset(const QSizeF &value) +void QPanGesture::setLastOffset(const QPointF &value) { d_func()->lastOffset = value; } -void QPanGesture::setOffset(const QSizeF &value) +void QPanGesture::setOffset(const QPointF &value) { d_func()->offset = value; } diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 9d1c11e..6469959 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -96,22 +96,22 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) - Q_PROPERTY(QSizeF totalOffset READ totalOffset WRITE setTotalOffset) - Q_PROPERTY(QSizeF lastOffset READ lastOffset WRITE setLastOffset) - Q_PROPERTY(QSizeF offset READ offset WRITE setOffset) + Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset) + Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset) + Q_PROPERTY(QPointF offset READ offset WRITE setOffset) Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) public: QPanGesture(QObject *parent = 0); - QSizeF totalOffset() const; - QSizeF lastOffset() const; - QSizeF offset() const; + QPointF totalOffset() const; + QPointF lastOffset() const; + QPointF offset() const; qreal acceleration() const; - void setTotalOffset(const QSizeF &value); - void setLastOffset(const QSizeF &value); - void setOffset(const QSizeF &value); + void setTotalOffset(const QPointF &value); + void setLastOffset(const QPointF &value); + void setOffset(const QPointF &value); void setAcceleration(qreal value); friend class QPanGestureRecognizer; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 10887f6..975c0c9 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -89,9 +89,9 @@ public: { } - QSizeF totalOffset; - QSizeF lastOffset; - QSizeF offset; + QPointF totalOffset; + QPointF lastOffset; + QPointF offset; QPoint lastPosition; qreal acceleration; }; diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index dfc3499..a136379 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -73,7 +73,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q result = QGestureRecognizer::MaybeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = d->offset = QSize(); + d->lastOffset = d->totalOffset = d->offset = QPointF(); break; } case QEvent::TouchEnd: { @@ -83,7 +83,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), + QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; d->totalOffset += d->offset; } @@ -99,11 +99,11 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QSize(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), + QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; d->totalOffset += d->offset; - if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 || - d->totalOffset.width() < -10 || d->totalOffset.height() < -10) { + if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 || + d->totalOffset.x() < -10 || d->totalOffset.y() < -10) { result = QGestureRecognizer::GestureTriggered; } else { result = QGestureRecognizer::MaybeGesture; @@ -128,7 +128,7 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QSizeF(); + d->totalOffset = d->lastOffset = d->offset = QPointF(); d->lastPosition = QPoint(); d->acceleration = 0; -- cgit v0.12 From 0e4d5715992f9d7d7e1c598527907797e0b98427 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 21 Oct 2009 12:40:29 +0200 Subject: Make warning more helpful. Also fix grammer and avoid using combined words. --- src/gui/kernel/qgesturemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 6f1aec4..ed8e744 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -90,7 +90,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r QGesture *dummy = recognizer->createGesture(0); if (!dummy) { qWarning("QGestureManager::registerGestureRecognizer: " - "the recognizer doesn't provide gesture object"); + "the recognizer fails to create a gesture object, skipping registration."); return Qt::GestureType(0); } Qt::GestureType type = dummy->gestureType(); -- cgit v0.12 From 760f221e7f1550ecc8198fb0c01c65ee13ded7f4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 22 Oct 2009 11:31:27 +0200 Subject: QSslSocket: Trigger a SSL transmission when reading from the socket. In certain cases a SSL transfer stalled when a readBufferSize was set. This change triggers a SSL transmission when there is data on the socket waiting to be decrypted. Task-number: QTBUG-3860 Reviewed-by: Thiago --- src/network/ssl/qsslsocket.cpp | 15 ++++++++ src/network/ssl/qsslsocket.h | 1 + src/network/ssl/qsslsocket_p.h | 1 + tests/auto/qsslsocket/tst_qsslsocket.cpp | 61 ++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index ad766c1..2c88130 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1740,6 +1740,11 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen) #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") ==" << readBytes; #endif + + // possibly trigger another transmit() to decrypt more data from the socket + if (d->readBuffer.isEmpty() && d->plainSocket->bytesAvailable()) + QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection); + return readBytes; } @@ -2134,6 +2139,16 @@ void QSslSocketPrivate::_q_flushWriteBuffer() q->flush(); } +/*! + \internal +*/ +void QSslSocketPrivate::_q_flushReadBuffer() +{ + // trigger a read from the plainSocket into SSL + if (mode != QSslSocket::UnencryptedMode) + transmit(); +} + QT_END_NAMESPACE // For private slots diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index adb206c..82cda35 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -207,6 +207,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_readyReadSlot()) Q_PRIVATE_SLOT(d_func(), void _q_bytesWrittenSlot(qint64)) Q_PRIVATE_SLOT(d_func(), void _q_flushWriteBuffer()) + Q_PRIVATE_SLOT(d_func(), void _q_flushReadBuffer()) friend class QSslSocketBackendPrivate; }; diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 24d4ebe..ee21956 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -120,6 +120,7 @@ public: void _q_readyReadSlot(); void _q_bytesWrittenSlot(qint64); void _q_flushWriteBuffer(); + void _q_flushReadBuffer(); // Platform specific functions virtual void startClientEncryption() = 0; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index d576201..2bd1684 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -170,6 +170,7 @@ private slots: void setEmptyKey(); void spontaneousWrite(); void setReadBufferSize(); + void setReadBufferSize_task_250027(); void waitForMinusOne(); void verifyMode(); void verifyDepth(); @@ -1241,6 +1242,66 @@ void tst_QSslSocket::setReadBufferSize() QVERIFY(receiver->bytesAvailable() > oldBytesAvailable); } +class SetReadBufferSize_task_250027_handler : public QObject { + Q_OBJECT +public slots: + void readyReadSlot() { + QTestEventLoop::instance().exitLoop(); + } + void waitSomeMore(QSslSocket *socket) { + QTime t; + t.start(); + while (!socket->encryptedBytesAvailable()) { + QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents, 250); + if (t.elapsed() > 1000 || socket->state() != QAbstractSocket::ConnectedState) + return; + } + } +}; + +void tst_QSslSocket::setReadBufferSize_task_250027() +{ + // do not execute this when a proxy is set. + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + QSslSocketPtr socket = newSocket(); + socket->setReadBufferSize(1000); // limit to 1 kb/sec + socket->ignoreSslErrors(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket->ignoreSslErrors(); + QVERIFY(socket->waitForConnected(10*1000)); + QVERIFY(socket->waitForEncrypted(10*1000)); + + // exit the event loop as soon as we receive a readyRead() + SetReadBufferSize_task_250027_handler setReadBufferSize_task_250027_handler; + connect(socket, SIGNAL(readyRead()), &setReadBufferSize_task_250027_handler, SLOT(readyReadSlot())); + + // provoke a response by sending a request + socket->write("GET /gif/fluke.gif HTTP/1.0\n"); // this file is 27 KB + socket->write("Host: "); + socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData()); + socket->write("\n"); + socket->write("Connection: close\n"); + socket->write("\n"); + socket->flush(); + + QTestEventLoop::instance().enterLoop(10); + setReadBufferSize_task_250027_handler.waitSomeMore(socket); + QByteArray firstRead = socket->readAll(); + // First read should be some data, but not the whole file + QVERIFY(firstRead.size() > 0 && firstRead.size() < 20*1024); + + QTestEventLoop::instance().enterLoop(10); + setReadBufferSize_task_250027_handler.waitSomeMore(socket); + QByteArray secondRead = socket->readAll(); + // second read should be some more data + QVERIFY(secondRead.size() > 0); + + socket->close(); +} + class SslServer3 : public QTcpServer { Q_OBJECT -- cgit v0.12 From f182dcb82c4b0f4807a99bc8fb05bb6d07d8ddd3 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 14 Oct 2009 11:59:44 +0200 Subject: QHttp: Fix bug related to SSL and big POST data QHttp is deprecated, but let's be nice and fix this. POST/PUT now properly works over HTTPS without buffering the whole data when it is not needed. Reviewed-by: Peter Hartmann --- src/network/access/qhttp.cpp | 28 +++++++++++++++++++++++++++ src/network/access/qhttp.h | 3 +++ tests/auto/qhttp/tst_qhttp.cpp | 43 +++++++++++++++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp index 69faee3..f006fba 100644 --- a/src/network/access/qhttp.cpp +++ b/src/network/access/qhttp.cpp @@ -121,6 +121,9 @@ public: void _q_slotError(QAbstractSocket::SocketError); void _q_slotClosed(); void _q_slotBytesWritten(qint64 numBytes); +#ifndef QT_NO_OPENSSL + void _q_slotEncryptedBytesWritten(qint64 numBytes); +#endif void _q_slotDoFinished(); void _q_slotSendRequest(); void _q_continuePost(); @@ -135,6 +138,8 @@ public: void closeConn(); void setSock(QTcpSocket *sock); + void postMoreData(); + QTcpSocket *socket; int reconnectAttempts; bool deleteSocket; @@ -2659,19 +2664,40 @@ void QHttpPrivate::_q_slotError(QAbstractSocket::SocketError err) closeConn(); } +#ifndef QT_NO_OPENSSL +void QHttpPrivate::_q_slotEncryptedBytesWritten(qint64 written) +{ + Q_UNUSED(written); + postMoreData(); +} +#endif + void QHttpPrivate::_q_slotBytesWritten(qint64 written) { Q_Q(QHttp); bytesDone += written; emit q->dataSendProgress(bytesDone, bytesTotal); + postMoreData(); +} +// Send the POST data +void QHttpPrivate::postMoreData() +{ if (pendingPost) return; if (!postDevice) return; + // the following is backported code from Qt 4.6 QNetworkAccessManager. + // We also have to check the encryptedBytesToWrite() if it is an SSL socket. +#ifndef QT_NO_OPENSSL + QSslSocket *sslSocket = qobject_cast(socket); + // if it is really an ssl socket, check more than just bytesToWrite() + if ((socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0)) == 0) { +#else if (socket->bytesToWrite() == 0) { +#endif int max = qMin(4096, postDevice->size() - postDevice->pos()); QByteArray arr; arr.resize(max); @@ -3097,6 +3123,8 @@ void QHttpPrivate::setSock(QTcpSocket *sock) if (qobject_cast(socket)) { QObject::connect(socket, SIGNAL(sslErrors(const QList &)), q, SIGNAL(sslErrors(const QList &))); + QObject::connect(socket, SIGNAL(encryptedBytesWritten(qint64)), + q, SLOT(_q_slotEncryptedBytesWritten(qint64))); } #endif } diff --git a/src/network/access/qhttp.h b/src/network/access/qhttp.h index e5061ca..f30def2 100644 --- a/src/network/access/qhttp.h +++ b/src/network/access/qhttp.h @@ -290,6 +290,9 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_slotError(QAbstractSocket::SocketError)) Q_PRIVATE_SLOT(d_func(), void _q_slotClosed()) Q_PRIVATE_SLOT(d_func(), void _q_slotBytesWritten(qint64 numBytes)) +#ifndef QT_NO_OPENSSL + Q_PRIVATE_SLOT(d_func(), void _q_slotEncryptedBytesWritten(qint64 numBytes)) +#endif Q_PRIVATE_SLOT(d_func(), void _q_slotDoFinished()) Q_PRIVATE_SLOT(d_func(), void _q_slotSendRequest()) Q_PRIVATE_SLOT(d_func(), void _q_continuePost()) diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp index f6d5e3e..0ea0d15 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/qhttp/tst_qhttp.cpp @@ -484,6 +484,7 @@ void tst_QHttp::post_data() QTest::addColumn("useProxy"); QTest::addColumn("host"); QTest::addColumn("port"); + QTest::addColumn("ssl"); QTest::addColumn("path"); QTest::addColumn("result"); @@ -491,25 +492,48 @@ void tst_QHttp::post_data() md5sum = "d41d8cd98f00b204e9800998ecf8427e"; QTest::newRow("empty-data") << QString() << false << false - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; QTest::newRow("empty-device") << QString() << true << false - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; QTest::newRow("proxy-empty-data") << QString() << false << true - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; md5sum = "b3e32ac459b99d3f59318f3ac31e4bee"; QTest::newRow("data") << "rfc3252.txt" << false << false - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; QTest::newRow("device") << "rfc3252.txt" << true << false - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; QTest::newRow("proxy-data") << "rfc3252.txt" << false << true - << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" + << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum; +#ifndef QT_NO_OPENSSL + md5sum = "d41d8cd98f00b204e9800998ecf8427e"; + QTest::newRow("empty-data-ssl") + << QString() << false << false + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + QTest::newRow("empty-device-ssl") + << QString() << true << false + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + QTest::newRow("proxy-empty-data-ssl") + << QString() << false << true + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum; + md5sum = "b3e32ac459b99d3f59318f3ac31e4bee"; + QTest::newRow("data-ssl") << "rfc3252.txt" << false << false + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" + << md5sum; + QTest::newRow("device-ssl") << "rfc3252.txt" << true << false + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" + << md5sum; + QTest::newRow("proxy-data-ssl") << "rfc3252.txt" << false << true + << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" + << md5sum; +#endif + // the following test won't work. See task 185996 /* QTest::newRow("proxy-device") << "rfc3252.txt" << true << true @@ -525,14 +549,19 @@ void tst_QHttp::post() QFETCH(bool, useProxy); QFETCH(QString, host); QFETCH(int, port); + QFETCH(bool, ssl); QFETCH(QString, path); http = newHttp(useProxy); +#ifndef QT_NO_OPENSSL + QObject::connect(http, SIGNAL(sslErrors(const QList &)), + http, SLOT(ignoreSslErrors())); +#endif QCOMPARE(http->currentId(), 0); QCOMPARE((int)http->state(), (int)QHttp::Unconnected); if (useProxy) addRequest(QHttpRequestHeader(), http->setProxy(QtNetworkSettings::serverName(), 3129)); - addRequest(QHttpRequestHeader(), http->setHost(host, port)); + addRequest(QHttpRequestHeader(), http->setHost(host, (ssl ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp), port)); // add the POST request QFile file(SRCDIR + source); -- cgit v0.12 From 30b66e1b92b54b8f035da3c66ad086340befcf5b Mon Sep 17 00:00:00 2001 From: Liang QI Date: Thu, 22 Oct 2009 17:37:25 +0200 Subject: QTextEdit: Fix the wrong order for call of Qt::WA_InputMethodEnabled in setReadOnly. Should set Qt::WA_InputMethodEnabled after set the flags, just because shouldEnableInputMethod() will read the flags. Task-number: QTBUG-4917 Reviewed-by: Shane Kearns --- src/gui/widgets/qtextedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index b894aa8..f477fee 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -2079,8 +2079,8 @@ void QTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); } /*! -- cgit v0.12 From 5de213210ef4f14e698c3fd970cf7e6c5b27c72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 16 Oct 2009 09:55:28 +0200 Subject: Added caching of graphics effect source pixmaps to speed up effects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If an effect is applied repeatedly on the same source, just with varying parameters, we can save a lot by caching the source pixmaps. Reviewed-by: Bjørn Erik Nilsen --- src/gui/effects/qgraphicseffect.cpp | 19 ++++++++++++++++++- src/gui/effects/qgraphicseffect.h | 1 + src/gui/effects/qgraphicseffect_p.h | 12 +++++++++++- src/gui/graphicsview/qgraphicsitem.cpp | 27 +++++++++++++++++++++------ src/gui/graphicsview/qgraphicsitem_p.h | 11 +++++++++-- src/gui/graphicsview/qgraphicsscene.cpp | 5 +++++ src/gui/kernel/qwidget.cpp | 22 ++++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 13 ++++++++++--- src/gui/painting/qbackingstore.cpp | 5 +++++ 9 files changed, 102 insertions(+), 13 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 91641b0..96d35b0 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -253,7 +253,24 @@ bool QGraphicsEffectSource::isPixmap() const */ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset) const { - return d_func()->pixmap(system, offset); + Q_D(const QGraphicsEffectSource); + + QPixmap pm; + if (d->m_cachedSystem == system) + QPixmapCache::find(d->m_cacheKey, &pm); + + if (pm.isNull()) { + pm = d->pixmap(system, &d->m_cachedOffset); + d->m_cachedSystem = system; + + d->invalidateCache(); + d->m_cacheKey = QPixmapCache::insert(pm); + } + + if (offset) + *offset = d->m_cachedOffset; + + return pm; } /*! diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index c5d3ede..c89851e 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -87,6 +87,7 @@ private: friend class QGraphicsEffectPrivate; friend class QGraphicsScenePrivate; friend class QGraphicsItem; + friend class QGraphicsItemPrivate; friend class QWidget; friend class QWidgetPrivate; }; diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index ff2fb85..8fb55d8 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -55,6 +55,8 @@ #include "qgraphicseffect.h" +#include + #include #include @@ -65,7 +67,7 @@ class QGraphicsEffectSourcePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QGraphicsEffectSource) public: QGraphicsEffectSourcePrivate() : QObjectPrivate() {} - virtual ~QGraphicsEffectSourcePrivate() {} + virtual ~QGraphicsEffectSourcePrivate() { invalidateCache(); } virtual void detach() = 0; virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0; virtual QRect deviceRect() const = 0; @@ -77,9 +79,16 @@ public: virtual bool isPixmap() const = 0; virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0) const = 0; virtual void effectBoundingRectChanged() = 0; + void invalidateCache() const { QPixmapCache::remove(m_cacheKey); } + friend class QGraphicsScenePrivate; friend class QGraphicsItem; friend class QGraphicsItemPrivate; + +private: + mutable Qt::CoordinateSystem m_cachedSystem; + mutable QPoint m_cachedOffset; + mutable QPixmapCache::Key m_cacheKey; }; class Q_GUI_EXPORT QGraphicsEffectPrivate : public QObjectPrivate @@ -94,6 +103,7 @@ public: if (source) { flags |= QGraphicsEffect::SourceDetached; source->d_func()->detach(); + source->d_func()->invalidateCache(); delete source; } source = newSource; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 45627f6..5153783 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2482,12 +2482,14 @@ void QGraphicsItem::setOpacity(qreal opacity) itemChange(ItemOpacityHasChanged, newOpacityVariant); // Update. - if (d_ptr->scene) + if (d_ptr->scene) { + d_ptr->invalidateGraphicsEffectsRecursively(); d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, /*maybeDirtyClipPath=*/false, /*force=*/false, /*ignoreOpacity=*/true); + } if (d_ptr->isObject) emit static_cast(this)->opacityChanged(); @@ -4949,6 +4951,22 @@ int QGraphicsItemPrivate::depth() const /*! \internal */ +void QGraphicsItemPrivate::invalidateGraphicsEffectsRecursively() +{ + QGraphicsItemPrivate *itemPrivate = this; + do { + if (itemPrivate->graphicsEffect) { + itemPrivate->notifyInvalidated = 1; + + if (!itemPrivate->updateDueToGraphicsEffect) + static_cast(itemPrivate->graphicsEffect->d_func()->source->d_func())->invalidateCache(); + } + } while ((itemPrivate = itemPrivate->parent ? itemPrivate->parent->d_ptr.data() : 0)); +} + +/*! + \internal +*/ void QGraphicsItemPrivate::invalidateDepthRecursively() { if (itemDepth == -1) @@ -5280,11 +5298,7 @@ void QGraphicsItem::update(const QRectF &rect) return; // Make sure we notify effects about invalidated source. - QGraphicsItem *item = this; - do { - if (item->d_ptr->graphicsEffect) - item->d_ptr->notifyInvalidated = 1; - } while ((item = item->d_ptr->parent)); + d_ptr->invalidateGraphicsEffectsRecursively(); if (CacheMode(d_ptr->cacheMode) != NoCache) { // Invalidate cache. @@ -10721,6 +10735,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP } pixmapPainter.end(); + return pixmap; } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 6550362..8fd1a75 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -177,6 +177,7 @@ public: wantsActive(0), holesInSiblingIndex(0), sequentialOrdering(1), + updateDueToGraphicsEffect(0), globalStackingOrder(-1), q_ptr(0) { @@ -221,6 +222,7 @@ public: bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false, bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; int depth() const; + void invalidateGraphicsEffectsRecursively(); void invalidateDepthRecursively(); void resolveDepth(); void addChild(QGraphicsItem *child); @@ -502,6 +504,7 @@ public: quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; + quint32 updateDueToGraphicsEffect : 1; // Optional stacking order int globalStackingOrder; @@ -589,8 +592,11 @@ public: inline const QWidget *widget() const { return 0; } - inline void update() - { item->update(); } + inline void update() { + item->d_ptr->updateDueToGraphicsEffect = true; + item->update(); + item->d_ptr->updateDueToGraphicsEffect = false; + } inline void effectBoundingRectChanged() { item->prepareGeometryChange(); } @@ -619,6 +625,7 @@ public: QGraphicsItem *item; QGraphicsItemPaintInfo *info; + QTransform lastEffectTransform; }; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a624b10..fc8ce8a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4569,6 +4569,11 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * else painter->setWorldTransform(*transformPtr); painter->setOpacity(opacity); + + if (sourced->lastEffectTransform != painter->worldTransform()) { + sourced->lastEffectTransform = painter->worldTransform(); + sourced->invalidateCache(); + } item->d_ptr->graphicsEffect->draw(painter, source); painter->setWorldTransform(restoreTransform); sourced->info = 0; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index de08312..088197e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -93,6 +93,7 @@ # include "qx11info_x11.h" #endif +#include #include #include #ifdef Q_WS_MAC @@ -1806,12 +1807,29 @@ QRegion QWidgetPrivate::clipRegion() const return r; } +void QWidgetPrivate::invalidateGraphicsEffectsRecursively() +{ + Q_Q(QWidget); + QWidget *w = q; + do { + if (w->graphicsEffect()) { + QWidgetEffectSourcePrivate *sourced = + static_cast(w->graphicsEffect()->source()->d_func()); + if (!sourced->updateDueToGraphicsEffect) + w->graphicsEffect()->source()->d_func()->invalidateCache(); + } + w = w->parentWidget(); + } while (w); +} + void QWidgetPrivate::setDirtyOpaqueRegion() { Q_Q(QWidget); dirtyOpaqueChildren = true; + invalidateGraphicsEffectsRecursively(); + if (q->isWindow()) return; @@ -5215,6 +5233,10 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP paintEngine->d_func()->systemClip = QRegion(); } else { context.painter = sharedPainter; + if (sharedPainter->worldTransform() != sourced->lastEffectTransform) { + sourced->invalidateCache(); + sourced->lastEffectTransform = sharedPainter->worldTransform(); + } sharedPainter->save(); sharedPainter->translate(offset); graphicsEffect->draw(sharedPainter, source); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index f7c2712..a109f32 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -360,6 +360,7 @@ public: void setOpaque(bool opaque); void updateIsTranslucent(); bool paintOnScreen() const; + void invalidateGraphicsEffectsRecursively(); QRegion getOpaqueRegion() const; const QRegion &getOpaqueChildren() const; @@ -729,7 +730,7 @@ class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: QWidgetEffectSourcePrivate(QWidget *widget) - : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0) + : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false) {} inline void detach() @@ -742,7 +743,11 @@ public: { return m_widget; } inline void update() - { m_widget->update(); } + { + updateDueToGraphicsEffect = true; + m_widget->update(); + updateDueToGraphicsEffect = false; + } inline bool isPixmap() const { return false; } @@ -754,7 +759,7 @@ public: if (QWidget *parent = m_widget->parentWidget()) parent->update(); else - m_widget->update(); + update(); } inline const QStyleOption *styleOption() const @@ -769,6 +774,8 @@ public: QWidget *m_widget; QWidgetPaintContext *context; + QTransform lastEffectTransform; + bool updateDueToGraphicsEffect; }; inline QWExtra *QWidgetPrivate::extraData() const diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 7c07df8..3cd1402 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include "qgraphicssystem_p.h" @@ -540,6 +541,8 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rgn.isEmpty()); + widget->d_func()->invalidateGraphicsEffectsRecursively(); + if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { widget->d_func()->dirty = rgn; @@ -615,6 +618,8 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rect.isEmpty()); + widget->d_func()->invalidateGraphicsEffectsRecursively(); + if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { widget->d_func()->dirty = QRegion(rect); -- cgit v0.12 From 363c2d0ee8342a014282326b6c660a9a0e919423 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 22 Oct 2009 18:54:33 +0200 Subject: Fix def file error for qtcore Problem caused by freezing with wrong openC version in environment Reviewed-by: TrustMe --- src/s60installs/eabi/QtCoreu.def | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 33df9fe..2ecc48f 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3577,6 +3577,4 @@ EXPORTS uncompress @ 3576 NONAME zError @ 3577 NONAME zlibVersion @ 3578 NONAME - _ZNSsC1EPKcRKSaIcE @ 3579 NONAME - _ZNSsC2EPKcRKSaIcE @ 3580 NONAME -- cgit v0.12 From 18acf933474577a4cec31560eeee22de04111e1e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 22 Oct 2009 18:59:09 +0200 Subject: QtGui def file update Two new APIs in QDesktopWidget --- src/s60installs/eabi/QtGuiu.def | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 0e1bc43..ae69475 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11613,4 +11613,6 @@ EXPORTS _Zls6QDebug6QFlagsIN6QStyle9StateFlagEE @ 11612 NONAME _Zls6QDebugRK12QStyleOption @ 11613 NONAME _Zls6QDebugRKN12QStyleOption10OptionTypeE @ 11614 NONAME + _ZNK14QDesktopWidget14screenGeometryEPK7QWidget @ 11615 NONAME + _ZNK14QDesktopWidget17availableGeometryEPK7QWidget @ 11616 NONAME -- cgit v0.12 From 7856c0397a42d26fa4fdd3ead3df7886b408b8ed Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 22 Oct 2009 20:15:36 +0200 Subject: Compile fix. QPanGesture was changed to use QPointF instead of QSizeF, also need to change all usages of the pan gesture. Reviewed-by: trustme --- examples/gestures/imagegestures/imagewidget.cpp | 6 ++-- src/gui/kernel/qmacgesturerecognizer_mac.mm | 8 ++--- tests/manual/gestures/graphicsview/main.cpp | 6 ++-- .../graphicsview/mousepangesturerecognizer.cpp | 10 +++--- tests/manual/gestures/scrollarea/main.cpp | 36 +++++++++++----------- .../scrollarea/mousepangesturerecognizer.cpp | 10 +++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 95525c5..28de6da 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -128,9 +128,9 @@ void ImageWidget::panTriggered(QPanGesture *gesture) setCursor(Qt::ArrowCursor); } #endif - QSizeF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.width(); - verticalOffset += lastOffset.height(); + QPointF lastOffset = gesture->offset(); + horizontalOffset += lastOffset.x(); + verticalOffset += lastOffset.y(); update(); } diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index 7b19a54..7019580 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -218,7 +218,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent const QPointF p = QCursor::pos(); const QPointF posOffset = p - _lastPos; g->setLastOffset(g->offset()); - g->setOffset(QSizeF(posOffset.x(), posOffset.y())); + g->setOffset(QPointF(posOffset.x(), posOffset.y())); g->setTotalOffset(g->lastOffset() + g->offset()); _lastPos = p; return QGestureRecognizer::GestureTriggered; @@ -256,9 +256,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) _startPos = QPointF(); _lastPos = QPointF(); _panCanceled = true; - g->setOffset(QSizeF(0, 0)); - g->setLastOffset(QSizeF(0, 0)); - g->setTotalOffset(QSizeF(0, 0)); + g->setOffset(QPointF(0, 0)); + g->setLastOffset(QPointF(0, 0)); + g->setTotalOffset(QPointF(0, 0)); g->setAcceleration(qreal(1)); QGestureRecognizer::reset(gesture); } diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index b4d74e4..e9065eb 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -66,11 +66,11 @@ protected: default: qDebug("view: Pan: "); break; } - const QSizeF offset = pan->offset(); + const QPointF offset = pan->offset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - vbar->setValue(vbar->value() - offset.height()); - hbar->setValue(hbar->value() - offset.width()); + vbar->setValue(vbar->value() - offset.y()); + hbar->setValue(hbar->value() - offset.x()); ge->accept(pan); return true; } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index acd525f..6cdbe12 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -87,8 +87,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat QPoint lastPos = g->property("lastPos").toPoint(); g->setLastOffset(g->offset()); lastPos = pos - lastPos; - g->setOffset(QSizeF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setOffset(QPointF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); g->setProperty("lastPos", pos); return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; } @@ -102,9 +102,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QSizeF()); - g->setLastOffset(QSizeF()); - g->setOffset(QSizeF()); + g->setTotalOffset(QPointF()); + g->setLastOffset(QPointF()); + g->setOffset(QPointF()); g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index 2796637..f90f6c6 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -87,23 +87,23 @@ protected: if (outside) return; - const QSizeF offset = pan->offset(); - const QSizeF totalOffset = pan->totalOffset(); + const QPointF offset = pan->offset(); + const QPointF totalOffset = pan->totalOffset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - if ((vbar->value() == vbar->minimum() && totalOffset.height() > 10) || - (vbar->value() == vbar->maximum() && totalOffset.height() < -10)) { + if ((vbar->value() == vbar->minimum() && totalOffset.y() > 10) || + (vbar->value() == vbar->maximum() && totalOffset.y() < -10)) { outside = true; return; } - if ((hbar->value() == hbar->minimum() && totalOffset.width() > 10) || - (hbar->value() == hbar->maximum() && totalOffset.width() < -10)) { + if ((hbar->value() == hbar->minimum() && totalOffset.x() > 10) || + (hbar->value() == hbar->maximum() && totalOffset.x() < -10)) { outside = true; return; } - vbar->setValue(vbar->value() - offset.height()); - hbar->setValue(hbar->value() - offset.width()); + vbar->setValue(vbar->value() - offset.y()); + hbar->setValue(hbar->value() - offset.x()); event->accept(pan); } } @@ -147,28 +147,28 @@ protected: event->ignore(pan); if (outside) return; - const QSizeF offset = pan->offset(); - const QSizeF totalOffset = pan->totalOffset(); + const QPointF offset = pan->offset(); + const QPointF totalOffset = pan->totalOffset(); if (orientation() == Qt::Horizontal) { - if ((value() == minimum() && totalOffset.width() < -10) || - (value() == maximum() && totalOffset.width() > 10)) { + if ((value() == minimum() && totalOffset.x() < -10) || + (value() == maximum() && totalOffset.x() > 10)) { outside = true; return; } - if (totalOffset.height() < 40 && totalOffset.height() > -40) { - setValue(value() + offset.width()); + if (totalOffset.y() < 40 && totalOffset.y() > -40) { + setValue(value() + offset.x()); event->accept(pan); } else { outside = true; } } else if (orientation() == Qt::Vertical) { - if ((value() == maximum() && totalOffset.height() < -10) || - (value() == minimum() && totalOffset.height() > 10)) { + if ((value() == maximum() && totalOffset.y() < -10) || + (value() == minimum() && totalOffset.y() > 10)) { outside = true; return; } - if (totalOffset.width() < 40 && totalOffset.width() > -40) { - setValue(value() - offset.height()); + if (totalOffset.x() < 40 && totalOffset.x() > -40) { + setValue(value() - offset.y()); event->accept(pan); } else { outside = true; diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 79b633e..5f94dbc 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -69,8 +69,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat QPoint lastPos = g->property("lastPos").toPoint(); g->setLastOffset(g->offset()); lastPos = pos - lastPos; - g->setOffset(QSizeF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y())); + g->setOffset(QPointF(lastPos.x(), lastPos.y())); + g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); g->setProperty("lastPos", pos); return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; } @@ -84,9 +84,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast(state); - g->setTotalOffset(QSizeF()); - g->setLastOffset(QSizeF()); - g->setOffset(QSizeF()); + g->setTotalOffset(QPointF()); + g->setLastOffset(QPointF()); + g->setOffset(QPointF()); g->setAcceleration(0); g->setProperty("lastPos", QVariant()); g->setProperty("pressed", QVariant::fromValue(false)); -- cgit v0.12 From 96db5d5367344e1cfd474991cb8d6992776db186 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 22 Oct 2009 11:28:49 -0700 Subject: Remove declaration of QDirectFBScreen::scroll This function has been declared since the initial commit but was never actually implemented. The function exists in QDirectFBWindowSurface. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 0520cdc..6330582 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -154,7 +154,6 @@ public: void shutdownDevice(); void exposeRegion(QRegion r, int changing); - void scroll(const QRegion ®ion, const QPoint &offset); void solidFill(const QColor &color, const QRegion ®ion); void setMode(int width, int height, int depth); -- cgit v0.12 From 5baebfc68dd67def412bcbaa7c61b43d05e6ee42 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 22 Oct 2009 18:43:22 +0200 Subject: Update mkdist-webkit script with latest tag. Not-reviewed: No-big-deal --- util/webkit/mkdist-webkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 9611d38..f88f10e 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -5,7 +5,7 @@ die() { exit 1 } -default_tag="qtwebkit-4.6-snapshot-30092009-2" +default_tag="qtwebkit-4.6-snapshot-22102009" if [ $# -eq 0 ]; then tag="$default_tag" -- cgit v0.12 From 57f1983c164bc8553c6b6aa7ac320f00e5405548 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Thu, 22 Oct 2009 19:50:52 +0200 Subject: Updated WebKit from /home/jturcott/dev/webkit/ to qtwebkit-4.6-snapshot-22102009 ( 0639bb8e812c8923287cd5523248ca64fa5f7a50 ) Changes in WebKit/qt since the last update: Jocelyn: fatal error from script, sha1 in src/3rdparty/webkit/VERSION is bad --- src/3rdparty/webkit/ChangeLog | 111 + src/3rdparty/webkit/JavaScriptCore/API/APICast.h | 2 + .../JavaScriptCore/API/JSCallbackConstructor.h | 5 +- .../webkit/JavaScriptCore/API/JSCallbackFunction.h | 2 +- .../webkit/JavaScriptCore/API/JSCallbackObject.h | 5 +- .../webkit/JavaScriptCore/API/JSContextRef.cpp | 10 + .../JavaScriptCore/API/JSContextRefPrivate.h | 53 + src/3rdparty/webkit/JavaScriptCore/ChangeLog | 1167 ++- .../webkit/JavaScriptCore/JavaScriptCore.gypi | 2 +- .../webkit/JavaScriptCore/JavaScriptCore.pri | 7 +- .../webkit/JavaScriptCore/JavaScriptCore.pro | 1 - .../assembler/MacroAssemblerCodeRef.h | 6 + .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 47 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 4 +- .../bytecompiler/BytecodeGenerator.cpp | 112 +- .../bytecompiler/BytecodeGenerator.h | 4 +- .../webkit/JavaScriptCore/bytecompiler/Label.h | 14 +- .../JavaScriptCore/debugger/DebuggerActivation.h | 5 +- .../webkit/JavaScriptCore/generated/Grammar.cpp | 2 +- .../JavaScriptCore/generated/StringPrototype.lut.h | 7 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 775 +- .../JavaScriptCore/interpreter/Interpreter.h | 1 - .../JavaScriptCore/jit/ExecutableAllocator.h | 3 + .../jit/ExecutableAllocatorSymbian.cpp | 75 + src/3rdparty/webkit/JavaScriptCore/jit/JIT.cpp | 10 +- src/3rdparty/webkit/JavaScriptCore/jit/JIT.h | 3 + .../webkit/JavaScriptCore/jit/JITArithmetic.cpp | 60 +- src/3rdparty/webkit/JavaScriptCore/jit/JITCall.cpp | 32 +- .../webkit/JavaScriptCore/jit/JITOpcodes.cpp | 518 +- .../JavaScriptCore/jit/JITPropertyAccess.cpp | 182 +- .../webkit/JavaScriptCore/jit/JITStubCall.h | 20 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 96 +- src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.h | 5 +- src/3rdparty/webkit/JavaScriptCore/jsc.cpp | 1 + src/3rdparty/webkit/JavaScriptCore/jsc.pro | 31 - .../webkit/JavaScriptCore/parser/Grammar.y | 2 +- .../webkit/JavaScriptCore/parser/Lexer.cpp | 6 - src/3rdparty/webkit/JavaScriptCore/parser/Lexer.h | 6 + .../webkit/JavaScriptCore/parser/Nodes.cpp | 12 +- .../webkit/JavaScriptCore/parser/ParserArena.h | 2 +- .../webkit/JavaScriptCore/runtime/Arguments.h | 5 +- .../JavaScriptCore/runtime/ArrayConstructor.cpp | 2 +- .../JavaScriptCore/runtime/ArrayPrototype.cpp | 51 +- .../webkit/JavaScriptCore/runtime/BooleanObject.h | 2 +- .../webkit/JavaScriptCore/runtime/Collector.cpp | 58 +- .../webkit/JavaScriptCore/runtime/Collector.h | 10 - .../webkit/JavaScriptCore/runtime/DateInstance.cpp | 9 + .../webkit/JavaScriptCore/runtime/DateInstance.h | 3 +- .../webkit/JavaScriptCore/runtime/DatePrototype.h | 6 +- .../JavaScriptCore/runtime/ExceptionHelpers.cpp | 5 + .../JavaScriptCore/runtime/ExceptionHelpers.h | 1 + .../JavaScriptCore/runtime/FunctionPrototype.h | 2 +- .../webkit/JavaScriptCore/runtime/GetterSetter.h | 2 +- .../JavaScriptCore/runtime/GlobalEvalFunction.h | 5 +- .../JavaScriptCore/runtime/InternalFunction.h | 4 +- .../JavaScriptCore/runtime/JSAPIValueWrapper.h | 2 +- .../webkit/JavaScriptCore/runtime/JSActivation.h | 5 +- .../webkit/JavaScriptCore/runtime/JSArray.cpp | 121 +- .../webkit/JavaScriptCore/runtime/JSArray.h | 24 +- .../webkit/JavaScriptCore/runtime/JSByteArray.cpp | 2 +- .../webkit/JavaScriptCore/runtime/JSByteArray.h | 3 + .../webkit/JavaScriptCore/runtime/JSCell.cpp | 4 - .../webkit/JavaScriptCore/runtime/JSCell.h | 17 - .../webkit/JavaScriptCore/runtime/JSFunction.h | 5 +- .../JavaScriptCore/runtime/JSGlobalObject.cpp | 21 +- .../webkit/JavaScriptCore/runtime/JSGlobalObject.h | 5 +- .../webkit/JavaScriptCore/runtime/JSNotAnObject.h | 5 +- .../webkit/JavaScriptCore/runtime/JSNumberCell.h | 10 +- .../webkit/JavaScriptCore/runtime/JSONObject.h | 5 +- .../webkit/JavaScriptCore/runtime/JSObject.cpp | 40 +- .../webkit/JavaScriptCore/runtime/JSObject.h | 8 +- .../runtime/JSPropertyNameIterator.cpp | 48 +- .../runtime/JSPropertyNameIterator.h | 85 +- .../JavaScriptCore/runtime/JSStaticScopeObject.h | 5 +- .../webkit/JavaScriptCore/runtime/JSString.cpp | 41 - .../webkit/JavaScriptCore/runtime/JSString.h | 43 +- .../webkit/JavaScriptCore/runtime/JSTypeInfo.h | 12 +- .../webkit/JavaScriptCore/runtime/JSValue.cpp | 5 +- .../webkit/JavaScriptCore/runtime/JSValue.h | 26 +- .../JavaScriptCore/runtime/JSVariableObject.h | 3 +- .../JavaScriptCore/runtime/JSWrapperObject.h | 2 +- .../webkit/JavaScriptCore/runtime/MarkStack.h | 2 +- .../webkit/JavaScriptCore/runtime/MathObject.h | 5 +- .../JavaScriptCore/runtime/NumberConstructor.h | 5 +- .../webkit/JavaScriptCore/runtime/NumberObject.h | 14 +- .../JavaScriptCore/runtime/ObjectConstructor.cpp | 1 + .../webkit/JavaScriptCore/runtime/Operations.h | 27 +- .../JavaScriptCore/runtime/PropertyNameArray.cpp | 5 +- .../JavaScriptCore/runtime/PropertyNameArray.h | 35 +- .../webkit/JavaScriptCore/runtime/Protect.h | 2 +- .../JavaScriptCore/runtime/RegExpConstructor.cpp | 46 - .../JavaScriptCore/runtime/RegExpConstructor.h | 52 +- .../webkit/JavaScriptCore/runtime/RegExpObject.cpp | 2 +- .../webkit/JavaScriptCore/runtime/RegExpObject.h | 5 +- .../webkit/JavaScriptCore/runtime/StringObject.h | 3 +- .../StringObjectThatMasqueradesAsUndefined.h | 4 +- .../JavaScriptCore/runtime/StringPrototype.cpp | 63 +- .../webkit/JavaScriptCore/runtime/Structure.cpp | 87 +- .../webkit/JavaScriptCore/runtime/Structure.h | 17 +- .../JavaScriptCore/runtime/StructureChain.cpp | 14 - .../webkit/JavaScriptCore/runtime/StructureChain.h | 3 +- src/3rdparty/webkit/JavaScriptCore/wscript | 2 +- .../JavaScriptCore/wtf/CrossThreadRefCounted.h | 14 +- .../webkit/JavaScriptCore/wtf/FastMalloc.cpp | 6 +- .../webkit/JavaScriptCore/wtf/FastMalloc.h | 5 + .../webkit/JavaScriptCore/wtf/ListRefPtr.h | 3 + .../webkit/JavaScriptCore/wtf/MathExtras.h | 2 + src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 96 +- .../webkit/JavaScriptCore/wtf/RandomNumber.cpp | 17 + .../webkit/JavaScriptCore/wtf/StringExtras.h | 4 +- .../webkit/JavaScriptCore/yarr/RegexJIT.cpp | 8 - src/3rdparty/webkit/JavaScriptCore/yarr/RegexJIT.h | 9 +- src/3rdparty/webkit/VERSION | 4 +- src/3rdparty/webkit/WebCore/ChangeLog | 9158 +++++++++++++++++++- src/3rdparty/webkit/WebCore/DerivedSources.cpp | 2 + .../ForwardingHeaders/runtime/ExceptionHelpers.h | 4 + .../WebCore/ForwardingHeaders/runtime/JSCell.h | 4 + .../ForwardingHeaders/runtime/StructureChain.h | 5 + .../webkit/WebCore/WebCore.3DRendering.exp | 1 + .../webkit/WebCore/WebCore.SVG.Filters.exp | 1 + src/3rdparty/webkit/WebCore/WebCore.Video.exp | 14 + src/3rdparty/webkit/WebCore/WebCore.gypi | 47 +- src/3rdparty/webkit/WebCore/WebCore.order | 1 + src/3rdparty/webkit/WebCore/WebCore.pro | 134 +- src/3rdparty/webkit/WebCore/WebCore.qrc | 3 - .../accessibility/AccessibilityMediaControls.cpp | 3 + .../WebCore/bindings/ScriptControllerBase.cpp | 84 + .../WebCore/bindings/js/JSAbstractWorkerCustom.cpp | 8 - .../webkit/WebCore/bindings/js/JSCallbackData.cpp | 77 + .../webkit/WebCore/bindings/js/JSCallbackData.h | 70 + .../bindings/js/JSCanvasArrayBufferConstructor.h | 3 +- .../WebCore/bindings/js/JSCanvasArrayCustom.cpp | 33 +- .../bindings/js/JSCustomPositionCallback.cpp | 34 +- .../WebCore/bindings/js/JSCustomPositionCallback.h | 9 +- .../bindings/js/JSCustomPositionErrorCallback.cpp | 33 +- .../bindings/js/JSCustomPositionErrorCallback.h | 8 +- .../bindings/js/JSCustomSQLStatementCallback.cpp | 45 +- .../bindings/js/JSCustomSQLStatementCallback.h | 8 +- .../js/JSCustomSQLStatementErrorCallback.cpp | 59 +- .../js/JSCustomSQLStatementErrorCallback.h | 10 +- .../bindings/js/JSCustomSQLTransactionCallback.cpp | 69 +- .../bindings/js/JSCustomSQLTransactionCallback.h | 6 +- .../js/JSCustomSQLTransactionErrorCallback.cpp | 48 +- .../js/JSCustomSQLTransactionErrorCallback.h | 6 +- .../WebCore/bindings/js/JSCustomVoidCallback.cpp | 43 +- .../WebCore/bindings/js/JSCustomVoidCallback.h | 7 +- .../bindings/js/JSDOMApplicationCacheCustom.cpp | 8 - .../webkit/WebCore/bindings/js/JSDOMBinding.cpp | 5 + .../webkit/WebCore/bindings/js/JSDOMBinding.h | 7 +- .../WebCore/bindings/js/JSDOMGlobalObject.cpp | 2 +- .../webkit/WebCore/bindings/js/JSDOMGlobalObject.h | 6 + .../webkit/WebCore/bindings/js/JSDOMWindowBase.cpp | 11 +- .../webkit/WebCore/bindings/js/JSDOMWindowBase.h | 9 +- .../WebCore/bindings/js/JSDOMWindowCustom.cpp | 28 +- .../webkit/WebCore/bindings/js/JSDOMWindowShell.h | 4 +- .../bindings/js/JSDesktopNotificationsCustom.cpp | 12 +- .../WebCore/bindings/js/JSDocumentCustom.cpp | 2 +- .../webkit/WebCore/bindings/js/JSEventCustom.cpp | 5 +- .../WebCore/bindings/js/JSEventSourceCustom.cpp | 8 - .../webkit/WebCore/bindings/js/JSExceptionBase.cpp | 64 + .../webkit/WebCore/bindings/js/JSExceptionBase.h | 43 + .../WebCore/bindings/js/JSHTMLAllCollection.h | 4 +- .../bindings/js/JSInspectorBackendCustom.cpp | 43 +- .../WebCore/bindings/js/JSLocationCustom.cpp | 4 +- .../WebCore/bindings/js/JSMessageEventCustom.cpp | 2 +- .../WebCore/bindings/js/JSMessagePortCustom.cpp | 8 - .../WebCore/bindings/js/JSMessagePortCustom.h | 2 +- .../webkit/WebCore/bindings/js/JSNodeCustom.cpp | 16 - .../bindings/js/JSQuarantinedObjectWrapper.h | 4 +- .../bindings/js/JSSVGElementInstanceCustom.cpp | 8 - .../WebCore/bindings/js/JSWebSocketCustom.cpp | 21 +- .../WebCore/bindings/js/JSXMLHttpRequestCustom.cpp | 8 - .../bindings/js/JSXMLHttpRequestUploadCustom.cpp | 8 - .../webkit/WebCore/bindings/js/ScheduledAction.cpp | 2 +- .../webkit/WebCore/bindings/js/ScheduledAction.h | 1 + .../WebCore/bindings/js/ScriptCachedFrameData.cpp | 2 +- .../WebCore/bindings/js/ScriptController.cpp | 6 +- .../webkit/WebCore/bindings/js/ScriptController.h | 8 + .../webkit/WebCore/bindings/js/ScriptObject.cpp | 8 + .../webkit/WebCore/bindings/js/ScriptObject.h | 1 + .../WebCore/bindings/js/SerializedScriptValue.cpp | 839 ++ .../WebCore/bindings/js/SerializedScriptValue.h | 199 + .../WebCore/bindings/scripts/CodeGenerator.pm | 14 + .../WebCore/bindings/scripts/CodeGeneratorCOM.pm | 16 +- .../WebCore/bindings/scripts/CodeGeneratorJS.pm | 99 +- .../WebCore/bindings/scripts/CodeGeneratorObjC.pm | 43 +- .../WebCore/bindings/scripts/CodeGeneratorV8.pm | 396 +- src/3rdparty/webkit/WebCore/bridge/IdentifierRep.h | 3 +- .../webkit/WebCore/bridge/c/c_instance.cpp | 18 +- src/3rdparty/webkit/WebCore/bridge/npapi.h | 13 +- src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h | 2 +- src/3rdparty/webkit/WebCore/bridge/runtime_array.h | 3 +- .../webkit/WebCore/bridge/runtime_method.h | 3 +- .../webkit/WebCore/bridge/runtime_object.h | 3 +- src/3rdparty/webkit/WebCore/bridge/runtime_root.h | 2 + .../WebCore/css/CSSComputedStyleDeclaration.cpp | 22 +- src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 4 +- src/3rdparty/webkit/WebCore/css/CSSParser.cpp | 34 +- src/3rdparty/webkit/WebCore/css/CSSParserValues.h | 2 +- .../webkit/WebCore/css/CSSPrimitiveValue.cpp | 105 +- .../webkit/WebCore/css/CSSPrimitiveValueMappings.h | 78 +- .../webkit/WebCore/css/CSSPropertyNames.in | 3 +- src/3rdparty/webkit/WebCore/css/CSSSelector.cpp | 12 +- src/3rdparty/webkit/WebCore/css/CSSSelector.h | 3 +- .../webkit/WebCore/css/CSSStyleSelector.cpp | 23 +- .../webkit/WebCore/css/CSSValueKeywords.in | 7 + .../WebCore/css/SVGCSSComputedStyleDeclaration.cpp | 2 - src/3rdparty/webkit/WebCore/css/SVGCSSParser.cpp | 6 - .../webkit/WebCore/css/SVGCSSPropertyNames.in | 2 +- .../webkit/WebCore/css/SVGCSSStyleSelector.cpp | 7 - .../webkit/WebCore/css/SVGCSSValueKeywords.in | 9 +- src/3rdparty/webkit/WebCore/css/html.css | 5 + src/3rdparty/webkit/WebCore/css/makevalues.pl | 2 +- .../webkit/WebCore/css/mediaControlsChromium.css | 6 +- .../webkit/WebCore/css/mediaControlsQT.css | 177 - .../webkit/WebCore/css/mediaControlsQt.css | 138 + .../webkit/WebCore/css/mediaControlsQuickTime.css | 177 + .../webkit/WebCore/css/qt/mediaControls-extras.css | 101 - src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h | 67 + .../webkit/WebCore/dom/BeforeLoadEvent.idl | 39 + src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp | 12 + src/3rdparty/webkit/WebCore/dom/ContainerNode.h | 2 + src/3rdparty/webkit/WebCore/dom/Document.cpp | 123 +- src/3rdparty/webkit/WebCore/dom/Document.h | 4 +- src/3rdparty/webkit/WebCore/dom/Document.idl | 3 + src/3rdparty/webkit/WebCore/dom/Element.cpp | 3 +- src/3rdparty/webkit/WebCore/dom/Event.cpp | 7 + src/3rdparty/webkit/WebCore/dom/Event.h | 7 + src/3rdparty/webkit/WebCore/dom/EventNames.h | 2 +- src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp | 1 + src/3rdparty/webkit/WebCore/dom/ExceptionBase.h | 2 + src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp | 60 + src/3rdparty/webkit/WebCore/dom/ExceptionCode.h | 1 + src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp | 7 +- src/3rdparty/webkit/WebCore/dom/MessageEvent.h | 13 +- src/3rdparty/webkit/WebCore/dom/MessageEvent.idl | 6 +- src/3rdparty/webkit/WebCore/dom/MessagePort.cpp | 6 +- src/3rdparty/webkit/WebCore/dom/MessagePort.h | 6 +- .../webkit/WebCore/dom/MessagePortChannel.cpp | 6 +- .../webkit/WebCore/dom/MessagePortChannel.h | 11 +- .../webkit/WebCore/dom/MouseRelatedEvent.cpp | 4 +- .../webkit/WebCore/dom/ProcessingInstruction.cpp | 22 +- src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp | 7 + src/3rdparty/webkit/WebCore/dom/QualifiedName.h | 10 +- src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp | 3 + src/3rdparty/webkit/WebCore/dom/StyledElement.cpp | 4 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp | 6 +- .../webkit/WebCore/dom/XMLTokenizerLibxml2.cpp | 9 +- src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp | 5 +- .../webkit/WebCore/editing/ApplyStyleCommand.cpp | 89 +- .../webkit/WebCore/editing/ApplyStyleCommand.h | 1 + .../webkit/WebCore/editing/EditorCommand.cpp | 48 +- .../WebCore/editing/IndentOutdentCommand.cpp | 140 +- .../webkit/WebCore/editing/IndentOutdentCommand.h | 6 +- .../WebCore/editing/ReplaceSelectionCommand.cpp | 13 + .../webkit/WebCore/editing/VisibleSelection.cpp | 2 +- src/3rdparty/webkit/WebCore/editing/markup.cpp | 10 +- .../webkit/WebCore/generated/CSSGrammar.cpp | 1050 ++- .../webkit/WebCore/generated/CSSPropertyNames.cpp | 374 +- .../webkit/WebCore/generated/CSSPropertyNames.h | 362 +- .../webkit/WebCore/generated/CSSValueKeywords.c | 777 +- .../webkit/WebCore/generated/CSSValueKeywords.h | 455 +- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 2 +- .../webkit/WebCore/generated/HTMLNames.cpp | 8 +- src/3rdparty/webkit/WebCore/generated/HTMLNames.h | 2 +- .../webkit/WebCore/generated/JSAbstractWorker.cpp | 5 +- .../webkit/WebCore/generated/JSAbstractWorker.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSAttr.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSAttr.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSBarInfo.h | 10 +- .../webkit/WebCore/generated/JSBeforeLoadEvent.cpp | 188 + .../webkit/WebCore/generated/JSBeforeLoadEvent.h | 78 + .../webkit/WebCore/generated/JSCDATASection.cpp | 5 +- .../webkit/WebCore/generated/JSCDATASection.h | 10 +- .../webkit/WebCore/generated/JSCSSCharsetRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSCharsetRule.h | 10 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSFontFaceRule.h | 10 +- .../webkit/WebCore/generated/JSCSSImportRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSImportRule.h | 10 +- .../webkit/WebCore/generated/JSCSSMediaRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSMediaRule.h | 8 +- .../webkit/WebCore/generated/JSCSSPageRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSPageRule.h | 10 +- .../WebCore/generated/JSCSSPrimitiveValue.cpp | 5 +- .../webkit/WebCore/generated/JSCSSPrimitiveValue.h | 8 +- .../webkit/WebCore/generated/JSCSSRule.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSCSSRule.h | 8 +- .../webkit/WebCore/generated/JSCSSRuleList.cpp | 5 +- .../webkit/WebCore/generated/JSCSSRuleList.h | 8 +- .../WebCore/generated/JSCSSStyleDeclaration.cpp | 5 +- .../WebCore/generated/JSCSSStyleDeclaration.h | 8 +- .../webkit/WebCore/generated/JSCSSStyleRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSStyleRule.h | 10 +- .../webkit/WebCore/generated/JSCSSStyleSheet.cpp | 5 +- .../webkit/WebCore/generated/JSCSSStyleSheet.h | 8 +- .../webkit/WebCore/generated/JSCSSValue.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSCSSValue.h | 8 +- .../webkit/WebCore/generated/JSCSSValueList.cpp | 5 +- .../webkit/WebCore/generated/JSCSSValueList.h | 8 +- .../generated/JSCSSVariablesDeclaration.cpp | 5 +- .../WebCore/generated/JSCSSVariablesDeclaration.h | 8 +- .../WebCore/generated/JSCSSVariablesRule.cpp | 5 +- .../webkit/WebCore/generated/JSCSSVariablesRule.h | 10 +- .../webkit/WebCore/generated/JSCanvasArray.cpp | 4 - .../webkit/WebCore/generated/JSCanvasArray.h | 8 +- .../webkit/WebCore/generated/JSCanvasArrayBuffer.h | 10 +- .../webkit/WebCore/generated/JSCanvasByteArray.h | 10 +- .../webkit/WebCore/generated/JSCanvasFloatArray.h | 10 +- .../webkit/WebCore/generated/JSCanvasGradient.h | 11 +- .../webkit/WebCore/generated/JSCanvasIntArray.h | 10 +- .../webkit/WebCore/generated/JSCanvasPattern.h | 13 + .../WebCore/generated/JSCanvasRenderingContext.cpp | 5 +- .../WebCore/generated/JSCanvasRenderingContext.h | 10 +- .../generated/JSCanvasRenderingContext2D.cpp | 5 +- .../WebCore/generated/JSCanvasRenderingContext2D.h | 8 +- .../generated/JSCanvasRenderingContext3D.cpp | 69 +- .../WebCore/generated/JSCanvasRenderingContext3D.h | 11 +- .../webkit/WebCore/generated/JSCanvasShortArray.h | 10 +- .../WebCore/generated/JSCanvasUnsignedByteArray.h | 10 +- .../WebCore/generated/JSCanvasUnsignedIntArray.h | 10 +- .../WebCore/generated/JSCanvasUnsignedShortArray.h | 10 +- .../webkit/WebCore/generated/JSCharacterData.cpp | 5 +- .../webkit/WebCore/generated/JSCharacterData.h | 8 +- .../webkit/WebCore/generated/JSClientRect.cpp | 5 +- .../webkit/WebCore/generated/JSClientRect.h | 10 +- .../webkit/WebCore/generated/JSClientRectList.cpp | 5 +- .../webkit/WebCore/generated/JSClientRectList.h | 8 +- .../webkit/WebCore/generated/JSClipboard.cpp | 5 +- .../webkit/WebCore/generated/JSClipboard.h | 8 +- .../webkit/WebCore/generated/JSComment.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSComment.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSConsole.h | 8 +- .../webkit/WebCore/generated/JSCoordinates.h | 10 +- .../webkit/WebCore/generated/JSCounter.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSCounter.h | 10 +- .../WebCore/generated/JSDOMApplicationCache.h | 8 +- .../WebCore/generated/JSDOMCoreException.cpp | 5 +- .../webkit/WebCore/generated/JSDOMCoreException.h | 8 +- .../WebCore/generated/JSDOMImplementation.cpp | 5 +- .../webkit/WebCore/generated/JSDOMImplementation.h | 8 +- .../webkit/WebCore/generated/JSDOMParser.cpp | 5 +- .../webkit/WebCore/generated/JSDOMParser.h | 8 +- .../webkit/WebCore/generated/JSDOMSelection.h | 8 +- .../webkit/WebCore/generated/JSDOMWindow.cpp | 20 +- .../webkit/WebCore/generated/JSDOMWindow.h | 10 +- .../webkit/WebCore/generated/JSDataGridColumn.cpp | 5 +- .../webkit/WebCore/generated/JSDataGridColumn.h | 8 +- .../WebCore/generated/JSDataGridColumnList.cpp | 5 +- .../WebCore/generated/JSDataGridColumnList.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSDatabase.h | 8 +- .../WebCore/generated/JSDedicatedWorkerContext.h | 8 +- .../webkit/WebCore/generated/JSDocument.cpp | 18 +- src/3rdparty/webkit/WebCore/generated/JSDocument.h | 9 +- .../WebCore/generated/JSDocumentFragment.cpp | 5 +- .../webkit/WebCore/generated/JSDocumentFragment.h | 8 +- .../webkit/WebCore/generated/JSDocumentType.cpp | 5 +- .../webkit/WebCore/generated/JSDocumentType.h | 10 +- .../webkit/WebCore/generated/JSElement.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSElement.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSEntity.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSEntity.h | 10 +- .../webkit/WebCore/generated/JSEntityReference.cpp | 5 +- .../webkit/WebCore/generated/JSEntityReference.h | 10 +- .../webkit/WebCore/generated/JSErrorEvent.cpp | 5 +- .../webkit/WebCore/generated/JSErrorEvent.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSEvent.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSEvent.h | 8 +- .../webkit/WebCore/generated/JSEventException.cpp | 5 +- .../webkit/WebCore/generated/JSEventException.h | 8 +- .../webkit/WebCore/generated/JSEventSource.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSFile.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSFile.h | 10 +- .../webkit/WebCore/generated/JSFileList.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSFileList.h | 8 +- .../webkit/WebCore/generated/JSGeolocation.h | 8 +- .../webkit/WebCore/generated/JSGeoposition.h | 10 +- .../WebCore/generated/JSHTMLAnchorElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLAnchorElement.h | 8 +- .../WebCore/generated/JSHTMLAppletElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLAppletElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLAreaElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLAreaElement.h | 10 +- .../WebCore/generated/JSHTMLAudioElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLAudioElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLBRElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLBRElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLBaseElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLBaseElement.h | 10 +- .../WebCore/generated/JSHTMLBaseFontElement.cpp | 5 +- .../WebCore/generated/JSHTMLBaseFontElement.h | 10 +- .../WebCore/generated/JSHTMLBlockquoteElement.cpp | 5 +- .../WebCore/generated/JSHTMLBlockquoteElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLBodyElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLBodyElement.h | 10 +- .../WebCore/generated/JSHTMLButtonElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLButtonElement.h | 8 +- .../WebCore/generated/JSHTMLCanvasElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLCanvasElement.h | 8 +- .../webkit/WebCore/generated/JSHTMLCollection.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLCollection.h | 8 +- .../WebCore/generated/JSHTMLDListElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLDListElement.h | 10 +- .../generated/JSHTMLDataGridCellElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataGridCellElement.h | 10 +- .../WebCore/generated/JSHTMLDataGridColElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataGridColElement.h | 10 +- .../WebCore/generated/JSHTMLDataGridElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataGridElement.h | 10 +- .../WebCore/generated/JSHTMLDataGridRowElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataGridRowElement.h | 10 +- .../WebCore/generated/JSHTMLDataListElement.cpp | 5 +- .../WebCore/generated/JSHTMLDataListElement.h | 10 +- .../WebCore/generated/JSHTMLDirectoryElement.cpp | 5 +- .../WebCore/generated/JSHTMLDirectoryElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLDivElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLDivElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLDocument.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLDocument.h | 8 +- .../webkit/WebCore/generated/JSHTMLElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLElement.h | 8 +- .../WebCore/generated/JSHTMLEmbedElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLEmbedElement.h | 8 +- .../WebCore/generated/JSHTMLFieldSetElement.cpp | 5 +- .../WebCore/generated/JSHTMLFieldSetElement.h | 8 +- .../webkit/WebCore/generated/JSHTMLFontElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLFontElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLFormElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLFormElement.h | 8 +- .../WebCore/generated/JSHTMLFrameElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLFrameElement.h | 8 +- .../WebCore/generated/JSHTMLFrameSetElement.cpp | 5 +- .../WebCore/generated/JSHTMLFrameSetElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLHRElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLHRElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLHeadElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLHeadElement.h | 10 +- .../WebCore/generated/JSHTMLHeadingElement.cpp | 5 +- .../WebCore/generated/JSHTMLHeadingElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLHtmlElement.h | 10 +- .../WebCore/generated/JSHTMLIFrameElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLIFrameElement.h | 8 +- .../WebCore/generated/JSHTMLImageElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLImageElement.h | 10 +- .../WebCore/generated/JSHTMLInputElement.cpp | 39 +- .../webkit/WebCore/generated/JSHTMLInputElement.h | 12 +- .../WebCore/generated/JSHTMLIsIndexElement.cpp | 5 +- .../WebCore/generated/JSHTMLIsIndexElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLLIElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLLIElement.h | 10 +- .../WebCore/generated/JSHTMLLabelElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLLabelElement.h | 10 +- .../WebCore/generated/JSHTMLLegendElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLLegendElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLLinkElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLLinkElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLMapElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLMapElement.h | 10 +- .../WebCore/generated/JSHTMLMarqueeElement.cpp | 5 +- .../WebCore/generated/JSHTMLMarqueeElement.h | 8 +- .../WebCore/generated/JSHTMLMediaElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLMediaElement.h | 8 +- .../webkit/WebCore/generated/JSHTMLMenuElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLMenuElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLMetaElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLMetaElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLModElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLModElement.h | 10 +- .../WebCore/generated/JSHTMLOListElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLOListElement.h | 10 +- .../WebCore/generated/JSHTMLObjectElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLObjectElement.h | 8 +- .../WebCore/generated/JSHTMLOptGroupElement.cpp | 5 +- .../WebCore/generated/JSHTMLOptGroupElement.h | 10 +- .../WebCore/generated/JSHTMLOptionElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLOptionElement.h | 10 +- .../WebCore/generated/JSHTMLOptionsCollection.h | 8 +- .../WebCore/generated/JSHTMLParagraphElement.cpp | 5 +- .../WebCore/generated/JSHTMLParagraphElement.h | 10 +- .../WebCore/generated/JSHTMLParamElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLParamElement.h | 10 +- .../webkit/WebCore/generated/JSHTMLPreElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLPreElement.h | 10 +- .../WebCore/generated/JSHTMLQuoteElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLQuoteElement.h | 10 +- .../WebCore/generated/JSHTMLScriptElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLScriptElement.h | 10 +- .../WebCore/generated/JSHTMLSelectElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLSelectElement.h | 8 +- .../WebCore/generated/JSHTMLSourceElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLSourceElement.h | 10 +- .../WebCore/generated/JSHTMLStyleElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLStyleElement.h | 10 +- .../generated/JSHTMLTableCaptionElement.cpp | 5 +- .../WebCore/generated/JSHTMLTableCaptionElement.h | 10 +- .../WebCore/generated/JSHTMLTableCellElement.cpp | 5 +- .../WebCore/generated/JSHTMLTableCellElement.h | 10 +- .../WebCore/generated/JSHTMLTableColElement.cpp | 5 +- .../WebCore/generated/JSHTMLTableColElement.h | 10 +- .../WebCore/generated/JSHTMLTableElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLTableElement.h | 8 +- .../WebCore/generated/JSHTMLTableRowElement.cpp | 5 +- .../WebCore/generated/JSHTMLTableRowElement.h | 8 +- .../generated/JSHTMLTableSectionElement.cpp | 5 +- .../WebCore/generated/JSHTMLTableSectionElement.h | 8 +- .../WebCore/generated/JSHTMLTextAreaElement.cpp | 5 +- .../WebCore/generated/JSHTMLTextAreaElement.h | 8 +- .../WebCore/generated/JSHTMLTitleElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLTitleElement.h | 10 +- .../WebCore/generated/JSHTMLUListElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLUListElement.h | 10 +- .../WebCore/generated/JSHTMLVideoElement.cpp | 5 +- .../webkit/WebCore/generated/JSHTMLVideoElement.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSHistory.h | 8 +- .../webkit/WebCore/generated/JSImageData.cpp | 5 +- .../webkit/WebCore/generated/JSImageData.h | 10 +- .../WebCore/generated/JSInspectorBackend.cpp | 152 +- .../webkit/WebCore/generated/JSInspectorBackend.h | 27 +- .../WebCore/generated/JSJavaScriptCallFrame.h | 8 +- .../webkit/WebCore/generated/JSKeyboardEvent.cpp | 5 +- .../webkit/WebCore/generated/JSKeyboardEvent.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSLocation.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSMedia.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSMedia.h | 8 +- .../webkit/WebCore/generated/JSMediaError.cpp | 5 +- .../webkit/WebCore/generated/JSMediaError.h | 8 +- .../webkit/WebCore/generated/JSMediaList.cpp | 5 +- .../webkit/WebCore/generated/JSMediaList.h | 8 +- .../webkit/WebCore/generated/JSMessageChannel.h | 8 +- .../webkit/WebCore/generated/JSMessageEvent.cpp | 8 +- .../webkit/WebCore/generated/JSMessageEvent.h | 8 +- .../webkit/WebCore/generated/JSMessagePort.cpp | 5 +- .../webkit/WebCore/generated/JSMessagePort.h | 8 +- .../webkit/WebCore/generated/JSMimeType.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSMimeType.h | 10 +- .../webkit/WebCore/generated/JSMimeTypeArray.cpp | 5 +- .../webkit/WebCore/generated/JSMimeTypeArray.h | 8 +- .../webkit/WebCore/generated/JSMouseEvent.cpp | 5 +- .../webkit/WebCore/generated/JSMouseEvent.h | 8 +- .../webkit/WebCore/generated/JSMutationEvent.cpp | 5 +- .../webkit/WebCore/generated/JSMutationEvent.h | 8 +- .../webkit/WebCore/generated/JSNamedNodeMap.cpp | 5 +- .../webkit/WebCore/generated/JSNamedNodeMap.h | 8 +- .../webkit/WebCore/generated/JSNavigator.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSNode.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSNode.h | 8 +- .../webkit/WebCore/generated/JSNodeFilter.cpp | 5 +- .../webkit/WebCore/generated/JSNodeFilter.h | 8 +- .../webkit/WebCore/generated/JSNodeIterator.cpp | 5 +- .../webkit/WebCore/generated/JSNodeIterator.h | 8 +- .../webkit/WebCore/generated/JSNodeList.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSNodeList.h | 8 +- .../webkit/WebCore/generated/JSNotation.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSNotation.h | 10 +- .../webkit/WebCore/generated/JSOverflowEvent.cpp | 5 +- .../webkit/WebCore/generated/JSOverflowEvent.h | 8 +- .../WebCore/generated/JSPageTransitionEvent.cpp | 5 +- .../WebCore/generated/JSPageTransitionEvent.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSPlugin.h | 8 +- .../webkit/WebCore/generated/JSPluginArray.cpp | 5 +- .../webkit/WebCore/generated/JSPluginArray.h | 8 +- .../webkit/WebCore/generated/JSPositionError.cpp | 5 +- .../webkit/WebCore/generated/JSPositionError.h | 8 +- .../WebCore/generated/JSProcessingInstruction.cpp | 5 +- .../WebCore/generated/JSProcessingInstruction.h | 10 +- .../webkit/WebCore/generated/JSProgressEvent.cpp | 5 +- .../webkit/WebCore/generated/JSProgressEvent.h | 8 +- .../webkit/WebCore/generated/JSRGBColor.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSRGBColor.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSRange.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSRange.h | 8 +- .../webkit/WebCore/generated/JSRangeException.cpp | 5 +- .../webkit/WebCore/generated/JSRangeException.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSRect.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSRect.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSSQLError.h | 10 +- .../webkit/WebCore/generated/JSSQLResultSet.h | 10 +- .../WebCore/generated/JSSQLResultSetRowList.h | 8 +- .../webkit/WebCore/generated/JSSQLTransaction.h | 11 +- .../webkit/WebCore/generated/JSSVGAElement.h | 8 +- .../WebCore/generated/JSSVGAltGlyphElement.h | 10 +- .../webkit/WebCore/generated/JSSVGAngle.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSSVGAngle.h | 8 +- .../WebCore/generated/JSSVGAnimateColorElement.h | 13 + .../webkit/WebCore/generated/JSSVGAnimateElement.h | 13 + .../generated/JSSVGAnimateTransformElement.h | 13 + .../webkit/WebCore/generated/JSSVGAnimatedAngle.h | 10 +- .../WebCore/generated/JSSVGAnimatedBoolean.h | 10 +- .../WebCore/generated/JSSVGAnimatedEnumeration.h | 10 +- .../WebCore/generated/JSSVGAnimatedInteger.h | 10 +- .../webkit/WebCore/generated/JSSVGAnimatedLength.h | 10 +- .../WebCore/generated/JSSVGAnimatedLengthList.h | 10 +- .../webkit/WebCore/generated/JSSVGAnimatedNumber.h | 10 +- .../WebCore/generated/JSSVGAnimatedNumberList.h | 10 +- .../generated/JSSVGAnimatedPreserveAspectRatio.h | 10 +- .../webkit/WebCore/generated/JSSVGAnimatedRect.h | 10 +- .../webkit/WebCore/generated/JSSVGAnimatedString.h | 10 +- .../WebCore/generated/JSSVGAnimatedTransformList.h | 10 +- .../WebCore/generated/JSSVGAnimationElement.h | 8 +- .../webkit/WebCore/generated/JSSVGCircleElement.h | 8 +- .../WebCore/generated/JSSVGClipPathElement.h | 8 +- .../webkit/WebCore/generated/JSSVGColor.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSSVGColor.h | 8 +- .../JSSVGComponentTransferFunctionElement.cpp | 5 +- .../JSSVGComponentTransferFunctionElement.h | 8 +- .../webkit/WebCore/generated/JSSVGCursorElement.h | 8 +- .../webkit/WebCore/generated/JSSVGDefsElement.h | 8 +- .../webkit/WebCore/generated/JSSVGDescElement.h | 8 +- .../webkit/WebCore/generated/JSSVGDocument.h | 8 +- .../webkit/WebCore/generated/JSSVGElement.cpp | 5 +- .../webkit/WebCore/generated/JSSVGElement.h | 10 +- .../WebCore/generated/JSSVGElementInstance.h | 8 +- .../WebCore/generated/JSSVGElementInstanceList.h | 8 +- .../webkit/WebCore/generated/JSSVGEllipseElement.h | 8 +- .../webkit/WebCore/generated/JSSVGException.cpp | 5 +- .../webkit/WebCore/generated/JSSVGException.h | 8 +- .../WebCore/generated/JSSVGFEBlendElement.cpp | 5 +- .../webkit/WebCore/generated/JSSVGFEBlendElement.h | 8 +- .../generated/JSSVGFEColorMatrixElement.cpp | 5 +- .../WebCore/generated/JSSVGFEColorMatrixElement.h | 8 +- .../generated/JSSVGFEComponentTransferElement.h | 8 +- .../WebCore/generated/JSSVGFECompositeElement.cpp | 9 +- .../WebCore/generated/JSSVGFECompositeElement.h | 10 +- .../generated/JSSVGFEDiffuseLightingElement.h | 8 +- .../generated/JSSVGFEDisplacementMapElement.cpp | 5 +- .../generated/JSSVGFEDisplacementMapElement.h | 8 +- .../WebCore/generated/JSSVGFEDistantLightElement.h | 10 +- .../WebCore/generated/JSSVGFEFloodElement.cpp | 19 +- .../webkit/WebCore/generated/JSSVGFEFloodElement.h | 9 +- .../webkit/WebCore/generated/JSSVGFEFuncAElement.h | 13 + .../webkit/WebCore/generated/JSSVGFEFuncBElement.h | 13 + .../webkit/WebCore/generated/JSSVGFEFuncGElement.h | 13 + .../webkit/WebCore/generated/JSSVGFEFuncRElement.h | 13 + .../WebCore/generated/JSSVGFEGaussianBlurElement.h | 8 +- .../webkit/WebCore/generated/JSSVGFEImageElement.h | 8 +- .../webkit/WebCore/generated/JSSVGFEMergeElement.h | 8 +- .../WebCore/generated/JSSVGFEMergeNodeElement.h | 10 +- .../WebCore/generated/JSSVGFEMorphologyElement.cpp | 336 + .../WebCore/generated/JSSVGFEMorphologyElement.h | 99 + .../WebCore/generated/JSSVGFEOffsetElement.h | 8 +- .../WebCore/generated/JSSVGFEPointLightElement.h | 10 +- .../generated/JSSVGFESpecularLightingElement.h | 8 +- .../WebCore/generated/JSSVGFESpotLightElement.h | 10 +- .../webkit/WebCore/generated/JSSVGFETileElement.h | 8 +- .../WebCore/generated/JSSVGFETurbulenceElement.cpp | 5 +- .../WebCore/generated/JSSVGFETurbulenceElement.h | 8 +- .../webkit/WebCore/generated/JSSVGFilterElement.h | 8 +- .../webkit/WebCore/generated/JSSVGFontElement.h | 13 + .../WebCore/generated/JSSVGFontFaceElement.h | 13 + .../WebCore/generated/JSSVGFontFaceFormatElement.h | 13 + .../WebCore/generated/JSSVGFontFaceNameElement.h | 13 + .../WebCore/generated/JSSVGFontFaceSrcElement.h | 13 + .../WebCore/generated/JSSVGFontFaceUriElement.h | 13 + .../WebCore/generated/JSSVGForeignObjectElement.h | 8 +- .../webkit/WebCore/generated/JSSVGGElement.h | 8 +- .../webkit/WebCore/generated/JSSVGGlyphElement.h | 13 + .../WebCore/generated/JSSVGGradientElement.cpp | 5 +- .../WebCore/generated/JSSVGGradientElement.h | 8 +- .../webkit/WebCore/generated/JSSVGHKernElement.h | 13 + .../webkit/WebCore/generated/JSSVGImageElement.h | 8 +- .../webkit/WebCore/generated/JSSVGLength.cpp | 5 +- .../webkit/WebCore/generated/JSSVGLength.h | 8 +- .../webkit/WebCore/generated/JSSVGLengthList.h | 8 +- .../webkit/WebCore/generated/JSSVGLineElement.h | 8 +- .../WebCore/generated/JSSVGLinearGradientElement.h | 10 +- .../WebCore/generated/JSSVGMarkerElement.cpp | 5 +- .../webkit/WebCore/generated/JSSVGMarkerElement.h | 8 +- .../webkit/WebCore/generated/JSSVGMaskElement.h | 8 +- .../webkit/WebCore/generated/JSSVGMatrix.h | 8 +- .../WebCore/generated/JSSVGMetadataElement.h | 13 + .../WebCore/generated/JSSVGMissingGlyphElement.h | 13 + .../webkit/WebCore/generated/JSSVGNumber.h | 10 +- .../webkit/WebCore/generated/JSSVGNumberList.h | 8 +- .../webkit/WebCore/generated/JSSVGPaint.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSSVGPaint.h | 8 +- .../webkit/WebCore/generated/JSSVGPathElement.h | 8 +- .../webkit/WebCore/generated/JSSVGPathSeg.cpp | 5 +- .../webkit/WebCore/generated/JSSVGPathSeg.h | 8 +- .../webkit/WebCore/generated/JSSVGPathSegArcAbs.h | 10 +- .../webkit/WebCore/generated/JSSVGPathSegArcRel.h | 10 +- .../WebCore/generated/JSSVGPathSegClosePath.h | 13 + .../generated/JSSVGPathSegCurvetoCubicAbs.h | 10 +- .../generated/JSSVGPathSegCurvetoCubicRel.h | 10 +- .../generated/JSSVGPathSegCurvetoCubicSmoothAbs.h | 10 +- .../generated/JSSVGPathSegCurvetoCubicSmoothRel.h | 10 +- .../generated/JSSVGPathSegCurvetoQuadraticAbs.h | 10 +- .../generated/JSSVGPathSegCurvetoQuadraticRel.h | 10 +- .../JSSVGPathSegCurvetoQuadraticSmoothAbs.h | 10 +- .../JSSVGPathSegCurvetoQuadraticSmoothRel.h | 10 +- .../WebCore/generated/JSSVGPathSegLinetoAbs.h | 10 +- .../generated/JSSVGPathSegLinetoHorizontalAbs.h | 10 +- .../generated/JSSVGPathSegLinetoHorizontalRel.h | 10 +- .../WebCore/generated/JSSVGPathSegLinetoRel.h | 10 +- .../generated/JSSVGPathSegLinetoVerticalAbs.h | 10 +- .../generated/JSSVGPathSegLinetoVerticalRel.h | 10 +- .../webkit/WebCore/generated/JSSVGPathSegList.h | 8 +- .../WebCore/generated/JSSVGPathSegMovetoAbs.h | 10 +- .../WebCore/generated/JSSVGPathSegMovetoRel.h | 10 +- .../webkit/WebCore/generated/JSSVGPatternElement.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSSVGPoint.h | 8 +- .../webkit/WebCore/generated/JSSVGPointList.h | 8 +- .../webkit/WebCore/generated/JSSVGPolygonElement.h | 8 +- .../WebCore/generated/JSSVGPolylineElement.h | 8 +- .../WebCore/generated/JSSVGPreserveAspectRatio.cpp | 5 +- .../WebCore/generated/JSSVGPreserveAspectRatio.h | 8 +- .../WebCore/generated/JSSVGRadialGradientElement.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSSVGRect.h | 10 +- .../webkit/WebCore/generated/JSSVGRectElement.h | 8 +- .../WebCore/generated/JSSVGRenderingIntent.cpp | 5 +- .../WebCore/generated/JSSVGRenderingIntent.h | 8 +- .../webkit/WebCore/generated/JSSVGSVGElement.h | 8 +- .../webkit/WebCore/generated/JSSVGScriptElement.h | 10 +- .../webkit/WebCore/generated/JSSVGSetElement.h | 13 + .../webkit/WebCore/generated/JSSVGStopElement.h | 8 +- .../webkit/WebCore/generated/JSSVGStringList.h | 8 +- .../webkit/WebCore/generated/JSSVGStyleElement.h | 10 +- .../webkit/WebCore/generated/JSSVGSwitchElement.h | 8 +- .../webkit/WebCore/generated/JSSVGSymbolElement.h | 8 +- .../webkit/WebCore/generated/JSSVGTRefElement.h | 10 +- .../webkit/WebCore/generated/JSSVGTSpanElement.h | 13 + .../WebCore/generated/JSSVGTextContentElement.cpp | 5 +- .../WebCore/generated/JSSVGTextContentElement.h | 8 +- .../webkit/WebCore/generated/JSSVGTextElement.h | 8 +- .../WebCore/generated/JSSVGTextPathElement.cpp | 5 +- .../WebCore/generated/JSSVGTextPathElement.h | 8 +- .../generated/JSSVGTextPositioningElement.h | 10 +- .../webkit/WebCore/generated/JSSVGTitleElement.h | 8 +- .../webkit/WebCore/generated/JSSVGTransform.cpp | 5 +- .../webkit/WebCore/generated/JSSVGTransform.h | 8 +- .../webkit/WebCore/generated/JSSVGTransformList.h | 8 +- .../webkit/WebCore/generated/JSSVGUnitTypes.cpp | 5 +- .../webkit/WebCore/generated/JSSVGUnitTypes.h | 8 +- .../webkit/WebCore/generated/JSSVGUseElement.h | 8 +- .../webkit/WebCore/generated/JSSVGViewElement.h | 8 +- .../webkit/WebCore/generated/JSSVGZoomEvent.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSScreen.h | 10 +- .../webkit/WebCore/generated/JSSharedWorker.h | 8 +- .../WebCore/generated/JSSharedWorkerContext.h | 10 +- .../webkit/WebCore/generated/JSStorage.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSStorage.h | 8 +- .../webkit/WebCore/generated/JSStorageEvent.cpp | 25 +- .../webkit/WebCore/generated/JSStorageEvent.h | 9 +- .../webkit/WebCore/generated/JSStyleSheet.cpp | 5 +- .../webkit/WebCore/generated/JSStyleSheet.h | 8 +- .../webkit/WebCore/generated/JSStyleSheetList.cpp | 5 +- .../webkit/WebCore/generated/JSStyleSheetList.h | 8 +- src/3rdparty/webkit/WebCore/generated/JSText.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSText.h | 8 +- .../webkit/WebCore/generated/JSTextEvent.cpp | 5 +- .../webkit/WebCore/generated/JSTextEvent.h | 8 +- .../webkit/WebCore/generated/JSTextMetrics.cpp | 5 +- .../webkit/WebCore/generated/JSTextMetrics.h | 10 +- .../webkit/WebCore/generated/JSTimeRanges.h | 8 +- .../webkit/WebCore/generated/JSTreeWalker.cpp | 5 +- .../webkit/WebCore/generated/JSTreeWalker.h | 8 +- .../webkit/WebCore/generated/JSUIEvent.cpp | 5 +- src/3rdparty/webkit/WebCore/generated/JSUIEvent.h | 8 +- .../webkit/WebCore/generated/JSValidityState.h | 10 +- .../webkit/WebCore/generated/JSVoidCallback.h | 11 +- .../WebCore/generated/JSWebKitAnimationEvent.cpp | 5 +- .../WebCore/generated/JSWebKitAnimationEvent.h | 8 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.cpp | 5 +- .../WebCore/generated/JSWebKitCSSKeyframeRule.h | 10 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.cpp | 5 +- .../WebCore/generated/JSWebKitCSSKeyframesRule.h | 8 +- .../webkit/WebCore/generated/JSWebKitCSSMatrix.h | 8 +- .../generated/JSWebKitCSSTransformValue.cpp | 5 +- .../WebCore/generated/JSWebKitCSSTransformValue.h | 8 +- .../webkit/WebCore/generated/JSWebKitPoint.h | 10 +- .../WebCore/generated/JSWebKitTransitionEvent.cpp | 5 +- .../WebCore/generated/JSWebKitTransitionEvent.h | 8 +- .../webkit/WebCore/generated/JSWebSocket.cpp | 41 +- .../webkit/WebCore/generated/JSWebSocket.h | 13 +- .../webkit/WebCore/generated/JSWheelEvent.cpp | 5 +- .../webkit/WebCore/generated/JSWheelEvent.h | 10 +- src/3rdparty/webkit/WebCore/generated/JSWorker.h | 8 +- .../webkit/WebCore/generated/JSWorkerContext.h | 8 +- .../webkit/WebCore/generated/JSWorkerLocation.cpp | 5 +- .../webkit/WebCore/generated/JSWorkerLocation.h | 8 +- .../webkit/WebCore/generated/JSWorkerNavigator.h | 10 +- .../webkit/WebCore/generated/JSXMLHttpRequest.h | 8 +- .../generated/JSXMLHttpRequestException.cpp | 5 +- .../WebCore/generated/JSXMLHttpRequestException.h | 8 +- .../generated/JSXMLHttpRequestProgressEvent.cpp | 5 +- .../generated/JSXMLHttpRequestProgressEvent.h | 10 +- .../WebCore/generated/JSXMLHttpRequestUpload.cpp | 5 +- .../WebCore/generated/JSXMLHttpRequestUpload.h | 8 +- .../webkit/WebCore/generated/JSXMLSerializer.cpp | 5 +- .../webkit/WebCore/generated/JSXMLSerializer.h | 8 +- .../webkit/WebCore/generated/JSXPathEvaluator.cpp | 5 +- .../webkit/WebCore/generated/JSXPathEvaluator.h | 8 +- .../webkit/WebCore/generated/JSXPathException.cpp | 5 +- .../webkit/WebCore/generated/JSXPathException.h | 8 +- .../webkit/WebCore/generated/JSXPathExpression.cpp | 5 +- .../webkit/WebCore/generated/JSXPathExpression.h | 8 +- .../webkit/WebCore/generated/JSXPathNSResolver.h | 11 +- .../webkit/WebCore/generated/JSXPathResult.cpp | 5 +- .../webkit/WebCore/generated/JSXPathResult.h | 8 +- .../webkit/WebCore/generated/JSXSLTProcessor.h | 11 +- .../webkit/WebCore/generated/StringPrototype.lut.h | 7 +- .../WebCore/generated/UserAgentStyleSheets.h | 3 +- .../WebCore/generated/UserAgentStyleSheetsData.cpp | 721 +- .../webkit/WebCore/generated/WebKitVersion.h | 2 +- .../webkit/WebCore/html/HTMLAnchorElement.cpp | 27 +- .../webkit/WebCore/html/HTMLAnchorElement.h | 27 + .../webkit/WebCore/html/HTMLAttributeNames.in | 2 +- .../webkit/WebCore/html/HTMLCanvasElement.cpp | 4 +- src/3rdparty/webkit/WebCore/html/HTMLDocument.cpp | 3 +- src/3rdparty/webkit/WebCore/html/HTMLElement.cpp | 2 +- .../webkit/WebCore/html/HTMLFormControlElement.cpp | 100 +- .../webkit/WebCore/html/HTMLFormControlElement.h | 24 +- .../webkit/WebCore/html/HTMLFrameElementBase.cpp | 6 +- .../webkit/WebCore/html/HTMLImageElement.cpp | 4 +- .../webkit/WebCore/html/HTMLInputElement.cpp | 189 +- .../webkit/WebCore/html/HTMLInputElement.h | 20 +- .../webkit/WebCore/html/HTMLInputElement.idl | 6 + .../webkit/WebCore/html/HTMLLinkElement.cpp | 31 +- .../webkit/WebCore/html/HTMLMediaElement.cpp | 146 +- .../webkit/WebCore/html/HTMLMediaElement.h | 13 +- .../webkit/WebCore/html/HTMLObjectElement.cpp | 6 +- .../webkit/WebCore/html/HTMLScriptElement.cpp | 4 +- .../webkit/WebCore/html/HTMLTextAreaElement.cpp | 89 +- .../webkit/WebCore/html/HTMLTextAreaElement.h | 14 +- src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 19 +- .../webkit/WebCore/html/HTMLVideoElement.cpp | 13 + .../webkit/WebCore/html/HTMLVideoElement.h | 2 +- src/3rdparty/webkit/WebCore/html/ValidityState.cpp | 48 + src/3rdparty/webkit/WebCore/html/ValidityState.h | 7 +- .../webkit/WebCore/html/canvas/CanvasActiveInfo.h | 62 + .../WebCore/html/canvas/CanvasActiveInfo.idl | 36 + .../webkit/WebCore/html/canvas/CanvasArray.cpp | 2 +- .../webkit/WebCore/html/canvas/CanvasArray.h | 8 + .../webkit/WebCore/html/canvas/CanvasArray.idl | 2 +- .../webkit/WebCore/html/canvas/CanvasByteArray.cpp | 11 +- .../webkit/WebCore/html/canvas/CanvasByteArray.h | 3 + .../WebCore/html/canvas/CanvasFloatArray.cpp | 13 +- .../webkit/WebCore/html/canvas/CanvasFloatArray.h | 2 + .../webkit/WebCore/html/canvas/CanvasIntArray.cpp | 14 +- .../webkit/WebCore/html/canvas/CanvasIntArray.h | 3 + .../webkit/WebCore/html/canvas/CanvasObject.h | 6 +- .../html/canvas/CanvasRenderingContext2D.cpp | 2 +- .../html/canvas/CanvasRenderingContext3D.cpp | 29 + .../WebCore/html/canvas/CanvasRenderingContext3D.h | 9 +- .../html/canvas/CanvasRenderingContext3D.idl | 10 +- .../WebCore/html/canvas/CanvasShortArray.cpp | 12 +- .../webkit/WebCore/html/canvas/CanvasShortArray.h | 3 + .../html/canvas/CanvasUnsignedByteArray.cpp | 9 +- .../WebCore/html/canvas/CanvasUnsignedByteArray.h | 3 + .../WebCore/html/canvas/CanvasUnsignedIntArray.cpp | 9 +- .../WebCore/html/canvas/CanvasUnsignedIntArray.h | 3 + .../html/canvas/CanvasUnsignedShortArray.cpp | 9 +- .../WebCore/html/canvas/CanvasUnsignedShortArray.h | 3 + .../webkit/WebCore/inspector/InspectorBackend.cpp | 126 +- .../webkit/WebCore/inspector/InspectorBackend.h | 28 +- .../webkit/WebCore/inspector/InspectorBackend.idl | 26 +- .../WebCore/inspector/InspectorController.cpp | 347 +- .../webkit/WebCore/inspector/InspectorController.h | 52 +- .../webkit/WebCore/inspector/InspectorDOMAgent.cpp | 38 - .../webkit/WebCore/inspector/InspectorDOMAgent.h | 6 - .../inspector/InspectorDOMStorageResource.cpp | 2 +- .../inspector/InspectorDatabaseResource.cpp | 5 +- .../WebCore/inspector/InspectorDatabaseResource.h | 5 +- .../webkit/WebCore/inspector/InspectorFrontend.cpp | 105 +- .../webkit/WebCore/inspector/InspectorFrontend.h | 15 +- .../webkit/WebCore/inspector/InspectorResource.cpp | 18 + .../webkit/WebCore/inspector/InspectorResource.h | 4 + .../webkit/WebCore/inspector/JavaScriptCallFrame.h | 8 +- .../WebCore/inspector/JavaScriptProfileNode.cpp | 50 - .../WebCore/inspector/front-end/ConsoleView.js | 69 +- .../WebCore/inspector/front-end/CookieItemsView.js | 15 +- .../webkit/WebCore/inspector/front-end/DOMAgent.js | 15 +- .../webkit/WebCore/inspector/front-end/Database.js | 47 +- .../WebCore/inspector/front-end/ElementsPanel.js | 4 +- .../inspector/front-end/ElementsTreeOutline.js | 242 +- .../WebCore/inspector/front-end/InjectedScript.js | 107 +- .../inspector/front-end/InjectedScriptAccess.js | 42 +- .../webkit/WebCore/inspector/front-end/Object.js | 6 +- .../WebCore/inspector/front-end/ProfileView.js | 125 +- .../WebCore/inspector/front-end/ProfilesPanel.js | 228 +- .../WebCore/inspector/front-end/ResourceView.js | 1 + .../WebCore/inspector/front-end/ResourcesPanel.js | 114 +- .../inspector/front-end/ScopeChainSidebarPane.js | 12 +- .../WebCore/inspector/front-end/ScriptsPanel.js | 24 +- .../WebCore/inspector/front-end/SourceFrame.js | 528 +- .../WebCore/inspector/front-end/SourceView.js | 9 +- .../WebCore/inspector/front-end/StoragePanel.js | 62 +- .../WebCore/inspector/front-end/TestController.js | 65 + .../WebCore/inspector/front-end/TextPrompt.js | 2 +- .../WebCore/inspector/front-end/TimelineAgent.js | 4 +- .../front-end/WatchExpressionsSidebarPane.js | 7 +- .../webkit/WebCore/inspector/front-end/WebKit.qrc | 2 + .../WebCore/inspector/front-end/inspector.css | 68 +- .../WebCore/inspector/front-end/inspector.html | 5 +- .../WebCore/inspector/front-end/inspector.js | 92 +- .../front-end/inspectorSyntaxHighlight.css | 71 + .../WebCore/inspector/front-end/utilities.js | 145 +- src/3rdparty/webkit/WebCore/loader/Cache.cpp | 3 +- .../webkit/WebCore/loader/CachedResourceClient.h | 4 +- .../webkit/WebCore/loader/CachedResourceHandle.h | 7 +- src/3rdparty/webkit/WebCore/loader/EmptyClients.h | 1 + src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp | 1743 +--- src/3rdparty/webkit/WebCore/loader/FrameLoader.h | 813 +- .../webkit/WebCore/loader/FrameLoaderClient.h | 3 +- .../webkit/WebCore/loader/FrameLoaderTypes.h | 5 + .../webkit/WebCore/loader/HistoryController.cpp | 627 ++ .../webkit/WebCore/loader/HistoryController.h | 95 + src/3rdparty/webkit/WebCore/loader/ImageLoader.cpp | 112 +- src/3rdparty/webkit/WebCore/loader/ImageLoader.h | 9 +- .../webkit/WebCore/loader/MainResourceLoader.cpp | 28 +- .../webkit/WebCore/loader/PolicyCallback.cpp | 133 + .../webkit/WebCore/loader/PolicyCallback.h | 80 + .../webkit/WebCore/loader/PolicyChecker.cpp | 197 + src/3rdparty/webkit/WebCore/loader/PolicyChecker.h | 97 + .../webkit/WebCore/loader/RedirectScheduler.cpp | 374 + .../webkit/WebCore/loader/RedirectScheduler.h | 81 + .../webkit/WebCore/loader/ResourceLoadNotifier.cpp | 177 + .../webkit/WebCore/loader/ResourceLoadNotifier.h | 74 + .../webkit/WebCore/loader/ResourceLoader.cpp | 22 +- .../webkit/WebCore/loader/SubresourceLoader.cpp | 7 +- .../WebCore/loader/WorkerThreadableLoader.cpp | 2 +- .../loader/appcache/ApplicationCacheGroup.cpp | 2 +- .../webkit/WebCore/loader/icon/IconDatabase.cpp | 26 +- .../WebCore/loader/icon/IconDatabaseNone.cpp | 2 +- src/3rdparty/webkit/WebCore/page/ChromeClient.h | 4 + .../webkit/WebCore/page/ContextMenuController.cpp | 8 +- src/3rdparty/webkit/WebCore/page/DOMWindow.cpp | 24 +- src/3rdparty/webkit/WebCore/page/DOMWindow.h | 5 +- src/3rdparty/webkit/WebCore/page/DOMWindow.idl | 37 +- .../webkit/WebCore/page/DragController.cpp | 6 + src/3rdparty/webkit/WebCore/page/EventHandler.cpp | 17 +- src/3rdparty/webkit/WebCore/page/EventSource.cpp | 3 +- src/3rdparty/webkit/WebCore/page/Frame.cpp | 10 +- src/3rdparty/webkit/WebCore/page/Frame.h | 3 + src/3rdparty/webkit/WebCore/page/FrameView.cpp | 79 + src/3rdparty/webkit/WebCore/page/FrameView.h | 2 + src/3rdparty/webkit/WebCore/page/History.cpp | 10 +- src/3rdparty/webkit/WebCore/page/Page.cpp | 68 +- src/3rdparty/webkit/WebCore/page/Page.h | 9 +- src/3rdparty/webkit/WebCore/page/PageGroup.cpp | 110 +- src/3rdparty/webkit/WebCore/page/PageGroup.h | 19 +- src/3rdparty/webkit/WebCore/page/PluginHalter.cpp | 7 +- src/3rdparty/webkit/WebCore/page/PluginHalter.h | 5 +- .../webkit/WebCore/page/PluginHalterClient.h | 1 + src/3rdparty/webkit/WebCore/page/PrintContext.cpp | 30 +- .../webkit/WebCore/page/SecurityOrigin.cpp | 66 +- src/3rdparty/webkit/WebCore/page/SecurityOrigin.h | 21 +- src/3rdparty/webkit/WebCore/page/Settings.cpp | 41 +- src/3rdparty/webkit/WebCore/page/Settings.h | 31 +- .../webkit/WebCore/page/UserContentURLPattern.cpp | 32 +- .../webkit/WebCore/page/UserContentURLPattern.h | 2 +- src/3rdparty/webkit/WebCore/page/UserScript.h | 14 +- src/3rdparty/webkit/WebCore/page/UserStyleSheet.h | 13 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.cpp | 67 +- src/3rdparty/webkit/WebCore/page/XSSAuditor.h | 15 +- .../WebCore/page/animation/AnimationBase.cpp | 10 +- .../WebCore/page/animation/AnimationController.cpp | 21 +- .../page/animation/AnimationControllerPrivate.h | 16 +- .../WebCore/page/animation/ImplicitAnimation.cpp | 6 +- .../WebCore/page/animation/KeyframeAnimation.cpp | 6 +- .../webkit/WebCore/platform/ContextMenu.cpp | 8 +- src/3rdparty/webkit/WebCore/platform/Cookie.h | 19 + .../webkit/WebCore/platform/CrossThreadCopier.cpp | 2 +- src/3rdparty/webkit/WebCore/platform/KURL.cpp | 2 +- .../webkit/WebCore/platform/KURLGoogle.cpp | 2 +- .../webkit/WebCore/platform/ScrollView.cpp | 29 +- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 4 +- .../webkit/WebCore/platform/SuddenTermination.h | 3 + src/3rdparty/webkit/WebCore/platform/ThemeTypes.h | 2 +- .../webkit/WebCore/platform/graphics/BitmapImage.h | 1 + .../WebCore/platform/graphics/FontDescription.h | 8 +- .../WebCore/platform/graphics/FontFastPath.cpp | 4 + .../WebCore/platform/graphics/GraphicsContext.h | 5 + .../WebCore/platform/graphics/GraphicsContext3D.h | 21 +- .../WebCore/platform/graphics/GraphicsLayer.cpp | 10 + .../WebCore/platform/graphics/GraphicsLayer.h | 3 + .../WebCore/platform/graphics/ImageSource.cpp | 4 - .../WebCore/platform/graphics/MediaPlayer.cpp | 24 +- .../webkit/WebCore/platform/graphics/MediaPlayer.h | 23 +- .../WebCore/platform/graphics/MediaPlayerPrivate.h | 7 +- .../WebCore/platform/graphics/SimpleFontData.h | 3 +- .../WebCore/platform/graphics/TextRenderingMode.h | 35 + .../platform/graphics/filters/FEComposite.cpp | 2 +- .../platform/graphics/filters/FEGaussianBlur.cpp | 139 + .../platform/graphics/filters/FEGaussianBlur.h | 57 + .../platform/graphics/filters/FilterEffect.cpp | 7 +- .../platform/graphics/filters/FilterEffect.h | 18 +- .../platform/graphics/filters/SourceAlpha.cpp | 25 +- .../platform/graphics/filters/SourceAlpha.h | 2 +- .../WebCore/platform/graphics/qt/ColorQt.cpp | 5 +- .../platform/graphics/qt/GraphicsContextQt.cpp | 65 +- .../platform/graphics/qt/ImageDecoderQt.cpp | 379 +- .../WebCore/platform/graphics/qt/ImageDecoderQt.h | 49 +- .../WebCore/platform/graphics/qt/ImageQt.cpp | 1 + .../WebCore/platform/graphics/qt/ImageSourceQt.cpp | 67 - .../WebCore/platform/image-decoders/ImageDecoder.h | 16 +- .../platform/image-decoders/qt/RGBA32BufferQt.cpp | 144 + .../webkit/WebCore/platform/mac/ClipboardMac.mm | 21 +- .../webkit/WebCore/platform/mac/ThemeMac.mm | 26 + .../WebCore/platform/network/CredentialStorage.cpp | 125 +- .../WebCore/platform/network/CredentialStorage.h | 6 +- .../WebCore/platform/network/HTTPHeaderMap.cpp | 2 +- .../WebCore/platform/network/ResourceErrorBase.cpp | 6 +- .../platform/network/ResourceRequestBase.cpp | 4 +- .../platform/network/ResourceResponseBase.cpp | 8 +- .../platform/network/qt/QNetworkReplyHandler.cpp | 84 +- .../platform/network/qt/QNetworkReplyHandler.h | 4 - .../webkit/WebCore/platform/qt/ClipboardQt.cpp | 4 +- .../webkit/WebCore/platform/qt/Localizations.cpp | 4 +- .../platform/qt/PlatformKeyboardEventQt.cpp | 2 +- .../WebCore/platform/qt/PlatformScreenQt.cpp | 2 +- .../webkit/WebCore/platform/qt/PopupMenuQt.cpp | 2 +- .../webkit/WebCore/platform/qt/QWebPageClient.h | 14 +- .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 9 +- .../webkit/WebCore/platform/sql/SQLValue.cpp | 8 +- .../webkit/WebCore/platform/sql/SQLValue.h | 4 +- .../webkit/WebCore/platform/sql/SQLiteDatabase.h | 4 +- .../webkit/WebCore/platform/text/AtomicString.cpp | 22 +- .../webkit/WebCore/platform/text/AtomicString.h | 3 + .../webkit/WebCore/platform/text/PlatformString.h | 13 +- .../webkit/WebCore/platform/text/String.cpp | 18 +- .../webkit/WebCore/platform/text/StringImpl.cpp | 219 +- .../webkit/WebCore/platform/text/StringImpl.h | 47 +- .../WebCore/platform/text/TextEncodingRegistry.cpp | 30 + .../WebCore/platform/text/qt/TextCodecQt.cpp | 2 +- .../webkit/WebCore/plugins/PluginDataNone.cpp | 4 - .../webkit/WebCore/plugins/PluginDatabase.cpp | 6 +- .../webkit/WebCore/plugins/PluginPackage.cpp | 3 + .../webkit/WebCore/plugins/PluginPackage.h | 13 + .../webkit/WebCore/plugins/PluginPackageNone.cpp | 32 - .../webkit/WebCore/plugins/PluginQuirkSet.h | 1 + src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 45 +- src/3rdparty/webkit/WebCore/plugins/PluginView.h | 29 +- .../webkit/WebCore/plugins/PluginViewNone.cpp | 32 +- .../WebCore/plugins/mac/PluginPackageMac.cpp | 3 +- .../webkit/WebCore/plugins/mac/PluginViewMac.cpp | 12 +- .../WebCore/plugins/qt/PluginContainerQt.cpp | 1 + .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 16 + .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 498 +- .../plugins/symbian/PluginContainerSymbian.cpp | 77 + .../plugins/symbian/PluginContainerSymbian.h | 50 + .../plugins/symbian/PluginDatabaseSymbian.cpp | 79 + .../plugins/symbian/PluginPackageSymbian.cpp | 177 + .../WebCore/plugins/symbian/PluginViewSymbian.cpp | 462 + .../webkit/WebCore/plugins/symbian/npinterface.h | 37 + .../webkit/WebCore/plugins/win/PluginViewWin.cpp | 43 +- .../webkit/WebCore/rendering/CounterNode.cpp | 12 +- .../webkit/WebCore/rendering/InlineFlowBox.cpp | 41 +- .../WebCore/rendering/MediaControlElements.cpp | 16 +- .../WebCore/rendering/MediaControlElements.h | 2 + src/3rdparty/webkit/WebCore/rendering/RenderBR.cpp | 2 +- .../webkit/WebCore/rendering/RenderBlock.cpp | 4 +- .../webkit/WebCore/rendering/RenderBox.cpp | 10 +- .../webkit/WebCore/rendering/RenderCounter.cpp | 25 +- .../webkit/WebCore/rendering/RenderImage.cpp | 2 +- .../webkit/WebCore/rendering/RenderInline.cpp | 2 +- .../webkit/WebCore/rendering/RenderLayer.cpp | 32 +- .../webkit/WebCore/rendering/RenderLayer.h | 6 +- .../WebCore/rendering/RenderLayerBacking.cpp | 32 +- .../webkit/WebCore/rendering/RenderLayerBacking.h | 6 +- .../WebCore/rendering/RenderLayerCompositor.cpp | 1 + .../webkit/WebCore/rendering/RenderListBox.cpp | 2 +- .../webkit/WebCore/rendering/RenderListBox.h | 2 +- .../WebCore/rendering/RenderMediaControls.cpp | 15 +- .../rendering/RenderMediaControlsChromium.cpp | 287 + .../rendering/RenderMediaControlsChromium.h | 46 + .../webkit/WebCore/rendering/RenderObject.cpp | 19 +- .../webkit/WebCore/rendering/RenderObject.h | 2 + .../webkit/WebCore/rendering/RenderPartObject.cpp | 10 +- .../webkit/WebCore/rendering/RenderSlider.cpp | 18 +- .../rendering/RenderTextControlMultiLine.cpp | 6 +- .../rendering/RenderTextControlSingleLine.cpp | 4 +- .../rendering/RenderTextControlSingleLine.h | 2 +- .../webkit/WebCore/rendering/RenderTheme.cpp | 6 + .../WebCore/rendering/RenderThemeChromiumMac.h | 1 + .../WebCore/rendering/RenderThemeChromiumMac.mm | 174 +- .../WebCore/rendering/RenderThemeChromiumSkia.cpp | 188 +- .../WebCore/rendering/RenderThemeChromiumWin.h | 2 +- .../webkit/WebCore/rendering/RenderThemeMac.h | 2 + .../webkit/WebCore/rendering/RenderThemeSafari.cpp | 2 +- .../webkit/WebCore/rendering/RenderWidget.cpp | 11 +- .../webkit/WebCore/rendering/RenderWidget.h | 3 + .../webkit/WebCore/rendering/SVGRenderSupport.cpp | 2 +- .../webkit/WebCore/rendering/style/RenderStyle.h | 2 +- .../WebCore/rendering/style/RenderStyleConstants.h | 1 + .../WebCore/rendering/style/SVGRenderStyle.h | 4 - .../WebCore/rendering/style/SVGRenderStyleDefs.h | 4 - .../WebCore/storage/ChangeVersionWrapper.cpp | 4 +- src/3rdparty/webkit/WebCore/storage/Database.cpp | 76 +- .../webkit/WebCore/storage/DatabaseTracker.cpp | 2 +- .../webkit/WebCore/storage/LocalStorageTask.cpp | 8 +- .../webkit/WebCore/storage/LocalStorageTask.h | 14 +- .../webkit/WebCore/storage/LocalStorageThread.cpp | 4 +- .../webkit/WebCore/storage/LocalStorageThread.h | 4 +- .../webkit/WebCore/storage/OriginQuotaManager.cpp | 2 +- src/3rdparty/webkit/WebCore/storage/SQLError.h | 4 +- .../webkit/WebCore/storage/SQLStatement.cpp | 2 +- .../webkit/WebCore/storage/SQLTransaction.cpp | 10 +- src/3rdparty/webkit/WebCore/storage/StorageArea.h | 4 +- .../webkit/WebCore/storage/StorageAreaImpl.cpp | 81 +- .../webkit/WebCore/storage/StorageAreaImpl.h | 6 +- .../webkit/WebCore/storage/StorageAreaSync.cpp | 4 +- .../webkit/WebCore/storage/StorageEvent.cpp | 11 +- src/3rdparty/webkit/WebCore/storage/StorageEvent.h | 11 +- .../webkit/WebCore/storage/StorageEvent.idl | 5 +- .../WebCore/storage/StorageEventDispatcher.cpp | 77 + src/3rdparty/webkit/WebCore/storage/StorageMap.cpp | 53 +- src/3rdparty/webkit/WebCore/storage/StorageMap.h | 26 +- .../webkit/WebCore/storage/StorageNamespace.cpp | 4 +- .../webkit/WebCore/storage/StorageNamespace.h | 2 +- .../WebCore/storage/StorageNamespaceImpl.cpp | 16 +- .../webkit/WebCore/storage/StorageNamespaceImpl.h | 5 +- .../webkit/WebCore/storage/StorageSyncManager.cpp | 8 +- .../webkit/WebCore/storage/StorageSyncManager.h | 4 +- .../webkit/WebCore/svg/LinearGradientAttributes.h | 32 +- .../webkit/WebCore/svg/RadialGradientAttributes.h | 40 +- src/3rdparty/webkit/WebCore/svg/SVGAElement.cpp | 5 +- src/3rdparty/webkit/WebCore/svg/SVGAElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGAllInOne.cpp | 2 + .../webkit/WebCore/svg/SVGAltGlyphElement.cpp | 1 + .../webkit/WebCore/svg/SVGAltGlyphElement.h | 5 +- .../webkit/WebCore/svg/SVGAnimatedProperty.h | 126 +- .../webkit/WebCore/svg/SVGAnimatedTemplate.h | 2 +- .../webkit/WebCore/svg/SVGAnimationElement.cpp | 3 +- .../webkit/WebCore/svg/SVGAnimationElement.h | 11 +- .../webkit/WebCore/svg/SVGCircleElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGCircleElement.h | 8 +- .../webkit/WebCore/svg/SVGClipPathElement.cpp | 1 + .../webkit/WebCore/svg/SVGClipPathElement.h | 10 +- .../webkit/WebCore/svg/SVGCursorElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGCursorElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGDefsElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGDefsElement.h | 9 +- src/3rdparty/webkit/WebCore/svg/SVGElement.cpp | 17 +- src/3rdparty/webkit/WebCore/svg/SVGElement.h | 35 +- src/3rdparty/webkit/WebCore/svg/SVGElement.idl | 2 +- .../webkit/WebCore/svg/SVGEllipseElement.cpp | 1 + .../webkit/WebCore/svg/SVGEllipseElement.h | 8 +- .../WebCore/svg/SVGExternalResourcesRequired.cpp | 1 - .../WebCore/svg/SVGExternalResourcesRequired.h | 25 +- .../webkit/WebCore/svg/SVGFECompositeElement.idl | 2 +- .../webkit/WebCore/svg/SVGFEFloodElement.cpp | 19 +- .../webkit/WebCore/svg/SVGFEFloodElement.h | 6 +- .../webkit/WebCore/svg/SVGFEFloodElement.idl | 3 - .../webkit/WebCore/svg/SVGFEGaussianBlurElement.h | 2 +- .../webkit/WebCore/svg/SVGFEImageElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEImageElement.h | 13 +- .../webkit/WebCore/svg/SVGFELightElement.h | 3 - .../webkit/WebCore/svg/SVGFEMergeElement.cpp | 2 + .../webkit/WebCore/svg/SVGFEMergeNodeElement.h | 5 - .../webkit/WebCore/svg/SVGFEMorphologyElement.cpp | 88 + .../webkit/WebCore/svg/SVGFEMorphologyElement.h | 52 + .../webkit/WebCore/svg/SVGFEMorphologyElement.idl | 43 + .../webkit/WebCore/svg/SVGFilterElement.cpp | 68 +- src/3rdparty/webkit/WebCore/svg/SVGFilterElement.h | 19 +- .../svg/SVGFilterPrimitiveStandardAttributes.cpp | 59 +- .../svg/SVGFilterPrimitiveStandardAttributes.h | 3 - .../webkit/WebCore/svg/SVGFitToViewBox.cpp | 20 +- src/3rdparty/webkit/WebCore/svg/SVGFitToViewBox.h | 16 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.cpp | 3 +- src/3rdparty/webkit/WebCore/svg/SVGFontElement.h | 8 +- .../webkit/WebCore/svg/SVGForeignObjectElement.cpp | 2 + .../webkit/WebCore/svg/SVGForeignObjectElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGGElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGGElement.h | 10 +- .../webkit/WebCore/svg/SVGGradientElement.cpp | 2 + .../webkit/WebCore/svg/SVGGradientElement.h | 12 +- .../webkit/WebCore/svg/SVGImageElement.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGImageElement.h | 11 +- src/3rdparty/webkit/WebCore/svg/SVGLineElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGLineElement.h | 8 +- .../WebCore/svg/SVGLinearGradientElement.cpp | 19 +- .../webkit/WebCore/svg/SVGMPathElement.cpp | 4 +- src/3rdparty/webkit/WebCore/svg/SVGMPathElement.h | 54 +- .../webkit/WebCore/svg/SVGMarkerElement.cpp | 10 +- src/3rdparty/webkit/WebCore/svg/SVGMarkerElement.h | 14 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.cpp | 52 +- src/3rdparty/webkit/WebCore/svg/SVGMaskElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGPathElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGPathElement.h | 10 +- .../webkit/WebCore/svg/SVGPatternElement.cpp | 8 +- .../webkit/WebCore/svg/SVGPatternElement.h | 17 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.cpp | 3 +- src/3rdparty/webkit/WebCore/svg/SVGPolyElement.h | 10 +- .../WebCore/svg/SVGRadialGradientElement.cpp | 48 +- src/3rdparty/webkit/WebCore/svg/SVGRectElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGRectElement.h | 8 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.cpp | 14 +- src/3rdparty/webkit/WebCore/svg/SVGSVGElement.h | 15 +- .../webkit/WebCore/svg/SVGScriptElement.cpp | 2 + src/3rdparty/webkit/WebCore/svg/SVGScriptElement.h | 12 +- .../webkit/WebCore/svg/SVGSwitchElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGSwitchElement.h | 16 +- .../webkit/WebCore/svg/SVGSymbolElement.cpp | 5 +- src/3rdparty/webkit/WebCore/svg/SVGSymbolElement.h | 17 +- src/3rdparty/webkit/WebCore/svg/SVGTRefElement.cpp | 1 + src/3rdparty/webkit/WebCore/svg/SVGTRefElement.h | 8 +- .../webkit/WebCore/svg/SVGTextContentElement.cpp | 1 + .../webkit/WebCore/svg/SVGTextContentElement.h | 10 +- .../webkit/WebCore/svg/SVGTextPathElement.cpp | 1 + .../webkit/WebCore/svg/SVGTextPathElement.h | 8 +- .../webkit/WebCore/svg/SVGURIReference.cpp | 1 - src/3rdparty/webkit/WebCore/svg/SVGURIReference.h | 8 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.cpp | 10 +- src/3rdparty/webkit/WebCore/svg/SVGUseElement.h | 13 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.cpp | 5 +- src/3rdparty/webkit/WebCore/svg/SVGViewElement.h | 14 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.cpp | 17 +- src/3rdparty/webkit/WebCore/svg/SVGViewSpec.h | 11 +- .../svg/SynchronizablePropertyController.cpp | 163 + .../WebCore/svg/SynchronizablePropertyController.h | 122 + .../webkit/WebCore/svg/graphics/SVGImage.cpp | 7 +- .../WebCore/svg/graphics/SVGResourceFilter.cpp | 38 +- .../WebCore/svg/graphics/SVGResourceFilter.h | 27 +- .../WebCore/svg/graphics/filters/SVGFEFlood.cpp | 7 +- .../WebCore/svg/graphics/filters/SVGFEFlood.h | 5 +- .../svg/graphics/filters/SVGFEGaussianBlur.cpp | 82 - .../svg/graphics/filters/SVGFEGaussianBlur.h | 58 - .../svg/graphics/filters/SVGFEMorphology.cpp | 8 +- .../WebCore/svg/graphics/filters/SVGFEMorphology.h | 6 +- .../WebCore/svg/graphics/filters/SVGFilter.cpp | 24 +- .../WebCore/svg/graphics/filters/SVGFilter.h | 5 +- src/3rdparty/webkit/WebCore/svg/svgtags.in | 2 - .../webkit/WebCore/websockets/WebSocket.cpp | 18 +- src/3rdparty/webkit/WebCore/websockets/WebSocket.h | 4 + .../webkit/WebCore/websockets/WebSocket.idl | 16 +- .../webkit/WebCore/wml/WMLImageElement.cpp | 5 +- .../WebCore/workers/DedicatedWorkerContext.cpp | 6 +- .../WebCore/workers/DedicatedWorkerContext.h | 6 +- .../WebCore/workers/DedicatedWorkerContext.idl | 2 +- .../workers/DefaultSharedWorkerRepository.cpp | 22 +- .../WebCore/workers/SharedWorkerRepository.h | 3 + .../webkit/WebCore/workers/SharedWorkerThread.cpp | 2 +- src/3rdparty/webkit/WebCore/workers/Worker.cpp | 6 +- src/3rdparty/webkit/WebCore/workers/Worker.h | 6 +- src/3rdparty/webkit/WebCore/workers/Worker.idl | 4 +- .../webkit/WebCore/workers/WorkerContextProxy.h | 2 +- .../WebCore/workers/WorkerMessagingProxy.cpp | 24 +- .../webkit/WebCore/workers/WorkerMessagingProxy.h | 4 +- .../webkit/WebCore/workers/WorkerObjectProxy.h | 2 +- .../webkit/WebCore/workers/WorkerRunLoop.cpp | 4 +- .../webkit/WebCore/workers/WorkerThread.cpp | 4 +- src/3rdparty/webkit/WebKit.pri | 5 +- src/3rdparty/webkit/WebKit/ChangeLog | 133 + .../WebKit/mac/Configurations/Version.xcconfig | 2 +- .../webkit/WebKit/qt/Api/qgraphicswebview.cpp | 78 +- .../webkit/WebKit/qt/Api/qgraphicswebview.h | 3 +- src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 39 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 6 + src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 42 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 83 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h | 12 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 70 +- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 6 + src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 32 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 650 ++ .../webkit/WebKit/qt/Plugins/ICOHandler.cpp | 460 - src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.h | 52 - src/3rdparty/webkit/WebKit/qt/Plugins/Plugins.pro | 14 - .../WebKit/qt/WebCoreSupport/DragClientQt.cpp | 2 + .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 93 +- .../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp | 3 - .../qgraphicswebview/tst_qgraphicswebview.cpp | 76 + .../webkit/WebKit/qt/tests/qwebelement/image.png | Bin 0 -> 14743 bytes .../WebKit/qt/tests/qwebelement/qwebelement.qrc | 1 + .../qt/tests/qwebelement/tst_qwebelement.cpp | 75 + .../webkit/WebKit/qt/tests/qwebframe/qwebframe.pro | 1 + .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 24 + .../webkit/WebKit/qt/tests/qwebpage/qwebpage.pro | 1 + .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 214 +- .../webkit/WebKit/qt/tests/qwebview/qwebview.pro | 1 + .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 45 + .../webkit/WebKit/qt/tests/resources/test.swf | Bin 0 -> 10085 bytes 1274 files changed, 34097 insertions(+), 12040 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocatorSymbian.cpp delete mode 100644 src/3rdparty/webkit/JavaScriptCore/jsc.pro create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/ExceptionHelpers.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/JSCell.h create mode 100644 src/3rdparty/webkit/WebCore/ForwardingHeaders/runtime/StructureChain.h create mode 100644 src/3rdparty/webkit/WebCore/WebCore.3DRendering.exp create mode 100644 src/3rdparty/webkit/WebCore/WebCore.Video.exp create mode 100644 src/3rdparty/webkit/WebCore/bindings/ScriptControllerBase.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSCallbackData.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSExceptionBase.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/JSExceptionBase.h create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.cpp create mode 100644 src/3rdparty/webkit/WebCore/bindings/js/SerializedScriptValue.h delete mode 100644 src/3rdparty/webkit/WebCore/css/mediaControlsQT.css create mode 100644 src/3rdparty/webkit/WebCore/css/mediaControlsQt.css create mode 100644 src/3rdparty/webkit/WebCore/css/mediaControlsQuickTime.css delete mode 100644 src/3rdparty/webkit/WebCore/css/qt/mediaControls-extras.css create mode 100644 src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h create mode 100644 src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl create mode 100644 src/3rdparty/webkit/WebCore/generated/JSBeforeLoadEvent.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSBeforeLoadEvent.h create mode 100644 src/3rdparty/webkit/WebCore/generated/JSSVGFEMorphologyElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/generated/JSSVGFEMorphologyElement.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.h create mode 100644 src/3rdparty/webkit/WebCore/html/canvas/CanvasActiveInfo.idl create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/TestController.js create mode 100644 src/3rdparty/webkit/WebCore/inspector/front-end/inspectorSyntaxHighlight.css create mode 100644 src/3rdparty/webkit/WebCore/loader/HistoryController.cpp create mode 100644 src/3rdparty/webkit/WebCore/loader/HistoryController.h create mode 100644 src/3rdparty/webkit/WebCore/loader/PolicyCallback.cpp create mode 100644 src/3rdparty/webkit/WebCore/loader/PolicyCallback.h create mode 100644 src/3rdparty/webkit/WebCore/loader/PolicyChecker.cpp create mode 100644 src/3rdparty/webkit/WebCore/loader/PolicyChecker.h create mode 100644 src/3rdparty/webkit/WebCore/loader/RedirectScheduler.cpp create mode 100644 src/3rdparty/webkit/WebCore/loader/RedirectScheduler.h create mode 100644 src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.cpp create mode 100644 src/3rdparty/webkit/WebCore/loader/ResourceLoadNotifier.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/TextRenderingMode.h create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/filters/FEGaussianBlur.h delete mode 100644 src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageSourceQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/PluginContainerSymbian.h create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/PluginDatabaseSymbian.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/PluginPackageSymbian.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp create mode 100644 src/3rdparty/webkit/WebCore/plugins/symbian/npinterface.h create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.cpp create mode 100644 src/3rdparty/webkit/WebCore/rendering/RenderMediaControlsChromium.h create mode 100644 src/3rdparty/webkit/WebCore/storage/StorageEventDispatcher.cpp create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.cpp create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.h create mode 100644 src/3rdparty/webkit/WebCore/svg/SVGFEMorphologyElement.idl create mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.cpp create mode 100644 src/3rdparty/webkit/WebCore/svg/SynchronizablePropertyController.h delete mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.cpp delete mode 100644 src/3rdparty/webkit/WebCore/svg/graphics/filters/SVGFEGaussianBlur.h delete mode 100644 src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp delete mode 100644 src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.h delete mode 100644 src/3rdparty/webkit/WebKit/qt/Plugins/Plugins.pro create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png create mode 100644 src/3rdparty/webkit/WebKit/qt/tests/resources/test.swf diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index e2c1ef5..fb7dddf 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,114 @@ +2009-10-18 Jan Michael Alonzo + + Reviewed by Holger Freyther. + + [GTK] Add MathML to the build system + https://bugs.webkit.org/show_bug.cgi?id=30487 + + Add --enable-mathml to configure. + + * configure.ac: + +2009-10-15 Jan Michael Alonzo + + Reviewed by Xan Lopez. + + [GTK] marshal stamp files are not cleaned after a distclean + https://bugs.webkit.org/show_bug.cgi?id=30156 + + Add the stamp files directly to cleanfiles. Also rearrange the + variable declarations so we don't miss any files that need to be + cleaned up during the clean targets. + + * GNUmakefile.am: + +2009-10-15 Gustavo Noronha Silva + + Unreviewed. Help text fix - Web Sockets default is no, not yes. + + * configure.ac: + +2009-10-12 Jan Michael Alonzo + + Rubberstamped by Eric Seidel. + + [Gtk] Fix icu CFLAG for Darwin + https://bugs.webkit.org/show_bug.cgi?id=29517 + + Don't escape the srcdir variable. Also use $host instead of the + os_foo variables. + + * autotools/webkit.m4: + +2009-10-12 Jan Michael Alonzo + + Reviewed by Gustavo Noronha. + + [Gtk] Use the SQLite3 headers from WebKitLibraries if sqlite3 is undetected + https://bugs.webkit.org/show_bug.cgi?id=29518 + + * configure.ac: + +2009-10-05 Zoltan Horvath + + Reviewed by Simon Hausmann. + + [Qt] Disable TCmalloc for Windows port at the present, because MinGW + hasn't got built-in pthread library. + + * WebKit.pri: + +2009-10-02 Prasanth Ullattil + + Reviewed by Simon Hausmann. + + Disable a few more harmless MSVC warnings. + + * WebKit.pri: + +2009-10-01 Laszlo Gombos + + Unreviewed, build fix. + + [Qt] Symbian build break after r48976. + unix is set for Symbian in the Qt build system. + + * WebKit.pri: + +2009-10-01 Zoltan Horvath + + Reviewed by Simon Hausmann. + + [Qt] Enable TCmalloc for the Linux, Mac and Windows Qt-port + https://bugs.webkit.org/show_bug.cgi?id=27029 + + Remove USE_SYSTEM_MALLOC for Linux, Mac and Windows Qt-port from WebKit.pri, + so these Qt-ports will use TCmalloc as other ports. + + * WebKit.pri: + +2009-10-01 Martin Robinson + + Reviewed by Xan Lopez. + + [GTK] GtkIMContext filtering interferes with DOM key events + https://bugs.webkit.org/show_bug.cgi?id=28733 + + Add new key event test ensuring that IME keypresses are handled. + + * GNUmakefile.am: + +2009-10-01 Philippe Normand + + Reviewed by Xan Lopez. + + [GTK] data: uri support in media player + https://bugs.webkit.org/show_bug.cgi?id=29842 + + Check presence of gstreamer-pbutils-0.10. + + * configure.ac: + 2009-09-26 David Kilzer GTK BUILD FIX: add ENABLE_ORIENTATION_EVENTS support to configure.ac diff --git a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h index b6d1532..b9167a8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/APICast.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/APICast.h @@ -27,6 +27,7 @@ #define APICast_h #include "JSAPIValueWrapper.h" +#include "JSGlobalObject.h" #include "JSValue.h" #include #include @@ -118,6 +119,7 @@ inline JSContextRef toRef(JSC::ExecState* e) inline JSGlobalContextRef toGlobalRef(JSC::ExecState* e) { + ASSERT(e == e->lexicalGlobalObject()->globalExec()); return reinterpret_cast(e); } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h index 202b119..c4bd7ad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackConstructor.h @@ -41,9 +41,12 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark | HasDefaultGetPropertyNames)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } +protected: + static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags; + private: virtual ConstructType getConstructData(ConstructData&); virtual const ClassInfo* classInfo() const { return &info; } diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h index 3a17fa2..0cf25c4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackFunction.h @@ -41,7 +41,7 @@ public: // refactor the code so this override isn't necessary static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } private: diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h index 86f2f32..d19890a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSCallbackObject.h @@ -50,9 +50,12 @@ public: static PassRefPtr createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | OverridesHasInstance)); + return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); } +protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | Base::StructureFlags; + private: virtual UString className() const; diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp index c358a84..e6626b7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRef.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "JSContextRef.h" +#include "JSContextRefPrivate.h" #include "APICast.h" #include "InitializeThreading.h" @@ -152,3 +153,12 @@ JSContextGroupRef JSContextGetGroup(JSContextRef ctx) ExecState* exec = toJS(ctx); return toRef(&exec->globalData()); } + +JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) +{ + ExecState* exec = toJS(ctx); + exec->globalData().heap.registerThread(); + JSLock lock(exec); + + return toGlobalRef(exec->lexicalGlobalObject()->globalExec()); +} diff --git a/src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h new file mode 100644 index 0000000..ff014ec --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/API/JSContextRefPrivate.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 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 JSContextRefPrivate_h +#define JSContextRefPrivate_h + +#include +#include +#include + +#ifndef __cplusplus +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! +@function +@abstract Gets the global context of a JavaScript execution context. +@param ctx The JSContext whose global context you want to get. +@result ctx's global context. +*/ +JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* JSContextRefPrivate_h */ diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 05f90b9..8d6c2df 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,17 +1,1180 @@ +2009-10-19 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Tightened up some put_by_id_transition code generation. + https://bugs.webkit.org/show_bug.cgi?id=30539 + + * jit/JIT.h: + * jit/JITPropertyAccess.cpp: + (JSC::JIT::testPrototype): + (JSC::JIT::privateCompilePutByIdTransition): No need to do object type + checks or read Structures and prototypes from objects: they're all known + constants at compile time. + +2009-10-19 Geoffrey Garen + + Reviewed by Sam Weinig. + + Added a private API for getting a global context from a context, for + clients who want to preserve a context for a later callback. + + * API/APICast.h: + (toGlobalRef): Added an ASSERT, since this function is used more often + than before. + + * API/JSContextRef.cpp: + * API/JSContextRefPrivate.h: Added. The new API. + + * API/tests/testapi.c: + (print_callAsFunction): + (main): Test the new API. + + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: Build and export the new API. + +2009-10-17 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Tightened up some instanceof code generation. + https://bugs.webkit.org/show_bug.cgi?id=30488 + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_instanceof): + (JSC::JIT::emitSlow_op_instanceof): No need to do object type checks - + cell type checks and ImplementsDefaultHasIntance checks implicitly + supersede object type checks. + +2009-10-18 Kwang Yul Seo + + Reviewed by Darin Adler. + + Use _stricmp and _strnicmp instead of deprecated stricmp and strnicmp. + https://bugs.webkit.org/show_bug.cgi?id=30474 + + stricmp and strnicmp are deprecated beginning in Visual + C++ 2005. Use _stricmp and _strnicmp instead in StringExtras.h. + + * wtf/StringExtras.h: + (strncasecmp): + (strcasecmp): + +2009-10-16 Geoffrey Garen + + Build fix: apparently we shouldn't export those symbols? + + * JavaScriptCore.exp: + +2009-10-16 Geoffrey Garen + + Build fix: export some symbols. + + * JavaScriptCore.exp: + +2009-10-16 Oliver Hunt + + Reviewed by Gavin Barraclough. + + structure typeinfo flags should be inherited. + https://bugs.webkit.org/show_bug.cgi?id=30468 + + Add StructureFlag constant to the various JSC classes and use + it for the TypeInfo construction. This allows us to simply + accumulate flags by basing each classes StructureInfo on its parents. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSByteArray.h: + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::createStructure): + * runtime/JSNotAnObject.h: + (JSC::JSNotAnObject::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + +2009-10-16 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fast for-in enumeration: Cache JSPropertyNameIterator; cache JSStrings + in JSPropertyNameIterator; inline more code. + + 1.024x as fast on SunSpider (fasta: 1.43x as fast). + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + * bytecode/Opcode.h: + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitGetPropertyNames): + (JSC::BytecodeGenerator::emitNextPropertyName): + * bytecompiler/BytecodeGenerator.h: Added a few extra operands to + op_get_pnames and op_next_pname so that we can track iteration state + in the register file instead of in the JSPropertyNameIterator. (To be + cacheable, the JSPropertyNameIterator must be stateless.) + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::tryCachePutByID): + (JSC::Interpreter::tryCacheGetByID): Updated for rename to + "normalizePrototypeChain" and removal of "isCacheable". + + (JSC::Interpreter::privateExecute): Updated for in-RegisterFile + iteration state tracking. + + * jit/JIT.cpp: + (JSC::JIT::privateCompileMainPass): + * jit/JIT.h: + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_get_pnames): Updated for in-RegisterFile + iteration state tracking. + + (JSC::JIT::emit_op_next_pname): Inlined code generation for op_next_pname. + + * jit/JITStubs.cpp: + (JSC::JITThunks::tryCachePutByID): + (JSC::JITThunks::tryCacheGetByID): Updated for rename to + "normalizePrototypeChain" and removal of "isCacheable". + + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): Added has_property and to_object stubs. Removed op_next_pname + stub, since has_property is all we need anymore. + + * parser/Nodes.cpp: + (JSC::ForInNode::emitBytecode): Updated for in-RegisterFile + iteration state tracking. + + * runtime/JSCell.h: + * runtime/JSObject.cpp: + (JSC::JSObject::getPropertyNames): Don't do caching at this layer + anymore, since we don't create a JSPropertyNameIterator at this layer. + + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::create): Do do caching at this layer. + (JSC::JSPropertyNameIterator::get): Updated for in-RegisterFile + iteration state tracking. + (JSC::JSPropertyNameIterator::markChildren): Mark our JSStrings. + + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::size): + (JSC::JSPropertyNameIterator::setCachedStructure): + (JSC::JSPropertyNameIterator::cachedStructure): + (JSC::JSPropertyNameIterator::setCachedPrototypeChain): + (JSC::JSPropertyNameIterator::cachedPrototypeChain): + (JSC::JSPropertyNameIterator::JSPropertyNameIterator): + (JSC::Structure::setEnumerationCache): Don't store iteration state in + a JSPropertyNameIterator. Do cache a JSPropertyNameIterator in a + Structure. + + * runtime/JSValue.h: + (JSC::asCell): + * runtime/MarkStack.h: Make those mischievous #include gods happy. + + * runtime/ObjectConstructor.cpp: + + * runtime/Operations.h: + (JSC::normalizePrototypeChain): Renamed countPrototypeChainEntriesAndCheckForProxies + to normalizePrototypeChain, since it changes dictionary prototypes to + non-dictionary objects. + + * runtime/PropertyNameArray.cpp: + (JSC::PropertyNameArray::add): + * runtime/PropertyNameArray.h: + (JSC::PropertyNameArrayData::PropertyNameArrayData): + (JSC::PropertyNameArray::data): + (JSC::PropertyNameArray::size): + (JSC::PropertyNameArray::begin): + (JSC::PropertyNameArray::end): Simplified some code here to help with + current and future refactoring. + + * runtime/Protect.h: + * runtime/Structure.cpp: + (JSC::Structure::~Structure): + (JSC::Structure::addPropertyWithoutTransition): + (JSC::Structure::removePropertyWithoutTransition): No need to clear + the enumeration cache with adding / removing properties without + transition. It is an error to add / remove properties without transition + once an object has been observed, and we can ASSERT to catch that. + + * runtime/Structure.h: + (JSC::Structure::enumerationCache): Changed the enumeration cache to + hold a JSPropertyNameIterator. + + * runtime/StructureChain.cpp: + * runtime/StructureChain.h: + (JSC::StructureChain::head): Removed StructureChain::isCacheable because + it was wrong-headed in two ways: (1) It gave up when a prototype was a + dictionary, but instead we want un-dictionary heavily accessed + prototypes; (2) It folded a test for hasDefaultGetPropertyNames() into + a generic test for "cacheable-ness", but hasDefaultGetPropertyNames() + is only releavant to for-in caching. + +2009-10-16 Steve Falkenburg + + Reviewed by Adam Roben. + + Add a Debug_All configuration to build entire stack as debug. + Change Debug_Internal to: + - stop using _debug suffix for all WebKit/Safari binaries + - not use _debug as a DLL naming suffix + - use non-debug C runtime lib. + + * JavaScriptCore.vcproj/JavaScriptCore.make: Debug build in makefile should build Debug_All. + * JavaScriptCore.vcproj/JavaScriptCore.sln: Add Debug_All configuration. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add Debug_All configuration. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: Renamed single configuration from "Release" to "all". + * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Add Debug_All configuration. + * JavaScriptCore.vcproj/WTF/WTF.vcproj: Add Debug_All configuration. + * JavaScriptCore.vcproj/jsc/jsc.vcproj: Add Debug_All configuration. + * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add Debug_All configuration. + +2009-10-16 Oliver Hunt + + Reviewed by Gavin Barraclough. + + Make typeinfo flags default to false + https://bugs.webkit.org/show_bug.cgi?id=30372 + + Last part -- replace HasDefaultGetPropertyNames with OverridesGetPropertyNames + flag. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::createStructure): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::createStructure): + * runtime/JSNotAnObject.h: + (JSC::JSNotAnObject::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.cpp: + (JSC::JSObject::getPropertyNames): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::overridesGetPropertyNames): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + * runtime/StructureChain.cpp: + (JSC::StructureChain::isCacheable): + +2009-10-16 Kevin Ollivier + + wxMSW build fix, we can't use the simple hash there because the PlatformModuleVersion + structure differs. + + * wtf/Platform.h: + +2009-10-16 Laszlo Gombos + + Reviewed by Simon Hausmann. + + [Qt] Implement ExecutableAllocator for Symbian + https://bugs.webkit.org/show_bug.cgi?id=29946 + + Tested with YARR JIT enabled for Symbian; + This patch does not (yet) enable YARR JIT by default. + + * JavaScriptCore.pri: + * jit/ExecutableAllocator.h: + * jit/ExecutableAllocatorSymbian.cpp: Added. + (JSC::ExecutableAllocator::intializePageSize): + (JSC::ExecutablePool::systemAlloc): + (JSC::ExecutablePool::systemRelease): + +2009-10-15 Oliver Hunt + + Reviewed by Darin Adler. + + Make typeinfo flags default to false + https://bugs.webkit.org/show_bug.cgi?id=30372 + + Part 2 -- Reverse the TypeInfo HasDefaultMark flag to OverridesMarkChildren, etc + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GetterSetter.h: + (JSC::GetterSetter::createStructure): + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::createStructure): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + (JSC::MarkStack::markChildren): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::createStructure): + * runtime/JSNotAnObject.h: + (JSC::JSNotAnObject::createStructure): + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + * runtime/JSPropertyNameIterator.h: + (JSC::JSPropertyNameIterator::createStructure): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSString.h: + (JSC::JSString::createStructure): + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::overridesMarkChildren): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + +2009-10-14 Oliver Hunt + + Reviewed by Geoff Garen. + + Make typeinfo flags default to false + https://bugs.webkit.org/show_bug.cgi?id=30372 + + Part 1. Reverse the HasStandardGetOwnPropertySlot flag. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * API/JSCallbackObject.h: + (JSC::JSCallbackObject::createStructure): + * debugger/DebuggerActivation.h: + (JSC::DebuggerActivation::createStructure): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * runtime/Arguments.h: + (JSC::Arguments::createStructure): + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/DatePrototype.h: + (JSC::DatePrototype::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/GlobalEvalFunction.h: + (JSC::GlobalEvalFunction::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSActivation.h: + (JSC::JSActivation::createStructure): + * runtime/JSArray.h: + (JSC::JSArray::createStructure): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSFunction.h: + (JSC::JSFunction::createStructure): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::createStructure): + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.h: + (JSC::JSObject::createStructure): + (JSC::JSCell::fastGetOwnPropertySlot): + * runtime/JSStaticScopeObject.h: + (JSC::JSStaticScopeObject::createStructure): + * runtime/JSString.h: + (JSC::JSString::createStructure): + * runtime/JSTypeInfo.h: + (JSC::TypeInfo::overridesGetOwnPropertySlot): + * runtime/JSVariableObject.h: + (JSC::JSVariableObject::createStructure): + * runtime/JSWrapperObject.h: + (JSC::JSWrapperObject::createStructure): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObject.h: + (JSC::StringObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + +2009-10-14 Kevin Ollivier +2009-10-14 Darin Adler + + Additions so fix for https://bugs.webkit.org/show_bug.cgi?id=18994 + can build on Windows. + + * wtf/MathExtras.h: Added llround and llroundf for Windows. + +2009-10-14 Kevin Ollivier + + wx build fix. Set ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH for plugins while we're still building stubs. + + * wtf/Platform.h: + +2009-10-13 Laszlo Gombos + + Reviewed by Simon Hausmann. + + Refactor ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH + https://bugs.webkit.org/show_bug.cgi?id=30278 + + Move the definition of ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH + from the make system into common code. + + * wtf/Platform.h: + +2009-10-13 Laszlo Gombos + + Reviewed by Darin Adler. + + ARM compiler does not understand reinterpret_cast + https://bugs.webkit.org/show_bug.cgi?id=29034 + + Change reinterpret_cast to regular C style (void*) cast + for the ARM RVCT compiler. + + * assembler/MacroAssemblerCodeRef.h: + (JSC::FunctionPtr::FunctionPtr): + * jit/JITOpcodes.cpp: Cast to FunctionPtr first + instead of directly casting to reinterpret_cast + * jit/JITStubCall.h: Ditto + change the type of m_stub + from void* to FunctionPtr. + (JSC::JITStubCall::JITStubCall): + (JSC::JITStubCall::call): + * jit/JITStubs.cpp: Ditto. + (JSC::DEFINE_STUB_FUNCTION(EncodedJSValue, op_throw)): + +2009-10-11 Oliver Hunt + + Re-enable the JIT. + + * wtf/Platform.h: + +2009-10-10 Oliver Hunt + + Reviewed by Maciej Stachowiak. + + Support for String.trim(), String.trimLeft() and String.trimRight() methods + https://bugs.webkit.org/show_bug.cgi?id=26590 + + Implement trim, trimLeft, and trimRight + + * runtime/StringPrototype.cpp: + (JSC::isTrimWhitespace): + Our normal string whitespace function does not include U+200B which + is needed for compatibility with mozilla's implementation of trim. + U+200B does not appear to be expected according to spec, however I am + choosing to be lax, and match mozilla behavior so have added this + exception. + (JSC::trimString): + +2009-10-09 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Eliminated some legacy bytecode weirdness. + + Use vPC[x] subscripting instead of ++vPC to access instruction operands. + This is simpler, and often more efficient. + + To support this, and to remove use of hard-coded offsets in bytecode and + JIT code generation and dumping, calculate jump offsets from the beginning + of an instruction, rather than the middle or end. + + Also, use OPCODE_LENGTH instead of hard-coded constants for the sizes of + opcodes. + + SunSpider reports no change in JIT mode, and a 1.01x speedup in Interpreter + mode. + + * bytecode/CodeBlock.cpp: + (JSC::printConditionalJump): + (JSC::CodeBlock::dump): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitJump): + (JSC::BytecodeGenerator::emitJumpIfTrue): + (JSC::BytecodeGenerator::emitJumpIfFalse): + (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): + (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): + (JSC::BytecodeGenerator::emitComplexJumpScopes): + (JSC::BytecodeGenerator::emitJumpScopes): + (JSC::BytecodeGenerator::emitNextPropertyName): + (JSC::BytecodeGenerator::emitCatch): + (JSC::BytecodeGenerator::emitJumpSubroutine): + (JSC::prepareJumpTableForImmediateSwitch): + (JSC::prepareJumpTableForCharacterSwitch): + (JSC::prepareJumpTableForStringSwitch): + (JSC::BytecodeGenerator::endSwitch): + * bytecompiler/Label.h: + (JSC::Label::setLocation): + (JSC::Label::bind): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::resolve): + (JSC::Interpreter::resolveSkip): + (JSC::Interpreter::resolveGlobal): + (JSC::Interpreter::resolveBase): + (JSC::Interpreter::resolveBaseAndProperty): + (JSC::Interpreter::createExceptionScope): + (JSC::Interpreter::privateExecute): + * interpreter/Interpreter.h: + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + * jit/JITArithmetic.cpp: + (JSC::JIT::emit_op_jnless): + (JSC::JIT::emitSlow_op_jnless): + (JSC::JIT::emit_op_jnlesseq): + (JSC::JIT::emitSlow_op_jnlesseq): + (JSC::JIT::emitBinaryDoubleOp): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_jmp): + (JSC::JIT::emit_op_loop): + (JSC::JIT::emit_op_loop_if_less): + (JSC::JIT::emitSlow_op_loop_if_less): + (JSC::JIT::emit_op_loop_if_lesseq): + (JSC::JIT::emitSlow_op_loop_if_lesseq): + (JSC::JIT::emit_op_loop_if_true): + (JSC::JIT::emitSlow_op_loop_if_true): + (JSC::JIT::emit_op_jfalse): + (JSC::JIT::emitSlow_op_jfalse): + (JSC::JIT::emit_op_jtrue): + (JSC::JIT::emitSlow_op_jtrue): + (JSC::JIT::emit_op_jeq_null): + (JSC::JIT::emit_op_jneq_null): + (JSC::JIT::emit_op_jneq_ptr): + (JSC::JIT::emit_op_jsr): + (JSC::JIT::emit_op_next_pname): + (JSC::JIT::emit_op_jmp_scopes): + +2009-10-09 Geoffrey Garen + + Reviewed by Sam Weinig. + + Migrated some code that didn't belong out of Structure. + + SunSpider says maybe 1.03x faster. + + * runtime/JSCell.h: Nixed Structure::markAggregate, and made marking of + a Structure's prototype the direct responsility of the object using it. + (Giving Structure a mark function was misleading because it implied that + all live structures get marked during GC, when they don't.) + + * runtime/JSGlobalObject.cpp: + (JSC::markIfNeeded): + (JSC::JSGlobalObject::markChildren): Added code to mark prototypes stored + on the global object. Maybe this wasn't necessary, but now we don't have + to wonder. + + * runtime/JSObject.cpp: + (JSC::JSObject::getPropertyNames): + (JSC::JSObject::getOwnPropertyNames): + (JSC::JSObject::getEnumerableNamesFromClassInfoTable): + * runtime/JSObject.h: + (JSC::JSObject::markChildrenDirect): + * runtime/PropertyNameArray.h: + * runtime/Structure.cpp: + * runtime/Structure.h: + (JSC::Structure::setEnumerationCache): + (JSC::Structure::enumerationCache): Moved property name gathering code + from Structure to JSObject because having a Structure iterate its JSObject + was a layering violation. A JSObject is implemented using a Structure; not + the other way around. + +2009-10-09 Mark Rowe + + Attempt to fix the GTK release build. + + * GNUmakefile.am: Include Grammar.cpp in release builds now that + AllInOneFile.cpp is gone. + +2009-10-09 Gabor Loki + + Rubber-stamped by Eric Seidel. + + Add ARM JIT support for Gtk port (disabled by default) + https://bugs.webkit.org/show_bug.cgi?id=30228 + + * GNUmakefile.am: + +2009-10-08 Geoffrey Garen + + Tiger build fix: added a few more variable initializations. + + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncSearch): + +2009-10-08 Geoffrey Garen + + Qt build fix: added missing #include. + + * jsc.cpp: + +2009-10-08 Geoffrey Garen + + Tiger build fix: initialize variable whose initialization the compiler + can't otherwise figure out. + + * runtime/RegExpObject.cpp: + (JSC::RegExpObject::match): + +2009-10-08 Geoffrey Garen + + Windows build fix: updated exports. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-10-08 Geoffrey Garen + + Tiger build fix: fixed file name case. + + * JavaScriptCore.xcodeproj/project.pbxproj: + +2009-10-08 Geoffrey Garen + + Reviewed by Maciej Stachowiak. + + At long last, I pronounce the death of AllInOneFile.cpp. + + SunSpider reports a 1.01x speedup. + + * AllInOneFile.cpp: Removed. + * GNUmakefile.am: + * JavaScriptCore.exp: + * JavaScriptCore.gypi: + * JavaScriptCore.xcodeproj/project.pbxproj: Added missing project files + to compilation stages. + + * parser/Grammar.y: + * parser/Lexer.cpp: + * parser/Lexer.h: + (JSC::jscyylex): + * runtime/ArrayConstructor.cpp: + (JSC::constructArrayWithSizeQuirk): + * runtime/Collector.h: + * runtime/JSCell.cpp: + (JSC::JSCell::operator new): + * runtime/JSCell.h: + (JSC::JSCell::operator new): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::operator new): + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::operator new): + * runtime/JSString.cpp: + * runtime/JSString.h: + (JSC::jsString): + (JSC::jsSubstring): + (JSC::jsOwnedString): + * runtime/RegExpConstructor.cpp: + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructorPrivate::RegExpConstructorPrivate): + (JSC::RegExpConstructorPrivate::lastOvector): + (JSC::RegExpConstructorPrivate::tempOvector): + (JSC::RegExpConstructorPrivate::changeLastOvector): + (JSC::RegExpConstructor::performMatch): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncMatch): + * yarr/RegexJIT.cpp: + * yarr/RegexJIT.h: + (JSC::Yarr::executeRegex): Inlined a few things that Shark said + were hot, on the presumption that AllInOneFile.cpp used to inline them + automatically. + +2009-10-08 Zoltan Herczeg + + Reviewed by Gavin Barraclough. + + Fix for JIT'ed op_call instructions (evals, constructs, etc.) + when !ENABLE(JIT_OPTIMIZE_CALL) && USE(JSVALUE32_64) + + https://bugs.webkit.org/show_bug.cgi?id=30201 + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + +2009-10-07 Geoffrey Garen + + Windows build fix: removed no longer exported symbol. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-10-07 Geoffrey Garen + + Reviewed by Oliver Hunt. + + Fixed Database code takes JSLock on secondary + thread, permanently slowing down JavaScript + + Removed the optional lock from Heap::protect, Heap::unprotect, and friends, + since WebCore no longer uses it. + + * JavaScriptCore.exp: + * runtime/Collector.cpp: + (JSC::Heap::protect): + (JSC::Heap::unprotect): + (JSC::Heap::markProtectedObjects): + (JSC::Heap::protectedGlobalObjectCount): + (JSC::Heap::protectedObjectCount): + (JSC::Heap::protectedObjectTypeCounts): + * runtime/Collector.h: + +2009-10-07 Zoltan Horvath + + Reviewed by Darin Adler. + + Allow custom memory allocation control for JavaScriptCore's IdentifierArena + https://bugs.webkit.org/show_bug.cgi?id=30158 + + Inherits IdentifierArena class from FastAllocBase because it has been + instantiated by 'new' in JavaScriptCore/parser/ParserArena.cpp:36. + + * parser/ParserArena.h: + +2009-10-07 Adam Roben + + Export DateInstance::info in a way that works on Windows + + Fixes + fast/dom/Window/window-postmessage-clone.html fails on Windows + + Reviewed by Anders Carlsson. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + Removed the export of DateInstance::info from here. + + * runtime/DateInstance.h: Use JS_EXPORTDATA to export + DateInstance::info, which is the required way of exporting data on + Windows. + +2009-10-07 Jørgen Lind + + Reviewed by Simon Hausmann. + + When enabling or disabling the JIT through .qmake.cache, make sure + to also toggle ENABLE_YARR_JIT. + + * JavaScriptCore.pri: + +2009-10-06 Priit Laes + + Reviewed by Gavin Barraclough. + + Linking fails with "relocation R_X86_64_PC32 against symbol + `cti_vm_throw'" + https://bugs.webkit.org/show_bug.cgi?id=28422 + + * jit/JITStubs.cpp: + Mark cti_vm_throw symbol as PLT-indirect symbol, so it doesn't end up + in text segment causing relocation errors on amd64 architecture. + Introduced new define SYMBOL_STRING_RELOCATION for such symbols. + +2009-10-06 Oliver Hunt + + Windows linking fix + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-10-06 Oliver Hunt + + Reviewed by NOBODY (build fix). + + Windows build fix. + + * runtime/DateInstance.cpp: + +2009-10-05 Oliver Hunt + + Reviewed by Gavin Barraclough. + + It should be possible to post (clone) built-in JS objects to Workers + https://bugs.webkit.org/show_bug.cgi?id=22878 + + Expose helpers to throw correct exceptions during object graph walk + used for cloning and add a helper function to create Date instances + without going through the JS Date constructor function. + + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/DateInstance.cpp: + (JSC::DateInstance::DateInstance): + * runtime/DateInstance.h: + * runtime/ExceptionHelpers.cpp: + (JSC::createTypeError): + * runtime/ExceptionHelpers.h: + +2009-10-06 David Levin + + Reviewed by Oliver Hunt. + + StringImpl needs a method to get an instance for another thread which doesn't copy the underlying buffer. + https://bugs.webkit.org/show_bug.cgi?id=30095 + + * wtf/CrossThreadRefCounted.h: + Removed an unused function and assert improvement. + (WTF::CrossThreadRefCounted::isOwnedByCurrentThread): Moved out common code from asserts. + (WTF::CrossThreadRefCounted::ref): Changed assert to use the common method. + (WTF::CrossThreadRefCounted::deref): Changed assert to use the common method. + (WTF::CrossThreadRefCounted::crossThreadCopy): Since this includes a potentially + non-threadsafe operation, add an assert that the class is owned by the current thread. + +2009-10-05 Kevin Ollivier + + wx build fix. Add Symbian files to the list of excludes. + + * wscript: + +2009-10-05 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Remove precompiled header from JavaScriptCore compilation to + prevent qmake warning during autonomous compilation. + https://bugs.webkit.org/show_bug.cgi?id=30069 + + * JavaScriptCore.pro: + +2009-10-02 Geoffrey Garen + + Reviewed by Sam Weinig. + + Removed the concept of a "fast access cutoff" in arrays, because it + punished some patterns of array access too much, and made things too + complex for inlining in some cases. + + 1.3% speedup on SunSpider. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_get_by_val): + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): + (JSC::JIT::emitSlow_op_put_by_val): + * jit/JITStubs.cpp: + * jit/JITStubs.h: + (JSC::): Check m_vectorLength instead of m_fastAccessCutoff when + getting / putting from / to an array. Inline putting past the end of + the array. + + * runtime/JSArray.cpp: + (JSC::JSArray::JSArray): + (JSC::JSArray::getOwnPropertySlot): + (JSC::JSArray::getOwnPropertyDescriptor): + (JSC::JSArray::put): + (JSC::JSArray::putSlowCase): + (JSC::JSArray::deleteProperty): + (JSC::JSArray::getOwnPropertyNames): + (JSC::JSArray::increaseVectorLength): + (JSC::JSArray::setLength): + (JSC::JSArray::pop): + (JSC::JSArray::push): + (JSC::JSArray::sort): + (JSC::JSArray::fillArgList): + (JSC::JSArray::copyToRegisters): + (JSC::JSArray::compactForSorting): + (JSC::JSArray::checkConsistency): + * runtime/JSArray.h: + (JSC::JSArray::canGetIndex): + (JSC::JSArray::canSetIndex): + (JSC::JSArray::setIndex): + (JSC::JSArray::markChildrenDirect): Removed m_fastAccessCutoff, and + replaced with checks for JSValue() to detect reads and writes from / to + uninitialized parts of the array. + +2009-10-02 Jonni Rainisto + + Reviewed by Darin Adler. + + Math.random() gives too low values on Win32 when _CRT_RAND_S is not defined + https://bugs.webkit.org/show_bug.cgi?id=29956 + + * wtf/RandomNumber.cpp: + (WTF::randomNumber): Added PLATFORM(WIN_OS) to handle 15bit rand() + +2009-10-02 Geoffrey Garen + + Reviewed by Sam Weinig. + + Take one branch instead of two to test for JSValue(). + + 1.1% SunSpider speedup. + + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_to_jsnumber): + (JSC::JIT::emit_op_create_arguments): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emitSlow_op_get_by_val): + (JSC::JIT::emit_op_put_by_val): Test for the empty value tag, instead + of testing for the cell tag with a 0 payload. + + * runtime/JSValue.cpp: + (JSC::JSValue::description): Added support for dumping the new empty value, + and deleted values, in debug builds. + + * runtime/JSValue.h: + (JSC::JSValue::JSValue()): Construct JSValue() with the empty value tag. + + (JSC::JSValue::JSValue(JSCell*)): Convert null pointer to the empty value + tag, to avoid having two different c++ versions of null / empty. + + (JSC::JSValue::operator bool): Test for the empty value tag, instead + of testing for the cell tag with a 0 payload. + +2009-10-02 Steve Falkenburg + + Reviewed by Mark Rowe. + + + Safari version number shouldn't be exposed in WebKit code + + For a WebKit version of 532.3.4: + Product version is: 5.32.3.4 (was 4.0.3.0) + File version is: 5.32.3.4 (was 4.532.3.4) + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.rc: + +2009-10-02 Tor Arne Vestbø + + Rubber-stamped by Simon Hausmann. + + Fix the Qt on Mac OS X build. + + * wtf/FastMalloc.cpp: + +2009-10-02 Jørgen Lind + + Reviewed by Simon Hausmann. + + Allow enabling and disabling of the JIT through a qmake variable. + + Qt's configure may set this variable through .qmake.cache if a + commandline option is given and/or the compile test for hwcap.h + failed/succeeded. + + * JavaScriptCore.pri: + +2009-10-01 Mark Rowe + + Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger. + + * Configurations/FeatureDefines.xcconfig: + +2009-10-01 Yongjun Zhang + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=29187 + + Don't inline ~ListRefPtr() to work around winscw compiler forward declaration + bug regarding templated classes. + + The compiler bug is reported at: + https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812 + + The change will be reverted when the above bug is fixed in winscw compiler. + + * wtf/ListRefPtr.h: + (WTF::::~ListRefPtr): + +2009-10-01 Zoltan Horvath + + Reviewed by Simon Hausmann. + + [Qt] Allow custom memory allocation control for the whole JavaScriptCore + https://bugs.webkit.org/show_bug.cgi?id=27029 + + Since in JavaScriptCore almost every class which has been instantiated by operator new is + inherited from FastAllocBase (bug #20422), we disable customizing global operator new for the Qt-port + when USE_SYSTEM_MALLOC=0. + + Add #include to FastMalloc.cpp because it's used by TCMalloc_PageHeap::scavengerThread(). + (It's needed for the functionality of TCmalloc.) + + Add TCSystemAlloc.cpp to JavaScriptCore.pri if USE_SYSTEM_MALLOC is disabled. + + * JavaScriptCore.pri: + * wtf/FastMalloc.cpp: + (WTF::sleep): + * wtf/FastMalloc.h: + +2009-09-30 Gabor Loki + + Reviewed by George Staikos. + + Defines two pseudo-platforms for ARM and Thumb-2 instruction set. + https://bugs.webkit.org/show_bug.cgi?id=29122 + + Introduces WTF_PLATFORM_ARM_TRADITIONAL and WTF_PLATFORM_ARM_THUMB2 + macros on ARM platforms. The PLATFORM(ARM_THUMB2) should be used + when Thumb-2 instruction set is the required target. The + PLATFORM(ARM_TRADITIONAL) is for generic ARM instruction set. In + case where the code is common the PLATFORM(ARM) have to be used. + + Modified by George Wright to correctly work + with the RVCT-defined __TARGET_ARCH_ARM and __TARGET_ARCH_THUMB + compiler macros, as well as adding readability changes. + + * wtf/Platform.h: + +2009-09-30 Oliver Hunt + + Reviewed by Geoff Garen. + + Devirtualise array toString conversion + + Tweak the implementation of Array.prototype.toString to have a fast path + when acting on a true JSArray. + + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + 2009-09-30 Csaba Osztrogonac - Reviewed by NOBODY (OOPS!). + Reviewed by Geoffrey Garen. Buildfix for platforms using JSVALUE32. https://bugs.webkit.org/show_bug.cgi?id=29915 After http://trac.webkit.org/changeset/48905 the build broke in JSVALUE32 case. + Also removed unreachable code. * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_add): - Declaration of "OperandTypes types" moved before first use. - Typos fixed: dst modified to result, regT2 added. - - Unnecessary code removed. + - Unreachable code removed. (JSC::JIT::emitSlow_op_add): - Missing declaration of "OperandTypes types" added. diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi index 15a0c0f..4b316c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.gypi @@ -1,7 +1,6 @@ { 'variables': { 'javascriptcore_files': [ - 'AllInOneFile.cpp', 'API/APICast.h', 'API/JavaScript.h', 'API/JavaScriptCore.h', @@ -19,6 +18,7 @@ 'API/JSClassRef.h', 'API/JSContextRef.cpp', 'API/JSContextRef.h', + 'API/JSContextRefPrivate.h', 'API/JSObjectRef.cpp', 'API/JSObjectRef.h', 'API/JSProfilerPrivate.cpp', diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index 2b08980..89c483e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -137,7 +137,8 @@ SOURCES += \ interpreter/RegisterFile.cpp symbian { - SOURCES += runtime/MarkStackSymbian.cpp + SOURCES += jit/ExecutableAllocatorSymbian.cpp \ + runtime/MarkStackSymbian.cpp } else { win32-*|wince* { SOURCES += jit/ExecutableAllocatorWin.cpp \ @@ -148,6 +149,10 @@ symbian { } } +!contains(DEFINES, USE_SYSTEM_MALLOC) { + SOURCES += wtf/TCSystemAlloc.cpp +} + # AllInOneFile.cpp helps gcc analize and optimize code # Other compilers may be able to do this at link time SOURCES += \ diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index 0cd2e1a..a1affd4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -16,7 +16,6 @@ CONFIG(QTDIR_build) { include($$QT_SOURCE_TREE/src/qbase.pri) INSTALLS = DESTDIR = $$OLDDESTDIR - PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h DEFINES *= NDEBUG } diff --git a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 568260a..3681af8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/src/3rdparty/webkit/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -69,7 +69,13 @@ public: template explicit FunctionPtr(FunctionType* value) +#if COMPILER(RVCT) + // RVTC compiler needs C-style cast as it fails with the following error + // Error: #694: reinterpret_cast cannot cast away const or other type qualifiers + : m_value((void*)(value)) +#else : m_value(reinterpret_cast(value)) +#endif { ASSERT_VALID_CODE_POINTER(m_value); } diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 6bac9b9..18ca2ae 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -135,11 +135,6 @@ NEVER_INLINE static const char* debugHookName(int debugHookID) return ""; } -static int locationForOffset(const Vector::const_iterator& begin, Vector::const_iterator& it, int offset) -{ - return it - begin + offset; -} - static void printUnaryOp(int location, Vector::const_iterator& it, const char* op) { int r0 = (++it)->u.operand; @@ -156,11 +151,11 @@ static void printBinaryOp(int location, Vector::const_iterator& it, printf("[%4d] %s\t\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str()); } -static void printConditionalJump(const Vector::const_iterator& begin, Vector::const_iterator& it, int location, const char* op) +static void printConditionalJump(const Vector::const_iterator&, Vector::const_iterator& it, int location, const char* op) { int r0 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, location + offset); } static void printGetByIdOp(int location, Vector::const_iterator& it, const Vector& m_identifiers, const char* op) @@ -852,12 +847,12 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& } case op_jmp: { int offset = (++it)->u.operand; - printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset)); + printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, location + offset); break; } case op_loop: { int offset = (++it)->u.operand; - printf("[%4d] loop\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset)); + printf("[%4d] loop\t\t %d(->%d)\n", location, offset, location + offset); break; } case op_jtrue: { @@ -884,56 +879,56 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] jneq_ptr\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_jnless: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_jnlesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] jnlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_loop_if_less: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_loop_if_lesseq: { int r0 = (++it)->u.operand; int r1 = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, location + offset); break; } case op_switch_imm: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_switch_char: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_switch_string: { int tableIndex = (++it)->u.operand; int defaultTarget = (++it)->u.operand; int scrutineeRegister = (++it)->u.operand; - printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); + printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, location + defaultTarget, registerName(scrutineeRegister).c_str()); break; } case op_new_func: { @@ -1020,16 +1015,18 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& break; } case op_get_pnames: { - int r0 = (++it)->u.operand; - int r1 = (++it)->u.operand; + int r0 = it[0].u.operand; + int r1 = it[1].u.operand; printf("[%4d] get_pnames\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str()); + it += OPCODE_LENGTH(op_get_pnames) - 1; break; } case op_next_pname: { - int dest = (++it)->u.operand; - int iter = (++it)->u.operand; - int offset = (++it)->u.operand; - printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, locationForOffset(begin, it, offset)); + int dest = it[0].u.operand; + int iter = it[4].u.operand; + int offset = it[5].u.operand; + printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, location + offset); + it += OPCODE_LENGTH(op_next_pname) - 1; break; } case op_push_scope: { @@ -1051,7 +1048,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& case op_jmp_scopes: { int scopeDelta = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, locationForOffset(begin, it, offset)); + printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, location + offset); break; } case op_catch: { @@ -1074,7 +1071,7 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& case op_jsr: { int retAddrDst = (++it)->u.operand; int offset = (++it)->u.operand; - printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, locationForOffset(begin, it, offset)); + printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, location + offset); break; } case op_sret: { diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index c9196ce..8968252 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -152,8 +152,8 @@ namespace JSC { macro(op_strcat, 4) \ macro(op_to_primitive, 3) \ \ - macro(op_get_pnames, 3) \ - macro(op_next_pname, 4) \ + macro(op_get_pnames, 6) \ + macro(op_next_pname, 7) \ \ macro(op_push_scope, 2) \ macro(op_pop_scope, 1) \ diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 8951ce3..41b5c39 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -608,8 +608,9 @@ void ALWAYS_INLINE BytecodeGenerator::rewindUnaryOp() PassRefPtr