diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-24 12:56:11 (GMT) |
commit | 512d332d21860b1d08e86d6de96b80ce12d742bf (patch) | |
tree | 339a6f5962b587b198f2ed21bf9f64ac338b66eb /src/3rdparty/webkit/WebKit/qt | |
parent | cb89aab6b29fd5761f3b9d41354abcde11e103dc (diff) | |
download | Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.zip Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.gz Qt-512d332d21860b1d08e86d6de96b80ce12d742bf.tar.bz2 |
Updated WebKit from /home/joce/dev/qtwebkit3/ to qtwebkit-4.6-snapshot-24092009 ( 75c44947a340d74a9e0098a3dfffabce0c9512ef )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2009-09-24 Martin Smith <msmith@trolltech.com>
Reviewed by Simon Hausmann.
qdoc: Added \brief texts to all the since 4.6 functions.
* Api/qwebhistory.cpp:
2009-09-23 J-P Nurmi <jpnurmi@gmail.com>
Reviewed by Simon Hausmann.
Prevent QWebPage::setView() from changing the viewport size on the fly
in case the view doesn't actually change. QWebPage::setView() is
called upon every QWebGraphicsItem::hoverMoveEvent(), which forced
the viewport size to be equal to the size of the whole graphics view.
https://bugs.webkit.org/show_bug.cgi?id=29676
* Api/qwebpage.cpp:
(QWebPage::setView):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Crash fix in QWebHistory back and forward methods.
QWebHistory::back() and QWebHistory::forward() were crashing on
ASSERT in WebCore::BackForwardList. The methods should check
canGoBack() and canGoForward() at the beginning.
https://bugs.webkit.org/show_bug.cgi?id=29675
* Api/qwebhistory.cpp:
(QWebHistory::back):
(QWebHistory::forward):
2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions
In QWebHistory's methods that change item count or current item call
to QWebPage::updateNavigationActions should be executed.
QWebHistory::clear() and QWebHistory::restorState() were changed.
New helper method, QWebPagePrivate accesor, were created in
QWebHistoryPrivate class.
Two autotest were developed.
https://bugs.webkit.org/show_bug.cgi?id=29246
* Api/qwebhistory.cpp:
(QWebHistory::clear):
(QWebHistory::restoreState):
(QWebHistoryPrivate::page):
* Api/qwebhistory_p.h:
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::saveAndRestore_1):
(tst_QWebHistory::clear):
2009-09-23 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Tor Arne Vestbø.
Need to guard QX11Info include with Q_WS_X11.
That class may not be available (in QT 4.5 for Symbian, for instance).
Completes fixes in r48627 and r48604.
* Api/qwebgraphicsitem.cpp:
* Api/qwebview.cpp:
2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add default timeout while waiting for signals in QWebPage auto
tests.
https://bugs.webkit.org/show_bug.cgi?id=29637
* tests/qwebpage/tst_qwebpage.cpp:
(waitForSignal):
2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reivewed by Simon Hausmann.
Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class)
There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget()
takes a QWidget*, not a QWebPageClient*
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::screenNumber):
* Api/qwebview.cpp:
(QWebViewPrivate::screenNumber):
2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
For Qt, platformPageClient() will now return a class derived from
the QWebPageClient, so the patch adapts our Qt hooks to go though
this class and not depend on the QWebView.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::scroll):
(QWebGraphicsItemPrivate::update):
(QWebGraphicsItemPrivate::cursor):
(QWebGraphicsItemPrivate::updateCursor):
(QWebGraphicsItemPrivate::screenNumber):
(QWebGraphicsItemPrivate::winId):
(QWebGraphicsItem::event):
(QWebGraphicsItem::setPage):
* Api/qwebgraphicsitem.h:
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebViewPrivate::scroll):
(QWebViewPrivate::update):
(QWebViewPrivate::cursor):
(QWebViewPrivate::updateCursor):
(QWebViewPrivate::screenNumber):
(QWebViewPrivate::winId):
(QWebView::setPage):
(QWebView::event):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::repaint):
(WebCore::ChromeClientQt::scroll):
(WebCore::ChromeClientQt::platformPageClient):
2009-09-21 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29609
Build fix for windows when using Qt 4.5.0.
* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):
2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29345
The tests of QWebFrame did not use QTRY_VERIFY for
tests involving the event loop.
* tests/qwebframe/tst_qwebframe.cpp:
* tests/util.h: Added. Copy of tests/shared/util.h of Qt
2009-09-19 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
[Qt] Add an autotest stub for QWebGraphicsItem.
It just calls all the functions and makes sure they don't crash.
* tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added.
* tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added.
(tst_QWebGraphicsItem::qwebgraphicsitem):
* tests/tests.pro:
2009-09-18 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Eric Seidel.
Corrected the Symbian specific UID3 values to be assigned
from the "unprotected" pool that permits self-signing of
those test and demo executables. (Added new UID3 values
where they were missing for new components.)
* QGVLauncher/QGVLauncher.pro:
* QtLauncher/QtLauncher.pro:
* tests/benchmarks/loading/tst_loading.pro:
* tests/benchmarks/painting/tst_painting.pro:
* tests/qwebelement/qwebelement.pro:
* tests/qwebframe/qwebframe.pro:
* tests/qwebhistory/qwebhistory.pro:
* tests/qwebhistoryinterface/qwebhistoryinterface.pro:
* tests/qwebpage/qwebpage.pro:
* tests/qwebplugindatabase/qwebplugindatabase.pro:
* tests/qwebview/qwebview.pro:
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Make PlatformWindow return something else than PlatformWidget
https://bugs.webkit.org/show_bug.cgi?id=29085
Reflect the rename of platformWindow and it's return type.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::platformPageClient):
* WebCoreSupport/ChromeClientQt.h:
2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Add persistence support for configuration options in the
inspector.
* Api/qwebinspector.cpp:
* QtLauncher/main.cpp:
(main):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::populateSetting):
(WebCore::InspectorClientQt::storeSetting):
(WebCore::variantToSetting):
(WebCore::settingToVariant):
2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Improve documentation for Page Cache.
* Api/qwebsettings.cpp:
2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test
https://bugs.webkit.org/show_bug.cgi?id=29081
The documentation now specifies that the URL has to be a local file
or a a data-URL (with utf-8 and base64-encoded data), as these are the
only two schemes that the current code path accepts.
The auto-test has been updated to reflect this limitation.
At a later point we should concider adding API for the new way of
doing both user defined stylesheets and scripts.
* Api/qwebsettings.cpp:
* tests/qwebpage/tst_qwebpage.cpp:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt')
30 files changed, 702 insertions, 97 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp index 1e491c9..196f0b8 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp @@ -23,13 +23,17 @@ #include "qwebframe.h" #include "qwebpage.h" #include "qwebpage_p.h" +#include "QWebPageClient.h" #include <QtGui/QGraphicsScene> #include <QtGui/QGraphicsView> #include <QtGui/qapplication.h> #include <QtGui/qgraphicssceneevent.h> #include <QtGui/qstyleoption.h> +#if defined(Q_WS_X11) +#include <QX11Info> +#endif -class QWebGraphicsItemPrivate { +class QWebGraphicsItemPrivate : public QWebPageClient { public: QWebGraphicsItemPrivate(QWebGraphicsItem* parent) : q(parent) @@ -38,10 +42,17 @@ public: , progress(1.0) {} - void _q_doScroll(int dx, int dy, const QRect&); + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); + + virtual int screenNumber() const; + virtual WId winId() const; + void _q_doLoadProgress(int progress); void _q_doLoadFinished(bool success); - void _q_doUpdate(const QRect& dirtyRect); void _q_setStatusBarMessage(const QString& message); QWebGraphicsItem* q; @@ -74,16 +85,48 @@ void QWebGraphicsItemPrivate::_q_doLoadFinished(bool success) emit q->loadFailed(); } -void QWebGraphicsItemPrivate::_q_doScroll(int dx, int dy, const QRect& rectToScroll) +void QWebGraphicsItemPrivate::scroll(int dx, int dy, const QRect& rectToScroll) { q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); } -void QWebGraphicsItemPrivate::_q_doUpdate(const QRect & dirtyRect) +void QWebGraphicsItemPrivate::update(const QRect & dirtyRect) { q->update(QRectF(dirtyRect)); } +QCursor QWebGraphicsItemPrivate::cursor() const +{ + return q->cursor(); +} + +void QWebGraphicsItemPrivate::updateCursor(const QCursor& cursor) +{ + q->setCursor(cursor); +} + +int QWebGraphicsItemPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->x11Info().screen(); +#endif + + return 0; +} + +WId QWebGraphicsItemPrivate::winId() const +{ + const QList<QGraphicsView*> views = q->scene()->views(); + + if (!views.isEmpty()) + return views.at(0)->winId(); + + return 0; +} + void QWebGraphicsItemPrivate::_q_setStatusBarMessage(const QString& s) { statusBarMessage = s; @@ -175,6 +218,24 @@ bool QWebGraphicsItem::sceneEvent(QEvent* event) bool QWebGraphicsItem::event(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. + + if (d->page) { +#ifndef QT_NO_CURSOR +#if QT_VERSION >= 0x040400 + } else if (event->type() == QEvent::CursorChange) { + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); +#endif +#endif + } return QGraphicsWidget::event(event); } @@ -193,6 +254,7 @@ void QWebGraphicsItem::setPage(QWebPage* page) return; if (d->page) { + d->page->d->client = 0; // unset the page client if (d->page->parent() == this) delete d->page; else @@ -202,6 +264,7 @@ void QWebGraphicsItem::setPage(QWebPage* page) d->page = page; if (!d->page) return; + d->page->d->client = d; // set the page client QSize size = geometry().size().toSize(); page->setViewportSize(size); @@ -220,10 +283,6 @@ void QWebGraphicsItem::setPage(QWebPage* page) this, SLOT(_q_doLoadProgress(int))); connect(d->page, SIGNAL(loadFinished(bool)), this, SLOT(_q_doLoadFinished(bool))); - connect(d->page, SIGNAL(repaintRequested(QRect)), - this, SLOT(_q_doUpdate(const QRect&))); - connect(d->page, SIGNAL(scrollRequested(int, int, const QRect&)), - this, SLOT(_q_doScroll(int, int, const QRect&))); connect(d->page, SIGNAL(statusBarMessage(const QString&)), this, SLOT(_q_setStatusBarMessage(const QString&))); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h index 223ac42..2c6817a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h @@ -133,10 +133,8 @@ protected: virtual bool sceneEvent(QEvent*); private: - Q_PRIVATE_SLOT(d, void _q_doScroll(int dx, int dy, const QRect&)) Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress)) Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) - Q_PRIVATE_SLOT(d, void _q_doUpdate(const QRect& dirtyRect)) Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message)) QWebGraphicsItemPrivate* const d; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp index 7923275..5752d66 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qwebhistory.h" #include "qwebhistory_p.h" +#include "qwebframe_p.h" #include "PlatformString.h" #include "Image.h" @@ -267,6 +268,8 @@ void QWebHistory::clear() lst->setCapacity(capacity); //revert capacity lst->addItem(current.get()); //insert old current item lst->goToItem(current.get()); //and set it as current again + + d->page()->updateNavigationActions(); } /*! @@ -353,9 +356,11 @@ bool QWebHistory::canGoForward() const */ void QWebHistory::back() { - d->lst->goBack(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoBack()) { + d->lst->goBack(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -366,9 +371,11 @@ void QWebHistory::back() */ void QWebHistory::forward() { - d->lst->goForward(); - WebCore::Page* page = d->lst->page(); - page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + if (canGoForward()) { + d->lst->goForward(); + WebCore::Page* page = d->lst->page(); + page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward); + } } /*! @@ -516,6 +523,8 @@ bool QWebHistory::restoreState(const QByteArray& buffer) default: {} // result is false; } + d->page()->updateNavigationActions(); + return result; }; @@ -597,4 +606,7 @@ QDataStream& operator>>(QDataStream& stream, QWebHistory& history) return stream; } - +QWebPagePrivate* QWebHistoryPrivate::page() +{ + return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle(); +} diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h index 809d405..a6682cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h @@ -25,6 +25,8 @@ #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> +class QWebPagePrivate; + class Q_AUTOTEST_EXPORT QWebHistoryItemPrivate : public QSharedData { public: static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem* q) @@ -57,6 +59,9 @@ public: { lst->deref(); } + + QWebPagePrivate* page(); + WebCore::BackForwardList* lst; }; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 5a66cc6..4578dc9 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -28,8 +28,6 @@ #include <QResizeEvent> -// TODO: handle the "Always enable" commands with QWebSettings - /*! \class QWebInspector \since 4.6 @@ -44,6 +42,14 @@ \snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0 + \note A QWebInspector will display a blank widget if either: + \list + \o page() is null + \o QWebSettings::DeveloperExtrasEnabled is false + \endlist + + \section1 Resources + Most of the resources needed by the inspector are owned by the associated QWebPage and are allocated the first time that: \list @@ -56,13 +62,16 @@ the first emission of QWebPage::webInspectorTriggered() to save additional resources. - \note A QWebInspector will display a blank widget if either: - \list - \o page() is null - \o QWebSettings::DeveloperExtrasEnabled is false - \endlist + \section1 Inspector configuration persistence + + The inspector allows the user to configure some options through its + interface (e.g. the resource tracking "Always enable" option). + These settings are persisted automatically by QtWebKit using QSettings. - \sa QWebPage::webInspectorTriggered() + However since the QSettings object is instantiated using the empty + constructor, QCoreApplication::setOrganizationName() and + QCoreApplication::setApplicationName() must be called within your + application to enable the persistence of these options. */ /*! diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 98c0770..a6942a4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -256,6 +256,7 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions) QWebPagePrivate::QWebPagePrivate(QWebPage *qq) : q(qq) + , client(0) , view(0) , inspectorFrontend(0) , inspector(0) @@ -1554,8 +1555,10 @@ QWebHistory *QWebPage::history() const */ void QWebPage::setView(QWidget *view) { - d->view = view; - setViewportSize(view ? view->size() : QSize(0, 0)); + if (d->view != view) { + d->view = view; + setViewportSize(view ? view->size() : QSize(0, 0)); + } } /*! @@ -2909,9 +2912,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const case QSysInfo::WV_VISTA: ver = "Windows NT 6.0"; break; +#if QT_VERSION > 0x040500 case QSysInfo::WV_WINDOWS7: ver = "Windows NT 6.1"; break; +#endif case QSysInfo::WV_CE: ver = "Windows CE"; break; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h index f765f98..9f4216a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h @@ -56,6 +56,7 @@ class QBitArray; QT_END_NAMESPACE class QWebInspector; +class QWebPageClient; class QWebPagePrivate { public: @@ -129,10 +130,11 @@ public: QPointer<QWebFrame> mainFrame; QWebPage *q; + QWebPageClient* client; #ifndef QT_NO_UNDOSTACK QUndoStack *undoStack; #endif - QWidget *view; + QWidget* view; bool insideOpenCall; quint64 m_totalBytes; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index e99ebbf..5f74f36 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -440,7 +440,10 @@ void QWebSettings::resetFontSize(FontSize type) /*! Specifies the location of a user stylesheet to load with every web page. - The \a location can be a URL or a path on the local filesystem. + The \a location must be either a path on the local filesystem, or a data URL + with UTF-8 and Base64 encoded data, such as: + + "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;" \sa userStyleSheetUrl() */ @@ -635,7 +638,15 @@ void QWebSettings::clearMemoryCaches() } /*! - Sets the maximum number of pages to hold in the memory cache to \a pages. + Sets the maximum number of pages to hold in the memory page cache to \a pages. + + The Page Cache allows for a nicer user experience when navigating forth or back + to pages in the forward/back history, by pausing and resuming up to \a pages + per page group. + + For more information about the feature, please refer to: + + http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ */ void QWebSettings::setMaximumPagesInCache(int pages) { diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index d12de94..c7515ab 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "qwebview.h" + +#include "QWebPageClient.h" #include "qwebframe.h" #include "qwebpage_p.h" @@ -29,14 +31,28 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" +#if defined(Q_WS_X11) +#include <QX11Info> +#endif -class QWebViewPrivate { +class QWebViewPrivate : public QWebPageClient { public: QWebViewPrivate(QWebView *view) : view(view) , page(0) , renderHints(QPainter::TextAntialiasing) - {} + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); + + virtual int screenNumber() const; + virtual WId winId() const; void _q_pageDestroyed(); @@ -46,6 +62,44 @@ public: QPainter::RenderHints renderHints; }; +void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebViewPrivate::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +QCursor QWebViewPrivate::cursor() const +{ + return view->cursor(); +} + +void QWebViewPrivate::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} + +int QWebViewPrivate::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +WId QWebViewPrivate::winId() const +{ + if (view) + return view->winId(); + + return 0; +} + void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -195,6 +249,7 @@ void QWebView::setPage(QWebPage* page) if (d->page == page) return; if (d->page) { + d->page->d->client = 0; // unset the page client if (d->page->parent() == this) delete d->page; else @@ -203,6 +258,7 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); + d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -682,24 +738,16 @@ bool QWebView::event(QEvent *e) #ifndef QT_NO_CURSOR #if QT_VERSION >= 0x040400 } else if (e->type() == QEvent::CursorChange) { - // might be a QWidget::unsetCursor() - if (cursor().shape() == Qt::ArrowCursor) { - QVariant prop = property("WebCoreCursor"); - if (prop.isValid()) { - QCursor webCoreCursor = qvariant_cast<QCursor>(prop); - if (webCoreCursor.shape() != Qt::ArrowCursor) - setCursor(webCoreCursor); - } - } - } else if (e->type() == QEvent::DynamicPropertyChange) { - const QByteArray& propName = static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName(); - if (!qstrcmp(propName, "WebCoreCursor")) { - QVariant prop = property("WebCoreCursor"); - if (prop.isValid()) { - QCursor webCoreCursor = qvariant_cast<QCursor>(prop); - setCursor(webCoreCursor); - } - } + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index c4c9523..7020ec0 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,220 @@ +2009-09-24 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + qdoc: Added \brief texts to all the since 4.6 functions. + + * Api/qwebhistory.cpp: + +2009-09-23 J-P Nurmi <jpnurmi@gmail.com> + + Reviewed by Simon Hausmann. + + Prevent QWebPage::setView() from changing the viewport size on the fly + in case the view doesn't actually change. QWebPage::setView() is + called upon every QWebGraphicsItem::hoverMoveEvent(), which forced + the viewport size to be equal to the size of the whole graphics view. + + https://bugs.webkit.org/show_bug.cgi?id=29676 + + * Api/qwebpage.cpp: + (QWebPage::setView): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Crash fix in QWebHistory back and forward methods. + + QWebHistory::back() and QWebHistory::forward() were crashing on + ASSERT in WebCore::BackForwardList. The methods should check + canGoBack() and canGoForward() at the beginning. + + https://bugs.webkit.org/show_bug.cgi?id=29675 + + * Api/qwebhistory.cpp: + (QWebHistory::back): + (QWebHistory::forward): + +2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions + + In QWebHistory's methods that change item count or current item call + to QWebPage::updateNavigationActions should be executed. + QWebHistory::clear() and QWebHistory::restorState() were changed. + New helper method, QWebPagePrivate accesor, were created in + QWebHistoryPrivate class. + Two autotest were developed. + + https://bugs.webkit.org/show_bug.cgi?id=29246 + + * Api/qwebhistory.cpp: + (QWebHistory::clear): + (QWebHistory::restoreState): + (QWebHistoryPrivate::page): + * Api/qwebhistory_p.h: + * tests/qwebhistory/tst_qwebhistory.cpp: + (tst_QWebHistory::saveAndRestore_1): + (tst_QWebHistory::clear): + +2009-09-23 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Need to guard QX11Info include with Q_WS_X11. + That class may not be available (in QT 4.5 for Symbian, for instance). + Completes fixes in r48627 and r48604. + + * Api/qwebgraphicsitem.cpp: + * Api/qwebview.cpp: + +2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add default timeout while waiting for signals in QWebPage auto + tests. + https://bugs.webkit.org/show_bug.cgi?id=29637 + + * tests/qwebpage/tst_qwebpage.cpp: + (waitForSignal): + +2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reivewed by Simon Hausmann. + + Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class) + + There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget() + takes a QWidget*, not a QWebPageClient* + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::screenNumber): + * Api/qwebview.cpp: + (QWebViewPrivate::screenNumber): + +2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + For Qt, platformPageClient() will now return a class derived from + the QWebPageClient, so the patch adapts our Qt hooks to go though + this class and not depend on the QWebView. + + * Api/qwebgraphicsitem.cpp: + (QWebGraphicsItemPrivate::scroll): + (QWebGraphicsItemPrivate::update): + (QWebGraphicsItemPrivate::cursor): + (QWebGraphicsItemPrivate::updateCursor): + (QWebGraphicsItemPrivate::screenNumber): + (QWebGraphicsItemPrivate::winId): + (QWebGraphicsItem::event): + (QWebGraphicsItem::setPage): + * Api/qwebgraphicsitem.h: + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebpage_p.h: + * Api/qwebview.cpp: + (QWebViewPrivate::scroll): + (QWebViewPrivate::update): + (QWebViewPrivate::cursor): + (QWebViewPrivate::updateCursor): + (QWebViewPrivate::screenNumber): + (QWebViewPrivate::winId): + (QWebView::setPage): + (QWebView::event): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::scroll): + (WebCore::ChromeClientQt::platformPageClient): + +2009-09-21 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29609 + Build fix for windows when using Qt 4.5.0. + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + +2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29345 + The tests of QWebFrame did not use QTRY_VERIFY for + tests involving the event loop. + + * tests/qwebframe/tst_qwebframe.cpp: + * tests/util.h: Added. Copy of tests/shared/util.h of Qt + +2009-09-19 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Add an autotest stub for QWebGraphicsItem. + + It just calls all the functions and makes sure they don't crash. + + * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added. + * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added. + (tst_QWebGraphicsItem::qwebgraphicsitem): + * tests/tests.pro: + +2009-09-18 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Eric Seidel. + + Corrected the Symbian specific UID3 values to be assigned + from the "unprotected" pool that permits self-signing of + those test and demo executables. (Added new UID3 values + where they were missing for new components.) + + * QGVLauncher/QGVLauncher.pro: + * QtLauncher/QtLauncher.pro: + * tests/benchmarks/loading/tst_loading.pro: + * tests/benchmarks/painting/tst_painting.pro: + * tests/qwebelement/qwebelement.pro: + * tests/qwebframe/qwebframe.pro: + * tests/qwebhistory/qwebhistory.pro: + * tests/qwebhistoryinterface/qwebhistoryinterface.pro: + * tests/qwebpage/qwebpage.pro: + * tests/qwebplugindatabase/qwebplugindatabase.pro: + * tests/qwebview/qwebview.pro: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::platformPageClient): + * WebCoreSupport/ChromeClientQt.h: + +2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add persistence support for configuration options in the + inspector. + + * Api/qwebinspector.cpp: + * QtLauncher/main.cpp: + (main): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::populateSetting): + (WebCore::InspectorClientQt::storeSetting): + (WebCore::variantToSetting): + (WebCore::settingToVariant): + 2009-09-18 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Ariya Hidayat. @@ -20,6 +237,34 @@ (ConsolePage::javaScriptConsoleMessage): (tst_QWebPage::consoleOutput): +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Improve documentation for Page Cache. + + * Api/qwebsettings.cpp: + +2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test + + https://bugs.webkit.org/show_bug.cgi?id=29081 + + The documentation now specifies that the URL has to be a local file + or a a data-URL (with utf-8 and base64-encoded data), as these are the + only two schemes that the current code path accepts. + + The auto-test has been updated to reflect this limitation. + + At a later point we should concider adding API for the new way of + doing both user defined stylesheets and scripts. + + * Api/qwebsettings.cpp: + * tests/qwebpage/tst_qwebpage.cpp: + 2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro b/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro index b883b52..dec1c9b 100644 --- a/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro +++ b/src/3rdparty/webkit/WebKit/qt/QGVLauncher/QGVLauncher.pro @@ -10,4 +10,4 @@ QT += network macx:QT+=xml QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267D0 +symbian:TARGET.UID3 = 0xA000E544 diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 9a63e85..5c65112 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -39,6 +39,7 @@ #include "WindowFeatures.h" #include "DatabaseTracker.h" #include "SecurityOrigin.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include "qwebpage_p.h" @@ -308,12 +309,11 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo { // No double buffer, so only update the QWidget if content changed. if (contentChanged) { - // Only do implicit paints for QWebView's - if (QWebView* view = qobject_cast<QWebView*>(m_webPage->view())) { + if (platformPageClient()) { QRect rect(windowRect); rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize())); if (!rect.isEmpty()) - view->update(rect); + platformPageClient()->update(rect); } emit m_webPage->repaintRequested(windowRect); } @@ -324,9 +324,8 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect&) { - // Only do implicit paints for QWebView's - if (QWebView* view = qobject_cast<QWebView*>(m_webPage->view())) - view->scroll(delta.width(), delta.height(), scrollViewRect); + if (platformPageClient()) + platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect); emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect); } @@ -342,9 +341,9 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const return point; } -PlatformWidget ChromeClientQt::platformWindow() const +PlatformPageClient ChromeClientQt::platformPageClient() const { - return m_webPage->view(); + return m_webPage->d->client; } void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 7ea6a70..196c4fc 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -105,7 +105,7 @@ namespace WebCore { virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual IntPoint screenToWindow(const IntPoint&) const; virtual IntRect windowToScreen(const IntRect&) const; - virtual PlatformWidget platformWindow() const; + virtual PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; virtual void scrollbarsModeDidChange() const { } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index ce08d42..340325e 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -37,6 +37,7 @@ #include "qwebpage_p.h" #include "qwebview.h" +#include <QtCore/QSettings> #include <QtCore/QCoreApplication> #include "InspectorController.h" @@ -46,6 +47,12 @@ namespace WebCore { +static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/"); +static const QLatin1String settingStorageTypeSuffix(".type"); + +static InspectorController::Setting variantToSetting(const QVariant& qvariant); +static QVariant settingToVariant(const InspectorController::Setting& icSetting); + class InspectorClientWebPage : public QWebPage { Q_OBJECT friend class InspectorClientQt; @@ -66,7 +73,6 @@ public: } }; - InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) {} @@ -169,12 +175,34 @@ void InspectorClientQt::updateWindowTitle() void InspectorClientQt::populateSetting(const String& key, InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called + qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QString settingKey(settingStoragePrefix + key); + QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString(); + QVariant storedValue = qsettings.value(settingKey); + storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data())); + setting = variantToSetting(storedValue); } void InspectorClientQt::storeSetting(const String& key, const InspectorController::Setting& setting) { - notImplemented(); + QSettings qsettings; + if (qsettings.status() == QSettings::AccessError) { + qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].", + qPrintable(static_cast<QString>(key))); + return; + } + + QVariant valueToStore = settingToVariant(setting); + QString settingKey(settingStoragePrefix + key); + qsettings.setValue(settingKey, valueToStore); + qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); } void InspectorClientQt::removeSetting(const String& key) @@ -182,6 +210,68 @@ void InspectorClientQt::removeSetting(const String& key) notImplemented(); } +static InspectorController::Setting variantToSetting(const QVariant& qvariant) +{ + InspectorController::Setting retVal; + + switch (qvariant.type()) { + case QVariant::Bool: + retVal.set(qvariant.toBool()); + break; + case QVariant::Double: + retVal.set(qvariant.toDouble()); + break; + case QVariant::Int: + retVal.set((long)qvariant.toInt()); + break; + case QVariant::String: + retVal.set(qvariant.toString()); + break; + case QVariant::StringList: { + QStringList qsList = qvariant.toStringList(); + int listCount = qsList.count(); + Vector<String> vector(listCount); + for (int i = 0; i < listCount; ++i) + vector[i] = qsList[i]; + retVal.set(vector); + break; + } + } + + return retVal; +} + +static QVariant settingToVariant(const InspectorController::Setting& icSetting) +{ + QVariant retVal; + + switch (icSetting.type()) { + case InspectorController::Setting::StringType: + retVal.setValue(static_cast<QString>(icSetting.string())); + break; + case InspectorController::Setting::StringVectorType: { + const Vector<String>& vector = icSetting.stringVector(); + Vector<String>::const_iterator iter; + QStringList qsList; + for (iter = vector.begin(); iter != vector.end(); ++iter) + qsList << *iter; + retVal.setValue(qsList); + break; + } + case InspectorController::Setting::DoubleType: + retVal.setValue(icSetting.doubleValue()); + break; + case InspectorController::Setting::IntegerType: + retVal.setValue((int)icSetting.integerValue()); + break; + case InspectorController::Setting::BooleanType: + retVal.setValue(icSetting.booleanValue()); + break; + } + + return retVal; +} + } #include "InspectorClientQt.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro index af0387e..80717c2 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/loading/tst_loading.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_loading.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E541 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro index 496210e..f45d804 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.pro @@ -4,3 +4,5 @@ include(../../../../../WebKit.pri) SOURCES += tst_painting.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E542 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro index ea2bc79..0a140ad 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro @@ -6,4 +6,4 @@ RESOURCES += qwebelement.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C3 +symbian:TARGET.UID3 = 0xA000E53A diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index a3e099b..81037c3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -6,4 +6,4 @@ RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C6 +symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 561087f..729b971 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -34,6 +34,7 @@ #include <QNetworkRequest> #include <QNetworkReply> #include <qsslerror.h> +#include "../util.h" //TESTED_CLASS= //TESTED_FILES= @@ -2446,23 +2447,17 @@ void tst_QWebFrame::popupFocus() view.resize(400, 100); view.show(); view.setFocus(); - QTest::qWait(200); - QVERIFY2(view.hasFocus(), - "The WebView should be created"); + QTRY_VERIFY(view.hasFocus()); // open the popup by clicking. check if focus is on the popup QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25)); QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup"); QComboBox* combo = qobject_cast<QComboBox*>(webpopup); - QTest::qWait(500); - QVERIFY2(!view.hasFocus() && combo->view()->hasFocus(), - "Focus sould be on the Popup"); + QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup // hide the popup and check if focus is on the page combo->hidePopup(); - QTest::qWait(500); - QVERIFY2(view.hasFocus() && !combo->view()->hasFocus(), - "Focus sould be back on the WebView"); + QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView // triple the flashing time, should at least blink twice already int delay = qApp->cursorFlashTime() * 3; @@ -2630,16 +2625,16 @@ void tst_QWebFrame::hasSetFocus() QCOMPARE(loadSpy.size(), 2); m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); for (int i = 0; i < children.size(); ++i) { children.at(i)->setFocus(); - QVERIFY(children.at(i)->hasFocus()); + QTRY_VERIFY(children.at(i)->hasFocus()); QVERIFY(!m_page->mainFrame()->hasFocus()); } m_page->mainFrame()->setFocus(); - QVERIFY(m_page->mainFrame()->hasFocus()); + QTRY_VERIFY(m_page->mainFrame()->hasFocus()); } void tst_QWebFrame::render() diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro new file mode 100644 index 0000000..39e90e7 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +TARGET = tst_qwebgraphicsitem +include(../../../../WebKit.pri) +SOURCES += tst_qwebgraphicsitem.cpp +QT += testlib network +QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp new file mode 100644 index 0000000..731e342 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <QtTest/QtTest> + +#include <qwebgraphicsitem.h> + +class tst_QWebGraphicsItem : public QObject +{ + Q_OBJECT + +private slots: + void qwebgraphicsitem(); +}; + +void tst_QWebGraphicsItem::qwebgraphicsitem() +{ + QWebGraphicsItem item; + item.url(); + item.title(); + item.icon(); + item.zoomFactor(); + item.isInteractive(); + item.progress(); + item.toHtml(); + item.history(); + item.settings(); + item.status(); + item.page(); + item.setPage(0); + item.page(); + item.setUrl(QUrl()); + item.setZoomFactor(0); + item.setInteractive(true); + item.load(QUrl()); + item.setHtml(QString()); + item.setContent(QByteArray()); +} + +QTEST_MAIN(tst_QWebGraphicsItem) + +#include "tst_qwebgraphicsitem.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro index 55ed414..8ee63cc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/qwebhistory.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebhistory.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C4 +symbian:TARGET.UID3 = 0xA000E53B diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp index ec7a040..4f4d3c4 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp @@ -18,6 +18,7 @@ */ #include <QtTest/QtTest> +#include <QAction> #include "qwebpage.h" #include "qwebview.h" @@ -296,10 +297,13 @@ void tst_QWebHistory::serialize_3() /** Simple checks should be a bit redundant to streaming operators */ void tst_QWebHistory::saveAndRestore_1() { + QAction* actionBack = page->action(QWebPage::Back); hist->back(); waitForLoadFinished.exec(); + QVERIFY(actionBack->isEnabled()); QByteArray buffer(hist->saveState()); hist->clear(); + QVERIFY(!actionBack->isEnabled()); QVERIFY(hist->count() == 1); hist->restoreState(buffer); @@ -310,6 +314,7 @@ void tst_QWebHistory::saveAndRestore_1() QCOMPARE(hist->currentItemIndex(), histsize - 2); QCOMPARE(hist->itemAt(0).title(), QString("page1")); QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize)); + QVERIFY(actionBack->isEnabled()); } /** Check returns value if there are bad parameters. Actually, result @@ -376,16 +381,20 @@ void tst_QWebHistory::saveAndRestore_crash_3() /** ::clear */ void tst_QWebHistory::clear() { + QAction* actionBack = page->action(QWebPage::Back); + QVERIFY(actionBack->isEnabled()); hist->saveState(); QVERIFY(hist->count() > 1); hist->clear(); - QVERIFY(hist->count() == 1); //leave current item + QVERIFY(hist->count() == 1); // Leave current item. + QVERIFY(!actionBack->isEnabled()); + QWebPage* page2 = new QWebPage(this); QWebHistory* hist2 = page2->history(); QVERIFY(hist2->count() == 0); hist2->clear(); - QVERIFY(hist2->count() == 0); //do not change anything + QVERIFY(hist2->count() == 0); // Do not change anything. delete page2; } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro index 011869d..53e1afe 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebhistoryinterface.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C5 +symbian:TARGET.UID3 = 0xA000E53C diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index e4b11c2..82ffac6 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -6,4 +6,4 @@ RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C7 +symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 47a1426..0fb05b8 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -59,7 +59,7 @@ * \return \p true if the requested signal was received * \p false on timeout */ -static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) { QEventLoop loop; QObject::connect(obj, signal, &loop, SLOT(quit())); @@ -208,7 +208,7 @@ public: public slots: bool shouldInterruptJavaScript() { - return true; + return true; } }; @@ -346,13 +346,13 @@ void tst_QWebPage::userStyleSheet() m_page->setNetworkAccessManager(networkManager); networkManager->requestedUrls.clear(); - m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); + m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64," + + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64())); m_view->setHtml("<p>hello world</p>"); - QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)), 1000)); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); - QVERIFY(networkManager->requestedUrls.count() >= 2); - QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}")); - QCOMPARE(networkManager->requestedUrls.at(1), QUrl("http://does.not/exist.png")); + QVERIFY(networkManager->requestedUrls.count() >= 1); + QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png")); } void tst_QWebPage::modified() @@ -674,7 +674,7 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage() view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); qt_webpage_setGroupName(view1.page(), "group1"); - view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); + view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); qt_webpage_setGroupName(view2.page(), "group2"); QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); @@ -945,7 +945,7 @@ void tst_QWebPage::textSelection() QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0); QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0); - // right now they are disabled because contentEditable is false and + // right now they are disabled because contentEditable is false and // there isn't an existing selection to modify QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false); QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false); @@ -1114,14 +1114,14 @@ void tst_QWebPage::textEditing() QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), true); QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), true); - + // make sure these are disabled since there isn't a selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false); - + // make sure everything is selected page->triggerAction(QWebPage::SelectAll); - + // this is only true if there is an editable selection QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), true); QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), true); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro index 5d10993..1376ca5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro @@ -4,3 +4,5 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebplugindatabase.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR + +symbian:TARGET.UID3 = 0xA000E540 diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index b7e0fb1..d9d122c 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -5,4 +5,4 @@ SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -symbian:TARGET.UID3 = 0x200267C8 +symbian:TARGET.UID3 = 0xA000E53F diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index b5f66ee..ec496e3 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qwebgraphicsitem qwebhistoryinterface qwebplugindatabase qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro diff --git a/src/3rdparty/webkit/WebKit/qt/tests/util.h b/src/3rdparty/webkit/WebKit/qt/tests/util.h new file mode 100644 index 0000000..7f7e613 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/util.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +// Functions and macros that really need to be in QTestLib + +// Will try to wait for the condition while allowing event processing +#define QTRY_VERIFY(__expr) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ + } while(0) + +// Will try to wait for the condition while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ + do { \ + const int __step = 50; \ + const int __timeout = 5000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ + } while(0) + |