summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/Api
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp77
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp26
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp25
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp9
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp15
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp88
9 files changed, 200 insertions, 51 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp
index 1e491c9..196f0b8 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.cpp
@@ -23,13 +23,17 @@
#include "qwebframe.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
+#include "QWebPageClient.h"
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include <QtGui/qapplication.h>
#include <QtGui/qgraphicssceneevent.h>
#include <QtGui/qstyleoption.h>
+#if defined(Q_WS_X11)
+#include <QX11Info>
+#endif
-class QWebGraphicsItemPrivate {
+class QWebGraphicsItemPrivate : public QWebPageClient {
public:
QWebGraphicsItemPrivate(QWebGraphicsItem* parent)
: q(parent)
@@ -38,10 +42,17 @@ public:
, progress(1.0)
{}
- void _q_doScroll(int dx, int dy, const QRect&);
+ virtual void scroll(int dx, int dy, const QRect&);
+ virtual void update(const QRect& dirtyRect);
+
+ virtual QCursor cursor() const;
+ virtual void updateCursor(const QCursor& cursor);
+
+ virtual int screenNumber() const;
+ virtual WId winId() const;
+
void _q_doLoadProgress(int progress);
void _q_doLoadFinished(bool success);
- void _q_doUpdate(const QRect& dirtyRect);
void _q_setStatusBarMessage(const QString& message);
QWebGraphicsItem* q;
@@ -74,16 +85,48 @@ void QWebGraphicsItemPrivate::_q_doLoadFinished(bool success)
emit q->loadFailed();
}
-void QWebGraphicsItemPrivate::_q_doScroll(int dx, int dy, const QRect& rectToScroll)
+void QWebGraphicsItemPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
{
q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll));
}
-void QWebGraphicsItemPrivate::_q_doUpdate(const QRect & dirtyRect)
+void QWebGraphicsItemPrivate::update(const QRect & dirtyRect)
{
q->update(QRectF(dirtyRect));
}
+QCursor QWebGraphicsItemPrivate::cursor() const
+{
+ return q->cursor();
+}
+
+void QWebGraphicsItemPrivate::updateCursor(const QCursor& cursor)
+{
+ q->setCursor(cursor);
+}
+
+int QWebGraphicsItemPrivate::screenNumber() const
+{
+#if defined(Q_WS_X11)
+ const QList<QGraphicsView*> views = q->scene()->views();
+
+ if (!views.isEmpty())
+ return views.at(0)->x11Info().screen();
+#endif
+
+ return 0;
+}
+
+WId QWebGraphicsItemPrivate::winId() const
+{
+ const QList<QGraphicsView*> views = q->scene()->views();
+
+ if (!views.isEmpty())
+ return views.at(0)->winId();
+
+ return 0;
+}
+
void QWebGraphicsItemPrivate::_q_setStatusBarMessage(const QString& s)
{
statusBarMessage = s;
@@ -175,6 +218,24 @@ bool QWebGraphicsItem::sceneEvent(QEvent* event)
bool QWebGraphicsItem::event(QEvent* event)
{
// Re-implemented in order to allows fixing event-related bugs in patch releases.
+
+ if (d->page) {
+#ifndef QT_NO_CURSOR
+#if QT_VERSION >= 0x040400
+ } else if (event->type() == QEvent::CursorChange) {
+ // An unsetCursor will set the cursor to Qt::ArrowCursor.
+ // Thus this cursor change might be a QWidget::unsetCursor()
+ // If this is not the case and it came from WebCore, the
+ // QWebPageClient already has set its cursor internally
+ // to Qt::ArrowCursor, so updating the cursor is always
+ // right, as it falls back to the last cursor set by
+ // WebCore.
+ // FIXME: Add a QEvent::CursorUnset or similar to Qt.
+ if (cursor().shape() == Qt::ArrowCursor)
+ d->resetCursor();
+#endif
+#endif
+ }
return QGraphicsWidget::event(event);
}
@@ -193,6 +254,7 @@ void QWebGraphicsItem::setPage(QWebPage* page)
return;
if (d->page) {
+ d->page->d->client = 0; // unset the page client
if (d->page->parent() == this)
delete d->page;
else
@@ -202,6 +264,7 @@ void QWebGraphicsItem::setPage(QWebPage* page)
d->page = page;
if (!d->page)
return;
+ d->page->d->client = d; // set the page client
QSize size = geometry().size().toSize();
page->setViewportSize(size);
@@ -220,10 +283,6 @@ void QWebGraphicsItem::setPage(QWebPage* page)
this, SLOT(_q_doLoadProgress(int)));
connect(d->page, SIGNAL(loadFinished(bool)),
this, SLOT(_q_doLoadFinished(bool)));
- connect(d->page, SIGNAL(repaintRequested(QRect)),
- this, SLOT(_q_doUpdate(const QRect&)));
- connect(d->page, SIGNAL(scrollRequested(int, int, const QRect&)),
- this, SLOT(_q_doScroll(int, int, const QRect&)));
connect(d->page, SIGNAL(statusBarMessage(const QString&)),
this, SLOT(_q_setStatusBarMessage(const QString&)));
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h
index 223ac42..2c6817a 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebgraphicsitem.h
@@ -133,10 +133,8 @@ protected:
virtual bool sceneEvent(QEvent*);
private:
- Q_PRIVATE_SLOT(d, void _q_doScroll(int dx, int dy, const QRect&))
Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress))
Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
- Q_PRIVATE_SLOT(d, void _q_doUpdate(const QRect& dirtyRect))
Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message))
QWebGraphicsItemPrivate* const d;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp
index 7923275..5752d66 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "qwebhistory.h"
#include "qwebhistory_p.h"
+#include "qwebframe_p.h"
#include "PlatformString.h"
#include "Image.h"
@@ -267,6 +268,8 @@ void QWebHistory::clear()
lst->setCapacity(capacity); //revert capacity
lst->addItem(current.get()); //insert old current item
lst->goToItem(current.get()); //and set it as current again
+
+ d->page()->updateNavigationActions();
}
/*!
@@ -353,9 +356,11 @@ bool QWebHistory::canGoForward() const
*/
void QWebHistory::back()
{
- d->lst->goBack();
- WebCore::Page* page = d->lst->page();
- page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ if (canGoBack()) {
+ d->lst->goBack();
+ WebCore::Page* page = d->lst->page();
+ page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ }
}
/*!
@@ -366,9 +371,11 @@ void QWebHistory::back()
*/
void QWebHistory::forward()
{
- d->lst->goForward();
- WebCore::Page* page = d->lst->page();
- page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ if (canGoForward()) {
+ d->lst->goForward();
+ WebCore::Page* page = d->lst->page();
+ page->goToItem(currentItem().d->item, WebCore::FrameLoadTypeIndexedBackForward);
+ }
}
/*!
@@ -516,6 +523,8 @@ bool QWebHistory::restoreState(const QByteArray& buffer)
default: {} // result is false;
}
+ d->page()->updateNavigationActions();
+
return result;
};
@@ -597,4 +606,7 @@ QDataStream& operator>>(QDataStream& stream, QWebHistory& history)
return stream;
}
-
+QWebPagePrivate* QWebHistoryPrivate::page()
+{
+ return QWebFramePrivate::kit(lst->page()->mainFrame())->page()->handle();
+}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h
index 809d405..a6682cd 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistory_p.h
@@ -25,6 +25,8 @@
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
+class QWebPagePrivate;
+
class Q_AUTOTEST_EXPORT QWebHistoryItemPrivate : public QSharedData {
public:
static QExplicitlySharedDataPointer<QWebHistoryItemPrivate> get(QWebHistoryItem* q)
@@ -57,6 +59,9 @@ public:
{
lst->deref();
}
+
+ QWebPagePrivate* page();
+
WebCore::BackForwardList* lst;
};
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
index 5a66cc6..4578dc9 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
@@ -28,8 +28,6 @@
#include <QResizeEvent>
-// TODO: handle the "Always enable" commands with QWebSettings
-
/*!
\class QWebInspector
\since 4.6
@@ -44,6 +42,14 @@
\snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0
+ \note A QWebInspector will display a blank widget if either:
+ \list
+ \o page() is null
+ \o QWebSettings::DeveloperExtrasEnabled is false
+ \endlist
+
+ \section1 Resources
+
Most of the resources needed by the inspector are owned by the associated
QWebPage and are allocated the first time that:
\list
@@ -56,13 +62,16 @@
the first emission of QWebPage::webInspectorTriggered() to save additional
resources.
- \note A QWebInspector will display a blank widget if either:
- \list
- \o page() is null
- \o QWebSettings::DeveloperExtrasEnabled is false
- \endlist
+ \section1 Inspector configuration persistence
+
+ The inspector allows the user to configure some options through its
+ interface (e.g. the resource tracking "Always enable" option).
+ These settings are persisted automatically by QtWebKit using QSettings.
- \sa QWebPage::webInspectorTriggered()
+ However since the QSettings object is instantiated using the empty
+ constructor, QCoreApplication::setOrganizationName() and
+ QCoreApplication::setApplicationName() must be called within your
+ application to enable the persistence of these options.
*/
/*!
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 98c0770..a6942a4 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -256,6 +256,7 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
: q(qq)
+ , client(0)
, view(0)
, inspectorFrontend(0)
, inspector(0)
@@ -1554,8 +1555,10 @@ QWebHistory *QWebPage::history() const
*/
void QWebPage::setView(QWidget *view)
{
- d->view = view;
- setViewportSize(view ? view->size() : QSize(0, 0));
+ if (d->view != view) {
+ d->view = view;
+ setViewportSize(view ? view->size() : QSize(0, 0));
+ }
}
/*!
@@ -2909,9 +2912,11 @@ QString QWebPage::userAgentForUrl(const QUrl& url) const
case QSysInfo::WV_VISTA:
ver = "Windows NT 6.0";
break;
+#if QT_VERSION > 0x040500
case QSysInfo::WV_WINDOWS7:
ver = "Windows NT 6.1";
break;
+#endif
case QSysInfo::WV_CE:
ver = "Windows CE";
break;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
index f765f98..9f4216a 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
@@ -56,6 +56,7 @@ class QBitArray;
QT_END_NAMESPACE
class QWebInspector;
+class QWebPageClient;
class QWebPagePrivate {
public:
@@ -129,10 +130,11 @@ public:
QPointer<QWebFrame> mainFrame;
QWebPage *q;
+ QWebPageClient* client;
#ifndef QT_NO_UNDOSTACK
QUndoStack *undoStack;
#endif
- QWidget *view;
+ QWidget* view;
bool insideOpenCall;
quint64 m_totalBytes;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index e99ebbf..5f74f36 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -440,7 +440,10 @@ void QWebSettings::resetFontSize(FontSize type)
/*!
Specifies the location of a user stylesheet to load with every web page.
- The \a location can be a URL or a path on the local filesystem.
+ The \a location must be either a path on the local filesystem, or a data URL
+ with UTF-8 and Base64 encoded data, such as:
+
+ "data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow==;"
\sa userStyleSheetUrl()
*/
@@ -635,7 +638,15 @@ void QWebSettings::clearMemoryCaches()
}
/*!
- Sets the maximum number of pages to hold in the memory cache to \a pages.
+ Sets the maximum number of pages to hold in the memory page cache to \a pages.
+
+ The Page Cache allows for a nicer user experience when navigating forth or back
+ to pages in the forward/back history, by pausing and resuming up to \a pages
+ per page group.
+
+ For more information about the feature, please refer to:
+
+ http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
*/
void QWebSettings::setMaximumPagesInCache(int pages)
{
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index d12de94..c7515ab 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "qwebview.h"
+
+#include "QWebPageClient.h"
#include "qwebframe.h"
#include "qwebpage_p.h"
@@ -29,14 +31,28 @@
#include "qprinter.h"
#include "qdir.h"
#include "qfile.h"
+#if defined(Q_WS_X11)
+#include <QX11Info>
+#endif
-class QWebViewPrivate {
+class QWebViewPrivate : public QWebPageClient {
public:
QWebViewPrivate(QWebView *view)
: view(view)
, page(0)
, renderHints(QPainter::TextAntialiasing)
- {}
+ {
+ Q_ASSERT(view);
+ }
+
+ virtual void scroll(int dx, int dy, const QRect&);
+ virtual void update(const QRect& dirtyRect);
+
+ virtual QCursor cursor() const;
+ virtual void updateCursor(const QCursor& cursor);
+
+ virtual int screenNumber() const;
+ virtual WId winId() const;
void _q_pageDestroyed();
@@ -46,6 +62,44 @@ public:
QPainter::RenderHints renderHints;
};
+void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll)
+{
+ view->scroll(qreal(dx), qreal(dy), rectToScroll);
+}
+
+void QWebViewPrivate::update(const QRect & dirtyRect)
+{
+ view->update(dirtyRect);
+}
+
+QCursor QWebViewPrivate::cursor() const
+{
+ return view->cursor();
+}
+
+void QWebViewPrivate::updateCursor(const QCursor& cursor)
+{
+ view->setCursor(cursor);
+}
+
+int QWebViewPrivate::screenNumber() const
+{
+#if defined(Q_WS_X11)
+ if (view)
+ return view->x11Info().screen();
+#endif
+
+ return 0;
+}
+
+WId QWebViewPrivate::winId() const
+{
+ if (view)
+ return view->winId();
+
+ return 0;
+}
+
void QWebViewPrivate::_q_pageDestroyed()
{
page = 0;
@@ -195,6 +249,7 @@ void QWebView::setPage(QWebPage* page)
if (d->page == page)
return;
if (d->page) {
+ d->page->d->client = 0; // unset the page client
if (d->page->parent() == this)
delete d->page;
else
@@ -203,6 +258,7 @@ void QWebView::setPage(QWebPage* page)
d->page = page;
if (d->page) {
d->page->setView(this);
+ d->page->d->client = d; // set the page client
d->page->setPalette(palette());
// #### connect signals
QWebFrame *mainFrame = d->page->mainFrame();
@@ -682,24 +738,16 @@ bool QWebView::event(QEvent *e)
#ifndef QT_NO_CURSOR
#if QT_VERSION >= 0x040400
} else if (e->type() == QEvent::CursorChange) {
- // might be a QWidget::unsetCursor()
- if (cursor().shape() == Qt::ArrowCursor) {
- QVariant prop = property("WebCoreCursor");
- if (prop.isValid()) {
- QCursor webCoreCursor = qvariant_cast<QCursor>(prop);
- if (webCoreCursor.shape() != Qt::ArrowCursor)
- setCursor(webCoreCursor);
- }
- }
- } else if (e->type() == QEvent::DynamicPropertyChange) {
- const QByteArray& propName = static_cast<QDynamicPropertyChangeEvent *>(e)->propertyName();
- if (!qstrcmp(propName, "WebCoreCursor")) {
- QVariant prop = property("WebCoreCursor");
- if (prop.isValid()) {
- QCursor webCoreCursor = qvariant_cast<QCursor>(prop);
- setCursor(webCoreCursor);
- }
- }
+ // An unsetCursor will set the cursor to Qt::ArrowCursor.
+ // Thus this cursor change might be a QWidget::unsetCursor()
+ // If this is not the case and it came from WebCore, the
+ // QWebPageClient already has set its cursor internally
+ // to Qt::ArrowCursor, so updating the cursor is always
+ // right, as it falls back to the last cursor set by
+ // WebCore.
+ // FIXME: Add a QEvent::CursorUnset or similar to Qt.
+ if (cursor().shape() == Qt::ArrowCursor)
+ d->resetCursor();
#endif
#endif
} else if (e->type() == QEvent::Leave)