summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-10-02 08:48:52 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-10-02 08:48:52 (GMT)
commitc006edf9b186c4a8a56e888e8f5d1b692e29f1d8 (patch)
treee105f4e2389cd17a5392478160d37230f4118960 /src/3rdparty/webkit/WebKit/qt
parentfd5e86e65adfdecd7bf8a49764d9c9410d877e44 (diff)
parent2d003378ff5e7621d5dcc810408039cfe13a8c0a (diff)
downloadQt-c006edf9b186c4a8a56e888e8f5d1b692e29f1d8.zip
Qt-c006edf9b186c4a8a56e888e8f5d1b692e29f1d8.tar.gz
Qt-c006edf9b186c4a8a56e888e8f5d1b692e29f1d8.tar.bz2
Merge commit 'qt/4.6' into mmfphonon
Conflicts: src/gui/kernel/qwidget_s60.cpp
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/headers.pri2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp)148
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h (renamed from src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h)18
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp207
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h25
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog121
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp50
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro)4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp (renamed from src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp)14
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp126
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/tests.pro2
16 files changed, 581 insertions, 156 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
index 51abba4..5a95c67 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
+++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
@@ -1,5 +1,5 @@
WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
- $$PWD/qwebgraphicsitem.h \
+ $$PWD/qgraphicswebview.h \
$$PWD/qwebkitglobal.h \
$$PWD/qwebpage.h \
$$PWD/qwebview.h \
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index 196f0b8..d8d9d64 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
@@ -18,7 +18,7 @@
*/
#include "config.h"
-#include "qwebgraphicsitem.h"
+#include "qgraphicswebview.h"
#include "qwebframe.h"
#include "qwebpage.h"
@@ -33,9 +33,9 @@
#include <QX11Info>
#endif
-class QWebGraphicsItemPrivate : public QWebPageClient {
+class QGraphicsWebViewPrivate : public QWebPageClient {
public:
- QWebGraphicsItemPrivate(QWebGraphicsItem* parent)
+ QGraphicsWebViewPrivate(QGraphicsWebView* parent)
: q(parent)
, page(0)
, interactive(true)
@@ -55,7 +55,7 @@ public:
void _q_doLoadFinished(bool success);
void _q_setStatusBarMessage(const QString& message);
- QWebGraphicsItem* q;
+ QGraphicsWebView* q;
QWebPage* page;
QString statusBarMessage;
@@ -63,7 +63,7 @@ public:
qreal progress;
};
-void QWebGraphicsItemPrivate::_q_doLoadProgress(int progress)
+void QGraphicsWebViewPrivate::_q_doLoadProgress(int progress)
{
if (qFuzzyCompare(this->progress, qreal(progress / 100.)))
return;
@@ -73,7 +73,7 @@ void QWebGraphicsItemPrivate::_q_doLoadProgress(int progress)
emit q->progressChanged(this->progress);
}
-void QWebGraphicsItemPrivate::_q_doLoadFinished(bool success)
+void QGraphicsWebViewPrivate::_q_doLoadFinished(bool success)
{
// If the page had no title, still make sure it gets the signal
if (q->title().isEmpty())
@@ -85,27 +85,27 @@ void QWebGraphicsItemPrivate::_q_doLoadFinished(bool success)
emit q->loadFailed();
}
-void QWebGraphicsItemPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
+void QGraphicsWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
{
q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll));
}
-void QWebGraphicsItemPrivate::update(const QRect & dirtyRect)
+void QGraphicsWebViewPrivate::update(const QRect & dirtyRect)
{
q->update(QRectF(dirtyRect));
}
-QCursor QWebGraphicsItemPrivate::cursor() const
+QCursor QGraphicsWebViewPrivate::cursor() const
{
return q->cursor();
}
-void QWebGraphicsItemPrivate::updateCursor(const QCursor& cursor)
+void QGraphicsWebViewPrivate::updateCursor(const QCursor& cursor)
{
q->setCursor(cursor);
}
-int QWebGraphicsItemPrivate::screenNumber() const
+int QGraphicsWebViewPrivate::screenNumber() const
{
#if defined(Q_WS_X11)
const QList<QGraphicsView*> views = q->scene()->views();
@@ -117,7 +117,7 @@ int QWebGraphicsItemPrivate::screenNumber() const
return 0;
}
-WId QWebGraphicsItemPrivate::winId() const
+WId QGraphicsWebViewPrivate::winId() const
{
const QList<QGraphicsView*> views = q->scene()->views();
@@ -127,15 +127,15 @@ WId QWebGraphicsItemPrivate::winId() const
return 0;
}
-void QWebGraphicsItemPrivate::_q_setStatusBarMessage(const QString& s)
+void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s)
{
statusBarMessage = s;
emit q->statusChanged();
}
/*!
- \class QWebGraphicsItem
- \brief The QWebGraphicsItem class allows web content to be added to a GraphicsView.
+ \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.
@@ -146,13 +146,13 @@ void QWebGraphicsItemPrivate::_q_setStatusBarMessage(const QString& s)
*/
/*!
- Constructs an empty QWebGraphicsItem with parent \a parent.
+ Constructs an empty QGraphicsWebView with parent \a parent.
\sa load()
*/
-QWebGraphicsItem::QWebGraphicsItem(QGraphicsItem* parent)
+QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent)
: QGraphicsWidget(parent)
- , d(new QWebGraphicsItemPrivate(this))
+ , d(new QGraphicsWebViewPrivate(this))
{
#if QT_VERSION >= 0x040600
setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
@@ -164,7 +164,7 @@ QWebGraphicsItem::QWebGraphicsItem(QGraphicsItem* parent)
/*!
Destroys the web graphicsitem.
*/
-QWebGraphicsItem::~QWebGraphicsItem()
+QGraphicsWebView::~QGraphicsWebView()
{
if (d->page)
d->page->d->view = 0;
@@ -180,10 +180,10 @@ QWebGraphicsItem::~QWebGraphicsItem()
\sa setPage()
*/
-QWebPage* QWebGraphicsItem::page() const
+QWebPage* QGraphicsWebView::page() const
{
if (!d->page) {
- QWebGraphicsItem* that = const_cast<QWebGraphicsItem*>(this);
+ QGraphicsWebView* that = const_cast<QGraphicsWebView*>(this);
QWebPage* page = new QWebPage(that);
// Default to not having a background, in the case
@@ -200,14 +200,14 @@ QWebPage* QWebGraphicsItem::page() const
/*! \reimp
*/
-void QWebGraphicsItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*)
+void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*)
{
page()->mainFrame()->render(painter, option->exposedRect.toRect());
}
/*! \reimp
*/
-bool QWebGraphicsItem::sceneEvent(QEvent* event)
+bool QGraphicsWebView::sceneEvent(QEvent* event)
{
// Re-implemented in order to allows fixing event-related bugs in patch releases.
return QGraphicsWidget::sceneEvent(event);
@@ -215,7 +215,7 @@ bool QWebGraphicsItem::sceneEvent(QEvent* event)
/*! \reimp
*/
-bool QWebGraphicsItem::event(QEvent* event)
+bool QGraphicsWebView::event(QEvent* event)
{
// Re-implemented in order to allows fixing event-related bugs in patch releases.
@@ -248,7 +248,7 @@ bool QWebGraphicsItem::event(QEvent* event)
\sa page()
*/
-void QWebGraphicsItem::setPage(QWebPage* page)
+void QGraphicsWebView::setPage(QWebPage* page)
{
if (d->page == page)
return;
@@ -288,7 +288,7 @@ void QWebGraphicsItem::setPage(QWebPage* page)
}
/*!
- \property QWebGraphicsItem::url
+ \property QGraphicsWebView::url
\brief the url of the web page currently viewed
Setting this property clears the view and loads the URL.
@@ -298,12 +298,12 @@ void QWebGraphicsItem::setPage(QWebPage* page)
\sa load(), urlChanged()
*/
-void QWebGraphicsItem::setUrl(const QUrl &url)
+void QGraphicsWebView::setUrl(const QUrl &url)
{
page()->mainFrame()->setUrl(url);
}
-QUrl QWebGraphicsItem::url() const
+QUrl QGraphicsWebView::url() const
{
if (d->page)
return d->page->mainFrame()->url();
@@ -312,14 +312,14 @@ QUrl QWebGraphicsItem::url() const
}
/*!
- \property QWebGraphicsItem::title
+ \property QGraphicsWebView::title
\brief the title of the web page currently viewed
By default, this property contains an empty string.
\sa titleChanged()
*/
-QString QWebGraphicsItem::title() const
+QString QGraphicsWebView::title() const
{
if (d->page)
return d->page->mainFrame()->title();
@@ -328,14 +328,14 @@ QString QWebGraphicsItem::title() const
}
/*!
- \property QWebGraphicsItem::icon
+ \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 QWebGraphicsItem::icon() const
+QIcon QGraphicsWebView::icon() const
{
if (d->page)
return d->page->mainFrame()->icon();
@@ -344,12 +344,12 @@ QIcon QWebGraphicsItem::icon() const
}
/*!
- \property QWebGraphicsItem::zoomFactor
+ \property QGraphicsWebView::zoomFactor
\since 4.5
\brief the zoom factor for the view
*/
-void QWebGraphicsItem::setZoomFactor(qreal factor)
+void QGraphicsWebView::setZoomFactor(qreal factor)
{
if (factor == page()->mainFrame()->zoomFactor())
return;
@@ -358,14 +358,14 @@ void QWebGraphicsItem::setZoomFactor(qreal factor)
emit zoomFactorChanged();
}
-qreal QWebGraphicsItem::zoomFactor() const
+qreal QGraphicsWebView::zoomFactor() const
{
return page()->mainFrame()->zoomFactor();
}
/*! \reimp
*/
-void QWebGraphicsItem::updateGeometry()
+void QGraphicsWebView::updateGeometry()
{
QGraphicsWidget::updateGeometry();
@@ -378,7 +378,7 @@ void QWebGraphicsItem::updateGeometry()
/*! \reimp
*/
-void QWebGraphicsItem::setGeometry(const QRectF& rect)
+void QGraphicsWebView::setGeometry(const QRectF& rect)
{
QGraphicsWidget::setGeometry(rect);
@@ -400,7 +400,7 @@ void QWebGraphicsItem::setGeometry(const QRectF& rect)
\sa statusChanged()
*/
-QString QWebGraphicsItem::status() const
+QString QGraphicsWebView::status() const
{
return d->statusBarMessage;
}
@@ -410,7 +410,7 @@ QString QWebGraphicsItem::status() const
\sa reload(), loadFinished()
*/
-void QWebGraphicsItem::stop()
+void QGraphicsWebView::stop()
{
if (d->page)
d->page->triggerAction(QWebPage::Stop);
@@ -422,7 +422,7 @@ void QWebGraphicsItem::stop()
\sa forward()
*/
-void QWebGraphicsItem::back()
+void QGraphicsWebView::back()
{
if (d->page)
d->page->triggerAction(QWebPage::Back);
@@ -434,7 +434,7 @@ void QWebGraphicsItem::back()
\sa back()
*/
-void QWebGraphicsItem::forward()
+void QGraphicsWebView::forward()
{
if (d->page)
d->page->triggerAction(QWebPage::Forward);
@@ -445,17 +445,17 @@ void QWebGraphicsItem::forward()
\sa stop(), loadStarted()
*/
-void QWebGraphicsItem::reload()
+void QGraphicsWebView::reload()
{
if (d->page)
d->page->triggerAction(QWebPage::Reload);
}
/*!
- \property QWebGraphicsItem::progress
+ \property QGraphicsWebView::progress
\brief the progress of loading the current URL, from 0 to 1.
*/
-qreal QWebGraphicsItem::progress() const
+qreal QGraphicsWebView::progress() const
{
return d->progress;
}
@@ -467,13 +467,13 @@ qreal QWebGraphicsItem::progress() const
\sa setUrl(), url(), urlChanged()
*/
-void QWebGraphicsItem::load(const QUrl& url)
+void QGraphicsWebView::load(const QUrl& url)
{
page()->mainFrame()->load(url);
}
/*!
- \fn void QWebGraphicsItem::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body)
+ \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.
@@ -484,7 +484,7 @@ void QWebGraphicsItem::load(const QUrl& url)
\sa url(), urlChanged()
*/
-void QWebGraphicsItem::load(const QNetworkRequest& request,
+void QGraphicsWebView::load(const QNetworkRequest& request,
QNetworkAccessManager::Operation operation,
const QByteArray& body)
{
@@ -507,12 +507,12 @@ void QWebGraphicsItem::load(const QNetworkRequest& request,
\sa load(), setContent(), QWebFrame::toHtml()
*/
-void QWebGraphicsItem::setHtml(const QString& html, const QUrl& baseUrl)
+void QGraphicsWebView::setHtml(const QString& html, const QUrl& baseUrl)
{
page()->mainFrame()->setHtml(html, baseUrl);
}
-QString QWebGraphicsItem::toHtml() const
+QString QGraphicsWebView::toHtml() const
{
return page()->mainFrame()->toHtml();
}
@@ -528,7 +528,7 @@ QString QWebGraphicsItem::toHtml() const
\sa load(), setHtml(), QWebFrame::toHtml()
*/
-void QWebGraphicsItem::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl)
+void QGraphicsWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl)
{
page()->mainFrame()->setContent(data, mimeType, baseUrl);
}
@@ -540,22 +540,22 @@ void QWebGraphicsItem::setContent(const QByteArray& data, const QString& mimeTyp
\snippet webkitsnippets/qtwebkit_qwebview_snippet.cpp 0
*/
-QWebHistory* QWebGraphicsItem::history() const
+QWebHistory* QGraphicsWebView::history() const
{
return page()->history();
}
/*!
- \property QWebGraphicsItem::interactive
+ \property QGraphicsWebView::interactive
\brief controls whether the item responds to mouse and key events.
*/
-bool QWebGraphicsItem::isInteractive() const
+bool QGraphicsWebView::isInteractive() const
{
return d->interactive;
}
-void QWebGraphicsItem::setInteractive(bool allowed)
+void QGraphicsWebView::setInteractive(bool allowed)
{
if (d->interactive == allowed)
return;
@@ -573,14 +573,14 @@ void QWebGraphicsItem::setInteractive(bool allowed)
\sa QWebSettings::globalSettings()
*/
-QWebSettings* QWebGraphicsItem::settings() const
+QWebSettings* QGraphicsWebView::settings() const
{
return page()->settings();
}
/*! \reimp
*/
-void QWebGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent* ev)
+void QGraphicsWebView::hoverMoveEvent(QGraphicsSceneHoverEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -598,14 +598,14 @@ void QWebGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* ev)
+void QGraphicsWebView::hoverLeaveEvent(QGraphicsSceneHoverEvent* ev)
{
Q_UNUSED(ev);
}
/*! \reimp
*/
-void QWebGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
+void QGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -619,7 +619,7 @@ void QWebGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent* ev)
+void QGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -633,7 +633,7 @@ void QWebGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
+void QGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -647,7 +647,7 @@ void QWebGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev)
+void QGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -661,7 +661,7 @@ void QWebGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::keyPressEvent(QKeyEvent* ev)
+void QGraphicsWebView::keyPressEvent(QKeyEvent* ev)
{
if (d->interactive && d->page)
d->page->event(ev);
@@ -672,7 +672,7 @@ void QWebGraphicsItem::keyPressEvent(QKeyEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::keyReleaseEvent(QKeyEvent* ev)
+void QGraphicsWebView::keyReleaseEvent(QKeyEvent* ev)
{
if (d->interactive && d->page)
d->page->event(ev);
@@ -683,7 +683,7 @@ void QWebGraphicsItem::keyReleaseEvent(QKeyEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::focusInEvent(QFocusEvent* ev)
+void QGraphicsWebView::focusInEvent(QFocusEvent* ev)
{
if (d->page)
d->page->event(ev);
@@ -693,7 +693,7 @@ void QWebGraphicsItem::focusInEvent(QFocusEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::focusOutEvent(QFocusEvent* ev)
+void QGraphicsWebView::focusOutEvent(QFocusEvent* ev)
{
if (d->page)
d->page->event(ev);
@@ -703,7 +703,7 @@ void QWebGraphicsItem::focusOutEvent(QFocusEvent* ev)
/*! \reimp
*/
-bool QWebGraphicsItem::focusNextPrevChild(bool next)
+bool QGraphicsWebView::focusNextPrevChild(bool next)
{
if (d->page)
return d->page->focusNextPrevChild(next);
@@ -713,7 +713,7 @@ bool QWebGraphicsItem::focusNextPrevChild(bool next)
/*! \reimp
*/
-void QWebGraphicsItem::dragEnterEvent(QGraphicsSceneDragDropEvent* ev)
+void QGraphicsWebView::dragEnterEvent(QGraphicsSceneDragDropEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
//if (d->page)
@@ -727,7 +727,7 @@ void QWebGraphicsItem::dragEnterEvent(QGraphicsSceneDragDropEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev)
+void QGraphicsWebView::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
if (d->interactive && d->page) {
@@ -745,7 +745,7 @@ void QWebGraphicsItem::dragLeaveEvent(QGraphicsSceneDragDropEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::dragMoveEvent(QGraphicsSceneDragDropEvent* ev)
+void QGraphicsWebView::dragMoveEvent(QGraphicsSceneDragDropEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
if (d->interactive && d->page) {
@@ -763,7 +763,7 @@ void QWebGraphicsItem::dragMoveEvent(QGraphicsSceneDragDropEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::dropEvent(QGraphicsSceneDragDropEvent* ev)
+void QGraphicsWebView::dropEvent(QGraphicsSceneDragDropEvent* ev)
{
#ifndef QT_NO_DRAGANDDROP
if (d->interactive && d->page) {
@@ -782,7 +782,7 @@ void QWebGraphicsItem::dropEvent(QGraphicsSceneDragDropEvent* ev)
#ifndef QT_NO_CONTEXTMENU
/*! \reimp
*/
-void QWebGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev)
+void QGraphicsWebView::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev)
{
if (d->page) {
const bool accepted = ev->isAccepted();
@@ -795,7 +795,7 @@ void QWebGraphicsItem::contextMenuEvent(QGraphicsSceneContextMenuEvent* ev)
#ifndef QT_NO_WHEELEVENT
/*! \reimp
*/
-void QWebGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent* ev)
+void QGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent* ev)
{
if (d->interactive && d->page) {
const bool accepted = ev->isAccepted();
@@ -810,7 +810,7 @@ void QWebGraphicsItem::wheelEvent(QGraphicsSceneWheelEvent* ev)
/*! \reimp
*/
-void QWebGraphicsItem::inputMethodEvent(QInputMethodEvent* ev)
+void QGraphicsWebView::inputMethodEvent(QInputMethodEvent* ev)
{
if (d->interactive && d->page)
d->page->event(ev);
@@ -819,4 +819,4 @@ void QWebGraphicsItem::inputMethodEvent(QInputMethodEvent* ev)
QGraphicsItem::inputMethodEvent(ev);
}
-#include "moc_qwebgraphicsitem.cpp"
+#include "moc_qgraphicswebview.cpp"
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h
index 2c6817a..a8478d8 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h
@@ -17,8 +17,8 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef QWebGraphicsItem_h
-#define QWebGraphicsItem_h
+#ifndef QGraphicsWebView_h
+#define QGraphicsWebView_h
#include "qwebkitglobal.h"
#include <QtCore/qurl.h>
@@ -32,9 +32,9 @@ class QWebPage;
class QWebHistory;
class QWebSettings;
-class QWebGraphicsItemPrivate;
+class QGraphicsWebViewPrivate;
-class QWEBKIT_EXPORT QWebGraphicsItem : public QGraphicsWidget {
+class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
Q_OBJECT
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
@@ -49,8 +49,8 @@ class QWEBKIT_EXPORT QWebGraphicsItem : public QGraphicsWidget {
Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactivityChanged)
public:
- QWebGraphicsItem(QGraphicsItem* parent = 0);
- ~QWebGraphicsItem();
+ QGraphicsWebView(QGraphicsItem* parent = 0);
+ ~QGraphicsWebView();
QWebPage* page() const;
void setPage(QWebPage*);
@@ -137,8 +137,8 @@ private:
Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message))
- QWebGraphicsItemPrivate* const d;
- friend class QWebGraphicsItemPrivate;
+ QGraphicsWebViewPrivate* const d;
+ friend class QGraphicsWebViewPrivate;
};
-#endif // QWebGraphicsItem_h
+#endif // QGraphicsWebView_h
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 45a38c6..942c3ea 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -66,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"
@@ -95,6 +99,7 @@
#include <QSslSocket>
#include <QStyle>
#include <QSysInfo>
+#include <QTextCharFormat>
#if QT_VERSION >= 0x040400
#include <QNetworkAccessManager>
#include <QNetworkRequest>
@@ -262,6 +267,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
, inspector(0)
, inspectorIsInternalOnly(false)
, viewportSize(QSize(0, 0))
+ , clickCausedFocus(false)
{
WebCore::InitializeLoggingChannelsIfNecessary();
JSC::initializeThreading();
@@ -627,6 +633,11 @@ void QWebPagePrivate::mousePressEvent(QMouseEvent *ev)
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()) {
@@ -640,6 +651,14 @@ 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)
@@ -745,6 +764,24 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev)
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)
@@ -761,6 +798,7 @@ void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
ev->setAccepted(accepted);
handleClipboard(ev, ev->button());
+ handleSoftwareInputPanel(ev->button());
}
#ifndef QT_NO_CONTEXTMENU
@@ -1087,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();
@@ -1196,41 +1274,89 @@ 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::ImCurrentSelection:
- return QVariant(selectedText());
- default:
- 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();
}
}
@@ -1491,11 +1617,10 @@ QWebPage::QWebPage(QObject *parent)
*/
QWebPage::~QWebPage()
{
- if (d->mainFrame) {
- FrameLoader *loader = d->mainFrame->d->frame->loader();
- if (loader)
- loader->detachFromParent();
- }
+ d->createMainFrame();
+ FrameLoader *loader = d->mainFrame->d->frame->loader();
+ if (loader)
+ loader->detachFromParent();
if (d->inspector)
d->inspector->setPage(0);
delete d;
@@ -1936,6 +2061,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkReques
*/
QString QWebPage::selectedText() const
{
+ d->createMainFrame();
return d->page->focusController()->focusedOrMainFrame()->selectedText();
}
@@ -2491,6 +2617,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);
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
index aecd860..41d1835 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
@@ -25,12 +25,12 @@
#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;
@@ -266,7 +266,8 @@ public:
QMenu *createStandardContextMenu();
enum Extension {
- ChooseMultipleFilesExtension
+ ChooseMultipleFilesExtension,
+ ErrorPageExtension
};
class ExtensionOption
{};
@@ -284,6 +285,24 @@ public:
QStringList fileNames;
};
+ enum ErrorDomain { QtNetwork, Http, WebKit };
+ class ErrorPageExtensionOption : public ExtensionOption {
+ public:
+ 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;
@@ -352,7 +371,7 @@ private:
friend class QWebFrame;
friend class QWebPagePrivate;
friend class QWebView;
- friend class QWebGraphicsItem;
+ friend class QGraphicsWebView;
friend class QWebInspector;
friend class WebCore::ChromeClientQt;
friend class WebCore::EditorClientQt;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
index 9f4216a..b9571fa 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
@@ -111,6 +111,7 @@ public:
void shortcutOverrideEvent(QKeyEvent*);
void leaveEvent(QEvent*);
void handleClipboard(QEvent*, Qt::MouseButton);
+ void handleSoftwareInputPanel(Qt::MouseButton);
bool handleScrolling(QKeyEvent*, WebCore::Frame*);
void setInspector(QWebInspector*);
@@ -143,6 +144,8 @@ public:
QPoint tripleClick;
QBasicTimer tripleClickTimer;
+ bool clickCausedFocus;
+
#if QT_VERSION < 0x040400
bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index 5f74f36..eedf7d1 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -356,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"));
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index a8b5c38..fd2768c 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,124 @@
+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 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-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.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index 40833f2..5d5df97 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -220,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()
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 0c636f6..67d974c 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -702,8 +702,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
@@ -719,32 +721,32 @@ 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(),
+ 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));
}
@@ -860,12 +862,46 @@ void FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest(unsigned long,
notImplemented();
}
+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.error = error.errorCode();
+ option.errorString = error.localizedDescription();
+
+ QWebPage::ErrorPageExtensionReturn output;
+ if (!page->extension(QWebPage::ErrorPageExtension, &option, &output))
+ return;
+
+ KURL baseUrl(output.baseUrl);
+ KURL failingUrl(QUrl(error.failingURL()));
+
+ 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_loadError = error;
+ if (!error.isNull() && !error.isCancellation())
+ callErrorPageExtension(error);
}
void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& error)
@@ -874,6 +910,8 @@ void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& erro
printf("%s - didFailLoadWithError\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
m_loadError = error;
+ if (!error.isNull() && !error.isCancellation())
+ callErrorPageExtension(error);
}
WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage()
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 8a7e428..66c4252 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/src/3rdparty/webkit/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);
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp
index 069bea2..f04cd29 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebview_snippet.cpp
@@ -13,22 +13,22 @@ void wrapInFunction()
//! [2]
- view->triggerPageAction(QWebPage::Copy);
+ view->triggerAction(QWebPage::Copy);
//! [2]
//! [3]
- view->page()->triggerAction(QWebPage::Stop);
+ view->page()->triggerPageAction(QWebPage::Stop);
//! [3]
//! [4]
- view->page()->triggerAction(QWebPage::GoBack);
+ view->page()->triggerPageAction(QWebPage::GoBack);
//! [4]
//! [5]
- view->page()->triggerAction(QWebPage::GoForward);
+ view->page()->triggerPageAction(QWebPage::GoForward);
//! [5]
}
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
index 39e90e7..cba6f11 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/qwebgraphicsitem.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/qgraphicswebview.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
-TARGET = tst_qwebgraphicsitem
+TARGET = tst_qgraphicswebview
include(../../../../WebKit.pri)
-SOURCES += tst_qwebgraphicsitem.cpp
+SOURCES += tst_qgraphicswebview.cpp
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index 731e342..1a57286 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebgraphicsitem/tst_qwebgraphicsitem.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -19,19 +19,19 @@
#include <QtTest/QtTest>
-#include <qwebgraphicsitem.h>
+#include <qgraphicswebview.h>
-class tst_QWebGraphicsItem : public QObject
+class tst_QGraphicsWebView : public QObject
{
Q_OBJECT
private slots:
- void qwebgraphicsitem();
+ void qgraphicswebview();
};
-void tst_QWebGraphicsItem::qwebgraphicsitem()
+void tst_QGraphicsWebView::qgraphicswebview()
{
- QWebGraphicsItem item;
+ QGraphicsWebView item;
item.url();
item.title();
item.icon();
@@ -53,6 +53,6 @@ void tst_QWebGraphicsItem::qwebgraphicsitem()
item.setContent(QByteArray());
}
-QTEST_MAIN(tst_QWebGraphicsItem)
+QTEST_MAIN(tst_QGraphicsWebView)
-#include "tst_qwebgraphicsitem.moc"
+#include "tst_qgraphicswebview.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 0fb05b8..8f9a740 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/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>
@@ -113,11 +114,10 @@ private slots:
void localURLSchemes();
void testOptionalJSObjects();
void testEnablePersistentStorage();
-
void consoleOutput();
+ void inputMethods();
-private:
-
+ void crashTests_LazyInitializationOfMainFrame();
private:
QWebView* m_view;
@@ -466,14 +466,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);
}
@@ -1200,6 +1205,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();
@@ -1301,5 +1394,26 @@ void tst_QWebPage::testEnablePersistentStorage()
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/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
index ec496e3..81cc8f3 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = qwebframe qwebpage qwebelement qwebgraphicsitem 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