summaryrefslogtreecommitdiffstats
path: root/WebKit/qt
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/qt')
-rw-r--r--WebKit/qt/Api/headers.pri2
-rw-r--r--WebKit/qt/Api/qgraphicswebview.cpp832
-rw-r--r--WebKit/qt/Api/qgraphicswebview.h143
-rw-r--r--WebKit/qt/Api/qwebdatabase.cpp2
-rw-r--r--WebKit/qt/Api/qwebelement.cpp714
-rw-r--r--WebKit/qt/Api/qwebelement.h29
-rw-r--r--WebKit/qt/Api/qwebframe.cpp27
-rw-r--r--WebKit/qt/Api/qwebframe_p.h5
-rw-r--r--WebKit/qt/Api/qwebhistory.cpp69
-rw-r--r--WebKit/qt/Api/qwebhistory_p.h33
-rw-r--r--WebKit/qt/Api/qwebhistoryinterface.cpp2
-rw-r--r--WebKit/qt/Api/qwebinspector.cpp196
-rw-r--r--WebKit/qt/Api/qwebinspector.h58
-rw-r--r--WebKit/qt/Api/qwebinspector_p.h (renamed from WebKit/qt/Api/qwebplugindatabase_p.h)46
-rw-r--r--WebKit/qt/Api/qwebpage.cpp628
-rw-r--r--WebKit/qt/Api/qwebpage.h36
-rw-r--r--WebKit/qt/Api/qwebpage_p.h56
-rw-r--r--WebKit/qt/Api/qwebplugindatabase.cpp132
-rw-r--r--WebKit/qt/Api/qwebplugindatabase.h10
-rw-r--r--WebKit/qt/Api/qwebpluginfactory.cpp23
-rw-r--r--WebKit/qt/Api/qwebsecurityorigin.cpp59
-rw-r--r--WebKit/qt/Api/qwebsecurityorigin.h5
-rw-r--r--WebKit/qt/Api/qwebsettings.cpp142
-rw-r--r--WebKit/qt/Api/qwebsettings.h14
-rw-r--r--WebKit/qt/Api/qwebview.cpp125
-rw-r--r--WebKit/qt/Api/qwebview.h8
-rw-r--r--WebKit/qt/ChangeLog1692
-rw-r--r--WebKit/qt/QGVLauncher/QGVLauncher.pro13
-rw-r--r--WebKit/qt/QGVLauncher/main.cpp337
-rw-r--r--WebKit/qt/QtLauncher/QtLauncher.pro2
-rw-r--r--WebKit/qt/QtLauncher/main.cpp76
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.cpp24
-rw-r--r--WebKit/qt/WebCoreSupport/ChromeClientQt.h3
-rw-r--r--WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp2
-rw-r--r--WebKit/qt/WebCoreSupport/DragClientQt.cpp2
-rw-r--r--WebKit/qt/WebCoreSupport/EditorClientQt.cpp14
-rw-r--r--WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp180
-rw-r--r--WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h6
-rw-r--r--WebKit/qt/WebCoreSupport/InspectorClientQt.cpp207
-rw-r--r--WebKit/qt/WebCoreSupport/InspectorClientQt.h5
-rw-r--r--WebKit/qt/docs/qtwebkit.qdoc121
-rw-r--r--WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp17
-rw-r--r--WebKit/qt/docs/webkitsnippets/simple/main.cpp2
-rw-r--r--WebKit/qt/docs/webkitsnippets/webpage/main.cpp2
-rw-r--r--WebKit/qt/tests/benchmarks/loading/tst_loading.pro2
-rw-r--r--WebKit/qt/tests/benchmarks/painting/tst_painting.pro2
-rw-r--r--WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro6
-rw-r--r--WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp58
-rw-r--r--WebKit/qt/tests/qwebelement/qwebelement.pro2
-rw-r--r--WebKit/qt/tests/qwebelement/tst_qwebelement.cpp163
-rw-r--r--WebKit/qt/tests/qwebframe/qwebframe.pro3
-rw-r--r--WebKit/qt/tests/qwebframe/tst_qwebframe.cpp115
-rw-r--r--WebKit/qt/tests/qwebhistory/qwebhistory.pro2
-rw-r--r--WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp76
-rw-r--r--WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro2
-rw-r--r--WebKit/qt/tests/qwebpage/qwebpage.pro2
-rw-r--r--WebKit/qt/tests/qwebpage/tst_qwebpage.cpp257
-rw-r--r--WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro2
-rw-r--r--WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp36
-rw-r--r--WebKit/qt/tests/qwebview/qwebview.pro2
-rw-r--r--WebKit/qt/tests/tests.pro2
-rw-r--r--WebKit/qt/tests/util.h48
62 files changed, 5710 insertions, 1171 deletions
diff --git a/WebKit/qt/Api/headers.pri b/WebKit/qt/Api/headers.pri
index 92a120d..5a95c67 100644
--- a/WebKit/qt/Api/headers.pri
+++ b/WebKit/qt/Api/headers.pri
@@ -1,4 +1,5 @@
WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
+ $$PWD/qgraphicswebview.h \
$$PWD/qwebkitglobal.h \
$$PWD/qwebpage.h \
$$PWD/qwebview.h \
@@ -10,4 +11,5 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
$$PWD/qwebplugindatabase.h \
$$PWD/qwebpluginfactory.h \
$$PWD/qwebhistory.h \
+ $$PWD/qwebinspector.h \
$$PWD/qwebkitversion.h
diff --git a/WebKit/qt/Api/qgraphicswebview.cpp b/WebKit/qt/Api/qgraphicswebview.cpp
new file mode 100644
index 0000000..c267745
--- /dev/null
+++ b/WebKit/qt/Api/qgraphicswebview.cpp
@@ -0,0 +1,832 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qgraphicswebview.h"
+
+#include "qwebframe.h"
+#include "qwebpage.h"
+#include "qwebpage_p.h"
+#include "QWebPageClient.h"
+#include <QtGui/QGraphicsScene>
+#include <QtGui/QGraphicsView>
+#include <QtGui/qapplication.h>
+#include <QtGui/qgraphicssceneevent.h>
+#include <QtGui/qstyleoption.h>
+#if defined(Q_WS_X11)
+#include <QX11Info>
+#endif
+
+class QGraphicsWebViewPrivate : public QWebPageClient {
+public:
+ QGraphicsWebViewPrivate(QGraphicsWebView* parent)
+ : q(parent)
+ , page(0)
+ , interactive(true)
+ , progress(1.0)
+ {}
+
+ virtual void scroll(int dx, int dy, const QRect&);
+ virtual void update(const QRect& dirtyRect);
+
+#ifndef QT_NO_CURSOR
+ virtual QCursor cursor() const;
+ virtual void updateCursor(const QCursor& cursor);
+#endif
+
+ virtual int screenNumber() const;
+ virtual WId winId() const;
+
+ virtual QObject* pluginParent() const;
+
+ void _q_doLoadProgress(int progress);
+ void _q_doLoadFinished(bool success);
+ void _q_setStatusBarMessage(const QString& message);
+
+ QGraphicsWebView* q;
+ QWebPage* page;
+
+ QString statusBarMessage;
+ bool interactive;
+ qreal progress;
+};
+
+void QGraphicsWebViewPrivate::_q_doLoadProgress(int progress)
+{
+ if (qFuzzyCompare(this->progress, qreal(progress / 100.)))
+ return;
+
+ this->progress = progress / 100.;
+
+ emit q->progressChanged(this->progress);
+}
+
+void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success)
+{
+ // If the page had no title, still make sure it gets the signal
+ if (q->title().isEmpty())
+ emit q->urlChanged(q->url());
+
+ emit q->loadFinished(success);
+}
+
+void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
+{
+ q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll));
+}
+
+void QGraphicsWebViewPrivate::update(const QRect & dirtyRect)
+{
+ q->update(QRectF(dirtyRect));
+}
+
+#ifndef QT_NO_CURSOR
+QCursor QGraphicsWebViewPrivate::cursor() const
+{
+ return q->cursor();
+}
+
+void QGraphicsWebViewPrivate::updateCursor(const QCursor& cursor)
+{
+ q->setCursor(cursor);
+}
+#endif
+
+int QGraphicsWebViewPrivate::screenNumber() const
+{
+#if defined(Q_WS_X11)
+ const QList<QGraphicsView*> views = q->scene()->views();
+
+ if (!views.isEmpty())
+ return views.at(0)->x11Info().screen();
+#endif
+
+ return 0;
+}
+
+WId QGraphicsWebViewPrivate::winId() const
+{
+ const QList<QGraphicsView*> views = q->scene()->views();
+
+ if (!views.isEmpty())
+ return views.at(0)->winId();
+
+ return 0;
+}
+
+QObject* QGraphicsWebViewPrivate::pluginParent() const
+{
+ return q;
+}
+
+void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s)
+{
+ statusBarMessage = s;
+ emit q->statusChanged();
+}
+
+/*!
+ \class QGraphicsWebView
+ \brief The QGraphicsWebView class allows web content to be added to a GraphicsView.
+ \since 4.6
+
+ A WebGraphicsItem renders web content based on a URL or set data.
+
+ If the width and height of the item is not set, they will
+ dynamically adjust to a size appropriate for the content.
+ This width may be large (eg. 980) for typical online web pages.
+*/
+
+/*!
+ Constructs an empty QGraphicsWebView with parent \a parent.
+
+ \sa load()
+*/
+QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent)
+ : QGraphicsWidget(parent)
+ , d(new QGraphicsWebViewPrivate(this))
+{
+#if QT_VERSION >= 0x040600
+ setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
+#endif
+ setAcceptHoverEvents(true);
+ setFocusPolicy(Qt::StrongFocus);
+}
+
+/*!
+ Destroys the web graphicsitem.
+*/
+QGraphicsWebView::~QGraphicsWebView()
+{
+ if (d->page)
+ d->page->d->view = 0;
+
+ if (d->page && d->page->parent() == this)
+ delete d->page;
+
+ delete d;
+}
+
+/*!
+ Returns a pointer to the underlying web page.
+
+ \sa setPage()
+*/
+QWebPage* QGraphicsWebView::page() const
+{
+ if (!d->page) {
+ QGraphicsWebView* that = const_cast<QGraphicsWebView*>(this);
+ QWebPage* page = new QWebPage(that);
+
+ // Default to not having a background, in the case
+ // the page doesn't provide one.
+ QPalette palette = QApplication::palette();
+ palette.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0));
+ page->setPalette(palette);
+
+ that->setPage(page);
+ }
+
+ return d->page;
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*)
+{
+ page()->mainFrame()->render(painter, option->exposedRect.toRect());
+}
+
+/*! \reimp
+*/
+bool QGraphicsWebView::sceneEvent(QEvent* event)
+{
+ // Re-implemented in order to allows fixing event-related bugs in patch releases.
+ return QGraphicsWidget::sceneEvent(event);
+}
+
+/*! \reimp
+*/
+bool QGraphicsWebView::event(QEvent* event)
+{
+ // Re-implemented in order to allows fixing event-related bugs in patch releases.
+
+ if (d->page) {
+#ifndef QT_NO_CURSOR
+#if QT_VERSION >= 0x040400
+ } else if (event->type() == QEvent::CursorChange) {
+ // An unsetCursor will set the cursor to Qt::ArrowCursor.
+ // Thus this cursor change might be a QWidget::unsetCursor()
+ // If this is not the case and it came from WebCore, the
+ // QWebPageClient already has set its cursor internally
+ // to Qt::ArrowCursor, so updating the cursor is always
+ // right, as it falls back to the last cursor set by
+ // WebCore.
+ // FIXME: Add a QEvent::CursorUnset or similar to Qt.
+ if (cursor().shape() == Qt::ArrowCursor)
+ d->resetCursor();
+#endif
+#endif
+ }
+ return QGraphicsWidget::event(event);
+}
+
+/*!
+ Makes \a page the new web page of the web graphicsitem.
+
+ The parent QObject of the provided page remains the owner
+ of the object. If the current document is a child of the web
+ view, it will be deleted.
+
+ \sa page()
+*/
+void QGraphicsWebView::setPage(QWebPage* page)
+{
+ if (d->page == page)
+ return;
+
+ if (d->page) {
+ d->page->d->client = 0; // unset the page client
+ if (d->page->parent() == this)
+ delete d->page;
+ else
+ d->page->disconnect(this);
+ }
+
+ d->page = page;
+ if (!d->page)
+ return;
+ d->page->d->client = d; // set the page client
+
+ QSize size = geometry().size().toSize();
+ page->setViewportSize(size);
+
+ QWebFrame* mainFrame = d->page->mainFrame();
+
+ connect(mainFrame, SIGNAL(titleChanged(const QString&)),
+ this, SIGNAL(titleChanged(const QString&)));
+ connect(mainFrame, SIGNAL(iconChanged()),
+ this, SIGNAL(iconChanged()));
+ connect(mainFrame, SIGNAL(urlChanged(const QUrl&)),
+ this, SIGNAL(urlChanged(const QUrl&)));
+ connect(d->page, SIGNAL(loadStarted()),
+ this, SIGNAL(loadStarted()));
+ connect(d->page, SIGNAL(loadProgress(int)),
+ this, SLOT(_q_doLoadProgress(int)));
+ connect(d->page, SIGNAL(loadFinished(bool)),
+ this, SLOT(_q_doLoadFinished(bool)));
+ connect(d->page, SIGNAL(statusBarMessage(const QString&)),
+ this, SLOT(_q_setStatusBarMessage(const QString&)));
+}
+
+/*!
+ \property QGraphicsWebView::url
+ \brief the url of the web page currently viewed
+
+ Setting this property clears the view and loads the URL.
+
+ By default, this property contains an empty, invalid URL.
+
+ \sa load(), urlChanged()
+*/
+
+void QGraphicsWebView::setUrl(const QUrl &url)
+{
+ page()->mainFrame()->setUrl(url);
+}
+
+QUrl QGraphicsWebView::url() const
+{
+ if (d->page)
+ return d->page->mainFrame()->url();
+
+ return QUrl();
+}
+
+/*!
+ \property QGraphicsWebView::title
+ \brief the title of the web page currently viewed
+
+ By default, this property contains an empty string.
+
+ \sa titleChanged()
+*/
+QString QGraphicsWebView::title() const
+{
+ if (d->page)
+ return d->page->mainFrame()->title();
+
+ return QString();
+}
+
+/*!
+ \property QGraphicsWebView::icon
+ \brief the icon associated with the web page currently viewed
+
+ By default, this property contains a null icon.
+
+ \sa iconChanged(), QWebSettings::iconForUrl()
+*/
+QIcon QGraphicsWebView::icon() const
+{
+ if (d->page)
+ return d->page->mainFrame()->icon();
+
+ return QIcon();
+}
+
+/*!
+ \property QGraphicsWebView::zoomFactor
+ \since 4.5
+ \brief the zoom factor for the view
+*/
+
+void QGraphicsWebView::setZoomFactor(qreal factor)
+{
+ if (factor == page()->mainFrame()->zoomFactor())
+ return;
+
+ page()->mainFrame()->setZoomFactor(factor);
+ emit zoomFactorChanged();
+}
+
+qreal QGraphicsWebView::zoomFactor() const
+{
+ return page()->mainFrame()->zoomFactor();
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::updateGeometry()
+{
+ QGraphicsWidget::updateGeometry();
+
+ if (!d->page)
+ return;
+
+ QSize size = geometry().size().toSize();
+ d->page->setViewportSize(size);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::setGeometry(const QRectF& rect)
+{
+ QGraphicsWidget::setGeometry(rect);
+
+ if (!d->page)
+ return;
+
+ // NOTE: call geometry() as setGeometry ensures that
+ // the geometry is within legal bounds (minimumSize, maximumSize)
+ QSize size = geometry().size().toSize();
+ d->page->setViewportSize(size);
+}
+
+/*!
+ \property QGraphicsWebView::status
+ \brief the load status message.
+
+ Provides the latest status message set during the load of a URL.
+ Commonly shown by Status Bar widgets.
+
+ \sa statusChanged()
+*/
+
+QString QGraphicsWebView::status() const
+{
+ return d->statusBarMessage;
+}
+
+/*!
+ Convenience slot that stops loading the document.
+
+ \sa reload(), loadFinished()
+*/
+void QGraphicsWebView::stop()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Stop);
+}
+
+/*!
+ Convenience slot that loads the previous document in the list of documents
+ built by navigating links. Does nothing if there is no previous document.
+
+ \sa forward()
+*/
+void QGraphicsWebView::back()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Back);
+}
+
+/*!
+ Convenience slot that loads the next document in the list of documents
+ built by navigating links. Does nothing if there is no next document.
+
+ \sa back()
+*/
+void QGraphicsWebView::forward()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Forward);
+}
+
+/*!
+ Reloads the current document.
+
+ \sa stop(), loadStarted()
+*/
+void QGraphicsWebView::reload()
+{
+ if (d->page)
+ d->page->triggerAction(QWebPage::Reload);
+}
+
+/*!
+ \property QGraphicsWebView::progress
+ \brief the progress of loading the current URL, from 0 to 1.
+*/
+qreal QGraphicsWebView::progress() const
+{
+ return d->progress;
+}
+
+/*!
+ Loads the specified \a url and displays it.
+
+ \note The view remains the same until enough data has arrived to display the new \a url.
+
+ \sa setUrl(), url(), urlChanged()
+*/
+void QGraphicsWebView::load(const QUrl& url)
+{
+ page()->mainFrame()->load(url);
+}
+
+/*!
+ \fn void QGraphicsWebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body)
+
+ Loads a network request, \a request, using the method specified in \a operation.
+
+ \a body is optional and is only used for POST operations.
+
+ \note The view remains the same until enough data has arrived to display the new url.
+
+ \sa url(), urlChanged()
+*/
+
+void QGraphicsWebView::load(const QNetworkRequest& request,
+ QNetworkAccessManager::Operation operation,
+ const QByteArray& body)
+{
+ page()->mainFrame()->load(request, operation, body);
+}
+
+/*!
+ \property QGraphicsWebView::html
+ This property provides an HTML interface to the text in the webview.
+
+ When setting this property, external objects such as stylesheets or images
+ referenced in the HTML document are located relative to \a baseUrl.
+
+ The \a html is loaded immediately; external objects are loaded asynchronously.
+
+ When using these methods, WebKit assumes that external resources such as
+ JavaScript programs or style sheets are encoded in UTF-8 unless otherwise
+ specified. For example, the encoding of an external script can be specified
+ through the charset attribute of the HTML script tag. Alternatively, the
+ encoding can also be specified by the web server.
+
+ \sa load(), setContent(), QWebFrame::toHtml()
+*/
+void QGraphicsWebView::setHtml(const QString& html, const QUrl& baseUrl)
+{
+ page()->mainFrame()->setHtml(html, baseUrl);
+}
+
+QString QGraphicsWebView::toHtml() const
+{
+ return page()->mainFrame()->toHtml();
+}
+
+/*!
+ Sets the content of the web graphicsitem to the specified content \a data. If the \a mimeType argument
+ is empty it is currently assumed that the content is HTML but in future versions we may introduce
+ auto-detection.
+
+ External objects referenced in the content are located relative to \a baseUrl.
+
+ The \a data is loaded immediately; external objects are loaded asynchronously.
+
+ \sa load(), setHtml(), QWebFrame::toHtml()
+*/
+void QGraphicsWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl)
+{
+ page()->mainFrame()->setContent(data, mimeType, baseUrl);
+}
+
+/*!
+ Returns a pointer to the view's history of navigated web pages.
+
+ It is equivalent to
+
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0
+*/
+QWebHistory* QGraphicsWebView::history() const
+{
+ return page()->history();
+}
+
+/*!
+ \property QGraphicsWebView::interactive
+ \brief controls whether the item responds to mouse and key events.
+*/
+
+bool QGraphicsWebView::isInteractive() const
+{
+ return d->interactive;
+}
+
+void QGraphicsWebView::setInteractive(bool allowed)
+{
+ if (d->interactive == allowed)
+ return;
+
+ d->interactive = allowed;
+ emit interactivityChanged();
+}
+
+/*!
+ Returns a pointer to the view/page specific settings object.
+
+ It is equivalent to
+
+ \snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 1
+
+ \sa QWebSettings::globalSettings()
+*/
+QWebSettings* QGraphicsWebView::settings() const
+{
+ return page()->settings();
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ 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);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::hoverMoveEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::hoverLeaveEvent(QGraphicsSceneHoverEvent* ev)
+{
+ Q_UNUSED(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::mouseMoveEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::mousePressEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::mouseReleaseEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::mouseDoubleClickEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::keyPressEvent(QKeyEvent* ev)
+{
+ if (d->interactive && d->page)
+ d->page->event(ev);
+
+ if (!ev->isAccepted())
+ QGraphicsItem::keyPressEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::keyReleaseEvent(QKeyEvent* ev)
+{
+ if (d->interactive && d->page)
+ d->page->event(ev);
+
+ if (!ev->isAccepted())
+ QGraphicsItem::keyReleaseEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::focusInEvent(QFocusEvent* ev)
+{
+ if (d->page)
+ d->page->event(ev);
+ else
+ QGraphicsItem::focusInEvent(ev);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::focusOutEvent(QFocusEvent* ev)
+{
+ if (d->page)
+ d->page->event(ev);
+ else
+ QGraphicsItem::focusOutEvent(ev);
+}
+
+/*! \reimp
+*/
+bool QGraphicsWebView::focusNextPrevChild(bool next)
+{
+ if (d->page)
+ return d->page->focusNextPrevChild(next);
+
+ return QGraphicsWidget::focusNextPrevChild(next);
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::dragEnterEvent(QGraphicsSceneDragDropEvent* ev)
+{
+#ifndef QT_NO_DRAGANDDROP
+ //if (d->page)
+ // d->page->event(ev);
+ //Just remove this line below when the code above is working
+ Q_UNUSED(ev);
+#else
+ Q_UNUSED(ev);
+#endif
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev)
+{
+#ifndef QT_NO_DRAGANDDROP
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsWidget::dragLeaveEvent(ev);
+#else
+ Q_UNUSED(ev);
+#endif
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::dragMoveEvent(QGraphicsSceneDragDropEvent* ev)
+{
+#ifndef QT_NO_DRAGANDDROP
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsWidget::dragMoveEvent(ev);
+#else
+ Q_UNUSED(ev);
+#endif
+}
+
+/*! \reimp
+*/
+void QGraphicsWebView::dropEvent(QGraphicsSceneDragDropEvent* ev)
+{
+#ifndef QT_NO_DRAGANDDROP
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsWidget::dropEvent(ev);
+#else
+ Q_UNUSED(ev);
+#endif
+}
+
+#ifndef QT_NO_CONTEXTMENU
+/*! \reimp
+*/
+void QGraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev)
+{
+ if (d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+}
+#endif // QT_NO_CONTEXTMENU
+
+#ifndef QT_NO_WHEELEVENT
+/*! \reimp
+*/
+void QGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent* ev)
+{
+ if (d->interactive && d->page) {
+ const bool accepted = ev->isAccepted();
+ d->page->event(ev);
+ ev->setAccepted(accepted);
+ }
+
+ if (!ev->isAccepted())
+ QGraphicsItem::wheelEvent(ev);
+}
+#endif // QT_NO_WHEELEVENT
+
+/*! \reimp
+*/
+void QGraphicsWebView::inputMethodEvent(QInputMethodEvent* ev)
+{
+ if (d->interactive && d->page)
+ d->page->event(ev);
+
+ if (!ev->isAccepted())
+ QGraphicsItem::inputMethodEvent(ev);
+}
+
+#include "moc_qgraphicswebview.cpp"
diff --git a/WebKit/qt/Api/qgraphicswebview.h b/WebKit/qt/Api/qgraphicswebview.h
new file mode 100644
index 0000000..26f7374
--- /dev/null
+++ b/WebKit/qt/Api/qgraphicswebview.h
@@ -0,0 +1,143 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef QGraphicsWebView_h
+#define QGraphicsWebView_h
+
+#include "qwebkitglobal.h"
+#include <QtCore/qurl.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qgraphicswidget.h>
+#include <QtGui/qicon.h>
+#include <QtGui/qpainter.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+
+class QWebPage;
+class QWebHistory;
+class QWebSettings;
+
+class QGraphicsWebViewPrivate;
+
+class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
+ Q_OBJECT
+
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
+ Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
+ Q_PROPERTY(QString status READ status NOTIFY statusChanged)
+
+ Q_PROPERTY(QString html READ toHtml WRITE setHtml)
+ Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
+ Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
+
+ Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactivityChanged)
+
+public:
+ QGraphicsWebView(QGraphicsItem* parent = 0);
+ ~QGraphicsWebView();
+
+ QWebPage* page() const;
+ void setPage(QWebPage*);
+
+ QUrl url() const;
+ void setUrl(const QUrl&);
+
+ QString title() const;
+ QIcon icon() const;
+
+ qreal zoomFactor() const;
+ void setZoomFactor(qreal);
+
+ bool isInteractive() const;
+ void setInteractive(bool);
+
+ qreal progress() const;
+
+ void load(const QUrl &url);
+ void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
+
+ QString toHtml() const;
+ void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
+ // FIXME: Consider rename to setHtml?
+ void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
+
+ QWebHistory* history() const;
+ QWebSettings* settings() const;
+
+ QString status() const;
+
+ virtual void setGeometry(const QRectF& rect);
+ virtual void updateGeometry();
+ virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
+ virtual bool event(QEvent*);
+
+public Q_SLOTS:
+ void stop();
+ void back();
+ void forward();
+ void reload();
+
+Q_SIGNALS:
+ void loadStarted();
+ void loadFinished(bool);
+
+ void progressChanged(qreal);
+ void interactivityChanged();
+ void urlChanged(const QUrl&);
+ void titleChanged(const QString&);
+ void iconChanged();
+ void statusChanged();
+ void zoomFactorChanged();
+
+protected:
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
+ virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
+#ifndef QT_NO_WHEELEVENT
+ virtual void wheelEvent(QGraphicsSceneWheelEvent*);
+#endif
+ virtual void keyPressEvent(QKeyEvent*);
+ virtual void keyReleaseEvent(QKeyEvent*);
+#ifndef QT_NO_CONTEXTMENU
+ virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
+#endif
+ virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*);
+ virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
+ virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*);
+ virtual void dropEvent(QGraphicsSceneDragDropEvent*);
+ virtual void focusInEvent(QFocusEvent*);
+ virtual void focusOutEvent(QFocusEvent*);
+ virtual void inputMethodEvent(QInputMethodEvent*);
+ virtual bool focusNextPrevChild(bool next);
+
+ virtual bool sceneEvent(QEvent*);
+
+private:
+ Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress))
+ Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
+ Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message))
+
+ QGraphicsWebViewPrivate* const d;
+ friend class QGraphicsWebViewPrivate;
+};
+
+#endif // QGraphicsWebView_h
diff --git a/WebKit/qt/Api/qwebdatabase.cpp b/WebKit/qt/Api/qwebdatabase.cpp
index d51e4e6..4e8fd30 100644
--- a/WebKit/qt/Api/qwebdatabase.cpp
+++ b/WebKit/qt/Api/qwebdatabase.cpp
@@ -33,6 +33,8 @@ using namespace WebCore;
\since 4.5
\brief The QWebDatabase class provides access to HTML 5 databases created with JavaScript.
+ \inmodule QtWebKit
+
The upcoming HTML 5 standard includes support for SQL databases that web sites can create and
access on a local computer through JavaScript. QWebDatabase is the C++ interface to these
databases.
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp
index 14b2811..939d881 100644
--- a/WebKit/qt/Api/qwebelement.cpp
+++ b/WebKit/qt/Api/qwebelement.cpp
@@ -23,8 +23,8 @@
#include "CSSComputedStyleDeclaration.h"
#include "CSSMutableStyleDeclaration.h"
#include "CSSParser.h"
-#include "CSSRuleList.h"
#include "CSSRule.h"
+#include "CSSRuleList.h"
#include "CSSStyleRule.h"
#include "CString.h"
#include "Document.h"
@@ -42,6 +42,7 @@
#include "qwebframe.h"
#include "qwebframe_p.h"
#include "runtime_root.h"
+#include <parser/SourceCode.h>
#include <wtf/Vector.h>
using namespace WebCore;
@@ -53,45 +54,47 @@ public:
/*!
\class QWebElement
\since 4.6
- \brief The QWebElement class provides convenient access to DOM elements in a QWebFrame.
+ \brief The QWebElement class provides convenient access to DOM elements in
+ a QWebFrame.
+ \inmodule QtWebKit
- QWebElement is the main class to easily access to the document model.
- The document model is represented by a tree-like structure of DOM elements.
- The root of the tree is called the document element and can be accessed using QWebFrame::documentElement().
+ A QWebElement object allows easy access to the document model, represented
+ by a tree-like structure of DOM elements. The root of the tree is called
+ the document element and can be accessed using
+ QWebFrame::documentElement().
- You can reach specific elements using findAll() and findFirst(); the elements
- are identified through CSS selectors.
+ Specific elements can be accessed using findAll() and findFirst(). These
+ elements are identified using CSS selectors. The code snippet below
+ demonstrates the use of findAll().
\snippet webkitsnippets/webelement/main.cpp FindAll
- The first list contains all \c span elements in the document. The second list contains
- \c span elements that are children of \c p, classified with \c intro.
+ The first list contains all \c span elements in the document. The second
+ list contains \c span elements that are children of \c p, classified with
+ \c intro.
- Using findFirst() is more efficient than calling findAll() and extracting the first element
- only in the returned list.
+ Using findFirst() is more efficient than calling findAll(), and extracting
+ the first element only in the list returned.
- Alternatively you can manually traverse the document using firstChild() and nextSibling():
+ Alternatively you can traverse the document manually using firstChild() and
+ nextSibling():
\snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement
- The underlying content of QWebElement is explicitly shared. Creating a copy of a QWebElement
- does not create a copy of the content. Instead, both instances point to the same element.
-
- The element's attributes can be read using attribute() and modified with setAttribute().
-
- The contents of child elements can be converted to plain text with toPlainText() and to
- XHTML using toInnerXml(). To also include the element's tag in the output, use toOuterXml().
+ The underlying content of QWebElement is explicitly shared. Creating a copy
+ of a QWebElement does not create a copy of the content. Instead, both
+ instances point to the same element.
- It is possible to replace the contents using setPlainText() and setInnerXml(). To replace
- the element itself and its contents, use setOuterXml().
+ The element's attributes can be read using attribute() and modified with
+ setAttribute().
- In the JavaScript DOM interfaces, elements can have additional functions depending on their
- type. For example an HTML form element can be triggered to submit the entire form to the
- web server using the submit() function. A list of these special functions can be obtained
- in QWebElement using functions(); they can be invoked using callFunction().
+ The contents of child elements can be converted to plain text with
+ toPlainText(); to XHTML using toInnerXml(). To include the element's tag in
+ the output, use toOuterXml().
- Similarly element specific properties can be obtained using scriptableProperties() and
- read/written using scriptableProperty()/setScriptableProperty().
+ It is possible to replace the contents of child elements using
+ setPlainText() and setInnerXml(). To replace the element itself and its
+ contents, use setOuterXml().
*/
/*!
@@ -156,7 +159,7 @@ QWebElement &QWebElement::operator=(const QWebElement &other)
}
/*!
- Destroys the element. The underlying DOM element is not destroyed.
+ Destroys the element. However, the underlying DOM element is not destroyed.
*/
QWebElement::~QWebElement()
{
@@ -176,7 +179,7 @@ bool QWebElement::operator!=(const QWebElement& o) const
}
/*!
- Returns true if the element is a null element; false otherwise.
+ Returns true if the element is a null element; otherwise returns false.
*/
bool QWebElement::isNull() const
{
@@ -184,13 +187,16 @@ bool QWebElement::isNull() const
}
/*!
- Returns a new list of child elements matching the given CSS selector \a selectorQuery.
- If there are no matching elements, an empty list is returned.
+ Returns a new list of child elements matching the given CSS selector
+ \a selectorQuery. If there are no matching elements, an empty list is
+ returned.
- \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} syntax is
- used for the query.
+ \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
+ syntax is used for the query.
\note This search is performed recursively.
+
+ \sa findFirst()
*/
QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
{
@@ -203,7 +209,7 @@ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
if (!nodes)
return elements;
- for (int i = 0; i < nodes->length(); ++i) {
+ for (unsigned i = 0; i < nodes->length(); ++i) {
WebCore::Node* n = nodes->item(i);
elements.append(QWebElement(static_cast<Element*>(n)));
}
@@ -212,12 +218,15 @@ QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
}
/*!
- Returns the first child element that matches the given CSS selector \a selectorQuery.
+ Returns the first child element that matches the given CSS selector
+ \a selectorQuery.
- \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} syntax is
- used for the query.
+ \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector}
+ syntax is used for the query.
\note This search is performed recursively.
+
+ \sa findAll()
*/
QWebElement QWebElement::findFirst(const QString &selectorQuery) const
{
@@ -231,6 +240,8 @@ QWebElement QWebElement::findFirst(const QString &selectorQuery) const
Replaces the existing content of this element with \a text.
This is equivalent to setting the HTML innerText property.
+
+ \sa toPlainText()
*/
void QWebElement::setPlainText(const QString &text)
{
@@ -245,6 +256,8 @@ void QWebElement::setPlainText(const QString &text)
element.
This is equivalent to reading the HTML innerText property.
+
+ \sa setPlainText()
*/
QString QWebElement::toPlainText() const
{
@@ -254,11 +267,13 @@ QString QWebElement::toPlainText() const
}
/*!
- Replaces the contents of this element as well as its own tag with \a markup.
- The string may contain HTML or XML tags, which is parsed and formatted
- before insertion into the document.
+ Replaces the contents of this element as well as its own tag with
+ \a markup. The string may contain HTML or XML tags, which is parsed and
+ formatted before insertion into the document.
\note This is currently only implemented for (X)HTML elements.
+
+ \sa toOuterXml(), toInnerXml(), setInnerXml()
*/
void QWebElement::setOuterXml(const QString &markup)
{
@@ -272,9 +287,11 @@ void QWebElement::setOuterXml(const QString &markup)
/*!
Returns this element converted to XML, including the start and the end
- tag of this element and its attributes.
+ tags as well as its attributes.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa setOuterXml(), setInnerXml(), toInnerXml()
*/
QString QWebElement::toOuterXml() const
{
@@ -285,11 +302,13 @@ QString QWebElement::toOuterXml() const
}
/*!
- Replaces the content of this element with \a markup.
- The string may contain HTML or XML tags, which is parsed and formatted
- before insertion into the document.
+ Replaces the contents of this element with \a markup. The string may
+ contain HTML or XML tags, which is parsed and formatted before insertion
+ into the document.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa toInnerXml(), toOuterXml(), setOuterXml()
*/
void QWebElement::setInnerXml(const QString &markup)
{
@@ -302,10 +321,11 @@ void QWebElement::setInnerXml(const QString &markup)
}
/*!
- Returns the XML between the start and the end tag of this
- element.
+ Returns the XML content between the element's start and end tags.
- \note This is currently only implemented for (X)HTML elements.
+ \note This is currently implemented for (X)HTML elements only.
+
+ \sa setInnerXml(), setOuterXml(), toOuterXml()
*/
QString QWebElement::toInnerXml() const
{
@@ -316,8 +336,10 @@ QString QWebElement::toInnerXml() const
}
/*!
- Adds an attribute called \a name with the value \a value. If an attribute
- with the same name exists, its value is replaced by \a value.
+ Adds an attribute with the given \a name and \a value. If an attribute with
+ the same name exists, its value is replaced by \a value.
+
+ \sa attribute(), attributeNS(), setAttributeNS()
*/
void QWebElement::setAttribute(const QString &name, const QString &value)
{
@@ -328,9 +350,11 @@ void QWebElement::setAttribute(const QString &name, const QString &value)
}
/*!
- Adds an attribute called \a name in the namespace described with \a namespaceUri
- with the value \a value. If an attribute with the same name exists, its value is
- replaced by \a value.
+ Adds an attribute with the given \a name in \a namespaceUri with \a value.
+ If an attribute with the same name exists, its value is replaced by
+ \a value.
+
+ \sa attributeNS(), attribute(), setAttribute()
*/
void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value)
{
@@ -341,8 +365,10 @@ void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Returns the attributed called \a name. If the attribute does not exist \a defaultValue is
- returned.
+ Returns the attribute with the given \a name. If the attribute does not
+ exist, \a defaultValue is returned.
+
+ \sa setAttribute(), setAttributeNS(), attributeNS()
*/
QString QWebElement::attribute(const QString &name, const QString &defaultValue) const
{
@@ -355,8 +381,10 @@ QString QWebElement::attribute(const QString &name, const QString &defaultValue)
}
/*!
- Returns the attributed called \a name in the namespace described with \a namespaceUri.
- If the attribute does not exist \a defaultValue is returned.
+ Returns the attribute with the given \a name in \a namespaceUri. If the
+ attribute does not exist, \a defaultValue is returned.
+
+ \sa setAttributeNS(), setAttribute(), attribute()
*/
QString QWebElement::attributeNS(const QString &namespaceUri, const QString &name, const QString &defaultValue) const
{
@@ -369,7 +397,10 @@ QString QWebElement::attributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Returns true if this element has an attribute called \a name; otherwise returns false.
+ Returns true if this element has an attribute with the given \a name;
+ otherwise returns false.
+
+ \sa attribute(), setAttribute()
*/
bool QWebElement::hasAttribute(const QString &name) const
{
@@ -379,8 +410,10 @@ bool QWebElement::hasAttribute(const QString &name) const
}
/*!
- Returns true if this element has an attribute called \a name in the namespace described
- with \a namespaceUri; otherwise returns false.
+ Returns true if this element has an attribute with the given \a name, in
+ \a namespaceUri; otherwise returns false.
+
+ \sa attributeNS(), setAttributeNS()
*/
bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &name) const
{
@@ -390,7 +423,9 @@ bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &nam
}
/*!
- Removes the attribute called \a name from this element.
+ Removes the attribute with the given \a name from this element.
+
+ \sa attribute(), setAttribute(), hasAttribute()
*/
void QWebElement::removeAttribute(const QString &name)
{
@@ -401,8 +436,10 @@ void QWebElement::removeAttribute(const QString &name)
}
/*!
- Removes the attribute called \a name in the namespace described with \a namespaceUri
- from this element.
+ Removes the attribute with the given \a name, in \a namespaceUri, from this
+ element.
+
+ \sa attributeNS(), setAttributeNS(), hasAttributeNS()
*/
void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &name)
{
@@ -413,7 +450,10 @@ void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &
}
/*!
- Returns true if the element has any attributes defined; otherwise returns false;
+ Returns true if the element has any attributes defined; otherwise returns
+ false;
+
+ \sa attribute(), setAttribute()
*/
bool QWebElement::hasAttributes() const
{
@@ -423,7 +463,36 @@ bool QWebElement::hasAttributes() const
}
/*!
+ Returns true if the element has keyboard input focus; otherwise, returns false
+
+ \sa setFocus()
+*/
+bool QWebElement::hasFocus() const
+{
+ if (!m_element)
+ return false;
+ if (m_element->document())
+ return m_element == m_element->document()->focusedNode();
+ return false;
+}
+
+/*!
+ Gives keyboard input focus to this element
+
+ \sa hasFocus()
+*/
+void QWebElement::setFocus()
+{
+ if (!m_element)
+ return;
+ if (m_element->document() && m_element->isFocusable())
+ m_element->document()->setFocusedNode(m_element);
+}
+
+/*!
Returns the geometry of this element, relative to its containing frame.
+
+ \sa tagName()
*/
QRect QWebElement::geometry() const
{
@@ -434,6 +503,8 @@ QRect QWebElement::geometry() const
/*!
Returns the tag name of this element.
+
+ \sa geometry()
*/
QString QWebElement::tagName() const
{
@@ -443,7 +514,8 @@ QString QWebElement::tagName() const
}
/*!
- Returns the namespace prefix of the element or an empty string if the element has no namespace prefix.
+ Returns the namespace prefix of the element. If the element has no\
+ namespace prefix, empty string is returned.
*/
QString QWebElement::prefix() const
{
@@ -453,8 +525,8 @@ QString QWebElement::prefix() const
}
/*!
- If the element uses namespaces, this function returns the local name of the element;
- otherwise it returns an empty string.
+ Returns the local name of the element. If the element does not use
+ namespaces, an empty string is returned.
*/
QString QWebElement::localName() const
{
@@ -464,7 +536,8 @@ QString QWebElement::localName() const
}
/*!
- Returns the namespace URI of this element or an empty string if the element has no namespace URI.
+ Returns the namespace URI of this element. If the element has no namespace
+ URI, an empty string is returned.
*/
QString QWebElement::namespaceUri() const
{
@@ -474,8 +547,8 @@ QString QWebElement::namespaceUri() const
}
/*!
- Returns the parent element of this element or a null element if this element
- is the root document element.
+ Returns the parent element of this elemen. If this element is the root
+ document element, a null element is returned.
*/
QWebElement QWebElement::parent() const
{
@@ -485,9 +558,9 @@ QWebElement QWebElement::parent() const
}
/*!
- Returns the first child element of this element.
+ Returns the element's first child.
- \sa lastChild() previousSibling() nextSibling()
+ \sa lastChild(), previousSibling(), nextSibling()
*/
QWebElement QWebElement::firstChild() const
{
@@ -503,9 +576,9 @@ QWebElement QWebElement::firstChild() const
}
/*!
- Returns the last child element of this element.
+ Returns the element's last child.
- \sa firstChild() previousSibling() nextSibling()
+ \sa firstChild(), previousSibling(), nextSibling()
*/
QWebElement QWebElement::lastChild() const
{
@@ -521,9 +594,9 @@ QWebElement QWebElement::lastChild() const
}
/*!
- Returns the next sibling element of this element.
+ Returns the element's next sibling.
- \sa firstChild() previousSibling() lastChild()
+ \sa firstChild(), previousSibling(), lastChild()
*/
QWebElement QWebElement::nextSibling() const
{
@@ -539,9 +612,9 @@ QWebElement QWebElement::nextSibling() const
}
/*!
- Returns the previous sibling element of this element.
+ Returns the element's previous sibling.
- \sa firstChild() nextSibling() lastChild()
+ \sa firstChild(), nextSibling(), lastChild()
*/
QWebElement QWebElement::previousSibling() const
{
@@ -557,7 +630,7 @@ QWebElement QWebElement::previousSibling() const
}
/*!
- Returns the document this element belongs to.
+ Returns the document which this element belongs to.
*/
QWebElement QWebElement::document() const
{
@@ -570,8 +643,8 @@ QWebElement QWebElement::document() const
}
/*!
- Returns the web frame this elements is a part of. If the element is
- a null element null is returned.
+ Returns the web frame which this element is a part of. If the element is a
+ null element, null is returned.
*/
QWebFrame *QWebElement::webFrame() const
{
@@ -617,41 +690,10 @@ static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValu
}
-static bool setupScriptObject(WebCore::Element* element, ScriptObject& object, ScriptState*& state, ScriptController*& scriptController)
-{
- if (!element)
- return false;
-
- Document* document = element->document();
- if (!document)
- return false;
-
- Frame* frame = document->frame();
- if (!frame)
- return false;
-
- scriptController = frame->script();
-
- state = scriptController->globalObject()->globalExec();
-
- JSC::JSValue thisValue = toJS(state, element);
- if (!thisValue)
- return false;
-
- JSC::JSObject* thisObject = thisValue.toObject(state);
- if (!thisObject)
- return false;
-
- object = ScriptObject(state, thisObject);
- return true;
-}
-
/*!
- Executes the \a scriptSource with this element as the `this' object.
-
- \sa callFunction()
+ Executes \a scriptSource with this element as \c this object.
*/
-QVariant QWebElement::evaluateScript(const QString& scriptSource)
+QVariant QWebElement::evaluateJavaScript(const QString& scriptSource)
{
if (scriptSource.isEmpty())
return QVariant();
@@ -678,263 +720,40 @@ QVariant QWebElement::evaluateScript(const QString& scriptSource)
}
/*!
- Calls the function with the given \a name and \a arguments.
-
- The underlying DOM element that QWebElement wraps may have dedicated functions depending
- on its type. For example a form element can have the "submit" function, that would submit
- the form to the destination specified in the HTML.
-
- \sa functions()
-*/
-QVariant QWebElement::callFunction(const QString &name, const QVariantList &arguments)
-{
- ScriptState* state = 0;
- ScriptObject thisObject;
- ScriptController* scriptController = 0;
-
- if (!setupScriptObject(m_element, thisObject, state, scriptController))
- return QVariant();
-
- ScriptFunctionCall functionCall(state, thisObject, name);
-
- for (QVariantList::ConstIterator it = arguments.constBegin(), end = arguments.constEnd();
- it != end; ++it)
- functionCall.appendArgument(JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), *it));
-
- bool hadException = false;
- ScriptValue result = functionCall.call(hadException);
- if (hadException)
- return QVariant();
-
- int distance = 0;
- return JSC::Bindings::convertValueToQVariant(state, result.jsValue(), QMetaType::Void, &distance);
-}
-
-/*!
- Returns a list of function names this element supports.
-
- The function names returned are the same functions that are callable from the DOM
- element's JavaScript binding.
-
- \sa callFunction()
-*/
-QStringList QWebElement::functions() const
-{
- ScriptState* state = 0;
- ScriptObject thisObject;
- ScriptController* scriptController = 0;
-
- if (!setupScriptObject(m_element, thisObject, state, scriptController))
- return QStringList();
-
- JSC::JSObject* object = thisObject.jsObject();
- if (!object)
- return QStringList();
-
- QStringList names;
-
- // Enumerate the contents of the object
- JSC::PropertyNameArray properties(state);
- object->getPropertyNames(state, properties);
- for (JSC::PropertyNameArray::const_iterator it = properties.begin();
- it != properties.end(); ++it) {
-
- JSC::JSValue property = object->get(state, *it);
- if (!property)
- continue;
-
- JSC::JSObject* function = property.toObject(state);
- if (!function)
- continue;
-
- JSC::CallData callData;
- JSC::CallType callType = function->getCallData(callData);
- if (callType == JSC::CallTypeNone)
- continue;
-
- JSC::UString ustring = (*it).ustring();
- names << QString::fromUtf16((const ushort*)ustring.rep()->data(), ustring.size());
- }
-
- if (state->hadException())
- state->clearException();
-
- return names;
-}
-
-/*!
- Returns the value of the element's \a name property.
-
- If no such property exists, the returned variant is invalid.
-
- The return property has the same value as the corresponding property
- in the element's JavaScript binding with the same name.
-
- Information about all available properties is provided through scriptProperties().
-
- \sa setScriptableProperty(), scriptableProperties()
-*/
-QVariant QWebElement::scriptableProperty(const QString &name) const
-{
- ScriptState* state = 0;
- ScriptObject thisObject;
- ScriptController *scriptController = 0;
-
- if (!setupScriptObject(m_element, thisObject, state, scriptController))
- return QVariant();
-
- String wcName(name);
- JSC::JSValue property = thisObject.jsObject()->get(state, JSC::Identifier(state, wcName));
-
- // ###
- if (state->hadException())
- state->clearException();
-
- int distance = 0;
- return JSC::Bindings::convertValueToQVariant(state, property, QMetaType::Void, &distance);
-}
-
-/*!
- Sets the value of the element's \a name property to \a value.
-
- Information about all available properties is provided through scriptProperties().
-
- Setting the property will affect the corresponding property
- in the element's JavaScript binding with the same name.
-
- \sa scriptableProperty(), scriptableProperties()
-*/
-void QWebElement::setScriptableProperty(const QString &name, const QVariant &value)
-{
- ScriptState* state = 0;
- ScriptObject thisObject;
- ScriptController* scriptController = 0;
-
- if (!setupScriptObject(m_element, thisObject, state, scriptController))
- return;
-
- JSC::JSValue jsValue = JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), value);
- if (!jsValue)
- return;
-
- String wcName(name);
- JSC::PutPropertySlot slot;
- thisObject.jsObject()->put(state, JSC::Identifier(state, wcName), jsValue, slot);
- if (state->hadException())
- state->clearException();
-}
-
-/*!
- Returns a list of property names this element supports.
-
- The function names returned are the same properties that are accessible from the DOM
- element's JavaScript binding.
-
- \sa setScriptableProperty(), scriptableProperty()
-*/
-QStringList QWebElement::scriptableProperties() const
-{
- if (!m_element)
- return QStringList();
-
- Document* document = m_element->document();
- if (!document)
- return QStringList();
-
- Frame* frame = document->frame();
- if (!frame)
- return QStringList();
-
- ScriptController* script = frame->script();
- JSC::ExecState* exec = script->globalObject()->globalExec();
-
- JSC::JSValue thisValue = toJS(exec, m_element);
- if (!thisValue)
- return QStringList();
-
- JSC::JSObject* object = thisValue.toObject(exec);
- if (!object)
- return QStringList();
-
- QStringList names;
-
- // Enumerate the contents of the object
- JSC::PropertyNameArray properties(exec);
- object->getPropertyNames(exec, properties);
- for (JSC::PropertyNameArray::const_iterator it = properties.begin();
- it != properties.end(); ++it) {
-
- JSC::JSValue property = object->get(exec, *it);
- if (!property)
- continue;
-
- JSC::JSObject* function = property.toObject(exec);
- if (!function)
- continue;
-
- JSC::CallData callData;
- JSC::CallType callType = function->getCallData(callData);
- if (callType != JSC::CallTypeNone)
- continue;
-
- JSC::UString ustring = (*it).ustring();
- names << QString::fromUtf16((const ushort*)ustring.rep()->data(), ustring.size());
- }
-
- if (exec->hadException())
- exec->clearException();
-
- return names;
-}
-
-/*!
- \enum QWebElement::ResolveRule
- \since 4.6
+ \enum QWebElement::StyleResolveStrategy
This enum describes how QWebElement's styleProperty resolves the given
property name.
- \value IgnoreCascadingStyles Return the property value as it is defined
- in the element, without respecting style inheritance and other CSS rules.
- \value RespectCascadingStyles The property's value is determined using
- the inheritance and importance rules defined in the document's stylesheet.
-*/
-
-/*!
- \enum QWebElement::StylePriority
- \since 4.6
-
- This enum describes the priority newly set CSS properties should have when
- set using QWebElement::setStyleProperty().
-
- \value NormalStylePriority Define the property without important
- priority even if "!important" is explicitly set in \a value.
- \value DeclaredStylePriority Define the property respecting the
- priority specified in \a value.
- \value ImportantStylePriority Define the property to have
- an important priority, this is equal to appending "!important" to the value.
+ \value InlineStyle Return the property value as it is defined in
+ the element, without respecting style inheritance and other CSS
+ rules.
+ \value CascadedStyle The property's value is determined using the
+ inheritance and importance rules defined in the document's
+ stylesheet.
+ \value ComputedStyle The property's value is the absolute value
+ of the style property resolved from the environment.
*/
/*!
- Returns the value of the style named \a name or an empty string if such one
- does not exist.
-
- If \a rule is IgnoreCascadingStyles, the value defined inside the element
- (inline in CSS terminology) is returned.
+ Returns the value of the style with the given \a name using the specified
+ \a strategy. If a style with \a name does not exist, an empty string is
+ returned.
- if \a rule is RespectCascadingStyles, the actual style applied to the
- element is returned.
+ In CSS, the cascading part depends on which CSS rule has priority and is
+ thus applied. Generally, the last defined rule has priority. Thus, an
+ inline style rule has priority over an embedded block style rule, which
+ in return has priority over an external style rule.
- In CSS, the cascading part has to do with which CSS rule has priority and
- is thus applied. Generally speaking, the last defined rule has priority,
- thus an inline style rule has priority over an embedded block style rule,
- which in return has priority over an external style rule.
+ If the "!important" declaration is set on one of those, the declaration
+ receives highest priority, unless other declarations also use the
+ "!important" declaration. Then, the last "!important" declaration takes
+ predecence.
- If the !important declaration is set on one of those, the declaration gets
- highest priority, unless other declarations also use the !important
- declaration, in which the last !important declaration takes predecence.
+ \sa setStyleProperty()
*/
-QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
+
+QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy strategy) const
{
if (!m_element || !m_element->isStyledElement())
return QString();
@@ -946,10 +765,10 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style();
- if (rule == IgnoreCascadingStyles)
+ if (strategy == InlineStyle)
return style->getPropertyValue(propID);
- if (rule == RespectCascadingStyles) {
+ if (strategy == CascadedStyle) {
if (style->getPropertyPriority(propID))
return style->getPropertyValue(propID);
@@ -977,32 +796,33 @@ QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
return style->getPropertyValue(propID);
}
+ if (strategy == ComputedStyle) {
+ if (!m_element || !m_element->isStyledElement())
+ return QString();
+
+ int propID = cssPropertyID(name);
+
+ RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element);
+ if (!propID || !style)
+ return QString();
+
+ return style->getPropertyValue(propID);
+ }
+
return QString();
}
/*!
- Sets the value of the style named \a name to \a value.
+ Sets the value of the inline style with the given \a name to \a value.
- Setting a value, doesn't necessarily mean that it will become the applied
+ Setting a value, does not necessarily mean that it will become the applied
value, due to the fact that the style property's value might have been set
- earlier with priority in external or embedded style declarations.
+ earlier with a higher priority in external or embedded style declarations.
- In order to ensure that the value will be applied, ImportantStylePriority
- should be used as \a priority.
-
- Following the CSS syntax for property values, this is equal to appending
+ In order to ensure that the value will be applied, you may have to append
"!important" to the value.
-
- This syntax is supported when using DeclaredStylePriority as \a priority.
-
- Using NormalStylePriority as \a priority, the property will have normal
- priority, and any "!important" declaration will be ignored. On the other
- hand, using ImportantStylePriority sets the important priority even when
- not explicit passed in \a value.
- By using DeclaredStylePriority as \a priority the property will respect the
- priority specified in \a value.
*/
-void QWebElement::setStyleProperty(const QString &name, const QString &value, StylePriority priority)
+void QWebElement::setStyleProperty(const QString &name, const QString &value)
{
if (!m_element || !m_element->isStyledElement())
return;
@@ -1013,42 +833,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value, St
return;
ExceptionCode exception = 0;
-
- const QRegExp hasImportantTest(QLatin1String("!\\s*important"));
- int index = value.indexOf(hasImportantTest);
-
- QString newValue = (index != -1) ? value.left(index - 1) : value;
-
- switch (priority) {
- case NormalStylePriority:
- style->setProperty(name, newValue, "", exception);
- break;
- case DeclaredStylePriority:
- style->setProperty(name, newValue, (index != -1) ? "important" : "", exception);
- break;
- case ImportantStylePriority:
- style->setProperty(name, newValue, "important", exception);
- break;
- default:
- break;
- }
-}
-
-/*!
- Returns the computed value for style named \a name or an empty string if the style has no such name.
-*/
-QString QWebElement::computedStyleProperty(const QString &name) const
-{
- if (!m_element || !m_element->isStyledElement())
- return QString();
-
- int propID = cssPropertyID(name);
-
- RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element);
- if (!propID || !style)
- return QString();
-
- return style->getPropertyValue(propID);
+ style->setProperty(name, value, exception);
}
/*!
@@ -1083,7 +868,8 @@ QStringList QWebElement::classes() const
}
/*!
- Returns true if this element has a class called \a name; otherwise returns false.
+ Returns true if this element has a class with the given \a name; otherwise
+ returns false.
*/
bool QWebElement::hasClass(const QString &name) const
{
@@ -1092,7 +878,7 @@ bool QWebElement::hasClass(const QString &name) const
}
/*!
- Adds the specified class \a name to the element.
+ Adds the specified class with the given \a name to the element.
*/
void QWebElement::addClass(const QString &name)
{
@@ -1105,7 +891,7 @@ void QWebElement::addClass(const QString &name)
}
/*!
- Removes the specified class \a name from the element.
+ Removes the specified class with the given \a name from the element.
*/
void QWebElement::removeClass(const QString &name)
{
@@ -1118,8 +904,8 @@ void QWebElement::removeClass(const QString &name)
}
/*!
- Adds the specified class \a name if it is not present,
- removes it if it is already present.
+ Adds the specified class with the given \a name if it is not present. If
+ the class is already present, it will be removed.
*/
void QWebElement::toggleClass(const QString &name)
{
@@ -1134,11 +920,11 @@ void QWebElement::toggleClass(const QString &name)
}
/*!
- Appends \a element as the element's last child.
+ Appends the given \a element as the element's last child.
- If \a element is the child of another element, it is re-parented
- to this element. If \a element is a child of this element, then
- its position in the list of children is changed.
+ If \a element is the child of another element, it is re-parented to this
+ element. If \a element is a child of this element, then its position in
+ the list of children is changed.
Calling this function on a null element does nothing.
@@ -1178,9 +964,9 @@ void QWebElement::appendInside(const QString &markup)
/*!
Prepends \a element as the element's first child.
- If \a element is the child of another element, it is re-parented
- to this element. If \a element is a child of this element, then
- its position in the list of children is changed.
+ If \a element is the child of another element, it is re-parented to this
+ element. If \a element is a child of this element, then its position in
+ the list of children is changed.
Calling this function on a null element does nothing.
@@ -1227,10 +1013,10 @@ void QWebElement::prependInside(const QString &markup)
/*!
- Inserts \a element before this element.
+ Inserts the given \a element before this element.
- If \a element is the child of another element, it is re-parented
- to the parent of this element.
+ If \a element is the child of another element, it is re-parented to the
+ parent of this element.
Calling this function on a null element does nothing.
@@ -1274,10 +1060,10 @@ void QWebElement::prependOutside(const QString &markup)
}
/*!
- Inserts \a element after this element.
+ Inserts the given \a element after this element.
- If \a element is the child of another element, it is re-parented
- to the parent of this element.
+ If \a element is the child of another element, it is re-parented to the
+ parent of this element.
Calling this function on a null element does nothing.
@@ -1342,11 +1128,10 @@ QWebElement QWebElement::clone() const
}
/*!
- Removes this element from the document and returns a reference
- to this.
+ Removes this element from the document and returns a reference to it.
- The element is still valid after removal, and can be inserted into
- other parts of the document.
+ The element is still valid after removal, and can be inserted into other
+ parts of the document.
\sa removeChildren(), removeFromDocument()
*/
@@ -1362,8 +1147,7 @@ QWebElement &QWebElement::takeFromDocument()
}
/*!
- Removes this element from the document and makes this
- a null element.
+ Removes this element from the document and makes it a null element.
\sa removeChildren(), takeFromDocument()
*/
@@ -1414,9 +1198,10 @@ static RefPtr<Node> findInsertionPoint(PassRefPtr<Node> root)
}
/*!
- Enclose the contents of this element in \a element as the child
- of the deepest descendant element within the structure of the
- first element provided.
+ Encloses the contents of this element with \a element. This element becomes
+ the child of the deepest descendant within \a element.
+
+ ### illustration
\sa encloseWith()
*/
@@ -1446,9 +1231,8 @@ void QWebElement::encloseContentsWith(const QWebElement &element)
}
/*!
- Enclose the contents of this element in the result of parsing
- \a markup as the child of the deepest descendant element within
- the structure of the first element provided.
+ Encloses the contents of this element with the result of parsing \a markup.
+ This element becomes the child of the deepest descendant within \a markup.
\sa encloseWith()
*/
@@ -1490,9 +1274,8 @@ void QWebElement::encloseContentsWith(const QString &markup)
}
/*!
- Enclose this element in \a element as the child of the deepest
- descendant element within the structure of the first element
- provided.
+ Encloses this element with \a element. This element becomes the child of
+ the deepest descendant within \a element.
\sa replace()
*/
@@ -1523,8 +1306,8 @@ void QWebElement::encloseWith(const QWebElement &element)
}
/*!
- Enclose this element in the result of parsing \a markup,
- as the last child.
+ Encloses this element with the result of parsing \a markup. This element
+ becomes the child of the deepest descendant within \a markup.
\sa replace()
*/
@@ -1569,8 +1352,7 @@ void QWebElement::encloseWith(const QString &markup)
/*!
Replaces this element with \a element.
- It is not possible to replace the <html>, <head>, or <body>
- elements using this method.
+ This method will not replace the <html>, <head> or <body> elements.
\sa encloseWith()
*/
@@ -1586,8 +1368,7 @@ void QWebElement::replace(const QWebElement &element)
/*!
Replaces this element with the result of parsing \a markup.
- It is not possible to replace the <html>, <head>, or <body>
- elements using this method.
+ This method will not replace the <html>, <head> or <body> elements.
\sa encloseWith()
*/
@@ -1601,13 +1382,32 @@ void QWebElement::replace(const QString &markup)
}
/*!
+ \internal
+ Walk \a node's parents until a valid QWebElement is found.
+ For example, a WebCore::Text node is not a valid Html QWebElement, but its
+ enclosing p tag is.
+*/
+QWebElement QWebElement::enclosingElement(WebCore::Node* node)
+{
+ QWebElement element(node);
+
+ while (element.isNull() && node) {
+ node = node->parentNode();
+ element = QWebElement(node);
+ }
+ return element;
+}
+
+/*!
\fn inline bool QWebElement::operator==(const QWebElement& o) const;
- Returns true if this element points to the same underlying DOM object than \a o; otherwise returns false.
+ Returns true if this element points to the same underlying DOM object as
+ \a o; otherwise returns false.
*/
/*!
\fn inline bool QWebElement::operator!=(const QWebElement& o) const;
- Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false.
+ Returns true if this element points to a different underlying DOM object
+ than \a o; otherwise returns false.
*/
diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h
index bc6f8a9..3db4637 100644
--- a/WebKit/qt/Api/qwebelement.h
+++ b/WebKit/qt/Api/qwebelement.h
@@ -74,6 +74,9 @@ public:
void removeClass(const QString& name);
void toggleClass(const QString& name);
+ bool hasFocus() const;
+ void setFocus();
+
QRect geometry() const;
QString tagName() const;
@@ -120,30 +123,26 @@ public:
void removeFromDocument();
void removeChildren();
- QVariant evaluateScript(const QString& scriptSource);
-
- QVariant callFunction(const QString& functionName, const QVariantList& arguments = QVariantList());
- QStringList functions() const;
-
- QVariant scriptableProperty(const QString& name) const;
- void setScriptableProperty(const QString& name, const QVariant& value);
- QStringList scriptableProperties() const;
+ QVariant evaluateJavaScript(const QString& scriptSource);
- enum ResolveRule { IgnoreCascadingStyles, RespectCascadingStyles };
- QString styleProperty(const QString& name, ResolveRule = IgnoreCascadingStyles) const;
-
- enum StylePriority { NormalStylePriority, DeclaredStylePriority, ImportantStylePriority };
- void setStyleProperty(const QString& name, const QString& value, StylePriority = DeclaredStylePriority);
-
- QString computedStyleProperty(const QString& name) const;
+ enum StyleResolveStrategy {
+ InlineStyle,
+ CascadedStyle,
+ ComputedStyle,
+ };
+ QString styleProperty(const QString& name, StyleResolveStrategy strategy) const;
+ void setStyleProperty(const QString& name, const QString& value);
private:
explicit QWebElement(WebCore::Element*);
explicit QWebElement(WebCore::Node*);
+ static QWebElement enclosingElement(WebCore::Node*);
+
friend class QWebFrame;
friend class QWebHitTestResult;
friend class QWebHitTestResultPrivate;
+ friend class QWebPage;
QWebElementPrivate* d;
WebCore::Element* m_element;
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index c857df2..1777cc8 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -268,6 +268,8 @@ void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip)
\since 4.4
\brief The QWebFrame class represents a frame in a web page.
+ \inmodule QtWebKit
+
QWebFrame represents a frame inside a web page. Each QWebPage
object contains at least one frame, the main frame, obtained using
QWebPage::mainFrame(). Additional frames will be created for HTML
@@ -542,7 +544,7 @@ QUrl QWebFrame::requestedUrl() const
// 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_loadSucceeded
+ || (!d->frameLoaderClient->m_loadError.isNull()
&& !d->frame->loader()->outgoingReferrer().isEmpty()))
return QUrl(d->frame->loader()->outgoingReferrer());
@@ -708,7 +710,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)
{
@@ -716,7 +720,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);
}
@@ -729,7 +733,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)
{
@@ -739,11 +745,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.
@@ -801,13 +806,11 @@ void QWebFrame::setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPol
d->horizontalScrollBarPolicy = policy;
if (d->frame->view()) {
d->frame->view()->setHorizontalScrollbarMode((ScrollbarMode)policy);
- d->frame->view()->updateDefaultScrollbarState();
}
} else {
d->verticalScrollBarPolicy = policy;
if (d->frame->view()) {
d->frame->view()->setVerticalScrollbarMode((ScrollbarMode)policy);
- d->frame->view()->updateDefaultScrollbarState();
}
}
}
@@ -873,6 +876,7 @@ int QWebFrame::scrollBarMaximum(Qt::Orientation orientation) const
*/
int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const
{
+ Q_UNUSED(orientation)
return 0;
}
@@ -1024,7 +1028,8 @@ qreal QWebFrame::zoomFactor() const
*/
bool QWebFrame::hasFocus() const
{
- return QWebFramePrivate::kit(d->frame->page()->focusController()->focusedFrame()) == this;
+ WebCore::Frame* ff = d->frame->page()->focusController()->focusedFrame();
+ return ff && QWebFramePrivate::kit(ff) == this;
}
/*!
@@ -1246,7 +1251,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)
ScriptController *proxy = d->frame->script();
QVariant rc;
if (proxy) {
- JSC::JSValue v = proxy->evaluate(ScriptSourceCode(scriptSource)).jsValue();
+ JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
int distance = 0;
rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance);
}
@@ -1364,6 +1369,8 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame)
\brief The QWebHitTestResult class provides information about the web
page content after a hit test.
+ \inmodule QtWebKit
+
QWebHitTestResult is returned by QWebFrame::hitTestContent() to provide
information about the content of the web page at the specified position.
*/
diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h
index d6afc01..632f83a 100644
--- a/WebKit/qt/Api/qwebframe_p.h
+++ b/WebKit/qt/Api/qwebframe_p.h
@@ -79,15 +79,14 @@ public:
WebCore::Scrollbar* horizontalScrollBar() const;
WebCore::Scrollbar* verticalScrollBar() const;
- Qt::ScrollBarPolicy horizontalScrollBarPolicy;
- Qt::ScrollBarPolicy verticalScrollBarPolicy;
-
static WebCore::Frame* core(QWebFrame*);
static QWebFrame* kit(WebCore::Frame*);
void renderPrivate(QPainter *painter, const QRegion &clip);
QWebFrame *q;
+ Qt::ScrollBarPolicy horizontalScrollBarPolicy;
+ Qt::ScrollBarPolicy verticalScrollBarPolicy;
WebCore::FrameLoaderClientQt *frameLoaderClient;
WebCore::Frame *frame;
QWebPage *page;
diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp
index 1c1c72a..5752d66 100644
--- a/WebKit/qt/Api/qwebhistory.cpp
+++ b/WebKit/qt/Api/qwebhistory.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "qwebhistory.h"
#include "qwebhistory_p.h"
+#include "qwebframe_p.h"
#include "PlatformString.h"
#include "Image.h"
@@ -35,6 +36,8 @@
\since 4.4
\brief The QWebHistoryItem class represents one item in the history of a QWebPage
+ \inmodule QtWebKit
+
Each QWebHistoryItem instance represents an entry in the history stack of a Web page,
containing information about the page, its location, and when it was last visited.
@@ -201,6 +204,8 @@ bool QWebHistoryItem::isValid() const
\since 4.4
\brief The QWebHistory class represents the history of a QWebPage
+ \inmodule QtWebKit
+
Each QWebPage instance contains a history of visited pages that can be accessed
by QWebPage::history(). QWebHistory represents this history and makes it possible
to navigate it.
@@ -244,17 +249,27 @@ QWebHistory::~QWebHistory()
*/
void QWebHistory::clear()
{
- RefPtr<WebCore::HistoryItem> current = d->lst->currentItem();
- int capacity = d->lst->capacity();
- d->lst->setCapacity(0);
+ //shortcut to private BackForwardList
+ WebCore::BackForwardList* lst = d->lst;
- WebCore::Page* page = d->lst->page();
+ //clear visited links
+ WebCore::Page* page = lst->page();
if (page && page->groupPtr())
page->groupPtr()->removeVisitedLinks();
- d->lst->setCapacity(capacity);
- d->lst->addItem(current.get());
- d->lst->goToItem(current.get());
+ //if count() == 0 then just return
+ if (!lst->entries().size())
+ return;
+
+ RefPtr<WebCore::HistoryItem> current = lst->currentItem();
+ int capacity = lst->capacity();
+ lst->setCapacity(0);
+
+ lst->setCapacity(capacity); //revert capacity
+ lst->addItem(current.get()); //insert old current item
+ lst->goToItem(current.get()); //and set it as current again
+
+ d->page()->updateNavigationActions();
}
/*!
@@ -267,7 +282,7 @@ QList<QWebHistoryItem> QWebHistory::items() const
const WebCore::HistoryItemVector &items = d->lst->entries();
QList<QWebHistoryItem> ret;
- for (int i = 0; i < items.size(); ++i) {
+ for (unsigned i = 0; i < items.size(); ++i) {
QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get());
ret.append(QWebHistoryItem(priv));
}
@@ -286,7 +301,7 @@ QList<QWebHistoryItem> QWebHistory::backItems(int maxItems) const
d->lst->backListWithLimit(maxItems, items);
QList<QWebHistoryItem> ret;
- for (int i = 0; i < items.size(); ++i) {
+ for (unsigned i = 0; i < items.size(); ++i) {
QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get());
ret.append(QWebHistoryItem(priv));
}
@@ -305,7 +320,7 @@ QList<QWebHistoryItem> QWebHistory::forwardItems(int maxItems) const
d->lst->forwardListWithLimit(maxItems, items);
QList<QWebHistoryItem> ret;
- for (int i = 0; i < items.size(); ++i) {
+ for (unsigned i = 0; i < items.size(); ++i) {
QWebHistoryItemPrivate *priv = new QWebHistoryItemPrivate(items[i].get());
ret.append(QWebHistoryItem(priv));
}
@@ -341,9 +356,11 @@ bool QWebHistory::canGoForward() const
*/
void QWebHistory::back()
{
- d->lst->goBack();
- WebCore::Page* page = d->lst->page();
- page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ if (canGoBack()) {
+ d->lst->goBack();
+ WebCore::Page* page = d->lst->page();
+ page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ }
}
/*!
@@ -354,9 +371,11 @@ void QWebHistory::back()
*/
void QWebHistory::forward()
{
- d->lst->goForward();
- WebCore::Page* page = d->lst->page();
- page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ if (canGoForward()) {
+ d->lst->goForward();
+ WebCore::Page* page = d->lst->page();
+ page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ }
}
/*!
@@ -504,6 +523,8 @@ bool QWebHistory::restoreState(const QByteArray& buffer)
default: {} // result is false;
}
+ d->page()->updateNavigationActions();
+
return result;
};
@@ -529,7 +550,7 @@ QByteArray QWebHistory::saveState(HistoryStateVersion version) const
stream << count() << currentItemIndex();
const WebCore::HistoryItemVector &items = d->lst->entries();
- for (int i = 0; i < items.size(); i++)
+ for (unsigned i = 0; i < items.size(); i++)
items[i].get()->saveState(stream, version);
if (stream.status() != QDataStream::Ok)
@@ -549,8 +570,11 @@ QByteArray QWebHistory::saveState(HistoryStateVersion version) const
\fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history)
\relates QWebHistory
- Saves the given \a history into the specified \a stream. This is a convenience function
- and is equivalent to calling the saveState() method.
+ \brief The operator<< function streams a history into a data stream.
+
+ It saves the \a history into the specified \a stream. This is a
+ convenience function and is equivalent to calling the saveState()
+ method.
\sa QWebHistory::saveState()
*/
@@ -565,6 +589,8 @@ QDataStream& operator<<(QDataStream& stream, const QWebHistory& history)
\relates QWebHistory
\since 4.6
+ \brief The operator>> function loads a history from a data stream.
+
Loads a QWebHistory from the specified \a stream into the given \a history.
This is a convenience function and it is equivalent to calling the restoreState()
method.
@@ -580,4 +606,7 @@ QDataStream& operator>>(QDataStream& stream, QWebHistory& history)
return stream;
}
-
+QWebPagePrivate* QWebHistoryPrivate::page()
+{
+ return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle();
+}
diff --git a/WebKit/qt/Api/qwebhistory_p.h b/WebKit/qt/Api/qwebhistory_p.h
index e77adef..a6682cd 100644
--- a/WebKit/qt/Api/qwebhistory_p.h
+++ b/WebKit/qt/Api/qwebhistory_p.h
@@ -25,13 +25,15 @@
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
+class QWebPagePrivate;
+
class Q_AUTOTEST_EXPORT QWebHistoryItemPrivate : public QSharedData {
public:
- static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem *q)
+ static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem* q)
{
return q->d;
}
- QWebHistoryItemPrivate(WebCore::HistoryItem *i)
+ QWebHistoryItemPrivate(WebCore::HistoryItem* i)
{
if (i)
i->ref();
@@ -43,30 +45,12 @@ public:
item->deref();
}
- /* QByteArray saveStateWithoutVersionControl(QWebHistory::HistoryStateVersion version)
- {
- QByteArray buffer;
- switch(version){
- case QWebHistory::HistoryVersion1:
- buffer=item->saveState(version);
- break;
- default:{}
- }
- return buffer;
- }
-
- bool restoreStateWithoutVersionControl(QWebHistory::HistoryStateVersion version,QDataStream& stream)
- {
-
- }
-*/
-
- WebCore::HistoryItem *item;
+ WebCore::HistoryItem* item;
};
class QWebHistoryPrivate : public QSharedData {
public:
- QWebHistoryPrivate(WebCore::BackForwardList *l)
+ QWebHistoryPrivate(WebCore::BackForwardList* l)
{
l->ref();
lst = l;
@@ -75,7 +59,10 @@ public:
{
lst->deref();
}
- WebCore::BackForwardList *lst;
+
+ QWebPagePrivate* page();
+
+ WebCore::BackForwardList* lst;
};
diff --git a/WebKit/qt/Api/qwebhistoryinterface.cpp b/WebKit/qt/Api/qwebhistoryinterface.cpp
index 87d52ce..80567d1 100644
--- a/WebKit/qt/Api/qwebhistoryinterface.cpp
+++ b/WebKit/qt/Api/qwebhistoryinterface.cpp
@@ -81,6 +81,8 @@ QWebHistoryInterface* QWebHistoryInterface::defaultInterface()
\since 4.4
\brief The QWebHistoryInterface class provides an interface to implement link history.
+ \inmodule QtWebKit
+
The QWebHistoryInterface is an interface that can be used to
implement link history. It contains two pure virtual methods that
are called by the WebKit engine. addHistoryEntry() is used to add
diff --git a/WebKit/qt/Api/qwebinspector.cpp b/WebKit/qt/Api/qwebinspector.cpp
new file mode 100644
index 0000000..4578dc9
--- /dev/null
+++ b/WebKit/qt/Api/qwebinspector.cpp
@@ -0,0 +1,196 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qwebinspector.h"
+
+#include "Element.h"
+#include "InspectorController.h"
+#include "qwebelement.h"
+#include "qwebinspector_p.h"
+#include "qwebpage_p.h"
+
+#include <QResizeEvent>
+
+/*!
+ \class QWebInspector
+ \since 4.6
+ \brief The QWebInspector class allows the placement and control of a
+ QWebPage's inspector.
+ The inspector allows you to see a page current hierarchy and loading
+ statistics.
+
+ The QWebPage to be inspected is determined with the setPage() method.
+
+ A typical use of QWebInspector follows:
+
+ \snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0
+
+ \note A QWebInspector will display a blank widget if either:
+ \list
+ \o page() is null
+ \o QWebSettings::DeveloperExtrasEnabled is false
+ \endlist
+
+ \section1 Resources
+
+ Most of the resources needed by the inspector are owned by the associated
+ QWebPage and are allocated the first time that:
+ \list
+ \o an element is inspected
+ \o the QWebInspector is shown.
+ \endlist
+
+ This class acts mostly as a container and a controller for the inspector.
+ You can defer the creation and association of the QWebInspector until
+ the first emission of QWebPage::webInspectorTriggered() to save additional
+ resources.
+
+ \section1 Inspector configuration persistence
+
+ The inspector allows the user to configure some options through its
+ interface (e.g. the resource tracking "Always enable" option).
+ These settings are persisted automatically by QtWebKit using QSettings.
+
+ However since the QSettings object is instantiated using the empty
+ constructor, QCoreApplication::setOrganizationName() and
+ QCoreApplication::setApplicationName() must be called within your
+ application to enable the persistence of these options.
+*/
+
+/*!
+ Constructs an empty QWebInspector with parent \a parent.
+*/
+QWebInspector::QWebInspector(QWidget* parent)
+ : QWidget(parent)
+ , d(new QWebInspectorPrivate(this))
+{
+}
+
+/*!
+ Destroys the inspector.
+*/
+QWebInspector::~QWebInspector()
+{
+ // Remove association principally to prevent deleting a child frontend
+ setPage(0);
+}
+
+/*!
+ Sets the QWebPage to be inspected.
+
+ There can only be one QWebInspector associated with a QWebPage
+ and vices versa.
+
+ Calling with \a page as null will break the current association, if any.
+
+ If \a page is already associated to another QWebInspector, the association
+ will be replaced and the previous QWebInspector will have no page
+ associated.
+
+ \sa page()
+*/
+void QWebInspector::setPage(QWebPage* page)
+{
+ if (d->page) {
+ // Break currentPage-->this
+ d->page->d->setInspector(0);
+ }
+ if (page && page->d->inspector && page->d->inspector != this) {
+ // Break newPage<->newPageCurrentInspector
+ page->d->inspector->setPage(0);
+ }
+
+ d->page = page;
+
+ if (page) {
+ // Setup the reciprocal association
+ page->d->setInspector(this);
+ }
+}
+
+/*!
+ Returns the inspected QWebPage.
+ If no web page is currently associated, a null pointer is returned.
+*/
+QWebPage* QWebInspector::page() const
+{
+ return d->page;
+}
+
+/*! \reimp */
+QSize QWebInspector::sizeHint() const
+{
+ return QSize(450, 300);
+}
+
+/*! \reimp */
+bool QWebInspector::event(QEvent* ev)
+{
+ return QWidget::event(ev);
+}
+
+/*! \reimp */
+void QWebInspector::resizeEvent(QResizeEvent* event)
+{
+ d->adjustFrontendSize(event->size());
+}
+
+/*! \reimp */
+void QWebInspector::showEvent(QShowEvent* event)
+{
+ // Allows QWebInspector::show() to init the inspector.
+ if (d->page)
+ d->page->d->inspectorController()->show();
+}
+
+/*! \reimp */
+void QWebInspector::hideEvent(QHideEvent* event)
+{
+ if (d->page)
+ d->page->d->inspectorController()->setWindowVisible(false);
+}
+
+/*! \internal */
+void QWebInspectorPrivate::setFrontend(QWidget* newFrontend)
+{
+ if (frontend)
+ frontend->setParent(0);
+
+ frontend = newFrontend;
+
+ if (frontend) {
+ frontend->setParent(q);
+ frontend->show();
+ adjustFrontendSize(q->size());
+ }
+}
+
+void QWebInspectorPrivate::adjustFrontendSize(const QSize& size)
+{
+ if (frontend)
+ frontend->resize(size);
+}
+
+/*!
+ \fn void QWebInspector::windowTitleChanged(const QString& newTitle);
+
+ This is emitted to signal that this widget's title changed to \a newTitle.
+*/
+
diff --git a/WebKit/qt/Api/qwebinspector.h b/WebKit/qt/Api/qwebinspector.h
new file mode 100644
index 0000000..bb5bd64
--- /dev/null
+++ b/WebKit/qt/Api/qwebinspector.h
@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef QWEBINSPECTOR_H
+#define QWEBINSPECTOR_H
+
+#include "qwebkitglobal.h"
+#include "qwebpage.h"
+
+#include "qwebview.h"
+
+class QWebInspectorPrivate;
+
+class QWEBKIT_EXPORT QWebInspector : public QWidget {
+ Q_OBJECT
+public:
+ QWebInspector(QWidget* parent = 0);
+ ~QWebInspector();
+
+ void setPage(QWebPage* page);
+ QWebPage* page() const;
+
+ QSize sizeHint() const;
+ bool event(QEvent*);
+
+Q_SIGNALS:
+ void windowTitleChanged(const QString& newTitle);
+
+protected:
+ void resizeEvent(QResizeEvent* event);
+ void showEvent(QShowEvent* event);
+ void hideEvent(QHideEvent* event);
+
+private:
+ QWebInspectorPrivate* d;
+
+ friend class QWebInspectorPrivate;
+ friend class QWebPage;
+ friend class QWebPagePrivate;
+ friend class WebCore::InspectorClientQt;
+};
+#endif
diff --git a/WebKit/qt/Api/qwebplugindatabase_p.h b/WebKit/qt/Api/qwebinspector_p.h
index 714458f..4d327cc 100644
--- a/WebKit/qt/Api/qwebplugindatabase_p.h
+++ b/WebKit/qt/Api/qwebinspector_p.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com>
+ Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -17,30 +17,30 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef QWEBPLUGINDATABASE_P_H
-#define QWEBPLUGINDATABASE_P_H
+#ifndef QWEBINSPECTOR_P_H
+#define QWEBINSPECTOR_P_H
-#include "qwebkitglobal.h"
+QT_BEGIN_NAMESPACE
+class QSize;
+class QWidget;
+QT_END_NAMESPACE
+class QWebInspector;
+class QWebPage;
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
- class PluginPackage;
- class PluginDatabase;
-};
-
-class QWebPluginInfoPrivate {
-public:
- QWebPluginInfoPrivate(RefPtr<WebCore::PluginPackage> pluginPackage);
-
- RefPtr<WebCore::PluginPackage> plugin;
-};
-
-class QWebPluginDatabasePrivate {
+class QWebInspectorPrivate {
public:
- QWebPluginDatabasePrivate(WebCore::PluginDatabase* pluginDatabase);
-
- WebCore::PluginDatabase* database;
+ QWebInspectorPrivate(QWebInspector* qq)
+ : q(qq)
+ , page(0)
+ , frontend(0)
+ {}
+
+ void setFrontend(QWidget* newFrontend);
+ void adjustFrontendSize(const QSize& size);
+
+ QWebInspector* q;
+ QWebPage* page;
+ QWidget* frontend;
};
-#endif // QWEBPLUGINDATABASE_P_H
+#endif
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 8e40339..0acec48 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -27,6 +27,8 @@
#include "qwebframe_p.h"
#include "qwebhistory.h"
#include "qwebhistory_p.h"
+#include "qwebinspector.h"
+#include "qwebinspector_p.h"
#include "qwebsettings.h"
#include "qwebkitversion.h"
@@ -64,8 +66,12 @@
#include "PluginDatabase.h"
#include "ProgressTracker.h"
#include "RefPtr.h"
+#include "RenderTextControl.h"
+#include "TextIterator.h"
#include "HashMap.h"
#include "HTMLFormElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLNames.h"
#include "HitTestResult.h"
#include "WindowFeatures.h"
#include "LocalizedStrings.h"
@@ -76,7 +82,6 @@
#include <QBasicTimer>
#include <QBitArray>
#include <QDebug>
-#include <QDesktopServices>
#include <QDragEnterEvent>
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
@@ -94,6 +99,7 @@
#include <QSslSocket>
#include <QStyle>
#include <QSysInfo>
+#include <QTextCharFormat>
#if QT_VERSION >= 0x040400
#include <QNetworkAccessManager>
#include <QNetworkRequest>
@@ -108,7 +114,7 @@ void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
Vector<String> paths;
- String qtPath(getenv("QTWEBKIT_PLUGIN_PATH"));
+ String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data());
qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths);
db->setPluginDirectories(paths);
@@ -226,18 +232,6 @@ const char* QWebPagePrivate::editorCommandForWebActions(QWebPage::WebAction acti
return 0;
}
-#ifndef QT_NO_CURSOR
-SetCursorEvent::SetCursorEvent(const QCursor& cursor)
- : QEvent(static_cast<QEvent::Type>(EventType))
- , m_cursor(cursor)
-{}
-
-QCursor SetCursorEvent::cursor() const
-{
- return m_cursor;
-}
-#endif
-
// If you change this make sure to also adjust the docs for QWebPage::userAgentForUrl
#define WEBKIT_VERSION "527+"
@@ -265,45 +259,25 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
return result;
}
-static void initializeApplicationCachePathIfNecessary()
-{
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
- static bool initialized = false;
-
- if (initialized)
- return;
-
- // Determine the path for HTML5 Application Cache DB
- QString appCachePath;
-#if QT_VERSION >= 0x040500
- appCachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
-#else
- appCachePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#endif
-
- if (appCachePath.isEmpty())
- appCachePath = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName();
-
- WebCore::cacheStorage().setCacheDirectory(appCachePath);
- initialized = true;
-#endif
-}
-
QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
: q(qq)
+ , client(0)
, view(0)
+ , inspectorFrontend(0)
+ , inspector(0)
+ , inspectorIsInternalOnly(false)
, viewportSize(QSize(0, 0))
+ , clickCausedFocus(false)
{
WebCore::InitializeLoggingChannelsIfNecessary();
JSC::initializeThreading();
- WebCore::FrameLoader::setLocalLoadPolicy(WebCore::FrameLoader::AllowLocalLoadsForLocalAndSubstituteData);
- initializeApplicationCachePathIfNecessary();
+ WebCore::SecurityOrigin::setLocalLoadPolicy(WebCore::SecurityOrigin::AllowLocalLoadsForLocalAndSubstituteData);
chromeClient = new ChromeClientQt(q);
contextMenuClient = new ContextMenuClientQt();
editorClient = new EditorClientQt(q);
page = new Page(chromeClient, contextMenuClient, editorClient,
- new DragClientQt(q), new InspectorClientQt(q));
+ new DragClientQt(q), new InspectorClientQt(q), 0);
// ### should be configurable
page->settings()->setDefaultTextEncodingName("iso-8859-1");
@@ -465,13 +439,13 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked)
q->triggerAction(action, checked);
}
-#ifndef NDEBUG
void QWebPagePrivate::_q_cleanupLeakMessages()
{
+#ifndef NDEBUG
// Need this to make leak messages accurate.
cache()->setCapacities(0, 0, 0);
-}
#endif
+}
void QWebPagePrivate::updateAction(QWebPage::WebAction action)
{
@@ -487,10 +461,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();
@@ -608,6 +582,18 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev)
q->QObject::timerEvent(ev);
}
+void QWebPagePrivate::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
+{
+ q->setView(ev->widget());
+
+ WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
+ if (!frame->view())
+ return;
+
+ bool accepted = frame->eventHandler()->mouseMoved(PlatformMouseEvent(ev, 0));
+ ev->setAccepted(accepted);
+}
+
void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
@@ -618,12 +604,40 @@ void QWebPagePrivate::mouseMoveEvent(QMouseEvent *ev)
ev->setAccepted(accepted);
}
+void QWebPagePrivate::mousePressEvent(QGraphicsSceneMouseEvent* ev)
+{
+ q->setView(ev->widget());
+
+ WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
+ if (!frame->view())
+ return;
+
+ if (tripleClickTimer.isActive()
+ && (ev->pos().toPoint() - tripleClick).manhattanLength()
+ < QApplication::startDragDistance()) {
+ mouseTripleClickEvent(ev);
+ return;
+ }
+
+ bool accepted = false;
+ PlatformMouseEvent mev(ev, 1);
+ // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
+ if (mev.button() != NoButton)
+ accepted = frame->eventHandler()->handleMousePressEvent(mev);
+ ev->setAccepted(accepted);
+}
+
void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
if (!frame->view())
return;
+ RefPtr<WebCore::Node> oldNode;
+ if (page->focusController()->focusedFrame()
+ && page->focusController()->focusedFrame()->document())
+ oldNode = page->focusController()->focusedFrame()->document()->focusedNode();
+
if (tripleClickTimer.isActive()
&& (ev->pos() - tripleClick).manhattanLength()
< QApplication::startDragDistance()) {
@@ -637,6 +651,33 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
if (mev.button() != NoButton)
accepted = frame->eventHandler()->handleMousePressEvent(mev);
ev->setAccepted(accepted);
+
+ RefPtr<WebCore::Node> newNode;
+ if (page->focusController()->focusedFrame()
+ && page->focusController()->focusedFrame()->document())
+ newNode = page->focusController()->focusedFrame()->document()->focusedNode();
+
+ if (newNode && oldNode != newNode)
+ clickCausedFocus = true;
+}
+
+void QWebPagePrivate::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *ev)
+{
+ q->setView(ev->widget());
+
+ WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
+ if (!frame->view())
+ return;
+
+ bool accepted = false;
+ PlatformMouseEvent mev(ev, 2);
+ // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
+ if (mev.button() != NoButton)
+ accepted = frame->eventHandler()->handleMousePressEvent(mev);
+ ev->setAccepted(accepted);
+
+ tripleClickTimer.start(QApplication::doubleClickInterval(), q);
+ tripleClick = ev->pos().toPoint();
}
void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
@@ -656,7 +697,7 @@ void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
tripleClick = ev->pos();
}
-void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
+void QWebPagePrivate::mouseTripleClickEvent(QGraphicsSceneMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
if (!frame->view())
@@ -670,30 +711,33 @@ void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
ev->setAccepted(accepted);
}
-void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
+void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
if (!frame->view())
return;
bool accepted = false;
- PlatformMouseEvent mev(ev, 0);
+ PlatformMouseEvent mev(ev, 3);
// ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
if (mev.button() != NoButton)
- accepted = frame->eventHandler()->handleMouseReleaseEvent(mev);
+ accepted = frame->eventHandler()->handleMousePressEvent(mev);
ev->setAccepted(accepted);
+}
+void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button)
+{
#ifndef QT_NO_CLIPBOARD
if (QApplication::clipboard()->supportsSelection()) {
bool oldSelectionMode = Pasteboard::generalPasteboard()->isSelectionMode();
Pasteboard::generalPasteboard()->setSelectionMode(true);
WebCore::Frame* focusFrame = page->focusController()->focusedOrMainFrame();
- if (ev->button() == Qt::LeftButton) {
+ if (button == Qt::LeftButton) {
if (focusFrame && (focusFrame->editor()->canCopy() || focusFrame->editor()->canDHTMLCopy())) {
focusFrame->editor()->copy();
ev->setAccepted(true);
}
- } else if (ev->button() == Qt::MidButton) {
+ } else if (button == Qt::MidButton) {
if (focusFrame && (focusFrame->editor()->canPaste() || focusFrame->editor()->canDHTMLPaste())) {
focusFrame->editor()->paste();
ev->setAccepted(true);
@@ -704,12 +748,65 @@ void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
#endif
}
+void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
+{
+ q->setView(ev->widget());
+
+ WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
+ if (!frame->view())
+ return;
+
+ bool accepted = false;
+ PlatformMouseEvent mev(ev, 0);
+ // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
+ if (mev.button() != NoButton)
+ accepted = frame->eventHandler()->handleMouseReleaseEvent(mev);
+ ev->setAccepted(accepted);
+
+ handleClipboard(ev, ev->button());
+ handleSoftwareInputPanel(ev->button());
+}
+
+void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ if (view && view->testAttribute(Qt::WA_InputMethodEnabled)
+ && button == Qt::LeftButton && qApp->autoSipEnabled()) {
+ QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
+ view->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
+ QEvent event(QEvent::RequestSoftwareInputPanel);
+ QApplication::sendEvent(view, &event);
+ }
+ }
+
+ clickCausedFocus = false;
+#endif
+}
+
+void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
+{
+ WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
+ if (!frame->view())
+ return;
+
+ bool accepted = false;
+ PlatformMouseEvent mev(ev, 0);
+ // ignore the event if we can't map Qt's mouse buttons to WebCore::MouseButton
+ if (mev.button() != NoButton)
+ accepted = frame->eventHandler()->handleMouseReleaseEvent(mev);
+ ev->setAccepted(accepted);
+
+ handleClipboard(ev, ev->button());
+ handleSoftwareInputPanel(ev->button());
+}
+
#ifndef QT_NO_CONTEXTMENU
-void QWebPagePrivate::contextMenuEvent(QContextMenuEvent *ev)
+void QWebPagePrivate::contextMenuEvent(const QPoint& globalPos)
{
QMenu *menu = q->createStandardContextMenu();
if (menu) {
- menu->exec(ev->globalPos());
+ menu->exec(globalPos);
delete menu;
}
}
@@ -734,6 +831,19 @@ 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;
+
+ WebCore::PlatformWheelEvent pev(ev);
+ bool accepted = frame->eventHandler()->handleWheelEvent(pev);
+ ev->setAccepted(accepted);
+}
+
void QWebPagePrivate::wheelEvent(QWheelEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame);
@@ -804,7 +914,6 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev)
{
bool handled = false;
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
- WebCore::Editor* editor = frame->editor();
// we forward the key event to WebCore first to handle potential DOM
// defined event handlers and later on end up in EditorClientQt::handleKeyboardEvent
// to trigger editor commands via triggerAction().
@@ -816,7 +925,6 @@ void QWebPagePrivate::keyPressEvent(QKeyEvent *ev)
if (view)
defaultFont = view->font();
QFontMetrics fm(defaultFont);
- int fontHeight = fm.height();
if (!handleScrolling(ev, frame)) {
switch (ev->key()) {
case Qt::Key_Back:
@@ -859,7 +967,7 @@ void QWebPagePrivate::keyReleaseEvent(QKeyEvent *ev)
ev->setAccepted(handled);
}
-void QWebPagePrivate::focusInEvent(QFocusEvent *ev)
+void QWebPagePrivate::focusInEvent(QFocusEvent*)
{
FocusController *focusController = page->focusController();
Frame *frame = focusController->focusedFrame();
@@ -870,7 +978,7 @@ void QWebPagePrivate::focusInEvent(QFocusEvent *ev)
focusController->setFocusedFrame(QWebFramePrivate::core(mainFrame));
}
-void QWebPagePrivate::focusOutEvent(QFocusEvent *ev)
+void QWebPagePrivate::focusOutEvent(QFocusEvent*)
{
// only set the focused frame inactive so that we stop painting the caret
// and the focus frame. But don't tell the focus controller so that upon
@@ -880,7 +988,21 @@ void QWebPagePrivate::focusOutEvent(QFocusEvent *ev)
focusController->setFocused(false);
}
-void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev)
+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()));
+ Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData));
+ ev->setDropAction(action);
+ if (action != Qt::IgnoreAction)
+ ev->accept();
+#endif
+}
+
+void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
@@ -892,7 +1014,18 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent *ev)
#endif
}
-void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent *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);
+ ev->accept();
+#endif
+}
+
+void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
DragData dragData(0, IntPoint(), QCursor::pos(), DragOperationNone);
@@ -901,7 +1034,21 @@ void QWebPagePrivate::dragLeaveEvent(QDragLeaveEvent *ev)
#endif
}
-void QWebPagePrivate::dragMoveEvent(QDragMoveEvent *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()));
+ Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
+ ev->setDropAction(action);
+ if (action != Qt::IgnoreAction)
+ ev->accept();
+#endif
+}
+
+void QWebPagePrivate::dragMoveEvent(QDragMoveEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
@@ -913,7 +1060,18 @@ void QWebPagePrivate::dragMoveEvent(QDragMoveEvent *ev)
#endif
}
-void QWebPagePrivate::dropEvent(QDropEvent *ev)
+void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev)
+{
+#ifndef QT_NO_DRAGANDDROP
+ DragData dragData(ev->mimeData(), ev->pos().toPoint(),
+ QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
+ Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData));
+ if (action != Qt::IgnoreAction)
+ ev->accept();
+#endif
+}
+
+void QWebPagePrivate::dropEvent(QDropEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
@@ -924,7 +1082,7 @@ void QWebPagePrivate::dropEvent(QDropEvent *ev)
#endif
}
-void QWebPagePrivate::leaveEvent(QEvent *ev)
+void QWebPagePrivate::leaveEvent(QEvent*)
{
// Fake a mouse move event just outside of the widget, since all
// the interesting mouse-out behavior like invalidating scrollbars
@@ -967,13 +1125,53 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
return;
}
+ RenderObject* renderer = 0;
+ RenderTextControl* renderTextControl = 0;
+
+ if (frame->selection()->rootEditableElement())
+ renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer();
+
+ if (renderer && renderer->isTextControl())
+ renderTextControl = toRenderTextControl(renderer);
+
+ Vector<CompositionUnderline> underlines;
+
+ for (int i = 0; i < ev->attributes().size(); ++i) {
+ const QInputMethodEvent::Attribute& a = ev->attributes().at(i);
+ switch (a.type) {
+ case QInputMethodEvent::TextFormat: {
+ QTextCharFormat textCharFormat = a.value.value<QTextFormat>().toCharFormat();
+ QColor qcolor = textCharFormat.underlineColor();
+ underlines.append(CompositionUnderline(a.start, a.length, Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())), false));
+ break;
+ }
+ case QInputMethodEvent::Cursor: {
+ frame->setCaretVisible(a.length); //if length is 0 cursor is invisible
+ if (a.length > 0) {
+ RenderObject* caretRenderer = frame->selection()->caretRenderer();
+ if (caretRenderer) {
+ QColor qcolor = a.value.value<QColor>();
+ caretRenderer->style()->setColor(Color(makeRGBA(qcolor.red(), qcolor.green(), qcolor.blue(), qcolor.alpha())));
+ }
+ }
+ break;
+ }
+#if QT_VERSION >= 0x040600
+ case QInputMethodEvent::Selection: {
+ if (renderTextControl) {
+ renderTextControl->setSelectionStart(a.start);
+ renderTextControl->setSelectionEnd(a.start + a.length);
+ }
+ break;
+ }
+#endif
+ }
+ }
+
if (!ev->commitString().isEmpty())
editor->confirmComposition(ev->commitString());
- else {
+ else if (!ev->preeditString().isEmpty()) {
QString preedit = ev->preeditString();
- // ### FIXME: use the provided QTextCharFormat (use color at least)
- Vector<CompositionUnderline> underlines;
- underlines.append(CompositionUnderline(0, preedit.length(), Color(0, 0, 0), false));
editor->setComposition(preedit, underlines, preedit.length(), 0);
}
ev->accept();
@@ -1076,44 +1274,140 @@ bool QWebPagePrivate::handleScrolling(QKeyEvent *ev, Frame *frame)
*/
QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
{
+ Frame* frame = d->page->focusController()->focusedFrame();
+ if (!frame)
+ return QVariant();
+
+ WebCore::Editor* editor = frame->editor();
+
+ RenderObject* renderer = 0;
+ RenderTextControl* renderTextControl = 0;
+
+ if (frame->selection()->rootEditableElement())
+ renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer();
+
+ if (renderer && renderer->isTextControl())
+ renderTextControl = toRenderTextControl(renderer);
+
switch (property) {
- case Qt::ImMicroFocus: {
- Frame *frame = d->page->focusController()->focusedFrame();
- if (frame)
+ case Qt::ImMicroFocus: {
return QVariant(frame->selection()->absoluteCaretBounds());
- return QVariant();
- }
- case Qt::ImFont: {
- QWebView *webView = qobject_cast<QWebView *>(d->view);
- if (webView)
- return QVariant(webView->font());
- return QVariant();
- }
- case Qt::ImCursorPosition: {
- Frame *frame = d->page->focusController()->focusedFrame();
- if (frame) {
- VisibleSelection selection = frame->selection()->selection();
- if (selection.isCaret())
- return QVariant(selection.start().deprecatedEditingOffset());
}
- return QVariant();
- }
- case Qt::ImSurroundingText: {
- Frame *frame = d->page->focusController()->focusedFrame();
- if (frame) {
- Document *document = frame->document();
- if (document->focusedNode())
- return QVariant(document->focusedNode()->nodeValue());
+ case Qt::ImFont: {
+ if (renderTextControl) {
+ RenderStyle* renderStyle = renderTextControl->style();
+ return QVariant(QFont(renderStyle->font().font()));
+ }
+ return QVariant(QFont());
}
- return QVariant();
+ case Qt::ImCursorPosition: {
+ if (renderTextControl) {
+ if (editor->hasComposition()) {
+ RefPtr<Range> range = editor->compositionRange();
+ return QVariant(renderTextControl->selectionEnd() - TextIterator::rangeLength(range.get()));
+ }
+ return QVariant(renderTextControl->selectionEnd());
+ }
+ return QVariant();
+ }
+ case Qt::ImSurroundingText: {
+ if (renderTextControl) {
+ QString text = renderTextControl->text();
+ RefPtr<Range> range = editor->compositionRange();
+ if (range) {
+ text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get()));
+ }
+ return QVariant(text);
+ }
+ return QVariant();
+ }
+ case Qt::ImCurrentSelection: {
+ if (renderTextControl) {
+ int start = renderTextControl->selectionStart();
+ int end = renderTextControl->selectionEnd();
+ if (end > start)
+ return QVariant(QString(renderTextControl->text()).mid(start,end-start));
+ }
+ return QVariant();
+
+ }
+#if QT_VERSION >= 0x040600
+ case Qt::ImAnchorPosition: {
+ if (renderTextControl) {
+ if (editor->hasComposition()) {
+ RefPtr<Range> range = editor->compositionRange();
+ return QVariant(renderTextControl->selectionStart() - TextIterator::rangeLength(range.get()));
+ }
+ return QVariant(renderTextControl->selectionStart());
+ }
+ return QVariant();
+ }
+ case Qt::ImMaximumTextLength: {
+ if (frame->selection()->isContentEditable()) {
+ if (frame->document() && frame->document()->focusedNode()) {
+ if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
+ return QVariant(inputElement->maxLength());
+ }
+ }
+ return QVariant(InputElement::s_maximumLength);
+ }
+ return QVariant(0);
+ }
+#endif
+ default:
+ return QVariant();
}
- case Qt::ImCurrentSelection:
- return QVariant(selectedText());
- default:
- return QVariant();
+}
+
+/*!
+ \internal
+*/
+void QWebPagePrivate::setInspector(QWebInspector* insp)
+{
+ if (inspector)
+ inspector->d->setFrontend(0);
+
+ if (inspectorIsInternalOnly) {
+ QWebInspector* inspToDelete = inspector;
+ inspector = 0;
+ inspectorIsInternalOnly = false;
+ delete inspToDelete; // Delete after to prevent infinite recursion
+ }
+
+ inspector = insp;
+
+ // Give inspector frontend web view if previously created
+ if (inspector && inspectorFrontend)
+ inspector->d->setFrontend(inspectorFrontend);
+}
+
+/*!
+ \internal
+ Returns the inspector and creates it if it wasn't created yet.
+ The instance created here will not be available through QWebPage's API.
+*/
+QWebInspector* QWebPagePrivate::getOrCreateInspector()
+{
+ if (!inspector) {
+ QWebInspector* insp = new QWebInspector;
+ insp->setPage(q);
+ insp->connect(q, SIGNAL(webInspectorTriggered(const QWebElement&)), SLOT(show()));
+ insp->show(); // The inspector is expected to be shown on inspection
+ inspectorIsInternalOnly = true;
+
+ Q_ASSERT(inspector); // Associated through QWebInspector::setPage(q)
}
+ return inspector;
}
+/*! \internal */
+InspectorController* QWebPagePrivate::inspectorController()
+{
+ return page->inspectorController();
+}
+
+
/*!
\enum QWebPage::FindFlag
@@ -1252,6 +1546,8 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
\since 4.4
\brief The QWebPage class provides an object to view and edit web documents.
+ \inmodule QtWebKit
+
QWebPage holds a main frame responsible for web content, settings, the history
of navigated links and actions. This class can be used, together with QWebFrame,
to provide functionality like QWebView in a widget-less environment.
@@ -1321,9 +1617,12 @@ QWebPage::QWebPage(QObject *parent)
*/
QWebPage::~QWebPage()
{
+ d->createMainFrame();
FrameLoader *loader = d->mainFrame->d->frame->loader();
if (loader)
loader->detachFromParent();
+ if (d->inspector)
+ d->inspector->setPage(0);
delete d;
}
@@ -1348,6 +1647,7 @@ QWebFrame *QWebPage::mainFrame() const
*/
QWebFrame *QWebPage::currentFrame() const
{
+ d->createMainFrame();
return static_cast<WebCore::FrameLoaderClientQt *>(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame();
}
@@ -1373,6 +1673,7 @@ QWebFrame* QWebPage::frameAt(const QPoint& pos) const
*/
QWebHistory *QWebPage::history() const
{
+ d->createMainFrame();
return &d->history;
}
@@ -1383,8 +1684,10 @@ QWebHistory *QWebPage::history() const
*/
void QWebPage::setView(QWidget *view)
{
- d->view = view;
- setViewportSize(view ? view->size() : QSize(0, 0));
+ if (d->view != view) {
+ d->view = view;
+ setViewportSize(view ? view->size() : QSize(0, 0));
+ }
}
/*!
@@ -1419,6 +1722,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
*/
void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg)
{
+ Q_UNUSED(frame)
#ifndef QT_NO_MESSAGEBOX
QMessageBox::information(d->view, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), msg, QMessageBox::Ok);
#endif
@@ -1432,6 +1736,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg)
*/
bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
{
+ Q_UNUSED(frame)
#ifdef QT_NO_MESSAGEBOX
return true;
#else
@@ -1450,6 +1755,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
*/
bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result)
{
+ Q_UNUSED(frame)
bool ok = false;
#ifndef QT_NO_INPUTDIALOG
QString x = QInputDialog::getText(d->view, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), msg, QLineEdit::Normal, defaultValue, &ok);
@@ -1543,7 +1849,7 @@ static void openNewWindow(const QUrl& url, WebCore::Frame* frame)
\sa action()
*/
-void QWebPage::triggerAction(WebAction action, bool checked)
+void QWebPage::triggerAction(WebAction action, bool)
{
WebCore::Frame *frame = d->page->focusController()->focusedOrMainFrame();
if (!frame)
@@ -1619,12 +1925,16 @@ void QWebPage::triggerAction(WebAction action, bool checked)
case SetTextDirectionRightToLeft:
editor->setBaseWritingDirection(RightToLeftWritingDirection);
break;
- case InspectElement:
- if (!d->hitTestResult.isNull())
+ case InspectElement: {
+ QWebElement inspectedElement(QWebElement::enclosingElement(d->hitTestResult.d->innerNonSharedNode.get()));
+ emit webInspectorTriggered(inspectedElement);
+
+ if (!d->hitTestResult.isNull()) {
+ d->getOrCreateInspector(); // Make sure the inspector is created
d->page->inspectorController()->inspect(d->hitTestResult.d->innerNonSharedNode.get());
- else
- d->page->inspectorController()->show();
+ }
break;
+ }
default:
command = QWebPagePrivate::editorCommandForWebActions(action);
break;
@@ -1725,6 +2035,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
#endif
{
+ Q_UNUSED(frame)
if (type == NavigationTypeLinkClicked) {
switch (d->linkPolicy) {
case DontDelegateLinks:
@@ -1754,6 +2065,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkReques
*/
QString QWebPage::selectedText() const
{
+ d->createMainFrame();
return d->page->focusController()->focusedOrMainFrame()->selectedText();
}
@@ -2079,24 +2391,42 @@ bool QWebPage::event(QEvent *ev)
case QEvent::MouseMove:
d->mouseMoveEvent(static_cast<QMouseEvent*>(ev));
break;
+ case QEvent::GraphicsSceneMouseMove:
+ d->mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ break;
case QEvent::MouseButtonPress:
d->mousePressEvent(static_cast<QMouseEvent*>(ev));
break;
+ case QEvent::GraphicsSceneMousePress:
+ d->mousePressEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ break;
case QEvent::MouseButtonDblClick:
d->mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
break;
+ case QEvent::GraphicsSceneMouseDoubleClick:
+ d->mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ break;
case QEvent::MouseButtonRelease:
d->mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
break;
+ case QEvent::GraphicsSceneMouseRelease:
+ d->mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ break;
#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
- d->contextMenuEvent(static_cast<QContextMenuEvent*>(ev));
+ d->contextMenuEvent(static_cast<QContextMenuEvent*>(ev)->globalPos());
+ break;
+ case QEvent::GraphicsSceneContextMenu:
+ d->contextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(ev)->screenPos());
break;
#endif
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
d->wheelEvent(static_cast<QWheelEvent*>(ev));
break;
+ case QEvent::GraphicsSceneWheel:
+ d->wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(ev));
+ break;
#endif
case QEvent::KeyPress:
d->keyPressEvent(static_cast<QKeyEvent*>(ev));
@@ -2114,15 +2444,27 @@ bool QWebPage::event(QEvent *ev)
case QEvent::DragEnter:
d->dragEnterEvent(static_cast<QDragEnterEvent*>(ev));
break;
+ case QEvent::GraphicsSceneDragEnter:
+ d->dragEnterEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev));
+ break;
case QEvent::DragLeave:
d->dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
break;
+ case QEvent::GraphicsSceneDragLeave:
+ d->dragLeaveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev));
+ break;
case QEvent::DragMove:
d->dragMoveEvent(static_cast<QDragMoveEvent*>(ev));
break;
+ case QEvent::GraphicsSceneDragMove:
+ d->dragMoveEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev));
+ break;
case QEvent::Drop:
d->dropEvent(static_cast<QDropEvent*>(ev));
break;
+ case QEvent::GraphicsSceneDrop:
+ d->dropEvent(static_cast<QGraphicsSceneDragDropEvent*>(ev));
+ break;
#endif
case QEvent::InputMethod:
d->inputMethodEvent(static_cast<QInputMethodEvent*>(ev));
@@ -2279,6 +2621,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
}
}
+ d->createMainFrame();
WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame();
HitTestResult result = focusedFrame->eventHandler()->hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos), /*allowShadowContent*/ false);
@@ -2335,15 +2678,56 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
\since 4.4
\brief The ExtensionOption class provides an extended input argument to QWebPage's extension support.
+ \inmodule QtWebKit
+
\sa QWebPage::extension()
*/
/*!
+ \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
for the multiple files selection extension.
+ \inmodule QtWebKit
+
The ChooseMultipleFilesExtensionOption class holds the frame originating the request
and the suggested filenames which might be provided.
@@ -2356,6 +2740,8 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
\brief The ChooseMultipleFilesExtensionReturn describes the return value
for the multiple files selection extension.
+ \inmodule QtWebKit
+
The ChooseMultipleFilesExtensionReturn class holds the filenames selected by the user
when the extension is invoked.
@@ -2460,6 +2846,7 @@ QWebSettings *QWebPage::settings() const
*/
QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFile)
{
+ Q_UNUSED(parentFrame)
#ifndef QT_NO_FILEDIALOG
return QFileDialog::getOpenFileName(d->view, QString::null, suggestedFile);
#else
@@ -2698,6 +3085,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
case QSysInfo::WV_VISTA:
ver = "Windows NT 6.0";
break;
+#if QT_VERSION > 0x040500
+ case QSysInfo::WV_WINDOWS7:
+ ver = "Windows NT 6.1";
+ break;
+#endif
case QSysInfo::WV_CE:
ver = "Windows CE";
break;
@@ -2936,6 +3328,24 @@ quint64 QWebPage::bytesReceived() const
*/
/*!
+ \fn void QWebPage::webInspectorTriggered(const QWebElement& inspectedElement);
+ \since 4.6
+
+ This signal is emitted when the user triggered an inspection through the
+ context menu. If a QWebInspector is associated to this page, it should be
+ visible to the user after this signal has been emitted.
+
+ If still no QWebInspector is associated to this QWebPage after the emission
+ of this signal, a privately owned inspector will be shown to the user.
+
+ \note \a inspectedElement contains the QWebElement under the context menu.
+ It is not garanteed to be the same as the focused element in the web
+ inspector.
+
+ \sa QWebInspector
+*/
+
+/*!
\fn void QWebPage::toolBarVisibilityChangeRequested(bool visible)
This signal is emitted whenever the visibility of the toolbar in a web browser
@@ -2986,6 +3396,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/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h
index 24741a1..d77656c 100644
--- a/WebKit/qt/Api/qwebpage.h
+++ b/WebKit/qt/Api/qwebpage.h
@@ -25,18 +25,19 @@
#include "qwebkitglobal.h"
#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
#include <QtGui/qwidget.h>
QT_BEGIN_NAMESPACE
class QNetworkProxy;
class QUndoStack;
-class QUrl;
class QMenu;
class QNetworkRequest;
class QNetworkReply;
class QNetworkAccessManager;
QT_END_NAMESPACE
+class QWebElement;
class QWebFrame;
class QWebNetworkRequest;
class QWebHistory;
@@ -55,6 +56,7 @@ namespace WebCore {
class InspectorClientQt;
class ResourceHandle;
class HitTestResult;
+ class QNetworkReplyHandler;
struct FrameLoadRequest;
}
@@ -265,7 +267,8 @@ public:
QMenu *createStandardContextMenu();
enum Extension {
- ChooseMultipleFilesExtension
+ ChooseMultipleFilesExtension,
+ ErrorPageExtension
};
class ExtensionOption
{};
@@ -283,6 +286,26 @@ public:
QStringList fileNames;
};
+ enum ErrorDomain { QtNetwork, Http, WebKit };
+ class ErrorPageExtensionOption : public ExtensionOption {
+ public:
+ QUrl url;
+ QWebFrame* frame;
+ ErrorDomain domain;
+ int error;
+ QString errorString;
+ };
+
+ class ErrorPageExtensionReturn : public ExtensionReturn {
+ public:
+ ErrorPageExtensionReturn() : contentType(QLatin1String("text/html")), encoding(QLatin1String("utf-8")) {};
+ QString contentType;
+ QString encoding;
+ QUrl baseUrl;
+ QByteArray content;
+ };
+
+
virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0);
virtual bool supportsExtension(Extension extension) const;
@@ -306,6 +329,7 @@ Q_SIGNALS:
void windowCloseRequested();
void printRequested(QWebFrame *frame);
void linkClicked(const QUrl &url);
+ void webInspectorTriggered(const QWebElement& inspectedElement);
void toolBarVisibilityChangeRequested(bool visible);
void statusBarVisibilityChangeRequested(bool visible);
@@ -323,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 &paramNames, const QStringList &paramValues);
@@ -343,19 +369,21 @@ protected:
private:
Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int))
Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked))
-#ifndef NDEBUG
Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages())
-#endif
+
QWebPagePrivate *d;
friend class QWebFrame;
friend class QWebPagePrivate;
friend class QWebView;
+ friend class QGraphicsWebView;
+ friend class QWebInspector;
friend class WebCore::ChromeClientQt;
friend class WebCore::EditorClientQt;
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/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index 87c624d..b9571fa 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -25,6 +25,7 @@
#include <qnetworkproxy.h>
#include <qpointer.h>
#include <qevent.h>
+#include <qgraphicssceneevent.h>
#include "qwebpage.h"
#include "qwebhistory.h"
@@ -42,21 +43,10 @@ namespace WebCore {
class ContextMenu;
class EditorClientQt;
class Element;
+ class InspectorController;
class Node;
class Page;
class Frame;
-
-#ifndef QT_NO_CURSOR
- class SetCursorEvent : public QEvent {
- public:
- static const int EventType = 724;
- SetCursorEvent(const QCursor&);
-
- QCursor cursor() const;
- private:
- QCursor m_cursor;
- };
-#endif
}
QT_BEGIN_NAMESPACE
@@ -65,6 +55,9 @@ class QMenu;
class QBitArray;
QT_END_NAMESPACE
+class QWebInspector;
+class QWebPageClient;
+
class QWebPagePrivate {
public:
QWebPagePrivate(QWebPage*);
@@ -75,9 +68,7 @@ public:
#endif
void _q_onLoadProgressChanged(int);
void _q_webActionTriggered(bool checked);
-#ifndef NDEBUG
void _q_cleanupLeakMessages();
-#endif
void updateAction(QWebPage::WebAction action);
void updateNavigationActions();
void updateEditorActions();
@@ -85,32 +76,48 @@ public:
void timerEvent(QTimerEvent*);
void mouseMoveEvent(QMouseEvent*);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent*);
void mousePressEvent(QMouseEvent*);
+ void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseDoubleClickEvent(QMouseEvent*);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
void mouseTripleClickEvent(QMouseEvent*);
+ void mouseTripleClickEvent(QGraphicsSceneMouseEvent*);
void mouseReleaseEvent(QMouseEvent*);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent*);
+ void contextMenuEvent(const QPoint& globalPos);
#endif
#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent*);
+ void wheelEvent(QGraphicsSceneWheelEvent*);
#endif
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
void focusInEvent(QFocusEvent*);
void focusOutEvent(QFocusEvent*);
- void dragEnterEvent(QDragEnterEvent *);
- void dragLeaveEvent(QDragLeaveEvent *);
- void dragMoveEvent(QDragMoveEvent *);
- void dropEvent(QDropEvent *);
+ void dragEnterEvent(QDragEnterEvent*);
+ void dragEnterEvent(QGraphicsSceneDragDropEvent*);
+ void dragLeaveEvent(QDragLeaveEvent*);
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
+ void dragMoveEvent(QDragMoveEvent*);
+ void dragMoveEvent(QGraphicsSceneDragDropEvent*);
+ void dropEvent(QDropEvent*);
+ void dropEvent(QGraphicsSceneDragDropEvent*);
void inputMethodEvent(QInputMethodEvent*);
void shortcutOverrideEvent(QKeyEvent*);
- void leaveEvent(QEvent *);
+ void leaveEvent(QEvent*);
+ void handleClipboard(QEvent*, Qt::MouseButton);
+ void handleSoftwareInputPanel(Qt::MouseButton);
bool handleScrolling(QKeyEvent*, WebCore::Frame*);
+ void setInspector(QWebInspector*);
+ QWebInspector* getOrCreateInspector();
+ WebCore::InspectorController* inspectorController();
+
#ifndef QT_NO_SHORTCUT
static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event);
#endif
@@ -124,10 +131,11 @@ public:
QPointer<QWebFrame> mainFrame;
QWebPage *q;
+ QWebPageClient* client;
#ifndef QT_NO_UNDOSTACK
QUndoStack *undoStack;
#endif
- QWidget *view;
+ QWidget* view;
bool insideOpenCall;
quint64 m_totalBytes;
@@ -136,6 +144,8 @@ public:
QPoint tripleClick;
QBasicTimer tripleClickTimer;
+ bool clickCausedFocus;
+
#if QT_VERSION < 0x040400
bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
@@ -168,6 +178,10 @@ public:
QWebPluginFactory *pluginFactory;
+ QWidget* inspectorFrontend;
+ QWebInspector* inspector;
+ bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
+
static bool drtRun;
};
diff --git a/WebKit/qt/Api/qwebplugindatabase.cpp b/WebKit/qt/Api/qwebplugindatabase.cpp
index 8758c60..623895f 100644
--- a/WebKit/qt/Api/qwebplugindatabase.cpp
+++ b/WebKit/qt/Api/qwebplugindatabase.cpp
@@ -19,7 +19,6 @@
#include "config.h"
#include "qwebplugindatabase.h"
-#include "qwebplugindatabase_p.h"
#include "PluginDatabase.h"
#include "PluginPackage.h"
@@ -32,16 +31,6 @@ using namespace WebCore;
\brief Represents a single MIME type supported by a plugin.
*/
-QWebPluginInfoPrivate::QWebPluginInfoPrivate(RefPtr<PluginPackage> pluginPackage)
- : plugin(pluginPackage)
-{
-}
-
-QWebPluginDatabasePrivate::QWebPluginDatabasePrivate(PluginDatabase* pluginDatabase)
- : database(pluginDatabase)
-{
-}
-
/*!
\class QWebPluginInfo
\since 4.6
@@ -64,21 +53,25 @@ QWebPluginDatabasePrivate::QWebPluginDatabasePrivate(PluginDatabase* pluginDatab
Constructs a null QWebPluginInfo.
*/
QWebPluginInfo::QWebPluginInfo()
- : d(new QWebPluginInfoPrivate(0))
+ : m_package(0)
{
}
-QWebPluginInfo::QWebPluginInfo(PluginPackage* plugin)
- : d(new QWebPluginInfoPrivate(plugin))
+QWebPluginInfo::QWebPluginInfo(PluginPackage* package)
+ : m_package(package)
{
+ if (m_package)
+ m_package->ref();
}
/*!
Contructs a copy of \a other.
*/
QWebPluginInfo::QWebPluginInfo(const QWebPluginInfo& other)
- : d(new QWebPluginInfoPrivate(other.d->plugin))
+ : m_package(other.m_package)
{
+ if (m_package)
+ m_package->ref();
}
/*!
@@ -86,7 +79,8 @@ QWebPluginInfo::QWebPluginInfo(const QWebPluginInfo& other)
*/
QWebPluginInfo::~QWebPluginInfo()
{
- delete d;
+ if (m_package)
+ m_package->deref();
}
/*!
@@ -96,9 +90,9 @@ QWebPluginInfo::~QWebPluginInfo()
*/
QString QWebPluginInfo::name() const
{
- if (!d->plugin)
+ if (!m_package)
return QString();
- return d->plugin->name();
+ return m_package->name();
}
/*!
@@ -108,9 +102,9 @@ QString QWebPluginInfo::name() const
*/
QString QWebPluginInfo::description() const
{
- if (!d->plugin)
+ if (!m_package)
return QString();
- return d->plugin->description();
+ return m_package->description();
}
/*!
@@ -120,28 +114,27 @@ QString QWebPluginInfo::description() const
*/
QList<QWebPluginInfo::MimeType> QWebPluginInfo::mimeTypes() const
{
- if (!d->plugin)
- return QList<MimeType>();
+ if (m_package && m_mimeTypes.isEmpty()) {
+ const MIMEToDescriptionsMap& mimeToDescriptions = m_package->mimeToDescriptions();
+ MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
- QList<MimeType> mimeTypes;
- const MIMEToDescriptionsMap& mimeToDescriptions = d->plugin->mimeToDescriptions();
- MIMEToDescriptionsMap::const_iterator end = mimeToDescriptions.end();
- for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
- MimeType mimeType;
- mimeType.name = it->first;
- mimeType.description = it->second;
+ for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
+ MimeType mimeType;
+ mimeType.name = it->first;
+ mimeType.description = it->second;
- QStringList fileExtensions;
- Vector<String> extensions = d->plugin->mimeToExtensions().get(mimeType.name);
+ QStringList fileExtensions;
+ Vector<String> extensions = m_package->mimeToExtensions().get(mimeType.name);
- for (unsigned i = 0; i < extensions.size(); ++i)
- fileExtensions.append(extensions[i]);
+ for (unsigned i = 0; i < extensions.size(); ++i)
+ fileExtensions.append(extensions[i]);
- mimeType.fileExtensions = fileExtensions;
- mimeTypes.append(mimeType);
+ mimeType.fileExtensions = fileExtensions;
+ m_mimeTypes.append(mimeType);
+ }
}
- return mimeTypes;
+ return m_mimeTypes;
}
/*!
@@ -152,13 +145,9 @@ QList<QWebPluginInfo::MimeType> QWebPluginInfo::mimeTypes() const
*/
bool QWebPluginInfo::supportsMimeType(const QString& mimeType) const
{
- QList<MimeType> types = mimeTypes();
- foreach (const MimeType& type, types) {
- if (type.name == mimeType)
- return true;
- }
-
- return false;
+ if (!m_package)
+ return false;
+ return m_package->mimeToDescriptions().contains(mimeType);
}
/*!
@@ -166,9 +155,9 @@ bool QWebPluginInfo::supportsMimeType(const QString& mimeType) const
*/
QString QWebPluginInfo::path() const
{
- if (!d->plugin)
+ if (!m_package)
return QString();
- return d->plugin->path();
+ return m_package->path();
}
/*!
@@ -176,7 +165,7 @@ QString QWebPluginInfo::path() const
*/
bool QWebPluginInfo::isNull() const
{
- return !d->plugin;
+ return !m_package;
}
/*!
@@ -189,9 +178,9 @@ bool QWebPluginInfo::isNull() const
*/
void QWebPluginInfo::setEnabled(bool enabled)
{
- if (!d->plugin)
+ if (!m_package)
return;
- d->plugin->setEnabled(enabled);
+ m_package->setEnabled(enabled);
}
/*!
@@ -201,27 +190,43 @@ void QWebPluginInfo::setEnabled(bool enabled)
*/
bool QWebPluginInfo::isEnabled() const
{
- if (!d->plugin)
+ if (!m_package)
return false;
- return d->plugin->isEnabled();
+ return m_package->isEnabled();
}
+/*!
+ Returns true if this plugin info is the same as the \a other plugin info.
+*/
bool QWebPluginInfo::operator==(const QWebPluginInfo& other) const
{
- return d->plugin == other.d->plugin;
+ return m_package == other.m_package;
}
+/*!
+ Returns true if this plugin info is different from the \a other plugin info.
+*/
bool QWebPluginInfo::operator!=(const QWebPluginInfo& other) const
{
- return d->plugin != other.d->plugin;
+ return m_package != other.m_package;
}
+/*!
+ Assigns the \a other plugin info to this plugin info, and returns a reference
+ to this plugin info.
+*/
QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other)
{
if (this == &other)
return *this;
- d->plugin = other.d->plugin;
+ if (m_package)
+ m_package->deref();
+ m_package = other.m_package;
+ if (m_package)
+ m_package->ref();
+ m_mimeTypes = other.m_mimeTypes;
+
return *this;
}
@@ -253,13 +258,12 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other)
QWebPluginDatabase::QWebPluginDatabase(QObject* parent)
: QObject(parent)
- , d(new QWebPluginDatabasePrivate(PluginDatabase::installedPlugins()))
+ , m_database(PluginDatabase::installedPlugins())
{
}
QWebPluginDatabase::~QWebPluginDatabase()
{
- delete d;
}
/*!
@@ -273,7 +277,7 @@ QWebPluginDatabase::~QWebPluginDatabase()
QList<QWebPluginInfo> QWebPluginDatabase::plugins() const
{
QList<QWebPluginInfo> qwebplugins;
- const Vector<PluginPackage*>& plugins = d->database->plugins();
+ const Vector<PluginPackage*>& plugins = m_database->plugins();
for (unsigned int i = 0; i < plugins.size(); ++i) {
PluginPackage* plugin = plugins[i];
@@ -308,7 +312,7 @@ QStringList QWebPluginDatabase::searchPaths() const
{
QStringList paths;
- const Vector<String>& directories = d->database->pluginDirectories();
+ const Vector<String>& directories = m_database->pluginDirectories();
for (unsigned int i = 0; i < directories.size(); ++i)
paths.append(directories[i]);
@@ -325,12 +329,12 @@ void QWebPluginDatabase::setSearchPaths(const QStringList& paths)
{
Vector<String> directories;
- for (unsigned int i = 0; i < paths.count(); ++i)
+ for (int i = 0; i < paths.count(); ++i)
directories.append(paths.at(i));
- d->database->setPluginDirectories(directories);
+ m_database->setPluginDirectories(directories);
// PluginDatabase::setPluginDirectories() does not refresh the database.
- d->database->refresh();
+ m_database->refresh();
}
/*!
@@ -341,7 +345,7 @@ void QWebPluginDatabase::setSearchPaths(const QStringList& paths)
*/
void QWebPluginDatabase::addSearchPath(const QString& path)
{
- d->database->addExtraPluginDirectory(path);
+ m_database->addExtraPluginDirectory(path);
// PluginDatabase::addExtraPluginDirectory() does refresh the database.
}
@@ -355,7 +359,7 @@ void QWebPluginDatabase::addSearchPath(const QString& path)
*/
void QWebPluginDatabase::refresh()
{
- d->database->refresh();
+ m_database->refresh();
}
/*!
@@ -365,7 +369,7 @@ void QWebPluginDatabase::refresh()
*/
QWebPluginInfo QWebPluginDatabase::pluginForMimeType(const QString& mimeType)
{
- return QWebPluginInfo(d->database->pluginForMIMEType(mimeType));
+ return QWebPluginInfo(m_database->pluginForMIMEType(mimeType));
}
/*!
@@ -378,5 +382,5 @@ QWebPluginInfo QWebPluginDatabase::pluginForMimeType(const QString& mimeType)
*/
void QWebPluginDatabase::setPreferredPluginForMimeType(const QString& mimeType, const QWebPluginInfo& plugin)
{
- d->database->setPreferredPluginForMIMEType(mimeType, plugin.d->plugin.get());
+ m_database->setPreferredPluginForMIMEType(mimeType, plugin.m_package);
}
diff --git a/WebKit/qt/Api/qwebplugindatabase.h b/WebKit/qt/Api/qwebplugindatabase.h
index 4b50119..b22c3de 100644
--- a/WebKit/qt/Api/qwebplugindatabase.h
+++ b/WebKit/qt/Api/qwebplugindatabase.h
@@ -27,6 +27,7 @@
#include <QtCore/qstringlist.h>
namespace WebCore {
+ class PluginDatabase;
class PluginPackage;
}
@@ -39,7 +40,7 @@ public:
~QWebPluginInfo();
private:
- QWebPluginInfo(WebCore::PluginPackage* plugin);
+ QWebPluginInfo(WebCore::PluginPackage* package);
public:
typedef QWebPluginFactory::MimeType MimeType;
@@ -61,7 +62,9 @@ public:
friend class QWebPluginDatabase;
private:
- QWebPluginInfoPrivate *d;
+ QWebPluginInfoPrivate* d;
+ WebCore::PluginPackage* m_package;
+ mutable QList<MimeType> m_mimeTypes;
};
class QWebPluginDatabasePrivate;
@@ -88,7 +91,8 @@ public:
friend class QWebSettings;
private:
- QWebPluginDatabasePrivate *d;
+ QWebPluginDatabasePrivate* d;
+ WebCore::PluginDatabase* m_database;
};
#endif // QWEBPLUGINDATABASE_H
diff --git a/WebKit/qt/Api/qwebpluginfactory.cpp b/WebKit/qt/Api/qwebpluginfactory.cpp
index 7a8cabe..8ff13b1 100644
--- a/WebKit/qt/Api/qwebpluginfactory.cpp
+++ b/WebKit/qt/Api/qwebpluginfactory.cpp
@@ -26,6 +26,8 @@
\brief The QWebPluginFactory class creates plugins to be embedded into web
pages.
+ \inmodule QtWebKit
+
QWebPluginFactory is a factory for creating plugins for QWebPage. A plugin
factory can be installed on a QWebPage using QWebPage::setPluginFactory().
@@ -47,6 +49,8 @@
\class QWebPluginFactory::Plugin
\since 4.4
\brief the QWebPluginFactory::Plugin structure describes the properties of a plugin a QWebPluginFactory can create.
+
+ \inmodule QtWebKit
*/
/*!
@@ -68,8 +72,13 @@
\class QWebPluginFactory::MimeType
\since 4.4
\brief The QWebPluginFactory::MimeType structure describes a mime type supported by a plugin.
+
+ \inmodule QtWebKit
*/
+/*!
+ Returns true if this mimetype is the same as the \a other mime type.
+*/
bool QWebPluginFactory::MimeType::operator==(const MimeType& other) const
{
return name == other.name
@@ -78,6 +87,12 @@ bool QWebPluginFactory::MimeType::operator==(const MimeType& other) const
}
/*!
+ \fn bool QWebPluginFactory::MimeType::operator!=(const MimeType& other) const
+
+ Returns true if this mimetype is different from the \a other mime type.
+*/
+
+/*!
\variable QWebPluginFactory::MimeType::name
The full name of the MIME type; e.g., \c{text/plain} or \c{image/png}.
@@ -143,7 +158,7 @@ void QWebPluginFactory::refreshPlugins()
For example:
\code
- <object type="application/x-pdf" data="http://qtsoftware.com/document.pdf" width="500" height="400">
+ <object type="application/x-pdf" data="http://qt.nokia.com/document.pdf" width="500" height="400">
<param name="showTableOfContents" value="true" />
<param name="hideThumbnails" value="false" />
</object>
@@ -156,7 +171,7 @@ void QWebPluginFactory::refreshPlugins()
\row \o mimeType
\o "application/x-pdf"
\row \o url
- \o "http://qtsoftware.com/document.pdf"
+ \o "http://qt.nokia.com/document.pdf"
\row \o argumentNames
\o "showTableOfContents" "hideThumbnails"
\row \o argumentVaues
@@ -180,6 +195,8 @@ void QWebPluginFactory::refreshPlugins()
\since 4.4
\brief The ExtensionOption class provides an extended input argument to QWebPluginFactory's extension support.
+ \inmodule QtWebKit
+
\sa QWebPluginFactory::extension()
*/
@@ -188,6 +205,8 @@ void QWebPluginFactory::refreshPlugins()
\since 4.4
\brief The ExtensionOption class provides an extended output argument to QWebPluginFactory's extension support.
+ \inmodule QtWebKit
+
\sa QWebPluginFactory::extension()
*/
diff --git a/WebKit/qt/Api/qwebsecurityorigin.cpp b/WebKit/qt/Api/qwebsecurityorigin.cpp
index d2eaf10..7c44e37 100644
--- a/WebKit/qt/Api/qwebsecurityorigin.cpp
+++ b/WebKit/qt/Api/qwebsecurityorigin.cpp
@@ -35,6 +35,8 @@ using namespace WebCore;
\since 4.5
\brief The QWebSecurityOrigin class defines a security boundary for web sites.
+ \inmodule QtWebKit
+
QWebSecurityOrigin provides access to the security domains defined by web sites.
An origin consists of a host name, a scheme, and a port number. Web sites
with the same security origin can access each other's resources for client-side
@@ -198,3 +200,60 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const
return databases;
}
+/*!
+ \since 4.6
+
+ Adds the given \a scheme to the list of schemes that are considered equivalent
+ to the \c file: scheme. They are not subject to cross domain restrictions.
+*/
+void QWebSecurityOrigin::addLocalScheme(const QString& scheme)
+{
+ SecurityOrigin::registerURLSchemeAsLocal(scheme);
+}
+
+/*!
+ \since 4.6
+
+ Removes the given \a scheme from the list of local schemes.
+
+ \sa addLocalScheme()
+*/
+void QWebSecurityOrigin::removeLocalScheme(const QString& scheme)
+{
+ SecurityOrigin::removeURLSchemeRegisteredAsLocal(scheme);
+}
+
+/*!
+ \since 4.6
+ Returns a list of all the schemes that were set by the application as local schemes,
+ \sa addLocalScheme(), removeLocalScheme()
+*/
+QStringList QWebSecurityOrigin::localSchemes()
+{
+ QStringList list;
+ const URLSchemesMap& map = SecurityOrigin::localURLSchemes();
+ URLSchemesMap::const_iterator end = map.end();
+ for (URLSchemesMap::const_iterator i = map.begin(); i != end; ++i) {
+ const QString scheme = *i;
+ list.append(scheme);
+ }
+ return list;
+}
+
+/*!
+ \since 4.6
+ \internal
+*/
+void QWebSecurityOrigin::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
+{
+ SecurityOrigin::whiteListAccessFromOrigin(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
+}
+
+/*!
+ \since 4.6
+ \internal
+*/
+void QWebSecurityOrigin::resetOriginAccessWhiteLists()
+{
+ SecurityOrigin::resetOriginAccessWhiteLists();
+}
diff --git a/WebKit/qt/Api/qwebsecurityorigin.h b/WebKit/qt/Api/qwebsecurityorigin.h
index 3cfb0f4..94b96f0 100644
--- a/WebKit/qt/Api/qwebsecurityorigin.h
+++ b/WebKit/qt/Api/qwebsecurityorigin.h
@@ -37,6 +37,11 @@ class QWebFrame;
class QWEBKIT_EXPORT QWebSecurityOrigin {
public:
static QList<QWebSecurityOrigin> allOrigins();
+ static void addLocalScheme(const QString& scheme);
+ static void removeLocalScheme(const QString& scheme);
+ static QStringList localSchemes();
+ static void whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
+ static void resetOriginAccessWhiteLists();
~QWebSecurityOrigin();
diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp
index 47b2818..abd7036 100644
--- a/WebKit/qt/Api/qwebsettings.cpp
+++ b/WebKit/qt/Api/qwebsettings.cpp
@@ -37,7 +37,11 @@
#include "IntSize.h"
#include "ApplicationCacheStorage.h"
#include "DatabaseTracker.h"
+#include "FileSystem.h"
+#include <QApplication>
+#include <QDesktopServices>
+#include <QDir>
#include <QHash>
#include <QSharedData>
#include <QUrl>
@@ -55,7 +59,7 @@ public:
QHash<int, bool> attributes;
QUrl userStyleSheetLocation;
QString defaultTextEncoding;
- QString localStorageDatabasePath;
+ QString localStoragePath;
QString offlineWebApplicationCachePath;
qint64 offlineStorageDefaultQuota;
@@ -167,8 +171,8 @@ void QWebSettingsPrivate::apply()
QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
settings->setDefaultTextEncodingName(encoding);
- QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath;
- settings->setLocalStorageDatabasePath(localStoragePath);
+ QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
+ settings->setLocalStorageDatabasePath(storagePath);
value = attributes.value(QWebSettings::ZoomTextOnly,
global->attributes.value(QWebSettings::ZoomTextOnly));
@@ -186,13 +190,18 @@ void QWebSettingsPrivate::apply()
global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled));
settings->setOfflineWebApplicationCacheEnabled(value);
- value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled,
- global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled));
+ value = attributes.value(QWebSettings::LocalStorageEnabled,
+ global->attributes.value(QWebSettings::LocalStorageEnabled));
+
settings->setLocalStorageEnabled(value);
value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
settings->setAllowUniversalAccessFromFileURLs(value);
+
+ value = attributes.value(QWebSettings::SessionStorageEnabled,
+ global->attributes.value(QWebSettings::SessionStorageEnabled));
+ settings->setSessionStorageEnabled(value);
} else {
QList<QWebSettingsPrivate*> settings = *::allSettings();
for (int i = 0; i < settings.count(); ++i)
@@ -220,6 +229,8 @@ QWebSettings* QWebSettings::globalSettings()
\brief The QWebSettings class provides an object to store the settings used
by QWebPage and QWebFrame.
+ \inmodule QtWebKit
+
Each QWebPage object has its own QWebSettings object, which configures the
settings for that page. If a setting is not configured, then it is looked
up in the global settings object, which can be accessed using
@@ -302,6 +313,8 @@ QWebSettings* QWebSettings::globalSettings()
\value AutoLoadImages Specifies whether images are automatically loaded in
web pages.
+ \value DnsPrefetchEnabled Specifies whether QtWebkit will try to pre-fetch DNS entries to
+ speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later.
\value JavascriptEnabled Enables or disables the running of JavaScript
programs.
\value JavaEnabled Enables or disables Java applets.
@@ -314,8 +327,9 @@ QWebSettings* QWebSettings::globalSettings()
\value JavascriptCanAccessClipboard Specifies whether JavaScript programs
can read or write to the clipboard.
\value DeveloperExtrasEnabled Enables extra tools for Web developers.
- Currently this enables the "Inspect" element in the context menu,
- which shows the WebKit WebInspector for web site debugging.
+ Currently this enables the "Inspect" element in the context menu as
+ well as the use of QWebInspector which controls the WebKit WebInspector
+ for web site debugging.
\value LinksIncludedInFocusChain Specifies whether hyperlinks should be
included in the keyboard focus chain.
\value ZoomTextOnly Specifies whether the zoom factor on a frame applies to
@@ -323,12 +337,14 @@ QWebSettings* QWebSettings::globalSettings()
\value PrintElementBackgrounds Specifies whether the background color and images
are also drawn when the page is printed.
\value OfflineStorageDatabaseEnabled Specifies whether support for the HTML 5
- offline storage feature is enabled or not.
+ offline storage feature is enabled or not. Disabled by default.
\value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5
- web application cache feature is enabled or not.
- \value LocalStorageDatabaseEnabled Specifies whether support for the HTML 5
- local storage feature is enabled or not.
+ web application cache feature is enabled or not. Disabled by default.
+ \value LocalStorageEnabled Specifies whether support for the HTML 5
+ local storage feature is enabled or not. Disabled by default.
\value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls.
+ \value SessionStorageEnabled Specifies whether support for the HTML 5
+ session storage feature is enabled or not. Enabled by default.
*/
/*!
@@ -340,8 +356,8 @@ QWebSettings::QWebSettings()
// Initialize our global defaults
d->fontSizes.insert(QWebSettings::MinimumFontSize, 0);
d->fontSizes.insert(QWebSettings::MinimumLogicalFontSize, 0);
- d->fontSizes.insert(QWebSettings::DefaultFontSize, 14);
- d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 14);
+ d->fontSizes.insert(QWebSettings::DefaultFontSize, 16);
+ d->fontSizes.insert(QWebSettings::DefaultFixedFontSize, 13);
d->fontFamilies.insert(QWebSettings::StandardFont, QLatin1String("Arial"));
d->fontFamilies.insert(QWebSettings::FixedFont, QLatin1String("Courier New"));
d->fontFamilies.insert(QWebSettings::SerifFont, QLatin1String("Times New Roman"));
@@ -350,14 +366,16 @@ QWebSettings::QWebSettings()
d->fontFamilies.insert(QWebSettings::FantasyFont, QLatin1String("Arial"));
d->attributes.insert(QWebSettings::AutoLoadImages, true);
+ d->attributes.insert(QWebSettings::DnsPrefetchEnabled, false);
d->attributes.insert(QWebSettings::JavascriptEnabled, true);
d->attributes.insert(QWebSettings::LinksIncludedInFocusChain, true);
d->attributes.insert(QWebSettings::ZoomTextOnly, false);
d->attributes.insert(QWebSettings::PrintElementBackgrounds, true);
- d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true);
- d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true);
- d->attributes.insert(QWebSettings::LocalStorageDatabaseEnabled, true);
- d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, true);
+ d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, false);
+ d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, false);
+ d->attributes.insert(QWebSettings::LocalStorageEnabled, false);
+ d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false);
+ d->attributes.insert(QWebSettings::SessionStorageEnabled, true);
d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
}
@@ -422,7 +440,10 @@ void QWebSettings::resetFontSize(FontSize type)
/*!
Specifies the location of a user stylesheet to load with every web page.
- The \a location can be a URL or a path on the local filesystem.
+ The \a location must be either a path on the local filesystem, or a data URL
+ with UTF-8 and Base64 encoded data, such as:
+
+ "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;"
\sa userStyleSheetUrl()
*/
@@ -607,17 +628,20 @@ 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();
}
/*!
- Sets the maximum number of pages to hold in the memory cache to \a pages.
+ Sets the maximum number of pages to hold in the memory page cache to \a pages.
+
+ The Page Cache allows for a nicer user experience when navigating forth or back
+ to pages in the forward/back history, by pausing and resuming up to \a pages
+ per page group.
+
+ For more information about the feature, please refer to:
+
+ http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
*/
void QWebSettings::setMaximumPagesInCache(int pages)
{
@@ -867,37 +891,71 @@ qint64 QWebSettings::offlineWebApplicationCacheQuota()
#endif
}
-/*
- \since 4.5
+/*!
+ \since 4.6
\relates QWebSettings
- Sets the path for HTML5 local storage databases to \a path.
-
- \a path must point to an existing directory where the cache is stored.
-
- Setting an empty path disables the feature.
+ Sets the path for HTML5 local storage to \a path.
+
+ For more information on HTML5 local storage see the
+ \l{http://www.w3.org/TR/webstorage/#the-localstorage-attribute}{Web Storage standard}.
+
+ Support for local storage can enabled by setting the
+ \l{QWebSettings::LocalStorageEnabled}{LocalStorageEnabled} attribute.
- \sa localStorageDatabasePath()
+ \sa localStoragePath()
*/
-void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path)
+void QWebSettings::setLocalStoragePath(const QString& path)
{
- QWebSettingsPrivate* d = settings->handle();
- d->localStorageDatabasePath = path;
+ d->localStoragePath = path;
d->apply();
}
-/*
- \since 4.5
+/*!
+ \since 4.6
\relates QWebSettings
- Returns the path for HTML5 local storage databases
- or an empty string if the feature is disabled.
+ Returns the path for HTML5 local storage.
+
+ \sa setLocalStoragePath()
+*/
+QString QWebSettings::localStoragePath() const
+{
+ return d->localStoragePath;
+}
- \sa setLocalStorageDatabasePath()
+/*!
+ \since 4.6
+ \relates QWebSettings
+
+ Enables WebKit persistent data and sets the path to \a path.
+ If the \a path is empty the path for persistent data is set to the
+ user-specific data location specified by
+ \l{QDesktopServices::DataLocation}{DataLocation}.
+
+ \sa localStoragePath()
*/
-QString QWEBKIT_EXPORT qt_websettings_localStorageDatabasePath(QWebSettings* settings)
+void QWebSettings::enablePersistentStorage(const QString& path)
{
- return settings->handle()->localStorageDatabasePath;
+ QString storagePath;
+
+ if (path.isEmpty()) {
+ storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
+
+ if (storagePath.isEmpty())
+ storagePath = WebCore::pathByAppendingComponent(QDir::homePath(), QCoreApplication::applicationName());
+ } else
+ storagePath = path;
+
+ WebCore::makeAllDirectories(storagePath);
+
+ QWebSettings::setIconDatabasePath(storagePath);
+ QWebSettings::setOfflineWebApplicationCachePath(storagePath);
+ QWebSettings::setOfflineStoragePath(WebCore::pathByAppendingComponent(storagePath, "Databases"));
+ QWebSettings::globalSettings()->setLocalStoragePath(WebCore::pathByAppendingComponent(storagePath, "LocalStorage"));
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
}
/*!
diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h
index b7ea54b..4790823 100644
--- a/WebKit/qt/Api/qwebsettings.h
+++ b/WebKit/qt/Api/qwebsettings.h
@@ -62,8 +62,13 @@ public:
PrintElementBackgrounds,
OfflineStorageDatabaseEnabled,
OfflineWebApplicationCacheEnabled,
- LocalStorageDatabaseEnabled,
- LocalContentCanAccessRemoteUrls
+ LocalStorageEnabled,
+#ifdef QT_DEPRECATED
+ LocalStorageDatabaseEnabled = LocalStorageEnabled,
+#endif
+ LocalContentCanAccessRemoteUrls,
+ SessionStorageEnabled,
+ DnsPrefetchEnabled
};
enum WebGraphic {
MissingImageGraphic,
@@ -121,9 +126,14 @@ public:
static QString offlineWebApplicationCachePath();
static void setOfflineWebApplicationCacheQuota(qint64 maximumSize);
static qint64 offlineWebApplicationCacheQuota();
+
+ void setLocalStoragePath(const QString& path);
+ QString localStoragePath() const;
static void clearMemoryCaches();
+ static void enablePersistentStorage(const QString& path = QString());
+
inline QWebSettingsPrivate* handle() const { return d; }
private:
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index e1a0c98..ce8b923 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "qwebview.h"
+
+#include "QWebPageClient.h"
#include "qwebframe.h"
#include "qwebpage_p.h"
@@ -29,46 +31,91 @@
#include "qprinter.h"
#include "qdir.h"
#include "qfile.h"
+#if defined(Q_WS_X11)
+#include <QX11Info>
+#endif
-class QWebViewPrivate {
+class QWebViewPrivate : public QWebPageClient {
public:
QWebViewPrivate(QWebView *view)
: view(view)
, page(0)
, renderHints(QPainter::TextAntialiasing)
+ {
+ Q_ASSERT(view);
+ }
+
+ virtual void scroll(int dx, int dy, const QRect&);
+ virtual void update(const QRect& dirtyRect);
+
#ifndef QT_NO_CURSOR
- , cursorSetByWebCore(false)
- , usesWebCoreCursor(true)
+ virtual QCursor cursor() const;
+ virtual void updateCursor(const QCursor& cursor);
#endif
- {}
+
+ virtual int screenNumber() const;
+ virtual WId winId() const;
+
+ virtual QObject* pluginParent() const;
+
+ void _q_pageDestroyed();
QWebView *view;
QWebPage *page;
QPainter::RenderHints renderHints;
+};
+
+void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
+{
+ view->scroll(qreal(dx), qreal(dy), rectToScroll);
+}
+
+void QWebViewPrivate::update(const QRect & dirtyRect)
+{
+ view->update(dirtyRect);
+}
#ifndef QT_NO_CURSOR
- /*
- * We keep track of if we have called setCursor and if the CursorChange
- * event is sent due our setCursor call and if we currently use the WebCore
- * Cursor and use it to decide if we can update to another WebCore Cursor.
- */
- bool cursorSetByWebCore;
- bool usesWebCoreCursor;
-
- void setCursor(const QCursor& newCursor)
- {
- webCoreCursor = newCursor;
+QCursor QWebViewPrivate::cursor() const
+{
+ return view->cursor();
+}
- if (usesWebCoreCursor) {
- cursorSetByWebCore = true;
- view->setCursor(webCoreCursor);
- }
- }
+void QWebViewPrivate::updateCursor(const QCursor& cursor)
+{
+ view->setCursor(cursor);
+}
+#endif
- QCursor webCoreCursor;
+int QWebViewPrivate::screenNumber() const
+{
+#if defined(Q_WS_X11)
+ if (view)
+ return view->x11Info().screen();
#endif
-};
+
+ return 0;
+}
+
+WId QWebViewPrivate::winId() const
+{
+ if (view)
+ return view->winId();
+
+ return 0;
+}
+
+QObject* QWebViewPrivate::pluginParent() const
+{
+ return view;
+}
+
+void QWebViewPrivate::_q_pageDestroyed()
+{
+ page = 0;
+ view->setPage(0);
+}
/*!
\class QWebView
@@ -77,6 +124,8 @@ public:
web documents.
\ingroup advanced
+ \inmodule QtWebKit
+
QWebView is the main widget component of the QtWebKit web browsing module.
It can be used in various applications to display web content live from the
Internet.
@@ -160,7 +209,7 @@ QWebView::QWebView(QWidget *parent)
{
d = new QWebViewPrivate(this);
-#if !defined(Q_WS_QWS)
+#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN)
setAttribute(Qt::WA_InputMethodEnabled);
#endif
@@ -211,6 +260,7 @@ void QWebView::setPage(QWebPage* page)
if (d->page == page)
return;
if (d->page) {
+ d->page->d->client = 0; // unset the page client
if (d->page->parent() == this)
delete d->page;
else
@@ -219,6 +269,7 @@ void QWebView::setPage(QWebPage* page)
d->page = page;
if (d->page) {
d->page->setView(this);
+ d->page->d->client = d; // set the page client
d->page->setPalette(palette());
// #### connect signals
QWebFrame *mainFrame = d->page->mainFrame();
@@ -242,6 +293,8 @@ void QWebView::setPage(QWebPage* page)
connect(d->page, SIGNAL(microFocusChanged()),
this, SLOT(updateMicroFocus()));
+ connect(d->page, SIGNAL(destroyed()),
+ this, SLOT(_q_pageDestroyed()));
}
setAttribute(Qt::WA_OpaquePaintEvent, d->page);
update();
@@ -608,6 +661,7 @@ qreal QWebView::textSizeMultiplier() const
return page()->mainFrame()->textSizeMultiplier();
}
+#if !defined(Q_OS_SYMBIAN)
/*!
\property QWebView::renderHints
\since 4.6
@@ -619,6 +673,7 @@ qreal QWebView::textSizeMultiplier() const
\sa QPainter::renderHints()
*/
+#endif
QPainter::RenderHints QWebView::renderHints() const
{
return d->renderHints;
@@ -694,19 +749,18 @@ bool QWebView::event(QEvent *e)
if (e->type() == QEvent::ShortcutOverride) {
d->page->event(e);
#ifndef QT_NO_CURSOR
- } else if (e->type() == static_cast<QEvent::Type>(WebCore::SetCursorEvent::EventType)) {
- d->setCursor(static_cast<WebCore::SetCursorEvent*>(e)->cursor());
#if QT_VERSION >= 0x040400
} else if (e->type() == QEvent::CursorChange) {
- // Okay we might use the WebCore Cursor now.
- d->usesWebCoreCursor = d->cursorSetByWebCore;
- d->cursorSetByWebCore = false;
-
- // Go back to the WebCore Cursor. QWidget::unsetCursor is appromixated with this
- if (!d->usesWebCoreCursor && cursor().shape() == Qt::ArrowCursor) {
- d->usesWebCoreCursor = true;
- d->setCursor(d->webCoreCursor);
- }
+ // An unsetCursor will set the cursor to Qt::ArrowCursor.
+ // Thus this cursor change might be a QWidget::unsetCursor()
+ // If this is not the case and it came from WebCore, the
+ // QWebPageClient already has set its cursor internally
+ // to Qt::ArrowCursor, so updating the cursor is always
+ // right, as it falls back to the last cursor set by
+ // WebCore.
+ // FIXME: Add a QEvent::CursorUnset or similar to Qt.
+ if (cursor().shape() == Qt::ArrowCursor)
+ d->resetCursor();
#endif
#endif
} else if (e->type() == QEvent::Leave)
@@ -1094,3 +1148,6 @@ void QWebView::changeEvent(QEvent *e)
\sa QWebPage::linkDelegationPolicy()
*/
+
+#include "moc_qwebview.cpp"
+
diff --git a/WebKit/qt/Api/qwebview.h b/WebKit/qt/Api/qwebview.h
index e886144..15b5836 100644
--- a/WebKit/qt/Api/qwebview.h
+++ b/WebKit/qt/Api/qwebview.h
@@ -50,7 +50,14 @@ class QWEBKIT_EXPORT QWebView : public QWidget {
//Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false)
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
+
+// FIXME: temporary work around for elftran issue that it couldn't find the QPainter::staticMetaObject
+// symbol from Qt lib; it should be reverted after the right symbol is exported.
+// remember to revert the qdoc \property comment as well.
+// See bug: http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=258893
+#if !defined(Q_OS_SYMBIAN)
Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
+#endif
Q_FLAGS(QPainter::RenderHints)
public:
explicit QWebView(QWidget* parent = 0);
@@ -162,6 +169,7 @@ protected:
private:
friend class QWebPage;
QWebViewPrivate* d;
+ Q_PRIVATE_SLOT(d, void _q_pageDestroyed())
};
#endif // QWEBVIEW_H
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 6b05b18..5aff018 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,1689 @@
+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.
+
+ [Qt] don't enable input methods on Symbian by default.
+ https://bugs.webkit.org/show_bug.cgi?id=30117
+
+ If input methods are enabled Symbian FEP will be launched on every
+ pointer event making webpage navigation impossible with QWebView.
+
+ * 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ø.
+
+ Make Software Input Panel requests work with QGraphicsWebView
+ _and_ QWebView by sharing the event code in handleSoftwareInputPanel().
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::mouseReleaseEvent):
+ (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.
+
+ Fixed software input panel support on web input elements.
+
+ Send the RequestSoftwareInputPanel event if the element supports focus
+ and the element is clicked.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPagePrivate::mousePressEvent):
+ (QWebPagePrivate::mouseReleaseEvent):
+ * Api/qwebpage_p.h:
+
+2009-10-01 Joe Ligman <joseph.ligman@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implementation for QWebPage::inputMethodQuery and QWebPagePrivate::inputMethodEvent
+
+ https://bugs.webkit.org/show_bug.cgi?id=29681
+
+ Some additional changes from Kristian Amlie <kristian.amlie@nokia.com>:
+
+ * Fixed surrounding text to exclude preedit string
+ * Avoid emission of microFocusChanged during setComposition()
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::inputMethodEvent):
+ (QWebPage::inputMethodQuery):
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::respondToChangedSelection):
+ * 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ø.
+
+ [Qt] Default font size reconciliation to 16px/13px to match other platform's de-facto standard.
+ This fixes https://bugs.webkit.org/show_bug.cgi?id=19674.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+
+2009-09-29 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29844
+
+ QWebPage dependency autotest fix.
+
+ Fix for database() autotest. All opened databases should be removed at
+ end of test.
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::database):
+
+2009-09-29 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Some QWebHistory and QWebPage autotest crash fixes.
+
+ Some checking for m_mainFrame were added. MainFrame should be created
+ at some point of QWebPage live cicle.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29803
+
+ * Api/qwebpage.cpp:
+ (QWebPage::~QWebPage):
+ (QWebPage::currentFrame):
+ (QWebPage::history):
+ (QWebPage::selectedText):
+ (QWebPage::updatePositionDependentActions):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::crashTests_LazyInitializationOfMainFrame):
+
+2009-09-29 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann and Tor Arne Vestbø.
+
+ Implement QWebPage Extension for error pages, incl.
+ an example on how to use it in QtLauncher.
+
+ Correct our use of ResourceError.
+
+ * Api/qwebpage.h:
+ (ExtensionOption::):
+ (ExtensionOption::ErrorPageExtensionReturn::ErrorPageExtensionReturn):
+ * QtLauncher/main.cpp:
+ (WebPage::supportsExtension):
+ (MainWindow::MainWindow):
+ (MainWindow::selectElements):
+ (WebPage::extension):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::cancelledError):
+ (WebCore::FrameLoaderClientQt::blockedError):
+ (WebCore::FrameLoaderClientQt::cannotShowURLError):
+ (WebCore::FrameLoaderClientQt::interruptForPolicyChangeError):
+ (WebCore::FrameLoaderClientQt::cannotShowMIMETypeError):
+ (WebCore::FrameLoaderClientQt::fileDoesNotExistError):
+ (WebCore::FrameLoaderClientQt::callErrorPageExtension):
+ (WebCore::FrameLoaderClientQt::dispatchDidFailProvisionalLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidFailLoad):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-09-28 Andre Poenitz <andre.poenitz@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Compile fix with namespaced Qt.
+
+ * Api/qwebinspector_p.h:
+
+2009-09-27 Joe Ligman <joseph.ligman@mindspring.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Adding API setFocus and hasFocus to QWebElement. This API is needed for
+ clients that want to check/set the focus node of the document.
+ https://bugs.webkit.org/show_bug.cgi?id=29682
+
+ * Api/qwebelement.cpp:
+ (QWebElement::hasFocus):
+ (QWebElement::setFocus):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::hasSetFocus):
+
+2009-09-25 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Make tst_qwebframe work if Qt built without SSL support
+ https://bugs.webkit.org/show_bug.cgi?id=29735
+
+ * tests/qwebframe/tst_qwebframe.cpp: Missing #ifndef blocks added.
+
+2009-09-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Update QWebElement API to remove script related methods.
+ QWebElement::evaluateScript is the only one kept, these are
+ removed to postpone most of the QtWebKit<->JavaScript API design
+ after 4.6.
+ https://bugs.webkit.org/show_bug.cgi?id=29708
+
+ * Api/qwebelement.cpp:
+ * Api/qwebelement.h:
+ Methods removed:
+ - QWebElement::callFunction
+ - QWebElement::functions
+ - QWebElement::scriptableProperty
+ - QWebElement::setScriptableProperty
+ - QWebElement::scriptableProperties
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::evaluateScript):
+
+2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Rename QWebElement::evaluateScript
+ to QWebElement::evaluateJavaScript.
+ https://bugs.webkit.org/show_bug.cgi?id=29709
+
+ * Api/qwebelement.cpp:
+ (QWebElement::evaluateJavaScript):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::evaluateJavaScript):
+
+2009-09-25 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Update the stypeProperty API of QWebElement.
+ https://bugs.webkit.org/show_bug.cgi?id=29711
+
+ * Api/qwebelement.cpp:
+ (QWebElement::styleProperty):
+ - Merge the stypeProperty and the computedStyleProperty methods
+ - Remove the default value for the style resolving enum
+ - Rename ResolveRule to StyleResolveStrategy
+ (QWebElement::setStyleProperty):
+ - Remove the priority argument since it is possible to control the
+ behaviour by adding !important or removing in the value.
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::style):
+ (tst_QWebElement::computedStyle):
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-09-24 Jon Honeycutt <jhoneycutt@apple.com>
+
+ Reviewed by Alice Liu.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ Pass 0 for new Page constructor argument.
+
+2009-09-24 Martin Smith <msmith@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ qdoc: Added \brief texts to all the since 4.6 functions.
+
+ * Api/qwebhistory.cpp:
+
+2009-09-23 J-P Nurmi <jpnurmi@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ Prevent QWebPage::setView() from changing the viewport size on the fly
+ in case the view doesn't actually change. QWebPage::setView() is
+ called upon every QWebGraphicsItem::hoverMoveEvent(), which forced
+ the viewport size to be equal to the size of the whole graphics view.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29676
+
+ * Api/qwebpage.cpp:
+ (QWebPage::setView):
+
+2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Crash fix in QWebHistory back and forward methods.
+
+ QWebHistory::back() and QWebHistory::forward() were crashing on
+ ASSERT in WebCore::BackForwardList. The methods should check
+ canGoBack() and canGoForward() at the beginning.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29675
+
+ * Api/qwebhistory.cpp:
+ (QWebHistory::back):
+ (QWebHistory::forward):
+
+2009-09-23 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Bug fix. QWebHistory should call QWebPage::updateNavigationActions
+
+ In QWebHistory's methods that change item count or current item call
+ to QWebPage::updateNavigationActions should be executed.
+ QWebHistory::clear() and QWebHistory::restorState() were changed.
+ New helper method, QWebPagePrivate accesor, were created in
+ QWebHistoryPrivate class.
+ Two autotest were developed.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29246
+
+ * Api/qwebhistory.cpp:
+ (QWebHistory::clear):
+ (QWebHistory::restoreState):
+ (QWebHistoryPrivate::page):
+ * Api/qwebhistory_p.h:
+ * tests/qwebhistory/tst_qwebhistory.cpp:
+ (tst_QWebHistory::saveAndRestore_1):
+ (tst_QWebHistory::clear):
+
+2009-09-23 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Need to guard QX11Info include with Q_WS_X11.
+ That class may not be available (in QT 4.5 for Symbian, for instance).
+ Completes fixes in r48627 and r48604.
+
+ * Api/qwebgraphicsitem.cpp:
+ * Api/qwebview.cpp:
+
+2009-09-22 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add default timeout while waiting for signals in QWebPage auto
+ tests.
+ https://bugs.webkit.org/show_bug.cgi?id=29637
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (waitForSignal):
+
+2009-09-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reivewed by Simon Hausmann.
+
+ Fix the Qt/Mac build after r48604 (Implement new QWebPageClient class)
+
+ There's no QWidget::x11Info() on Mac, and setPlatformPluginWidget()
+ takes a QWidget*, not a QWebPageClient*
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItemPrivate::screenNumber):
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::screenNumber):
+
+2009-09-21 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ For Qt, platformPageClient() will now return a class derived from
+ the QWebPageClient, so the patch adapts our Qt hooks to go though
+ this class and not depend on the QWebView.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItemPrivate::scroll):
+ (QWebGraphicsItemPrivate::update):
+ (QWebGraphicsItemPrivate::cursor):
+ (QWebGraphicsItemPrivate::updateCursor):
+ (QWebGraphicsItemPrivate::screenNumber):
+ (QWebGraphicsItemPrivate::winId):
+ (QWebGraphicsItem::event):
+ (QWebGraphicsItem::setPage):
+ * Api/qwebgraphicsitem.h:
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ * Api/qwebpage_p.h:
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::scroll):
+ (QWebViewPrivate::update):
+ (QWebViewPrivate::cursor):
+ (QWebViewPrivate::updateCursor):
+ (QWebViewPrivate::screenNumber):
+ (QWebViewPrivate::winId):
+ (QWebView::setPage):
+ (QWebView::event):
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::repaint):
+ (WebCore::ChromeClientQt::scroll):
+ (WebCore::ChromeClientQt::platformPageClient):
+
+2009-09-21 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29609
+ Build fix for windows when using Qt 4.5.0.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
+2009-09-19 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29345
+ The tests of QWebFrame did not use QTRY_VERIFY for
+ tests involving the event loop.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+ * tests/util.h: Added. Copy of tests/shared/util.h of Qt
+
+2009-09-19 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add an autotest stub for QWebGraphicsItem.
+
+ It just calls all the functions and makes sure they don't crash.
+
+ * tests/qwebgraphicsitem/qwebgraphicsitem.pro: Added.
+ * tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp: Added.
+ (tst_QWebGraphicsItem::qwebgraphicsitem):
+ * tests/tests.pro:
+
+2009-09-18 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ Corrected the Symbian specific UID3 values to be assigned
+ from the "unprotected" pool that permits self-signing of
+ those test and demo executables. (Added new UID3 values
+ where they were missing for new components.)
+
+ * QGVLauncher/QGVLauncher.pro:
+ * QtLauncher/QtLauncher.pro:
+ * tests/benchmarks/loading/tst_loading.pro:
+ * tests/benchmarks/painting/tst_painting.pro:
+ * tests/qwebelement/qwebelement.pro:
+ * tests/qwebframe/qwebframe.pro:
+ * tests/qwebhistory/qwebhistory.pro:
+ * tests/qwebhistoryinterface/qwebhistoryinterface.pro:
+ * tests/qwebpage/qwebpage.pro:
+ * tests/qwebplugindatabase/qwebplugindatabase.pro:
+ * tests/qwebview/qwebview.pro:
+
+2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Make PlatformWindow return something else than PlatformWidget
+ https://bugs.webkit.org/show_bug.cgi?id=29085
+
+ Reflect the rename of platformWindow and it's return type.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::platformPageClient):
+ * WebCoreSupport/ChromeClientQt.h:
+
+2009-09-18 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add persistence support for configuration options in the
+ inspector.
+
+ * Api/qwebinspector.cpp:
+ * QtLauncher/main.cpp:
+ (main):
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientQt::populateSetting):
+ (WebCore::InspectorClientQt::storeSetting):
+ (WebCore::variantToSetting):
+ (WebCore::settingToVariant):
+
+2009-09-18 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Fixed a bunch of documentation warnings.
+
+ * Api/qwebgraphicsitem.cpp:
+ * Api/qwebplugindatabase.cpp:
+ * Api/qwebpluginfactory.cpp:
+ * Api/qwebsecurityorigin.cpp:
+
+2009-09-18 Warwick Allison <warwick.allison@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Added a test that console output works.
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (ConsolePage::ConsolePage):
+ (ConsolePage::javaScriptConsoleMessage):
+ (tst_QWebPage::consoleOutput):
+
+2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Improve documentation for Page Cache.
+
+ * Api/qwebsettings.cpp:
+
+2009-09-17 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Update QWebSettings::setUserStyleSheetUrl() docs and test
+
+ https://bugs.webkit.org/show_bug.cgi?id=29081
+
+ The documentation now specifies that the URL has to be a local file
+ or a a data-URL (with utf-8 and base64-encoded data), as these are the
+ only two schemes that the current code path accepts.
+
+ The auto-test has been updated to reflect this limitation.
+
+ At a later point we should concider adding API for the new way of
+ doing both user defined stylesheets and scripts.
+
+ * Api/qwebsettings.cpp:
+ * tests/qwebpage/tst_qwebpage.cpp:
+
+2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian build fix.
+
+ Moved the #ifdefs around _q_cleanupLeakMessages() into the function
+ definition.
+
+ QMake is not being able to distinguish between release and debug builds
+ in Symbian build. This is a Symbian toolchain issue.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::_q_cleanupLeakMessages):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+
+2009-09-17 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Small cosmetic documentation fixlet in the QWebInspector.
+
+ * Api/qwebinspector.cpp:
+
+2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ Detect and add Windows7 properly to the user agent.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
+2009-09-16 Andras Becsi <andrewbecsi@yahoo.co.uk>
+
+ Rubberstamped by Kenneth Christiansen.
+
+ [Qt] Build fix for previous changes.
+
+ * QGVLauncher/main.cpp:
+ (MainView::flip):
+
+2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Unreviewed potential Qt < 4.6 build fix.
+
+ * QGVLauncher/main.cpp:
+ (MainView::flip):
+
+2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Add a "Flip effect" to our GraphicsView based launcher.
+
+ * QGVLauncher/main.cpp:
+ (MainView::resizeEvent):
+ (MainView::flip):
+ (MainWindow::flip):
+ (MainWindow::buildUI):
+
+2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
+
+ Rubber-stamped by Simon Hausmann.
+
+ [Qt] Typo fix. Pass the window object to the Format
+ menu. In this way Qt can free its internal graphical
+ objects during exit.
+
+ * QtLauncher/main.cpp:
+ (MainWindow::setupUI):
+
+2009-09-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Build break fix on gcc ARM.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItemPrivate::_q_doLoadProgress):
+
+2009-09-16 Warwick Allison <warwick.allison@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fix a crash in QWebFrame::hasFocus() with a simple null pointer check
+ when the focused frame is null. We do the same check in other places
+ where we call kit().
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hasFocus):
+
+2009-09-16 Jure Repinc <jlp@holodeck1.com>
+
+ Reviewed by Simon Hausmann.
+
+ Fixed a typo found during translation.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::interruptForPolicyChangeError):
+
+2009-09-14 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] QWebGraphicsItem should check for null QWebPage.
+ https://bugs.webkit.org/show_bug.cgi?id=29185
+
+ Don't crash in QWebGraphicsItem when the page is still null, by
+ either checking if it's the case or constructing the default one.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItem::icon):
+ (QWebGraphicsItem::setZoomFactor):
+ (QWebGraphicsItem::zoomFactor):
+ (QWebGraphicsItem::setGeometry):
+ (QWebGraphicsItem::load):
+ (QWebGraphicsItem::setHtml):
+ (QWebGraphicsItem::toHtml):
+ (QWebGraphicsItem::setContent):
+ (QWebGraphicsItem::history):
+ (QWebGraphicsItem::settings):
+
+2009-09-11 David Boddie <dboddie@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Doc: Note that Netscape plugins are only available on desktop platforms.
+
+ * docs/qtwebkit.qdoc:
+
+2009-09-11 Martin Smith <msmith@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Adjust the name of the contentspage for the documentation
+ to the new name used in Qt 4.6.
+
+ * docs/qtwebkit.qdoc:
+
+2009-09-11 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Changed URLs from qtsoftware.com to qt.nokia.com, as part of a general
+ renaming.
+
+ * Api/qwebpluginfactory.cpp:
+ * docs/webkitsnippets/simple/main.cpp:
+ (main):
+ * docs/webkitsnippets/webpage/main.cpp:
+ (main):
+
+2009-09-11 Volker Hilsheimer <volker.hilsheimer@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Restructure the documentation, both on a file and on a content level.
+
+ * Api/qwebdatabase.cpp:
+ * Api/qwebelement.cpp:
+ * Api/qwebframe.cpp:
+ * Api/qwebhistory.cpp:
+ * Api/qwebhistoryinterface.cpp:
+ * Api/qwebpage.cpp:
+ * Api/qwebpluginfactory.cpp:
+ * Api/qwebsecurityorigin.cpp:
+ * Api/qwebsettings.cpp:
+ * Api/qwebview.cpp:
+ * docs/qtwebkit.qdoc:
+
+2009-09-11 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29136
+ [Qt] emit microFocusChanged() signal when no QWidget-based view is present.
+
+ emit microFocusChange() signal regardless of view.
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::setInputMethodState):
+
+2009-09-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28806
+
+ [Qt] Make the WebInspector available as a QWidget.
+
+ * Api/headers.pri:
+ * Api/qwebelement.cpp:
+ (QWebElement::enclosingElement):
+ * Api/qwebelement.h:
+ * Api/qwebinspector.cpp: Added.
+ * Api/qwebinspector.h: Added.
+ * Api/qwebinspector_p.h: Added.
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPagePrivate::setInspector):
+ (QWebPagePrivate::getOrCreateInspector):
+ (QWebPagePrivate::inspectorController):
+ (QWebPage::~QWebPage):
+ (QWebPage::triggerAction):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ * Api/qwebsettings.cpp:
+ * QtLauncher/main.cpp:
+ (MainWindow::MainWindow):
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientWebPage::InspectorClientWebPage):
+ (WebCore::InspectorClientWebPage::createWindow):
+ (WebCore::InspectorClientQt::createPage):
+ (WebCore::InspectorClientQt::showWindow):
+ (WebCore::InspectorClientQt::closeWindow):
+ (WebCore::InspectorClientQt::attachWindow):
+ (WebCore::InspectorClientQt::detachWindow):
+ (WebCore::InspectorClientQt::updateWindowTitle):
+ * WebCoreSupport/InspectorClientQt.h:
+ * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: Added.
+
+2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Fix comparison between signed and unsigned integer warnings
+ https://bugs.webkit.org/show_bug.cgi?id=29162
+
+ No functional change.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::findAll):
+ * Api/qwebhistory.cpp:
+ (QWebHistory::items):
+ (QWebHistory::backItems):
+ (QWebHistory::forwardItems):
+ (QWebHistory::saveState):
+ * Api/qwebplugindatabase.cpp:
+ (QWebPluginDatabase::setSearchPaths):
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::runOpenPanel):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createPlugin):
+
+2009-09-10 Simon Hausmann <hausmann@webkit.org>
+
+ Rubber-stamped by Ariya Hidayat.
+
+ Fix a bunch of qdoc warnings: Invalid references, non-standard
+ wording, etc.
+
+ * Api/qwebelement.cpp:
+ * Api/qwebgraphicsitem.cpp:
+ * Api/qwebsecurityorigin.cpp:
+
+2009-09-10 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix context menu event delivery with QWebGraphicsItem.
+
+ Re-implement the correct context menu virtual function using
+ a QGraphicsSceneContextMenuEvent and forward & handle it in
+ QWebPage.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItem::contextMenuEvent):
+ * Api/qwebgraphicsitem.h:
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::contextMenuEvent):
+ (QWebPage::event):
+ * Api/qwebpage_p.h:
+
+2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed.
+
+ Build fix for QtWebKit for Mac after r48219.
+
+ qevent and qstyleoption are QtGui interfaces.
+
+ * Api/qwebgraphicsitem.cpp:
+ * Api/qwebgraphicsitem.h:
+
+2009-09-09 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Call the right base class function QGraphicsWidget::event() instead
+ of skipping it and using QObject::event() instead.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItem::event):
+
+2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Unreviewed.
+
+ Fix comment at Tor Arne Vestbø's request.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItem::sceneEvent):
+ (QWebGraphicsItem::event):
+
+2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Implement some virtual event methods so that we can fix
+ event-related bugs in Qt patch releases.
+
+ * Api/qwebgraphicsitem.cpp:
+ (QWebGraphicsItem::sceneEvent):
+ (QWebGraphicsItem::event):
+ * Api/qwebgraphicsitem.h:
+
+2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>, Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ Add a new QGraphicsWidget based version of the "QWebView"
+ under the name "QWebGraphicsItem".
+
+ https://bugs.webkit.org/show_bug.cgi?id=28862
+
+ Includes an alternative Qt launcher using the QGraphicsView.
+
+ * Api/headers.pri:
+ * Api/qwebgraphicsitem.cpp: Added.
+ * Api/qwebgraphicsitem.h: Added.
+ * Api/qwebpage.h:
+ * QGVLauncher/QGVLauncher.pro: Copied from WebKit/qt/QtLauncher/QtLauncher.pro.
+ * QGVLauncher/main.cpp: Added.
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::repaint):
+ (WebCore::ChromeClientQt::scroll):
+
+2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Unreviewed build fix.
+
+ Potential build fix for Qt 4.5
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::mousePressEvent):
+
+2009-09-08 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29007
+ Add a test for the signal QWebFrame::javaScriptWindowObjectCleared()
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix unused variable warnings
+ https://bugs.webkit.org/show_bug.cgi?id=29018
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::keyPressEvent):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::startDownload):
+ (WebCore::FrameLoaderClientQt::createFrame):
+
+2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Use the declaration order in initializer lists
+ https://bugs.webkit.org/show_bug.cgi?id=29017
+
+ * Api/qwebframe_p.h:
+
+2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ Add support for handling QGraphicsScene events.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::mouseMoveEvent):
+ (QWebPagePrivate::mousePressEvent):
+ (QWebPagePrivate::mouseDoubleClickEvent):
+ (QWebPagePrivate::mouseTripleClickEvent):
+ (QWebPagePrivate::handleClipboard):
+ (QWebPagePrivate::mouseReleaseEvent):
+ (QWebPagePrivate::wheelEvent):
+ (QWebPagePrivate::dragEnterEvent):
+ (QWebPagePrivate::dragLeaveEvent):
+ (QWebPagePrivate::dragMoveEvent):
+ (QWebPagePrivate::dropEvent):
+ (QWebPage::event):
+ * Api/qwebpage_p.h:
+
+2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack.
+ https://bugs.webkit.org/show_bug.cgi?id=28865
+
+ Clean up the unserCursor hack to use the QCursor set
+ as a property of the QWidget by WebCore::WidgetQt.
+
+ Remove all code that are no longer necessary for getting
+ cursor change events.
+
+ Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> and
+ Antonio Gomes <antonio.gomes@openbossa.org> on 2009-09-07
+
+ * Api/qwebpage.cpp:
+ * Api/qwebpage_p.h:
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::QWebViewPrivate):
+ (QWebView::event):
+
+2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] QtWebKit single API to enable persistency
+ https://bugs.webkit.org/show_bug.cgi?id=28682
+
+ Disable LocalStorage, ApplicationCache, HTML5 offline storage by
+ default.
+
+ If persistency is enabled the default directory for LocalStorage and
+ ApplicationCache is now based on QDesktopServices::DataLocation and not
+ QDesktopServices::CacheLocation (as it is expected to keep this data
+ around after a reboot).
+
+ If persistency is enabled initialize HTML5 offline storage as well - this
+ fixed offline Storage for QtLauncher.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+ (QWebSettings::enablePersistentStorage):
+ * Api/qwebsettings.h: Add a new API called enablePersistentStorage
+ * QtLauncher/main.cpp: Use the new enablePersistentStorage API
+ (main):
+
+2009-09-07 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ Speed up the QWebPluginInfo::supportsMimeType() function.
+ https://bugs.webkit.org/show_bug.cgi?id=27651
+
+ Instead of going through the MIME types list constructed with
+ mimeTypes() function, look up the internal mimeToDescriptions map.
+
+ * Api/qwebplugindatabase.cpp:
+ (QWebPluginInfo::supportsMimeType):
+
+2009-09-07 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ Speed up the QWebPluginInfo::mimeTypes() function.
+ https://bugs.webkit.org/show_bug.cgi?id=27651
+
+ Instead of constructing a list of MIME types every time it is called,
+ do this only once.
+
+ * Api/qwebplugindatabase.cpp:
+ (QWebPluginInfo::mimeTypes):
+ (QWebPluginInfo::operator=):
+ * Api/qwebplugindatabase.h:
+ * tests/qwebplugindatabase/tst_qwebplugindatabase.cpp:
+ (tst_QWebPluginDatabase::operatorassign_data):
+ (tst_QWebPluginDatabase::operatorassign):
+
+2009-09-07 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Simon Hausmann.
+
+ Remove the private classes from QWebPluginDatabase.
+ https://bugs.webkit.org/show_bug.cgi?id=27651
+
+ Instead, hold the PluginDatabase and PluginPackage objects as class
+ members and take care of refcounting on our own instead of using RefPtr.
+
+ This way we not only made the code cleaner but also got rid of
+ redundant allocations when constructing null QWebPluginInfo objects.
+
+ The private classes have been forward-declared and the d-pointers left
+ to be on the safe side.
+
+ * Api/qwebplugindatabase.cpp:
+ (QWebPluginInfo::QWebPluginInfo):
+ (QWebPluginInfo::~QWebPluginInfo):
+ (QWebPluginInfo::name):
+ (QWebPluginInfo::description):
+ (QWebPluginInfo::mimeTypes):
+ (QWebPluginInfo::path):
+ (QWebPluginInfo::isNull):
+ (QWebPluginInfo::setEnabled):
+ (QWebPluginInfo::isEnabled):
+ (QWebPluginInfo::operator==):
+ (QWebPluginInfo::operator!=):
+ (QWebPluginInfo::operator=):
+ (QWebPluginDatabase::QWebPluginDatabase):
+ (QWebPluginDatabase::~QWebPluginDatabase):
+ (QWebPluginDatabase::plugins):
+ (QWebPluginDatabase::searchPaths):
+ (QWebPluginDatabase::setSearchPaths):
+ (QWebPluginDatabase::addSearchPath):
+ (QWebPluginDatabase::refresh):
+ (QWebPluginDatabase::pluginForMimeType):
+ (QWebPluginDatabase::setPreferredPluginForMimeType):
+ * Api/qwebplugindatabase.h:
+ * Api/qwebplugindatabase_p.h: Removed.
+
+2009-09-05 Jakub Wieczorek <faw217@gmail.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] r47424 broke binary compatibility
+ https://bugs.webkit.org/show_bug.cgi?id=28996
+
+ Append the new DnsPrefetchEnabled attribute at the end of the enum.
+
+ * Api/qwebsettings.h:
+
+2009-09-04 Mark Mentovai <mark@chromium.org>
+
+ Reviewed by Dave Hyatt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28614
+
+ Account for scrollbar state changes that occur during layout.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::setScrollBarPolicy):
+
+ Eliminate duplicated (and incorrect) scrollbar mode tracking between
+ FrameView and ScrollView.
+
+2009-09-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Fix tst_QWebPage::database autotest failure
+ https://bugs.webkit.org/show_bug.cgi?id=28961
+
+ Make sure that the test case enables the feature before
+ the feature gets tested
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::database):
+
+2009-09-04 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Eric Seidel.
+
+ Any QtWebKit application crashes on exit if the inspector is
+ used during the session rather then exiting.
+
+ If a QWebView has a QWebPage that is destroyed the QWebView
+ does not update its pointer and will crash the next time
+ it access the page pointers (such as in its destructor).
+
+ InspectorClientView should not call deleteLater when the page
+ is destroyed because it does not have a parent and is a top
+ level widget. close() needs to be called so that QApplication
+ can exit the application if quitOnLastWindowClosed is set
+ and a InspectorClientView is the last window, otherwise
+ the application will never exit.
+
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::_q_pageDestroyed):
+ (QWebView::setPage):
+ * Api/qwebview.h:
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientView::InspectorClientView):
+
+2009-09-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by eric@webkit.org.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24696
+
+ Stub implementations of mixed content methods of FrameLoaderClient.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::didDisplayInsecureContent):
+ (WebCore::FrameLoaderClientQt::didRunInsecureContent):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-09-03 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Eric Seidel.
+
+ [Qt] Add a setting to turn SessionStorage on/off
+ https://bugs.webkit.org/show_bug.cgi?id=28836
+
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+ (QWebSettings::QWebSettings):
+ * Api/qwebsettings.h:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (testFlag):
+ (tst_QWebPage::testOptionalJSObjects):
+
+2009-09-02 Richard Moore <rich@kde.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] Make sure we relayout the page after evaluating JS
+
+ https://bugs.webkit.org/show_bug.cgi?id=28235
+
+ QtWebKit does not always seem to reflow the page when evaluating
+ javascript. This patch changes the way evaluateJavaScript works to
+ use the frameloader which ensures that this is done properly.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::evaluateJavaScript):
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25889
+ [GTK] scrollbar policy for main frame is not implementable
+
+ Add empty implementation for new ChromeClient method.
+
+ * WebCoreSupport/ChromeClientQt.h:
+ (WebCore::ChromeClientQt::scrollbarsModeDidChange):
+
+2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ QWebHistory::clear() modifications.
+
+ Clear() method was changed. If QWebHistory is empty (there is no
+ elements even current) clear() do nothing. If there at least one
+ element clear() will delete everything apart of current.
+
+ New autotests in QWebHistory
+
+ New autotests were added to QWebHistory. They should check some crashes
+ in save and restore state process and clear() method and general
+ behavior on where QWebHistory::count() == 0 or QWebHistory::count() == 1
+
+ Bugzilla: https://bugs.webkit.org/show_bug.cgi?id=28711
+
+ * Api/qwebhistory.cpp:
+ (QWebHistory::clear):
+ * tests/qwebhistory/tst_qwebhistory.cpp:
+ (tst_QWebHistory::back):
+ (tst_QWebHistory::forward):
+ (tst_QWebHistory::saveAndRestore_crash_1):
+ (tst_QWebHistory::saveAndRestore_crash_2):
+ (tst_QWebHistory::saveAndRestore_crash_3):
+ (tst_QWebHistory::clear):
+
+2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Cleanup, old and commented part of source code was removed.
+ Fix some formatting problems.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28712
+
+ * Api/qwebhistory_p.h:
+ (QWebHistoryPrivate::QWebHistoryPrivate):
+
+2009-08-26 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Oliver Hunt.
+
+ Don't let local files access web URLs
+ https://bugs.webkit.org/show_bug.cgi?id=28480
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+
+2009-08-25 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Bug 28708 - Make possible to better use ResourceError in FrameLoaderClientQt class.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::requestedUrl):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::FrameLoaderClientQt):
+ (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
+ (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
+ (WebCore::FrameLoaderClientQt::dispatchDidFailProvisionalLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidFailLoad):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-08-22 Adam Barth <abarth@webkit.org>
+
+ Revert 47684. We're going to do this later once clients have had a
+ chance to opt into the setting they like.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+
+2009-08-22 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Don't let local files access web URLs
+ https://bugs.webkit.org/show_bug.cgi?id=28480
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+
+2009-08-19 Aaron Boodman <aa@chromium.org>
+
+ Speculative build break fix for qt.
+
+ * Api/qwebsecurityorigin.cpp:
+ (QWebSecurityOrigin::whiteListAccessFromOrigin):
+ * Api/qwebsecurityorigin.h:
+
+2009-08-19 Aaron Boodman <aa@chromium.org>
+
+ Reviewed by David Levin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to
+ specify a more granular policy for cross-origin XHR access.
+
+ * Api/qwebsecurityorigin.cpp: Add API to manipulate origin access whitelists.
+ (QWebSecurityOrigin::whiteListAccessFromOrigin): Ditto.
+ (QWebSecurityOrigin::resetOriginAccessWhiteLists): Ditto.
+ * Api/qwebsecurityorigin.h: Ditto.
+
+2009-08-18 Markus Goetz <Markus.Goetz@nokia.com>
+
+ Reviwed by Ariya Hidayat.
+
+ [Qt] For prefecthDNS, the pre-fetching has to be enabled in the
+ WebSettings.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+ * Api/qwebsettings.h:
+
+2009-08-17 Darin Adler <darin@apple.com>
+
+ Try to fix Qt build again.
+
+ * WebCoreSupport/EditorClientQt.cpp: Move "using namespace".
+
+2009-08-17 Darin Adler <darin@apple.com>
+
+ Try to fix Qt build.
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::shouldShowDeleteInterface):
+ Use getAttribute(classAttr) instead of className() function.
+
+2009-08-14 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ RVCT elftran fails to resolve QPainter::staticMetaObject coming with
+ QWebView::RenderHints property.
+
+ This is a temporary fix and will be revereted when the right symbols
+ exported from Qt lib in S60.
+
+ https://bugs.webkit.org/show_bug.cgi?id=28181
+
+ * Api/qwebview.h:
+
+2009-08-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Public API to configure the storage path for HTML5 localStorage
+ https://bugs.webkit.org/show_bug.cgi?id=28036
+
+ Disables LocalStorage for QtWebKit by default by setting
+ QWebSettings::LocalStorageEnabled to false.
+
+ Sets up a default for the LocalStorage path so that clients would only
+ need to enable the LocalStorageEnabled setting to turn on LocalStoragre
+ support.
+
+ Turn on LocalStorage support for QtLauncher and the relevant test
+ since LocalStorage is now disabled by default for QtWebkit.
+
+ * Api/qwebpage.cpp:
+ (defaultCachePath):
+ (initializeApplicationCachePathIfNecessary):
+ (QWebPagePrivate::QWebPagePrivate):
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+ (QWebSettings::QWebSettings):
+ (QWebSettings::setLocalStoragePath):
+ (QWebSettings::localStoragePath):
+ * Api/qwebsettings.h:
+ * QtLauncher/main.cpp:
+ (main):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::multiplePageGroupsAndLocalStorage):
+
+2009-08-14 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Allow applications to register their own local URL scheme.
+ https://bugs.webkit.org/show_bug.cgi?id=28240
+
+ * Api/qwebsecurityorigin.cpp:
+ (QWebSecurityOrigin::addLocalScheme):
+ (QWebSecurityOrigin::removeLocalScheme):
+ (QWebSecurityOrigin::localSchemes):
+ * Api/qwebsecurityorigin.h:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::localURLSchemes):
+
+2009-08-13 Mark Rowe <mrowe@apple.com>
+
+ Try and fix the Qt build.
+
+ * Api/qwebelement.cpp:
+
+2009-08-13 Kavindra Devi Palaraja <kavindra.palaraja@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Doc - Some cleanup on the documentation of QWebElement
+
+ * Api/qwebelement.cpp:
+
+2009-08-13 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Symbian target components (library and executable files)
+ require Unique Identifiers (i.e., UID3).
+ These identifiers are defined in the respective project
+ files, conditionally for "symbian" platform.
+
+ * QtLauncher/QtLauncher.pro:
+ * tests/qwebelement/qwebelement.pro:
+ * tests/qwebframe/qwebframe.pro:
+ * tests/qwebhistory/qwebhistory.pro:
+ * tests/qwebhistoryinterface/qwebhistoryinterface.pro:
+ * tests/qwebpage/qwebpage.pro:
+ * tests/qwebview/qwebview.pro:
+
+2009-08-12 George Wright <george.wright@torchmobile.com>
+
+ Reviewed by Adam Treat.
+
+ Initialise zoom levels independent of whether a URL is valid or not to
+ fix https://bugs.webkit.org/show_bug.cgi?id=28162
+
+ * QtLauncher/main.cpp:
+ (MainWindow::MainWindow):
+
+2009-08-12 Joerg Bornemann <joerg.bornemann@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ QtWebKit compile fix for Windows CE
+
+ There's no getenv on Windows CE, use qgetenv instead.
+
+ * Api/qwebpage.cpp:
+ (qt_drt_overwritePluginDirectories):
+
2009-08-10 Kavindra Palaraja <kavindra.palaraja@nokia.com>
Reviewed by Simon Hausmann.
@@ -2956,7 +4642,7 @@
Reviewed by Simon Hausmann.
- http://www.qtsoftware.com/developer/task-tracker/index_html?id=238391&method=entry
+ http://qt.nokia.com/developer/task-tracker/index_html?id=238391&method=entry
[Qt] If QPainter fails to start on a QPrinter instance, do not
continue printing.
@@ -3149,7 +4835,7 @@
Rubber-stamped by Simon Hausmann.
- http://www.qtsoftware.com/developer/task-tracker/index_html?id=219344&method=entry
+ http://qt.nokia.com/developer/task-tracker/index_html?id=219344&method=entry
[Qt] API documentation for QWebPage::WebAction enum.
@@ -3204,7 +4890,7 @@
Reviewed by Simon Hausmann.
- http://www.qtsoftware.com/developer/task-tracker/index_html?id=241144&method=entry
+ http://qt.nokia.com/developer/task-tracker/index_html?id=241144&method=entry
[Qt] Create actions for text selection and editing for QWebPage.
Also properly disable and enable them when contentEditable is toggled.
diff --git a/WebKit/qt/QGVLauncher/QGVLauncher.pro b/WebKit/qt/QGVLauncher/QGVLauncher.pro
new file mode 100644
index 0000000..dec1c9b
--- /dev/null
+++ b/WebKit/qt/QGVLauncher/QGVLauncher.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+SOURCES += main.cpp
+CONFIG -= app_bundle
+CONFIG += uitools
+DESTDIR = ../../../bin
+
+include(../../../WebKit.pri)
+
+QT += network
+macx:QT+=xml
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E544
diff --git a/WebKit/qt/QGVLauncher/main.cpp b/WebKit/qt/QGVLauncher/main.cpp
new file mode 100644
index 0000000..1d67c35
--- /dev/null
+++ b/WebKit/qt/QGVLauncher/main.cpp
@@ -0,0 +1,337 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
+ * Copyright (C) 2009 Kenneth Christiansen <kenneth@webkit.org>
+ * Copyright (C) 2009 Antonio Gomes <antonio.gomes@openbossa.org>
+ * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <QDebug>
+#include <QFile>
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+#include <QNetworkRequest>
+#include <QTextStream>
+#include <QVector>
+#include <QtGui>
+#include <QtNetwork/QNetworkProxy>
+#include <cstdio>
+#include <qwebelement.h>
+#include <qwebframe.h>
+#include <qgraphicswebview.h>
+#include <qwebpage.h>
+#include <qwebsettings.h>
+#include <qwebview.h>
+
+class WebPage : public QWebPage {
+ Q_OBJECT
+
+public:
+ WebPage(QWidget* parent = 0) : QWebPage(parent)
+ {
+ applyProxy();
+ }
+ virtual QWebPage* createWindow(QWebPage::WebWindowType);
+
+private:
+ void applyProxy();
+};
+
+class MainView : public QGraphicsView {
+ Q_OBJECT
+
+public:
+ MainView(QWidget* parent) : QGraphicsView(parent), m_mainWidget(0)
+ {
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ }
+
+ void setMainWidget(QGraphicsWidget* widget)
+ {
+ QRectF rect(QRect(QPoint(0, 0), size()));
+ widget->setGeometry(rect);
+ m_mainWidget = widget;
+ }
+
+ void resizeEvent(QResizeEvent* event)
+ {
+ QGraphicsView::resizeEvent(event);
+ if (!m_mainWidget)
+ return;
+ QRectF rect(QPoint(0, 0), event->size());
+ m_mainWidget->setGeometry(rect);
+ }
+
+public slots:
+ void flip()
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QSizeF center = m_mainWidget->boundingRect().size() / 2;
+ QPointF centerPoint = QPointF(center.width(), center.height());
+ m_mainWidget->setTransformOriginPoint(centerPoint);
+
+ m_mainWidget->setRotation(m_mainWidget->rotation() ? 0 : 180);
+#endif
+ }
+
+ void animatedFlip()
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QSizeF center = m_mainWidget->boundingRect().size() / 2;
+ QPointF centerPoint = QPointF(center.width(), center.height());
+ m_mainWidget->setTransformOriginPoint(centerPoint);
+
+ QPropertyAnimation* animation = new QPropertyAnimation(m_mainWidget, "rotation", this);
+ animation->setDuration(1000);
+ animation->setStartValue(m_mainWidget->rotation());
+ animation->setEndValue(m_mainWidget->rotation() + 180);
+ animation->start(QAbstractAnimation::DeleteWhenStopped);
+#endif
+ }
+private:
+ QGraphicsWidget* m_mainWidget;
+};
+
+class SharedScene : public QSharedData {
+public:
+ SharedScene()
+ {
+ m_scene = new QGraphicsScene;
+
+ m_item = new QGraphicsWebView;
+ m_item->setPage(new WebPage());
+
+ m_scene->addItem(m_item);
+ m_scene->setActiveWindow(m_item);
+ }
+
+ ~SharedScene()
+ {
+ delete m_item;
+ delete m_scene;
+ }
+
+ QGraphicsScene* scene() const { return m_scene; }
+ QGraphicsWebView* webView() const { return m_item; }
+
+private:
+ QGraphicsScene* m_scene;
+ QGraphicsWebView* m_item;
+};
+
+
+class MainWindow : public QMainWindow {
+ Q_OBJECT
+
+public:
+ MainWindow(QExplicitlySharedDataPointer<SharedScene> other)
+ : QMainWindow(), view(new MainView(this)), scene(other)
+ {
+ init();
+ }
+
+ MainWindow()
+ : QMainWindow(), view(new MainView(this)), scene(new SharedScene())
+ {
+ init();
+ }
+
+ void init()
+ {
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ view->setScene(scene->scene());
+ view->setFrameShape(QFrame::NoFrame);
+ view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ setCentralWidget(view);
+
+ view->setMainWidget(scene->webView());
+
+ connect(scene->webView(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
+ connect(scene->webView(), SIGNAL(titleChanged(const QString&)), this, SLOT(setWindowTitle(const QString&)));
+ connect(scene->webView()->page(), SIGNAL(windowCloseRequested()), this, SLOT(close()));
+
+ resize(640, 480);
+ buildUI();
+ }
+
+ void load(const QString& url)
+ {
+ QUrl deducedUrl = guessUrlFromString(url);
+ if (!deducedUrl.isValid())
+ deducedUrl = QUrl("http://" + url + "/");
+
+ urlEdit->setText(deducedUrl.toEncoded());
+ scene->webView()->load(deducedUrl);
+ scene->webView()->setFocus(Qt::OtherFocusReason);
+ }
+
+ QUrl guessUrlFromString(const QString& string)
+ {
+ QString input(string);
+ QFileInfo fi(input);
+ if (fi.exists() && fi.isRelative())
+ input = fi.absoluteFilePath();
+
+ return QWebView::guessUrlFromString(input);
+ }
+
+ QWebPage* page() const
+ {
+ return scene->webView()->page();
+ }
+
+protected slots:
+ void changeLocation()
+ {
+ load(urlEdit->text());
+ }
+
+ void loadFinished(bool)
+ {
+ QUrl url = scene->webView()->url();
+ urlEdit->setText(url.toString());
+
+ QUrl::FormattingOptions opts;
+ opts |= QUrl::RemoveScheme;
+ opts |= QUrl::RemoveUserInfo;
+ opts |= QUrl::StripTrailingSlash;
+ QString s = url.toString(opts);
+ s = s.mid(2);
+ if (s.isEmpty())
+ return;
+ //FIXME: something missing here
+ }
+
+public slots:
+ void newWindow(const QString &url = QString())
+ {
+ MainWindow* mw = new MainWindow();
+ mw->load(url);
+ mw->show();
+ }
+
+ void clone()
+ {
+ MainWindow* mw = new MainWindow(scene);
+ mw->show();
+ }
+
+ void flip()
+ {
+ view->flip();
+ }
+
+ void animatedFlip()
+ {
+ view->animatedFlip();
+ }
+private:
+ void buildUI()
+ {
+ QWebPage* page = scene->webView()->page();
+ urlEdit = new QLineEdit(this);
+ urlEdit->setSizePolicy(QSizePolicy::Expanding, urlEdit->sizePolicy().verticalPolicy());
+ connect(urlEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
+
+ QToolBar* bar = addToolBar("Navigation");
+ bar->addAction(page->action(QWebPage::Back));
+ bar->addAction(page->action(QWebPage::Forward));
+ bar->addAction(page->action(QWebPage::Reload));
+ bar->addAction(page->action(QWebPage::Stop));
+ bar->addWidget(urlEdit);
+
+ QMenu* fileMenu = menuBar()->addMenu("&File");
+ fileMenu->addAction("New Window", this, SLOT(newWindow()));
+ fileMenu->addAction("Clone view", this, SLOT(clone()));
+ fileMenu->addAction("Close", this, SLOT(close()));
+
+ QMenu* viewMenu = menuBar()->addMenu("&View");
+ viewMenu->addAction(page->action(QWebPage::Stop));
+ viewMenu->addAction(page->action(QWebPage::Reload));
+
+ QMenu* fxMenu = menuBar()->addMenu("&Effects");
+ fxMenu->addAction("Flip", this, SLOT(flip()));
+ fxMenu->addAction("Animated Flip", this, SLOT(animatedFlip()));
+ }
+
+private:
+ MainView* view;
+ QExplicitlySharedDataPointer<SharedScene> scene;
+
+ QLineEdit* urlEdit;
+};
+
+QWebPage* WebPage::createWindow(QWebPage::WebWindowType)
+{
+ MainWindow* mw = new MainWindow;
+ mw->show();
+ return mw->page();
+}
+
+void WebPage::applyProxy()
+{
+ QUrl proxyUrl = QWebView::guessUrlFromString(qgetenv("http_proxy"));
+
+ if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
+ int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
+ networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort));
+ }
+}
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+ QString url = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
+
+ app.setApplicationName("GQVLauncher");
+
+ QWebSettings::setObjectCacheCapacities((16 * 1024 * 1024) / 8, (16 * 1024 * 1024) / 8, 16 * 1024 * 1024);
+ QWebSettings::setMaximumPagesInCache(4);
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+
+ const QStringList args = app.arguments();
+ if (args.count() > 1)
+ url = args.at(1);
+
+ MainWindow* window = new MainWindow;
+ window->load(url);
+
+ for (int i = 2; i < args.count(); i++)
+ window->newWindow(args.at(i));
+
+ window->show();
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/WebKit/qt/QtLauncher/QtLauncher.pro b/WebKit/qt/QtLauncher/QtLauncher.pro
index 42138c8..5b10dea 100644
--- a/WebKit/qt/QtLauncher/QtLauncher.pro
+++ b/WebKit/qt/QtLauncher/QtLauncher.pro
@@ -9,3 +9,5 @@ include(../../../WebKit.pri)
QT += network
macx:QT+=xml
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E543
diff --git a/WebKit/qt/QtLauncher/main.cpp b/WebKit/qt/QtLauncher/main.cpp
index 9cbab53..8cc8a09 100644
--- a/WebKit/qt/QtLauncher/main.cpp
+++ b/WebKit/qt/QtLauncher/main.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2006 George Staikos <staikos@kde.org>
* Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
@@ -34,6 +35,7 @@
#include <qwebframe.h>
#include <qwebsettings.h>
#include <qwebelement.h>
+#include <qwebinspector.h>
#include <QtGui>
#include <QDebug>
@@ -62,6 +64,13 @@ public:
virtual QWebPage *createWindow(QWebPage::WebWindowType);
virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
+ virtual bool supportsExtension(QWebPage::Extension extension) const
+ {
+ if (extension == QWebPage::ErrorPageExtension)
+ return true;
+ return false;
+ }
+ virtual bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output);
};
class MainWindow : public QMainWindow
@@ -70,13 +79,15 @@ class MainWindow : public QMainWindow
public:
MainWindow(QString url = QString()): currentZoom(100) {
setAttribute(Qt::WA_DeleteOnClose);
+ if (qgetenv("QTLAUNCHER_USE_ARGB_VISUALS").toInt() == 1)
+ setAttribute(Qt::WA_TranslucentBackground);
- view = new QWebView(this);
- setCentralWidget(view);
+ QSplitter* splitter = new QSplitter(Qt::Vertical, this);
+ setCentralWidget(splitter);
+ view = new QWebView(splitter);
WebPage* page = new WebPage(view);
view->setPage(page);
-
connect(view, SIGNAL(loadFinished(bool)),
this, SLOT(loadFinished()));
connect(view, SIGNAL(titleChanged(const QString&)),
@@ -85,9 +96,15 @@ public:
this, SLOT(showLinkHover(const QString&, const QString&)));
connect(view->page(), SIGNAL(windowCloseRequested()), this, SLOT(close()));
+ inspector = new QWebInspector(splitter);
+ inspector->setPage(page);
+ inspector->hide();
+ connect(this, SIGNAL(destroyed()), inspector, SLOT(deleteLater()));
+ connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector, SLOT(show()));
+
setupUI();
- // set the proxy to the http_proxy env variable - if present
+ // set the proxy to the http_proxy env variable - if present
QUrl proxyUrl = view->guessUrlFromString(qgetenv("http_proxy"));
if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
@@ -103,11 +120,12 @@ public:
urlEdit->setText(qurl.toEncoded());
view->load(qurl);
- // the zoom values are chosen to be like in Mozilla Firefox 3
- zoomLevels << 30 << 50 << 67 << 80 << 90;
- zoomLevels << 100;
- zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
}
+
+ // the zoom values are chosen to be like in Mozilla Firefox 3
+ zoomLevels << 30 << 50 << 67 << 80 << 90;
+ zoomLevels << 100;
+ zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
}
QWebPage* webPage() const {
@@ -193,6 +211,22 @@ protected slots:
#endif
}
+ void screenshot()
+ {
+ QPixmap pixmap = QPixmap::grabWidget(view);
+ QLabel* label = new QLabel;
+ label->setAttribute(Qt::WA_DeleteOnClose);
+ label->setWindowTitle("Screenshot - Preview");
+ label->setPixmap(pixmap);
+ label->show();
+
+ QString fileName = QFileDialog::getSaveFileName(label, "Screenshot");
+ if (!fileName.isEmpty()) {
+ pixmap.save(fileName, "png");
+ label->setWindowTitle(QString("Screenshot - Saved at %1").arg(fileName));
+ }
+ }
+
void setEditable(bool on) {
view->page()->setContentEditable(on);
formatMenuAction->setVisible(on);
@@ -206,6 +240,7 @@ protected slots:
bool ok;
QString str = QInputDialog::getText(this, "Select elements", "Choose elements",
QLineEdit::Normal, "a", &ok);
+
if (ok && !str.isEmpty()) {
QList<QWebElement> result = view->page()->mainFrame()->findAllElements(str);
foreach (QWebElement e, result)
@@ -259,6 +294,7 @@ private:
#if QT_VERSION >= 0x040400
fileMenu->addAction(tr("Print"), this, SLOT(print()));
#endif
+ QAction* screenshot = fileMenu->addAction("Screenshot", this, SLOT(screenshot()));
fileMenu->addAction("Close", this, SLOT(close()));
QMenu *editMenu = menuBar()->addMenu("&Edit");
@@ -285,7 +321,7 @@ private:
viewMenu->addSeparator();
viewMenu->addAction("Dump HTML", this, SLOT(dumpHtml()));
- QMenu *formatMenu = new QMenu("F&ormat");
+ QMenu *formatMenu = new QMenu("F&ormat", this);
formatMenuAction = menuBar()->addMenu(formatMenu);
formatMenuAction->setVisible(false);
formatMenu->addAction(view->pageAction(QWebPage::ToggleBold));
@@ -297,6 +333,7 @@ private:
writingMenu->addAction(view->pageAction(QWebPage::SetTextDirectionRightToLeft));
newWindow->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
+ screenshot->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
view->pageAction(QWebPage::Back)->setShortcut(QKeySequence::Back);
view->pageAction(QWebPage::Stop)->setShortcut(Qt::Key_Escape);
view->pageAction(QWebPage::Forward)->setShortcut(QKeySequence::Forward);
@@ -321,6 +358,7 @@ private:
QWebView *view;
QLineEdit *urlEdit;
QProgressBar *progress;
+ QWebInspector* inspector;
QAction *formatMenuAction;
@@ -328,6 +366,17 @@ private:
QStringListModel urlModel;
};
+bool WebPage::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output)
+{
+ const QWebPage::ErrorPageExtensionOption* info = static_cast<const QWebPage::ErrorPageExtensionOption*>(option);
+ QWebPage::ErrorPageExtensionReturn* errorPage = static_cast<QWebPage::ErrorPageExtensionReturn*>(output);
+
+ errorPage->content = QString("<html><head><title>Failed loading page</title></head><body>%1</body></html>")
+ .arg(info->errorString).toUtf8();
+
+ return true;
+}
+
QWebPage *WebPage::createWindow(QWebPage::WebWindowType)
{
MainWindow *mw = new MainWindow;
@@ -356,6 +405,7 @@ public:
URLLoader(QWebView* view, const QString& inputFileName)
: m_view(view)
, m_stdOut(stdout)
+ , m_loaded(0)
{
init(inputFileName);
}
@@ -367,7 +417,7 @@ public slots:
if (getUrl(qstr)) {
QUrl url(qstr, QUrl::StrictMode);
if (url.isValid()) {
- m_stdOut << "Loading " << qstr << " ......" << endl;
+ m_stdOut << "Loading " << qstr << " ......" << ++m_loaded << endl;
m_view->load(url);
} else
loadNext();
@@ -410,6 +460,7 @@ private:
int m_index;
QWebView* m_view;
QTextStream m_stdOut;
+ int m_loaded;
};
#include "main.moc"
@@ -442,6 +493,11 @@ int main(int argc, char **argv)
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
+ QWebSettings::enablePersistentStorage();
+
+ // To allow QWebInspector's configuration persistence
+ QCoreApplication::setOrganizationName("Nokia");
+ QCoreApplication::setApplicationName("QtLauncher");
const QStringList args = app.arguments();
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index d659833..26cf6f6 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -39,12 +39,14 @@
#include "WindowFeatures.h"
#include "DatabaseTracker.h"
#include "SecurityOrigin.h"
+#include "QWebPageClient.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
#include "qwebframe_p.h"
#include "qwebsecurityorigin.h"
#include "qwebsecurityorigin_p.h"
+#include "qwebview.h"
#include <qtooltip.h>
#include <qtextdocument.h>
@@ -303,16 +305,15 @@ IntRect ChromeClientQt::windowResizerRect() const
return IntRect();
}
-void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
+void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, bool, bool)
{
// No double buffer, so only update the QWidget if content changed.
if (contentChanged) {
- QWidget* view = m_webPage->view();
- if (view) {
+ if (platformPageClient()) {
QRect rect(windowRect);
rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize()));
if (!rect.isEmpty())
- view->update(rect);
+ platformPageClient()->update(rect);
}
emit m_webPage->repaintRequested(windowRect);
}
@@ -323,9 +324,8 @@ void ChromeClientQt::repaint(const IntRect& windowRect, bool contentChanged, boo
void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect&)
{
- QWidget* view = m_webPage->view();
- if (view)
- view->scroll(delta.width(), delta.height(), scrollViewRect);
+ if (platformPageClient())
+ platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect);
emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect);
}
@@ -341,9 +341,9 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const
return point;
}
-PlatformWidget ChromeClientQt::platformWindow() const
+PlatformPageClient ChromeClientQt::platformPageClient() const
{
- return m_webPage->view();
+ return m_webPage->d->client;
}
void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
@@ -351,7 +351,7 @@ void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) cons
emit QWebFramePrivate::kit(frame)->contentsSizeChanged(size);
}
-void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
+void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
{
TextDirection dir;
if (result.absoluteLinkURL() != lastHoverURL
@@ -402,7 +402,7 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-void ChromeClientQt::reachedMaxAppCacheSize(int64_t spaceNeeded)
+void ChromeClientQt::reachedMaxAppCacheSize(int64_t)
{
// FIXME: Free some space.
notImplemented();
@@ -419,7 +419,7 @@ void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileC
option.parentFrame = QWebFramePrivate::kit(frame);
if (!fileChooser->filenames().isEmpty())
- for (int i = 0; i < fileChooser->filenames().size(); ++i)
+ for (unsigned i = 0; i < fileChooser->filenames().size(); ++i)
option.suggestedFileNames += fileChooser->filenames()[i];
QWebPage::ChooseMultipleFilesExtensionReturn output;
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 96c7fab..196c4fc 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -105,9 +105,10 @@ namespace WebCore {
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual IntPoint screenToWindow(const IntPoint&) const;
virtual IntRect windowToScreen(const IntRect&) const;
- virtual PlatformWidget platformWindow() const;
+ virtual PlatformPageClient platformPageClient() const;
virtual void contentsSizeChanged(Frame*, const IntSize&) const;
+ virtual void scrollbarsModeDidChange() const { }
virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
virtual void setToolTip(const String&, TextDirection);
diff --git a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
index ed79946..b4400ff 100644
--- a/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
@@ -52,7 +52,7 @@ void ContextMenuClientQt::contextMenuItemSelected(ContextMenuItem*, const Contex
notImplemented();
}
-void ContextMenuClientQt::downloadURL(const KURL& url)
+void ContextMenuClientQt::downloadURL(const KURL&)
{
notImplemented();
}
diff --git a/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index 0df0768..99e438d 100644
--- a/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/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/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index 995d61d..5d5df97 100644
--- a/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -41,6 +41,7 @@
#include "FocusController.h"
#include "Frame.h"
#include "HTMLElement.h"
+#include "HTMLNames.h"
#include "KeyboardCodes.h"
#include "KeyboardEvent.h"
#include "NotImplemented.h"
@@ -96,6 +97,7 @@ static QString dumpRange(WebCore::Range *range)
namespace WebCore {
+using namespace HTMLNames;
bool EditorClientQt::shouldDeleteRange(Range* range)
{
@@ -108,7 +110,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range)
bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element)
{
if (QWebPagePrivate::drtRun)
- return element->className() == "needsDeletionUI";
+ return element->getAttribute(classAttr) == "needsDeletionUI";
return false;
}
@@ -218,7 +220,9 @@ void EditorClientQt::respondToChangedSelection()
m_page->d->updateEditorActions();
emit m_page->selectionChanged();
- emit m_page->microFocusChanged();
+ Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+ if (!frame->editor()->ignoreCompositionSelectionChange())
+ emit m_page->microFocusChanged();
}
void EditorClientQt::didEndEditing()
@@ -593,10 +597,10 @@ bool EditorClientQt::isEditing() const
void EditorClientQt::setInputMethodState(bool active)
{
QWidget *view = m_page->view();
- if (view) {
+ if (view)
view->setAttribute(Qt::WA_InputMethodEnabled, active);
- emit m_page->microFocusChanged();
- }
+
+ emit m_page->microFocusChanged();
}
}
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 5cf86b1..665f16a 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/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
@@ -144,7 +148,7 @@ FrameLoaderClientQt::FrameLoaderClientQt()
, m_pluginView(0)
, m_hasSentResponseToPlugin(false)
, m_firstData(false)
- , m_loadSucceeded(false)
+ , m_loadError (ResourceError())
{
}
@@ -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
@@ -282,9 +286,7 @@ void FrameLoaderClientQt::dispatchDidCancelClientRedirect()
}
-void FrameLoaderClientQt::dispatchWillPerformClientRedirect(const KURL& url,
- double interval,
- double fireDate)
+void FrameLoaderClientQt::dispatchWillPerformClientRedirect(const KURL& url, double, double)
{
if (dumpFrameLoaderCallbacks)
printf("%s - willPerformClientRedirectToURL: %s \n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), qPrintable(drtDescriptionSuitableForTestResult(url)));
@@ -376,7 +378,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
if (dumpFrameLoaderCallbacks)
printf("%s - didFinishLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- m_loadSucceeded = true;
+ m_loadError = ResourceError(); // clears the previous error
if (!m_webFrame)
return;
@@ -461,10 +463,10 @@ void FrameLoaderClientQt::postProgressFinishedNotification()
}
if (m_webFrame && m_frame->page())
- emit loadFinished(m_loadSucceeded);
+ emit loadFinished(m_loadError.isNull());
}
-void FrameLoaderClientQt::setMainFrameDocumentReady(bool b)
+void FrameLoaderClientQt::setMainFrameDocumentReady(bool)
{
// this is only interesting once we provide an external API for the DOM
}
@@ -514,13 +516,13 @@ bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const
return false;
}
-bool FrameLoaderClientQt::representationExistsForURLScheme(const String& URLScheme) const
+bool FrameLoaderClientQt::representationExistsForURLScheme(const String&) const
{
return false;
}
-String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String& URLScheme) const
+String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String&) const
{
notImplemented();
return String();
@@ -632,11 +634,21 @@ void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks()
{
}
-bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *item) const
+bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *) const
{
return true;
}
+void FrameLoaderClientQt::didDisplayInsecureContent()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientQt::didRunInsecureContent(WebCore::SecurityOrigin*)
+{
+ notImplemented();
+}
+
void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item)
{
QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item));
@@ -692,8 +704,10 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c
WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request)
{
- return ResourceError("Error", -999, request.url().prettyURL(),
+ ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(),
QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8));
+ error.setIsCancellation(true);
+ return error;
}
// copied from WebKit/Misc/WebKitErrors[Private].h
@@ -709,36 +723,36 @@ enum {
WebCore::ResourceError FrameLoaderClientQt::blockedError(const WebCore::ResourceRequest& request)
{
- return ResourceError("Error", WebKitErrorCannotUseRestrictedPort, request.url().prettyURL(),
+ return ResourceError("WebKit", WebKitErrorCannotUseRestrictedPort, request.url().prettyURL(),
QCoreApplication::translate("QWebFrame", "Request blocked", 0, QCoreApplication::UnicodeUTF8));
}
WebCore::ResourceError FrameLoaderClientQt::cannotShowURLError(const WebCore::ResourceRequest& request)
{
- return ResourceError("Error", WebKitErrorCannotShowURL, request.url().string(),
+ return ResourceError("WebKit", WebKitErrorCannotShowURL, request.url().string(),
QCoreApplication::translate("QWebFrame", "Cannot show URL", 0, QCoreApplication::UnicodeUTF8));
}
WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
{
- return ResourceError("Error", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(),
- QCoreApplication::translate("QWebFrame", "Frame load interruped by policy change", 0, QCoreApplication::UnicodeUTF8));
+ return ResourceError("WebKit", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(),
+ QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0, QCoreApplication::UnicodeUTF8));
}
WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
{
- return ResourceError("Error", WebKitErrorCannotShowMIMEType, response.url().string(),
+ return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(),
QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8));
}
WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
- return ResourceError("Error", -998 /* ### */, response.url().string(),
+ return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(),
QCoreApplication::translate("QWebFrame", "File does not exist", 0, QCoreApplication::UnicodeUTF8));
}
-WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse& response)
+WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse&)
{
notImplemented();
return ResourceError();
@@ -776,7 +790,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor
#endif
}
-void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader* loader, const WebCore::ResourceRequest& request)
+void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest& request)
{
if (dumpResourceLoadCallbacks)
dumpAssignedUrls[identifier] = drtDescriptionSuitableForTestResult(request.url());
@@ -823,7 +837,7 @@ void FrameLoaderClientQt::dispatchDidReceiveContentLength(WebCore::DocumentLoade
{
}
-void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader* loader, unsigned long)
+void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long)
{
}
@@ -850,20 +864,58 @@ void FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest(unsigned long,
notImplemented();
}
-void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::ResourceError&)
+void FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error)
+{
+ QWebPage* page = m_webFrame->page();
+ if (page->supportsExtension(QWebPage::ErrorPageExtension)) {
+ QWebPage::ErrorPageExtensionOption option;
+
+ if (error.domain() == "QtNetwork")
+ option.domain = QWebPage::QtNetwork;
+ else if (error.domain() == "HTTP")
+ option.domain = QWebPage::Http;
+ else if (error.domain() == "WebKit")
+ option.domain = QWebPage::WebKit;
+ else
+ return;
+
+ option.url = QUrl(error.failingURL());
+ option.frame = m_webFrame;
+ option.error = error.errorCode();
+ option.errorString = error.localizedDescription();
+
+ QWebPage::ErrorPageExtensionReturn output;
+ if (!page->extension(QWebPage::ErrorPageExtension, &option, &output))
+ return;
+
+ KURL baseUrl(output.baseUrl);
+ KURL failingUrl(option.url);
+
+ WebCore::ResourceRequest request(baseUrl);
+ WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(output.content.constData(), output.content.length());
+ WebCore::SubstituteData substituteData(buffer, output.contentType, output.encoding, failingUrl);
+ m_frame->loader()->load(request, substituteData, false);
+ }
+}
+
+void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::ResourceError& error)
{
if (dumpFrameLoaderCallbacks)
printf("%s - didFailProvisionalLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- m_loadSucceeded = false;
+ m_loadError = error;
+ if (!error.isNull() && !error.isCancellation())
+ callErrorPageExtension(error);
}
-void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError&)
+void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& error)
{
if (dumpFrameLoaderCallbacks)
printf("%s - didFailLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- m_loadSucceeded = false;
+ m_loadError = error;
+ if (!error.isNull() && !error.isCancellation())
+ callErrorPageExtension(error);
}
WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage()
@@ -946,7 +998,6 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request)
if (!m_webFrame)
return;
- QWebPage *page = m_webFrame->page();
emit m_webFrame->page()->downloadRequested(request.toNetworkRequest());
#endif
}
@@ -976,9 +1027,6 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String
// ### set override encoding if we have one
- FrameLoadType loadType = m_frame->loader()->loadType();
- FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList;
-
frameData.frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get());
// The frame's onload handler may have removed it from the document.
@@ -1074,6 +1122,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)
{
@@ -1087,12 +1182,12 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
QStringList values;
QString classid(element->getAttribute("classid"));
- for (int i = 0; i < paramNames.size(); ++i) {
+ for (unsigned i = 0; i < paramNames.size(); ++i) {
params.append(paramNames[i]);
if (paramNames[i] == "classid")
classid = paramValues[i];
}
- for (int i = 0; i < paramValues.size(); ++i)
+ for (unsigned i = 0; i < paramValues.size(); ++i)
values.append(paramValues[i]);
QString urlStr(url.string());
@@ -1110,7 +1205,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
if (!styleSheet.isEmpty())
styleSheet += QLatin1Char(';');
- for (int i = 0; i < numqStyleSheetProperties; ++i) {
+ for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
CSSPropertyID property = qstyleSheetProperties[i];
styleSheet += QString::fromLatin1(::getPropertyName(property));
@@ -1135,15 +1230,26 @@ 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 = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent());
+ if (parentWidget)
+ 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) {
+ graphicsWidget->hide();
+ graphicsWidget->setParentItem(qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent()));
+ 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
@@ -1162,8 +1268,8 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
m_hasSentResponseToPlugin = false;
}
-PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
- const Vector<String>& paramNames, const Vector<String>& paramValues)
+PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&,
+ const Vector<String>&, const Vector<String>&)
{
notImplemented();
return 0;
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 754d8bc..66c4252 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -59,6 +59,7 @@ namespace WebCore {
friend class ::QWebFrame;
void callPolicyFunction(FramePolicyFunction function, PolicyAction action);
+ void callErrorPageExtension(const ResourceError&);
signals:
void loadStarted();
void loadProgress(int d);
@@ -148,6 +149,9 @@ namespace WebCore {
virtual void updateGlobalHistoryRedirectLinks();
virtual bool shouldGoToHistoryItem(HistoryItem*) const;
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(SecurityOrigin*);
+
virtual ResourceError cancelledError(const ResourceRequest&);
virtual ResourceError blockedError(const ResourceRequest&);
virtual ResourceError cannotShowURLError(const ResourceRequest&);
@@ -211,7 +215,7 @@ namespace WebCore {
WebCore::PluginView* m_pluginView;
bool m_hasSentResponseToPlugin;
- bool m_loadSucceeded;
+ ResourceError m_loadError;
};
}
diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index d7f03d1..12f405c 100644
--- a/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -31,10 +31,13 @@
#include "config.h"
#include "InspectorClientQt.h"
+#include "qwebinspector.h"
+#include "qwebinspector_p.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
#include "qwebview.h"
+#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
#include "InspectorController.h"
@@ -44,49 +47,32 @@
namespace WebCore {
-class InspectorClientWebPage : public QWebPage
-{
- Q_OBJECT
- friend class InspectorClientQt;
-public:
- QWebPage* createWindow(QWebPage::WebWindowType)
- {
- QWidget *w = new QWebView(0);
- QWebPage *page = new QWebPage(w);
- page->setView(w);
- connect(page, SIGNAL(destroyed()), w, SLOT(deleteLater()));
- return page;
- }
-
-Q_SIGNALS:
- void attachRequested();
- void detachRequested();
-};
+static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/");
+static const QLatin1String settingStorageTypeSuffix(".type");
+static InspectorController::Setting variantToSetting(const QVariant& qvariant);
+static QVariant settingToVariant(const InspectorController::Setting& icSetting);
-class InspectorClientView : public QWebView {
+class InspectorClientWebPage : public QWebPage {
+ Q_OBJECT
+ friend class InspectorClientQt;
public:
- InspectorClientView(InspectorController* controller)
- : QWebView(0)
- , m_controller(controller)
+ InspectorClientWebPage(QObject* parent = 0)
+ : QWebPage(parent)
{
- setPage(new InspectorClientWebPage);
- connect(page(), SIGNAL(destroyed()), SLOT(deleteLater()));
+ settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
}
-protected:
-
- void closeEvent(QCloseEvent* ev)
+ QWebPage* createWindow(QWebPage::WebWindowType)
{
- QWidget::closeEvent(ev);
- m_controller->setWindowVisible(false);
+ QWebView* view = new QWebView;
+ QWebPage* page = new QWebPage;
+ view->setPage(page);
+ view->setAttribute(Qt::WA_DeleteOnClose);
+ return page;
}
-
-private:
- InspectorController* m_controller;
};
-
InspectorClientQt::InspectorClientQt(QWebPage* page)
: m_inspectedWebPage(page)
{}
@@ -98,14 +84,16 @@ void InspectorClientQt::inspectorDestroyed()
Page* InspectorClientQt::createPage()
{
- if (m_webPage)
- return m_webPage->d->page;
+ QWebView* inspectorView = new QWebView;
+ InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView);
+ inspectorView->setPage(inspectorPage);
+ m_inspectorView.set(inspectorView);
+
+ inspectorPage->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html"));
+ m_inspectedWebPage->d->inspectorFrontend = inspectorView;
+ m_inspectedWebPage->d->getOrCreateInspector()->d->setFrontend(inspectorView);
- InspectorClientView* view = new InspectorClientView(m_inspectedWebPage->d->page->inspectorController());
- m_webPage.set(qobject_cast<InspectorClientWebPage*>(view->page()));
- m_webPage->mainFrame()->load(QString::fromLatin1("qrc:/webkit/inspector/inspector.html"));
- m_webPage->view()->setMinimumSize(400,300);
- return m_webPage->d->page;
+ return m_inspectorView->page()->d->page;
}
String InspectorClientQt::localizedStringsURL()
@@ -122,52 +110,37 @@ String InspectorClientQt::hiddenPanels()
void InspectorClientQt::showWindow()
{
- if (!m_webPage)
- return;
-
updateWindowTitle();
- m_webPage->view()->show();
- m_inspectedWebPage->d->page->inspectorController()->setWindowVisible(true);
-}
-void InspectorClientQt::closeWindow()
-{
- if (!m_webPage)
- return;
-
- m_webPage->view()->hide();
- m_inspectedWebPage->d->page->inspectorController()->setWindowVisible(false);
+ m_inspectedWebPage->d->inspectorController()->setWindowVisible(true, true);
+ // We don't allow the inspector to ask for widget visibility itself because showWindow is
+ // not always called when we want.
+ // Inspecting an element or calling QWebInspector::show() should already have made the
+ // widget visible.
}
-bool InspectorClientQt::windowVisible()
+void InspectorClientQt::closeWindow()
{
- if (!m_webPage)
- return false;
- return m_webPage->view()->isVisible();
+ if (m_inspectedWebPage->d->inspector)
+ m_inspectedWebPage->d->inspector->close();
}
void InspectorClientQt::attachWindow()
{
- if (!m_webPage)
- return;
-
- emit m_webPage->attachRequested();
+ notImplemented();
}
void InspectorClientQt::detachWindow()
{
- if (!m_webPage)
- return;
-
- emit m_webPage->detachRequested();
+ notImplemented();
}
-void InspectorClientQt::setAttachedWindowHeight(unsigned height)
+void InspectorClientQt::setAttachedWindowHeight(unsigned)
{
notImplemented();
}
-void InspectorClientQt::highlight(Node* node)
+void InspectorClientQt::highlight(Node*)
{
notImplemented();
}
@@ -190,28 +163,112 @@ void InspectorClientQt::inspectorWindowObjectCleared()
void InspectorClientQt::updateWindowTitle()
{
- if (!m_webPage)
- return;
-
- QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2");
- m_webPage->view()->setWindowTitle(caption.arg(m_inspectedURL));
+ if (m_inspectedWebPage->d->inspector) {
+ QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL);
+ m_inspectedWebPage->d->inspector->setWindowTitle(caption);
+ emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption);
+ }
}
void InspectorClientQt::populateSetting(const String& key, InspectorController::Setting& setting)
{
- notImplemented();
+ QSettings qsettings;
+ if (qsettings.status() == QSettings::AccessError) {
+ // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called
+ qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].",
+ qPrintable(static_cast<QString>(key)));
+ return;
+ }
+
+ QString settingKey(settingStoragePrefix + key);
+ QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString();
+ QVariant storedValue = qsettings.value(settingKey);
+ storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data()));
+ setting = variantToSetting(storedValue);
}
void InspectorClientQt::storeSetting(const String& key, const InspectorController::Setting& setting)
{
- notImplemented();
+ QSettings qsettings;
+ if (qsettings.status() == QSettings::AccessError) {
+ qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].",
+ qPrintable(static_cast<QString>(key)));
+ return;
+ }
+
+ QVariant valueToStore = settingToVariant(setting);
+ QString settingKey(settingStoragePrefix + key);
+ qsettings.setValue(settingKey, valueToStore);
+ qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
}
-void InspectorClientQt::removeSetting(const String& key)
+void InspectorClientQt::removeSetting(const String&)
{
notImplemented();
}
+static InspectorController::Setting variantToSetting(const QVariant& qvariant)
+{
+ InspectorController::Setting retVal;
+
+ switch (qvariant.type()) {
+ case QVariant::Bool:
+ retVal.set(qvariant.toBool());
+ break;
+ case QVariant::Double:
+ retVal.set(qvariant.toDouble());
+ break;
+ case QVariant::Int:
+ retVal.set((long)qvariant.toInt());
+ break;
+ case QVariant::String:
+ retVal.set(qvariant.toString());
+ break;
+ case QVariant::StringList: {
+ QStringList qsList = qvariant.toStringList();
+ int listCount = qsList.count();
+ Vector<String> vector(listCount);
+ for (int i = 0; i < listCount; ++i)
+ vector[i] = qsList[i];
+ retVal.set(vector);
+ break;
+ }
+ }
+
+ return retVal;
+}
+
+static QVariant settingToVariant(const InspectorController::Setting& icSetting)
+{
+ QVariant retVal;
+
+ switch (icSetting.type()) {
+ case InspectorController::Setting::StringType:
+ retVal.setValue(static_cast<QString>(icSetting.string()));
+ break;
+ case InspectorController::Setting::StringVectorType: {
+ const Vector<String>& vector = icSetting.stringVector();
+ Vector<String>::const_iterator iter;
+ QStringList qsList;
+ for (iter = vector.begin(); iter != vector.end(); ++iter)
+ qsList << *iter;
+ retVal.setValue(qsList);
+ break;
+ }
+ case InspectorController::Setting::DoubleType:
+ retVal.setValue(icSetting.doubleValue());
+ break;
+ case InspectorController::Setting::IntegerType:
+ retVal.setValue((int)icSetting.integerValue());
+ break;
+ case InspectorController::Setting::BooleanType:
+ retVal.setValue(icSetting.booleanValue());
+ break;
+ }
+
+ return retVal;
+}
+
}
#include "InspectorClientQt.moc"
diff --git a/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/WebKit/qt/WebCoreSupport/InspectorClientQt.h
index 03c684a..ccf8b69 100644
--- a/WebKit/qt/WebCoreSupport/InspectorClientQt.h
+++ b/WebKit/qt/WebCoreSupport/InspectorClientQt.h
@@ -35,12 +35,12 @@
#include <QtCore/QString>
class QWebPage;
+class QWebView;
namespace WebCore {
class Node;
class Page;
class String;
- class InspectorClientWebPage;
class InspectorClientQt : public InspectorClient {
public:
@@ -56,7 +56,6 @@ namespace WebCore {
virtual void showWindow();
virtual void closeWindow();
- virtual bool windowVisible();
virtual void attachWindow();
virtual void detachWindow();
@@ -76,7 +75,7 @@ namespace WebCore {
private:
void updateWindowTitle();
QWebPage* m_inspectedWebPage;
- OwnPtr<InspectorClientWebPage> m_webPage;
+ OwnPtr<QWebView> m_inspectorView;
QString m_inspectedURL;
};
}
diff --git a/WebKit/qt/docs/qtwebkit.qdoc b/WebKit/qt/docs/qtwebkit.qdoc
index f3681ee..09dfae5 100644
--- a/WebKit/qt/docs/qtwebkit.qdoc
+++ b/WebKit/qt/docs/qtwebkit.qdoc
@@ -1,18 +1,70 @@
/*!
\module QtWebKit
\title QtWebKit Module
- \contentspage Qt's Modules
+ \contentspage All Qt Modules
\previouspage QtSvg
\nextpage QtXml
- \ingroup architecture
\ingroup modules
- \brief An introduction to the QtWebKit module.
+ \brief The QtWebKit module provides a web browser engine as well as
+ classes to render and interact with web content.
- \keyword Browser
- \keyword Web Browser
+ To include the definitions of the module's classes, use the
+ following directive:
+
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
+
+ \section1 License Information
+
+ This is a snapshot of the Qt port of WebKit. The exact version information
+ can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt.
+ Qt Commercial Edition licensees that wish to distribute applications that
+ use the QtWebKit module need to be aware of their obligations under the
+ GNU Lesser General Public License (LGPL).
+
+ Developers using the Open Source Edition can choose to redistribute
+ the module under the appropriate version of the GNU LGPL; version 2.1
+ for applications and libraries licensed under the GNU GPL version 2,
+ or version 3 for applications and libraries licensed under the GNU
+ GPL version 2.
+
+ \legalese
+ WebKit is licensed under the GNU Library General Public License.
+ Individual contributor names and copyright dates can be found
+ inline in the code.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ \endlegalese
+*/
+
+/*!
+ \page webintegration.html
+ \title Integrating Web Content with QtWebKit
\since 4.4
+ \ingroup frameworks-technologies
+
+ \keyword Browser
+ \keyword Web Browser
+
QtWebKit provides a Web browser engine that makes it easy to embed content
from the World Wide Web into your Qt application. At the same time Web
content can be enhanced with native controls.
@@ -55,20 +107,6 @@
\tableofcontents
- \section1 Configuring the Build Process
-
- Applications using QtWebKit's classes need to be configured to be built
- against the QtWebKit module. The following declaration in a \c qmake
- project file ensures that an application is compiled and linked
- appropriately:
-
- \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
-
- To include the definitions of the module's classes, use the following
- directive:
-
- \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
-
\section1 Architecture
The easiest way to render content is through the QWebView class. As a
@@ -101,15 +139,18 @@
\section1 Netscape Plugin Support
+ \note Netscape plugin support is only available on desktop platforms.
+
Since WebKit supports the Netscape Plugin API, Qt applications can display
- Web pages that embed common plugins, as long as the user has the appropriate
+ Web pages that embed common plugins on platforms for which those plugins
+ are available. To enable plugin support, the user must have the appropriate
binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled}
- attribute is enabled for the application.
+ attribute must be enabled for the application.
The following locations are searched for plugins:
\table
- \header \o Linux/Unix \o Windows
+ \header \o Linux/Unix (X11) \o Windows
\row \o{1,3}
\list
\o \c{.mozilla/plugins} in the user's home directory
@@ -158,40 +199,4 @@
\o The system \c{/Library/Internet Plug-Ins} directory
\endlist
\endtable
-
- \section1 License Information
-
- This is a snapshot of the Qt port of WebKit. The exact version information
- can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt.
-
- Qt Commercial Edition licensees that wish to distribute applications that
- use the QtWebKit module need to be aware of their obligations under the
- GNU Lesser General Public License (LGPL).
-
- Developers using the Open Source Edition can choose to redistribute
- the module under the appropriate version of the GNU LGPL; version 2.1
- for applications and libraries licensed under the GNU GPL version 2,
- or version 3 for applications and libraries licensed under the GNU
- GPL version 2.
-
- \legalese
- WebKit is licensed under the GNU Library General Public License.
- Individual contributor names and copyright dates can be found
- inline in the code.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- \endlegalese
*/
diff --git a/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
new file mode 100644
index 0000000..0ba1cad
--- /dev/null
+++ b/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
@@ -0,0 +1,17 @@
+
+void wrapInFunction()
+{
+
+//! [0]
+ // ...
+ QWebPage *page = new QWebPage;
+ // ...
+
+ QWebInspector *inspector = new QWebInspector;
+ inspector->setPage(page);
+
+ connect(page, SIGNAL(webInspectorTriggered(const QWebElement&)), inspector, SLOT(show()));
+//! [0]
+
+}
+
diff --git a/WebKit/qt/docs/webkitsnippets/simple/main.cpp b/WebKit/qt/docs/webkitsnippets/simple/main.cpp
index 82f5b6c..408630e 100644
--- a/WebKit/qt/docs/webkitsnippets/simple/main.cpp
+++ b/WebKit/qt/docs/webkitsnippets/simple/main.cpp
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
QWidget *parent = 0;
//! [Using QWebView]
QWebView *view = new QWebView(parent);
- view->load(QUrl("http://qtsoftware.com/"));
+ view->load(QUrl("http://qt.nokia.com/"));
view->show();
//! [Using QWebView]
return app.exec();
diff --git a/WebKit/qt/docs/webkitsnippets/webpage/main.cpp b/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
index b91bc30..393b16a 100644
--- a/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
+++ b/WebKit/qt/docs/webkitsnippets/webpage/main.cpp
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- Thumbnailer thumbnail(QUrl("http://qtsoftware.com"));
+ Thumbnailer thumbnail(QUrl("http://qt.nokia.com"));
QObject::connect(&thumbnail, SIGNAL(finished()),
&app, SLOT(quit()));
diff --git a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro b/WebKit/qt/tests/benchmarks/loading/tst_loading.pro
index af0387e..80717c2 100644
--- a/WebKit/qt/tests/benchmarks/loading/tst_loading.pro
+++ b/WebKit/qt/tests/benchmarks/loading/tst_loading.pro
@@ -4,3 +4,5 @@ include(../../../../../WebKit.pri)
SOURCES += tst_loading.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E541
diff --git a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro b/WebKit/qt/tests/benchmarks/painting/tst_painting.pro
index 496210e..f45d804 100644
--- a/WebKit/qt/tests/benchmarks/painting/tst_painting.pro
+++ b/WebKit/qt/tests/benchmarks/painting/tst_painting.pro
@@ -4,3 +4,5 @@ include(../../../../../WebKit.pri)
SOURCES += tst_painting.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E542
diff --git a/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
new file mode 100644
index 0000000..cba6f11
--- /dev/null
+++ b/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = tst_qgraphicswebview
+include(../../../../WebKit.pri)
+SOURCES += tst_qgraphicswebview.cpp
+QT += testlib network
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
new file mode 100644
index 0000000..1a57286
--- /dev/null
+++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2009 Jakub Wieczorek <faw217@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QtTest/QtTest>
+
+#include <qgraphicswebview.h>
+
+class tst_QGraphicsWebView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void qgraphicswebview();
+};
+
+void tst_QGraphicsWebView::qgraphicswebview()
+{
+ QGraphicsWebView item;
+ item.url();
+ item.title();
+ item.icon();
+ item.zoomFactor();
+ item.isInteractive();
+ item.progress();
+ item.toHtml();
+ item.history();
+ item.settings();
+ item.status();
+ item.page();
+ item.setPage(0);
+ item.page();
+ item.setUrl(QUrl());
+ item.setZoomFactor(0);
+ item.setInteractive(true);
+ item.load(QUrl());
+ item.setHtml(QString());
+ item.setContent(QByteArray());
+}
+
+QTEST_MAIN(tst_QGraphicsWebView)
+
+#include "tst_qgraphicswebview.moc"
diff --git a/WebKit/qt/tests/qwebelement/qwebelement.pro b/WebKit/qt/tests/qwebelement/qwebelement.pro
index dd0b88a..0a140ad 100644
--- a/WebKit/qt/tests/qwebelement/qwebelement.pro
+++ b/WebKit/qt/tests/qwebelement/qwebelement.pro
@@ -5,3 +5,5 @@ SOURCES += tst_qwebelement.cpp
RESOURCES += qwebelement.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E53A
diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
index 0819a3a..00783d1 100644
--- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
+++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -71,15 +71,11 @@ private slots:
void classes();
void namespaceURI();
void foreachManipulation();
- void evaluateScript();
- void callFunction();
- void callFunctionSubmitForm();
- void functionNames();
+ void evaluateJavaScript();
void documentElement();
void frame();
void style();
void computedStyle();
- void properties();
void appendAndPrepend();
void insertBeforeAndAfter();
void remove();
@@ -90,6 +86,7 @@ private slots:
void nullSelect();
void firstChildNextSibling();
void lastChildPreviousSibling();
+ void hasSetFocus();
private:
QWebView* m_view;
@@ -282,69 +279,31 @@ void tst_QWebElement::foreachManipulation()
QCOMPARE(body.findAll("div").count(), 4);
}
-void tst_QWebElement::evaluateScript()
+void tst_QWebElement::evaluateJavaScript()
{
QVariant result;
m_mainFrame->setHtml("<body><p>test");
QWebElement para = m_mainFrame->findFirstElement("p");
- result = para.evaluateScript("this.tagName");
+ result = para.evaluateJavaScript("this.tagName");
QVERIFY(result.isValid());
QVERIFY(result.type() == QVariant::String);
QCOMPARE(result.toString(), QLatin1String("P"));
- QVERIFY(para.functions().contains("hasAttributes"));
- result = para.evaluateScript("this.hasAttributes()");
+ result = para.evaluateJavaScript("this.hasAttributes()");
QVERIFY(result.isValid());
QVERIFY(result.type() == QVariant::Bool);
QVERIFY(!result.toBool());
- para.evaluateScript("this.setAttribute('align', 'left');");
+ para.evaluateJavaScript("this.setAttribute('align', 'left');");
QCOMPARE(para.attribute("align"), QLatin1String("left"));
- result = para.evaluateScript("this.hasAttributes()");
+ result = para.evaluateJavaScript("this.hasAttributes()");
QVERIFY(result.isValid());
QVERIFY(result.type() == QVariant::Bool);
QVERIFY(result.toBool());
}
-void tst_QWebElement::callFunction()
-{
- m_mainFrame->setHtml("<body><p>test");
- QWebElement body = m_mainFrame->documentElement();
- QVERIFY(body.functions().contains("hasChildNodes"));
- QVariant result = body.callFunction("hasChildNodes");
- QVERIFY(result.isValid());
- QVERIFY(result.type() == QVariant::Bool);
- QVERIFY(result.toBool());
-
- body.callFunction("setAttribute", QVariantList() << "foo" << "bar");
- QCOMPARE(body.attribute("foo"), QString("bar"));
-}
-
-void tst_QWebElement::callFunctionSubmitForm()
-{
- m_mainFrame->setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
- "<input type='text'><input type='submit'></form></body></html>"), QUrl());
-
- QWebElement form = m_mainFrame->documentElement().findAll("form").at(0);
- QVERIFY(form.functions().contains("submit"));
- QVERIFY(!form.isNull());
- form.callFunction("submit");
-
- waitForSignal(m_page, SIGNAL(loadFinished(bool)));
- QCOMPARE(m_mainFrame->url().toString(), QString("data:text/html,foo?"));
-}
-
-void tst_QWebElement::functionNames()
-{
- m_mainFrame->setHtml("<body><p>Test");
-
- QWebElement body = m_mainFrame->documentElement();
-
- QVERIFY(body.functions().contains("setAttribute"));
-}
-
void tst_QWebElement::documentElement()
{
m_mainFrame->setHtml("<body><p>Test");
@@ -398,27 +357,27 @@ void tst_QWebElement::style()
m_mainFrame->setHtml(html);
QWebElement p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
- QVERIFY(p.styleProperty("cursor").isEmpty());
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
+ QVERIFY(p.styleProperty("cursor", QWebElement::InlineStyle).isEmpty());
p.setStyleProperty("color", "red");
p.setStyleProperty("cursor", "auto");
- QCOMPARE(p.styleProperty("color"), QLatin1String("red"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("yellow"));
- QCOMPARE(p.styleProperty("cursor"), QLatin1String("auto"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("red"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("yellow"));
+ QCOMPARE(p.styleProperty("cursor", QWebElement::InlineStyle), QLatin1String("auto"));
p.setStyleProperty("color", "green !important");
- QCOMPARE(p.styleProperty("color"), QLatin1String("green"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("green"));
p.setStyleProperty("color", "blue");
- QCOMPARE(p.styleProperty("color"), QLatin1String("green"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("green"));
- p.setStyleProperty("color", "blue", QWebElement::ImportantStylePriority);
- QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+ p.setStyleProperty("color", "blue !important");
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue"));
QString html2 = "<head>"
"<style type='text/css'>"
@@ -434,8 +393,8 @@ void tst_QWebElement::style()
m_mainFrame->setHtml(html2);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue"));
QString html3 = "<head>"
"<style type='text/css'>"
@@ -451,8 +410,8 @@ void tst_QWebElement::style()
m_mainFrame->setHtml(html3);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("blue"));
QString html5 = "<head>"
"<style type='text/css'>"
@@ -468,8 +427,8 @@ void tst_QWebElement::style()
m_mainFrame->setHtml(html5);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String(""));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String(""));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red"));
QString html6 = "<head>"
"<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
@@ -489,8 +448,8 @@ void tst_QWebElement::style()
QTest::qWait(200);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("black"));
QString html7 = "<head>"
"<style type='text/css'>"
@@ -507,15 +466,15 @@ void tst_QWebElement::style()
QTest::qWait(200);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black"));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("black"));
QString html8 = "<body><p>some text</p></body>";
m_mainFrame->setHtml(html8);
p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color"), QLatin1String(""));
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String(""));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String(""));
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String(""));
}
void tst_QWebElement::computedStyle()
@@ -524,47 +483,16 @@ void tst_QWebElement::computedStyle()
m_mainFrame->setHtml(html);
QWebElement p = m_mainFrame->documentElement().findAll("p").at(0);
- QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("auto"));
- QVERIFY(!p.computedStyleProperty("cursor").isEmpty());
- QVERIFY(p.styleProperty("cursor").isEmpty());
+ QCOMPARE(p.styleProperty("cursor", QWebElement::ComputedStyle), QLatin1String("auto"));
+ QVERIFY(!p.styleProperty("cursor", QWebElement::ComputedStyle).isEmpty());
+ QVERIFY(p.styleProperty("cursor", QWebElement::InlineStyle).isEmpty());
p.setStyleProperty("cursor", "text");
p.setStyleProperty("color", "red");
- QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("text"));
- QCOMPARE(p.computedStyleProperty("color"), QLatin1String("rgb(255, 0, 0)"));
- QCOMPARE(p.styleProperty("color"), QLatin1String("red"));
-}
-
-void tst_QWebElement::properties()
-{
- m_mainFrame->setHtml("<body><form><input type=checkbox id=ourcheckbox checked=true>");
-
- QWebElement checkBox = m_mainFrame->findFirstElement("#ourcheckbox");
- QVERIFY(!checkBox.isNull());
-
- QVERIFY(checkBox.scriptableProperties().contains("checked"));
-
- QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(true));
- checkBox.setScriptableProperty("checked", false);
- QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(false));
-
- QVERIFY(!checkBox.scriptableProperties().contains("non_existant"));
- QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant());
-
- checkBox.setScriptableProperty("non_existant", "test");
-
- QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant("test"));
- QVERIFY(checkBox.scriptableProperties().contains("non_existant"));
-
- // removing scriptableProperties is currently not supported. We should look into this
- // and consider the option of just allowing through the QtScript API only.
-#if 0
- checkBox.setScriptableProperty("non_existant", QVariant());
-
- QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant());
- QVERIFY(!checkBox.scriptableProperties().contains("non_existant"));
-#endif
+ QCOMPARE(p.styleProperty("cursor", QWebElement::ComputedStyle), QLatin1String("text"));
+ QCOMPARE(p.styleProperty("color", QWebElement::ComputedStyle), QLatin1String("rgb(255, 0, 0)"));
+ QCOMPARE(p.styleProperty("color", QWebElement::InlineStyle), QLatin1String("red"));
}
void tst_QWebElement::appendAndPrepend()
@@ -878,5 +806,24 @@ void tst_QWebElement::lastChildPreviousSibling()
QVERIFY(p.previousSibling().isNull());
}
+void tst_QWebElement::hasSetFocus()
+{
+ m_mainFrame->setHtml("<html><body>" \
+ "<input type='text' id='input1'/>" \
+ "<br>"\
+ "<input type='text' id='input2'/>" \
+ "</body></html>");
+
+ QList<QWebElement> inputs = m_mainFrame->documentElement().findAll("input");
+ QWebElement input1 = inputs.at(0);
+ input1.setFocus();
+ QVERIFY(input1.hasFocus());
+
+ QWebElement input2 = inputs.at(1);
+ input2.setFocus();
+ QVERIFY(!input1.hasFocus());
+ QVERIFY(input2.hasFocus());
+}
+
QTEST_MAIN(tst_QWebElement)
#include "tst_qwebelement.moc"
diff --git a/WebKit/qt/tests/qwebframe/qwebframe.pro b/WebKit/qt/tests/qwebframe/qwebframe.pro
index e45e6dc..4c92e91 100644
--- a/WebKit/qt/tests/qwebframe/qwebframe.pro
+++ b/WebKit/qt/tests/qwebframe/qwebframe.pro
@@ -5,3 +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/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 17dea99..80c9d72 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -33,7 +33,10 @@
#include <QRegExp>
#include <QNetworkRequest>
#include <QNetworkReply>
+#ifndef QT_NO_OPENSSL
#include <qsslerror.h>
+#endif
+#include "../util.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -578,8 +581,12 @@ private slots:
void urlChange();
void domCycles();
void requestedUrl();
+ void javaScriptWindowObjectCleared_data();
+ void javaScriptWindowObjectCleared();
+ void javaScriptWindowObjectClearedOnEvaluate();
void setHtml();
void setHtmlWithResource();
+ void setHtmlWithBaseURL();
void ipv6HostEncoding();
void metaData();
void popupFocus();
@@ -592,6 +599,7 @@ private slots:
void hasSetFocus();
void render();
void scrollPosition();
+ void evaluateWillCauseRepaint();
private:
QString evalJS(const QString&s) {
@@ -692,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()
@@ -2178,8 +2187,11 @@ public:
if (request.url() == QUrl("qrc:/test1.html")) {
setHeader(QNetworkRequest::LocationHeader, QString("qrc:/test2.html"));
setAttribute(QNetworkRequest::RedirectionTargetAttribute, QUrl("qrc:/test2.html"));
- } else if (request.url() == QUrl("qrc:/fake-ssl-error.html"))
+ }
+#ifndef QT_NO_OPENSSL
+ else if (request.url() == QUrl("qrc:/fake-ssl-error.html"))
setError(QNetworkReply::SslHandshakeFailedError, tr("Fake error !")); // force a ssl error
+#endif
else if (request.url() == QUrl("http://abcdef.abcdef/"))
setError(QNetworkReply::HostNotFoundError, tr("Invalid URL"));
@@ -2206,8 +2218,10 @@ private slots:
emit error(this->error());
else if (request().url() == QUrl("http://abcdef.abcdef/"))
emit metaDataChanged();
+#ifndef QT_NO_OPENSSL
else if (request().url() == QUrl("qrc:/fake-ssl-error.html"))
return;
+#endif
emit readyRead();
emit finished();
@@ -2227,12 +2241,14 @@ protected:
if (op == QNetworkAccessManager::GetOperation)
if (url == "qrc:/test1.html" || url == "http://abcdef.abcdef/")
return new FakeReply(request, this);
+#ifndef QT_NO_OPENSSL
else if (url == "qrc:/fake-ssl-error.html") {
FakeReply* reply = new FakeReply(request, this);
QList<QSslError> errors;
emit sslErrors(reply, errors << QSslError(QSslError::UnspecifiedError));
return reply;
}
+#endif
return QNetworkAccessManager::createRequest(op, request, outgoingData);
}
@@ -2266,6 +2282,7 @@ void tst_QWebFrame::requestedUrl()
QCOMPARE(frame->requestedUrl(), QUrl("http://abcdef.abcdef/"));
QCOMPARE(frame->url(), QUrl("http://abcdef.abcdef/"));
+#ifndef QT_NO_OPENSSL
qRegisterMetaType<QList<QSslError> >("QList<QSslError>");
qRegisterMetaType<QNetworkReply* >("QNetworkReply*");
@@ -2275,6 +2292,41 @@ void tst_QWebFrame::requestedUrl()
QCOMPARE(spy2.count(), 1);
QCOMPARE(frame->requestedUrl(), QUrl("qrc:/fake-ssl-error.html"));
QCOMPARE(frame->url(), QUrl("qrc:/fake-ssl-error.html"));
+#endif
+}
+
+void tst_QWebFrame::javaScriptWindowObjectCleared_data()
+{
+ QTest::addColumn<QString>("html");
+ QTest::addColumn<int>("signalCount");
+ QTest::newRow("with <script>") << "<html><body><script></script><p>hello world</p></body></html>" << 1;
+ QTest::newRow("without <script>") << "<html><body><p>hello world</p></body></html>" << 0;
+}
+
+void tst_QWebFrame::javaScriptWindowObjectCleared()
+{
+ QWebPage page;
+ QWebFrame* frame = page.mainFrame();
+ QSignalSpy spy(frame, SIGNAL(javaScriptWindowObjectCleared()));
+ QFETCH(QString, html);
+ frame->setHtml(html);
+
+ QFETCH(int, signalCount);
+ QCOMPARE(spy.count(), signalCount);
+}
+
+void tst_QWebFrame::javaScriptWindowObjectClearedOnEvaluate()
+{
+ QWebPage page;
+ QWebFrame* frame = page.mainFrame();
+ QSignalSpy spy(frame, SIGNAL(javaScriptWindowObjectCleared()));
+ frame->setHtml("<html></html>");
+ QCOMPARE(spy.count(), 0);
+ frame->evaluateJavaScript("var a = 'a';");
+ QCOMPARE(spy.count(), 1);
+ // no new clear for a new script:
+ frame->evaluateJavaScript("var a = 1;");
+ QCOMPARE(spy.count(), 1);
}
void tst_QWebFrame::setHtml()
@@ -2317,7 +2369,29 @@ void tst_QWebFrame::setHtmlWithResource()
QCOMPARE(spy.size(), 2);
QWebElement p = frame->documentElement().findAll("p").at(0);
- QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red"));
+ 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
@@ -2408,23 +2482,17 @@ void tst_QWebFrame::popupFocus()
view.resize(400, 100);
view.show();
view.setFocus();
- QTest::qWait(200);
- QVERIFY2(view.hasFocus(),
- "The WebView should be created");
+ QTRY_VERIFY(view.hasFocus());
// open the popup by clicking. check if focus is on the popup
QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(25, 25));
QObject* webpopup = firstChildByClassName(&view, "WebCore::QWebPopup");
QComboBox* combo = qobject_cast<QComboBox*>(webpopup);
- QTest::qWait(500);
- QVERIFY2(!view.hasFocus() && combo->view()->hasFocus(),
- "Focus sould be on the Popup");
+ QTRY_VERIFY(!view.hasFocus() && combo->view()->hasFocus()); // Focus should be on the popup
// hide the popup and check if focus is on the page
combo->hidePopup();
- QTest::qWait(500);
- QVERIFY2(view.hasFocus() && !combo->view()->hasFocus(),
- "Focus sould be back on the WebView");
+ QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView
// triple the flashing time, should at least blink twice already
int delay = qApp->cursorFlashTime() * 3;
@@ -2592,16 +2660,16 @@ void tst_QWebFrame::hasSetFocus()
QCOMPARE(loadSpy.size(), 2);
m_page->mainFrame()->setFocus();
- QVERIFY(m_page->mainFrame()->hasFocus());
+ QTRY_VERIFY(m_page->mainFrame()->hasFocus());
for (int i = 0; i < children.size(); ++i) {
children.at(i)->setFocus();
- QVERIFY(children.at(i)->hasFocus());
+ QTRY_VERIFY(children.at(i)->hasFocus());
QVERIFY(!m_page->mainFrame()->hasFocus());
}
m_page->mainFrame()->setFocus();
- QVERIFY(m_page->mainFrame()->hasFocus());
+ QTRY_VERIFY(m_page->mainFrame()->hasFocus());
}
void tst_QWebFrame::render()
@@ -2669,5 +2737,24 @@ void tst_QWebFrame::scrollPosition()
QCOMPARE(y, 29);
}
+void tst_QWebFrame::evaluateWillCauseRepaint()
+{
+ QWebView view;
+ QString html("<html><body>top<div id=\"junk\" style=\"display: block;\">"
+ "junk</div>bottom</body></html>");
+ view.setHtml(html);
+ view.show();
+
+ QTest::qWait(200);
+
+ view.page()->mainFrame()->evaluateJavaScript(
+ "document.getElementById('junk').style.display = 'none';");
+
+ ::waitForSignal(view.page(), SIGNAL(repaintRequested( const QRect &)));
+
+ QTest::qWait(2000);
+}
+
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
diff --git a/WebKit/qt/tests/qwebhistory/qwebhistory.pro b/WebKit/qt/tests/qwebhistory/qwebhistory.pro
index fd1074c..8ee63cc 100644
--- a/WebKit/qt/tests/qwebhistory/qwebhistory.pro
+++ b/WebKit/qt/tests/qwebhistory/qwebhistory.pro
@@ -5,3 +5,5 @@ SOURCES += tst_qwebhistory.cpp
RESOURCES += tst_qwebhistory.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E53B
diff --git a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
index 5b55613..4f4d3c4 100644
--- a/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
+++ b/WebKit/qt/tests/qwebhistory/tst_qwebhistory.cpp
@@ -18,6 +18,7 @@
*/
#include <QtTest/QtTest>
+#include <QAction>
#include "qwebpage.h"
#include "qwebview.h"
@@ -58,6 +59,11 @@ private slots:
void saveAndRestore_1(); //simple checks saveState and restoreState
void saveAndRestore_2(); //bad parameters saveState and restoreState
void saveAndRestore_3(); //try use different version
+ void saveAndRestore_crash_1();
+ void saveAndRestore_crash_2();
+ void saveAndRestore_crash_3();
+ void clear();
+
private:
QWebPage* page;
@@ -119,6 +125,8 @@ void tst_QWebHistory::back()
hist->back();
waitForLoadFinished.exec();
}
+ //try one more time (too many). crash test
+ hist->back();
}
/**
@@ -137,6 +145,8 @@ void tst_QWebHistory::forward()
hist->forward();
waitForLoadFinished.exec();
}
+ //try one more time (too many). crash test
+ hist->forward();
}
/**
@@ -287,10 +297,13 @@ void tst_QWebHistory::serialize_3()
/** Simple checks should be a bit redundant to streaming operators */
void tst_QWebHistory::saveAndRestore_1()
{
+ QAction* actionBack = page->action(QWebPage::Back);
hist->back();
waitForLoadFinished.exec();
+ QVERIFY(actionBack->isEnabled());
QByteArray buffer(hist->saveState());
hist->clear();
+ QVERIFY(!actionBack->isEnabled());
QVERIFY(hist->count() == 1);
hist->restoreState(buffer);
@@ -301,6 +314,7 @@ void tst_QWebHistory::saveAndRestore_1()
QCOMPARE(hist->currentItemIndex(), histsize - 2);
QCOMPARE(hist->itemAt(0).title(), QString("page1"));
QCOMPARE(hist->itemAt(histsize - 1).title(), QString("page") + QString::number(histsize));
+ QVERIFY(actionBack->isEnabled());
}
/** Check returns value if there are bad parameters. Actually, result
@@ -322,5 +336,67 @@ void tst_QWebHistory::saveAndRestore_3()
QVERIFY(hist->itemAt(3).isValid());
}
+/** The test shouldn't crash */
+void tst_QWebHistory::saveAndRestore_crash_1()
+{
+ QByteArray tmp = hist->saveState();
+ for (unsigned i = 0; i < 5; i++){
+ hist->restoreState(tmp);
+ hist->saveState();
+ }
+}
+
+/** The test shouldn't crash */
+void tst_QWebHistory::saveAndRestore_crash_2()
+{
+ QByteArray tmp = hist->saveState();
+ QWebPage* page2 = new QWebPage(this);
+ QWebHistory* hist2 = page2->history();
+ for (unsigned i = 0; i < 5; i++){
+ hist2->restoreState(tmp);
+ hist2->saveState();
+ }
+ delete page2;
+}
+
+/** The test shouldn't crash */
+void tst_QWebHistory::saveAndRestore_crash_3()
+{
+ QByteArray tmp = hist->saveState();
+ QWebPage* page2 = new QWebPage(this);
+ QWebHistory* hist1 = hist;
+ QWebHistory* hist2 = page2->history();
+ for (unsigned i = 0; i < 5; i++){
+ hist1->restoreState(tmp);
+ hist2->restoreState(tmp);
+ QVERIFY(hist1->count() == hist2->count());
+ QVERIFY(hist1->count() == histsize);
+ hist2->back();
+ tmp = hist2->saveState();
+ hist2->clear();
+ }
+ delete page2;
+}
+
+/** ::clear */
+void tst_QWebHistory::clear()
+{
+ QAction* actionBack = page->action(QWebPage::Back);
+ QVERIFY(actionBack->isEnabled());
+ hist->saveState();
+ QVERIFY(hist->count() > 1);
+ hist->clear();
+ QVERIFY(hist->count() == 1); // Leave current item.
+ QVERIFY(!actionBack->isEnabled());
+
+
+ QWebPage* page2 = new QWebPage(this);
+ QWebHistory* hist2 = page2->history();
+ QVERIFY(hist2->count() == 0);
+ hist2->clear();
+ QVERIFY(hist2->count() == 0); // Do not change anything.
+ delete page2;
+}
+
QTEST_MAIN(tst_QWebHistory)
#include "tst_qwebhistory.moc"
diff --git a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
index af3b348..53e1afe 100644
--- a/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
+++ b/WebKit/qt/tests/qwebhistoryinterface/qwebhistoryinterface.pro
@@ -4,3 +4,5 @@ include(../../../../WebKit.pri)
SOURCES += tst_qwebhistoryinterface.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E53C
diff --git a/WebKit/qt/tests/qwebpage/qwebpage.pro b/WebKit/qt/tests/qwebpage/qwebpage.pro
index 2f3a108..82ffac6 100644
--- a/WebKit/qt/tests/qwebpage/qwebpage.pro
+++ b/WebKit/qt/tests/qwebpage/qwebpage.pro
@@ -5,3 +5,5 @@ SOURCES += tst_qwebpage.cpp
RESOURCES += tst_qwebpage.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E53E
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 966f049..a9f9f16 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -20,6 +20,7 @@
#include <QtTest/QtTest>
+#include <qwebelement.h>
#include <qwebpage.h>
#include <qwidget.h>
#include <qwebview.h>
@@ -59,7 +60,7 @@
* \return \p true if the requested signal was received
* \p false on timeout
*/
-static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0)
+static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
{
QEventLoop loop;
QObject::connect(obj, signal, &loop, SLOT(quit()));
@@ -110,9 +111,13 @@ private slots:
void frameAt();
void requestCache();
void protectBindingsRuntimeObjectsFromCollector();
+ void localURLSchemes();
+ void testOptionalJSObjects();
+ void testEnablePersistentStorage();
+ void consoleOutput();
+ void inputMethods();
-private:
-
+ void crashTests_LazyInitializationOfMainFrame();
private:
QWebView* m_view;
@@ -217,6 +222,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)));
@@ -227,6 +235,7 @@ void tst_QWebPage::loadFinished()
QTest::qWait(3000);
+ QVERIFY(spyNetworkRequestStarted.count() > 1);
QVERIFY(spyLoadStarted.count() > 1);
QVERIFY(spyLoadFinished.count() > 1);
@@ -238,6 +247,31 @@ void tst_QWebPage::loadFinished()
QCOMPARE(spyLoadFinished.count(), 1);
}
+class ConsolePage : public QWebPage
+{
+public:
+ ConsolePage(QObject* parent = 0) : QWebPage(parent) {}
+
+ virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
+ {
+ messages.append(message);
+ lineNumbers.append(lineNumber);
+ sourceIDs.append(sourceID);
+ }
+
+ QStringList messages;
+ QList<int> lineNumbers;
+ QStringList sourceIDs;
+};
+
+void tst_QWebPage::consoleOutput()
+{
+ ConsolePage page;
+ page.mainFrame()->evaluateJavaScript("this is not valid JavaScript");
+ QCOMPARE(page.messages.count(), 1);
+ QCOMPARE(page.lineNumbers.at(0), 1);
+}
+
class TestPage : public QWebPage
{
public:
@@ -316,13 +350,13 @@ void tst_QWebPage::userStyleSheet()
m_page->setNetworkAccessManager(networkManager);
networkManager->requestedUrls.clear();
- m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}"));
+ m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64,"
+ + QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64()));
m_view->setHtml("<p>hello world</p>");
QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
- QVERIFY(networkManager->requestedUrls.count() >= 2);
- QCOMPARE(networkManager->requestedUrls.at(0), QUrl("data:text/css,p { background-image: url('http://does.not/exist.png');}"));
- QCOMPARE(networkManager->requestedUrls.at(1), QUrl("http://does.not/exist.png"));
+ QVERIFY(networkManager->requestedUrls.count() >= 1);
+ QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
}
void tst_QWebPage::modified()
@@ -405,6 +439,10 @@ void tst_QWebPage::database()
QWebSettings::setOfflineStorageDefaultQuota(1024 * 1024);
QVERIFY(QWebSettings::offlineStorageDefaultQuota() == 1024 * 1024);
+ m_page->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+ m_page->settings()->setAttribute(QWebSettings::SessionStorageEnabled, true);
+ m_page->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
+
QString dbFileName = path + "Databases.db";
if (QFile::exists(dbFileName))
@@ -432,14 +470,19 @@ void tst_QWebPage::database()
m_page->mainFrame()->evaluateJavaScript("var db3; db3=openDatabase('testdb', '1.0', 'test database API', 50000);db3.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Test (text TEXT)', []); }, function(tx, result) { }, function(tx, error) { });");
QTest::qWait(200);
+ // Remove all databases.
QWebSecurityOrigin origin = m_page->mainFrame()->securityOrigin();
QList<QWebDatabase> dbs = origin.databases();
- if (dbs.count() > 0) {
- QString fileName = dbs[0].fileName();
+ for (int i = 0; i < dbs.count(); i++) {
+ QString fileName = dbs[i].fileName();
QVERIFY(QFile::exists(fileName));
- QWebDatabase::removeDatabase(dbs[0]);
+ QWebDatabase::removeDatabase(dbs[i]);
QVERIFY(!QFile::exists(fileName));
}
+ QVERIFY(!origin.databases().size());
+ // Remove removed test :-)
+ QWebDatabase::removeAllDatabases();
+ QVERIFY(!origin.databases().size());
QTest::qWait(1000);
}
@@ -627,7 +670,6 @@ void tst_QWebPage::createViewlessPlugin()
// import private API
void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName);
QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page);
-void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path);
void tst_QWebPage::multiplePageGroupsAndLocalStorage()
{
@@ -638,9 +680,11 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage()
QWebView view1;
QWebView view2;
- qt_websettings_setLocalStorageDatabasePath(view1.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path1"));
+ view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+ view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1"));
qt_webpage_setGroupName(view1.page(), "group1");
- qt_websettings_setLocalStorageDatabasePath(view2.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path2"));
+ view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+ view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2"));
qt_webpage_setGroupName(view2.page(), "group2");
QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1"));
QCOMPARE(qt_webpage_groupName(view2.page()), QString("group2"));
@@ -1165,6 +1209,94 @@ void tst_QWebPage::frameAt()
frameAtHelper(webPage, webPage->mainFrame(), webPage->mainFrame()->pos());
}
+void tst_QWebPage::inputMethods()
+{
+ m_view->page()->mainFrame()->setHtml("<html><body>" \
+ "<input type='text' id='input1' style='font-family: serif' value='' maxlength='20'/>" \
+ "</body></html>");
+ m_view->page()->mainFrame()->setFocus();
+
+ QList<QWebElement> inputs = m_view->page()->mainFrame()->documentElement().findAll("input");
+
+ QMouseEvent evpres(QEvent::MouseButtonPress, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ m_view->page()->event(&evpres);
+ QMouseEvent evrel(QEvent::MouseButtonRelease, inputs.at(0).geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+ m_view->page()->event(&evrel);
+
+ //ImMicroFocus
+ QVariant variant = m_view->page()->inputMethodQuery(Qt::ImMicroFocus);
+ QRect focusRect = variant.toRect();
+ QVERIFY(inputs.at(0).geometry().contains(variant.toRect().topLeft()));
+
+ //ImFont
+ variant = m_view->page()->inputMethodQuery(Qt::ImFont);
+ QFont font = variant.value<QFont>();
+ QCOMPARE(QString("-webkit-serif"), font.family());
+
+ QList<QInputMethodEvent::Attribute> inputAttributes;
+
+ //Insert text.
+ {
+ QInputMethodEvent eventText("QtWebKit", inputAttributes);
+ QSignalSpy signalSpy(m_view->page(), SIGNAL(microFocusChanged()));
+ m_view->page()->event(&eventText);
+ QCOMPARE(signalSpy.count(), 0);
+ }
+
+ {
+ QInputMethodEvent eventText("", inputAttributes);
+ eventText.setCommitString(QString("QtWebKit"), 0, 0);
+ m_view->page()->event(&eventText);
+ }
+
+#if QT_VERSION >= 0x040600
+ //ImMaximumTextLength
+ variant = m_view->page()->inputMethodQuery(Qt::ImMaximumTextLength);
+ QCOMPARE(20, variant.toInt());
+
+ //Set selection
+ inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 3, 2, QVariant());
+ QInputMethodEvent eventSelection("",inputAttributes);
+ m_view->page()->event(&eventSelection);
+
+ //ImAnchorPosition
+ variant = m_view->page()->inputMethodQuery(Qt::ImAnchorPosition);
+ int anchorPosition = variant.toInt();
+ QCOMPARE(anchorPosition, 3);
+
+ //ImCursorPosition
+ variant = m_view->page()->inputMethodQuery(Qt::ImCursorPosition);
+ int cursorPosition = variant.toInt();
+ QCOMPARE(cursorPosition, 5);
+
+ //ImCurrentSelection
+ variant = m_view->page()->inputMethodQuery(Qt::ImCurrentSelection);
+ QString selectionValue = variant.value<QString>();
+ QCOMPARE(selectionValue, QString("eb"));
+#endif
+
+ //ImSurroundingText
+ variant = m_view->page()->inputMethodQuery(Qt::ImSurroundingText);
+ QString value = variant.value<QString>();
+ QCOMPARE(value, QString("QtWebKit"));
+
+#if QT_VERSION >= 0x040600
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ // Clear the selection, so the next test does not clear any contents.
+ QInputMethodEvent::Attribute newSelection(QInputMethodEvent::Selection, 0, 0, QVariant());
+ attributes.append(newSelection);
+ QInputMethodEvent event("composition", attributes);
+ m_view->page()->event(&event);
+ }
+
+ // A ongoing composition should not change the surrounding text before it is committed.
+ variant = m_view->page()->inputMethodQuery(Qt::ImSurroundingText);
+ value = variant.value<QString>();
+ QCOMPARE(value, QString("QtWebKit"));
+#endif
+}
+
// import a little DRT helper function to trigger the garbage collector
void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
@@ -1190,5 +1322,104 @@ void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector()
newPage->mainFrame()->evaluateJavaScript("testme('bar')");
}
+void tst_QWebPage::localURLSchemes()
+{
+ int i = QWebSecurityOrigin::localSchemes().size();
+ QWebSecurityOrigin::removeLocalScheme("file");
+ QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i);
+ QWebSecurityOrigin::addLocalScheme("file");
+ QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i);
+ QString myscheme = "myscheme";
+ QWebSecurityOrigin::addLocalScheme(myscheme);
+ QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i + 1);
+ QVERIFY(QWebSecurityOrigin::localSchemes().contains(myscheme));
+ QWebSecurityOrigin::removeLocalScheme(myscheme);
+ QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i);
+ QWebSecurityOrigin::removeLocalScheme(myscheme);
+ QTRY_COMPARE(QWebSecurityOrigin::localSchemes().size(), i);
+}
+
+static inline bool testFlag(QWebPage& webPage, QWebSettings::WebAttribute settingAttribute, const QString& jsObjectName, bool settingValue)
+{
+ webPage.settings()->setAttribute(settingAttribute, settingValue);
+ return webPage.mainFrame()->evaluateJavaScript(QString("(window.%1 != undefined)").arg(jsObjectName)).toBool();
+}
+
+void tst_QWebPage::testOptionalJSObjects()
+{
+ // Once a feature is enabled and the JS object is accessed turning off the setting will not turn off
+ // the visibility of the JS object any more. For this reason this test uses two QWebPage instances.
+ // Part of the test is to make sure that the QWebPage instances do not interfere with each other so turning on
+ // a feature for one instance will not turn it on for another.
+
+ QWebPage webPage1;
+ QWebPage webPage2;
+
+ 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);
+
+ QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false);
+ QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", true), true);
+ QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false);
+ QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", false), true);
+
+ QCOMPARE(testFlag(webPage1, QWebSettings::SessionStorageEnabled, "sessionStorage", false), false);
+ QCOMPARE(testFlag(webPage2, QWebSettings::SessionStorageEnabled, "sessionStorage", true), true);
+ QCOMPARE(testFlag(webPage1, QWebSettings::SessionStorageEnabled, "sessionStorage", false), false);
+ QCOMPARE(testFlag(webPage2, QWebSettings::SessionStorageEnabled, "sessionStorage", false), true);
+}
+
+void tst_QWebPage::testEnablePersistentStorage()
+{
+ QWebPage webPage;
+
+ // By default all persistent options should be disabled
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), false);
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), false);
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), false);
+ QVERIFY(webPage.settings()->iconDatabasePath().isEmpty());
+
+ QWebSettings::enablePersistentStorage();
+
+ // Give it some time to initialize - icon database needs it
+ QTest::qWait(1000);
+
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::LocalStorageEnabled), true);
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled), true);
+ QCOMPARE(webPage.settings()->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled), true);
+
+ QVERIFY(!webPage.settings()->offlineStoragePath().isEmpty());
+ QVERIFY(!webPage.settings()->offlineWebApplicationCachePath().isEmpty());
+ QVERIFY(!webPage.settings()->iconDatabasePath().isEmpty());
+}
+
+void tst_QWebPage::crashTests_LazyInitializationOfMainFrame()
+{
+ {
+ QWebPage webPage;
+ }
+ {
+ QWebPage webPage;
+ webPage.selectedText();
+ }
+ {
+ QWebPage webPage;
+ webPage.triggerAction(QWebPage::Back, true);
+ }
+ {
+ QWebPage webPage;
+ QPoint pos(10,10);
+ webPage.updatePositionDependentActions(pos);
+ }
+}
+
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
diff --git a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
index 5d10993..1376ca5 100644
--- a/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
+++ b/WebKit/qt/tests/qwebplugindatabase/qwebplugindatabase.pro
@@ -4,3 +4,5 @@ include(../../../../WebKit.pri)
SOURCES += tst_qwebplugindatabase.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E540
diff --git a/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp b/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp
index c0533ad..1ee6206 100644
--- a/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp
+++ b/WebKit/qt/tests/qwebplugindatabase/tst_qwebplugindatabase.cpp
@@ -40,6 +40,8 @@ private slots:
void operatorequal_data();
void operatorequal();
void preferredPlugin();
+ void operatorassign_data();
+ void operatorassign();
};
typedef QWebPluginInfo::MimeType MimeType;
@@ -396,6 +398,40 @@ void tst_QWebPluginDatabase::preferredPlugin()
}
}
+void tst_QWebPluginDatabase::operatorassign_data()
+{
+ QTest::addColumn<QWebPluginInfo>("first");
+ QTest::addColumn<QWebPluginInfo>("second");
+
+ QWebPluginDatabase* database = QWebSettings::pluginDatabase();
+ QTest::newRow("null") << QWebPluginInfo() << QWebPluginInfo();
+
+ QList<QWebPluginInfo> plugins = database->plugins();
+ for (int i = 0; i < (plugins.count() - 1); ++i) {
+ QWebPluginInfo first = plugins.at(i);
+ QWebPluginInfo second = plugins.at(i + 1);
+
+ QTest::newRow(QString("%1=%2").arg(first.name(), second.name()).toUtf8().constData()) << first << second;
+ }
+}
+
+void tst_QWebPluginDatabase::operatorassign()
+{
+ QFETCH(QWebPluginInfo, first);
+ QFETCH(QWebPluginInfo, second);
+
+ QWebPluginInfo info;
+ QCOMPARE(info.mimeTypes(), QList<MimeType>());
+ QCOMPARE(info = first, first);
+ QCOMPARE(info, first);
+ QCOMPARE(info.mimeTypes(), first.mimeTypes());
+ QCOMPARE(info = second, second);
+ QCOMPARE(info, second);
+ QCOMPARE(info.mimeTypes(), second.mimeTypes());
+ QCOMPARE(info = QWebPluginInfo(), QWebPluginInfo());
+ QCOMPARE(info.mimeTypes(), QList<MimeType>());
+}
+
QTEST_MAIN(tst_QWebPluginDatabase)
#include "tst_qwebplugindatabase.moc"
diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro
index 799ccfb..d9d122c 100644
--- a/WebKit/qt/tests/qwebview/qwebview.pro
+++ b/WebKit/qt/tests/qwebview/qwebview.pro
@@ -4,3 +4,5 @@ include(../../../../WebKit.pri)
SOURCES += tst_qwebview.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+symbian:TARGET.UID3 = 0xA000E53F
diff --git a/WebKit/qt/tests/tests.pro b/WebKit/qt/tests/tests.pro
index b5f66ee..81cc8f3 100644
--- a/WebKit/qt/tests/tests.pro
+++ b/WebKit/qt/tests/tests.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebplugindatabase qwebview qwebhistory
+SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory
greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro
diff --git a/WebKit/qt/tests/util.h b/WebKit/qt/tests/util.h
new file mode 100644
index 0000000..7f7e613
--- /dev/null
+++ b/WebKit/qt/tests/util.h
@@ -0,0 +1,48 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+// Functions and macros that really need to be in QTestLib
+
+// Will try to wait for the condition while allowing event processing
+#define QTRY_VERIFY(__expr) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 5000; \
+ if (!(__expr)) { \
+ QTest::qWait(0); \
+ } \
+ for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QVERIFY(__expr); \
+ } while(0)
+
+// Will try to wait for the condition while allowing event processing
+#define QTRY_COMPARE(__expr, __expected) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 5000; \
+ if ((__expr) != (__expected)) { \
+ QTest::qWait(0); \
+ } \
+ for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QCOMPARE(__expr, __expected); \
+ } while(0)
+