diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit')
30 files changed, 1578 insertions, 640 deletions
diff --git a/src/3rdparty/webkit/WebKit/ChangeLog b/src/3rdparty/webkit/WebKit/ChangeLog index 2f8f18f..607a039 100644 --- a/src/3rdparty/webkit/WebKit/ChangeLog +++ b/src/3rdparty/webkit/WebKit/ChangeLog @@ -1,3 +1,136 @@ +2009-10-19 John Gregg <johnnyg@google.com> + + Reviewed by Dimitri Glazkov. + + set ENABLE_NOTIFICATIONS=1 for Chromium + https://bugs.webkit.org/show_bug.cgi?id=29949 + + * chromium/features.gypi: + +2009-10-13 Drew Wilson <atwilson@atwilson-macpro.local> + + Reviewed by David Levin. + + Enable SHARED_WORKERS for Chromium + https://bugs.webkit.org/show_bug.cgi?id=30289 + + * chromium/features.gypi: + Turned on ENABLE_SHARED_WORKERS by default. This doesn't actually turn on + SharedWorkers yet, as Chromium overrides this flag in its feature_overrides.gypi. + +2009-10-12 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Chromium Port - Windows + https://bugs.webkit.org/show_bug.cgi?id=29969 + + * chromium/DEPS: Added gtest dep required by windows and incremented some of the deps revisions. + +2009-10-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Mark Rowe. + + accessibility/media-element.html crashes (and has incorrect result) + https://bugs.webkit.org/show_bug.cgi?id=30108 + + Fix up the accessibilty label for the newly added fullscreen button, + and update the test result accordingly. + + * English.lproj/Localizable.strings: + +2009-10-05 Kevin Decker <kdecker@apple.com> + + Reviewed by Dan Bernstein. + + * WebKit.xcodeproj/project.pbxproj: Add WebPluginHalterClient to the project. + +2009-10-05 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + One of the dependencies' SVN url was missing a @ before the revision number. + + https://bugs.webkit.org/show_bug.cgi?id=30101 + + * chromium/DEPS: + +2009-10-05 Pierre d'Herbemont <pdherbemont@webkit.org> + + Reviewed by Simon Fraser + + Support fullscreen in MediaPlayer (Mac) + https://bugs.webkit.org/show_bug.cgi?id=26742 + + Add new files for video fullscreen. + + * WebKit.xcodeproj/project.pbxproj: + +2009-10-05 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: add testing harness for Web Inspector. + + https://bugs.webkit.org/show_bug.cgi?id=30010 + + * WebKit.xcodeproj/project.pbxproj: + +2009-10-04 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Eric Seidel + + Enable Web Sockets in chromium build. + https://bugs.webkit.org/show_bug.cgi?id=29917 + + * chromium/features.gypi: + +2009-10-02 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added gyp_webkit that does a subset of the things gyp_chromium does + plus some specialization for an upstream chromium build. + + https://bugs.webkit.org/show_bug.cgi?id=29986 + + * chromium/DEPS: Points to gyp_webkit instead of gyp_chromium. + * chromium/gyp_webkit: A new python file. + +2009-10-01 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Make it possible to override the list of feature defines when building + downstream. + + https://bugs.webkit.org/show_bug.cgi?id=29979 + + * chromium/features.gypi: + +2009-10-01 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + Added windows-specific dependencies, updated some revisions and + re-organized file to make revision tracking easier. Also removed + extensions/v8 dependency that is no longer needed upstream. + + https://bugs.webkit.org/show_bug.cgi?id=29973 + + * chromium/DEPS: + +2009-09-30 Yaar Schnitman <yaar@chromium.org> + + Reviewed by Dimitri Glazkov. + + 1. Keeping up with downstream revisions. + 2. Turning off v8 snapshot build step. + + https://bugs.webkit.org/show_bug.cgi?id=29928 + + * chromium/DEPS + 2009-09-29 Brady Eidson <beidson@apple.com> Reviewed by John Sullivan. diff --git a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig index 3229ab5..6572d2c 100644 --- a/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig +++ b/src/3rdparty/webkit/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 532; -MINOR_VERSION = 1; +MINOR_VERSION = 3; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index b11890d..7e485a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -49,11 +50,16 @@ public: virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); #endif +#ifndef QT_NO_CURSOR virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); +#endif + virtual QPalette palette() const; virtual int screenNumber() const; - virtual WId winId() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; void _q_doLoadProgress(int progress); void _q_doLoadFinished(bool success); @@ -83,10 +89,7 @@ void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success) if (q->title().isEmpty()) emit q->urlChanged(q->url()); - if (success) - emit q->loadFinished(); - else - emit q->loadFailed(); + emit q->loadFinished(success); } void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) @@ -99,11 +102,11 @@ void QGraphicsWebViewPrivate::update(const QRect & dirtyRect) q->update(QRectF(dirtyRect)); } + void QGraphicsWebViewPrivate::setInputMethodEnabled(bool enable) { q->setAttribute(Qt::WA_InputMethodEnabled, enable); } - #if QT_VERSION >= 0x040600 void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) { @@ -113,7 +116,7 @@ void QGraphicsWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool q->setInputMethodHints(q->inputMethodHints() & ~hint); } #endif - +#ifndef QT_NO_CURSOR QCursor QGraphicsWebViewPrivate::cursor() const { return q->cursor(); @@ -123,6 +126,12 @@ void QGraphicsWebViewPrivate::updateCursor(const QCursor& cursor) { q->setCursor(cursor); } +#endif + +QPalette QGraphicsWebViewPrivate::palette() const +{ + return q->palette(); +} int QGraphicsWebViewPrivate::screenNumber() const { @@ -136,14 +145,15 @@ int QGraphicsWebViewPrivate::screenNumber() const return 0; } -WId QGraphicsWebViewPrivate::winId() const +QWidget* QGraphicsWebViewPrivate::ownerWidget() const { const QList<QGraphicsView*> views = q->scene()->views(); + return views.value(0); +} - if (!views.isEmpty()) - return views.at(0)->winId(); - - return 0; +QObject* QGraphicsWebViewPrivate::pluginParent() const +{ + return q; } void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) @@ -185,8 +195,10 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) */ QGraphicsWebView::~QGraphicsWebView() { - if (d->page) + if (d->page) { d->page->d->view = 0; + d->page->d->client = 0; // unset the page client + } if (d->page && d->page->parent() == this) delete d->page; @@ -239,21 +251,38 @@ bool QGraphicsWebView::event(QEvent* event) // Re-implemented in order to allows fixing event-related bugs in patch releases. if (d->page) { +#ifndef QT_NO_CONTEXTMENU + if (event->type() == QEvent::GraphicsSceneContextMenu) { + if (!isEnabled()) + return false; + + QGraphicsSceneContextMenuEvent* ev = static_cast<QGraphicsSceneContextMenuEvent*>(event); + QContextMenuEvent fakeEvent(QContextMenuEvent::Reason(ev->reason()), ev->pos().toPoint()); + if (d->page->swallowContextMenuEvent(&fakeEvent)) { + event->accept(); + return true; + } + d->page->updatePositionDependentActions(fakeEvent.pos()); + } else +#endif // QT_NO_CONTEXTMENU + { #ifndef QT_NO_CURSOR #if QT_VERSION >= 0x040400 - } else if (event->type() == QEvent::CursorChange) { - // An unsetCursor will set the cursor to Qt::ArrowCursor. - // Thus this cursor change might be a QWidget::unsetCursor() - // If this is not the case and it came from WebCore, the - // QWebPageClient already has set its cursor internally - // to Qt::ArrowCursor, so updating the cursor is always - // right, as it falls back to the last cursor set by - // WebCore. - // FIXME: Add a QEvent::CursorUnset or similar to Qt. - if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + if (event->type() == QEvent::CursorChange) { + // An unsetCursor will set the cursor to Qt::ArrowCursor. + // Thus this cursor change might be a QWidget::unsetCursor() + // If this is not the case and it came from WebCore, the + // QWebPageClient already has set its cursor internally + // to Qt::ArrowCursor, so updating the cursor is always + // right, as it falls back to the last cursor set by + // WebCore. + // FIXME: Add a QEvent::CursorUnset or similar to Qt. + if (cursor().shape() == Qt::ArrowCursor) + d->resetCursor(); + } #endif #endif + } } return QGraphicsWidget::event(event); } @@ -608,7 +637,6 @@ void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev) QMouseEvent me = QMouseEvent(QEvent::MouseMove, ev->pos().toPoint(), Qt::NoButton, Qt::NoButton, Qt::NoModifier); - d->page->setView(ev->widget()); d->page->event(&me); ev->setAccepted(accepted); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h index a8478d8..26f7374 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h @@ -95,8 +95,7 @@ public Q_SLOTS: Q_SIGNALS: void loadStarted(); - void loadFinished(); - void loadFailed(); + void loadFinished(bool); void progressChanged(qreal); void interactivityChanged(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 939d881..5b83870 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -30,12 +30,14 @@ #include "Document.h" #include "DocumentFragment.h" #include "FrameView.h" +#include "GraphicsContext.h" #include "HTMLElement.h" #include "JSGlobalObject.h" #include "JSHTMLElement.h" #include "JSObject.h" #include "NodeList.h" #include "PropertyNameArray.h" +#include "RenderImage.h" #include "ScriptFunctionCall.h" #include "StaticNodeList.h" #include "qt_runtime.h" @@ -45,6 +47,8 @@ #include <parser/SourceCode.h> #include <wtf/Vector.h> +#include <QPainter> + using namespace WebCore; class QWebElementPrivate { @@ -1411,3 +1415,38 @@ QWebElement QWebElement::enclosingElement(WebCore::Node* node) Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false. */ + + +/*! + Render the element into \a painter . +*/ +void QWebElement::render(QPainter* painter) +{ + WebCore::Element* e = m_element; + Document* doc = e ? e->document() : 0; + if (!doc) + return; + + Frame* frame = doc->frame(); + if (!frame || !frame->view() || !frame->contentRenderer()) + return; + + FrameView* view = frame->view(); + + view->layoutIfNeededRecursive(); + + IntRect rect = e->getRect(); + + if (rect.size().isEmpty()) + return; + + GraphicsContext context(painter); + + context.save(); + context.translate(-rect.x(), -rect.y()); + view->setNodeToDraw(e); + view->paintContents(&context, rect); + view->setNodeToDraw(0); + context.restore(); +} + diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h index 3db4637..351ccb4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h @@ -31,6 +31,10 @@ namespace WebCore { class Node; } +QT_BEGIN_NAMESPACE +class QPainter; +QT_END_NAMESPACE + class QWebFrame; class QWebElementPrivate; @@ -133,6 +137,8 @@ public: QString styleProperty(const QString& name, StyleResolveStrategy strategy) const; void setStyleProperty(const QString& name, const QString& value); + void render(QPainter* painter); + private: explicit QWebElement(WebCore::Element*); explicit QWebElement(WebCore::Node*); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 780f862..d2c324d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -540,15 +540,26 @@ QUrl QWebFrame::url() const */ QUrl QWebFrame::requestedUrl() const { - // In the following edge cases (where the failing document - // loader does not get commited by the frame loader) it is - // safer to rely on outgoingReferrer than originalRequest. - if (!d->frame->loader()->activeDocumentLoader() - || (!d->frameLoaderClient->m_loadError.isNull() - && !d->frame->loader()->outgoingReferrer().isEmpty())) - return QUrl(d->frame->loader()->outgoingReferrer()); + // 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 d->frame->loader()->originalRequest().url(); + return loader->originalRequest().url(); } /*! \since 4.6 @@ -710,7 +721,9 @@ void QWebFrame::load(const QNetworkRequest &req, script can be specified through the charset attribute of the HTML script tag. It is also possible for the encoding to be specified by web server. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setContent() */ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) { @@ -718,7 +731,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) 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, WebCore::String("text/html"), WebCore::String("utf-8"), kurl); + WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), KURL()); d->frame->loader()->load(request, substituteData, false); } @@ -731,7 +744,9 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl) The \a data is loaded immediately; external objects are loaded asynchronously. - \sa toHtml() + \note This method will not affect session or global history for the frame. + + \sa toHtml(), setHtml() */ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl) { @@ -741,11 +756,10 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons QString actualMimeType = mimeType; if (actualMimeType.isEmpty()) actualMimeType = QLatin1String("text/html"); - WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), kurl); + WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), KURL()); d->frame->loader()->load(request, substituteData, false); } - /*! Returns the parent frame of this frame, or 0 if the frame is the web pages main frame. @@ -1248,7 +1262,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) ScriptController *proxy = d->frame->script(); QVariant rc; if (proxy) { - JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); + JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue(); int distance = 0; rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 655fd0e..31d193e 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -271,7 +271,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) { WebCore::InitializeLoggingChannelsIfNecessary(); JSC::initializeThreading(); - WebCore::FrameLoader::setLocalLoadPolicy(WebCore::FrameLoader::AllowLocalLoadsForLocalAndSubstituteData); + WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData); chromeClient = new ChromeClientQt(q); contextMenuClient = new ContextMenuClientQt(); @@ -279,9 +279,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) page = new Page(chromeClient, contextMenuClient, editorClient, new DragClientQt(q), new InspectorClientQt(q), 0); - // ### should be configurable - page->settings()->setDefaultTextEncodingName("iso-8859-1"); - settings = new QWebSettings(page->settings()); #ifndef QT_NO_UNDOSTACK @@ -461,10 +458,10 @@ void QWebPagePrivate::updateAction(QWebPage::WebAction action) switch (action) { case QWebPage::Back: - enabled = loader->canGoBackOrForward(-1); + enabled = page->canGoBackOrForward(-1); break; case QWebPage::Forward: - enabled = loader->canGoBackOrForward(1); + enabled = page->canGoBackOrForward(1); break; case QWebPage::Stop: enabled = loader->isLoading(); @@ -584,8 +581,6 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev) void QWebPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -606,8 +601,6 @@ void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev) void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -663,8 +656,6 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev) void QWebPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -750,8 +741,6 @@ void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button) void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -833,8 +822,6 @@ QMenu *QWebPage::createStandardContextMenu() #ifndef QT_NO_WHEELEVENT void QWebPagePrivate::wheelEvent(QGraphicsSceneWheelEvent* ev) { - q->setView(ev->widget()); - WebCore::Frame* frame = QWebFramePrivate::core(mainFrame); if (!frame->view()) return; @@ -990,8 +977,6 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent*) void QWebPagePrivate::dragEnterEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); @@ -1016,8 +1001,6 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev) void QWebPagePrivate::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone); page->dragController()->dragExited(&dragData); @@ -1036,8 +1019,6 @@ void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent* ev) void QWebPagePrivate::dragMoveEvent(QGraphicsSceneDragDropEvent* ev) { - q->setView(ev->widget()); - #ifndef QT_NO_DRAGANDDROP DragData dragData(ev->mimeData(), ev->pos().toPoint(), QCursor::pos(), dropActionToDragOp(ev->possibleActions())); @@ -1863,7 +1844,7 @@ void QWebPage::triggerAction(WebAction action, bool) WTF::RefPtr<WebCore::Frame> wcFrame = targetFrame->d->frame; targetFrame->d->frame->loader()->loadFrameRequest(frameLoadRequest(d->hitTestResult.linkUrl(), wcFrame.get()), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, - /*FormState*/ 0); + /*FormState*/ 0, SendReferrer); break; } // fall through @@ -1975,7 +1956,7 @@ void QWebPage::setViewportSize(const QSize &size) const } } -QSize QWebPage::fixedContentsSize() const +QSize QWebPage::preferredContentsSize() const { QWebFrame* frame = d->mainFrame; if (frame) { @@ -1988,7 +1969,7 @@ QSize QWebPage::fixedContentsSize() const } /*! - \property QWebPage::fixedContentsSize + \property QWebPage::preferredContentsSize \since 4.6 \brief the size of the fixed layout @@ -1996,7 +1977,7 @@ QSize QWebPage::fixedContentsSize() const 1024x768 for example then webkit will layout the page as if the viewport were that size rather than something different. */ -void QWebPage::setFixedContentsSize(const QSize &size) const +void QWebPage::setPreferredContentsSize(const QSize &size) const { d->fixedLayoutSize = size; @@ -2684,6 +2665,43 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos) */ /*! + \class QWebPage::ErrorPageExtensionOption + \since 4.6 + \brief The ErrorPageExtensionOption class describes the option + for the error page extension. + + \inmodule QtWebKit + + The ErrorPageExtensionOption class holds the \a url for which an error occoured as well as + the associated \a frame. + + The error itself is reported by an error \a domain, the \a error code as well as \a errorString. + + \sa QWebPage::ErrorPageExtensionReturn +*/ + +/*! + \class QWebPage::ErrorPageExtensionReturn + \since 4.6 + \brief The ErrorPageExtensionReturn describes the error page, which will be shown for the + frame for which the error occured. + + \inmodule QtWebKit + + The ErrorPageExtensionReturn class holds the data needed for creating an error page. Some are + optional such as \a contentType, which defaults to "text/html", as well as the \a encoding, which + is assumed to be UTF-8 if not indicated otherwise. + + The error page is stored in the \a content byte array, as HTML content. In order to convert a + QString to a byte array, the QString::toUtf8() method can be used. + + External objects such as stylesheets or images referenced in the HTML are located relative to + \a baseUrl. + + \sa QWebPage::ErrorPageExtensionOption, QString::toUtf8() +*/ + +/*! \class QWebPage::ChooseMultipleFilesExtensionOption \since 4.5 \brief The ChooseMultipleFilesExtensionOption class describes the option @@ -2850,6 +2868,9 @@ QNetworkProxy QWebPage::networkProxy() const Sets the QNetworkAccessManager \a manager responsible for serving network requests for this QWebPage. + \note It is currently not supported to change the network access manager after the + QWebPage has used it. The results of doing this are undefined. + \sa networkAccessManager() */ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager) @@ -3359,6 +3380,16 @@ quint64 QWebPage::bytesReceived() const */ /*! + \since 4.6 + \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + \preliminary + + This signal is emitted when a \a frame of the current page requests a web resource. The application + may want to associate the \a request with the \a frame that initiated it by storing the \a frame + as an attribute of the \a request. +*/ + +/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index 41d1835..f2bbde0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -56,6 +56,7 @@ namespace WebCore { class InspectorClientQt; class ResourceHandle; class HitTestResult; + class QNetworkReplyHandler; struct FrameLoadRequest; } @@ -66,7 +67,7 @@ class QWEBKIT_EXPORT QWebPage : public QObject { Q_PROPERTY(bool modified READ isModified) Q_PROPERTY(QString selectedText READ selectedText) Q_PROPERTY(QSize viewportSize READ viewportSize WRITE setViewportSize) - Q_PROPERTY(QSize fixedContentsSize READ fixedContentsSize WRITE setFixedContentsSize) + Q_PROPERTY(QSize preferredContentsSize READ preferredContentsSize WRITE setPreferredContentsSize) Q_PROPERTY(bool forwardUnsupportedContent READ forwardUnsupportedContent WRITE setForwardUnsupportedContent) Q_PROPERTY(LinkDelegationPolicy linkDelegationPolicy READ linkDelegationPolicy WRITE setLinkDelegationPolicy) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) @@ -236,8 +237,8 @@ public: QSize viewportSize() const; void setViewportSize(const QSize &size) const; - QSize fixedContentsSize() const; - void setFixedContentsSize(const QSize &size) const; + QSize preferredContentsSize() const; + void setPreferredContentsSize(const QSize &size) const; virtual bool event(QEvent*); bool focusNextPrevChild(bool next); @@ -288,6 +289,8 @@ public: enum ErrorDomain { QtNetwork, Http, WebKit }; class ErrorPageExtensionOption : public ExtensionOption { public: + QUrl url; + QWebFrame* frame; ErrorDomain domain; int error; QString errorString; @@ -344,6 +347,8 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); + void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); + protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); @@ -378,6 +383,7 @@ private: friend class WebCore::FrameLoaderClientQt; friend class WebCore::InspectorClientQt; friend class WebCore::ResourceHandle; + friend class WebCore::QNetworkReplyHandler; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QWebPage::FindFlags) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index eedf7d1..ffa21e4 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -62,6 +62,8 @@ public: QString localStoragePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; + float printingMinimumShrinkFactor; + float printingMaximumShrinkFactor; void apply(); WebCore::Settings* settings; @@ -174,6 +176,12 @@ void QWebSettingsPrivate::apply() QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; settings->setLocalStorageDatabasePath(storagePath); + float minimumShrinkFactor = printingMinimumShrinkFactor > 0.0f ? printingMinimumShrinkFactor : global->printingMinimumShrinkFactor; + settings->setPrintingMinimumShrinkFactor(minimumShrinkFactor); + + float maximumShrinkFactor = printingMaximumShrinkFactor > 0.0f ? printingMaximumShrinkFactor : global->printingMaximumShrinkFactor; + settings->setPrintingMaximumShrinkFactor(maximumShrinkFactor); + value = attributes.value(QWebSettings::ZoomTextOnly, global->attributes.value(QWebSettings::ZoomTextOnly)); settings->setZoomsTextOnly(value); @@ -377,6 +385,9 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); d->attributes.insert(QWebSettings::SessionStorageEnabled, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; + d->defaultTextEncoding = QLatin1String("iso-8859-1"); + d->printingMinimumShrinkFactor = 0.0f; + d->printingMaximumShrinkFactor = 0.0f; } /*! @@ -491,6 +502,60 @@ QString QWebSettings::defaultTextEncoding() const } /*! + \since 4.7 + Specifies minimum shrink fator allowed for printing. If set to 0 a + default value is used. + + When printing, content will be shrunk to reduce page usage, it + will reduced by a factor between printingMinimumShrinkFactor and + printingMaximumShrinkFactor. + + \sa printingMinimumShrinkFactor() + \sa setPrintingMaximumShrinkFactor() + \sa printingMaximumShrinkFactor() +*/ +void QWebSettings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor) +{ + d->printingMinimumShrinkFactor = printingMinimumShrinkFactor; + d->apply(); +} + +/*! + \since 4.7 + returns the minimum shrink factor used for printing. + + \sa setPrintingMinimumShrinkFactor() +*/ +float QWebSettings::printingMinimumShrinkFactor() const +{ + return d->printingMinimumShrinkFactor; +} + +/*! + \since 4.7 + Specifies maximum shrink fator allowed for printing. If set to 0 a + default value is used. + + \sa setPrintingMinimumShrinkFactor() +*/ +void QWebSettings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor) +{ + d->printingMaximumShrinkFactor = printingMaximumShrinkFactor; + d->apply(); +} + +/*! + \since 4.7 + returns the maximum shrink factor used for printing. + + \sa setPrintingMinimumShrinkFactor() +*/ +float QWebSettings::printingMaximumShrinkFactor() const +{ + return d->printingMaximumShrinkFactor; +} + +/*! Sets the path of the icon database to \a path. The icon database is used to store "favicons" associated with web sites. @@ -628,11 +693,6 @@ void QWebSettings::clearMemoryCaches() // Invalidating the font cache and freeing all inactive font data. WebCore::fontCache()->invalidate(); -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - // Empty the application cache. - WebCore::cacheStorage().empty(); -#endif - // Empty the Cross-Origin Preflight cache WebCore::CrossOriginPreflightResultCache::shared().empty(); } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index 4790823..e68ea53 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -103,6 +103,12 @@ public: void setDefaultTextEncoding(const QString &encoding); QString defaultTextEncoding() const; + void setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor); + float printingMinimumShrinkFactor() const; + + void setPrintingMaximumShrinkFactor(float printingMaximimShrinkFactor); + float printingMaximumShrinkFactor() const; + static void setIconDatabasePath(const QString &location); static QString iconDatabasePath(); static void clearIconDatabase(); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 41067f1..f7caa94 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2008 Holger Hans Peter Freyther + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -52,11 +53,16 @@ public: virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); #endif +#ifndef QT_NO_CURSOR virtual QCursor cursor() const; virtual void updateCursor(const QCursor& cursor); +#endif + virtual QPalette palette() const; virtual int screenNumber() const; - virtual WId winId() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; void _q_pageDestroyed(); @@ -89,7 +95,7 @@ void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) view->setInputMethodHints(view->inputMethodHints() & ~hint); } #endif - +#ifndef QT_NO_CURSOR QCursor QWebViewPrivate::cursor() const { return view->cursor(); @@ -99,6 +105,12 @@ void QWebViewPrivate::updateCursor(const QCursor& cursor) { view->setCursor(cursor); } +#endif + +QPalette QWebViewPrivate::palette() const +{ + return view->palette(); +} int QWebViewPrivate::screenNumber() const { @@ -110,12 +122,14 @@ int QWebViewPrivate::screenNumber() const return 0; } -WId QWebViewPrivate::winId() const +QWidget* QWebViewPrivate::ownerWidget() const { - if (view) - return view->winId(); + return view; +} - return 0; +QObject* QWebViewPrivate::pluginParent() const +{ + return view; } void QWebViewPrivate::_q_pageDestroyed() @@ -137,7 +151,7 @@ void QWebViewPrivate::_q_pageDestroyed() It can be used in various applications to display web content live from the Internet. - The image below shows QWebView previewed in \QD with a Nokia website. + The image below shows QWebView previewed in \QD with the Trolltech website. \image qwebview-url.png @@ -231,8 +245,10 @@ QWebView::QWebView(QWidget *parent) */ QWebView::~QWebView() { - if (d->page) + if (d->page) { d->page->d->view = 0; + d->page->d->client = 0; + } if (d->page && d->page->parent() == this) delete d->page; diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 85d0e4f..7987613 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,334 @@ +2009-10-19 Nate Chapin <japhet@chromium.org> + + Unreviewed, build fix. + + Update call to FrameLoader::loadFrameRequest(). + + * Api/qwebpage.cpp: + (QWebPage::triggerAction): + +2009-10-19 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> + + Reviewed by Ariya Hidayat. + + Add QWebElement::render API which allows rendering of single + element. + + * Api/qwebelement.cpp: + (QWebElement::render): + * Api/qwebelement.h: + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::render): + * tests/qwebelement/qwebelement.qrc: + * tests/qwebelement/image.png: Added. + +2009-10-19 Markus Goetz <Markus.Goetz@nokia.com> + + Reviewed by Ariya Hidayat. + + QWebPage: Doc: setNetworkAccessManager should only be called once. + + * Api/qwebpage.cpp: + +2009-10-19 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Tor Arne. + + Wrong ifdef combination in QGraphicsWebView's event method. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::event): + +2009-10-19 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + [Qt] Windowed Plugins: Don't crash when client is 0. + + Client is 0 when we use QWebPage without a QWebView or QGraphicsWebView. + In addition, setFrameRect()/updatePluginWidget() is called even if the + plugin was not succesfully loaded. updatePluginWidget() updates the + window rect which is, in theory, useful to draw something that indicates + that we didn't load successfully. + + So, a status check is added to setNPWindowIfNeeded. + + https://bugs.webkit.org/show_bug.cgi?id=30380 + + * tests/qwebpage/qwebpage.pro: + * tests/qwebpage/tst_qwebpage.cpp: + (takeScreenshot): + (tst_QWebPage::screenshot_data): + (tst_QWebPage::screenshot): + * tests/resources/test.swf: Copied from LayoutTests/fast/replaced/resources/test.swf. + +2009-10-19 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Holger Freyther. + + [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView. + + Fixes various sources of crashes: + 1. The PluginContainer is a child of QWebView. When the view gets deleted, + the PluginView is not notified about the deletion of PluginContainer. + 2. QWebView destructor does not set client to 0. + 3. Sometimes pending paint events are sent after the plugin has died, so add + a check in PluginView::setNPWindowIfNeeded. + + https://bugs.webkit.org/show_bug.cgi?id=30354 + + * Api/qwebview.cpp: + (QWebView::~QWebView): + * tests/qwebview/qwebview.pro: + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::reusePage_data): + (tst_QWebView::reusePage): + +2009-10-19 Jakob Truelsen <antialize@gmail.com> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=29042 + + Allow one to costumize the minimal and maximal shrink factors, + Added methods setPrintingMinimumShrinkFactor, printingMinimumShrinkFactor, + setPrintingMaximumShrinkFactor, printingMaximumShrinkFactor to QWebSettings. + + + * Api/qwebsettings.cpp: + (QWebSettingsPrivate::apply): + (QWebSettings::QWebSettings): + (QWebSettings::setPrintingMinimumShrinkFactor): + (QWebSettings::printingMinimumShrinkFactor): + (QWebSettings::setPrintingMaximumShrinkFactor): + (QWebSettings::printingMaximumShrinkFactor): + * Api/qwebsettings.h: + +2009-10-18 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Rename fixedContentsSize property to preferredContentsSize as + agreed upon with Simon Hausmann and Matthias Ettrich. + + * Api/qwebpage.cpp: + (QWebPage::preferredContentsSize): + (QWebPage::setPreferredContentsSize): + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage): + +2009-10-16 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] QGLauncher leaks WebPage object + https://bugs.webkit.org/show_bug.cgi?id=30465 + + Make 'SharedScene' to own 'WebPage' reference and delete it at its destructor. + + * Api/qwebpage.cpp: + (QWebPage::view): + * Api/qwebpage_p.h: + * QGVLauncher/main.cpp: + (SharedScene::SharedScene): + (SharedScene::~SharedScene): + +2009-10-16 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] "dangling" pointer to qwebpage's view object can leads QGLauncher to crash + https://bugs.webkit.org/show_bug.cgi?id=30459 + + Remove all setView(ev->widget()) calls in QWebPage and QGWV event handling methods, + since QWebPageClient would do the trick. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::hoverMoveEvent): + * Api/qwebpage.cpp: + (QWebPagePrivate::mouseMoveEvent): + (QWebPagePrivate::mousePressEvent): + (QWebPagePrivate::mouseDoubleClickEvent): + (QWebPagePrivate::mouseReleaseEvent): + (QWebPagePrivate::wheelEvent): + (QWebPagePrivate::dragEnterEvent): + (QWebPagePrivate::dragLeaveEvent): + (QWebPagePrivate::dragMoveEvent): + +2009-10-16 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Pull out r49676 as it caused build breakges on Symbian + + * Api/qwebpage.cpp: + +2009-10-16 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Need a way to inform the application when a Netscape plugin is created or deleted + https://bugs.webkit.org/show_bug.cgi?id=30179 + + Added "c" style static methods for the application to hook up for + receiving notifications when a plugin is created or destroyed. + + * Api/qwebpage.cpp: + +2009-10-15 Antonio Gomes <tonikitoo@webkit.org> + + Rubberstamped by Tor Arne. + + Make QGLauncher's WebPage class constructor to get a QObject* as parent (not QWidget*). + + * QGVLauncher/main.cpp: + (WebPage::WebPage): + +2009-10-15 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Tor Arne. + + [Qt] QGLauncher crashes while closing a window + https://bugs.webkit.org/show_bug.cgi?id=30385 + + Set page's pageClient reference to '0' at QGWV deletion. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::~QGraphicsWebView): + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (WebPage::WebPage): + (WebPage::aborting): + (tst_QGraphicsWebView::crashOnViewlessWebPages): + +2009-10-13 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Make context menu to work in QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=30336 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::event): + +2009-10-13 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + [Qt] Plugins : Remove all traces of winId. Use ownerWidget() instead. + + This is a bug for two reasons: + 1. Everytime we use winId(), we end up creating a native widget. This causes an + unnecessary copy of contents from the backing store to the native widget. + 2. Neither windowed nor windowless plugins require the winId of the QWebView or + QGraphicsView. + + Introduce ownerWidget() which returns a QWidget * without creating a native widget + (as opposed to QWidget::find(winId)). + + https://bugs.webkit.org/show_bug.cgi?id=30170 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::ownerWidget): + * Api/qwebview.cpp: + (QWebViewPrivate::ownerWidget): + +2009-10-13 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Add some initial autotests for QWebPage's ErrorPageExtention + https://bugs.webkit.org/show_bug.cgi?id=30296 + + * tests/qwebpage/tst_qwebpage.cpp: + (ErrorPage::ErrorPage): + (ErrorPage::supportsExtension): + (ErrorPage::extension): + (tst_QWebPage::errorPageExtension): + +2009-10-13 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] better handle possible edge cases on qwebframe::requestedUrl use + https://bugs.webkit.org/show_bug.cgi?id=30216 + + QWebFrame::requestedUrl can be called at any time during the load + process, including: + + * An error handling (whereas an alternate error page for unsuccessful + load is being set); + * A ssl error exception call; + * During navigation notifications/callbacks (titleChanged, urlChanged, + progresses, addHistoryEntry, etc); + * Among others. + + This patch makes requestedUrl calls to fallback to FrameLoaderClient + m_loadError's failingURL when an error has occurred, unless it is + null/empty. + + Also, m_loadError is now being reset at each the main frame starts a + load, in order to avoid previous load errors footprints. + + * Api/qwebframe.cpp: + (QWebFrame::requestedUrl): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::postProgressStartedNotification): + +2009-10-12 Jakub Wieczorek <faw217@gmail.com> + + Reviewed by Simon Hausmann. + + [Qt] Missing default value for the default text encoding. + https://bugs.webkit.org/show_bug.cgi?id=30311 + + QtWebKit has provided a default, hardcoded value for default charset but since + the addition of the defaultTextEncoding setting in QWebSettings, that hardcoded + value has had no effect. + + Added a regression test and unskipped fast/dom/Document/document-charset.html, + which is passing now. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + * Api/qwebsettings.cpp: + (QWebSettings::QWebSettings): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::defaultTextEncoding): + +2009-10-12 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Implement the new palette() methods on the page clients + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::palette): + * Api/qwebview.cpp: + (QWebViewPrivate::palette): + +2009-10-12 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + QWebPage's createViewlessPlugin autotest crash fix. + + It is possible that plugins that are QWidgets or QGraphicsWidgets + are created before a view has been assigned to a QWebPage. The + plug-ins won't be fully functional, as by design, they should + visualise something, but they won't crash and will stay in memory. + + An autotest that covers this use-case, is included. + + https://bugs.webkit.org/show_bug.cgi?id=30118 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + * tests/qwebpage/tst_qwebpage.cpp: + (PluginTrackedPageWidget::PluginTrackedPageWidget): + (PluginTrackedPageGraphicsWidget::PluginTrackedPageGraphicsWidget): + (PluginTrackedPageGraphicsWidget::createPlugin): + (tst_QWebPage::destroyPlugin): + (tst_QWebPage::createViewlessPlugin): + 2009-10-09 Joe Ligman <joseph.ligman@nokia.com> Reviewed by Simon Hausmann. @@ -24,6 +355,130 @@ * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): +2009-10-08 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move executeScript from FrameLoader to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=30200 + + Update API call. + + * Api/qwebframe.cpp: + (QWebFrame::evaluateJavaScript): + +2009-10-08 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Simon Hausmann. + + Part of testOptionalJSObjects autotest was marked as "expect to fail". + + Two places in tst_QWebPage::testOptionalJSObjects were marked as + expected to fail. The problem concern checking if a feature is enabled + or disabled. According to discussion on webkit dev mailing list + a disabled feature should be invisible from java script level, but + there are exceptions from the rule. So we decided to disable the test + for now. + + https://bugs.webkit.org/show_bug.cgi?id=29867 + + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::testOptionalJSObjects): + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callPolicyFunction): + +2009-10-07 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Get rid of useless loadFailed signal in QGraphicsWebView + https://bugs.webkit.org/show_bug.cgi?id=30166 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::_q_doLoadFinished): + * Api/qgraphicswebview.h: + * QGVLauncher/main.cpp: + (MainWindow::init): + (MainWindow::loadFinished): + +2009-10-07 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Add a simple rotation effect to QGVLauncher + + https://bugs.webkit.org/show_bug.cgi?id=30162 + + * QGVLauncher/main.cpp: + (MainView::animatedFlip): + (MainWindow::animatedFlip): + (MainWindow::buildUI): + +2009-10-07 Volker Hilsheimer <volker.hilsheimer@nokia.com> + + Reviewed by Simon Hausmann. + + Doc: Document HTML and status as properties. + + * Api/qgraphicswebview.cpp: + +2009-10-07 Martin Smith <msmith@trolltech.com> + + Reviewed by Simon Hausmann. + + Fix qdoc warning about disabled renderHints property + on Symbian. + + * Api/qwebview.cpp: + * Api/qwebview.h: + +2009-10-06 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move setLocalLoadPolicy and friends to SecurityOrigin + https://bugs.webkit.org/show_bug.cgi?id=30110 + + Call the new API. + + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2009-10-06 Benjamin C Meyer <bmeyer@rim.com> + + Reviewed by Ariya Hidayat. + + When the drag data contains an image set it on the QDrag so it will be visible to the user. + + * WebCoreSupport/DragClientQt.cpp: + (WebCore::DragClientQt::startDrag): + +2009-10-06 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: close inspector client view on + InspectorController::close API call. + + In order to run batch web inspector layout tests (and not affect + subsequent tests) we should close inspector client's view upon + InspectorController::close API call. + + https://bugs.webkit.org/show_bug.cgi?id=30009 + + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::createPage): + 2009-10-06 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. @@ -37,6 +492,159 @@ * Api/qwebview.cpp: (QWebView::QWebView): +2009-10-05 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + QtLauncher: print the number of loaded urls + + When using the -r mode print the number of URLs loaded so far. This + is extremly useful when opening the same URL over and over again and + one wants to see the progress. + + * QtLauncher/main.cpp: + (URLLoader::URLLoader): + (URLLoader::loadNext): + +2009-10-05 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Add screenshot option to menubar + + https://bugs.webkit.org/show_bug.cgi?id=30067 + + * QtLauncher/main.cpp: + (MainWindow::screenshot): + (MainWindow::setupUI): + +2009-10-05 Girish Ramakrishnan <girish@forwardbias.in> + + Reviewed by Simon Hausmann. + + Setting the env QTLAUNCHER_USE_ARGB_VISUALS makes Qt use WA_TranslucentWindow. + + https://bugs.webkit.org/show_bug.cgi?id=30068 + + * QtLauncher/main.cpp: + (MainWindow::MainWindow): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Rubberstamped by Simon Hausmann. + + Add documentation to the ErrorPageExtension. + + * Api/qwebpage.cpp: + +2009-10-02 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Inform the application when a new request is created + https://bugs.webkit.org/show_bug.cgi?id=29975 + + Add a signal to QWebPage, to inform the application when a request is created. + + * Api/qwebpage.cpp: + * Api/qwebpage.h: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + ErrorPageExtension: Add a pointer to the QWebFrame that had + an error. + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + +2009-10-05 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Do not empty the offline web appcache when clearing + memory caches. That one is not in memory, but stored + in sqlite. + + * Api/qwebsettings.cpp: + (QWebSettings::clearMemoryCaches): + +2009-10-05 J-P Nurmi <jpnurmi@gmail.com> + + Reviewed by Simon Hausmann. + + Added QGraphicsWidget-plugins support to FrameLoaderClientQt. + + https://bugs.webkit.org/show_bug.cgi?id=29710 + + * Api/qgraphicswebview.cpp: + (QGraphicsWebViewPrivate::pluginParent): + * Api/qwebview.cpp: + (QWebViewPrivate::pluginParent): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::): + (WebCore::FrameLoaderClientQt::createPlugin): + +2009-10-03 Adam Barth <abarth@webkit.org> + + Unreview build fix. I wish I had a try server... + + * Api/qwebpage.cpp: + (QWebPagePrivate::updateAction): + +2009-10-02 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Simon Hausmann. + + Conditionally guard cursor code (cursor and updateCursor functions) with !QT_NO_CURSOR. + Otherwise, it is inconsistent with class declaration of QCursor. + + * Api/qgraphicswebview.cpp: + * Api/qwebview.cpp: + +2009-10-02 Prasanth Ullattil <prasanth.ullattil@nokia.com> + + Reviewed by Simon Hausmann. + + Fix compiler warnings about unused function arguments. + + * Api/qwebframe.cpp: + (QWebFrame::scrollBarMinimum): + * Api/qwebpage.cpp: + (QWebPagePrivate::focusInEvent): + (QWebPagePrivate::focusOutEvent): + (QWebPagePrivate::leaveEvent): + (QWebPage::javaScriptAlert): + (QWebPage::javaScriptConfirm): + (QWebPage::javaScriptPrompt): + (QWebPage::triggerAction): + (QWebPage::acceptNavigationRequest): + (QWebPage::chooseFile): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::repaint): + (WebCore::ChromeClientQt::mouseDidMoveOverElement): + (WebCore::ChromeClientQt::reachedMaxAppCacheSize): + * WebCoreSupport/ContextMenuClientQt.cpp: + (WebCore::ContextMenuClientQt::downloadURL): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchWillPerformClientRedirect): + (WebCore::FrameLoaderClientQt::setMainFrameDocumentReady): + (WebCore::FrameLoaderClientQt::representationExistsForURLScheme): + (WebCore::FrameLoaderClientQt::generatedMIMETypeForURLScheme): + (WebCore::FrameLoaderClientQt::shouldGoToHistoryItem): + (WebCore::FrameLoaderClientQt::pluginWillHandleLoadError): + (WebCore::FrameLoaderClientQt::assignIdentifierToInitialRequest): + (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading): + (WebCore::FrameLoaderClientQt::createJavaAppletWidget): + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::setAttachedWindowHeight): + (WebCore::InspectorClientQt::highlight): + (WebCore::InspectorClientQt::removeSetting): + 2009-10-01 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Tor Arne Vestbø. @@ -49,6 +657,37 @@ (QWebPagePrivate::handleSoftwareInputPanel): * Api/qwebpage_p.h: +2009-10-01 Alexis Menard <alexis.menard@nokia.com> + + Reviewed by Tor Arne Vestbø. + + Rename QWebGraphicsItem to QGraphicsWebView + + * Api/headers.pri: + * Api/qwebpage.h: + * Api/qwebgraphicsitem.cpp: Renamed. + * Api/qwebgraphicsitem.h: Renamed. + * WebKit/qt/QGVLauncher/main.cpp: + * tests/tests.pro: + * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Renamed. + * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Renamed. + +2009-10-01 Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=29248 + [Qt] [API] Make it possible to have 'invisible' loads + + Make QWebFrame's setHtml and setContent methods to not change + session and global history at all. + + * Api/qwebframe.cpp: + (QWebFrame::setHtml): + (QWebFrame::setContent): + * tests/qwebframe/qwebframe.pro: + * tests/qwebframe/tst_qwebframe.cpp: + 2009-10-01 Kristian Amlie <kristian.amlie@nokia.com> Reviewed by Simon Hausmann. @@ -85,6 +724,17 @@ * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): +2009-09-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by David Hyatt. + + Add the failed URL to the ErrorPageExtension, as it is quite + useful for creating error pages. + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::callErrorPageExtension): + 2009-09-29 Andras Becsi <becsi.andras@stud.u-szeged.hu> Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp b/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp deleted file mode 100644 index d7fae07..0000000 --- a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp +++ /dev/null @@ -1,460 +0,0 @@ -/* - * kimgio import filter for MS Windows .ico files - * - * Distributed under the terms of the LGPL - * Copyright (c) 2000 Malte Starostik <malte@kde.org> - * - */ - -#include "config.h" -#include "ICOHandler.h" - -#include <cstring> -#include <cstdlib> -#include <algorithm> -#include <vector> - -#include <QtGui/QImage> -#include <QtGui/QBitmap> -#include <QtGui/QApplication> -#include <QtCore/QVector> -#include <QtGui/QDesktopWidget> - -namespace -{ - // Global header (see http://www.daubnet.com/formats/ICO.html) - struct IcoHeader - { - enum Type { Icon = 1, Cursor }; - quint16 reserved; - quint16 type; - quint16 count; - }; - - inline QDataStream& operator >>( QDataStream& s, IcoHeader& h ) - { - return s >> h.reserved >> h.type >> h.count; - } - - // Based on qt_read_dib et al. from qimage.cpp - // (c) 1992-2002 Nokia Corporation and/or its subsidiary(-ies). - struct BMP_INFOHDR - { - static const quint32 Size = 40; - quint32 biSize; // size of this struct - quint32 biWidth; // pixmap width - quint32 biHeight; // pixmap height - quint16 biPlanes; // should be 1 - quint16 biBitCount; // number of bits per pixel - enum Compression { RGB = 0 }; - quint32 biCompression; // compression method - quint32 biSizeImage; // size of image - quint32 biXPelsPerMeter; // horizontal resolution - quint32 biYPelsPerMeter; // vertical resolution - quint32 biClrUsed; // number of colors used - quint32 biClrImportant; // number of important colors - }; - const quint32 BMP_INFOHDR::Size; - - QDataStream& operator >>( QDataStream &s, BMP_INFOHDR &bi ) - { - s >> bi.biSize; - if ( bi.biSize == BMP_INFOHDR::Size ) - { - s >> bi.biWidth >> bi.biHeight >> bi.biPlanes >> bi.biBitCount; - s >> bi.biCompression >> bi.biSizeImage; - s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; - s >> bi.biClrUsed >> bi.biClrImportant; - } - return s; - } - -#if 0 - QDataStream &operator<<( QDataStream &s, const BMP_INFOHDR &bi ) - { - s << bi.biSize; - s << bi.biWidth << bi.biHeight; - s << bi.biPlanes; - s << bi.biBitCount; - s << bi.biCompression; - s << bi.biSizeImage; - s << bi.biXPelsPerMeter << bi.biYPelsPerMeter; - s << bi.biClrUsed << bi.biClrImportant; - return s; - } -#endif - - // Header for every icon in the file - struct IconRec - { - unsigned char width; - unsigned char height; - quint16 colors; - quint16 hotspotX; - quint16 hotspotY; - quint32 size; - quint32 offset; - }; - - inline QDataStream& operator >>( QDataStream& s, IconRec& r ) - { - return s >> r.width >> r.height >> r.colors - >> r.hotspotX >> r.hotspotY >> r.size >> r.offset; - } - - struct LessDifference - { - LessDifference( unsigned s, unsigned c ) - : size( s ), colors( c ) {} - - bool operator ()( const IconRec& lhs, const IconRec& rhs ) const - { - // closest size match precedes everything else - if ( std::abs( int( lhs.width - size ) ) < - std::abs( int( rhs.width - size ) ) ) return true; - else if ( std::abs( int( lhs.width - size ) ) > - std::abs( int( rhs.width - size ) ) ) return false; - else if ( colors == 0 ) - { - // high/true color requested - if ( lhs.colors == 0 ) return true; - else if ( rhs.colors == 0 ) return false; - else return lhs.colors > rhs.colors; - } - else - { - // indexed icon requested - if ( lhs.colors == 0 && rhs.colors == 0 ) return false; - else if ( lhs.colors == 0 ) return false; - else return std::abs( int( lhs.colors - colors ) ) < - std::abs( int( rhs.colors - colors ) ); - } - } - unsigned size; - unsigned colors; - }; - - bool loadFromDIB( QDataStream& stream, const IconRec& rec, QImage& icon ) - { - BMP_INFOHDR header; - stream >> header; - if ( stream.atEnd() || header.biSize != BMP_INFOHDR::Size || - header.biSize > rec.size || - header.biCompression != BMP_INFOHDR::RGB || - ( header.biBitCount != 1 && header.biBitCount != 4 && - header.biBitCount != 8 && header.biBitCount != 24 && - header.biBitCount != 32 ) ) return false; - - unsigned paletteSize, paletteEntries; - - if (header.biBitCount > 8) - { - paletteEntries = 0; - paletteSize = 0; - } - else - { - paletteSize = (1 << header.biBitCount); - paletteEntries = paletteSize; - if (header.biClrUsed && header.biClrUsed < paletteSize) - paletteEntries = header.biClrUsed; - } - - // Always create a 32-bit image to get the mask right - // Note: this is safe as rec.width, rec.height are bytes - icon = QImage( rec.width, rec.height, QImage::Format_ARGB32 ); - if ( icon.isNull() ) return false; - - QVector< QRgb > colorTable( paletteSize ); - - colorTable.fill( QRgb( 0 ) ); - for ( unsigned i = 0; i < paletteEntries; ++i ) - { - unsigned char rgb[ 4 ]; - stream.readRawData( reinterpret_cast< char* >( &rgb ), - sizeof( rgb ) ); - colorTable[ i ] = qRgb( rgb[ 2 ], rgb[ 1 ], rgb[ 0 ] ); - } - - unsigned bpl = ( rec.width * header.biBitCount + 31 ) / 32 * 4; - - unsigned char* buf = new unsigned char[ bpl ]; - for ( unsigned y = rec.height; !stream.atEnd() && y--; ) - { - stream.readRawData( reinterpret_cast< char* >( buf ), bpl ); - unsigned char* pixel = buf; - QRgb* p = reinterpret_cast< QRgb* >( icon.scanLine( y ) ); - switch ( header.biBitCount ) - { - case 1: - for ( unsigned x = 0; x < rec.width; ++x ) - *p++ = colorTable[ - ( pixel[ x / 8 ] >> ( 7 - ( x & 0x07 ) ) ) & 1 ]; - break; - case 4: - for ( unsigned x = 0; x < rec.width; ++x ) - if ( x & 1 ) *p++ = colorTable[ pixel[ x / 2 ] & 0x0f ]; - else *p++ = colorTable[ pixel[ x / 2 ] >> 4 ]; - break; - case 8: - for ( unsigned x = 0; x < rec.width; ++x ) - *p++ = colorTable[ pixel[ x ] ]; - break; - case 24: - for ( unsigned x = 0; x < rec.width; ++x ) - *p++ = qRgb( pixel[ 3 * x + 2 ], - pixel[ 3 * x + 1 ], - pixel[ 3 * x ] ); - break; - case 32: - for ( unsigned x = 0; x < rec.width; ++x ) - *p++ = qRgba( pixel[ 4 * x + 2 ], - pixel[ 4 * x + 1 ], - pixel[ 4 * x ], - pixel[ 4 * x + 3] ); - break; - } - } - delete[] buf; - - if ( header.biBitCount < 32 ) - { - // Traditional 1-bit mask - bpl = ( rec.width + 31 ) / 32 * 4; - buf = new unsigned char[ bpl ]; - for ( unsigned y = rec.height; y--; ) - { - stream.readRawData( reinterpret_cast< char* >( buf ), bpl ); - QRgb* p = reinterpret_cast< QRgb* >( icon.scanLine( y ) ); - for ( unsigned x = 0; x < rec.width; ++x, ++p ) - if ( ( ( buf[ x / 8 ] >> ( 7 - ( x & 0x07 ) ) ) & 1 ) ) - *p &= RGB_MASK; - } - delete[] buf; - } - return true; - } -} - -ICOHandler::ICOHandler() -{ -} - -bool ICOHandler::canRead() const -{ - return canRead(device()); -} - -bool ICOHandler::read(QImage *outImage) -{ - - qint64 offset = device()->pos(); - - QDataStream stream( device() ); - stream.setByteOrder( QDataStream::LittleEndian ); - IcoHeader header; - stream >> header; - if ( stream.atEnd() || !header.count || - ( header.type != IcoHeader::Icon && header.type != IcoHeader::Cursor) ) - return false; - - unsigned requestedSize = 32; - unsigned requestedColors = QApplication::desktop()->depth() > 8 ? 0 : QApplication::desktop()->depth(); - int requestedIndex = -1; -#if 0 - if ( io->parameters() ) - { - QStringList params = QString(io->parameters()).split( ';', QString::SkipEmptyParts ); - QMap< QString, QString > options; - for ( QStringList::ConstIterator it = params.begin(); - it != params.end(); ++it ) - { - QStringList tmp = (*it).split( '=', QString::SkipEmptyParts ); - if ( tmp.count() == 2 ) options[ tmp[ 0 ] ] = tmp[ 1 ]; - } - if ( options[ "index" ].toUInt() ) - requestedIndex = options[ "index" ].toUInt(); - if ( options[ "size" ].toUInt() ) - requestedSize = options[ "size" ].toUInt(); - if ( options[ "colors" ].toUInt() ) - requestedColors = options[ "colors" ].toUInt(); - } -#endif - - typedef std::vector< IconRec > IconList; - IconList icons; - for ( unsigned i = 0; i < header.count; ++i ) - { - if ( stream.atEnd() ) - return false; - IconRec rec; - stream >> rec; - icons.push_back( rec ); - } - IconList::const_iterator selected; - if (requestedIndex >= 0) { - selected = std::min( icons.begin() + requestedIndex, icons.end() ); - } else { - selected = std::min_element( icons.begin(), icons.end(), - LessDifference( requestedSize, requestedColors ) ); - } - if ( stream.atEnd() || selected == icons.end() || - offset + selected->offset > device()->size() ) - return false; - - device()->seek( offset + selected->offset ); - QImage icon; - if ( loadFromDIB( stream, *selected, icon ) ) - { -#ifndef QT_NO_IMAGE_TEXT - icon.setText( "X-Index", 0, QString::number( selected - icons.begin() ) ); - if ( header.type == IcoHeader::Cursor ) - { - icon.setText( "X-HotspotX", 0, QString::number( selected->hotspotX ) ); - icon.setText( "X-HotspotY", 0, QString::number( selected->hotspotY ) ); - } -#endif - *outImage = icon; - return true; - } - return false; -} - -bool ICOHandler::write(const QImage &/*image*/) -{ -#if 0 - if (image.isNull()) - return; - - QByteArray dibData; - QDataStream dib(dibData, QIODevice::ReadWrite); - dib.setByteOrder(QDataStream::LittleEndian); - - QImage pixels = image; - QImage mask; - if (io->image().hasAlphaBuffer()) - mask = image.createAlphaMask(); - else - mask = image.createHeuristicMask(); - mask.invertPixels(); - for ( int y = 0; y < pixels.height(); ++y ) - for ( int x = 0; x < pixels.width(); ++x ) - if ( mask.pixel( x, y ) == 0 ) pixels.setPixel( x, y, 0 ); - - if (!qt_write_dib(dib, pixels)) - return; - - uint hdrPos = dib.device()->at(); - if (!qt_write_dib(dib, mask)) - return; - memmove(dibData.data() + hdrPos, dibData.data() + hdrPos + BMP_WIN + 8, dibData.size() - hdrPos - BMP_WIN - 8); - dibData.resize(dibData.size() - BMP_WIN - 8); - - QDataStream ico(device()); - ico.setByteOrder(QDataStream::LittleEndian); - IcoHeader hdr; - hdr.reserved = 0; - hdr.type = Icon; - hdr.count = 1; - ico << hdr.reserved << hdr.type << hdr.count; - IconRec rec; - rec.width = image.width(); - rec.height = image.height(); - if (image.numColors() <= 16) - rec.colors = 16; - else if (image.depth() <= 8) - rec.colors = 256; - else - rec.colors = 0; - rec.hotspotX = 0; - rec.hotspotY = 0; - rec.dibSize = dibData.size(); - ico << rec.width << rec.height << rec.colors - << rec.hotspotX << rec.hotspotY << rec.dibSize; - rec.dibOffset = ico.device()->at() + sizeof(rec.dibOffset); - ico << rec.dibOffset; - - BMP_INFOHDR dibHeader; - dib.device()->at(0); - dib >> dibHeader; - dibHeader.biHeight = image.height() << 1; - dib.device()->at(0); - dib << dibHeader; - - ico.writeRawBytes(dibData.data(), dibData.size()); - return true; -#endif - return false; -} - -QByteArray ICOHandler::name() const -{ - return "ico"; -} - -bool ICOHandler::canRead(QIODevice *device) -{ - if (!device) { - qWarning("ICOHandler::canRead() called with no device"); - return false; - } - - const qint64 oldPos = device->pos(); - - char head[8]; - qint64 readBytes = device->read(head, sizeof(head)); - const bool readOk = readBytes == sizeof(head); - - if (device->isSequential()) { - while (readBytes > 0) - device->ungetChar(head[readBytes-- - 1]); - } else { - device->seek(oldPos); - } - - if ( !readOk ) - return false; - - return head[2] == '\001' && head[3] == '\000' && // type should be 1 - ( head[6] == 16 || head[6] == 32 || head[6] == 64 ) && // width can only be one of those - ( head[7] == 16 || head[7] == 32 || head[7] == 64 ); // same for height -} - -class ICOPlugin : public QImageIOPlugin -{ -public: - QStringList keys() const; - Capabilities capabilities(QIODevice *device, const QByteArray &format) const; - QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const; -}; - -QStringList ICOPlugin::keys() const -{ - return QStringList() << "ico" << "ICO"; -} - -QImageIOPlugin::Capabilities ICOPlugin::capabilities(QIODevice *device, const QByteArray &format) const -{ - if (format == "ico" || format == "ICO") - return Capabilities(CanRead); - if (!format.isEmpty()) - return 0; - if (!device->isOpen()) - return 0; - - Capabilities cap; - if (device->isReadable() && ICOHandler::canRead(device)) - cap |= CanRead; - return cap; -} - -QImageIOHandler *ICOPlugin::create(QIODevice *device, const QByteArray &format) const -{ - QImageIOHandler *handler = new ICOHandler; - handler->setDevice(device); - handler->setFormat(format); - return handler; -} - -Q_EXPORT_STATIC_PLUGIN(ICOPlugin) -Q_EXPORT_PLUGIN2(qtwebico, ICOPlugin) diff --git a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.h b/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.h deleted file mode 100644 index 4f1f1d6..0000000 --- a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * ico.h - kimgio import filter for MS Windows .ico files - * - * Distributed under the terms of the LGPL - * Copyright (c) 2000 Malte Starostik <malte@kde.org> - * - */ - -// You can use QImageIO::setParameters() to request a specific -// Icon out of an .ico file: -// -// Options consist of a name=value pair and are separated by a semicolon. -// Available options are: -// size=<size> select the icon that most closely matches <size> (pixels) -// default: 32 -// colors=<num> select the icon that has <num> colors (or comes closest) -// default: 1 << display depth or 0 (RGB) if display depth > 8 -// index=<index> select the indexth icon from the file. If this option -// is present, the size and colors options will be ignored. -// default: none -// If both size and colors are given, size takes precedence. -// -// The old format is still supported: -// the parameters consist of a single string in the form -// "<size>[:<colors>]" which correspond to the options above -// -// If an icon was returned (i.e. the file is valid and the index option -// if present was not out of range), the icon's index within the .ico -// file is returned in the text tag "X-Index" of the image. -// If the icon is in fact a cursor, its hotspot coordinates are returned -// in the text tags "X-HotspotX" and "X-HotspotY". - -#ifndef _ICOHANDLER_H_ -#define _ICOHANDLER_H_ - -#include <QtGui/QImageIOPlugin> - -class ICOHandler : public QImageIOHandler -{ -public: - ICOHandler(); - - bool canRead() const; - bool read(QImage *image); - bool write(const QImage &image); - - QByteArray name() const; - - static bool canRead(QIODevice *device); -}; - -#endif diff --git a/src/3rdparty/webkit/WebKit/qt/Plugins/Plugins.pro b/src/3rdparty/webkit/WebKit/qt/Plugins/Plugins.pro deleted file mode 100644 index a9b4f82..0000000 --- a/src/3rdparty/webkit/WebKit/qt/Plugins/Plugins.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = lib -TARGET = qtwebico -CONFIG += plugin -HEADERS += ICOHandler.h -SOURCES += ICOHandler.cpp - -include(../../WebKit.pri) - -contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols -unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions - -target.path = $$[QT_INSTALL_PLUGINS]/imageformats -INSTALLS += target - diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp index 0df0768..99e438d 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp @@ -66,6 +66,8 @@ void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Cli QWidget* view = m_webPage->view(); if (view) { QDrag *drag = new QDrag(view); + if (clipboardData->hasImage()) + drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData())); drag->setMimeData(clipboardData); drag->start(); } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 905e11d..81ccbe8 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -55,8 +55,10 @@ #include "ResourceHandle.h" #include "Settings.h" #include "ScriptString.h" +#include "QWebPageClient.h" #include "qwebpage.h" +#include "qwebpage_p.h" #include "qwebframe.h" #include "qwebframe_p.h" #include "qwebhistoryinterface.h" @@ -67,6 +69,8 @@ #include <QCoreApplication> #include <QDebug> #if QT_VERSION >= 0x040400 +#include <QGraphicsScene> +#include <QGraphicsWidget> #include <QNetworkRequest> #include <QNetworkReply> #else @@ -183,7 +187,7 @@ QWebFrame* FrameLoaderClientQt::webFrame() const void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action) { - (m_frame->loader()->*function)(action); + (m_frame->loader()->policyChecker()->*function)(action); } bool FrameLoaderClientQt::hasWebView() const @@ -210,12 +214,12 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor(); QWebPage* page = m_webFrame->page(); - const QSize fixedLayoutSize = page->fixedContentsSize(); + const QSize preferredLayoutSize = page->preferredContentsSize(); m_frame->createView(m_webFrame->page()->viewportSize(), backgroundColor, !backgroundColor.alpha(), - fixedLayoutSize.isValid() ? IntSize(fixedLayoutSize) : IntSize(), - fixedLayoutSize.isValid(), + preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(), + preferredLayoutSize.isValid(), (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal), (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical)); } @@ -374,7 +378,8 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() if (dumpFrameLoaderCallbacks) printf("%s - didFinishLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - m_loadError = ResourceError(); // clears the previous error + // Clears the previous error. + m_loadError = ResourceError(); if (!m_webFrame) return; @@ -428,6 +433,8 @@ void FrameLoaderClientQt::revertToProvisionalState(DocumentLoader*) void FrameLoaderClientQt::postProgressStartedNotification() { if (m_webFrame && m_frame->page()) { + // A new load starts, so lets clear the previous error. + m_loadError = ResourceError(); emit loadStarted(); postProgressEstimateChangedNotification(); } @@ -875,6 +882,8 @@ void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& e else return; + option.url = QUrl(error.failingURL()); + option.frame = m_webFrame; option.error = error.errorCode(); option.errorString = error.localizedDescription(); @@ -883,7 +892,7 @@ void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& e return; KURL baseUrl(output.baseUrl); - KURL failingUrl(QUrl(error.failingURL())); + KURL failingUrl(option.url); WebCore::ResourceRequest request(baseUrl); WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(output.content.constData(), output.content.length()); @@ -1116,6 +1125,53 @@ public: } }; +#if QT_VERSION >= 0x040600 +class QtPluginGraphicsWidget: public Widget +{ +public: + static RefPtr<QtPluginGraphicsWidget> create(QGraphicsWidget* w = 0) + { + return adoptRef(new QtPluginGraphicsWidget(w)); + } + + ~QtPluginGraphicsWidget() + { + if (graphicsWidget) + graphicsWidget->deleteLater(); + } + virtual void invalidateRect(const IntRect& r) + { + QGraphicsScene* scene = graphicsWidget ? graphicsWidget->scene() : 0; + if (scene) + scene->update(QRect(r)); + } + virtual void frameRectsChanged() + { + if (!graphicsWidget) + return; + + IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height())); + graphicsWidget->setGeometry(QRect(windowRect)); + + // FIXME: clipping of graphics widgets + } + virtual void show() + { + if (graphicsWidget) + graphicsWidget->show(); + } + virtual void hide() + { + if (graphicsWidget) + graphicsWidget->hide(); + } +private: + QtPluginGraphicsWidget(QGraphicsWidget* w = 0): Widget(0), graphicsWidget(w) {} + + QGraphicsWidget* graphicsWidget; +}; +#endif + PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) { @@ -1177,15 +1233,34 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, if (object) { QWidget* widget = qobject_cast<QWidget*>(object); if (widget) { - QWidget* view = m_webFrame->page()->view(); - if (view) - widget->setParent(view); + QWidget* parentWidget; + if (m_webFrame->page()->d->client) + parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent()); + else + parentWidget = 0; // The plug-in won't be fully functional because the QWebView doesn't exist. + widget->setParent(parentWidget); RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget()); w->setPlatformWidget(widget); // Make sure it's invisible until properly placed into the layout w->setFrameRect(IntRect(0, 0, 0, 0)); return w; } +#if QT_VERSION >= 0x040600 + QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object); + if (graphicsWidget) { + QGraphicsObject* parentWidget; + if (m_webFrame->page()->d->client) + parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()); + else + parentWidget = 0; // The plug-in won't be fully functional because the QWebView doesn't exist. + graphicsWidget->hide(); + graphicsWidget->setParentItem(parentWidget); + RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget); + // Make sure it's invisible until properly placed into the layout + w->setFrameRect(IntRect(0, 0, 0, 0)); + return w; + } +#endif // FIXME: make things work for widgetless plugins as well delete object; } else { // NPAPI Plugins diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 3931a85..12f405c 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -84,9 +84,6 @@ void InspectorClientQt::inspectorDestroyed() Page* InspectorClientQt::createPage() { - if (m_inspectorView) - return m_inspectorView->page()->d->page; - QWebView* inspectorView = new QWebView; InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView); inspectorView->setPage(inspectorPage); diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index 1a57286..4bdb7f5 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -19,7 +19,33 @@ #include <QtTest/QtTest> +#include <QGraphicsView> #include <qgraphicswebview.h> +#include <qwebpage.h> +#include <qwebframe.h> + +/** + * Starts an event loop that runs until the given signal is received. + * Optionally the event loop + * can return earlier on a timeout. + * + * \return \p true if the requested signal was received + * \p false on timeout + */ +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) +{ + QEventLoop loop; + QObject::connect(obj, signal, &loop, SLOT(quit())); + QTimer timer; + QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); + if (timeout > 0) { + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.setSingleShot(true); + timer.start(timeout); + } + loop.exec(); + return timeoutSpy.isEmpty(); +} class tst_QGraphicsWebView : public QObject { @@ -27,6 +53,7 @@ class tst_QGraphicsWebView : public QObject private slots: void qgraphicswebview(); + void crashOnViewlessWebPages(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -53,6 +80,55 @@ void tst_QGraphicsWebView::qgraphicswebview() item.setContent(QByteArray()); } +class WebPage : public QWebPage +{ + Q_OBJECT + +public: + WebPage(QObject* parent = 0): QWebPage(parent) + { + } + + QGraphicsWebView* webView; + +private slots: + // Force a webview deletion during the load. + // It should not cause WebPage to crash due to + // it accessing invalid pageClient pointer. + void aborting() + { + delete webView; + } +}; + +void tst_QGraphicsWebView::crashOnViewlessWebPages() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + + QGraphicsWebView* webView = new QGraphicsWebView; + WebPage* page = new WebPage; + webView->setPage(page); + page->webView = webView; + connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting())); + + scene.addItem(webView); + + view.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + view.resize(600, 480); + webView->resize(view.geometry().size()); + QTest::qWait(200); + view.show(); + + page->mainFrame()->setHtml(QString("data:text/html," + "<frameset cols=\"25%,75%\">" + "<frame src=\"data:text/html,foo \">" + "<frame src=\"data:text/html,bar\">" + "</frameset>")); + + QVERIFY(::waitForSignal(page, SIGNAL(loadFinished(bool)))); +} + QTEST_MAIN(tst_QGraphicsWebView) #include "tst_qgraphicswebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png Binary files differnew file mode 100644 index 0000000..8d70364 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/image.png diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc index ed01440..28b9d7b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc @@ -2,5 +2,6 @@ <qresource prefix="/"> <file>style.css</file> <file>style2.css</file> +<file>image.png</file> </qresource> </RCC> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index 00783d1..db2f7d7 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -87,6 +87,7 @@ private slots: void firstChildNextSibling(); void lastChildPreviousSibling(); void hasSetFocus(); + void render(); private: QWebView* m_view; @@ -825,5 +826,79 @@ void tst_QWebElement::hasSetFocus() QVERIFY(input2.hasFocus()); } +void tst_QWebElement::render() +{ + QString html( "<html>" + "<head><style>" + "body, iframe { margin: 0px; border: none; }" + "</style></head>" + "<body><table width='300px' height='300px' border='1'>" + "<tr>" + "<td>test" + "</td>" + "<td><img src='qrc:///image.png'>" + "</td>" + "</tr>" + "</table>" + "</body>" + "</html>" + ); + + QWebPage page; + QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool))); + page.mainFrame()->setHtml(html); + + waitForSignal(&page, SIGNAL(loadFinished(bool))); + QCOMPARE(loadSpy.count(), 1); + + QList<QWebElement> imgs = page.mainFrame()->findAllElements("img"); + QCOMPARE(imgs.count(), 1); + + QImage resource(":/image.png"); + QRect imageRect(0, 0, resource.width(), resource.height()); + + QImage testImage(resource.width(), resource.height(), QImage::Format_ARGB32); + QPainter painter0(&testImage); + painter0.fillRect(imageRect, Qt::white); + painter0.drawImage(0, 0, resource); + painter0.end(); + + QImage image1(resource.width(), resource.height(), QImage::Format_ARGB32); + QPainter painter1(&image1); + painter1.fillRect(imageRect, Qt::white); + imgs[0].render(&painter1); + painter1.end(); + + QVERIFY(image1 == testImage); + + // render image 2nd time to make sure that cached rendering works fine + QImage image2(resource.width(), resource.height(), QImage::Format_ARGB32); + QPainter painter2(&image2); + painter2.fillRect(imageRect, Qt::white); + imgs[0].render(&painter2); + painter2.end(); + + QVERIFY(image2 == testImage); + + // compare table rendered through QWebElement::render to whole page table rendering + QRect tableRect(0, 0, 300, 300); + QList<QWebElement> tables = page.mainFrame()->findAllElements("table"); + QCOMPARE(tables.count(), 1); + + QImage image3(300, 300, QImage::Format_ARGB32); + QPainter painter3(&image3); + painter3.fillRect(tableRect, Qt::white); + tables[0].render(&painter3); + painter3.end(); + + QImage image4(300, 300, QImage::Format_ARGB32); + QPainter painter4(&image4); + page.mainFrame()->setClipRenderToViewport(false); + page.mainFrame()->render(&painter4, tableRect); + painter4.end(); + + QVERIFY(image3 == image4); +} + QTEST_MAIN(tst_QWebElement) #include "tst_qwebelement.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 81037c3..4c92e91 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,5 +5,6 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian:TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 797446b..80c9d72 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -586,6 +586,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -699,6 +700,7 @@ void tst_QWebFrame::init() m_page = m_view->page(); m_myObject = new MyQObject(); m_page->mainFrame()->addToJavaScriptWindowObject("myObject", m_myObject); + QDir::setCurrent(SRCDIR); } void tst_QWebFrame::cleanup() @@ -2370,6 +2372,28 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); +} + class TestNetworkManager : public QNetworkAccessManager { public: diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 82ffac6..101837a 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,5 +5,6 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian:TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index bdcc27f..21b3bc7 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1,5 +1,6 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -23,6 +24,7 @@ #include <qwebelement.h> #include <qwebpage.h> #include <qwidget.h> +#include <QGraphicsWidget> #include <qwebview.h> #include <qwebframe.h> #include <qwebhistory.h> @@ -33,6 +35,7 @@ #include <qwebsecurityorigin.h> #include <qwebdatabase.h> #include <QPushButton> +#include <QDir> // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ @@ -101,7 +104,9 @@ private slots: void contextMenuCrash(); void database(); void createPlugin(); + void destroyPlugin_data(); void destroyPlugin(); + void createViewlessPlugin_data(); void createViewlessPlugin(); void multiplePageGroupsAndLocalStorage(); void cursorMovements(); @@ -116,9 +121,14 @@ private slots: void testEnablePersistentStorage(); void consoleOutput(); void inputMethods(); + void defaultTextEncoding(); + void errorPageExtension(); void crashTests_LazyInitializationOfMainFrame(); + void screenshot_data(); + void screenshot(); + private: QWebView* m_view; QWebPage* m_page; @@ -222,6 +232,9 @@ void tst_QWebPage::infiniteLoopJS() void tst_QWebPage::loadFinished() { + qRegisterMetaType<QWebFrame*>("QWebFrame*"); + qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*"); + QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -232,6 +245,7 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); + QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -617,50 +631,93 @@ void tst_QWebPage::createPlugin() QCOMPARE(newPage->calls.count(), 0); } -class PluginTrackedPage : public QWebPage -{ + +// Standard base class for template PluginTracerPage. In tests it is used as interface. +class PluginCounterPage : public QWebPage { public: + int m_count; + QPointer<QObject> m_widget; + PluginCounterPage(QObject* parent = 0) : QWebPage(parent), m_count(0), m_widget(0) + { + settings()->setAttribute(QWebSettings::PluginsEnabled, true); + } +}; - int count; - QPointer<QWidget> widget; +template<class T> +class PluginTracerPage : public PluginCounterPage { +public: + PluginTracerPage(QObject* parent = 0) : PluginCounterPage(parent) {} + virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) + { + m_count++; + return m_widget = new T(); + } +}; - PluginTrackedPage(QWidget *parent = 0) : QWebPage(parent), count(0) { - settings()->setAttribute(QWebSettings::PluginsEnabled, true); +class PluginFactory { +public: + enum FactoredType {QWidgetType, QGraphicsWidgetType}; + static PluginCounterPage* create(FactoredType type, QObject* parent = 0) + { + PluginCounterPage* result = 0; + switch (type) { + case QWidgetType: + result = new PluginTracerPage<QWidget>(parent); + break; + case QGraphicsWidgetType: + result = new PluginTracerPage<QGraphicsWidget>(parent); + break; + default: {/*Oops*/}; + } + return result; } - virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) { - count++; - QWidget *w = new QWidget; - widget = w; - return w; + static void prepareTestData() + { + QTest::addColumn<int>("type"); + QTest::newRow("QWidget") << (int)PluginFactory::QWidgetType; + QTest::newRow("QGraphicsWidget") << (int)PluginFactory::QGraphicsWidgetType; } }; +void tst_QWebPage::destroyPlugin_data() +{ + PluginFactory::prepareTestData(); +} + void tst_QWebPage::destroyPlugin() { - PluginTrackedPage* page = new PluginTrackedPage(m_view); + QFETCH(int, type); + PluginCounterPage* page = PluginFactory::create((PluginFactory::FactoredType)type, m_view); m_view->setPage(page); // we create the plugin, so the widget should be constructed QString content("<html><body><object type=\"application/x-qt-plugin\" classid=\"QProgressBar\"></object></body></html>"); m_view->setHtml(content); - QVERIFY(page->widget != 0); - QCOMPARE(page->count, 1); + QVERIFY(page->m_widget); + QCOMPARE(page->m_count, 1); // navigate away, the plugin widget should be destructed m_view->setHtml("<html><body>Hi</body></html>"); QTestEventLoop::instance().enterLoop(1); - QVERIFY(page->widget == 0); + QVERIFY(!page->m_widget); +} + +void tst_QWebPage::createViewlessPlugin_data() +{ + PluginFactory::prepareTestData(); } void tst_QWebPage::createViewlessPlugin() { - PluginTrackedPage* page = new PluginTrackedPage; + QFETCH(int, type); + PluginCounterPage* page = PluginFactory::create((PluginFactory::FactoredType)type); QString content("<html><body><object type=\"application/x-qt-plugin\" classid=\"QProgressBar\"></object></body></html>"); page->mainFrame()->setHtml(content); - QCOMPARE(page->count, 1); - QVERIFY(page->widget != 0); + QCOMPARE(page->m_count, 1); + QVERIFY(page->m_widget); delete page; + } // import private API @@ -1370,8 +1427,10 @@ void tst_QWebPage::testOptionalJSObjects() webPage1.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl()); webPage2.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl()); + QEXPECT_FAIL("","Feature enabled/disabled checking problem. Look at bugs.webkit.org/show_bug.cgi?id=29867", Continue); QCOMPARE(testFlag(webPage1, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), false); QCOMPARE(testFlag(webPage2, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", true), true); + QEXPECT_FAIL("","Feature enabled/disabled checking problem. Look at bugs.webkit.org/show_bug.cgi?id=29867", Continue); QCOMPARE(testFlag(webPage1, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), false); QCOMPARE(testFlag(webPage2, QWebSettings::OfflineWebApplicationCacheEnabled, "applicationCache", false), true); @@ -1410,6 +1469,79 @@ void tst_QWebPage::testEnablePersistentStorage() QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty()); } +void tst_QWebPage::defaultTextEncoding() +{ + QWebFrame* mainFrame = m_page->mainFrame(); + + QString defaultCharset = mainFrame->evaluateJavaScript("document.defaultCharset").toString(); + QVERIFY(!defaultCharset.isEmpty()); + QCOMPARE(QWebSettings::globalSettings()->defaultTextEncoding(), defaultCharset); + + m_page->settings()->setDefaultTextEncoding(QString("utf-8")); + QString charset = mainFrame->evaluateJavaScript("document.defaultCharset").toString(); + QCOMPARE(charset, QString("utf-8")); + QCOMPARE(m_page->settings()->defaultTextEncoding(), charset); + + m_page->settings()->setDefaultTextEncoding(QString()); + charset = mainFrame->evaluateJavaScript("document.defaultCharset").toString(); + QVERIFY(!charset.isEmpty()); + QCOMPARE(charset, defaultCharset); + + QWebSettings::globalSettings()->setDefaultTextEncoding(QString("utf-8")); + charset = mainFrame->evaluateJavaScript("document.defaultCharset").toString(); + QCOMPARE(charset, QString("utf-8")); + QCOMPARE(QWebSettings::globalSettings()->defaultTextEncoding(), charset); +} + +class ErrorPage : public QWebPage +{ +public: + + ErrorPage(QWidget* parent = 0): QWebPage(parent) + { + } + + virtual bool supportsExtension(Extension extension) const + { + return extension == ErrorPageExtension; + } + + virtual bool extension(Extension, const ExtensionOption* option, ExtensionReturn* output) + { + const ErrorPageExtensionOption* info = static_cast<const ErrorPageExtensionOption*>(option); + ErrorPageExtensionReturn* errorPage = static_cast<ErrorPageExtensionReturn*>(output); + + if (info->frame == mainFrame()) { + errorPage->content = "data:text/html,error"; + return true; + } + + return false; + } +}; + +void tst_QWebPage::errorPageExtension() +{ + ErrorPage* page = new ErrorPage; + m_view->setPage(page); + + QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); + + page->mainFrame()->load(QUrl("qrc:///frametest/index.html")); + QTRY_COMPARE(spyLoadFinished.count(), 1); + + page->mainFrame()->setUrl(QUrl("http://non.existent/url")); + QTest::qWait(2000); + QTRY_COMPARE(spyLoadFinished.count(), 2); + QCOMPARE(page->mainFrame()->toPlainText(), QString("data:text/html,error")); + QCOMPARE(page->history()->count(), 2); + QCOMPARE(page->history()->currentItem().url(), QUrl("http://non.existent/url")); + QCOMPARE(page->history()->canGoBack(), true); + QCOMPARE(page->history()->canGoForward(), false); + + m_view->setPage(0); +} + void tst_QWebPage::crashTests_LazyInitializationOfMainFrame() { { @@ -1430,6 +1562,52 @@ void tst_QWebPage::crashTests_LazyInitializationOfMainFrame() } } +static void takeScreenshot(QWebPage* page) +{ + QWebFrame* mainFrame = page->mainFrame(); + page->setViewportSize(mainFrame->contentsSize()); + QImage image(page->viewportSize(), QImage::Format_ARGB32); + QPainter painter(&image); + mainFrame->render(&painter); + painter.end(); +} + +void tst_QWebPage::screenshot_data() +{ + QTest::addColumn<QString>("html"); + QTest::newRow("WithoutPlugin") << "<html><body id='b'>text</body></html>"; + QTest::newRow("WindowedPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf'></embed></body></html>"); + QTest::newRow("WindowlessPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf' wmode='transparent'></embed></body></html>"); +} + +void tst_QWebPage::screenshot() +{ + QDir::setCurrent(SRCDIR); + + QFETCH(QString, html); + QWebPage* page = new QWebPage; + page->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + QWebFrame* mainFrame = page->mainFrame(); + mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + if (html.contains("</embed>")) { + // some reasonable time for the PluginStream to feed test.swf to flash and start painting + QTest::qWait(2000); + } + + // take screenshot without a view + takeScreenshot(page); + + QWebView* view = new QWebView; + view->setPage(page); + + // take screenshot when attached to a view + takeScreenshot(page); + + delete page; + delete view; + + QDir::setCurrent(QApplication::applicationDirPath()); +} QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index d9d122c..bba7c39 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,5 +4,6 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian:TARGET.UID3 = 0xA000E53F diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 01d0e92..9204223 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2009 Torch Mobile Inc. + Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -26,6 +27,7 @@ #include <qnetworkrequest.h> #include <qdiriterator.h> #include <qwebkitversion.h> +#include <qwebframe.h> class tst_QWebView : public QObject { @@ -42,6 +44,9 @@ private slots: void guessUrlFromString_data(); void guessUrlFromString(); void getWebKitVersion(); + + void reusePage_data(); + void reusePage(); }; // This will be called before the first test function is executed. @@ -167,6 +172,46 @@ void tst_QWebView::getWebKitVersion() QVERIFY(qWebKitVersion().toDouble() > 0); } +void tst_QWebView::reusePage_data() +{ + QTest::addColumn<QString>("html"); + QTest::newRow("WithoutPlugin") << "<html><body id='b'>text</body></html>"; + QTest::newRow("WindowedPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf'></embed></body></html>"); + QTest::newRow("WindowlessPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf' wmode=\"transparent\"></embed></body></html>"); +} + +void tst_QWebView::reusePage() +{ + QDir::setCurrent(SRCDIR); + + QFETCH(QString, html); + QWebView* view1 = new QWebView; + QPointer<QWebPage> page = new QWebPage; + view1->setPage(page); + page->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + QWebFrame* mainFrame = page->mainFrame(); + mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + if (html.contains("</embed>")) { + // some reasonable time for the PluginStream to feed test.swf to flash and start painting + QTest::qWait(2000); + } + + view1->show(); + QTest::qWait(2000); + delete view1; + QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view + + QWebView *view2 = new QWebView; + view2->setPage(page); + view2->show(); // in Windowless mode, you should still be able to see the plugin here + QTest::qWait(2000); + delete view2; + + delete page; // must not crash + + QDir::setCurrent(QApplication::applicationDirPath()); +} + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/resources/test.swf b/src/3rdparty/webkit/WebKit/qt/tests/resources/test.swf Binary files differnew file mode 100644 index 0000000..8952982 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/resources/test.swf |