diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebKit/qt | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebKit/qt')
49 files changed, 1984 insertions, 197 deletions
diff --git a/Source/WebKit/qt/Api/DerivedSources.pro b/Source/WebKit/qt/Api/DerivedSources.pro index 8084242..8be6748 100644 --- a/Source/WebKit/qt/Api/DerivedSources.pro +++ b/Source/WebKit/qt/Api/DerivedSources.pro @@ -19,7 +19,6 @@ win32-msvc* | wince* { } else { QUOTE = "\'" DOUBLE_ESCAPED_QUOTE = "\\\'" - ESCAPE = "\\" } qtheader_module.target = $${DESTDIR}/QtWebKit diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index b1c9586..b7b28bc 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -55,7 +55,8 @@ public: QGraphicsWebViewPrivate(QGraphicsWebView* parent) : q(parent) , page(0) - , resizesToContents(false) {} + , resizesToContents(false) + , renderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform) {} virtual ~QGraphicsWebViewPrivate(); @@ -74,6 +75,7 @@ public: QGraphicsWebView* q; QWebPage* page; bool resizesToContents; + QPainter::RenderHints renderHints; QGraphicsItemOverlay* overlay() const { @@ -279,6 +281,8 @@ QWebPage* QGraphicsWebView::page() const */ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) { + QPainter::RenderHints oldHints = painter->renderHints(); + painter->setRenderHints(oldHints | d->renderHints); #if ENABLE(TILED_BACKING_STORE) if (WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore()) { // FIXME: We should set the backing store viewport earlier than in paint @@ -286,6 +290,7 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* // QWebFrame::render is a public API, bypass it for tiled rendering so behavior does not need to change. WebCore::GraphicsContext context(painter); page()->mainFrame()->d->renderFromTiledBackingStore(&context, option->exposedRect.toAlignedRect()); + painter->setRenderHints(oldHints); return; } #endif @@ -294,6 +299,7 @@ void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* #else page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect()); #endif + painter->setRenderHints(oldHints); } /*! \reimp @@ -357,6 +363,65 @@ QVariant QGraphicsWebView::inputMethodQuery(Qt::InputMethodQuery query) const return QVariant(); } +/*! + \property QGraphicsWebView::renderHints + \since 4.8 + \brief the default render hints for the view + + These hints are used to initialize QPainter before painting the Web page. + + QPainter::TextAntialiasing and QPainter::SmoothPixmapTransform are enabled by default and will be + used to render the item in addition of what has been set on the painter given by QGraphicsScene. + + \note This property is not available on Symbian. However, the getter and + setter functions can still be used directly. + + \sa QPainter::renderHints() +*/ + +/*! + \since 4.8 + Returns the render hints used by the view to render content. + + \sa QPainter::renderHints() +*/ +QPainter::RenderHints QGraphicsWebView::renderHints() const +{ + return d->renderHints; +} + +/*! + \since 4.8 + Sets the render hints used by the view to the specified \a hints. + + \sa QPainter::setRenderHints() +*/ +void QGraphicsWebView::setRenderHints(QPainter::RenderHints hints) +{ + if (hints == d->renderHints) + return; + d->renderHints = hints; + update(); +} + +/*! + \since 4.8 + If \a enabled is true, enables the specified render \a hint; otherwise + disables it. + + \sa renderHints, QPainter::renderHints() +*/ +void QGraphicsWebView::setRenderHint(QPainter::RenderHint hint, bool enabled) +{ + QPainter::RenderHints oldHints = d->renderHints; + if (enabled) + d->renderHints |= hint; + else + d->renderHints &= ~hint; + if (oldHints != d->renderHints) + update(); +} + /*! \reimp */ bool QGraphicsWebView::event(QEvent* event) diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h index 733c224..ceb0ad8 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.h +++ b/Source/WebKit/qt/Api/qgraphicswebview.h @@ -50,6 +50,9 @@ class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget { Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents) Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen) + Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints) + Q_FLAGS(QPainter::RenderHints) + public: explicit QGraphicsWebView(QGraphicsItem* parent = 0); ~QGraphicsWebView(); @@ -99,6 +102,10 @@ public: virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + QPainter::RenderHints renderHints() const; + void setRenderHints(QPainter::RenderHints); + void setRenderHint(QPainter::RenderHint, bool enabled = true); + public Q_SLOTS: void stop(); void back(); diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index 6f98bca..e5124bd 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -731,7 +731,7 @@ QMultiMap<QString, QString> QWebFrame::metaData() const static inline QUrl ensureAbsoluteUrl(const QUrl &url) { - if (!url.isRelative()) + if (!url.isValid() || !url.isRelative()) return url; // This contains the URL with absolute path but without @@ -780,26 +780,7 @@ QUrl QWebFrame::url() const */ QUrl QWebFrame::requestedUrl() const { - // There are some possible edge cases to be handled here, - // apart from checking if activeDocumentLoader is valid: - // - // * Method can be called while processing an unsucessful load. - // In this case, frameLoaderClient will hold the current error - // (m_loadError), and we will make use of it to recover the 'failingURL'. - // * If the 'failingURL' holds a null'ed string though, we fallback - // to 'outgoingReferrer' (it yet is safer than originalRequest). - FrameLoader* loader = d->frame->loader(); - FrameLoaderClientQt* loaderClient = d->frameLoaderClient; - - if (!loader->activeDocumentLoader() - || !loaderClient->m_loadError.isNull()) { - if (!loaderClient->m_loadError.failingURL().isNull()) - return QUrl(loaderClient->m_loadError.failingURL()); - else if (!loader->outgoingReferrer().isEmpty()) - return QUrl(loader->outgoingReferrer()); - } - - return loader->originalRequest().url(); + return d->frameLoaderClient->lastRequestedUrl(); } /*! \since 4.6 @@ -893,11 +874,9 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::DeleteOperation: request.setHTTPMethod("DELETE"); break; -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) case QNetworkAccessManager::CustomOperation: request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData()); break; -#endif case QNetworkAccessManager::UnknownOperation: // eh? break; diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp index a9761de..33bad41 100644 --- a/Source/WebKit/qt/Api/qwebhistory.cpp +++ b/Source/WebKit/qt/Api/qwebhistory.cpp @@ -23,11 +23,13 @@ #include "qwebframe_p.h" #include "BackForwardListImpl.h" -#include "PlatformString.h" +#include "IconDatabaseBase.h" #include "Image.h" +#include "IntSize.h" #include "KURL.h" #include "Page.h" #include "PageGroup.h" +#include "PlatformString.h" #include <QSharedData> #include <QDebug> @@ -156,7 +158,8 @@ QDateTime QWebHistoryItem::lastVisited() const QIcon QWebHistoryItem::icon() const { if (d->item) - return *d->item->icon()->nativeImageForCurrentFrame(); + return *WebCore::iconDatabase().synchronousIconForPageURL(d->item->url(), WebCore::IntSize(16, 16))->nativeImageForCurrentFrame(); + return QIcon(); } diff --git a/Source/WebKit/qt/Api/qwebhistoryinterface.cpp b/Source/WebKit/qt/Api/qwebhistoryinterface.cpp index 61cf5af..40ff5c9 100644 --- a/Source/WebKit/qt/Api/qwebhistoryinterface.cpp +++ b/Source/WebKit/qt/Api/qwebhistoryinterface.cpp @@ -69,8 +69,8 @@ void QWebHistoryInterface::setDefaultInterface(QWebHistoryInterface* defaultInte /*! Returns the default interface that will be used by WebKit. If no default interface has been set, - Webkit will not keep track of visited links and a null pointer will be returned. - \sa setDefaultInterface + WebKit will not keep track of visited links and a null pointer will be returned. + \sa setDefaultInterface() */ QWebHistoryInterface* QWebHistoryInterface::defaultInterface() { diff --git a/Source/WebKit/qt/Api/qwebkitplatformplugin.h b/Source/WebKit/qt/Api/qwebkitplatformplugin.h index 2a94e0c..f274a0b 100644 --- a/Source/WebKit/qt/Api/qwebkitplatformplugin.h +++ b/Source/WebKit/qt/Api/qwebkitplatformplugin.h @@ -26,6 +26,7 @@ * and may be changed from version to version or even be completely removed. */ +#include <QColor> #include <QObject> #include <QUrl> #if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA @@ -46,6 +47,10 @@ public: virtual bool itemIsSelected(int index) const = 0; virtual int itemCount() const = 0; virtual bool multiple() const = 0; + virtual QColor backgroundColor() const = 0; + virtual QColor foregroundColor() const = 0; + virtual QColor itemBackgroundColor(int index) const = 0; + virtual QColor itemForegroundColor(int index) const = 0; }; class QWebSelectMethod : public QObject diff --git a/Source/WebKit/qt/Api/qwebkitversion.cpp b/Source/WebKit/qt/Api/qwebkitversion.cpp index 181913b..1143f99 100644 --- a/Source/WebKit/qt/Api/qwebkitversion.cpp +++ b/Source/WebKit/qt/Api/qwebkitversion.cpp @@ -40,7 +40,7 @@ */ QString qWebKitVersion() { - return QString("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION); + return QString::fromLatin1("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION); } /*! diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 5dd57f5..ac1d562 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -104,6 +104,9 @@ #include "Scrollbar.h" #include "SecurityOrigin.h" #include "Settings.h" +#if defined Q_OS_WIN32 +#include "SystemInfo.h" +#endif // Q_OS_WIN32 #include "TextIterator.h" #include "WebPlatformStrategies.h" #include "WindowFeatures.h" @@ -312,9 +315,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) ScriptController::initializeThreading(); WTF::initializeMainThread(); WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); -#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) - WebCore::Font::setCodePath(WebCore::Font::Complex); -#endif WebPlatformStrategies::initialize(); @@ -1168,7 +1168,7 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev QString p = q->property("_q_RepaintThrottlingPreset").toString(); for(int i = 0; i < sizeof(presets) / sizeof(presets[0]); i++) { - if(p == presets[i].name) { + if (p == QLatin1String(presets[i].name)) { FrameView::setRepaintThrottlingDeferredRepaintDelay( presets[i].deferredRepaintDelay); FrameView::setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading( @@ -1219,6 +1219,9 @@ void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* ev else if (event->propertyName() == "_q_webInspectorServerPort") { InspectorServerQt* inspectorServer = InspectorServerQt::server(); inspectorServer->listen(inspectorServerPort()); + } else if (event->propertyName() == "_q_deadDecodedDataDeletionInterval") { + double interval = q->property("_q_deadDecodedDataDeletionInterval").toDouble(); + memoryCache()->setDeadDecodedDataDeletionInterval(interval); } } #endif @@ -2070,7 +2073,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, // Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html // At this point DRT's WebPage has already been destroyed if (QWebPagePrivate::drtRun) { - if (message == "PLUGIN: NPP_Destroy") + if (message == QLatin1String("PLUGIN: NPP_Destroy")) fprintf (stdout, "CONSOLE MESSAGE: line %d: %s\n", lineNumber, message.toUtf8().constData()); } } @@ -2540,7 +2543,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av result.m_minimumScaleFactor = conf.minimumScale; result.m_maximumScaleFactor = conf.maximumScale; result.m_devicePixelRatio = conf.devicePixelRatio; - result.m_isUserScalable = conf.userScalable; + result.m_isUserScalable = static_cast<bool>(conf.userScalable); d->pixelRatio = conf.devicePixelRatio; @@ -3169,10 +3172,10 @@ bool QWebPage::focusNextPrevChild(bool next) void QWebPage::setContentEditable(bool editable) { if (isContentEditable() != editable) { + d->page->setEditable(editable); d->page->setTabKeyCyclesThroughElements(!editable); if (d->mainFrame) { WebCore::Frame* frame = d->mainFrame->d->frame; - frame->document()->setDesignMode(editable ? WebCore::Document::on : WebCore::Document::off); if (editable) { frame->editor()->applyEditingStyleToBodyElement(); // FIXME: mac port calls this if there is no selectedDOMRange @@ -3186,7 +3189,7 @@ void QWebPage::setContentEditable(bool editable) bool QWebPage::isContentEditable() const { - return d->mainFrame && d->mainFrame->d->frame->document()->inDesignMode(); + return d->page->isEditable(); } /*! @@ -3772,52 +3775,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const #ifdef Q_OS_AIX firstPartTemp += QString::fromLatin1("AIX"); #elif defined Q_OS_WIN32 - - switch (QSysInfo::WindowsVersion) { - case QSysInfo::WV_32s: - firstPartTemp += QString::fromLatin1("Windows 3.1"); - break; - case QSysInfo::WV_95: - firstPartTemp += QString::fromLatin1("Windows 95"); - break; - case QSysInfo::WV_98: - firstPartTemp += QString::fromLatin1("Windows 98"); - break; - case QSysInfo::WV_Me: - firstPartTemp += QString::fromLatin1("Windows 98; Win 9x 4.90"); - break; - case QSysInfo::WV_NT: - firstPartTemp += QString::fromLatin1("WinNT4.0"); - break; - case QSysInfo::WV_2000: - firstPartTemp += QString::fromLatin1("Windows NT 5.0"); - break; - case QSysInfo::WV_XP: - firstPartTemp += QString::fromLatin1("Windows NT 5.1"); - break; - case QSysInfo::WV_2003: - firstPartTemp += QString::fromLatin1("Windows NT 5.2"); - break; - case QSysInfo::WV_VISTA: - firstPartTemp += QString::fromLatin1("Windows NT 6.0"); - break; - case QSysInfo::WV_WINDOWS7: - firstPartTemp += QString::fromLatin1("Windows NT 6.1"); - break; - case QSysInfo::WV_CE: - firstPartTemp += QString::fromLatin1("Windows CE"); - break; - case QSysInfo::WV_CENET: - firstPartTemp += QString::fromLatin1("Windows CE .NET"); - break; - case QSysInfo::WV_CE_5: - firstPartTemp += QString::fromLatin1("Windows CE 5.x"); - break; - case QSysInfo::WV_CE_6: - firstPartTemp += QString::fromLatin1("Windows CE 6.x"); - break; - } - + firstPartTemp += windowsVersionForUAString(); #elif defined Q_OS_DARWIN #ifdef __i386__ || __x86_64__ firstPartTemp += QString::fromLatin1("Intel Mac OS X"); @@ -4086,7 +4044,8 @@ quint64 QWebPage::bytesReceived() const /*! \fn void QWebPage::repaintRequested(const QRect& dirtyRect) - This signal is emitted whenever this QWebPage should be updated and no view was set. + This signal is emitted whenever this QWebPage should be updated. It's useful + when rendering a QWebPage without a QWebView or QGraphicsWebView. \a dirtyRect contains the area that needs to be updated. To paint the QWebPage get the mainFrame() and call the render(QPainter*, const QRegion&) method with the \a dirtyRect as the second parameter. @@ -4131,6 +4090,8 @@ quint64 QWebPage::bytesReceived() const At signal emission time the meta-data of the QNetworkReply \a reply is available. + \note The receiving slot is responsible for deleting the QNetworkReply \a reply. + \note This signal is only emitted if the forwardUnsupportedContent property is set to true. \sa downloadRequested() diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 3f0b436..f744e81 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -28,6 +28,9 @@ #include "MemoryCache.h" #include "CrossOriginPreflightResultCache.h" #include "FontCache.h" +#if ENABLE(ICONDATABASE) +#include "IconDatabaseClientQt.h" +#endif #include "Page.h" #include "PageCache.h" #include "Settings.h" @@ -477,25 +480,16 @@ QWebSettings::QWebSettings() d->fontFamilies.insert(QWebSettings::StandardFont, defaultFont.defaultFamily()); d->fontFamilies.insert(QWebSettings::SerifFont, defaultFont.defaultFamily()); -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) defaultFont.setStyleHint(QFont::Fantasy); d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily()); defaultFont.setStyleHint(QFont::Cursive); d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily()); -#else - d->fontFamilies.insert(QWebSettings::FantasyFont, defaultFont.defaultFamily()); - d->fontFamilies.insert(QWebSettings::CursiveFont, defaultFont.defaultFamily()); -#endif defaultFont.setStyleHint(QFont::SansSerif); d->fontFamilies.insert(QWebSettings::SansSerifFont, defaultFont.defaultFamily()); -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) defaultFont.setStyleHint(QFont::Monospace); -#else - defaultFont.setStyleHint(QFont::TypeWriter); -#endif d->fontFamilies.insert(QWebSettings::FixedFont, defaultFont.defaultFamily()); d->attributes.insert(QWebSettings::AutoLoadImages, true); @@ -645,13 +639,18 @@ QString QWebSettings::defaultTextEncoding() const */ void QWebSettings::setIconDatabasePath(const QString& path) { - WebCore::iconDatabase().delayDatabaseCleanup(); +#if ENABLE(ICONDATABASE) + // Make sure that IconDatabaseClientQt is instantiated. + WebCore::IconDatabaseClientQt::instance(); +#endif + + WebCore::IconDatabase::delayDatabaseCleanup(); if (!path.isEmpty()) { WebCore::iconDatabase().setEnabled(true); QFileInfo info(path); if (info.isDir() && info.isWritable()) - WebCore::iconDatabase().open(path); + WebCore::iconDatabase().open(path, WebCore::IconDatabase::defaultDatabaseFilename()); } else { WebCore::iconDatabase().setEnabled(false); WebCore::iconDatabase().close(); @@ -693,7 +692,7 @@ void QWebSettings::clearIconDatabase() */ QIcon QWebSettings::iconForUrl(const QUrl& url) { - WebCore::Image* image = WebCore::iconDatabase().iconForPageURL(WebCore::KURL(url).string(), + WebCore::Image* image = WebCore::iconDatabase().synchronousIconForPageURL(WebCore::KURL(url).string(), WebCore::IntSize(16, 16)); if (!image) return QPixmap(); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index a28825c..1a922ad 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,716 @@ +2011-03-30 Robert Hogan <robert@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt] Fix LoadHTMLStringItem::invoke() after r75966 + + Add DRT support for loading an alternate HTML string + for error pages. This allows Qt to unskip + http/tests/navigation/go-back-to-error-page.html. + + https://bugs.webkit.org/show_bug.cgi?id=52614 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::setAlternateHtml): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2011-03-29 Alexis Menard <alexis.menard@openbossa.org> + + Unreviewed build fix for build-webkit -minimal. + + Breakage introduced by http://trac.webkit.org/changeset/82238. + The minimal option has no support for shortcuts. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::handleInputMethodKeydown): + +2011-03-29 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enterkey to go to Newline does not work in the text area(in HTML form) + https://bugs.webkit.org/show_bug.cgi?id=33179 + + Fixed newline generation from Qt::Key_Enter when editting text area using InputMethods. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::handleInputMethodKeydown): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2011-03-29 Andreas Kling <kling@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Fix documentation for QWebPage::repaintRequested() + + This signal is always emitted when the page is dirtied, so remove + reference to old behavior where we would only emit the signal for + headless QWebPages. + + * Api/qwebpage.cpp: + +2011-03-28 Andreas Kling <kling@webkit.org> + + Reviewed by Benjamin Poulain. + + [Qt] Pass QString() instead of String() when emitting titleChanged() for new loads. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad): + +2011-03-28 Andreas Kling <kling@webkit.org> + + Reviewed by Benjamin Poulain. + + [Qt] Crash when calling QWebFrame::render() in response to QWebPage::repaintRequested() + https://bugs.webkit.org/show_bug.cgi?id=52629 + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::invalidateContentsAndWindow): Make the emission of + QWebPage::repaintRequested() use a Qt::QueuedConnection. + + * tests/qwebpage/tst_qwebpage.cpp: + (RepaintRequestedRenderer::RepaintRequestedRenderer): + (RepaintRequestedRenderer::onRepaintRequested): + (tst_QWebPage::renderOnRepaintRequestedShouldNotRecurse): Test that calling + QWebFrame::render() in a slot connected to to QWebPage::repaintRequested() + doesn't cause recursive signal emissions. + +2011-03-28 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled + https://bugs.webkit.org/show_bug.cgi?id=57087 + + * QtWebKit.pro: we can now enable QT_ASCII_CAST_WARNINGS + * tests/tests.pri: we do not require QT_ASCII_CAST_WARNINGS for tests + since they are applications, not libraries. + +2011-03-28 Andras Becsi <abecsi@webkit.org> + + Reviewed by Csaba Osztrogonác. + + [Qt] QtWebKit does not link with --3d-canvas using MinGW + https://bugs.webkit.org/show_bug.cgi?id=57225 + + * QtWebKit.pro: Append the OpenGL libraries on MinGW so it can resolve symbols. + +2011-03-28 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Andreas Kling. + + REGRESSION(r54712): [Qt] Installed QtWebKit header does not compile. + https://bugs.webkit.org/show_bug.cgi?id=57183 + + Windows buildfix after r82065. + + * Api/DerivedSources.pro: Readding escaping on Windows platforms. + +2011-03-27 Andreas Kling <kling@webkit.org> + + Fix build warning about IconDatabaseClient.h (wrong path.) + + * QtWebKit.pro: + +2011-03-27 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Support for CSS color and background-color properties on select element's dropdown list + https://bugs.webkit.org/show_bug.cgi?id=51627 + + Extend the QWebSelectData interface with background and foreground colors + for the whole menu, as well as per-item. Hook it up to the PopupMenuStyle + getters in RenderMenuList. + + * Api/qwebkitplatformplugin.h: + * WebCoreSupport/PopupMenuQt.cpp: + (SelectData::backgroundColor): + (SelectData::foregroundColor): + (SelectData::itemBackgroundColor): + (SelectData::itemForegroundColor): + * WebCoreSupport/QtFallbackWebPopup.cpp: + (WebCore::QtFallbackWebPopup::show): + (WebCore::QtFallbackWebPopup::populate): + +2011-03-27 Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt][Symbian] Fix Api test failure -- microFocusCoordinates + https://bugs.webkit.org/show_bug.cgi?id=57108 + + Since the canvas is not self-closing tag, we need to add '</canvas>'. + + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::microFocusCoordinates): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::microFocusCoordinates): + +2011-03-27 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [Qt] Build fix: Define WTF_USE_TEXTURE_MAPPER=1 when CONFIG contains texmap. + https://bugs.webkit.org/show_bug.cgi?id=57143 + + Qt WebKit uses USE(TEXTURE_MAPPER) guard. Check texmap in CONFIG and + define WTF_USE_TEXTURE_MAPPER=1. + + * QtWebKit.pro: + +2011-03-27 Andreas Kling <kling@webkit.org> + + Reviewed by Benjamin Poulain. + + REGRESSION(r54712): [Qt] Installed QtWebKit header does not compile. + https://bugs.webkit.org/show_bug.cgi?id=57183 + + The convenience <QtWebKit> header would include \<QtNetwork/QtNetwork\> + which was due to the outputting code previously being wrapped in eval(). + + * Api/DerivedSources.pro: + +2011-03-27 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] QtWebKit will not compile with QT_ASCII_CAST_WARNINGS enabled + https://bugs.webkit.org/show_bug.cgi?id=57087 + + Use explicit conversion for string to avoid depending on the default codec + installed by the user code. + + * Api/qwebkitversion.cpp: + (qWebKitVersion): + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + (QWebPage::javaScriptConsoleMessage): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (convertToPropertyName): + (DumpRenderTreeSupportQt::setEditingBehavior): + (DumpRenderTreeSupportQt::plainText): + * WebCoreSupport/EditorClientQt.cpp: + (dumpRange): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (drtDescriptionSuitableForTestResult): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::openInspectorFrontend): + * WebCoreSupport/InspectorServerQt.cpp: + (WebCore::parseWebSocketChallengeNumber): + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + +2011-03-26 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QWebFrame::iconChanged() not emitted when icon is cached but not yet loaded + https://bugs.webkit.org/show_bug.cgi?id=57157 + + Add an IconDatabaseClient for the Qt port to ensure that QWebFrame::iconChanged() + is always emitted when appropriate. + + * QtWebKit.pro: Add new files. + + * WebCoreSupport/IconDatabaseClientQt.h: Added. + * WebCoreSupport/IconDatabaseClientQt.cpp: Added. + (WebCore::IconDatabaseClientQt::instance): + (WebCore::IconDatabaseClientQt::IconDatabaseClientQt): + (WebCore::IconDatabaseClientQt::~IconDatabaseClientQt): + (WebCore::IconDatabaseClientQt::performImport): + (WebCore::IconDatabaseClientQt::didRemoveAllIcons): + (WebCore::IconDatabaseClientQt::didImportIconURLForPageURL): + (WebCore::IconDatabaseClientQt::didImportIconDataForPageURL): + (WebCore::IconDatabaseClientQt::didChangeIconForPageURL): + (WebCore::IconDatabaseClientQt::didFinishURLImport): + + * WebCoreSupport/FrameLoaderClientQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::registerForIconNotification): + (WebCore::FrameLoaderClientQt::onIconLoadedForPageURL): New slot connected + to the IconDatabaseClientQt::iconLoadedForPageURL() signal. This emits the + QWebFrame::iconChanged() signal when the IconDatabases finishes loading + a cached favicon for the frame's URL. + + * Api/qwebsettings.cpp: + (QWebSettings::setIconDatabasePath): Make sure that IconDatabaseClientQt is + instantiated. An IconDatabaseClient has to be registered before the IconDatabase + spawns its reader thread. + +2011-03-25 Andy Estes <aestes@apple.com> + + Reviewed by Adele Peterson. + + REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js + https://bugs.webkit.org/show_bug.cgi?id=49016 + + Update objectContentType() implementation to handle the + shouldPreferPlugInsForImages flag. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::objectContentType): + * WebCoreSupport/FrameLoaderClientQt.h: + +2011-03-25 Chang Shu <cshu@webkit.org> + + Reviewed by Ryosuke Niwa. + + rename Node::isContentEditable and all call sites to rendererIsEditable + https://bugs.webkit.org/show_bug.cgi?id=54290 + + This is part of the effort to separate JS API HTMLElement isContentEditable from + internal Node::rendererIsEditable. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::handleKeyboardEvent): + +2011-03-25 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Andreas Kling. + + [Qt] The keyboard shortcuts during fullscreen playback do not work. + https://bugs.webkit.org/show_bug.cgi?id=57095 + + We need to explicitely set the focus on the widget in order to receive the keyboard events. + + * WebCoreSupport/FullScreenVideoWidget.cpp: + (WebCore::FullScreenVideoWidget::show): + +2011-03-24 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r81916 and r81917. + http://trac.webkit.org/changeset/81916 + http://trac.webkit.org/changeset/81917 + https://bugs.webkit.org/show_bug.cgi?id=57071 + + broke a test on platforms that do not have QuickTime installed + (Requested by estes on #webkit). + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::objectContentType): + * WebCoreSupport/FrameLoaderClientQt.h: + +2011-03-24 Andy Estes <aestes@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r70748): latest nightly builds kills AC_QuickTime.js + https://bugs.webkit.org/show_bug.cgi?id=49016 + + Update objectContentType() implementation to handle the + shouldPreferPlugInsForImages flag. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::objectContentType): + * WebCoreSupport/FrameLoaderClientQt.h: + +2011-03-24 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] When we render WebGL offscreen, color conversion cost a lot of CPU cycles + https://bugs.webkit.org/show_bug.cgi?id=40884 + + Add tests and benchmarks for the software fallback of WebGL. + + * tests/benchmarks/webgl/10000_triangles.html: Added. + * tests/benchmarks/webgl/tst_webgl.cpp: Added. + (GraphicsView::GraphicsView): + (GraphicsView::resizeEvent): + (tst_WebGlPerformance::init): + (tst_WebGlPerformance::cleanup): + (tst_WebGlPerformance::benchSoftwareFallbackRgb16): + (tst_WebGlPerformance::benchSoftwareFallbackRgb32): + (tst_WebGlPerformance::benchSoftwareFallbackArgb32): + (tst_WebGlPerformance::benchSoftwareFallbackArgb32Premultiplied): + (tst_WebGlPerformance::benchmarkFrameRenderingOnImage): + * tests/benchmarks/webgl/tst_webgl.qrc: Added. + * tests/benchmarks/webgl/webgl.pro: Added. + * tests/qgraphicswebview/qgraphicswebview.pro: + * tests/qgraphicswebview/resources/pointing_right.html: Added. + * tests/qgraphicswebview/resources/pointing_up.html: Added. + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (compareImagesFuzzyPixelCount): + (GraphicsView::GraphicsView): + (tst_QGraphicsWebView::webglSoftwareFallbackVerticalOrientation): + (tst_QGraphicsWebView::webglSoftwareFallbackHorizontalOrientation): + (tst_QGraphicsWebView::compareCanvasToImage): + * tests/qgraphicswebview/tst_qgraphicswebview.qrc: + * tests/tests.pro: + +2011-03-24 Kristian Amlie <kristian.amlie@nokia.com> + + Reviewed by Benjamin Poulain. + + Avoided ASCII-cast warnings for WebKit. + + Normally they won't be enabled anyway, but if you build webkit from + within the Qt mother repository it will pick up Qt's default build + settings, which do enable it. We need to disable them because + warnings are treated as errors and there are way too many of them in + the WebKit code. + + [Qt] Avoid ASCII-cast warnings for WebKit. + https://bugs.webkit.org/show_bug.cgi?id=57016 + + * QtWebKit.pro: + +2011-03-24 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Reviewed by Benjamin Poulain. + + [Qt] Resetting the URL property of a QWebView results in the current directory being set as file::-type URL + https://bugs.webkit.org/show_bug.cgi?id=29595 + + Qt Designer resets the URL by setting it to QUrl(). The bug was caused by + ensureAbsoluteUrl() helper function treating the empty URL as a relative URL, and + prepending the current directory. + + By fixing this, now we can pass QUrl() invalid and empty URLs to WebCore layer, which + will end up loading "about:blank", but keeping it as a requested URL. + + This patch also simplifies the logic for requestedUrl(), since m_lastRequestedUrl + is filled for the loaded URLs as well, we can use it in every case. + + Three new autotests were added, to better cover the expected behavior of setting + the QUrl() in a QWebFrame. + + * Api/qwebframe.cpp: + (ensureAbsoluteUrl): do not treat invalid URLs (empty included) as relative. + (QWebFrame::requestedUrl): always use m_lastRequestedUrl. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad): do not clear m_lastRequestedUrl + anymore, since we always rely on it even for loaded frames. + + * tests/qwebframe/tst_qwebframe.cpp: + (tst_QWebFrame::setUrlToEmpty): verify the behavior of setting empty URLs. This includes + the reduction of the bug report. + (tst_QWebFrame::setUrlToInvalid): setting invalid, but not necessarily empty, URLs. + (tst_QWebFrame::setUrlHistory): to verify how setting empty URLs affect history. + +2011-03-23 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Change IconDatabase opening to allow for arbitrary filenames + https://bugs.webkit.org/show_bug.cgi?id=56977 + + * Api/qwebsettings.cpp: + (QWebSettings::setIconDatabasePath): + +2011-03-23 Aparna Nandyal <aparna.nand@wipro.com> + + Reviewed by Andreas Kling. + + [Qt] QtWebKit rendering problem when maximizing and doing a back + https://bugs.webkit.org/show_bug.cgi?id=56669 + + Added an auto test. + Patch by Alexis Menard < alexis.menard@nokia.com> on 2011-03-21 + + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::rendering): + +2011-03-23 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + [V8] Web Inspector: compile DebuggerScript.js into DebuggerScriptSource.h + https://bugs.webkit.org/show_bug.cgi?id=56843 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::openInspectorFrontend): + +2011-03-22 Andrew Wason <rectalogic@rectalogic.com> + + Reviewed by Benjamin Poulain. + + [Qt] QWebPage with WebGL content crashes when rendering if no QWebView parent + https://bugs.webkit.org/show_bug.cgi?id=54138 + + * tests/qwebpage/tst_qwebpage.cpp: + (webGLScreenshotWithoutView): + (tst_QWebPage::acceleratedWebGLScreenshotWithoutView): + (tst_QWebPage::unacceleratedWebGLScreenshotWithoutView): + Render a QWebPage (with and without accelerated compositing) + with a WebGL context that has no owning view. Shouldn't crash. + +2011-03-21 Chang Shu <cshu@webkit.org> + + Reviewed by Alexey Proskuryakov. + + REGRESSION (r79953): Can't type in MS Outlook 2011 + https://bugs.webkit.org/show_bug.cgi?id=56665 + + r79953 removed the WebView level editablity which is persistent no matter whether + underlying document itself is changed and editability gets lost. The resolution is to + set this WebView editable value to WebCore. This avoids the callback from WebCore to + WebKit which was the main goal in r79953 to improve performance. + + * Api/qwebpage.cpp: + (QWebPage::setContentEditable): + (QWebPage::isContentEditable): + +2011-03-19 Andreas Kling <kling@webkit.org> + + Reviewed by Benjamin Poulain. + + [Qt] Remove support for Qt 4.6 + https://bugs.webkit.org/show_bug.cgi?id=56712 + + * Api/qwebframe.cpp: + (QWebFrame::load): + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + * WebCoreSupport/GeolocationClientQt.cpp: + (WebCore::GeolocationClientQt::positionUpdated): + +2011-03-19 Andreas Kling <kling@webkit.org> + + Reviewed by Antonio Gomes. + + [Qt][Doc] QWebPage::unsupportedContent() passes ownership of the QNetworkReply + https://bugs.webkit.org/show_bug.cgi?id=56711 + + Document the fact that when unsupportedContent(QNetworkReply*) is emitted, + ownership of the reply is transferred to the receiving slot. + + * Api/qwebpage.cpp: + +2011-03-17 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=56425 + More groundwork for WebKit2 IconDatabase + + Update already-used function names: + * Api/qwebhistory.cpp: + (QWebHistoryItem::icon): + * Api/qwebsettings.cpp: + (QWebSettings::iconForUrl): + +2011-03-18 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Benjamin Poulain. + + [Qt] console.log not being exposed to QmlViewer + https://bugs.webkit.org/show_bug.cgi?id=56536 + + The documentation is bogus the feature does not exist. + + * declarative/qdeclarativewebview.cpp: + +2011-03-17 Andreas Kling <kling@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] QML WebView emits iconChanged() when the page title changes + https://bugs.webkit.org/show_bug.cgi?id=56570 + + * declarative/qdeclarativewebview.cpp: + (QDeclarativeWebView::setPage): Don't forward the frame's titleChanged + signal to the view's iconChanged signal. + +2011-03-17 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Benjamin Poulain. + + [Qt] Videos look ugly when using QGraphicsWebView. + https://bugs.webkit.org/show_bug.cgi?id=56580 + + We need to set QPainter::SmoothPixmapTransform on the painter for a proper rendering of the video. + QWebView does it but not QGraphicsWebView because the API does not exist. This patch is fixing it + by introducing the same API as QWebView to control the renderHints of the item. Unlike QWebView + QGraphicsWebView inherits the painter from QGraphicsScene and those flags are not set. This patch + ensure that before rendering the item we add QPainter::SmoothPixmapTransform and QPainter::TextAntialiasing + in addition of what could be set on the painter. In order to not break the rendering of all the items in the + scene we set back the painter to its original state when QGraphicsWebView is rendered. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): + (QGraphicsWebView::paint): + (QGraphicsWebView::renderHints): + (QGraphicsWebView::setRenderHints): + (QGraphicsWebView::setRenderHint): + * Api/qgraphicswebview.h: + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::renderHints): + +2011-03-16 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by Kenneth Rohde Christiansen. + + Viewport no longer allows an auto value for "user-scalable" + https://bugs.webkit.org/show_bug.cgi?id=55416 + + Make the default value for userScalable be true. + + * Api/qwebpage.cpp: + (QWebPage::viewportAttributesForSize): + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::viewportAsText): update test output to include userScalable. + +2011-03-15 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Introduce WTF_USE_EXPORT_MACROS, which will allow us to put shared library import/export + info into the headers rather than in export symbol definition files, but disable it on + all platforms initially so we can deal with port build issues one port at a time. + + https://bugs.webkit.org/show_bug.cgi?id=27551 + + * WebCoreSupport/GeolocationClientQt.cpp: + * WebCoreSupport/PopupMenuQt.cpp: + +2011-03-14 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + https://bugs.webkit.org/show_bug.cgi?id=56320 + Remove HistoryItem::icon() and the WebCore dependency on "IconDatabaseBase::defaultIcon()" + + * Api/qwebhistory.cpp: + (QWebHistoryItem::icon): Use IconDatabase directly. + +2011-03-11 Brady Eidson <beidson@apple.com> + + Reviewed by attempt at build fix! + + https://bugs.webkit.org/show_bug.cgi?id=56216 + Fix the Qt build following the same pattern of the patch. + + * Api/qwebsettings.cpp: + (QWebSettings::setIconDatabasePath): Call the static method via IconDatabase:: and not via iconDatabase() + +2011-03-11 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Ariya Hidayat. + + [Qt] Entering fullscreen and leaving it may hide the cursor of the application. + https://bugs.webkit.org/show_bug.cgi?id=56181 + + We need to stop the auto hide cursor timer when closing the widget otherwise the timer + might get fired and therefore hide the cursor even when the fullscreen widget is closed. + + * WebCoreSupport/FullScreenVideoWidget.cpp: + (WebCore::FullScreenVideoWidget::closeEvent): + +2011-03-10 David Boddie <david.boddie@nokia.com> + + Reviewed by Andreas Kling. + + Fixed a qdoc warning and terminology (WebKit instead of Webkit). + https://bugs.webkit.org/show_bug.cgi?id=55756 + + * Api/qwebhistoryinterface.cpp: + +2011-03-10 Andreas Kling <kling@webkit.org> + + Unreviewed build fix after r80774. + + QML property versioning is introduced in Qt 4.7.3, not 4.7.2. + See also: http://bugreports.qt.nokia.com/browse/QTBUG-13451 + + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + * declarative/qdeclarativewebview.cpp: + * declarative/qdeclarativewebview_p.h: + * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: + +2011-03-10 Alexis Menard <alexis.menard@openbossa.org> + + Reviewed by Andreas Kling. + + [Qt] QtDeclarative Webview element has a fixed white background + https://bugs.webkit.org/show_bug.cgi?id=40918 + + Implement a way to change the background color of the WebView QML element. + This feature is activated for QtWebKit 1.1 version of the plugin. + + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + * declarative/qdeclarativewebview.cpp: + (QDeclarativeWebView::backgroundColor): + (QDeclarativeWebView::setBackgroundColor): + * declarative/qdeclarativewebview_p.h: + * tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml: Added. + * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: + (tst_QDeclarativeWebView::backgroundColor): + * tests/qdeclarativewebview/tst_qdeclarativewebview.qrc: + +2011-03-10 Stanislav Paltis <Stanislav.Paltis@nokia.com> + + Reviewed by Laszlo Gombos. + + [Qt] MemoryCache deadDecodedDataDeletionInterval is not exposed for client's usage + https://bugs.webkit.org/show_bug.cgi?id=55945 + + Added handling of dynamic/runtime property _q_deadDecodedDataDeletionInterval to + set interval used to trigger when decoded data in dead list of object cache will + be purged from object cache. + + * Api/qwebpage.cpp: + (QWebPagePrivate::dynamicPropertyChangeEvent): + +2011-03-10 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Reviewed by Antonio Gomes. + + Simplify how QWebFrame::requestedUrl() is obtained + https://bugs.webkit.org/show_bug.cgi?id=55842 + + When a load starts, store the requested URL until we know that it'll be + available for us in the document loader -- after load finished. + + The existing auto tests cover the three different code paths in + requestedUrl() and the new code passes the autotests. In each of those + cases, we looked for the information in a different place, but in all + of them, dispatchDidStartProvisionalLoad was called. + + This simplification will be useful to fix bug 32723. The way requestedUrl() + is implementent, we can't use it as a fallback for url() when the setUrl() + was called with an invalid URL. + + * Api/qwebframe.cpp: + (QWebFrame::requestedUrl): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad): + * WebCoreSupport/FrameLoaderClientQt.h: + (WebCore::FrameLoaderClientQt::lastRequestedUrl): + +2011-03-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Kenneth Rohde Christiansen. + + Tiled backing store's delegated scroll request uses incorrect convention + https://bugs.webkit.org/show_bug.cgi?id=56011 + + Adapt internal API to match the change from delta to point on the + WebCore side, and convert the point to a delta for the public API. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::delegatedScrollRequested): + * WebCoreSupport/ChromeClientQt.h: + +2011-03-09 Peter Kasting <pkasting@google.com> + + Reviewed by Mihai Parparita. + + Unify Windows version checks. + https://bugs.webkit.org/show_bug.cgi?id=55979 + + * Api/qwebpage.cpp: + (QWebPage::userAgentForUrl): + 2011-03-07 Sam Weinig <sam@webkit.org> Reviewed by Anders Carlsson. diff --git a/Source/WebKit/qt/QtWebKit.pro b/Source/WebKit/qt/QtWebKit.pro index 4b7bb05..8836c4a 100644 --- a/Source/WebKit/qt/QtWebKit.pro +++ b/Source/WebKit/qt/QtWebKit.pro @@ -42,6 +42,11 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. contains(QT_CONFIG, embedded):CONFIG += embedded +win32*:!win32-msvc* { + # Make sure OpenGL libs are after the webcore lib so MinGW can resolve symbols + contains(DEFINES, ENABLE_WEBGL=1)|contains(CONFIG, texmap): LIBS += $$QMAKE_LIBS_OPENGL +} + moduleFile=$$PWD/qt_webkit_version.pri isEmpty(QT_BUILD_TREE):include($$moduleFile) VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION} @@ -82,6 +87,7 @@ CONFIG(QTDIR_build) { symbian: TARGET =$$TARGET$${QT_LIBINFIX} } + symbian { TARGET.EPOCALLOWDLLDATA=1 # DRM and Allfiles capabilites need to be audited to be signed on Symbian @@ -215,6 +221,15 @@ contains(DEFINES, ENABLE_VIDEO=1) { } } +contains(DEFINES, ENABLE_ICONDATABASE=1) { + HEADERS += \ + $$SOURCE_DIR/WebCore/loader/icon/IconDatabaseClient.h \ + $$PWD/WebCoreSupport/IconDatabaseClientQt.h + + SOURCES += \ + $$PWD/WebCoreSupport/IconDatabaseClientQt.cpp +} + contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) { HEADERS += \ $$PWD/WebCoreSupport/DeviceMotionClientQt.h \ @@ -238,6 +253,10 @@ contains(DEFINES, ENABLE_GEOLOCATION=1) { $$PWD/WebCoreSupport/GeolocationClientQt.cpp } +contains(CONFIG, texmap) { + DEFINES += WTF_USE_TEXTURE_MAPPER=1 +} + !symbian-abld:!symbian-sbsv2 { modfile.files = $$moduleFile modfile.path = $$[QMAKE_MKSPECS]/modules diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index c784375..bec4bc4 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -411,7 +411,7 @@ void ChromeClientQt::invalidateContentsAndWindow(const IntRect& windowRect, bool if (!rect.isEmpty()) platformPageClient()->update(rect); } - emit m_webPage->repaintRequested(windowRect); + QMetaObject::invokeMethod(m_webPage, "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect)); // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag // is set. @@ -430,9 +430,10 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, } #if ENABLE(TILED_BACKING_STORE) -void ChromeClientQt::delegatedScrollRequested(const IntSize& delta) +void ChromeClientQt::delegatedScrollRequested(const IntPoint& point) { - emit m_webPage->scrollRequested(delta.width(), delta.height(), QRect(QPoint(0, 0), m_webPage->viewportSize())); + QPoint currentPosition(m_webPage->mainFrame()->scrollPosition()); + emit m_webPage->scrollRequested(point.x() - currentPosition.x(), point.y() - currentPosition.y(), QRect(QPoint(0, 0), m_webPage->viewportSize())); } #endif diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 27327ef..a12c2ec 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -120,7 +120,7 @@ namespace WebCore { virtual void invalidateContentsForSlowScroll(const IntRect&, bool); virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); #if ENABLE(TILED_BACKING_STORE) - virtual void delegatedScrollRequested(const IntSize& scrollDelta); + virtual void delegatedScrollRequested(const IntPoint& scrollPoint); #endif virtual IntPoint screenToWindow(const IntPoint&) const; diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index c0017a2..ba712d1 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -531,7 +531,7 @@ QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listIt static QString convertToPropertyName(const QString& name) { - QStringList parts = name.split('-'); + QStringList parts = name.split(QLatin1Char('-')); QString camelCaseName; for (int j = 0; j < parts.count(); ++j) { QString part = parts.at(j); @@ -626,11 +626,11 @@ void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& { WebCore::EditingBehaviorType coreEditingBehavior; - if (editingBehavior == "win") + if (editingBehavior == QLatin1String("win")) coreEditingBehavior = EditingWindowsBehavior; - else if (editingBehavior == "mac") + else if (editingBehavior == QLatin1String("mac")) coreEditingBehavior = EditingMacBehavior; - else if (editingBehavior == "unix") + else if (editingBehavior == QLatin1String("unix")) coreEditingBehavior = EditingUnixBehavior; else { ASSERT_NOT_REACHED(); @@ -742,12 +742,13 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c availableSize); QString res; - res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f]\n", + res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", conf.layoutSize.width(), conf.layoutSize.height(), conf.initialScale, conf.minimumScale, - conf.maximumScale); + conf.maximumScale, + conf.userScalable); return res; } @@ -922,10 +923,10 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti QString DumpRenderTreeSupportQt::plainText(const QVariant& range) { QMap<QString, QVariant> map = range.toMap(); - QVariant startContainer = map.value("startContainer"); + QVariant startContainer = map.value(QLatin1String("startContainer")); map = startContainer.toMap(); - return map.value("innerText").toString(); + return map.value(QLatin1String("innerText")).toString(); } QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) @@ -949,6 +950,7 @@ QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, return res; } +// API Candidate? QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame) { WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); @@ -1038,6 +1040,18 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const return res; } +// API Candidate? +void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl) +{ + KURL kurl(baseUrl); + WebCore::Frame* coreFrame = QWebFramePrivate::core(frame); + WebCore::ResourceRequest request(kurl); + const QByteArray utf8 = html.toUtf8(); + WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length()); + WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl); + coreFrame->loader()->load(request, substituteData, false); +} + // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame) diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 1e7b275..78752d8 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -198,6 +198,7 @@ public: static void setMinimumTimerInterval(QWebPage*, double); static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId); + static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl); }; #endif diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index cf2fa41..e7bbd2c 100644 --- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -76,9 +76,9 @@ static QString dumpRange(WebCore::Range *range) return QLatin1String("(null)"); WebCore::ExceptionCode code; - QString str = QString("range from %1 of %2 to %3 of %4") - .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code))) - .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code))); + QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4") + .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code))) + .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code))); return str; } @@ -420,7 +420,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) return; // FIXME: refactor all of this to use Actions or something like them - if (start->isContentEditable()) { + if (start->rendererIsEditable()) { bool doSpatialNavigation = false; if (isSpatialNavigationEnabled(frame)) { if (!kevent->modifiers()) { @@ -530,8 +530,22 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) #endif // QT_NO_SHORTCUT } -void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*) +void EditorClientQt::handleInputMethodKeydown(KeyboardEvent* event) { +#ifndef QT_NO_SHORTCUT + const PlatformKeyboardEvent* kevent = event->keyEvent(); + if (kevent->type() == PlatformKeyboardEvent::RawKeyDown) { + QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent()); + switch (action) { + case QWebPage::InsertParagraphSeparator: + case QWebPage::InsertLineSeparator: + m_page->triggerAction(action); + break; + default: + break; + } + } +#endif } EditorClientQt::EditorClientQt(QWebPage* page) diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 5cab6a7..d318494 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2011 Apple Inc. All rights reserved. * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008 Collabora Ltd. All rights reserved. * Coypright (C) 2008 Holger Hans Peter Freyther @@ -40,6 +40,9 @@ #include "FrameView.h" #include "DocumentLoader.h" #include "HitTestResult.h" +#if ENABLE(ICONDATABASE) +#include "IconDatabaseClientQt.h" +#endif #if USE(JSC) #include "JSDOMWindowBase.h" #elif USE(V8) @@ -119,7 +122,7 @@ static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url) if (_url.isEmpty() || !_url.isLocalFile()) return _url.string(); // Remove the leading path from file urls - return QString(_url.string()).replace(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath, "").mid(1); + return QString(_url.string()).remove(WebCore::FrameLoaderClientQt::dumpResourceLoadCallbacksPath).mid(1); } static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error) @@ -147,17 +150,17 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n { QString result; if (exception) { - result.append("ERROR"); + result.append(QLatin1String("ERROR")); return result; } if (!node) { - result.append("NULL"); + result.append(QLatin1String("NULL")); return result; } result.append(node->nodeName()); RefPtr<WebCore::Node> parent = node->parentNode(); if (parent) { - result.append(" > "); + result.append(QLatin1String(" > ")); result.append(drtDescriptionSuitableForTestResult(parent, 0)); } return result; @@ -437,6 +440,8 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad() if (dumpUserGestureInFrameLoaderCallbacks) printf("%s - in didStartProvisionalLoadForFrame\n", qPrintable(drtPrintFrameUserGestureStatus(m_frame))); + m_lastRequestedUrl = m_frame->loader()->activeDocumentLoader()->requestURL(); + if (m_webFrame) emit m_webFrame->provisionalLoad(); } @@ -481,7 +486,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad() // We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle() // will be called very soon with the correct title. // This properly resets the title when we navigate to a URI without a title. - emit titleChanged(String()); + emit titleChanged(QString()); bool isMainFrame = (m_frame == m_frame->page()->mainFrame()); if (!isMainFrame) @@ -769,11 +774,25 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const m_webFrame->page()->d->updateNavigationActions(); } -void FrameLoaderClientQt::registerForIconNotification(bool) +void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister) { - notImplemented(); +#if ENABLE(ICONDATABASE) + if (shouldRegister) + connect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString)), Qt::UniqueConnection); + else + disconnect(IconDatabaseClientQt::instance(), SIGNAL(iconLoadedForPageURL(QString)), this, SLOT(onIconLoadedForPageURL(QString))); +#endif } +void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url) +{ +#if ENABLE(ICONDATABASE) + if (m_webFrame && m_webFrame->url() == url) + emit m_webFrame->iconChanged(); +#endif +} + + void FrameLoaderClientQt::updateGlobalHistory() { QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface(); @@ -1210,7 +1229,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n", qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()), - (node) ? qPrintable(QString(" originating from " + drtDescriptionSuitableForTestResult(node, 0))) : ""); + (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : ""); if (policyDelegatePermissive) result = PolicyUse; @@ -1310,18 +1329,18 @@ void FrameLoaderClientQt::transferLoadingResourceFromPage(unsigned long, Documen { } -ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType) +ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& mimeTypeIn, bool shouldPreferPlugInsForImages) { -// qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<_mimeType; +// qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<mimeTypeIn; QFileInfo fi(url.path()); String extension = fi.suffix(); - if (_mimeType == "application/x-qt-plugin" || _mimeType == "application/x-qt-styled-widget") + if (mimeTypeIn == "application/x-qt-plugin" || mimeTypeIn == "application/x-qt-styled-widget") return ObjectContentOtherPlugin; - if (url.isEmpty() && !_mimeType.length()) + if (url.isEmpty() && !mimeTypeIn.length()) return ObjectContentNone; - String mimeType = _mimeType; + String mimeType = mimeTypeIn; if (!mimeType.length()) mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension); @@ -1331,14 +1350,17 @@ ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const if (!mimeType.length()) return ObjectContentFrame; - if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) - return ObjectContentImage; - + ObjectContentType plugInType = ObjectContentNone; if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType)) - return ObjectContentNetscapePlugin; - - if (m_frame->page() && m_frame->page()->pluginData() && m_frame->page()->pluginData()->supportsMimeType(mimeType)) - return ObjectContentOtherPlugin; + plugInType = ObjectContentNetscapePlugin; + else if (m_frame->page() && m_frame->page()->pluginData() && m_frame->page()->pluginData()->supportsMimeType(mimeType)) + plugInType = ObjectContentOtherPlugin; + + if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) + return shouldPreferPlugInsForImages && plugInType != ObjectContentNone ? plugInType : ObjectContentImage; + + if (plugInType != ObjectContentNone) + return plugInType; if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) return ObjectContentFrame; diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index e5be421..3ec5f20 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006, 2011 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008 Collabora Ltd. All rights reserved. * @@ -211,7 +211,7 @@ public: virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); - virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); + virtual ObjectContentType objectContentType(const KURL&, const String& mimeTypeIn, bool shouldPreferPlugInsForImages); virtual String overrideMediaType() const; virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*); @@ -239,6 +239,8 @@ public: virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); + const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; } + static bool dumpFrameLoaderCallbacks; static bool dumpUserGestureInFrameLoaderCallbacks; static bool dumpResourceLoadCallbacks; @@ -253,6 +255,9 @@ public: static bool dumpHistoryCallbacks; static QMap<QString, QString> URLsToRedirect; +private slots: + void onIconLoadedForPageURL(const QString&); + private: Frame *m_frame; QWebFrame *m_webFrame; @@ -267,6 +272,7 @@ private: // See finishedLoading(). bool m_hasRepresentation; + KURL m_lastRequestedUrl; ResourceError m_loadError; }; diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp index 4922cd7..bb5e2b9 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp @@ -66,6 +66,7 @@ void FullScreenVideoWidget::show(QMediaPlayer* player) setMouseTracking(true); raise(); m_mediaPlayer->setVideoOutput(this); + setFocus(); grabMouse(); hideCursor(); } @@ -73,6 +74,7 @@ void FullScreenVideoWidget::show(QMediaPlayer* player) void FullScreenVideoWidget::closeEvent(QCloseEvent* event) { m_mediaPlayer = 0; + m_cursorTimer.stop(); setMouseTracking(false); releaseMouse(); QApplication::restoreOverrideCursor(); diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp index 68a2af5..3c382cf 100644 --- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp @@ -82,12 +82,7 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo &geoPosition) bool providesSpeed = geoPosition.hasAttribute(QGeoPositionInfo::GroundSpeed); double speed = geoPosition.attribute(QGeoPositionInfo::GroundSpeed); -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) double timeStampInSeconds = geoPosition.timestamp().toMSecsSinceEpoch() / 1000; -#else - QDateTime datetime = geoPosition.timestamp(); - double timeStampInSeconds = (datetime.toTime_t() + datetime.time().msec()) / 1000; -#endif m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude, accuracy, providesAltitude, altitude, @@ -140,3 +135,5 @@ void GeolocationClientQt::cancelPermissionRequest(Geolocation* geolocation) } } // namespace WebCore + +#include "moc_GeolocationClientQt.cpp" diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp new file mode 100644 index 0000000..77b41db --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011 Andreas Kling <kling@webkit.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IconDatabaseClientQt.h" + +#include "FrameLoaderClientQt.h" +#include "IconDatabaseBase.h" +#include <wtf/text/CString.h> + +namespace WebCore { + +IconDatabaseClientQt* IconDatabaseClientQt::instance() +{ + static IconDatabaseClientQt* client = 0; + if (!client) { + client = new IconDatabaseClientQt; + iconDatabase().setClient(client); + } + return client; +} + +IconDatabaseClientQt::IconDatabaseClientQt() +{ +} + +IconDatabaseClientQt::~IconDatabaseClientQt() +{ +} + +bool IconDatabaseClientQt::performImport() +{ + return true; +} + +void IconDatabaseClientQt::didRemoveAllIcons() +{ +} + +void IconDatabaseClientQt::didImportIconURLForPageURL(const String& url) +{ +} + +void IconDatabaseClientQt::didImportIconDataForPageURL(const String& url) +{ + emit iconLoadedForPageURL(url); +} + +void IconDatabaseClientQt::didChangeIconForPageURL(const String& url) +{ +} + +void IconDatabaseClientQt::didFinishURLImport() +{ +} + +} + +#include "moc_IconDatabaseClientQt.cpp" diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h new file mode 100644 index 0000000..593fdd3 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011 Andreas Kling <kling@webkit.org> + * + * 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 IconDatabaseClientQt_h +#define IconDatabaseClientQt_h + +#include "IconDatabaseClient.h" +#include <QtCore/QObject> + +namespace WebCore { + +class IconDatabaseClientQt : public QObject, public IconDatabaseClient { + Q_OBJECT +public: + static IconDatabaseClientQt* instance(); + + virtual bool performImport(); + virtual void didRemoveAllIcons(); + virtual void didImportIconURLForPageURL(const String&); + virtual void didImportIconDataForPageURL(const String&); + virtual void didChangeIconForPageURL(const String&); + virtual void didFinishURLImport(); + +signals: + void iconLoadedForPageURL(const QString&); + +private: + IconDatabaseClientQt(); + virtual ~IconDatabaseClientQt(); +}; + +} + +#endif diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 441add6..6b557db 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -140,7 +140,7 @@ public: QVariant valueToStore = settingToVariant(value); QString settingKey(settingStoragePrefix + QString(name)); qsettings.setValue(settingKey, valueToStore); - qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type())); + qsettings.setValue(settingKey + settingStorageTypeSuffix, QLatin1String(QVariant::typeToName(valueToStore.type()))); #endif // QT_NO_SETTINGS } @@ -174,22 +174,6 @@ private: } -#if USE(V8) -static void ensureDebuggerScriptLoaded() -{ - static bool scriptLoaded = false; - if (scriptLoaded) - return; - - QFile debuggerScriptFile(":/webkit/inspector/DebuggerScript.js"); - if (debuggerScriptFile.open(QIODevice::ReadOnly)) { - QByteArray ba = debuggerScriptFile.readAll(); - ScriptDebugServer::shared().setDebuggerScriptSource(String(ba.constData(), ba.length())); - scriptLoaded = true; - } -} -#endif - InspectorClientQt::InspectorClientQt(QWebPage* page) : m_inspectedWebPage(page) , m_frontendWebPage(0) @@ -218,10 +202,6 @@ void InspectorClientQt::inspectorDestroyed() void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* inspectorController) { #if ENABLE(INSPECTOR) -#if USE(V8) - ensureDebuggerScriptLoaded(); -#endif - QWebView* inspectorView = new QWebView; InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); inspectorView->setPage(inspectorPage); @@ -240,7 +220,7 @@ void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* insp inspectorUrl = inspector->property("_q_inspectorUrl").toUrl(); #endif if (!inspectorUrl.isValid()) - inspectorUrl = QUrl("qrc:/webkit/inspector/inspector.html"); + inspectorUrl = QUrl(QLatin1String("qrc:/webkit/inspector/inspector.html")); #ifndef QT_NO_PROPERTIES QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects"); diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index f83deb2..92b7d5c 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -73,11 +73,10 @@ static quint32 parseWebSocketChallengeNumber(QString field) int numSpaces = 0; for (int i = 0; i < field.size(); i++) { QChar c = field[i]; - if (c == (QChar)' ') { + if (c == QLatin1Char(' ')) numSpaces++; - } else if ((c >= (QChar)'0') && (c <= (QChar)'9')) { - nString.append((QChar)c); - } + else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9'))) + nString.append(c); } quint32 num = nString.toLong(); quint32 result = (numSpaces ? (num / numSpaces) : num); @@ -195,7 +194,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() m_path = header.path(); m_contentType = header.contentType().toLatin1(); m_contentLength = header.contentLength(); - if (header.hasKey("Upgrade") && (header.value("Upgrade") == QLatin1String("WebSocket"))) + if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket"))) isWebSocket = true; m_data.clear(); @@ -204,9 +203,9 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() } if (m_endOfHeaders) { - QStringList pathAndQuery = m_path.split("?"); + QStringList pathAndQuery = m_path.split(QLatin1Char('?')); m_path = pathAndQuery[0]; - QStringList words = m_path.split(QString::fromLatin1("/")); + QStringList words = m_path.split(QLatin1Char('/')); if (isWebSocket) { // switch to websocket-style WebSocketService messaging @@ -216,18 +215,18 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() QByteArray key3 = m_tcpConnection->read(8); - quint32 number1 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key1")); - quint32 number2 = parseWebSocketChallengeNumber(header.value("Sec-WebSocket-Key2")); + quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1"))); + quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2"))); char responseData[16]; generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData); QByteArray response(responseData, sizeof(responseData)); - QHttpResponseHeader responseHeader(101, "WebSocket Protocol Handshake", 1, 1); - responseHeader.setValue("Upgrade", header.value("Upgrade")); - responseHeader.setValue("Connection", header.value("Connection")); - responseHeader.setValue("Sec-WebSocket-Origin", header.value("Origin")); - responseHeader.setValue("Sec-WebSocket-Location", ("ws://" + header.value("Host") + m_path)); + QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1); + responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade"))); + responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection"))); + responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin"))); + responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path)); responseHeader.setContentLength(response.size()); m_tcpConnection->write(responseHeader.toString().toLatin1()); m_tcpConnection->write(response); @@ -259,19 +258,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() QString text = QString::fromLatin1("OK"); // If no path is specified, generate an index page. - if ((m_path == "") || (m_path == "/")) { - QString indexHtml = "<html><head><title>Remote Web Inspector</title></head><body><ul>\n"; + if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) { + QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n"); for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); it != m_server->m_inspectorClients.end(); ++it) { - indexHtml.append(QString("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n") + indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n") .arg(it.key()) .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString())); } - indexHtml.append("</ul></body></html>"); + indexHtml.append(QLatin1String("</ul></body></html>")); response = indexHtml.toLatin1(); } else { - QString path = QString(":%1").arg(m_path); + QString path = QString::fromLatin1(":%1").arg(m_path); QFile file(path); // It seems that there should be an enum or define for these status codes somewhere in Qt or WebKit, // but grep fails to turn one up. diff --git a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp index f7c4edc..b662f5c 100644 --- a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp @@ -44,6 +44,10 @@ public: virtual int itemCount() const { return d ? d->listSize() : 0; } virtual bool itemIsSelected(int idx) const { return d ? d->itemIsSelected(idx) : false; } virtual bool multiple() const; + virtual QColor backgroundColor() const { return d ? QColor(d->menuStyle().backgroundColor()) : QColor(); } + virtual QColor foregroundColor() const { return d ? QColor(d->menuStyle().foregroundColor()) : QColor(); } + virtual QColor itemBackgroundColor(int idx) const { return d ? QColor(d->itemStyle(idx).backgroundColor()) : QColor(); } + virtual QColor itemForegroundColor(int idx) const { return d ? QColor(d->itemStyle(idx).foregroundColor()) : QColor(); } private: WebCore::PopupMenuClient*& d; @@ -157,4 +161,6 @@ void PopupMenuQt::selectItem(int index, bool ctrl, bool shift) } +#include "moc_PopupMenuQt.cpp" + // vim: ts=4 sw=4 et diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp index afa6492..5e641de 100644 --- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp @@ -124,6 +124,17 @@ void QtFallbackWebPopup::show(const QWebSelectData& data) populate(data); + QColor backgroundColor = data.backgroundColor(); + QColor foregroundColor = data.foregroundColor(); + + QPalette palette = m_combo->palette(); + if (backgroundColor.isValid()) + palette.setColor(QPalette::Background, backgroundColor); + if (foregroundColor.isValid()) + palette.setColor(QPalette::Foreground, foregroundColor); + m_combo->setPalette(palette); + + QRect rect = geometry(); if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(pageClient()->pluginParent())) { QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget(webView); @@ -235,6 +246,8 @@ void QtFallbackWebPopup::populate(const QWebSelectData& data) #ifndef QT_NO_TOOLTIP model->item(i)->setToolTip(data.itemToolTip(i)); #endif + model->item(i)->setBackground(data.itemBackgroundColor(i)); + model->item(i)->setForeground(data.itemForegroundColor(i)); if (data.itemIsSelected(i)) currentIndex = i; break; diff --git a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp index fffb564..182fe38 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp +++ b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp @@ -332,7 +332,7 @@ String WebPlatformStrategies::contextMenuItemTagSearchWeb() return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item"); } -String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary() +String WebPlatformStrategies::contextMenuItemTagLookUpInDictionary(const String&) { return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item"); } diff --git a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h index fbcfd16..b74af39 100644 --- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h +++ b/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h @@ -86,7 +86,7 @@ private: virtual WTF::String contextMenuItemTagIgnoreSpelling(); virtual WTF::String contextMenuItemTagLearnSpelling(); virtual WTF::String contextMenuItemTagSearchWeb(); - virtual WTF::String contextMenuItemTagLookUpInDictionary(); + virtual WTF::String contextMenuItemTagLookUpInDictionary(const String&); virtual WTF::String contextMenuItemTagOpenLink(); virtual WTF::String contextMenuItemTagIgnoreGrammar(); virtual WTF::String contextMenuItemTagSpellingMenu(); diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index f1f165e..49af415 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -32,6 +32,11 @@ public: Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit")); qmlRegisterType<QDeclarativeWebSettings>(); qmlRegisterType<QDeclarativeWebView>(uri, 1, 0, "WebView"); +#if QT_VERSION >= 0x040703 + qmlRegisterType<QDeclarativeWebView>(uri, 1, 1, "WebView"); + qmlRegisterRevision<QDeclarativeWebView, 0>("QtWebKit", 1, 0); + qmlRegisterRevision<QDeclarativeWebView, 1>("QtWebKit", 1, 1); +#endif } }; diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp index 9313d6c..83645aa 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -517,13 +517,12 @@ void QDeclarativeWebView::geometryChanged(const QRectF& newGeometry, const QRect } } - html: "<script>console.log(\"This is in WebKit!\"); window.qml.qmlCall();</script>" + html: "<script>window.qml.qmlCall();</script>" } \endqml The output of the example will be: \code - This is in WebKit! This call is in QML! \endcode @@ -772,7 +771,6 @@ void QDeclarativeWebView::setPage(QWebPage* page) page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); connect(page->mainFrame(), SIGNAL(urlChanged(QUrl)), this, SLOT(pageUrlChanged())); connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); - connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged())); connect(page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize))); @@ -983,6 +981,29 @@ void QDeclarativeWebView::setContentsScale(qreal scale) emit contentsScaleChanged(); } +#if QT_VERSION >= 0x040703 +/*! + \qmlproperty color WebView::backgroundColor + \since QtWebKit 1.1 + This property holds the background color of the view. +*/ + +QColor QDeclarativeWebView::backgroundColor() const +{ + return d->view->palette().base().color(); +} + +void QDeclarativeWebView::setBackgroundColor(const QColor& color) +{ + QPalette palette = d->view->palette(); + if (palette.base().color() == color) + return; + palette.setBrush(QPalette::Base, color); + d->view->setPalette(palette); + emit backgroundColorChanged(); +} +#endif + /*! Returns the area of the largest element at position (\a x,\a y) that is no larger than \a maxWidth by \a maxHeight pixels. diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h index ca15a1e..05f35f6 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h +++ b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h @@ -123,6 +123,9 @@ class QDeclarativeWebView : public QDeclarativeItem { Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged) Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged) +#if QT_VERSION >= 0x040703 + Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 1) +#endif public: QDeclarativeWebView(QDeclarativeItem *parent = 0); @@ -193,6 +196,11 @@ public: void setContentsScale(qreal scale); qreal contentsScale() const; +#if QT_VERSION >= 0x040703 + Q_REVISION(1) QColor backgroundColor() const; + Q_REVISION(1) void setBackgroundColor(const QColor&); +#endif + Q_SIGNALS: void preferredWidthChanged(); void preferredHeightChanged(); @@ -209,6 +217,9 @@ Q_SIGNALS: void renderingEnabledChanged(); void contentsSizeChanged(const QSize&); void contentsScaleChanged(); +#if QT_VERSION >= 0x040703 + void backgroundColorChanged(); +#endif void loadStarted(); void loadFinished(); diff --git a/Source/WebKit/qt/tests/benchmarks/webgl/10000_triangles.html b/Source/WebKit/qt/tests/benchmarks/webgl/10000_triangles.html new file mode 100644 index 0000000..fd061aa --- /dev/null +++ b/Source/WebKit/qt/tests/benchmarks/webgl/10000_triangles.html @@ -0,0 +1,59 @@ +<html> + <body style="margin: 0"> + <canvas width="1000" height="1000"></canvas> + </body> +</html> +<script> + var canvas = document.getElementsByTagName("canvas")[0]; + gl = canvas.getContext("experimental-webgl"); + gl.clearColor(0.0, 1.0, 0.0, 1.0); + gl.viewport(0, 0, canvas.width, canvas.height); + + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, "attribute vec4 vPosition;\nvoid main() { gl_Position = vPosition; }"); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }"); + gl.compileShader(fragmentShader); + + var shaderProgram = gl.createProgram(); + gl.attachShader(shaderProgram, vertexShader); + gl.attachShader(shaderProgram, fragmentShader); + gl.bindAttribLocation(shaderProgram, 0, "vPosition"); + gl.linkProgram(shaderProgram); + + gl.useProgram(shaderProgram); + + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + + var vertices = []; + var seedX = -1.0; + var seedY = 1.0; + for (var i = 1; i <= 10000; ++i) { + vertices.push(seedX); + vertices.push(seedY); + vertices.push(0); + seedX += 0.01; + vertices.push(seedX); + vertices.push(seedY - 0.02); + vertices.push(0); + seedX += 0.01; + vertices.push(seedX); + vertices.push(seedY); + vertices.push(0); + if (!(i % 100)) { + seedX = -1.0; + seedY -= 0.02; + } + } + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + + + gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); + gl.enableVertexAttribArray(0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.drawArrays(gl.TRIANGLES, 0, 30000); + gl.flush(); +</script> diff --git a/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.cpp b/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.cpp new file mode 100644 index 0000000..bd865a2 --- /dev/null +++ b/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.cpp @@ -0,0 +1,130 @@ +/* + Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include "../../util.h" +#include <QGLWidget> +#include <QGraphicsView> +#include <QGraphicsWebView> +#include <QScopedPointer> +#include <QWebFrame> +#include <QtTest/QtTest> + +class GraphicsView; + +class tst_WebGlPerformance : public QObject { + Q_OBJECT + +private slots: + void init(); + void cleanup(); + + void benchSoftwareFallbackRgb16(); + void benchSoftwareFallbackRgb32(); + void benchSoftwareFallbackArgb32(); + void benchSoftwareFallbackArgb32Premultiplied(); + +private: + void benchmarkFrameRenderingOnImage(QImage::Format); + + QScopedPointer<GraphicsView> m_view; +}; + +class GraphicsView : public QGraphicsView { +public: + GraphicsView(); + QGraphicsWebView* m_webView; + +protected: + void resizeEvent(QResizeEvent*); +}; + +GraphicsView::GraphicsView() +{ + QGraphicsScene* const scene = new QGraphicsScene(this); + setScene(scene); + + m_webView = new QGraphicsWebView; + scene->addItem(m_webView); + + m_webView->page()->settings()->setAttribute(QWebSettings::WebGLEnabled, true); + + resize(800, 600); + setFrameShape(QFrame::NoFrame); + setViewport(new QGLWidget); +} + +void GraphicsView::resizeEvent(QResizeEvent* event) +{ + QGraphicsView::resizeEvent(event); + QRectF rect(QPoint(0, 0), event->size()); + m_webView->setGeometry(rect); + scene()->setSceneRect(rect); +} + +void tst_WebGlPerformance::init() +{ + m_view.reset(new GraphicsView); + m_view->showMaximized(); + QTest::qWaitForWindowShown(m_view.data()); +} + +void tst_WebGlPerformance::cleanup() +{ + m_view.reset(); +} + +void tst_WebGlPerformance::benchSoftwareFallbackRgb16() +{ + benchmarkFrameRenderingOnImage(QImage::Format_RGB16); +} + +void tst_WebGlPerformance::benchSoftwareFallbackRgb32() +{ + benchmarkFrameRenderingOnImage(QImage::Format_RGB32); +} + +void tst_WebGlPerformance::benchSoftwareFallbackArgb32() +{ + benchmarkFrameRenderingOnImage(QImage::Format_ARGB32); +} + +void tst_WebGlPerformance::benchSoftwareFallbackArgb32Premultiplied() +{ + benchmarkFrameRenderingOnImage(QImage::Format_ARGB32_Premultiplied); +} + +void tst_WebGlPerformance::benchmarkFrameRenderingOnImage(QImage::Format format) +{ + m_view->m_webView->load(QUrl(QLatin1String("qrc:///testcases/10000_triangles.html"))); + const bool pageLoaded = waitForSignal(m_view->m_webView, SIGNAL(loadFinished(bool))); + Q_ASSERT(pageLoaded); + Q_UNUSED(pageLoaded); + + QImage target(m_view->size(), format); + QBENCHMARK { + QPainter painter(&target); + m_view->render(&painter); + painter.end(); + } +} + +QTEST_MAIN(tst_WebGlPerformance) + +#include "tst_webgl.moc" diff --git a/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.qrc b/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.qrc new file mode 100644 index 0000000..b849448 --- /dev/null +++ b/Source/WebKit/qt/tests/benchmarks/webgl/tst_webgl.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/testcases"> + <file>10000_triangles.html</file> + </qresource> +</RCC> diff --git a/Source/WebKit/qt/tests/benchmarks/webgl/webgl.pro b/Source/WebKit/qt/tests/benchmarks/webgl/webgl.pro new file mode 100644 index 0000000..fb21bc8 --- /dev/null +++ b/Source/WebKit/qt/tests/benchmarks/webgl/webgl.pro @@ -0,0 +1,4 @@ +isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../../.. +include(../../tests.pri) +exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc +QT += opengl diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml new file mode 100644 index 0000000..2edc794 --- /dev/null +++ b/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml @@ -0,0 +1,10 @@ +import Qt 4.7 +import QtWebKit 1.1 + +WebView { + id: myweb + height: 300 + width: 300 + focus: true + backgroundColor : "red" +} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp index 0025d6c..8fcab71 100644 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -1,4 +1,5 @@ #include "../util.h" +#include <QColor> #include <QDebug> #include <QDeclarativeComponent> #include <QDeclarativeEngine> @@ -22,6 +23,9 @@ private slots: void preferredHeightTest(); void preferredWidthDefaultTest(); void preferredHeightDefaultTest(); +#if QT_VERSION >= 0x040703 + void backgroundColor(); +#endif private: void checkNoErrors(const QDeclarativeComponent&); @@ -82,6 +86,36 @@ void tst_QDeclarativeWebView::preferredHeightDefaultTest() QCOMPARE(wv->property("prefHeight").toDouble(), view.preferredHeight()); } +#if QT_VERSION >= 0x040703 +void tst_QDeclarativeWebView::backgroundColor() +{ + // We test here the rendering of the background. + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewbackgroundcolor.qml")); + checkNoErrors(component); + QObject* wv = component.create(); + QVERIFY(wv); + QCOMPARE(wv->property("backgroundColor").value<QColor>(), QColor(Qt::red)); + QDeclarativeView view; + view.setSource(QUrl("qrc:///resources/webviewbackgroundcolor.qml")); + view.show(); + QTest::qWaitForWindowShown(&view); + QPixmap result(view.width(), view.height()); + QPainter painter(&result); + view.render(&painter); + QPixmap reference(view.width(), view.height()); + reference.fill(Qt::red); + QCOMPARE(reference, result); + + // We test the emission of the backgroundColorChanged signal. + QSignalSpy spyColorChanged(wv, SIGNAL(backgroundColorChanged())); + wv->setProperty("backgroundColor", Qt::red); + QCOMPARE(spyColorChanged.count(), 0); + wv->setProperty("backgroundColor", Qt::green); + QCOMPARE(spyColorChanged.count(), 1); +} +#endif + void tst_QDeclarativeWebView::checkNoErrors(const QDeclarativeComponent& component) { // Wait until the component is ready diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc index 9c27409..e14c333 100644 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc +++ b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc @@ -3,5 +3,6 @@ <file>resources/webviewtestdefault.qml</file> <file>resources/webviewtest.qml</file> <file>resources/sample.html</file> + <file>resources/webviewbackgroundcolor.qml</file> </qresource> </RCC> diff --git a/Source/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/Source/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro index e915d60..e5494ae 100644 --- a/Source/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro +++ b/Source/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro @@ -1,3 +1,6 @@ isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../../../.. include(../tests.pri) exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc +contains(DEFINES, ENABLE_WEBGL=1) { + QT += opengl +} diff --git a/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_right.html b/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_right.html new file mode 100644 index 0000000..bc592fb --- /dev/null +++ b/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_right.html @@ -0,0 +1,45 @@ +<html> + <body style="margin: 0"> + <canvas width="100" height="100"></canvas> + </body> +</html> +<script> + var canvas = document.getElementsByTagName("canvas")[0]; + gl = canvas.getContext("experimental-webgl"); + gl.clearColor(0.0, 1.0, 0.0, 1.0); + gl.viewport(0, 0, canvas.width, canvas.height); + + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, "attribute vec4 vPosition;\nvoid main() { gl_Position = vPosition; }"); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }"); + gl.compileShader(fragmentShader); + + var shaderProgram = gl.createProgram(); + gl.attachShader(shaderProgram, vertexShader); + gl.attachShader(shaderProgram, fragmentShader); + gl.bindAttribLocation(shaderProgram, 0, "vPosition"); + gl.linkProgram(shaderProgram); + + gl.useProgram(shaderProgram); + + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + + var vertices = [-1.0, -1.0, + 0.0, 0.0, + -1.0, 1.0]; + var seedX = -1.0; + var seedY = 1.0; + vertices + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + + + gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0); + gl.enableVertexAttribArray(0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.drawArrays(gl.TRIANGLES, 0, 3); + gl.flush(); +</script> diff --git a/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_up.html b/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_up.html new file mode 100644 index 0000000..474a56d --- /dev/null +++ b/Source/WebKit/qt/tests/qgraphicswebview/resources/pointing_up.html @@ -0,0 +1,46 @@ +<html> + <body style="margin: 0"> + <canvas width="100" height="100"></canvas> + </body> +</html> +<script> + var canvas = document.getElementsByTagName("canvas")[0]; + gl = canvas.getContext("experimental-webgl"); + gl.clearColor(0.0, 1.0, 0.0, 1.0); + gl.viewport(0, 0, canvas.width, canvas.height); + + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, "attribute vec4 vPosition;\nvoid main() { gl_Position = vPosition; }"); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }"); + gl.compileShader(fragmentShader); + + var shaderProgram = gl.createProgram(); + gl.attachShader(shaderProgram, vertexShader); + gl.attachShader(shaderProgram, fragmentShader); + gl.bindAttribLocation(shaderProgram, 0, "vPosition"); + gl.linkProgram(shaderProgram); + + gl.useProgram(shaderProgram); + + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + + var vertices = [-1.0, -1.0, + 0.0, 0.0, + 1.0, -1.0]; + var seedX = -1.0; + var seedY = 1.0; + vertices + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + + + gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0); + gl.enableVertexAttribArray(0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.drawArrays(gl.TRIANGLES, 0, 3); + gl.flush(); + gl.finish(); +</script> diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index f8a4359..7cc88db 100644 --- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -25,6 +25,10 @@ #include <qwebpage.h> #include <qwebframe.h> +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL +#include <QGLWidget> +#endif + class tst_QGraphicsWebView : public QObject { Q_OBJECT @@ -38,6 +42,15 @@ private slots: void widgetsRenderingThroughCache(); void setPalette_data(); void setPalette(); + void renderHints(); + +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL + void webglSoftwareFallbackVerticalOrientation(); + void webglSoftwareFallbackHorizontalOrientation(); + +private: + void compareCanvasToImage(const QUrl&, const QImage&); +#endif }; void tst_QGraphicsWebView::qgraphicswebview() @@ -191,9 +204,9 @@ void tst_QGraphicsWebView::microFocusCoordinates() page->mainFrame()->setHtml("<html><body>" \ "<input type='text' id='input1' style='font--family: serif' value='' maxlength='20'/><br>" \ - "<canvas id='canvas1' width='500' height='500'/>" \ + "<canvas id='canvas1' width='500' height='500'></canvas>" \ "<input type='password'/><br>" \ - "<canvas id='canvas2' width='500' height='500'/>" \ + "<canvas id='canvas2' width='500' height='500'></canvas>" \ "</body></html>"); page->mainFrame()->setFocus(); @@ -409,6 +422,146 @@ void tst_QGraphicsWebView::setPalette() QVERIFY(img1 != img2); } +void tst_QGraphicsWebView::renderHints() +{ + QGraphicsWebView webView; + + // default is only text antialiasing + smooth pixmap transform + QVERIFY(!(webView.renderHints() & QPainter::Antialiasing)); + QVERIFY(webView.renderHints() & QPainter::TextAntialiasing); + QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform); + QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); + + webView.setRenderHint(QPainter::Antialiasing, true); + QVERIFY(webView.renderHints() & QPainter::Antialiasing); + QVERIFY(webView.renderHints() & QPainter::TextAntialiasing); + QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform); + QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); + + webView.setRenderHint(QPainter::Antialiasing, false); + QVERIFY(!(webView.renderHints() & QPainter::Antialiasing)); + QVERIFY(webView.renderHints() & QPainter::TextAntialiasing); + QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform); + QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); + + webView.setRenderHint(QPainter::SmoothPixmapTransform, true); + QVERIFY(!(webView.renderHints() & QPainter::Antialiasing)); + QVERIFY(webView.renderHints() & QPainter::TextAntialiasing); + QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform); + QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); + + webView.setRenderHint(QPainter::SmoothPixmapTransform, false); + QVERIFY(webView.renderHints() & QPainter::TextAntialiasing); + QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform)); + QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing)); +} + +class GraphicsView : public QGraphicsView { +public: + GraphicsView(); + QGraphicsWebView* m_webView; +}; + +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL +bool compareImagesFuzzyPixelCount(const QImage& image1, const QImage& image2, qreal tolerance = 0.05) +{ + if (image1.size() != image2.size()) + return false; + + unsigned diffPixelCount = 0; + for (int row = 0; row < image1.size().width(); ++row) { + for (int column = 0; column < image1.size().height(); ++column) + if (image1.pixel(row, column) != image2.pixel(row, column)) + ++diffPixelCount; + } + + if (diffPixelCount > (image1.size().width() * image1.size().height()) * tolerance) + return false; + + return true; +} + +GraphicsView::GraphicsView() +{ + QGraphicsScene* const scene = new QGraphicsScene(this); + setScene(scene); + + m_webView = new QGraphicsWebView; + scene->addItem(m_webView); + + m_webView->page()->settings()->setAttribute(QWebSettings::WebGLEnabled, true); + m_webView->setResizesToContents(true); + + setFrameShape(QFrame::NoFrame); + setViewport(new QGLWidget); +} + +void tst_QGraphicsWebView::webglSoftwareFallbackVerticalOrientation() +{ + QSize canvasSize(100, 100); + QImage reference(canvasSize, QImage::Format_ARGB32); + reference.fill(0xFF00FF00); + { // Reference. + QPainter painter(&reference); + QPolygonF triangleUp; + triangleUp << QPointF(0, canvasSize.height()) + << QPointF(canvasSize.width(), canvasSize.height()) + << QPointF(canvasSize.width() / 2.0, canvasSize.height() / 2.0); + painter.setPen(Qt::NoPen); + painter.setBrush(Qt::red); + painter.drawPolygon(triangleUp); + } + + compareCanvasToImage(QUrl(QLatin1String("qrc:///resources/pointing_up.html")), reference); +} + +void tst_QGraphicsWebView::webglSoftwareFallbackHorizontalOrientation() +{ + QSize canvasSize(100, 100); + QImage reference(canvasSize, QImage::Format_ARGB32); + reference.fill(0xFF00FF00); + { // Reference. + QPainter painter(&reference); + QPolygonF triangleUp; + triangleUp << QPointF(0, 0) + << QPointF(0, canvasSize.height()) + << QPointF(canvasSize.width() / 2.0, canvasSize.height() / 2.0); + painter.setPen(Qt::NoPen); + painter.setBrush(Qt::red); + painter.drawPolygon(triangleUp); + } + + compareCanvasToImage(QUrl(QLatin1String("qrc:///resources/pointing_right.html")), reference); +} + +void tst_QGraphicsWebView::compareCanvasToImage(const QUrl& url, const QImage& reference) +{ + GraphicsView view; + view.show(); + QTest::qWaitForWindowShown(&view); + + QGraphicsWebView* const graphicsWebView = view.m_webView; + graphicsWebView->load(url); + QVERIFY(waitForSignal(graphicsWebView, SIGNAL(loadFinished(bool)))); + { // Force a render, to create the accelerated compositing tree. + QPixmap pixmap(view.size()); + QPainter painter(&pixmap); + view.render(&painter); + } + QApplication::syncX(); + + const QSize imageSize = reference.size(); + + QImage target(imageSize, QImage::Format_ARGB32); + { // Web page content. + QPainter painter(&target); + QRectF renderRect(0, 0, imageSize.width(), imageSize.height()); + view.scene()->render(&painter, renderRect, renderRect); + } + QVERIFY(compareImagesFuzzyPixelCount(target, reference, 0.01)); +} +#endif + QTEST_MAIN(tst_QGraphicsWebView) #include "tst_qgraphicswebview.moc" diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc index c91bb9c..1488fcf 100644 --- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc +++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc @@ -1,6 +1,7 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>resources/input_types.html</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>resources/input_types.html</file> + <file>resources/pointing_right.html</file> + <file>resources/pointing_up.html</file> + </qresource> </RCC> - diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index bc1594a..2c44e4c 100644 --- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -650,6 +650,9 @@ private slots: void setCacheLoadControlAttribute(); void setUrlWithPendingLoads(); void setUrlWithFragment(); + void setUrlToEmpty(); + void setUrlToInvalid(); + void setUrlHistory(); private: QString evalJS(const QString&s) { @@ -3340,5 +3343,148 @@ void tst_QWebFrame::setUrlWithFragment() QCOMPARE(page.mainFrame()->url(), url); } +void tst_QWebFrame::setUrlToEmpty() +{ + int expectedLoadFinishedCount = 0; + const QUrl aboutBlank("about:blank"); + const QUrl url("qrc:/test2.html"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + QCOMPARE(frame->url(), QUrl()); + QCOMPARE(frame->requestedUrl(), QUrl()); + QCOMPARE(frame->baseUrl(), QUrl()); + + QSignalSpy spy(frame, SIGNAL(loadFinished(bool))); + + // Set existing url + frame->setUrl(url); + expectedLoadFinishedCount++; + ::waitForSignal(frame, SIGNAL(loadFinished(bool))); + + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(frame->baseUrl(), url); + + // Set empty url + frame->setUrl(QUrl()); + expectedLoadFinishedCount++; + + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), aboutBlank); + QCOMPARE(frame->requestedUrl(), QUrl()); + QCOMPARE(frame->baseUrl(), aboutBlank); + + // Set existing url + frame->setUrl(url); + expectedLoadFinishedCount++; + ::waitForSignal(frame, SIGNAL(loadFinished(bool))); + + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(frame->baseUrl(), url); + + // Load empty url + frame->load(QUrl()); + expectedLoadFinishedCount++; + + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), aboutBlank); + QCOMPARE(frame->requestedUrl(), QUrl()); + QCOMPARE(frame->baseUrl(), aboutBlank); +} + +void tst_QWebFrame::setUrlToInvalid() +{ + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + const QUrl invalidUrl("http://strange;hostname/here"); + QVERIFY(!invalidUrl.isEmpty()); + QVERIFY(!invalidUrl.isValid()); + QVERIFY(invalidUrl != QUrl()); + + frame->setUrl(invalidUrl); + QCOMPARE(frame->url(), invalidUrl); + QCOMPARE(frame->requestedUrl(), invalidUrl); + QCOMPARE(frame->baseUrl(), invalidUrl); + + // QUrls equivalent to QUrl() will be treated as such. + const QUrl aboutBlank("about:blank"); + const QUrl anotherInvalidUrl("1http://bugs.webkit.org"); + QVERIFY(!anotherInvalidUrl.isEmpty()); // and they are not necessarily empty. + QVERIFY(!anotherInvalidUrl.isValid()); + QCOMPARE(anotherInvalidUrl, QUrl()); + + frame->setUrl(anotherInvalidUrl); + QCOMPARE(frame->url(), aboutBlank); + QCOMPARE(frame->requestedUrl(), anotherInvalidUrl); + QCOMPARE(frame->baseUrl(), aboutBlank); +} + +void tst_QWebFrame::setUrlHistory() +{ + const QUrl aboutBlank("about:blank"); + QUrl url; + int expectedLoadFinishedCount = 0; + QWebFrame* frame = m_page->mainFrame(); + QSignalSpy spy(frame, SIGNAL(loadFinished(bool))); + + QCOMPARE(m_page->history()->count(), 0); + + frame->setUrl(QUrl()); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), aboutBlank); + QCOMPARE(frame->requestedUrl(), QUrl()); + QCOMPARE(m_page->history()->count(), 0); + + url = QUrl("http://non.existant/"); + frame->setUrl(url); + ::waitForSignal(m_page, SIGNAL(loadFinished(bool))); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(m_page->history()->count(), 0); + + url = QUrl("qrc:/test1.html"); + frame->setUrl(url); + ::waitForSignal(m_page, SIGNAL(loadFinished(bool))); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(m_page->history()->count(), 1); + + frame->setUrl(QUrl()); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), aboutBlank); + QCOMPARE(frame->requestedUrl(), QUrl()); + QCOMPARE(m_page->history()->count(), 1); + + // Loading same page as current in history, so history count doesn't change. + url = QUrl("qrc:/test1.html"); + frame->setUrl(url); + ::waitForSignal(m_page, SIGNAL(loadFinished(bool))); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(m_page->history()->count(), 1); + + url = QUrl("qrc:/test2.html"); + frame->setUrl(url); + ::waitForSignal(m_page, SIGNAL(loadFinished(bool))); + expectedLoadFinishedCount++; + QCOMPARE(spy.count(), expectedLoadFinishedCount); + QCOMPARE(frame->url(), url); + QCOMPARE(frame->requestedUrl(), url); + QCOMPARE(m_page->history()->count(), 2); +} + QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 4417ac5..d43b2de 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -126,6 +126,11 @@ private slots: void screenshot_data(); void screenshot(); +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL + void acceleratedWebGLScreenshotWithoutView(); + void unacceleratedWebGLScreenshotWithoutView(); +#endif + void originatingObjectInNetworkRequests(); void testJSPrompt(); void showModalDialog(); @@ -135,6 +140,7 @@ private slots: void infiniteLoopJS(); void navigatorCookieEnabled(); void deleteQWebViewTwice(); + void renderOnRepaintRequestedShouldNotRecurse(); #ifdef Q_OS_MAC void macCopyUnicodeToClipboard(); @@ -2117,6 +2123,28 @@ void tst_QWebPage::inputMethods() clickOnPage(page, inputElement.geometry().center()); QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); + + // START - Newline test for textarea + qApp->processEvents(); + page->mainFrame()->setHtml("<html><body>" \ + "<textarea rows='5' cols='1' id='input5' value=''/>" \ + "</body></html>"); + page->mainFrame()->evaluateJavaScript("var inputEle = document.getElementById('input5'); inputEle.focus(); inputEle.select();"); + QKeyEvent keyEnter(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); + page->event(&keyEnter); + QList<QInputMethodEvent::Attribute> attribs; + + QInputMethodEvent eventText("\n", attribs); + page->event(&eventText); + + QInputMethodEvent eventText2("third line", attribs); + page->event(&eventText2); + qApp->processEvents(); + + QString inputValue2 = page->mainFrame()->evaluateJavaScript("document.getElementById('input5').value").toString(); + QCOMPARE(inputValue2, QString("\n\nthird line")); + // END - Newline test for textarea + delete container; } @@ -2473,6 +2501,33 @@ void tst_QWebPage::screenshot() QDir::setCurrent(QApplication::applicationDirPath()); } +#if defined(ENABLE_WEBGL) && ENABLE_WEBGL +// https://bugs.webkit.org/show_bug.cgi?id=54138 +static void webGLScreenshotWithoutView(bool accelerated) +{ + QWebPage page; + page.settings()->setAttribute(QWebSettings::WebGLEnabled, true); + page.settings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, accelerated); + QWebFrame* mainFrame = page.mainFrame(); + mainFrame->setHtml("<html><body>" + "<canvas id='webgl' width='300' height='300'></canvas>" + "<script>document.getElementById('webgl').getContext('experimental-webgl')</script>" + "</body></html>"); + + takeScreenshot(&page); +} + +void tst_QWebPage::acceleratedWebGLScreenshotWithoutView() +{ + webGLScreenshotWithoutView(true); +} + +void tst_QWebPage::unacceleratedWebGLScreenshotWithoutView() +{ + webGLScreenshotWithoutView(false); +} +#endif + void tst_QWebPage::originatingObjectInNetworkRequests() { TestNetworkManager* networkManager = new TestNetworkManager(m_page); @@ -2766,5 +2821,54 @@ void tst_QWebPage::deleteQWebViewTwice() } } +class RepaintRequestedRenderer : public QObject { + Q_OBJECT +public: + RepaintRequestedRenderer(QWebPage* page, QPainter* painter) + : m_page(page) + , m_painter(painter) + , m_recursionCount(0) + { + connect(m_page, SIGNAL(repaintRequested(QRect)), this, SLOT(onRepaintRequested(QRect))); + } + +signals: + void finished(); + +private slots: + void onRepaintRequested(const QRect& rect) + { + QCOMPARE(m_recursionCount, 0); + + m_recursionCount++; + m_page->mainFrame()->render(m_painter, rect); + m_recursionCount--; + + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); + } + +private: + QWebPage* m_page; + QPainter* m_painter; + int m_recursionCount; +}; + +void tst_QWebPage::renderOnRepaintRequestedShouldNotRecurse() +{ + QSize viewportSize(720, 576); + QWebPage page; + + QImage image(viewportSize, QImage::Format_ARGB32); + QPainter painter(&image); + + page.setPreferredContentsSize(viewportSize); + page.setViewportSize(viewportSize); + RepaintRequestedRenderer r(&page, &painter); + + page.mainFrame()->setHtml("zalan loves trunk", QUrl()); + + QVERIFY(::waitForSignal(&r, SIGNAL(finished()))); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 533d4e5..c7600fc 100644 --- a/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/Source/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -42,6 +42,7 @@ public slots: void cleanup(); private slots: + void renderingAfterMaxAndBack(); void renderHints(); void getWebKitVersion(); @@ -207,9 +208,9 @@ void tst_QWebView::microFocusCoordinates() page->mainFrame()->setHtml("<html><body>" \ "<input type='text' id='input1' style='font--family: serif' value='' maxlength='20'/><br>" \ - "<canvas id='canvas1' width='500' height='500'/>" \ + "<canvas id='canvas1' width='500' height='500'></canvas>" \ "<input type='password'/><br>" \ - "<canvas id='canvas2' width='500' height='500'/>" \ + "<canvas id='canvas2' width='500' height='500'></canvas>" \ "</body></html>"); page->mainFrame()->setFocus(); @@ -438,6 +439,63 @@ void tst_QWebView::setPalette() QVERIFY(img1 != img2); } +void tst_QWebView::renderingAfterMaxAndBack() +{ + QUrl url = QUrl("data:text/html,<html><head></head>" + "<body width=1024 height=768 bgcolor=red>" + "</body>" + "</html>"); + + QWebView view; + view.page()->mainFrame()->load(url); + QVERIFY(waitForSignal(&view, SIGNAL(loadFinished(bool)))); + view.show(); + + view.page()->settings()->setMaximumPagesInCache(3); + + QTest::qWaitForWindowShown(&view); + + QPixmap reference(view.page()->viewportSize()); + reference.fill(Qt::red); + + QPixmap image(view.page()->viewportSize()); + QPainter painter(&image); + view.page()->currentFrame()->render(&painter); + + QCOMPARE(image, reference); + + QUrl url2 = QUrl("data:text/html,<html><head></head>" + "<body width=1024 height=768 bgcolor=blue>" + "</body>" + "</html>"); + view.page()->mainFrame()->load(url2); + + QVERIFY(waitForSignal(&view, SIGNAL(loadFinished(bool)))); + + view.showMaximized(); + + QTest::qWaitForWindowShown(&view); + + QPixmap reference2(view.page()->viewportSize()); + reference2.fill(Qt::blue); + + QPixmap image2(view.page()->viewportSize()); + QPainter painter2(&image2); + view.page()->currentFrame()->render(&painter2); + + QCOMPARE(image2, reference2); + + view.back(); + + QPixmap reference3(view.page()->viewportSize()); + reference3.fill(Qt::red); + QPixmap image3(view.page()->viewportSize()); + QPainter painter3(&image3); + view.page()->currentFrame()->render(&painter3); + + QCOMPARE(image3, reference3); +} + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/Source/WebKit/qt/tests/tests.pri b/Source/WebKit/qt/tests/tests.pri index bb519eb..ebb6f8e 100644 --- a/Source/WebKit/qt/tests/tests.pri +++ b/Source/WebKit/qt/tests/tests.pri @@ -32,3 +32,5 @@ symbian { # This define is used by some tests to look up resources in the source tree !symbian: DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\" +DEFINES -= QT_ASCII_CAST_WARNINGS + diff --git a/Source/WebKit/qt/tests/tests.pro b/Source/WebKit/qt/tests/tests.pro index e5b7408..529fa04 100644 --- a/Source/WebKit/qt/tests/tests.pro +++ b/Source/WebKit/qt/tests/tests.pro @@ -3,3 +3,6 @@ TEMPLATE = subdirs SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory qwebinspector hybridPixmap contains(QT_CONFIG, declarative): SUBDIRS += qdeclarativewebview SUBDIRS += benchmarks/painting benchmarks/loading +contains(DEFINES, ENABLE_WEBGL=1) { + SUBDIRS += benchmarks/webgl +} |