summaryrefslogtreecommitdiff
path: root/Source/WebKit/qt
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-23 15:08:59 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-23 15:09:20 +0100
commit061d58bc0fa016cfeed744fd3e4663460635d69b (patch)
treead9b8b032c803e1c9054c23fa1b7a0f1976bf98f /Source/WebKit/qt
parent470286ecfe79d59df14944e5b5d34630fc739391 (diff)
downloadqtwebkit-061d58bc0fa016cfeed744fd3e4663460635d69b.tar.gz
Imported WebKit commit 8eb048315f36fa33731f28694630fe4a3c2cbc99 (http://svn.webkit.org/repository/webkit/trunk@135602)
New snapshot that fixes various bugs Change-Id: Icb6ce541a26a9f500d087821ce4b83a8d8a5474a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit/qt')
-rw-r--r--Source/WebKit/qt/Api/qgraphicswebview.cpp6
-rw-r--r--Source/WebKit/qt/Api/qwebelement.cpp6
-rw-r--r--Source/WebKit/qt/Api/qwebframe.cpp227
-rw-r--r--Source/WebKit/qt/Api/qwebframe.h7
-rw-r--r--Source/WebKit/qt/Api/qwebframe_p.h62
-rw-r--r--Source/WebKit/qt/Api/qwebhistory.cpp7
-rw-r--r--Source/WebKit/qt/Api/qwebhistory_p.h4
-rw-r--r--Source/WebKit/qt/Api/qwebinspector.cpp4
-rw-r--r--Source/WebKit/qt/Api/qwebinspector_p.h2
-rw-r--r--Source/WebKit/qt/Api/qwebkitglobal.h14
-rw-r--r--Source/WebKit/qt/Api/qwebpage.cpp718
-rw-r--r--Source/WebKit/qt/Api/qwebpage.h6
-rw-r--r--Source/WebKit/qt/Api/qwebpage_p.h126
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp34
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.h1
-rw-r--r--Source/WebKit/qt/Api/qwebview.cpp4
-rw-r--r--Source/WebKit/qt/ChangeLog659
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp215
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h16
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp72
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h50
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DragClientQt.h8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp399
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h145
-rw-r--r--Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp91
-rw-r--r--Source/WebKit/qt/WebCoreSupport/EditorClientQt.h10
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp443
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h25
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp17
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h5
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp51
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h19
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp23
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp27
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h13
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp30
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h16
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp50
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h29
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp114
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h19
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp71
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h53
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp18
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h6
-rw-r--r--Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp36
-rw-r--r--Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h34
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp19
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PageClientQt.h37
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp17
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp66
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h47
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp210
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h114
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp104
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h172
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp44
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h43
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp72
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h44
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp15
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h38
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h3
-rw-r--r--Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp19
-rw-r--r--Source/WebKit/qt/WebCoreSupport/UndoStepQt.h17
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp135
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebEventConversion.h23
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h5
-rw-r--r--Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp128
79 files changed, 3600 insertions, 1806 deletions
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp
index ef42c9518..84b4e801b 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp
@@ -88,7 +88,7 @@ public:
PageClientQGraphicsWidget* pageClient() const
{
- return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get());
+ return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.data());
}
};
@@ -468,7 +468,7 @@ void QGraphicsWebViewPrivate::detachCurrentPage()
return;
page->d->view = 0;
- page->d->client = nullptr;
+ page->d->client.reset();
// if the page was created by us, we own it and need to
// destroy it as well.
@@ -501,7 +501,7 @@ void QGraphicsWebView::setPage(QWebPage* page)
if (!d->page)
return;
- d->page->d->client = adoptPtr(new PageClientQGraphicsWidget(this, page));
+ d->page->d->client.reset(new PageClientQGraphicsWidget(this, page));
if (d->overlay())
d->overlay()->prepareGraphicsItemGeometryChange();
diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp
index 108b9b06f..82f579d95 100644
--- a/Source/WebKit/qt/Api/qwebelement.cpp
+++ b/Source/WebKit/qt/Api/qwebelement.cpp
@@ -39,6 +39,7 @@
#include "JSHTMLElement.h"
#include "JSObject.h"
#include "PropertyNameArray.h"
+#include <QWebFrameAdapter.h>
#include <parser/SourceCode.h>
#include "qt_runtime.h"
#include "NodeList.h"
@@ -47,8 +48,6 @@
#include "StaticNodeList.h"
#include "StyleResolver.h"
#include "markup.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
#include "runtime_root.h"
#include <JSDocument.h>
#include <wtf/Vector.h>
@@ -706,7 +705,8 @@ QWebFrame *QWebElement::webFrame() const
Frame* frame = document->frame();
if (!frame)
return 0;
- return QWebFramePrivate::kit(frame);
+ QWebFrameAdapter* frameAdapter = QWebFrameAdapter::kit(frame);
+ return frameAdapter->apiHandle();
}
static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController)
diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp
index 1310348ed..89474dd2e 100644
--- a/Source/WebKit/qt/Api/qwebframe.cpp
+++ b/Source/WebKit/qt/Api/qwebframe.cpp
@@ -106,54 +106,6 @@ QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT int qt_defaultDpi();
QT_END_NAMESPACE
-static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl)
-{
- switch (cacheLoadControl) {
- case QNetworkRequest::AlwaysNetwork:
- return WebCore::ReloadIgnoringCacheData;
- case QNetworkRequest::PreferCache:
- return WebCore::ReturnCacheDataElseLoad;
- case QNetworkRequest::AlwaysCache:
- return WebCore::ReturnCacheDataDontLoad;
- default:
- break;
- }
- return WebCore::UseProtocolCachePolicy;
-}
-
-QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame,
- WebCore::HTMLFrameOwnerElement* ownerFrameElement,
- const WTF::String& frameName)
- : name(frameName)
- , ownerElement(ownerFrameElement)
- , page(parentPage)
- , allowsScrolling(true)
- , marginWidth(0)
- , marginHeight(0)
-{
- frameLoaderClient = new FrameLoaderClientQt();
- frame = Frame::create(page, ownerElement, frameLoaderClient);
-
- // FIXME: All of the below should probably be moved over into WebCore
- frame->tree()->setName(name);
- if (parentFrame)
- parentFrame->tree()->appendChild(frame);
-}
-
-void QWebFramePrivate::init(QWebFrame *qframe, QWebFrameData *frameData)
-{
- q = qframe;
-
- allowsScrolling = frameData->allowsScrolling;
- marginWidth = frameData->marginWidth;
- marginHeight = frameData->marginHeight;
- frame = frameData->frame.get();
- frameLoaderClient = frameData->frameLoaderClient;
- frameLoaderClient->setFrame(qframe, frame);
-
- frame->init();
-}
-
void QWebFramePrivate::setPage(QWebPage* newPage)
{
if (page == newPage)
@@ -166,6 +118,7 @@ void QWebFramePrivate::setPage(QWebPage* newPage)
q->setParent(newPage);
page = newPage;
+ pageAdapter = newPage->handle();
emit q->pageChanged();
}
@@ -375,6 +328,11 @@ void QWebFramePrivate::emitUrlChanged()
emit q->urlChanged(url);
}
+void QWebFramePrivate::didStartProvisionalLoad()
+{
+ emit q->provisionalLoad();
+}
+
void QWebFramePrivate::_q_orientationChanged()
{
#if ENABLE(ORIENTATION_EVENTS)
@@ -409,6 +367,65 @@ void QWebFramePrivate::didClearWindowObject()
emit q->javaScriptWindowObjectCleared();
}
+bool QWebFramePrivate::handleProgressFinished(QPoint *localPos)
+{
+ QWidget *view = q->page()->view();
+ if (!view || !localPos)
+ return false;
+ *localPos = view->mapFromGlobal(QCursor::pos());
+ return view->hasFocus() && view->rect().contains(*localPos);
+}
+
+void QWebFramePrivate::emitInitialLayoutCompleted()
+{
+ emit q->initialLayoutCompleted();
+}
+
+void QWebFramePrivate::emitIconChanged()
+{
+ emit q->iconChanged();
+}
+
+void QWebFramePrivate::emitLoadStarted(bool originatingLoad)
+{
+ if (page && originatingLoad)
+ emit page->loadStarted();
+ emit q->loadStarted();
+}
+
+void QWebFramePrivate::emitLoadFinished(bool originatingLoad, bool ok)
+{
+ if (page && originatingLoad)
+ emit page->loadFinished(ok);
+ emit q->loadFinished(ok);
+}
+
+QWebFrameAdapter* QWebFramePrivate::createChildFrame(QWebFrameData* frameData)
+{
+ QWebFrame* newFrame = new QWebFrame(/*parent frame*/q, frameData);
+ return newFrame->d;
+}
+
+QWebFrame *QWebFramePrivate::apiHandle()
+{
+ return q;
+}
+
+QObject *QWebFramePrivate::handle()
+{
+ return q;
+}
+
+void QWebFramePrivate::contentsSizeDidChange(const QSize &size)
+{
+ emit q->contentsSizeChanged(size);
+}
+
+int QWebFramePrivate::scrollBarPolicy(Qt::Orientation orientation) const
+{
+ return (int) q->scrollBarPolicy(orientation);
+}
+
/*!
\class QWebFrame
\since 4.4
@@ -472,29 +489,27 @@ void QWebFramePrivate::didClearWindowObject()
\value AllLayers Includes all the above layers
*/
-QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
- : QObject(parent)
+QWebFrame::QWebFrame(QWebPage *parentPage)
+ : QObject(parentPage)
, d(new QWebFramePrivate)
{
- d->page = parent;
- d->init(this, frameData);
+ d->page = parentPage;
+ d->q = this;
+ d->init(/*page adapter*/ parentPage->handle());
- if (!frameData->url.isEmpty()) {
- WebCore::ResourceRequest request(frameData->url, frameData->referrer);
- d->frame->loader()->load(request, frameData->name, false);
- }
#if ENABLE(ORIENTATION_EVENTS)
connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
d->m_orientation.start();
#endif
}
-QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
+QWebFrame::QWebFrame(QWebFrame* parent, QWebFrameData* frameData)
: QObject(parent)
, d(new QWebFramePrivate)
{
d->page = parent->d->page;
- d->init(this, frameData);
+ d->q = this;
+ d->init(parent->d->pageAdapter, frameData);
#if ENABLE(ORIENTATION_EVENTS)
connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
d->m_orientation.start();
@@ -503,9 +518,6 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
QWebFrame::~QWebFrame()
{
- if (d->frame && d->frame->loader() && d->frame->loader()->client())
- static_cast<FrameLoaderClientQt*>(d->frame->loader()->client())->m_webFrame = 0;
-
delete d;
}
@@ -674,22 +686,6 @@ static inline bool isCoreFrameClear(WebCore::Frame* frame)
return frame->document()->url().isEmpty();
}
-static inline QUrl ensureAbsoluteUrl(const QUrl &url)
-{
- if (!url.isValid() || !url.isRelative())
- return url;
-
- // This contains the URL with absolute path but without
- // the query and the fragment part.
- QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath());
-
- // The path is removed so the query and the fragment parts are there.
- QString pathRemoved = url.toString(QUrl::RemovePath);
- QUrl toResolve(pathRemoved);
-
- return baseUrl.resolved(toResolve);
-}
-
/*!
\property QWebFrame::url
\brief the url of the frame currently viewed
@@ -704,7 +700,7 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url)
void QWebFrame::setUrl(const QUrl &url)
{
clearCoreFrame(d->frame);
- const QUrl absolute = ensureAbsoluteUrl(url);
+ const QUrl absolute = QWebFrameAdapter::ensureAbsoluteUrl(url);
d->url = absolute;
load(absolute);
}
@@ -798,58 +794,7 @@ void QWebFrame::load(const QNetworkRequest &req,
QNetworkAccessManager::Operation operation,
const QByteArray &body)
{
- if (d->parentFrame())
- d->page->d->insideOpenCall = true;
-
- QUrl url = ensureAbsoluteUrl(req.url());
-
- WebCore::ResourceRequest request(url);
-
- switch (operation) {
- case QNetworkAccessManager::HeadOperation:
- request.setHTTPMethod("HEAD");
- break;
- case QNetworkAccessManager::GetOperation:
- request.setHTTPMethod("GET");
- break;
- case QNetworkAccessManager::PutOperation:
- request.setHTTPMethod("PUT");
- break;
- case QNetworkAccessManager::PostOperation:
- request.setHTTPMethod("POST");
- break;
- case QNetworkAccessManager::DeleteOperation:
- request.setHTTPMethod("DELETE");
- break;
- case QNetworkAccessManager::CustomOperation:
- request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData());
- break;
- case QNetworkAccessManager::UnknownOperation:
- // eh?
- break;
- }
-
- QVariant cacheLoad = req.attribute(QNetworkRequest::CacheLoadControlAttribute);
- if (cacheLoad.isValid()) {
- bool ok;
- uint cacheLoadValue = cacheLoad.toUInt(&ok);
- if (ok)
- request.setCachePolicy(cacheLoadControlToCachePolicy(cacheLoadValue));
- }
-
- QList<QByteArray> httpHeaders = req.rawHeaderList();
- for (int i = 0; i < httpHeaders.size(); ++i) {
- const QByteArray &headerName = httpHeaders.at(i);
- request.addHTTPHeaderField(QString::fromLatin1(headerName), QString::fromLatin1(req.rawHeader(headerName)));
- }
-
- if (!body.isEmpty())
- request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size()));
-
- d->frame->loader()->load(request, false);
-
- if (d->parentFrame())
- d->page->d->insideOpenCall = false;
+ d->load(req, operation, body);
}
/*!
@@ -1088,10 +1033,7 @@ void QWebFrame::scroll(int dx, int dy)
QPoint QWebFrame::scrollPosition() const
{
- if (!d->frame->view())
- return QPoint(0, 0);
-
- IntSize ofs = d->frame->view()->scrollOffset();
+ IntSize ofs = d->scrollPosition();
return QPoint(ofs.width(), ofs.height());
}
@@ -1248,9 +1190,7 @@ QPoint QWebFrame::pos() const
*/
QRect QWebFrame::geometry() const
{
- if (!d->frame->view())
- return QRect();
- return d->frame->view()->frameRect();
+ return d->frameRect();
}
/*!
@@ -1479,6 +1419,11 @@ QWebFrame* QWebFramePrivate::kit(const WebCore::Frame* coreFrame)
return qobject_cast<QWebFrame*>(coreFrame->loader()->networkingContext()->originatingObject());
}
+QWebFrame *QWebFramePrivate::kit(const QWebFrameAdapter* frameAdapter)
+{
+ return static_cast<const QWebFramePrivate*>(frameAdapter)->q;
+}
+
/*!
\fn void QWebFrame::javaScriptWindowObjectCleared()
@@ -1859,4 +1804,12 @@ QWebFrame *QWebHitTestResult::frame() const
return d->frame.data();
}
+/*!
+ * \internal
+ */
+QWebFrameAdapter *QWebFrame::handle() const
+{
+ return d;
+}
+
#include "moc_qwebframe.cpp"
diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/Api/qwebframe.h
index ca96661e3..fe00d81f5 100644
--- a/Source/WebKit/qt/Api/qwebframe.h
+++ b/Source/WebKit/qt/Api/qwebframe.h
@@ -41,8 +41,10 @@ class QPrinter;
QT_END_NAMESPACE
class QWebNetworkRequest;
+class QWebFrameAdapter;
class QWebFramePrivate;
class QWebPage;
+class QWebPageAdapter;
class QWebHitTestResult;
class QWebHistoryItem;
class QWebSecurityOrigin;
@@ -115,8 +117,8 @@ class QWEBKIT_EXPORT QWebFrame : public QObject {
Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition)
Q_PROPERTY(bool focus READ hasFocus)
private:
- QWebFrame(QWebPage *parent, QWebFrameData *frameData);
- QWebFrame(QWebFrame *parent, QWebFrameData *frameData);
+ QWebFrame(QWebPage *parentPage);
+ QWebFrame(QWebFrame* parent, QWebFrameData*);
~QWebFrame();
public:
@@ -200,6 +202,7 @@ public:
virtual bool event(QEvent *);
QWebSecurityOrigin securityOrigin() const;
+ QWebFrameAdapter* handle() const;
public Q_SLOTS:
QVariant evaluateJavaScript(const QString& scriptSource);
diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h
index d6779f2bc..dbdcbc85a 100644
--- a/Source/WebKit/qt/Api/qwebframe_p.h
+++ b/Source/WebKit/qt/Api/qwebframe_p.h
@@ -21,24 +21,25 @@
#ifndef QWEBFRAME_P_H
#define QWEBFRAME_P_H
+#include "QWebFrameAdapter.h"
+
#include "qwebframe.h"
#include "qwebpage_p.h"
#include "EventHandler.h"
+#include "Frame.h"
#include "GraphicsContext.h"
#include "KURL.h"
#if ENABLE(ORIENTATION_EVENTS)
#include "qorientationsensor.h"
#endif // ENABLE(ORIENTATION_EVENTS).
#include "qwebelement.h"
-#include "wtf/RefPtr.h"
-#include "Frame.h"
-#include "ViewportArguments.h"
-#include <wtf/text/WTFString.h>
-
#if USE(ACCELERATED_COMPOSITING)
#include "texmap/TextureMapper.h"
#endif
+#include "ViewportArguments.h"
+#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -50,42 +51,17 @@ namespace WebCore {
}
class QWebPage;
-class QWebFrameData {
-public:
- QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0,
- WebCore::HTMLFrameOwnerElement* = 0,
- const WTF::String& frameName = WTF::String());
-
- WebCore::KURL url;
- WTF::String name;
- WebCore::HTMLFrameOwnerElement* ownerElement;
- WebCore::Page* page;
- RefPtr<WebCore::Frame> frame;
- WebCore::FrameLoaderClientQt* frameLoaderClient;
-
- WTF::String referrer;
- bool allowsScrolling;
- int marginWidth;
- int marginHeight;
-};
-
-class QWebFramePrivate {
+class QWebFramePrivate : public QWebFrameAdapter {
public:
QWebFramePrivate()
: q(0)
, horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded)
, verticalScrollBarPolicy(Qt::ScrollBarAsNeeded)
- , frameLoaderClient(0)
- , frame(0)
, page(0)
- , allowsScrolling(true)
- , marginWidth(-1)
- , marginHeight(-1)
#if USE(ACCELERATED_COMPOSITING)
, rootTextureMapperLayer(0)
#endif
{}
- void init(QWebFrame* qframe, QWebFrameData* frameData);
void setPage(QWebPage*);
inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); }
@@ -95,6 +71,7 @@ public:
static WebCore::Frame* core(const QWebFrame*);
static QWebFrame* kit(const WebCore::Frame*);
+ static QWebFrame* kit(const QWebFrameAdapter*);
void renderRelativeCoords(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
#if USE(TILED_BACKING_STORE)
@@ -105,22 +82,29 @@ public:
void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip);
#endif
void renderFrameExtras(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
- void emitUrlChanged();
void _q_orientationChanged();
- void didClearWindowObject();
+
+ // Adapter implementation
+ virtual QWebFrame* apiHandle() OVERRIDE;
+ virtual QObject* handle() OVERRIDE;
+ virtual void contentsSizeDidChange(const QSize &) OVERRIDE;
+ virtual int scrollBarPolicy(Qt::Orientation) const OVERRIDE;
+ virtual void emitUrlChanged() OVERRIDE;
+ virtual void didStartProvisionalLoad() OVERRIDE;
+ virtual void didClearWindowObject() OVERRIDE;
+ virtual bool handleProgressFinished(QPoint*) OVERRIDE;
+ virtual void emitInitialLayoutCompleted() OVERRIDE;
+ virtual void emitIconChanged() OVERRIDE;
+ virtual void emitLoadStarted(bool originatingLoad) OVERRIDE;
+ virtual void emitLoadFinished(bool originatingLoad, bool ok) OVERRIDE;
+ virtual QWebFrameAdapter* createChildFrame(QWebFrameData*) OVERRIDE;
QWebFrame *q;
Qt::ScrollBarPolicy horizontalScrollBarPolicy;
Qt::ScrollBarPolicy verticalScrollBarPolicy;
- WebCore::FrameLoaderClientQt *frameLoaderClient;
- WebCore::Frame *frame;
QWebPage *page;
- WebCore::KURL url;
- bool allowsScrolling;
- int marginWidth;
- int marginHeight;
#if USE(ACCELERATED_COMPOSITING)
WebCore::TextureMapperLayer* rootTextureMapperLayer;
OwnPtr<WebCore::TextureMapper> textureMapper;
diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp
index f7849666e..a945b592b 100644
--- a/Source/WebKit/qt/Api/qwebhistory.cpp
+++ b/Source/WebKit/qt/Api/qwebhistory.cpp
@@ -20,15 +20,16 @@
#include "config.h"
#include "qwebhistory.h"
#include "qwebhistory_p.h"
-#include "qwebframe_p.h"
#include "BackForwardListImpl.h"
+#include "Frame.h"
#include "IconDatabaseBase.h"
#include "Image.h"
#include "IntSize.h"
#include "KURL.h"
#include "Page.h"
#include "PageGroup.h"
+#include <QWebPageAdapter.h>
#include <wtf/text/WTFString.h>
#include <QSharedData>
@@ -552,9 +553,9 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history)
return source;
}
-QWebPagePrivate* QWebHistoryPrivate::page()
+QWebPageAdapter* QWebHistoryPrivate::page()
{
- return QWebFramePrivate::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page()->mainFrame())->page()->handle();
+ return QWebPageAdapter::kit(static_cast<WebCore::BackForwardListImpl*>(lst)->page());
}
WebCore::HistoryItem* QWebHistoryItemPrivate::core(const QWebHistoryItem* q)
diff --git a/Source/WebKit/qt/Api/qwebhistory_p.h b/Source/WebKit/qt/Api/qwebhistory_p.h
index aaee38632..17634ebc0 100644
--- a/Source/WebKit/qt/Api/qwebhistory_p.h
+++ b/Source/WebKit/qt/Api/qwebhistory_p.h
@@ -26,7 +26,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
-class QWebPagePrivate;
+class QWebPageAdapter;
class QWEBKIT_EXPORT QWebHistoryItemPrivate : public QSharedData {
public:
@@ -63,7 +63,7 @@ public:
lst->deref();
}
- QWebPagePrivate* page();
+ QWebPageAdapter* page();
WebCore::BackForwardListImpl* lst;
};
diff --git a/Source/WebKit/qt/Api/qwebinspector.cpp b/Source/WebKit/qt/Api/qwebinspector.cpp
index 2fbbab249..55089e1a1 100644
--- a/Source/WebKit/qt/Api/qwebinspector.cpp
+++ b/Source/WebKit/qt/Api/qwebinspector.cpp
@@ -184,12 +184,12 @@ void QWebInspector::closeEvent(QCloseEvent* event)
}
/*! \internal */
-void QWebInspectorPrivate::setFrontend(QWidget* newFrontend)
+void QWebInspectorPrivate::setFrontend(QObject* newFrontend)
{
if (frontend)
frontend->setParent(0);
- frontend = newFrontend;
+ frontend = qobject_cast<QWidget*>(newFrontend);
if (frontend) {
frontend->setParent(q);
diff --git a/Source/WebKit/qt/Api/qwebinspector_p.h b/Source/WebKit/qt/Api/qwebinspector_p.h
index 4d327cc5a..908de84ed 100644
--- a/Source/WebKit/qt/Api/qwebinspector_p.h
+++ b/Source/WebKit/qt/Api/qwebinspector_p.h
@@ -35,7 +35,7 @@ public:
, frontend(0)
{}
- void setFrontend(QWidget* newFrontend);
+ void setFrontend(QObject* newFrontend);
void adjustFrontendSize(const QSize& size);
QWebInspector* q;
diff --git a/Source/WebKit/qt/Api/qwebkitglobal.h b/Source/WebKit/qt/Api/qwebkitglobal.h
index 7ee56de86..947ba0654 100644
--- a/Source/WebKit/qt/Api/qwebkitglobal.h
+++ b/Source/WebKit/qt/Api/qwebkitglobal.h
@@ -28,22 +28,14 @@
// Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt.
#define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#if defined(QT_MAKEDLL) /* create a Qt DLL library */
+#ifndef QT_STATIC
# if defined(BUILDING_WEBKIT)
# define QWEBKIT_EXPORT Q_DECL_EXPORT
# else
# define QWEBKIT_EXPORT Q_DECL_IMPORT
# endif
-#elif defined(QT_DLL) /* use a Qt DLL library */
-# define QWEBKIT_EXPORT Q_DECL_IMPORT
-#endif
-
-#if !defined(QWEBKIT_EXPORT)
-# if defined(QT_SHARED)
-# define QWEBKIT_EXPORT Q_DECL_EXPORT
-# else
-# define QWEBKIT_EXPORT
-# endif
+#else
+# define QWEBKIT_EXPORT
#endif
#endif // QWEBKITGLOBAL_H
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp
index 02383ac67..65624d190 100644
--- a/Source/WebKit/qt/Api/qwebpage.cpp
+++ b/Source/WebKit/qt/Api/qwebpage.cpp
@@ -22,18 +22,6 @@
#include "config.h"
#include "qwebpage.h"
-#include "qwebview.h"
-#include "qwebframe.h"
-#include "qwebpage_p.h"
-#include "qwebframe_p.h"
-#include "qwebhistory.h"
-#include "qwebhistory_p.h"
-#include "qwebinspector.h"
-#include "qwebinspector_p.h"
-#include "qwebsettings.h"
-#include "qwebkitplatformplugin.h"
-#include "qwebkitversion.h"
-
#include "CSSComputedStyleDeclaration.h"
#include "CSSParser.h"
#include "ApplicationCacheStorage.h"
@@ -45,6 +33,9 @@
#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
#include "ContextMenuController.h"
+#if USE(QT_MULTIMEDIA)
+#include "DefaultFullScreenVideoHandler.h"
+#endif
#if ENABLE(DEVICE_ORIENTATION)
#include "DeviceMotionClientQt.h"
#include "DeviceOrientationClientMock.h"
@@ -62,7 +53,6 @@
#include "Frame.h"
#include "FrameLoadRequest.h"
#include "FrameLoader.h"
-#include "FrameLoader.h"
#include "FrameLoaderClientQt.h"
#include "FrameTree.h"
#include "FrameView.h"
@@ -79,7 +69,9 @@
#include "HitTestResult.h"
#include "Image.h"
#include "InitWebCoreQt.h"
+#include "InitWebKitQt.h"
#include "InspectorClientQt.h"
+#include "InspectorClientWebPage.h"
#include "InspectorController.h"
#include "InspectorServerQt.h"
#include "KURL.h"
@@ -88,20 +80,22 @@
#include "NavigationAction.h"
#include "NetworkingContext.h"
#include "NodeList.h"
-#include "NotificationPresenterClientQt.h"
#include "NotImplemented.h"
+#include "NotificationPresenterClientQt.h"
#include "Page.h"
#include "PageClientQt.h"
#include "PageGroup.h"
#include "Pasteboard.h"
-#include "PlatformGestureEvent.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformTouchEvent.h"
#include "PlatformWheelEvent.h"
#include "PluginDatabase.h"
-#include "PluginDatabase.h"
#include "PluginPackage.h"
#include "ProgressTracker.h"
+#include "QGraphicsWidgetPluginImpl.h"
+#include "QWebUndoCommand.h"
+#include "QWidgetPluginImpl.h"
+#include "QtFallbackWebPopup.h"
#include "QtPlatformPlugin.h"
#include "RenderTextControl.h"
#include "RenderThemeQt.h"
@@ -114,16 +108,30 @@
#include "SystemInfo.h"
#endif // Q_OS_WIN32
#include "TextIterator.h"
+#include "UndoStepQt.h"
#include "UserAgentQt.h"
#include "WebEventConversion.h"
#include "WebKitVersion.h"
#include "WindowFeatures.h"
#include "WorkerThread.h"
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "qwebhistory.h"
+#include "qwebhistory_p.h"
+#include "qwebinspector.h"
+#include "qwebinspector_p.h"
+#include "qwebkitplatformplugin.h"
+#include "qwebkitversion.h"
+#include "qwebpage_p.h"
+#include "qwebsettings.h"
+#include "qwebview.h"
+
#include <QAction>
#include <QApplication>
#include <QBasicTimer>
#include <QBitArray>
+#include <QClipboard>
#include <QColorDialog>
#include <QDebug>
#include <QDesktopWidget>
@@ -137,24 +145,25 @@
#include <QLabel>
#include <QMenu>
#include <QMessageBox>
+#include <QNetworkAccessManager>
#include <QNetworkProxy>
-#include <QUndoStack>
-#include <QUrl>
+#include <QNetworkRequest>
#include <QPainter>
-#include <QClipboard>
#include <QSslSocket>
#include <QStyle>
#include <QSysInfo>
+#if USE(QT_MOBILITY_SYSTEMINFO)
+#include <qsysteminfo.h>
+#endif
+#include <QSystemTrayIcon>
#include <QTextCharFormat>
+#include <QToolTip>
#include <QTouchEvent>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
+#include <QUndoStack>
+#include <QUrl>
#if defined(Q_WS_X11)
#include <QX11Info>
#endif
-#if USE(QT_MOBILITY_SYSTEMINFO)
-#include <qsysteminfo.h>
-#endif
using namespace WebCore;
@@ -163,8 +172,6 @@ QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT int qt_defaultDpi();
QT_END_NAMESPACE
-bool QWebPagePrivate::drtRun = false;
-
// Lookup table mapping QWebPage::WebActions to the associated Editor commands
static const char* editorCommandWebActions[] =
{
@@ -300,40 +307,33 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
: q(qq)
- , page(0)
#ifndef QT_NO_UNDOSTACK
, undoStack(0)
#endif
- , insideOpenCall(false)
, m_totalBytes(0)
, m_bytesReceived()
, clickCausedFocus(false)
- , networkManager(0)
- , forwardUnsupportedContent(false)
- , smartInsertDeleteEnabled(true)
- , selectTrailingWhitespaceEnabled(false)
, linkPolicy(QWebPage::DontDelegateLinks)
- , viewportSize(QSize(0, 0))
- , settings(0)
+ , m_viewportSize(QSize(0, 0))
, useFixedLayout(false)
- , pluginFactory(0)
, inspectorFrontend(0)
, inspector(0)
, inspectorIsInternalOnly(false)
, m_lastDropAction(Qt::IgnoreAction)
{
#if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION)
- bool useMock = QWebPagePrivate::drtRun;
+ bool useMock = QWebPageAdapter::drtRun;
#endif
+ WebKit::initializeWebKitWidgets();
WebCore::initializeWebCoreQt();
Page::PageClients pageClients;
- pageClients.chromeClient = new ChromeClientQt(q);
+ pageClients.chromeClient = new ChromeClientQt(this);
pageClients.contextMenuClient = new ContextMenuClientQt();
- pageClients.editorClient = new EditorClientQt(q);
- pageClients.dragClient = new DragClientQt(q);
- pageClients.inspectorClient = new InspectorClientQt(q);
+ pageClients.editorClient = new EditorClientQt(this);
+ pageClients.dragClient = new DragClientQt(pageClients.chromeClient);
+ pageClients.inspectorClient = new InspectorClientQt(this);
page = new Page(pageClients);
#if ENABLE(GEOLOCATION)
if (useMock) {
@@ -342,7 +342,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
WebCore::provideGeolocationTo(page, mock);
mock->setController(WebCore::GeolocationController::from(page));
} else
- WebCore::provideGeolocationTo(page, new GeolocationClientQt(q));
+ WebCore::provideGeolocationTo(page, new GeolocationClientQt(this));
#endif
#if ENABLE(DEVICE_ORIENTATION)
if (useMock)
@@ -351,9 +351,6 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt);
WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt);
#endif
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter());
-#endif
// By default each page is put into their own unique page group, which affects popup windows
// and visited links. Page groups (per process only) is a feature making it possible to use
@@ -364,7 +361,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout);
- settings = new QWebSettings(page->settings());
+ QWebPageAdapter::init(page);
history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList()));
memset(actions, 0, sizeof(actions));
@@ -372,8 +369,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
PageGroup::setShouldTrackVisitedLinks(true);
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- NotificationPresenterClientQt::notificationPresenter()->addClient();
-#endif
+ NotificationPresenterClientQt* presenter = NotificationPresenterClientQt::notificationPresenter();
+ presenter->addClient();
+#ifndef QT_NO_SYSTEMTRAYICON
+ if (!presenter->hasSystemTrayIcon())
+ presenter->setSystemTrayIcon(new QSystemTrayIcon);
+#endif // QT_NO_SYSTEMTRAYICON
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
}
QWebPagePrivate::~QWebPagePrivate()
@@ -384,8 +386,6 @@ QWebPagePrivate::~QWebPagePrivate()
#ifndef QT_NO_UNDOSTACK
delete undoStack;
#endif
- delete settings;
- delete page;
if (inspector) {
// If the inspector is ours, delete it, otherwise just detach from it.
@@ -394,41 +394,225 @@ QWebPagePrivate::~QWebPagePrivate()
else
inspector->setPage(0);
}
+ // Explicitly destruct the WebCore page at this point when the
+ // QWebPagePrivate / QWebPageAdapater vtables are still intact,
+ // in order for various destruction callbacks out of WebCore to
+ // work.
+ deletePage();
+}
-#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
- NotificationPresenterClientQt::notificationPresenter()->removeClient();
+WebCore::Page* QWebPagePrivate::core(const QWebPage* page)
+{
+ return page->d->page;
+}
+
+void QWebPagePrivate::show()
+{
+ if (!view)
+ return;
+ view->window()->show();
+}
+
+void QWebPagePrivate::setFocus()
+{
+ if (!view)
+ return;
+ view->setFocus();
+}
+
+void QWebPagePrivate::unfocus()
+{
+ if (!view)
+ return;
+ view->clearFocus();
+}
+
+void QWebPagePrivate::setWindowRect(const QRect &rect)
+{
+ emit q->geometryChangeRequested(rect);
+}
+
+QSize QWebPagePrivate::viewportSize() const
+{
+ return q->viewportSize();
+}
+
+QWebPageAdapter *QWebPagePrivate::createWindow(bool dialog)
+{
+ QWebPage *newPage = q->createWindow(dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow);
+ if (!newPage)
+ return 0;
+ // Make sure the main frame exists, as WebCore expects it when returning from this ChromeClient::createWindow()
+ newPage->d->createMainFrame();
+ return newPage->d;
+}
+
+void QWebPagePrivate::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID)
+{
+ q->javaScriptConsoleMessage(message, lineNumber, sourceID);
+}
+
+void QWebPagePrivate::javaScriptAlert(QWebFrameAdapter* frame, const QString& msg)
+{
+ q->javaScriptAlert(QWebFramePrivate::kit(frame), msg);
+}
+
+bool QWebPagePrivate::javaScriptConfirm(QWebFrameAdapter* frame, const QString& msg)
+{
+ return q->javaScriptConfirm(QWebFramePrivate::kit(frame), msg);
+}
+
+bool QWebPagePrivate::javaScriptPrompt(QWebFrameAdapter *frame, const QString &msg, const QString &defaultValue, QString *result)
+{
+ return q->javaScriptPrompt(QWebFramePrivate::kit(frame), msg, defaultValue, result);
+}
+
+bool QWebPagePrivate::shouldInterruptJavaScript()
+{
+ return q->shouldInterruptJavaScript();
+}
+
+void QWebPagePrivate::printRequested(QWebFrameAdapter *frame)
+{
+ emit q->printRequested(QWebFramePrivate::kit(frame));
+}
+
+void QWebPagePrivate::databaseQuotaExceeded(QWebFrameAdapter* frame, const QString& databaseName)
+{
+ emit q->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
+}
+
+void QWebPagePrivate::applicationCacheQuotaExceeded(QWebSecurityOrigin *origin, quint64 defaultOriginQuota, quint64 c)
+{
+ emit q->applicationCacheQuotaExceeded(origin, defaultOriginQuota, c);
+}
+
+void QWebPagePrivate::setToolTip(const QString &tip)
+{
+#ifndef QT_NO_TOOLTIP
+ if (!view)
+ return;
+
+ if (tip.isEmpty()) {
+ view->setToolTip(QString());
+ QToolTip::hideText();
+ } else {
+ QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>");
+ view->setToolTip(dtip);
+ }
+#else
+ Q_UNUSED(tip);
#endif
}
-WebCore::ViewportArguments QWebPagePrivate::viewportArguments()
+#if USE(QT_MULTIMEDIA)
+QWebFullScreenVideoHandler *QWebPagePrivate::createFullScreenVideoHandler()
{
- return page ? page->viewportArguments() : WebCore::ViewportArguments();
+ return new WebKit::DefaultFullScreenVideoHandler;
}
+#endif
-WebCore::Page* QWebPagePrivate::core(const QWebPage* page)
+QWebFrameAdapter *QWebPagePrivate::mainFrameAdapter()
{
- return page->d->page;
+ return q->mainFrame()->d;
}
-QWebPagePrivate* QWebPagePrivate::priv(QWebPage* page)
+QStringList QWebPagePrivate::chooseFiles(QWebFrameAdapter *frame, bool allowMultiple, const QStringList &suggestedFileNames)
{
- return page->d;
+ if (allowMultiple && q->supportsExtension(QWebPage::ChooseMultipleFilesExtension)) {
+ QWebPage::ChooseMultipleFilesExtensionOption option;
+ option.parentFrame = QWebFramePrivate::kit(frame);
+ option.suggestedFileNames = suggestedFileNames;
+
+ QWebPage::ChooseMultipleFilesExtensionReturn output;
+ q->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output);
+
+ return output.fileNames;
+ }
+ // Single file
+ QStringList result;
+ QString suggestedFile;
+ if (!suggestedFileNames.isEmpty())
+ suggestedFile = suggestedFileNames.first();
+ QString file = q->chooseFile(QWebFramePrivate::kit(frame), suggestedFile);
+ if (!file.isEmpty())
+ result << file;
+ return result;
}
-bool QWebPagePrivate::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
+bool QWebPagePrivate::acceptNavigationRequest(QWebFrameAdapter *frameAdapter, const QNetworkRequest &request, int type)
{
+ QWebFrame *frame = frameAdapter ? QWebFramePrivate::kit(frameAdapter): 0;
if (insideOpenCall
&& frame == mainFrame.data())
return true;
- return q->acceptNavigationRequest(frame, request, type);
+ return q->acceptNavigationRequest(frame, request, QWebPage::NavigationType(type));
+}
+
+void QWebPagePrivate::emitRestoreFrameStateRequested(QWebFrameAdapter *frame)
+{
+ emit q->restoreFrameStateRequested(QWebFramePrivate::kit(frame));
+}
+
+void QWebPagePrivate::emitSaveFrameStateRequested(QWebFrameAdapter *frame, QWebHistoryItem *item)
+{
+ emit q->saveFrameStateRequested(QWebFramePrivate::kit(frame), item);
+}
+
+void QWebPagePrivate::emitDownloadRequested(const QNetworkRequest &request)
+{
+ emit q->downloadRequested(request);
+}
+
+void QWebPagePrivate::emitFrameCreated(QWebFrameAdapter *frame)
+{
+ emit q->frameCreated(QWebFramePrivate::kit(frame));
+}
+
+bool QWebPagePrivate::errorPageExtension(QWebPageAdapter::ErrorPageOption *opt, QWebPageAdapter::ErrorPageReturn *out)
+{
+ QWebPage::ErrorPageExtensionOption option;
+ if (opt->domain == QLatin1String("QtNetwork"))
+ option.domain = QWebPage::QtNetwork;
+ else if (opt->domain == QLatin1String("HTTP"))
+ option.domain = QWebPage::Http;
+ else if (opt->domain == QLatin1String("WebKit"))
+ option.domain = QWebPage::WebKit;
+ else
+ return false;
+ option.url = opt->url;
+ option.frame = QWebFramePrivate::kit(opt->frame);
+ option.error = opt->error;
+ option.errorString = opt->errorString;
+ QWebPage::ErrorPageExtensionReturn output;
+ if (!q->extension(QWebPage::ErrorPageExtension, &option, &output))
+ return false;
+ out->baseUrl = output.baseUrl;
+ out->content = output.content;
+ out->contentType = output.contentType;
+ out->encoding = output.encoding;
+ return true;
+}
+
+QtPluginWidgetAdapter *QWebPagePrivate::createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
+{
+ QObject *widget = q->createPlugin(classid, url, paramNames, paramValues);
+ return adapterForWidget(widget);
+}
+
+QtPluginWidgetAdapter *QWebPagePrivate::adapterForWidget(QObject *object) const
+{
+ if (QWidget *widget = qobject_cast<QWidget*>(object))
+ return new QWidgetPluginImpl(widget);
+ if (QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(object))
+ return new QGraphicsWidgetPluginImpl(widget);
+ return 0;
}
void QWebPagePrivate::createMainFrame()
{
if (!mainFrame) {
- QWebFrameData frameData(page);
- mainFrame = new QWebFrame(q, &frameData);
-
+ mainFrame = new QWebFrame(q);
emit q->frameCreated(mainFrame.data());
}
}
@@ -475,49 +659,49 @@ QMenu *QWebPagePrivate::createContextMenu(const WebCore::ContextMenu *webcoreMen
if (!client || !webcoreMenu)
return 0;
- QMenu* menu = new QMenu(client->ownerWidget());
+ QMenu* menu = new QMenu(q->view());
for (int i = 0; i < items->count(); ++i) {
const ContextMenuItem &item = items->at(i);
switch (item.type()) {
- case WebCore::CheckableActionType: /* fall through */
- case WebCore::ActionType: {
- QWebPage::WebAction action = webActionForContextMenuAction(item.action());
- QAction *a = q->action(action);
- if (a) {
- ContextMenuItem it(item);
- page->contextMenuController()->checkOrEnableIfNeeded(it);
- PlatformMenuItemDescription desc = it.releasePlatformDescription();
- a->setEnabled(desc.enabled);
- a->setChecked(desc.checked);
- a->setCheckable(item.type() == WebCore::CheckableActionType);
-
- menu->addAction(a);
- visitedWebActions->setBit(action);
- }
- break;
+ case WebCore::CheckableActionType: /* fall through */
+ case WebCore::ActionType: {
+ QWebPage::WebAction action = webActionForContextMenuAction(item.action());
+ QAction *a = q->action(action);
+ if (a) {
+ ContextMenuItem it(item);
+ page->contextMenuController()->checkOrEnableIfNeeded(it);
+ PlatformMenuItemDescription desc = it.releasePlatformDescription();
+ a->setEnabled(desc.enabled);
+ a->setChecked(desc.checked);
+ a->setCheckable(item.type() == WebCore::CheckableActionType);
+
+ menu->addAction(a);
+ visitedWebActions->setBit(action);
}
- case WebCore::SeparatorType:
- menu->addSeparator();
- break;
- case WebCore::SubmenuType: {
- QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions);
-
- bool anyEnabledAction = false;
+ break;
+ }
+ case WebCore::SeparatorType:
+ menu->addSeparator();
+ break;
+ case WebCore::SubmenuType: {
+ QMenu *subMenu = createContextMenu(webcoreMenu, item.platformSubMenu(), visitedWebActions);
- QList<QAction *> actions = subMenu->actions();
- for (int i = 0; i < actions.count(); ++i) {
- if (actions.at(i)->isVisible())
- anyEnabledAction |= actions.at(i)->isEnabled();
- }
+ bool anyEnabledAction = false;
- // don't show sub-menus with just disabled actions
- if (anyEnabledAction) {
- subMenu->setTitle(item.title());
- menu->addAction(subMenu->menuAction());
- } else
- delete subMenu;
- break;
+ QList<QAction *> actions = subMenu->actions();
+ for (int i = 0; i < actions.count(); ++i) {
+ if (actions.at(i)->isVisible())
+ anyEnabledAction |= actions.at(i)->isEnabled();
}
+
+ // don't show sub-menus with just disabled actions
+ if (anyEnabledAction) {
+ subMenu->setTitle(item.title());
+ menu->addAction(subMenu->menuAction());
+ } else
+ delete subMenu;
+ break;
+ }
}
}
return menu;
@@ -619,6 +803,65 @@ void QWebPagePrivate::updateNavigationActions()
updateAction(QWebPage::ReloadAndBypassCache);
}
+QObject *QWebPagePrivate::inspectorHandle()
+{
+ return getOrCreateInspector();
+}
+
+void QWebPagePrivate::setInspectorFrontend(QObject* frontend)
+{
+ inspectorFrontend = qobject_cast<QWidget*>(frontend);
+ if (inspector)
+ inspector->d->setFrontend(frontend);
+}
+
+void QWebPagePrivate::setInspectorWindowTitle(const QString& title)
+{
+ if (inspector)
+ inspector->setWindowTitle(title);
+}
+
+void QWebPagePrivate::createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage)
+{
+ QWebPage* page = new WebKit::InspectorClientWebPage;
+ *inspectorView = page->view();
+ *inspectorPage = page->d;
+}
+
+#ifndef QT_NO_MENU
+static QStringList iterateContextMenu(QMenu* menu)
+{
+ if (!menu)
+ return QStringList();
+
+ QStringList items;
+ QList<QAction *> actions = menu->actions();
+ for (int i = 0; i < actions.count(); ++i) {
+ if (actions.at(i)->isSeparator())
+ items << QLatin1String("<separator>");
+ else
+ items << actions.at(i)->text();
+ if (actions.at(i)->menu())
+ items << iterateContextMenu(actions.at(i)->menu());
+ }
+ return items;
+}
+#endif
+
+QStringList QWebPagePrivate::menuActionsAsText()
+{
+#ifndef QT_NO_MENU
+ return iterateContextMenu(currentContextMenu.data());
+#else
+ return QStringList();
+#endif
+}
+
+void QWebPagePrivate::emitViewportChangeRequested()
+{
+ emit q->viewportChangeRequested();
+}
+
void QWebPagePrivate::updateEditorActions()
{
updateAction(QWebPage::Cut);
@@ -682,8 +925,7 @@ void QWebPagePrivate::timerEvent(QTimerEvent *ev)
q->timerEvent(ev);
}
-template<class T>
-void QWebPagePrivate::mouseMoveEvent(T* ev)
+void QWebPagePrivate::mouseMoveEvent(QMouseEvent* ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
@@ -693,8 +935,7 @@ void QWebPagePrivate::mouseMoveEvent(T* ev)
ev->setAccepted(accepted);
}
-template<class T>
-void QWebPagePrivate::mousePressEvent(T* ev)
+void QWebPagePrivate::mousePressEvent(QMouseEvent* ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
@@ -729,8 +970,7 @@ void QWebPagePrivate::mousePressEvent(T* ev)
clickCausedFocus = true;
}
-template<class T>
-void QWebPagePrivate::mouseDoubleClickEvent(T *ev)
+void QWebPagePrivate::mouseDoubleClickEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
@@ -747,8 +987,7 @@ void QWebPagePrivate::mouseDoubleClickEvent(T *ev)
tripleClick = QPointF(ev->pos()).toPoint();
}
-template<class T>
-void QWebPagePrivate::mouseTripleClickEvent(T *ev)
+void QWebPagePrivate::mouseTripleClickEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
@@ -762,8 +1001,7 @@ void QWebPagePrivate::mouseTripleClickEvent(T *ev)
ev->setAccepted(accepted);
}
-template<class T>
-void QWebPagePrivate::mouseReleaseEvent(T *ev)
+void QWebPagePrivate::mouseReleaseEvent(QMouseEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
@@ -790,7 +1028,7 @@ void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button, const QPo
&& frame->document()->focusedNode()
&& button == Qt::LeftButton && qApp->autoSipEnabled()) {
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
- client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ client->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(pos), false);
if (result.isContentEditable()) {
@@ -833,14 +1071,13 @@ QMenu *QWebPage::createStandardContextMenu()
}
#ifndef QT_NO_WHEELEVENT
-template<class T>
-void QWebPagePrivate::wheelEvent(T *ev)
+void QWebPagePrivate::wheelEvent(QWheelEvent *ev)
{
WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
if (!frame->view())
return;
- PlatformWheelEvent pev = convertWheelEvent(ev);
+ PlatformWheelEvent pev = convertWheelEvent(ev, QApplication::wheelScrollLines());
bool accepted = frame->eventHandler()->handleWheelEvent(pev);
ev->setAccepted(accepted);
}
@@ -1340,33 +1577,39 @@ bool QWebPagePrivate::touchEvent(QTouchEvent* event)
bool QWebPagePrivate::gestureEvent(QGestureEvent* event)
{
-#if ENABLE(GESTURE_EVENTS)
- WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
- if (!frame->view())
+ QWebFrameAdapter* frame = mainFrame.data()->d;
+ if (!frame->hasView())
return false;
-
// QGestureEvents can contain updates for multiple gestures.
bool handled = false;
+#if ENABLE(GESTURE_EVENTS)
+ // QGestureEvent lives in Widgets, we'll need a dummy struct to mule the info it contains to the "other side"
+ QGestureEventFacade gestureFacade;
+
QGesture* gesture = event->gesture(Qt::TapGesture);
// Beware that gestures send by DumpRenderTree will have state Qt::NoGesture,
// due to not originating from a GestureRecognizer.
if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
- frame->eventHandler()->handleGestureEvent(convertGesture(event, gesture));
- event->setAccepted(true);
+ gestureFacade.type = Qt::TapGesture;
+ QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position();
+ gestureFacade.globalPos = globalPos.toPoint();
+ gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint());
+ frame->handleGestureEvent(&gestureFacade);
handled = true;
}
gesture = event->gesture(Qt::TapAndHoldGesture);
if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
- frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(event, gesture));
- event->setAccepted(true);
+ gestureFacade.type = Qt::TapAndHoldGesture;
+ QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position();
+ gestureFacade.globalPos = globalPos.toPoint();
+ gestureFacade.pos = event->widget()->mapFromGlobal(globalPos.toPoint());
+ frame->handleGestureEvent(&gestureFacade);
handled = true;
}
+#endif // ENABLE(GESTURE_EVENTS)
+ event->setAccepted(handled);
return handled;
-#else
- event->ignore();
- return false;
-#endif
}
/*!
@@ -2037,12 +2280,12 @@ void QWebPage::setView(QWidget* view)
if (d->client) {
if (d->client->isQWidgetClient())
- static_cast<PageClientQWidget*>(d->client.get())->view = view;
+ static_cast<PageClientQWidget*>(d->client.data())->view = view;
return;
}
if (view)
- d->client = adoptPtr(new PageClientQWidget(view, this));
+ d->client.reset(new PageClientQWidget(view, this));
}
/*!
@@ -2068,7 +2311,7 @@ void QWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
// Catch plugin logDestroy message for LayoutTests/plugins/open-and-close-window-with-plugin.html
// At this point DRT's WebPage has already been destroyed
- if (QWebPagePrivate::drtRun) {
+ if (QWebPageAdapter::drtRun) {
if (message == QLatin1String("PLUGIN: NPP_Destroy")) {
fprintf(stdout, "CONSOLE MESSAGE: ");
if (lineNumber)
@@ -2088,8 +2331,7 @@ void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg)
{
Q_UNUSED(frame)
#ifndef QT_NO_MESSAGEBOX
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- QMessageBox box(parent);
+ QMessageBox box(view());
box.setWindowTitle(tr("JavaScript Alert - %1").arg(mainFrame()->url().host()));
box.setTextFormat(Qt::PlainText);
box.setText(msg);
@@ -2110,8 +2352,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
#ifdef QT_NO_MESSAGEBOX
return true;
#else
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- QMessageBox box(parent);
+ QMessageBox box(view());
box.setWindowTitle(tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()));
box.setTextFormat(Qt::PlainText);
box.setText(msg);
@@ -2136,8 +2377,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr
bool ok = false;
#ifndef QT_NO_INPUTDIALOG
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- QInputDialog dlg(parent);
+ QInputDialog dlg(view());
dlg.setWindowTitle(tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()));
// Hack to force the dialog's QLabel into plain text mode
@@ -2171,18 +2411,13 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr
If the user wanted to stop the JavaScript the implementation should return true; otherwise false.
The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.
-
- \warning Because of binary compatibility constraints, this function is not virtual. If you want to
- provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript()
- slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.
*/
bool QWebPage::shouldInterruptJavaScript()
{
#ifdef QT_NO_MESSAGEBOX
return false;
#else
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
+ return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No);
#endif
}
@@ -2197,7 +2432,8 @@ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, Permissio
break;
case Geolocation:
#if ENABLE(GEOLOCATION)
- GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, policy);
+ if (policy != PermissionUnknown)
+ GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame->d, (policy == PermissionGrantedByUser));
#endif
break;
@@ -2461,20 +2697,146 @@ QColor QWebPagePrivate::colorSelectionRequested(const QColor &selectedColor)
{
QColor ret = selectedColor;
#ifndef QT_NO_COLORDIALOG
- QWidget* parent = (client) ? client->ownerWidget() : 0;
- ret = QColorDialog::getColor(selectedColor, parent);
+ ret = QColorDialog::getColor(selectedColor, q->view());
if (!ret.isValid())
ret = selectedColor;
#endif
return ret;
}
+QWebSelectMethod *QWebPagePrivate::createSelectPopup()
+{
+ return new QtFallbackWebPopup(this);
+}
+
+QRect QWebPagePrivate::viewRectRelativeToWindow()
+{
+
+ QWidget* ownerWidget= client.isNull() ? 0 : qobject_cast<QWidget*>(client->ownerWidget());
+ if (!ownerWidget)
+ return QRect();
+ QWidget* topLevelWidget = ownerWidget->window();
+
+ QPoint topLeftCorner = ownerWidget->mapFrom(topLevelWidget, QPoint(0, 0));
+ return QRect(topLeftCorner, ownerWidget->size());
+}
+
+void QWebPagePrivate::geolocationPermissionRequested(QWebFrameAdapter* frame)
+{
+ emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Geolocation);
+}
+
+void QWebPagePrivate::geolocationPermissionRequestCancelled(QWebFrameAdapter* frame)
+{
+ emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Geolocation);
+}
+
+void QWebPagePrivate::notificationsPermissionRequested(QWebFrameAdapter* frame)
+{
+ emit q->featurePermissionRequested(QWebFramePrivate::kit(frame), QWebPage::Notifications);
+}
+
+void QWebPagePrivate::notificationsPermissionRequestCancelled(QWebFrameAdapter* frame)
+{
+ emit q->featurePermissionRequestCanceled(QWebFramePrivate::kit(frame), QWebPage::Notifications);
+}
+
+void QWebPagePrivate::respondToChangedContents()
+{
+ updateEditorActions();
+
+ emit q->contentsChanged();
+}
+
+void QWebPagePrivate::respondToChangedSelection()
+{
+ updateEditorActions();
+ emit q->selectionChanged();
+}
+
+void QWebPagePrivate::microFocusChanged()
+{
+ emit q->microFocusChanged();
+}
+
+void QWebPagePrivate::triggerCopyAction()
+{
+ q->triggerAction(QWebPage::Copy);
+}
+
+void QWebPagePrivate::triggerActionForKeyEvent(QKeyEvent* event)
+{
+ QWebPage::WebAction action = editorActionForKeyEvent(event);
+ q->triggerAction(action);
+}
+
+void QWebPagePrivate::clearUndoStack()
+{
+#ifndef QT_NO_UNDOSTACK
+ if (undoStack)
+ undoStack->clear();
+#endif
+}
+
+bool QWebPagePrivate::canUndo() const
+{
+#ifndef QT_NO_UNDOSTACK
+ if (!undoStack)
+ return false;
+ return undoStack->canUndo();
+#else
+ return false;
+#endif
+}
+
+bool QWebPagePrivate::canRedo() const
+{
+#ifndef QT_NO_UNDOSTACK
+ if (!undoStack)
+ return false;
+ return undoStack->canRedo();
+#else
+ return false;
+#endif
+}
+
+void QWebPagePrivate::undo()
+{
+#ifndef QT_NO_UNDOSTACK
+ if (undoStack)
+ undoStack->undo();
+#endif
+}
+
+void QWebPagePrivate::redo()
+{
+#ifndef QT_NO_UNDOSTACK
+ if (undoStack)
+ undoStack->redo();
+#endif
+}
+
+void QWebPagePrivate::createUndoStep(QSharedPointer<UndoStepQt> step)
+{
+#ifndef QT_NO_UNDOSTACK
+ // Call undoStack() getter first to ensure stack is created
+ // if it doesn't exist yet.
+ q->undoStack()->push(new QWebUndoCommand(step));
+#endif
+}
+
+const char *QWebPagePrivate::editorCommandForKeyEvent(QKeyEvent* event)
+{
+ QWebPage::WebAction action = editorActionForKeyEvent(event);
+ return editorCommandForWebActions(action);
+}
+
QSize QWebPage::viewportSize() const
{
if (d->mainFrame && d->mainFrame.data()->d->frame->view())
return d->mainFrame.data()->d->frame->view()->frameRect().size();
- return d->viewportSize;
+ return d->m_viewportSize;
}
/*!
@@ -2491,7 +2853,7 @@ QSize QWebPage::viewportSize() const
*/
void QWebPage::setViewportSize(const QSize &size) const
{
- d->viewportSize = size;
+ d->m_viewportSize = size;
QWebFrame *frame = mainFrame();
if (frame->d->frame && frame->d->frame->view()) {
@@ -2577,7 +2939,7 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av
// Both environment variables need to be set - or they will be ignored.
if (deviceWidth < 0 && deviceHeight < 0) {
- QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0);
+ QSize size = queryDeviceSizeForScreenContainingWidget(view());
deviceWidth = size.width();
deviceHeight = size.height();
}
@@ -3093,18 +3455,34 @@ bool QWebPage::event(QEvent *ev)
d->mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
break;
#if !defined(QT_NO_GRAPHICSVIEW)
- case QEvent::GraphicsSceneMouseMove:
- d->mouseMoveEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ case QEvent::GraphicsSceneMouseMove: {
+ QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+ QMouseEvent dummyEvent(QEvent::MouseMove, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+ d->mouseMoveEvent(&dummyEvent);
+ ev->setAccepted(dummyEvent.isAccepted());
break;
- case QEvent::GraphicsSceneMousePress:
- d->mousePressEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ }
+ case QEvent::GraphicsSceneMouseRelease: {
+ QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+ QMouseEvent dummyEvent(QEvent::MouseButtonRelease, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+ d->mouseReleaseEvent(&dummyEvent);
+ ev->setAccepted(dummyEvent.isAccepted());
break;
- case QEvent::GraphicsSceneMouseDoubleClick:
- d->mouseDoubleClickEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ }
+ case QEvent::GraphicsSceneMousePress: {
+ QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+ QMouseEvent dummyEvent(QEvent::MouseButtonPress, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+ d->mousePressEvent(&dummyEvent);
+ ev->setAccepted(dummyEvent.isAccepted());
break;
- case QEvent::GraphicsSceneMouseRelease:
- d->mouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent*>(ev));
+ }
+ case QEvent::GraphicsSceneMouseDoubleClick: {
+ QGraphicsSceneMouseEvent *gsEv = static_cast<QGraphicsSceneMouseEvent*>(ev);
+ QMouseEvent dummyEvent(QEvent::MouseButtonDblClick, gsEv->pos(), gsEv->screenPos(), gsEv->button(), gsEv->buttons(), gsEv->modifiers());
+ d->mouseDoubleClickEvent(&dummyEvent);
+ ev->setAccepted(dummyEvent.isAccepted());
break;
+ }
#endif
#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
@@ -3121,9 +3499,13 @@ bool QWebPage::event(QEvent *ev)
d->wheelEvent(static_cast<QWheelEvent*>(ev));
break;
#if !defined(QT_NO_GRAPHICSVIEW)
- case QEvent::GraphicsSceneWheel:
- d->wheelEvent(static_cast<QGraphicsSceneWheelEvent*>(ev));
+ case QEvent::GraphicsSceneWheel: {
+ QGraphicsSceneWheelEvent *gsEv = static_cast<QGraphicsSceneWheelEvent*>(ev);
+ QWheelEvent dummyEvent(gsEv->pos(), gsEv->screenPos(), gsEv->delta(), gsEv->buttons(), gsEv->modifiers(), gsEv->orientation());
+ d->wheelEvent(&dummyEvent);
+ ev->setAccepted(dummyEvent.isAccepted());
break;
+ }
#endif
#endif
case QEvent::KeyPress:
@@ -3639,8 +4021,7 @@ bool QWebPage::extension(Extension extension, const ExtensionOption *option, Ext
if (extension == ChooseMultipleFilesExtension) {
// FIXME: do not ignore suggestedFiles
QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames;
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- QStringList names = QFileDialog::getOpenFileNames(parent, QString::null);
+ QStringList names = QFileDialog::getOpenFileNames(view(), QString::null);
static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names;
return true;
}
@@ -3665,6 +4046,14 @@ bool QWebPage::supportsExtension(Extension extension) const
}
/*!
+ * \internal
+ */
+QWebPageAdapter *QWebPage::handle() const
+{
+ return d;
+}
+
+/*!
Finds the specified string, \a subString, in the page, using the given \a options.
If the HighlightAllOccurrences flag is passed, the function will highlight all occurrences
@@ -3732,8 +4121,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil
{
Q_UNUSED(parentFrame)
#ifndef QT_NO_FILEDIALOG
- QWidget* parent = (d->client) ? d->client->ownerWidget() : 0;
- return QFileDialog::getOpenFileName(parent, QString::null, suggestedFile);
+ return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile);
#else
return QString::null;
#endif
@@ -3750,11 +4138,7 @@ QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFil
*/
void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager)
{
- if (manager == d->networkManager)
- return;
- if (d->networkManager && d->networkManager->parent() == this)
- delete d->networkManager;
- d->networkManager = manager;
+ d->setNetworkAccessManager(manager);
}
/*!
@@ -3765,11 +4149,7 @@ void QWebPage::setNetworkAccessManager(QNetworkAccessManager *manager)
*/
QNetworkAccessManager *QWebPage::networkAccessManager() const
{
- if (!d->networkManager) {
- QWebPage *that = const_cast<QWebPage *>(this);
- that->d->networkManager = new QNetworkAccessManager(that);
- }
- return d->networkManager;
+ return d->networkAccessManager();
}
/*!
diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h
index b2caa131d..bb5421fcc 100644
--- a/Source/WebKit/qt/Api/qwebpage.h
+++ b/Source/WebKit/qt/Api/qwebpage.h
@@ -46,6 +46,7 @@ class QWebFrameData;
class QWebHistoryItem;
class QWebHitTestResult;
class QWebNetworkInterface;
+class QWebPageAdapter;
class QWebPagePrivate;
class QWebPluginFactory;
class QWebSecurityOrigin;
@@ -365,10 +366,9 @@ public:
virtual bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0);
virtual bool supportsExtension(Extension extension) const;
- inline QWebPagePrivate* handle() const { return d; }
+ QWebPageAdapter* handle() const;
-public Q_SLOTS:
- bool shouldInterruptJavaScript();
+ virtual bool shouldInterruptJavaScript();
Q_SIGNALS:
void loadStarted();
diff --git a/Source/WebKit/qt/Api/qwebpage_p.h b/Source/WebKit/qt/Api/qwebpage_p.h
index 794322991..2434dd653 100644
--- a/Source/WebKit/qt/Api/qwebpage_p.h
+++ b/Source/WebKit/qt/Api/qwebpage_p.h
@@ -21,29 +21,22 @@
#ifndef QWEBPAGE_P_H
#define QWEBPAGE_P_H
-#include <QPointer>
+#include "QWebPageAdapter.h"
+
+#include "qwebframe.h"
+#include "qwebhistory.h"
+#include "qwebpage.h"
+#include <QPointer>
#include <qbasictimer.h>
-#include <qnetworkproxy.h>
#include <qevent.h>
#include <qgesture.h>
#include <qgraphicssceneevent.h>
+#include <qgraphicswidget.h>
+#include <qnetworkproxy.h>
-#include "qwebpage.h"
-#include "qwebhistory.h"
-#include "qwebframe.h"
-
-#include "IntPoint.h"
-#include "KURL.h"
-
-#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
-
-#include "ViewportArguments.h"
namespace WebCore {
- class ChromeClientQt;
class ContextMenuClientQt;
class ContextMenuItem;
class ContextMenu;
@@ -54,7 +47,6 @@ namespace WebCore {
class IntRect;
class Node;
class NodeList;
- class Page;
class Frame;
}
@@ -64,8 +56,10 @@ class QMenu;
class QBitArray;
QT_END_NAMESPACE
+class QtPluginWidgetAdapter;
class QWebInspector;
-class QWebPageClient;
+class QWebFrameAdapter;
+class UndoStepQt;
class QtViewportAttributesPrivate : public QSharedData {
public:
@@ -76,13 +70,74 @@ public:
QWebPage::ViewportAttributes* q;
};
-class QWebPagePrivate {
+class QWebPagePrivate : public QWebPageAdapter {
public:
QWebPagePrivate(QWebPage*);
~QWebPagePrivate();
static WebCore::Page* core(const QWebPage*);
- static QWebPagePrivate* priv(QWebPage*);
+
+ // Adapter implementation
+ virtual void show() OVERRIDE;
+ virtual void setFocus() OVERRIDE;
+ virtual void unfocus() OVERRIDE;
+ virtual void setWindowRect(const QRect &) OVERRIDE;
+ virtual QSize viewportSize() const OVERRIDE;
+ virtual QWebPageAdapter* createWindow(bool /*dialog*/) OVERRIDE;
+ virtual QObject* handle() OVERRIDE { return q; }
+ virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) OVERRIDE;
+ virtual void javaScriptAlert(QWebFrameAdapter*, const QString& msg) OVERRIDE;
+ virtual bool javaScriptConfirm(QWebFrameAdapter*, const QString& msg) OVERRIDE;
+ virtual bool javaScriptPrompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) OVERRIDE;
+ virtual bool shouldInterruptJavaScript() OVERRIDE;
+ virtual void printRequested(QWebFrameAdapter*) OVERRIDE;
+ virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) OVERRIDE;
+ virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) OVERRIDE;
+ virtual void setToolTip(const QString&) OVERRIDE;
+#if USE(QT_MULTIMEDIA)
+ virtual QWebFullScreenVideoHandler* createFullScreenVideoHandler() OVERRIDE;
+#endif
+ virtual QWebFrameAdapter* mainFrameAdapter() OVERRIDE;
+ virtual QStringList chooseFiles(QWebFrameAdapter*, bool allowMultiple, const QStringList& suggestedFileNames) OVERRIDE;
+ virtual QColor colorSelectionRequested(const QColor& selectedColor) OVERRIDE;
+ virtual QWebSelectMethod* createSelectPopup() OVERRIDE;
+ virtual QRect viewRectRelativeToWindow() OVERRIDE;
+ virtual void geolocationPermissionRequested(QWebFrameAdapter*) OVERRIDE;
+ virtual void geolocationPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE;
+ virtual void notificationsPermissionRequested(QWebFrameAdapter*) OVERRIDE;
+ virtual void notificationsPermissionRequestCancelled(QWebFrameAdapter*) OVERRIDE;
+
+ virtual void respondToChangedContents() OVERRIDE;
+ virtual void respondToChangedSelection() OVERRIDE;
+ virtual void microFocusChanged() OVERRIDE;
+ virtual void triggerCopyAction() OVERRIDE;
+ virtual void triggerActionForKeyEvent(QKeyEvent*) OVERRIDE;
+ virtual void clearUndoStack() OVERRIDE;
+ virtual bool canUndo() const OVERRIDE;
+ virtual bool canRedo() const OVERRIDE;
+ virtual void undo() OVERRIDE;
+ virtual void redo() OVERRIDE;
+ virtual void createUndoStep(QSharedPointer<UndoStepQt>) OVERRIDE;
+ virtual const char* editorCommandForKeyEvent(QKeyEvent*) OVERRIDE;
+
+ void updateNavigationActions() OVERRIDE;
+
+ virtual QObject* inspectorHandle() OVERRIDE;
+ virtual void setInspectorFrontend(QObject*) OVERRIDE;
+ virtual void setInspectorWindowTitle(const QString&) OVERRIDE;
+ virtual void createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) OVERRIDE;
+ virtual QStringList menuActionsAsText() OVERRIDE;
+ virtual void emitViewportChangeRequested() OVERRIDE;
+ virtual bool acceptNavigationRequest(QWebFrameAdapter*, const QNetworkRequest&, int type) OVERRIDE;
+ virtual void emitRestoreFrameStateRequested(QWebFrameAdapter*) OVERRIDE;
+ virtual void emitSaveFrameStateRequested(QWebFrameAdapter*, QWebHistoryItem*) OVERRIDE;
+ virtual void emitDownloadRequested(const QNetworkRequest&) OVERRIDE;
+ virtual void emitFrameCreated(QWebFrameAdapter*) OVERRIDE;
+ virtual QString userAgentForUrl(const QUrl &url) const OVERRIDE { return q->userAgentForUrl(url); }
+ virtual bool supportsErrorPageExtension() const OVERRIDE { return q->supportsExtension(QWebPage::ErrorPageExtension); }
+ virtual bool errorPageExtension(ErrorPageOption *, ErrorPageReturn *) OVERRIDE;
+ virtual QtPluginWidgetAdapter* createPlugin(const QString &, const QUrl &, const QStringList &, const QStringList &) OVERRIDE;
+ virtual QtPluginWidgetAdapter* adapterForWidget(QObject *) const OVERRIDE;
void createMainFrame();
#ifndef QT_NO_CONTEXTMENU
@@ -92,23 +147,20 @@ public:
void _q_webActionTriggered(bool checked);
void _q_cleanupLeakMessages();
void updateAction(QWebPage::WebAction action);
- void updateNavigationActions();
void updateEditorActions();
- QColor colorSelectionRequested(const QColor& selectedColor);
-
void timerEvent(QTimerEvent*);
- template<class T> void mouseMoveEvent(T*);
- template<class T> void mousePressEvent(T*);
- template<class T> void mouseDoubleClickEvent(T*);
- template<class T> void mouseTripleClickEvent(T*);
- template<class T> void mouseReleaseEvent(T*);
+ void mouseMoveEvent(QMouseEvent*);
+ void mousePressEvent(QMouseEvent*);
+ void mouseDoubleClickEvent(QMouseEvent*);
+ void mouseTripleClickEvent(QMouseEvent*);
+ void mouseReleaseEvent(QMouseEvent*);
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(const QPoint& globalPos);
#endif
#ifndef QT_NO_WHEELEVENT
- template<class T> void wheelEvent(T*);
+ void wheelEvent(QWheelEvent*);
#endif
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
@@ -159,16 +211,12 @@ public:
WebCore::InspectorController* inspectorController();
quint16 inspectorServerPort();
- WebCore::ViewportArguments viewportArguments();
-
#ifndef QT_NO_SHORTCUT
static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event);
#endif
static const char* editorCommandForWebActions(QWebPage::WebAction action);
QWebPage *q;
- WebCore::Page *page;
- OwnPtr<QWebPageClient> client;
QPointer<QWebFrame> mainFrame;
#ifndef QT_NO_UNDOSTACK
@@ -177,7 +225,6 @@ public:
QPointer<QWidget> view;
- bool insideOpenCall;
quint64 m_totalBytes;
quint64 m_bytesReceived;
@@ -186,15 +233,9 @@ public:
bool clickCausedFocus;
- bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
- QNetworkAccessManager *networkManager;
-
- bool forwardUnsupportedContent;
- bool smartInsertDeleteEnabled;
- bool selectTrailingWhitespaceEnabled;
QWebPage::LinkDelegationPolicy linkPolicy;
- QSize viewportSize;
+ QSize m_viewportSize;
QSize fixedLayoutSize;
QWebHistory history;
@@ -202,20 +243,15 @@ public:
#ifndef QT_NO_CONTEXTMENU
QPointer<QMenu> currentContextMenu;
#endif
- QWebSettings *settings;
QPalette palette;
bool useFixedLayout;
QAction *actions[QWebPage::WebActionCount];
- QWebPluginFactory *pluginFactory;
-
QWidget* inspectorFrontend;
QWebInspector* inspector;
bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
Qt::DropAction m_lastDropAction;
-
- static bool drtRun;
};
#endif
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index 768c80256..74d8524d8 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -20,41 +20,39 @@
#include "config.h"
#include "qwebsettings.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
#include "qwebplugindatabase_p.h"
#include "AbstractDatabase.h"
-#include "MemoryCache.h"
+#include "ApplicationCacheStorage.h"
#include "CrossOriginPreflightResultCache.h"
+#include "DatabaseTracker.h"
+#include "FileSystem.h"
#include "FontCache.h"
+#include "IconDatabase.h"
+#include "Image.h"
#if ENABLE(ICONDATABASE)
#include "IconDatabaseClientQt.h"
#endif
#include "InitWebCoreQt.h"
+#include "IntSize.h"
+#include "KURL.h"
+#include "MemoryCache.h"
+#include "NetworkStateNotifier.h"
#include "Page.h"
#include "PageCache.h"
-#include "Settings.h"
-#include "KURL.h"
-#include "IconDatabase.h"
#include "PluginDatabase.h"
-#include "Image.h"
-#include "IntSize.h"
-#include "ApplicationCacheStorage.h"
-#include "DatabaseTracker.h"
-#include "FileSystem.h"
-#include <wtf/text/WTFString.h>
-
-#include <QApplication>
-#include <QStandardPaths>
+#include "Settings.h"
#include <QDir>
+#include <QFileInfo>
+#include <QFont>
+#include <QGuiApplication>
#include <QHash>
#include <QSharedData>
+#include <QStandardPaths>
#include <QUrl>
-#include <QFileInfo>
-#include <QStyle>
+#include <wtf/text/WTFString.h>
+
-#include "NetworkStateNotifier.h"
void QWEBKIT_EXPORT qt_networkAccessAllowed(bool isAllowed)
{
diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h
index 5e7d3e1b4..49721b7cb 100644
--- a/Source/WebKit/qt/Api/qwebsettings.h
+++ b/Source/WebKit/qt/Api/qwebsettings.h
@@ -163,6 +163,7 @@ public:
inline QWebSettingsPrivate* handle() const { return d; }
private:
+ friend class QWebPageAdapter;
friend class QWebPagePrivate;
friend class QWebSettingsPrivate;
diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/Api/qwebview.cpp
index 9f2af5787..2eda6a18e 100644
--- a/Source/WebKit/qt/Api/qwebview.cpp
+++ b/Source/WebKit/qt/Api/qwebview.cpp
@@ -227,9 +227,9 @@ void QWebViewPrivate::detachCurrentPage()
// to destroy it.
if (page->d->client && page->d->client->isQWidgetClient())
- page->d->client.clear();
+ page->d->client.reset();
- page->d->client.release();
+ page->d->client.take();
// if the page was created by us, we own it and need to
// destroy it as well.
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index f0791bfc0..4b0852a0c 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,662 @@
+2012-11-23 Allan Sandfeld Jensen <allan.jensen@digia.com>
+
+ tst_qwebpage fails after QMimeDatabase patch
+ https://bugs.webkit.org/show_bug.cgi?id=103125
+
+ Reviewed by Simon Hausmann.
+
+ Replace the static extension->mimetype table with a QMimeDatabase lookup
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::findText):
+ (tst_QWebPage::supportedContentType):
+
+2012-11-23 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] Compiling against QtWebkit API requires QT_DLL to be defined
+ https://bugs.webkit.org/show_bug.cgi?id=102942
+
+ Reviewed by Tor Arne Vestbø.
+
+ Remove the requirement of having QT_DLL defined in order for the QWEBKIT_EXPORT
+ macro to be defined as Q_DECL_IMPORT. Instead unify the export macro definition
+ to follow the same rules as other Qt 5 modules, with the exception that instead of
+ QT_BUILD_WEBKIT_LIB we continue to use BUILDING_WEBKIT, because that's used also
+ in other cross-platform header files to determine the correct meaning of export
+ macros.
+
+ * Api/qwebkitglobal.h:
+
+2012-11-23 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5
+ https://bugs.webkit.org/show_bug.cgi?id=103111
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ This function was added as a slot during Qt 4.x times because adding
+ virtual functions breaks binary compatibility. This constraint is gone
+ with the initial release of WebKit with Qt 5, and therefore we can
+ make it virtual now.
+
+ The change is fully source compatible as existing "re-implementations"
+ as slots will now be called through it being a virtual function. They
+ become unused slots.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::shouldInterruptJavaScript):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+ * WebCoreSupport/QWebPageAdapter.h:
+ (QWebPageAdapter):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (JSTestPage::shouldInterruptJavaScript):
+ (JSTestPage):
+
+2012-11-23 Pierre Rossi <pierre.rossi@gmail.com>
+
+ [Qt] REGRESSION(r135515): 3 appcache tests still failing
+ https://bugs.webkit.org/show_bug.cgi?id=103073
+
+ Rubber-stamped by Simon Hausmann.
+
+ Another sneaky typo.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::applicationCacheQuotaExceeded):
+
+2012-11-22 Pierre Rossi <pierre.rossi@gmail.com>
+
+ [Qt] Avoid initializing PlatformStrategies twice.
+
+ Rubber-stamped by Simon Hausmann.
+
+ This fixes another regression introduced in r135515:
+ initializeWebKitQt shouldn't implicitely call initializeWebCoreQt
+ since it can be called from WebKit2 to initialize QStyle for testing.
+ This would then lead to things such as PlatformStrategies being
+ initialized twice.
+
+ * Api/qwebpage.cpp: Explicitely call initializeWebCoreQt().
+ (QWebPagePrivate::QWebPagePrivate):
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebKit::initializeWebKitQt):
+
+2012-11-23 Simon Hausmann <simon.hausmann@digia.com>
+
+ Unreviewed trivial Qt/Win build fix:
+
+ Include FormState.h/HTMLFormElement.h in the FrameLoaderClient
+ declaration because MSVC needs it. Also fix Q_DECL_EXPORT declarations
+ for functions that are supposed to be exported.
+
+ * Api/qwebelement.cpp:
+ * WebCoreSupport/FrameLoaderClientQt.h:
+ * WebCoreSupport/InitWebCoreQt.h:
+ (WebKit):
+ * WebCoreSupport/InitWebKitQt.h:
+ (WebKit):
+
+2012-11-22 Pierre Rossi <pierre.rossi@gmail.com>
+
+ [Qt] REGRESSION(r135515): It made 3-3 tests fail and crash
+ https://bugs.webkit.org/show_bug.cgi?id=103073
+
+ Rubber-stamped by Simon Hausmann.
+
+ Removing the QNetworkAccessManager member in FrameNetworkingContextQt
+ was right, but we need to be careful as to how we fetch it back.
+ Since the WebCore Page is not always valid, get the QNAM instance
+ straight from the frame adapter through its page adapter instead.
+
+ * WebCoreSupport/ChromeClientQt.cpp: [Style nit] Remove stray emit.
+ * WebCoreSupport/FrameNetworkingContextQt.cpp:
+ (WebCore::FrameNetworkingContextQt::networkAccessManager):
+
+2012-11-22 Simon Hausmann <simon.hausmann@digia.com>
+
+ Unreviewed MSVC Windows build fix: Include header files referenced in RefPtr
+ instances.
+
+ * Api/qwebelement.cpp:
+
+2012-11-22 Simon Hausmann <simon.hausmann@digia.com>, Pierre Rossi <pierre.rossi@digia.com>
+
+ [Qt] Separate QWidget dependant code into separate WebKitWidgets static library
+ https://bugs.webkit.org/show_bug.cgi?id=102800
+
+ Reviewed by Tor Arne Vestbø.
+
+ This patch separates code that needs to use QWidget related APIs in
+ WebKit/qt/WebCoreSupport and Api from code that doesn't. This means for
+ example FrameLoaderClientQt.cpp remains in the WebKit1 static library,
+ while qwebpage.cpp and qwebframe.cpp become part of the WebKitWidgets
+ static library. WebKit1 is compiled without QT += widgets and therefore
+ any widget related dependency has been moved "up" and out of WebKit1 into
+ the WebKitWidgets library.
+
+ Between the code in WebKit.a and WebKitWidgets.a new adapters and
+ interfaces have been introduced, such as QWebPageAdapter and
+ QWebFrameAdapter. QWebPageAdapter, when used from WebKit1, is a way to
+ call out into the API layer, implemented by QWebPage (QWebPagePrivate).
+ The other way around if QWebPage wants to access WebCore or
+ WebCoreSupport related functionality, it will go through
+ QWebPageAdapater (as base class). The separation in the direction up
+ into the API layer is complete with this patch, no code in WebKit1
+ depends on QtWidgets. The separation the other way around, code in the
+ API layer not using any WebCore types, is not complete yet.
+
+ Some classes such as QWebSettings, QWebElement or
+ DumpRenderTreeSupportQt remain in WebKit1. While they are API layer,
+ they do not depend on widget related Qt APIs and they make much more
+ use of WebCore internal APIs and therefore are easier to keep in
+ WebKit1.
+
+ In the future we plan to place a real shared library boundary between
+ WebKit1 and WebKitWidgets, by keeping the WebKit1 static library as
+ part of the QtWebKit shared library and by turning the WebKitWidgets
+ static library into a shared one.
+
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebViewPrivate::pageClient):
+ (QGraphicsWebViewPrivate::detachCurrentPage):
+ (QGraphicsWebView::setPage):
+ * Api/qwebelement.cpp:
+ (QWebElement::webFrame):
+ * Api/qwebframe.cpp:
+ (QWebFramePrivate::setPage):
+ (QWebFramePrivate::didStartProvisionalLoad):
+ (QWebFramePrivate::handleProgressFinished):
+ (QWebFramePrivate::emitInitialLayoutCompleted):
+ (QWebFramePrivate::emitIconChanged):
+ (QWebFramePrivate::emitLoadStarted):
+ (QWebFramePrivate::emitLoadFinished):
+ (QWebFramePrivate::createChildFrame):
+ (QWebFramePrivate::apiHandle):
+ (QWebFramePrivate::handle):
+ (QWebFramePrivate::contentsSizeDidChange):
+ (QWebFramePrivate::scrollBarPolicy):
+ (QWebFrame::QWebFrame):
+ (QWebFrame::~QWebFrame):
+ (QWebFrame::setUrl):
+ (QWebFrame::load):
+ (QWebFrame::scrollPosition):
+ (QWebFrame::geometry):
+ (QWebFramePrivate::kit):
+ (QWebFrame::handle):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+ (QWebFramePrivate::QWebFramePrivate):
+ (QWebFramePrivate):
+ * Api/qwebhistory.cpp:
+ (QWebHistoryPrivate::page):
+ * Api/qwebhistory_p.h:
+ (QWebHistoryPrivate):
+ * Api/qwebinspector.cpp:
+ (QWebInspectorPrivate::setFrontend):
+ * Api/qwebinspector_p.h:
+ (QWebInspectorPrivate):
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPagePrivate::~QWebPagePrivate):
+ (QWebPagePrivate::core):
+ (QWebPagePrivate::show):
+ (QWebPagePrivate::setFocus):
+ (QWebPagePrivate::unfocus):
+ (QWebPagePrivate::setWindowRect):
+ (QWebPagePrivate::viewportSize):
+ (QWebPagePrivate::createWindow):
+ (QWebPagePrivate::javaScriptConsoleMessage):
+ (QWebPagePrivate::javaScriptAlert):
+ (QWebPagePrivate::javaScriptConfirm):
+ (QWebPagePrivate::javaScriptPrompt):
+ (QWebPagePrivate::printRequested):
+ (QWebPagePrivate::databaseQuotaExceeded):
+ (QWebPagePrivate::applicationCacheQuotaExceeded):
+ (QWebPagePrivate::setToolTip):
+ (QWebPagePrivate::createFullScreenVideoHandler):
+ (QWebPagePrivate::mainFrameAdapter):
+ (QWebPagePrivate::chooseFiles):
+ (QWebPagePrivate::acceptNavigationRequest):
+ (QWebPagePrivate::emitRestoreFrameStateRequested):
+ (QWebPagePrivate::emitSaveFrameStateRequested):
+ (QWebPagePrivate::emitDownloadRequested):
+ (QWebPagePrivate::emitFrameCreated):
+ (QWebPagePrivate::errorPageExtension):
+ (QWebPagePrivate::createPlugin):
+ (QWebPagePrivate::adapterForWidget):
+ (QWebPagePrivate::createMainFrame):
+ (QWebPagePrivate::createContextMenu):
+ (QWebPagePrivate::inspectorHandle):
+ (QWebPagePrivate::setInspectorFrontend):
+ (QWebPagePrivate::setInspectorWindowTitle):
+ (QWebPagePrivate::createWebInspector):
+ (iterateContextMenu):
+ (QWebPagePrivate::menuActionsAsText):
+ (QWebPagePrivate::emitViewportChangeRequested):
+ (QWebPagePrivate::mouseMoveEvent):
+ (QWebPagePrivate::mousePressEvent):
+ (QWebPagePrivate::mouseDoubleClickEvent):
+ (QWebPagePrivate::mouseTripleClickEvent):
+ (QWebPagePrivate::mouseReleaseEvent):
+ (QWebPagePrivate::handleSoftwareInputPanel):
+ (QWebPagePrivate::wheelEvent):
+ (QWebPagePrivate::gestureEvent):
+ (QWebPage::setView):
+ (QWebPage::javaScriptConsoleMessage):
+ (QWebPage::javaScriptAlert):
+ (QWebPage::javaScriptConfirm):
+ (QWebPage::javaScriptPrompt):
+ (QWebPage::shouldInterruptJavaScript):
+ (QWebPage::setFeaturePermission):
+ (QWebPagePrivate::colorSelectionRequested):
+ (QWebPagePrivate::createSelectPopup):
+ (QWebPagePrivate::viewRectRelativeToWindow):
+ (QWebPagePrivate::geolocationPermissionRequested):
+ (QWebPagePrivate::geolocationPermissionRequestCancelled):
+ (QWebPagePrivate::notificationsPermissionRequested):
+ (QWebPagePrivate::notificationsPermissionRequestCancelled):
+ (QWebPagePrivate::respondToChangedContents):
+ (QWebPagePrivate::respondToChangedSelection):
+ (QWebPagePrivate::microFocusChanged):
+ (QWebPagePrivate::triggerCopyAction):
+ (QWebPagePrivate::triggerActionForKeyEvent):
+ (QWebPagePrivate::clearUndoStack):
+ (QWebPagePrivate::canUndo):
+ (QWebPagePrivate::canRedo):
+ (QWebPagePrivate::undo):
+ (QWebPagePrivate::redo):
+ (QWebPagePrivate::createUndoStep):
+ (QWebPagePrivate::editorCommandForKeyEvent):
+ (QWebPage::viewportSize):
+ (QWebPage::setViewportSize):
+ (QWebPage::viewportAttributesForSize):
+ (QWebPage::event):
+ (QWebPage::extension):
+ (QWebPage::handle):
+ (QWebPage::chooseFile):
+ (QWebPage::setNetworkAccessManager):
+ (QWebPage::networkAccessManager):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ (WebCore):
+ (QWebPagePrivate):
+ * Api/qwebsettings.cpp:
+ * Api/qwebsettings.h:
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::detachCurrentPage):
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::ChromeClientQt):
+ (WebCore::ChromeClientQt::setWindowRect):
+ (WebCore::ChromeClientQt::focus):
+ (WebCore::ChromeClientQt::unfocus):
+ (WebCore::ChromeClientQt::createWindow):
+ (WebCore::ChromeClientQt::show):
+ (WebCore::ChromeClientQt::setToolbarsVisible):
+ (WebCore::ChromeClientQt::setStatusbarVisible):
+ (WebCore::ChromeClientQt::setMenubarVisible):
+ (WebCore::ChromeClientQt::addMessageToConsole):
+ (WebCore::ChromeClientQt::closeWindowSoon):
+ (WebCore::ChromeClientQt::runJavaScriptAlert):
+ (WebCore::ChromeClientQt::runJavaScriptConfirm):
+ (WebCore::ChromeClientQt::runJavaScriptPrompt):
+ (WebCore::ChromeClientQt::setStatusbarText):
+ (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+ (WebCore::ChromeClientQt::keyboardUIMode):
+ (WebCore::ChromeClientQt::windowResizerRect):
+ * WebCoreSupport/ChromeClientQt.h:
+ (ChromeClientQt):
+ * WebCoreSupport/ContextMenuClientQt.cpp:
+ * WebCoreSupport/ContextMenuClientQt.h:
+ (ContextMenuClientQt):
+ * WebCoreSupport/DefaultFullScreenVideoHandler.cpp: Added.
+ (DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler):
+ (DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler):
+ (DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback):
+ (DefaultFullScreenVideoHandler::enterFullScreen):
+ (DefaultFullScreenVideoHandler::exitFullScreen):
+ * WebCoreSupport/DefaultFullScreenVideoHandler.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (WebKit):
+ (DefaultFullScreenVideoHandler):
+ * WebCoreSupport/DragClientQt.cpp:
+ (WebCore::DragClientQt::startDrag):
+ * WebCoreSupport/DragClientQt.h:
+ (WebCore):
+ (WebCore::DragClientQt::DragClientQt):
+ (DragClientQt):
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (toGeolocationClientMock):
+ (toDeviceOrientationClientMock):
+ (DumpRenderTreeSupportQt::initialize):
+ (DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled):
+ (DumpRenderTreeSupportQt::setFrameFlatteningEnabled):
+ (DumpRenderTreeSupportQt::webPageSetGroupName):
+ (DumpRenderTreeSupportQt::webPageGroupName):
+ (DumpRenderTreeSupportQt::webInspectorExecuteScript):
+ (DumpRenderTreeSupportQt::webInspectorShow):
+ (DumpRenderTreeSupportQt::webInspectorClose):
+ (DumpRenderTreeSupportQt::hasDocumentElement):
+ (DumpRenderTreeSupportQt::pauseAnimation):
+ (DumpRenderTreeSupportQt::pauseTransitionOfProperty):
+ (DumpRenderTreeSupportQt::numberOfActiveAnimations):
+ (DumpRenderTreeSupportQt::clearFrameName):
+ (DumpRenderTreeSupportQt::setCaretBrowsingEnabled):
+ (DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled):
+ (DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled):
+ (DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled):
+ (DumpRenderTreeSupportQt::executeCoreCommandByName):
+ (DumpRenderTreeSupportQt::isCommandEnabled):
+ (DumpRenderTreeSupportQt::findString):
+ (DumpRenderTreeSupportQt::selectedRange):
+ (DumpRenderTreeSupportQt::firstRectForCharacterRange):
+ (DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId):
+ (DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior):
+ (DumpRenderTreeSupportQt::viewportAsText):
+ (DumpRenderTreeSupportQt::scalePageBy):
+ (DumpRenderTreeSupportQt::setMockDeviceOrientation):
+ (DumpRenderTreeSupportQt::resetGeolocationMock):
+ (DumpRenderTreeSupportQt::setMockGeolocationPermission):
+ (DumpRenderTreeSupportQt::setMockGeolocationPosition):
+ (DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError):
+ (DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests):
+ (DumpRenderTreeSupportQt::shouldClose):
+ (DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
+ (DumpRenderTreeSupportQt::addUserStyleSheet):
+ (DumpRenderTreeSupportQt::removeUserStyleSheets):
+ (DumpRenderTreeSupportQt::setDefersLoading):
+ (DumpRenderTreeSupportQt::goBack):
+ (DumpRenderTreeSupportQt::responseMimeType):
+ (DumpRenderTreeSupportQt::clearOpener):
+ (DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled):
+ (DumpRenderTreeSupportQt::contextMenu):
+ (DumpRenderTreeSupportQt::setMinimumTimerInterval):
+ (DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows):
+ (DumpRenderTreeSupportQt::mediaContentUrlByElementId):
+ (DumpRenderTreeSupportQt::setAlternateHtml):
+ (DumpRenderTreeSupportQt::confirmComposition):
+ (DumpRenderTreeSupportQt::injectInternalsObject):
+ (DumpRenderTreeSupportQt::resetInternalsObject):
+ (DumpRenderTreeSupportQt::paintPagesWithBoundaries):
+ (DumpRenderTreeSupportQt::setTrackRepaintRects):
+ (DumpRenderTreeSupportQt::trackRepaintRects):
+ (DumpRenderTreeSupportQt::getTrackedRepaintRects):
+ * WebCoreSupport/DumpRenderTreeSupportQt.h:
+ * WebCoreSupport/EditorClientQt.cpp:
+ (dumpRange):
+ (WebCore::EditorClientQt::shouldShowDeleteInterface):
+ (WebCore::EditorClientQt::shouldInsertText):
+ (WebCore::EditorClientQt::shouldChangeSelectedRange):
+ (WebCore::EditorClientQt::shouldApplyStyle):
+ (WebCore::EditorClientQt::respondToChangedContents):
+ (WebCore::EditorClientQt::respondToChangedSelection):
+ (WebCore::EditorClientQt::registerUndoStep):
+ (WebCore::EditorClientQt::clearUndoRedoOperations):
+ (WebCore::EditorClientQt::canUndo):
+ (WebCore::EditorClientQt::canRedo):
+ (WebCore::EditorClientQt::undo):
+ (WebCore::EditorClientQt::redo):
+ (WebCore::EditorClientQt::shouldInsertNode):
+ (WebCore::EditorClientQt::smartInsertDeleteEnabled):
+ (WebCore::EditorClientQt::toggleSmartInsertDelete):
+ (WebCore::EditorClientQt::isSelectTrailingWhitespaceEnabled):
+ (WebCore::EditorClientQt::handleKeyboardEvent):
+ (WebCore::EditorClientQt::EditorClientQt):
+ (WebCore::EditorClientQt::setInputMethodState):
+ * WebCoreSupport/EditorClientQt.h:
+ (EditorClientQt):
+ (WebCore::EditorClientQt::setSmartInsertDeleteEnabled):
+ (WebCore::EditorClientQt::setSelectTrailingWhitespaceEnabled):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (drtDescriptionSuitableForTestResult):
+ (WebCore::FrameLoaderClientQt::setFrame):
+ (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
+ (WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage):
+ (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidFinishDocumentLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
+ (WebCore::FrameLoaderClientQt::dispatchDidLayout):
+ (WebCore::FrameLoaderClientQt::dispatchWillSubmitForm):
+ (WebCore::FrameLoaderClientQt::postProgressStartedNotification):
+ (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
+ (WebCore::FrameLoaderClientQt::frameLoadCompleted):
+ (WebCore::FrameLoaderClientQt::restoreViewState):
+ (WebCore::FrameLoaderClientQt::userAgent):
+ (WebCore::FrameLoaderClientQt::dispatchDidReceiveIcon):
+ (WebCore::FrameLoaderClientQt::frameLoaderDestroyed):
+ (WebCore::FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld):
+ (WebCore::FrameLoaderClientQt::didPerformFirstNavigation):
+ (WebCore::FrameLoaderClientQt::onIconLoadedForPageURL):
+ (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks):
+ (WebCore::FrameLoaderClientQt::saveViewStateToItem):
+ (WebCore::FrameLoaderClientQt::cancelledError):
+ (WebCore::FrameLoaderClientQt::blockedError):
+ (WebCore::FrameLoaderClientQt::cannotShowURLError):
+ (WebCore::FrameLoaderClientQt::interruptedForPolicyChangeError):
+ (WebCore::FrameLoaderClientQt::cannotShowMIMETypeError):
+ (WebCore::FrameLoaderClientQt::fileDoesNotExistError):
+ (WebCore::FrameLoaderClientQt::pluginWillHandleLoadError):
+ (WebCore::FrameLoaderClientQt::download):
+ (WebCore::FrameLoaderClientQt::dispatchWillSendRequest):
+ (WebCore::FrameLoaderClientQt::dispatchDidReceiveResponse):
+ (WebCore::FrameLoaderClientQt::dispatchDidFinishLoading):
+ (WebCore::FrameLoaderClientQt::dispatchDidFailLoading):
+ (WebCore::FrameLoaderClientQt::callErrorPageExtension):
+ (WebCore::FrameLoaderClientQt::dispatchCreatePage):
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
+ (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
+ (WebCore::FrameLoaderClientQt::startDownload):
+ (WebCore::FrameLoaderClientQt::createFrame):
+ (WebCore::FrameLoaderClientQt::createPlugin):
+ (WebCore::FrameLoaderClientQt::createJavaAppletWidget):
+ (WebCore::FrameLoaderClientQt::chooseFile):
+ (WebCore::FrameLoaderClientQt::createNetworkingContext):
+ (WebCore):
+ (WebCore::FrameLoaderClientQt::webFrame):
+ (WebCore::FrameLoaderClientQt::emitLoadStarted):
+ (WebCore::FrameLoaderClientQt::emitLoadFinished):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+ (FrameLoaderClientQt):
+ * WebCoreSupport/FrameNetworkingContextQt.cpp:
+ (WebCore::FrameNetworkingContextQt::FrameNetworkingContextQt):
+ (WebCore::FrameNetworkingContextQt::create):
+ (WebCore::FrameNetworkingContextQt::networkAccessManager):
+ * WebCoreSupport/FrameNetworkingContextQt.h:
+ (FrameNetworkingContextQt):
+ * WebCoreSupport/FullScreenVideoQt.cpp:
+ (WebCore):
+ (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+ * WebCoreSupport/FullScreenVideoQt.h:
+ (WebCore):
+ * WebCoreSupport/FullScreenVideoWidget.cpp:
+ * WebCoreSupport/FullScreenVideoWidget.h:
+ * WebCoreSupport/GeolocationClientQt.cpp:
+ (WebCore::GeolocationClientQt::GeolocationClientQt):
+ (WebCore::GeolocationClientQt::positionUpdated):
+ (WebCore::GeolocationClientQt::startUpdating):
+ (WebCore::GeolocationClientQt::requestPermission):
+ (WebCore::GeolocationClientQt::cancelPermissionRequest):
+ * WebCoreSupport/GeolocationClientQt.h:
+ (GeolocationClientQt):
+ * WebCoreSupport/GeolocationPermissionClientQt.cpp:
+ (WebCore::GeolocationPermissionClientQt::requestGeolocationPermissionForFrame):
+ (WebCore::GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame):
+ (WebCore::GeolocationPermissionClientQt::setPermission):
+ * WebCoreSupport/GeolocationPermissionClientQt.h:
+ (GeolocationPermissionClientQt):
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebKit):
+ (WebKit::setWebKitWidgetsInitCallback):
+ (WebKit::initializeWebKitQt):
+ (WebKit::setImagePlatformResource):
+ (WebCore::initializeWebCoreQt):
+ * WebCoreSupport/InitWebCoreQt.h:
+ (WebCore):
+ (WebKit):
+ * WebCoreSupport/InitWebKitQt.cpp: Added.
+ (WebKit):
+ (WebKit::initializeWebKitWidgets):
+ * WebCoreSupport/InitWebKitQt.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (WebKit):
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore):
+ (WebCore::InspectorClientQt::InspectorClientQt):
+ (WebCore::InspectorClientQt::openInspectorFrontend):
+ (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend):
+ (WebCore::InspectorClientQt::detachRemoteFrontend):
+ (WebCore::InspectorClientQt::hideHighlight):
+ (WebCore::InspectorClientQt::sendMessageToFrontend):
+ (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
+ (WebCore::InspectorFrontendClientQt::updateWindowTitle):
+ (WebCore::InspectorFrontendClientQt::destroyInspectorView):
+ * WebCoreSupport/InspectorClientQt.h:
+ (InspectorClientQt):
+ (InspectorFrontendClientQt):
+ * WebCoreSupport/InspectorClientWebPage.cpp: Added.
+ (InspectorClientWebPage::InspectorClientWebPage):
+ (InspectorClientWebPage::createWindow):
+ (InspectorClientWebPage::javaScriptWindowObjectCleared):
+ * WebCoreSupport/InspectorClientWebPage.h: Copied from Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h.
+ (WebKit):
+ (InspectorClientWebPage):
+ * WebCoreSupport/InspectorServerQt.cpp:
+ (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
+ (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead):
+ * WebCoreSupport/InspectorServerQt.h:
+ (InspectorServerQt):
+ (InspectorServerRequestHandlerQt):
+ * WebCoreSupport/NotificationPresenterClientQt.cpp:
+ (WebCore::NotificationWrapper::NotificationWrapper):
+ (WebCore::NotificationPresenterClientQt::displayNotification):
+ (WebCore::NotificationPresenterClientQt::requestPermission):
+ (WebCore::NotificationPresenterClientQt::cancelRequestsForPermission):
+ (WebCore::NotificationPresenterClientQt::dumpShowText):
+ (WebCore::NotificationPresenterClientQt::toPage):
+ (WebCore::NotificationPresenterClientQt::toFrame):
+ * WebCoreSupport/NotificationPresenterClientQt.h:
+ (WebCore::NotificationWrapper::~NotificationWrapper):
+ (NotificationWrapper):
+ (NotificationPresenterClientQt):
+ (WebCore::NotificationPresenterClientQt::hasSystemTrayIcon):
+ (WebCore::NotificationPresenterClientQt::setSystemTrayIcon):
+ (CallbacksInfo):
+ (WebCore):
+ * WebCoreSupport/PageClientQt.cpp:
+ (createPlatformGraphicsContext3DFromWidget):
+ (QWebPageClient::ownerWindow):
+ (WebCore::PageClientQWidget::ownerWidget):
+ (WebCore::PageClientQWidget::createPlatformGraphicsContext3D):
+ (WebCore::PageClientQGraphicsWidget::ownerWidget):
+ (WebCore::PageClientQGraphicsWidget::createPlatformGraphicsContext3D):
+ * WebCoreSupport/PageClientQt.h:
+ (PageClientQWidget):
+ (WebCore::QGraphicsItemOverlay::QGraphicsItemOverlay):
+ (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget):
+ (PageClientQGraphicsWidget):
+ * WebCoreSupport/PlatformStrategiesQt.cpp:
+ (PlatformStrategiesQt::getPluginInfo):
+ * WebCoreSupport/PopupMenuQt.cpp:
+ (SelectData::SelectData):
+ * WebCoreSupport/QGraphicsWidgetPluginImpl.cpp: Added.
+ (QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl):
+ (QGraphicsWidgetPluginImpl::update):
+ (QGraphicsWidgetPluginImpl::setGeometryAndClip):
+ (QGraphicsWidgetPluginImpl::setVisible):
+ (QGraphicsWidgetPluginImpl::setWidgetParent):
+ (QGraphicsWidgetPluginImpl::handle):
+ * WebCoreSupport/QGraphicsWidgetPluginImpl.h: Added.
+ (QGraphicsWidgetPluginImpl):
+ (QGraphicsWidgetPluginImpl::QGraphicsWidgetPluginImpl):
+ * WebCoreSupport/QWebFrameAdapter.cpp: Added.
+ (cacheLoadControlToCachePolicy):
+ (QWebFrameData::QWebFrameData):
+ (QWebFrameAdapter::QWebFrameAdapter):
+ (QWebFrameAdapter::~QWebFrameAdapter):
+ (QWebFrameAdapter::load):
+ (QWebFrameAdapter::handleGestureEvent):
+ (QWebFrameAdapter::scrollPosition):
+ (QWebFrameAdapter::frameRect):
+ (QWebFrameAdapter::init):
+ (QWebFrameAdapter::kit):
+ (QWebFrameAdapter::ensureAbsoluteUrl):
+ * WebCoreSupport/QWebFrameAdapter.h: Added.
+ (WebCore):
+ (QWebFrameData):
+ (QWebFrameAdapter):
+ (QWebFrameAdapter::hasView):
+ * WebCoreSupport/QWebPageAdapter.cpp: Added.
+ (QWebPageAdapter::QWebPageAdapter):
+ (QWebPageAdapter::~QWebPageAdapter):
+ (QWebPageAdapter::init):
+ (QWebPageAdapter::deletePage):
+ (QWebPageAdapter::kit):
+ (QWebPageAdapter::viewportArguments):
+ (QWebPageAdapter::registerUndoStep):
+ (QWebPageAdapter::setNetworkAccessManager):
+ (QWebPageAdapter::networkAccessManager):
+ * WebCoreSupport/QWebPageAdapter.h: Added.
+ (WebCore):
+ (QWebPageAdapter):
+ (ErrorPageOption):
+ (ErrorPageReturn):
+ * WebCoreSupport/QWebUndoCommand.cpp: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (QWebUndoCommand::QWebUndoCommand):
+ (QWebUndoCommand::undo):
+ (QWebUndoCommand::redo):
+ * WebCoreSupport/QWebUndoCommand.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (QWebUndoCommand):
+ * WebCoreSupport/QWidgetPluginImpl.cpp: Added.
+ (QWidgetPluginImpl::~QWidgetPluginImpl):
+ (QWidgetPluginImpl::update):
+ (QWidgetPluginImpl::setGeometryAndClip):
+ (QWidgetPluginImpl::setVisible):
+ (QWidgetPluginImpl::setStyleSheet):
+ (QWidgetPluginImpl::setWidgetParent):
+ (QWidgetPluginImpl::handle):
+ * WebCoreSupport/QWidgetPluginImpl.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (QWidgetPluginImpl):
+ (QWidgetPluginImpl::QWidgetPluginImpl):
+ * WebCoreSupport/QtFallbackWebPopup.cpp:
+ (WebCore::QtFallbackWebPopup::QtFallbackWebPopup):
+ (WebCore::QtFallbackWebPopup::show):
+ (WebCore::QtFallbackWebPopup::pageClient):
+ * WebCoreSupport/QtFallbackWebPopup.h:
+ (QtFallbackWebPopup):
+ * WebCoreSupport/QtPluginWidgetAdapter.h: Copied from Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h.
+ (QtPluginWidgetAdapter):
+ * WebCoreSupport/QtWebComboBox.cpp:
+ (WebCore::QtWebComboBox::showPopupAtCursorPosition):
+ * WebCoreSupport/QtWebComboBox.h:
+ * WebCoreSupport/SearchPopupMenuQt.h:
+ (SearchPopupMenuQt):
+ * WebCoreSupport/UndoStepQt.cpp:
+ (UndoStepQt::UndoStepQt):
+ (UndoStepQt::text):
+ * WebCoreSupport/UndoStepQt.h:
+ (UndoStepQt):
+ * WebCoreSupport/WebEventConversion.cpp:
+ (WebCore::mouseEventTypeAndMouseButtonFromQEvent):
+ (WebKitPlatformWheelEvent):
+ (WebCore::WebKitPlatformWheelEvent::applyDelta):
+ (WebCore::WebKitPlatformWheelEvent::WebKitPlatformWheelEvent):
+ (WebKitPlatformGestureEvent):
+ (WebCore::toPlatformEventType):
+ (WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent):
+ (WebCore):
+ (WebCore::convertWheelEvent):
+ (WebCore::convertGesture):
+ * WebCoreSupport/WebEventConversion.h:
+ (QGestureEventFacade):
+ (WebCore):
+ * WebCoreSupport/WebSystemInterface.h:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::loadHtml5Video):
+ (tst_QWebPage::multiplePageGroupsAndLocalStorage):
+ (tst_QWebPage::thirdPartyCookiePolicy):
+
2012-11-21 Allan Sandfeld Jensen <allan.jensen@digia.com>
Position in QWebHitTestResult does not match documentation
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index eaaeb012f..05f7b949d 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -53,27 +53,25 @@
#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "Page.h"
-#include "PageClientQt.h"
#include "PopupMenuQt.h"
-#include "QtFallbackWebPopup.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "QWebPageClient.h"
#include "ScrollbarTheme.h"
#include "SearchPopupMenuQt.h"
#include "SecurityOrigin.h"
+#include "TiledBackingStore.h"
#include "ViewportArguments.h"
#include "WindowFeatures.h"
-
-#include "qgraphicswebview.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
+#include "qwebkitplatformplugin.h"
#include "qwebsecurityorigin.h"
#include "qwebsecurityorigin_p.h"
-#include "qwebview.h"
+#include "qwebsettings.h"
+
#include <qabstractanimation.h>
#include <qdebug.h>
#include <qeventloop.h>
-#include <qtooltip.h>
+#include <qwindow.h>
#include <wtf/OwnPtr.h>
#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
@@ -124,8 +122,8 @@ private:
bool ChromeClientQt::dumpVisitedLinksCallbacks = false;
-ChromeClientQt::ChromeClientQt(QWebPage* webPage)
- : m_webPage(webPage)
+ChromeClientQt::ChromeClientQt(QWebPageAdapter* webPageAdapter)
+ : m_webPage(webPageAdapter)
, m_eventLoop(0)
#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
, m_fullScreenVideo(0)
@@ -148,8 +146,7 @@ void ChromeClientQt::setWindowRect(const FloatRect& rect)
{
if (!m_webPage)
return;
- emit m_webPage->geometryChangeRequested(QRect(qRound(rect.x()), qRound(rect.y()),
- qRound(rect.width()), qRound(rect.height())));
+ m_webPage->setWindowRect(QRect(qRound(rect.x()), qRound(rect.y()), qRound(rect.width()), qRound(rect.height())));
}
/*!
@@ -182,11 +179,7 @@ void ChromeClientQt::focus()
{
if (!m_webPage)
return;
- QWidget* view = m_webPage->view();
- if (!view)
- return;
-
- view->setFocus();
+ m_webPage->setFocus();
}
@@ -194,10 +187,7 @@ void ChromeClientQt::unfocus()
{
if (!m_webPage)
return;
- QWidget* view = m_webPage->view();
- if (!view)
- return;
- view->clearFocus();
+ m_webPage->unfocus();
}
bool ChromeClientQt::canTakeFocus(FocusDirection)
@@ -227,24 +217,18 @@ void ChromeClientQt::focusedFrameChanged(Frame*)
Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&)
{
- QWebPage* newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow);
+ QWebPageAdapter* newPage = m_webPage->createWindow(features.dialog);
if (!newPage)
return 0;
- // A call to QWebPage::mainFrame() implicitly creates the main frame.
- // Make sure it exists, as WebCore expects it when returning from this call.
- newPage->mainFrame();
- return newPage->d->page;
+ return newPage->page;
}
void ChromeClientQt::show()
{
if (!m_webPage)
return;
- QWidget* view = m_webPage->view();
- if (!view)
- return;
- view->window()->show();
+ m_webPage->show();
}
@@ -266,7 +250,7 @@ void ChromeClientQt::runModal()
void ChromeClientQt::setToolbarsVisible(bool visible)
{
toolBarsVisible = visible;
- emit m_webPage->toolBarVisibilityChangeRequested(visible);
+ QMetaObject::invokeMethod(m_webPage->handle(), "toolBarVisibilityChangeRequested", Q_ARG(bool, visible));
}
@@ -278,7 +262,7 @@ bool ChromeClientQt::toolbarsVisible()
void ChromeClientQt::setStatusbarVisible(bool visible)
{
- emit m_webPage->statusBarVisibilityChangeRequested(visible);
+ QMetaObject::invokeMethod(m_webPage->handle(), "statusBarVisibilityChangeRequested", Q_ARG(bool, visible));
statusBarVisible = visible;
}
@@ -305,7 +289,7 @@ bool ChromeClientQt::scrollbarsVisible()
void ChromeClientQt::setMenubarVisible(bool visible)
{
menuBarVisible = visible;
- emit m_webPage->menuBarVisibilityChangeRequested(visible);
+ QMetaObject::invokeMethod(m_webPage->handle(), "menuBarVisibilityChangeRequested", Q_ARG(bool, visible));
}
bool ChromeClientQt::menubarVisible()
@@ -318,8 +302,7 @@ void ChromeClientQt::setResizable(bool)
notImplemented();
}
-void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message,
- unsigned int lineNumber, const String& sourceID)
+void ChromeClientQt::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID)
{
QString x = message;
QString y = sourceID;
@@ -343,30 +326,26 @@ bool ChromeClientQt::runBeforeUnloadConfirmPanel(const String& message, Frame* f
void ChromeClientQt::closeWindowSoon()
{
- m_webPage->d->page->setGroupName(String());
- m_webPage->mainFrame()->d->frame->loader()->stopAllLoaders();
- emit m_webPage->windowCloseRequested();
+ m_webPage->page->setGroupName(String());
+ m_webPage->page->mainFrame()->loader()->stopAllLoaders();
+ QMetaObject::invokeMethod(m_webPage->handle(), "windowCloseRequested");
}
void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg)
{
- QString x = msg;
- QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
- m_webPage->javaScriptAlert(webFrame, x);
+ m_webPage->javaScriptAlert(QWebFrameAdapter::kit(f), msg);
}
bool ChromeClientQt::runJavaScriptConfirm(Frame* f, const String& msg)
{
- QString x = msg;
- QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
- return m_webPage->javaScriptConfirm(webFrame, x);
+ return m_webPage->javaScriptConfirm(QWebFrameAdapter::kit(f), msg);
}
bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const String& defaultValue, String& result)
{
QString x = result;
- QWebFrame* webFrame = qobject_cast<QWebFrame*>(f->loader()->networkingContext()->originatingObject());
- bool rc = m_webPage->javaScriptPrompt(webFrame, (QString)message, (QString)defaultValue, &x);
+ QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(f);
+ bool rc = m_webPage->javaScriptPrompt(webFrame, message, defaultValue, &x);
// Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
// but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
@@ -381,19 +360,17 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
void ChromeClientQt::setStatusbarText(const String& msg)
{
QString x = msg;
- emit m_webPage->statusBarMessage(x);
+ QMetaObject::invokeMethod(m_webPage->handle(), "statusBarMessage", Q_ARG(QString, x));
}
bool ChromeClientQt::shouldInterruptJavaScript()
{
- bool shouldInterrupt = false;
- QMetaObject::invokeMethod(m_webPage, "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt));
- return shouldInterrupt;
+ return m_webPage->shouldInterruptJavaScript();
}
KeyboardUIMode ChromeClientQt::keyboardUIMode()
{
- return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain)
+ return m_webPage->settings->testAttribute(QWebSettings::LinksIncludedInFocusChain)
? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
}
@@ -407,11 +384,10 @@ IntRect ChromeClientQt::windowResizerRect() const
if (!pageClient)
return IntRect();
- QWidget* ownerWidget = pageClient->ownerWidget();
- if (!ownerWidget)
+ QWindow* topLevelWidget = pageClient->ownerWindow();
+ if (!topLevelWidget)
return IntRect();
- QWidget* topLevelWidget = ownerWidget->window();
QRect topLevelGeometry(topLevelWidget->geometry());
// There's no API in Qt to query for the size of the resizer, so we assume
@@ -423,12 +399,13 @@ IntRect ChromeClientQt::windowResizerRect() const
// it might even be on the lower left side of the window, but in WebKit we
// always draw scrollbars on the right hand side, so we assume this to be the
// location when computing the resize rect to reserve for WebKit.
- QPoint resizeCornerTopLeft = ownerWidget->mapFrom(topLevelWidget,
- QPoint(topLevelGeometry.width(), topLevelGeometry.height())
- - QPoint(scollbarThickness, scollbarThickness));
+ QPoint resizeCornerTopLeft = QPoint(topLevelGeometry.width(), topLevelGeometry.height())
+ - QPoint(scollbarThickness, scollbarThickness))
+ - m_webPage->viewRectRelativeToWindow().topLeft();
QRect resizeCornerRect = QRect(resizeCornerTopLeft, QSize(scollbarThickness, scollbarThickness));
return resizeCornerRect.intersected(pageClient->geometryRelativeToOwnerWidget());
+
#else
return IntRect();
#endif
@@ -438,7 +415,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool)
{
#if USE(TILED_BACKING_STORE)
if (platformPageClient()) {
- WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(m_webPage->mainFrame())->tiledBackingStore();
+ WebCore::TiledBackingStore* backingStore = m_webPage->mainFrameAdapter()->frame->tiledBackingStore();
if (!backingStore)
return;
backingStore->invalidate(windowRect);
@@ -448,7 +425,7 @@ void ChromeClientQt::invalidateRootView(const IntRect& windowRect, bool)
#endif
}
-void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool immediate)
+void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bool)
{
// No double buffer, so only update the QWidget if content changed.
if (platformPageClient()) {
@@ -457,9 +434,9 @@ void ChromeClientQt::invalidateContentsAndRootView(const IntRect& windowRect, bo
if (!rect.isEmpty())
platformPageClient()->update(rect);
}
- QMetaObject::invokeMethod(m_webPage, "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect));
+ QMetaObject::invokeMethod(m_webPage->handle(), "repaintRequested", Qt::QueuedConnection, Q_ARG(QRect, windowRect));
- // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag
+ // FIXME: There is no "immediate" support for window painting. This should be done always whenever the flag
// is set.
}
@@ -472,14 +449,18 @@ void ChromeClientQt::scroll(const IntSize& delta, const IntRect& scrollViewRect,
{
if (platformPageClient())
platformPageClient()->scroll(delta.width(), delta.height(), scrollViewRect);
- emit m_webPage->scrollRequested(delta.width(), delta.height(), scrollViewRect);
+ QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, delta.width()), Q_ARG(int, delta.height()), Q_ARG(QRect, scrollViewRect));
}
#if USE(TILED_BACKING_STORE)
void ChromeClientQt::delegatedScrollRequested(const IntPoint& point)
{
- QPoint currentPosition(m_webPage->mainFrame()->scrollPosition());
- emit m_webPage->scrollRequested(point.x() - currentPosition.x(), point.y() - currentPosition.y(), QRect(QPoint(0, 0), m_webPage->viewportSize()));
+
+ IntSize currentPosition = m_webPage->mainFrameAdapter()->scrollPosition();
+ int x = point.x() - currentPosition.width();
+ int y = point.y() - currentPosition.height();
+ const QRect rect(QPoint(0, 0), m_webPage->viewportSize());
+ QMetaObject::invokeMethod(m_webPage->handle(), "scrollRequested", Q_ARG(int, x), Q_ARG(int, y), Q_ARG(QRect, rect));
}
#endif
@@ -489,12 +470,12 @@ IntRect ChromeClientQt::rootViewToScreen(const IntRect& rect) const
if (!pageClient)
return rect;
- QWidget* ownerWidget = pageClient->ownerWidget();
- if (!ownerWidget)
- return rect;
+ QWindow* ownerWindow = pageClient->ownerWindow();
+ if (!ownerWindow)
+ return rect;
QRect screenRect(rect);
- screenRect.translate(ownerWidget->mapToGlobal(QPoint(0, 0)));
+ screenRect.translate(ownerWindow->mapToGlobal(m_webPage->viewRectRelativeToWindow().topLeft()));
return screenRect;
}
@@ -505,22 +486,22 @@ IntPoint ChromeClientQt::screenToRootView(const IntPoint& point) const
if (!pageClient)
return point;
- QWidget* ownerWidget = pageClient->ownerWidget();
- if (!ownerWidget)
+ QWindow* ownerWindow = pageClient->ownerWindow();
+ if (!ownerWindow)
return point;
- return ownerWidget->mapFromGlobal(point);
+ return ownerWindow->mapFromGlobal(point) - m_webPage->viewRectRelativeToWindow().topLeft();
}
PlatformPageClient ChromeClientQt::platformPageClient() const
{
- return m_webPage->d->client.get();
+ return m_webPage->client.data();
}
void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
if (frame->loader()->networkingContext())
- QWebFramePrivate::kit(frame)->contentsSizeChanged(size);
+ QWebFrameAdapter::kit(frame)->contentsSizeDidChange(size);
}
void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
@@ -532,33 +513,19 @@ void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsign
lastHoverURL = result.absoluteLinkURL();
lastHoverTitle = result.title(dir);
lastHoverContent = result.textContent();
- emit m_webPage->linkHovered(lastHoverURL.string(),
- lastHoverTitle, lastHoverContent);
+ QMetaObject::invokeMethod(m_webPage->handle(), "linkHovered", Q_ARG(QString, lastHoverURL.string()),
+ Q_ARG(QString, lastHoverTitle), Q_ARG(QString, lastHoverContent));
}
}
void ChromeClientQt::setToolTip(const String &tip, TextDirection)
{
-#ifndef QT_NO_TOOLTIP
- QWidget* view = m_webPage->view();
- if (!view)
- return;
-
- if (tip.isEmpty()) {
- view->setToolTip(QString());
- QToolTip::hideText();
- } else {
- QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>");
- view->setToolTip(dtip);
- }
-#else
- Q_UNUSED(tip);
-#endif
+ m_webPage->setToolTip(tip);
}
void ChromeClientQt::print(Frame* frame)
{
- emit m_webPage->printRequested(QWebFramePrivate::kit(frame));
+ emit m_webPage->printRequested(QWebFrameAdapter::kit(frame));
}
#if ENABLE(SQL_DATABASE)
@@ -569,7 +536,7 @@ void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseN
if (!DatabaseTracker::tracker().hasEntryForOrigin(frame->document()->securityOrigin()))
DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota);
- emit m_webPage->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
+ m_webPage->databaseQuotaExceeded(QWebFrameAdapter::kit(frame), databaseName);
}
#endif
@@ -588,15 +555,15 @@ void ChromeClientQt::reachedApplicationCacheOriginQuota(SecurityOrigin* origin,
QWebSecurityOrigin* securityOrigin = new QWebSecurityOrigin(priv);
if (!WebCore::cacheStorage().calculateQuotaForOrigin(origin, quota))
- WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
+ WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin, defaultOriginQuota);
- emit m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded));
+ m_webPage->applicationCacheQuotaExceeded(securityOrigin, defaultOriginQuota, static_cast<quint64>(totalSpaceNeeded));
}
#if ENABLE(INPUT_TYPE_COLOR)
PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient* client, const Color& color)
{
- const QColor selectedColor = m_webPage->d->colorSelectionRequested(QColor(color));
+ const QColor selectedColor = m_webPage->colorSelectionRequested(QColor(color));
client->didChooseColor(selectedColor);
client->didEndChooser();
return nullptr;
@@ -606,32 +573,22 @@ PassOwnPtr<ColorChooser> ChromeClientQt::createColorChooser(ColorChooserClient*
void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
{
RefPtr<FileChooser> fileChooser = prpFileChooser;
- bool supportMulti = m_webPage->supportsExtension(QWebPage::ChooseMultipleFilesExtension);
-
- if (fileChooser->settings().allowsMultipleFiles && supportMulti) {
- QWebPage::ChooseMultipleFilesExtensionOption option;
- option.parentFrame = QWebFramePrivate::kit(frame);
- if (!fileChooser->settings().selectedFiles.isEmpty())
- for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i)
- option.suggestedFileNames += fileChooser->settings().selectedFiles[i];
+ QStringList suggestedFileNames;
+ for (unsigned i = 0; i < fileChooser->settings().selectedFiles.size(); ++i)
+ suggestedFileNames += fileChooser->settings().selectedFiles[i];
- QWebPage::ChooseMultipleFilesExtensionReturn output;
- m_webPage->extension(QWebPage::ChooseMultipleFilesExtension, &option, &output);
+ const bool allowMultiple = fileChooser->settings().allowsMultipleFiles;
- if (!output.fileNames.isEmpty()) {
+ QStringList result = m_webPage->chooseFiles(QWebFrameAdapter::kit(frame), allowMultiple, suggestedFileNames);
+ if (!result.isEmpty()) {
+ if (allowMultiple) {
Vector<String> names;
- for (int i = 0; i < output.fileNames.count(); ++i)
- names.append(output.fileNames.at(i));
+ for (int i = 0; i < result.count(); ++i)
+ names.append(result.at(i));
fileChooser->chooseFiles(names);
- }
- } else {
- QString suggestedFile;
- if (!fileChooser->settings().selectedFiles.isEmpty())
- suggestedFile = fileChooser->settings().selectedFiles[0];
- QString file = m_webPage->chooseFile(QWebFramePrivate::kit(frame), suggestedFile);
- if (!file.isEmpty())
- fileChooser->chooseFile(file);
+ } else
+ fileChooser->chooseFile(result.first());
}
}
@@ -662,7 +619,7 @@ void ChromeClientQt::scheduleAnimation()
void ChromeClientQt::serviceScriptedAnimations()
{
- m_webPage->mainFrame()->d->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
+ m_webPage->mainFrameAdapter()->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
}
#endif
@@ -703,8 +660,10 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
if (!platformPageClient() || !m_webPage)
return IntRect();
- if (!platformPageClient()->viewResizesToContentsEnabled())
- return QRect(m_webPage->mainFrame()->scrollPosition(), m_webPage->mainFrame()->geometry().size());
+ if (!platformPageClient()->viewResizesToContentsEnabled()) {
+ IntSize offset = m_webPage->mainFrameAdapter()->scrollPosition();
+ return QRect(QPoint(offset.width(), offset.height()), m_webPage->mainFrameAdapter()->frameRect().size());
+ }
return enclosingIntRect(FloatRect(platformPageClient()->graphicsItemVisibleRect()));
}
@@ -751,7 +710,7 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const
return result.release();
#if !defined(QT_NO_COMBOBOX)
- return adoptPtr(new QtFallbackWebPopup(this));
+ return adoptPtr(m_webPage->createSelectPopup());
#else
return nullptr;
#endif
@@ -759,8 +718,18 @@ PassOwnPtr<QWebSelectMethod> ChromeClientQt::createSelectPopup() const
void ChromeClientQt::dispatchViewportPropertiesDidChange(const ViewportArguments&) const
{
- emit m_webPage->viewportChangeRequested();
+ m_webPage->emitViewportChangeRequested();
+}
+
+#if USE(QT_MULTIMEDIA)
+QWebFullScreenVideoHandler* ChromeClientQt::createFullScreenVideoHandler()
+{
+ QWebFullScreenVideoHandler* handler = m_platformPlugin.createFullScreenVideoHandler().leakPtr();
+ if (!handler)
+ handler = m_webPage->createFullScreenVideoHandler();
+ return handler;
}
+#endif
bool ChromeClientQt::selectItemWritingDirectionIsNatural()
{
@@ -794,7 +763,7 @@ void ChromeClientQt::populateVisitedLinks()
// in a separate database
if (dumpVisitedLinksCallbacks) {
printf("Asked to populate visited links for WebView \"%s\"\n",
- qPrintable(m_webPage->mainFrame()->url().toString()));
+ qPrintable(QUrl(m_webPage->mainFrameAdapter()->url).toString()));
}
}
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index f7359d2e2..96d8625c0 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -42,6 +42,8 @@ class QEventLoop;
QT_END_NAMESPACE
class QWebPage;
+class QWebPageAdapter;
+class QWebFullScreenVideoHandler;
namespace WebCore {
@@ -59,7 +61,7 @@ class FullScreenVideoQt;
class ChromeClientQt : public ChromeClient {
public:
- ChromeClientQt(QWebPage*);
+ ChromeClientQt(QWebPageAdapter*);
virtual ~ChromeClientQt();
virtual void chromeDestroyed();
@@ -98,7 +100,7 @@ public:
virtual void setResizable(bool);
- virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID);
+ virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID);
virtual bool canRunBeforeUnloadConfirmPanel();
virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame*);
@@ -156,7 +158,7 @@ public:
#if ENABLE(TOUCH_EVENTS)
virtual void needTouchEvents(bool) { }
#endif
-
+
#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT))
virtual bool supportsFullscreenForNode(const Node*);
virtual void enterFullscreenForNode(Node*);
@@ -169,8 +171,8 @@ public:
virtual PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&);
#endif
- virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
- virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
+ virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
+ virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
virtual void formStateDidChange(const Node*) { }
@@ -198,7 +200,9 @@ public:
virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
virtual void numWheelEventHandlersChanged(unsigned) { }
- QWebPage* m_webPage;
+ QWebFullScreenVideoHandler* createFullScreenVideoHandler();
+
+ QWebPageAdapter* m_webPage;
KURL lastHoverURL;
String lastHoverTitle;
String lastHoverContent;
diff --git a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
index 29180e062..d2984c3d4 100644
--- a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp
@@ -30,9 +30,8 @@
#include "HitTestResult.h"
#include "KURL.h"
#include "NotImplemented.h"
-#include <wtf/RefCounted.h>
-#include <stdio.h>
+#include <wtf/RefCounted.h>
namespace WebCore {
diff --git a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h
index 0420f8d4a..eabac1b1a 100644
--- a/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.h
@@ -40,7 +40,7 @@ public:
virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*);
virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*);
- virtual void downloadURL(const KURL& url);
+ virtual void downloadURL(const KURL&);
virtual void lookUpInDictionary(Frame*);
virtual void speak(const String&);
virtual bool isSpeaking();
diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp
new file mode 100644
index 000000000..0fe24e8bd
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "DefaultFullScreenVideoHandler.h"
+
+#if USE(QT_MULTIMEDIA)
+
+#include "FullScreenVideoWidget.h"
+
+using namespace WebKit;
+
+bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false;
+
+DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
+ : QWebFullScreenVideoHandler()
+ , m_fullScreenWidget(new FullScreenVideoWidget)
+{
+ connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed()));
+ m_fullScreenWidget->hide();
+
+ m_fullScreenWidget->close();
+}
+
+DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler()
+{
+ delete m_fullScreenWidget;
+}
+
+bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const
+{
+ static bool initialized = false;
+ if (!initialized) {
+ QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO");
+ if (!forceFullScreen.isEmpty())
+ s_shouldForceFullScreenVideoPlayback = true;
+
+ initialized = true;
+ }
+
+ return s_shouldForceFullScreenVideoPlayback;
+}
+
+void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player)
+{
+ m_fullScreenWidget->show(player);
+}
+
+void DefaultFullScreenVideoHandler::exitFullScreen()
+{
+ m_fullScreenWidget->close();
+}
+#endif
+
+
diff --git a/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h
new file mode 100644
index 000000000..e943c55e4
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/DefaultFullScreenVideoHandler.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef DefaultFullScreenVideoHandler_h
+#define DefaultFullScreenVideoHandler_h
+
+#include "qwebkitplatformplugin.h"
+
+namespace WebKit {
+
+class FullScreenVideoWidget;
+
+// We do not use ENABLE or USE because moc does not expand these macros.
+#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
+class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
+ Q_OBJECT
+public:
+ DefaultFullScreenVideoHandler();
+ virtual ~DefaultFullScreenVideoHandler();
+ bool requiresFullScreenForVideoPlayback() const;
+
+public Q_SLOTS:
+ void enterFullScreen(QMediaPlayer*);
+ void exitFullScreen();
+
+private:
+ static bool s_shouldForceFullScreenVideoPlayback;
+ FullScreenVideoWidget *m_fullScreenWidget;
+};
+#endif
+
+} // namespace WebKit
+
+#endif // DefaultFullScreenVideoHandler_h
diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index cb6328340..2e0d05ed1 100644
--- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -26,16 +26,16 @@
#include "config.h"
#include "DragClientQt.h"
+#include "ChromeClient.h"
#include "ClipboardQt.h"
#include "DragController.h"
#include "Frame.h"
#include "Page.h"
#include "PlatformMouseEvent.h"
-#include "qwebpage.h"
#include <QDrag>
#include <QMimeData>
-
+#include <QWebPageClient.h>
namespace WebCore {
@@ -93,7 +93,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP
#ifndef QT_NO_DRAGANDDROP
QMimeData* clipboardData = static_cast<ClipboardQt*>(clipboard)->clipboardData();
static_cast<ClipboardQt*>(clipboard)->invalidateWritableData();
- QWidget* view = m_webPage->view();
+ QObject* view = m_chromeClient->platformPageClient()->ownerWidget();
if (view) {
QDrag* drag = new QDrag(view);
if (dragImage)
@@ -105,7 +105,7 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP
Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
// Send dragEnd event
- PlatformMouseEvent me(m_webPage->view()->mapFromGlobal(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0);
+ PlatformMouseEvent me(m_chromeClient->screenToRootView(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0);
frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction));
}
frame->page()->dragController()->dragEnded();
diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.h b/Source/WebKit/qt/WebCoreSupport/DragClientQt.h
index 15724f1e1..aa8b8085b 100644
--- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.h
@@ -28,13 +28,13 @@
#include "DragClient.h"
-class QWebPage;
-
namespace WebCore {
+class ChromeClient;
+
class DragClientQt : public DragClient {
public:
- DragClientQt(QWebPage* webPage) : m_webPage(webPage) {};
+ DragClientQt(ChromeClient* chromeClient) : m_chromeClient(chromeClient) { };
virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*);
virtual DragDestinationAction actionMaskForDrag(DragData*);
virtual void dragControllerDestroyed();
@@ -42,7 +42,7 @@ public:
virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*);
virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false);
private:
- QWebPage* m_webPage;
+ ChromeClient* m_chromeClient;
};
}
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index edf20a460..8d08c4a10 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -43,8 +43,6 @@
#include "FrameLoaderClientQt.h"
#include "FrameView.h"
#include "GCController.h"
-#include "JSNode.h"
-#include "qt_runtime.h"
#include "GeolocationClient.h"
#include "GeolocationClientMock.h"
#include "GeolocationController.h"
@@ -53,8 +51,8 @@
#include "HTMLFormElement.h"
#include "HTMLInputElement.h"
#include "HistoryItem.h"
-#include "InitWebCoreQt.h"
#include "InspectorController.h"
+#include "JSNode.h"
#include "NodeList.h"
#include "NotificationPresenterClientQt.h"
#include "Page.h"
@@ -63,6 +61,8 @@
#include "PluginView.h"
#include "PositionError.h"
#include "PrintContext.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "RenderListItem.h"
#include "RenderTreeAsText.h"
#include "SchemeRegistry.h"
@@ -76,15 +76,10 @@
#include "ThirdPartyCookiesQt.h"
#include "WebCoreTestSupport.h"
#include "WorkerThread.h"
-#include <wtf/CurrentTime.h>
-
+#include "qt_runtime.h"
#include "qwebelement.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
#include "qwebhistory.h"
#include "qwebhistory_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
#include "qwebscriptworld.h"
#if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
@@ -92,9 +87,8 @@
#include "MediaPlayerPrivateQt.h"
#endif
-#include <QAction>
-#include <QMenu>
#include <QPainter>
+#include <wtf/CurrentTime.h>
using namespace WebCore;
@@ -103,15 +97,15 @@ QMap<int, QWebScriptWorld*> m_worldMap;
#if ENABLE(GEOLOCATION)
GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client)
{
- ASSERT(QWebPagePrivate::drtRun);
- return static_cast<GeolocationClientMock*>(client);
+ ASSERT(QWebPageAdapter::drtRun);
+ return static_cast<GeolocationClientMock*>(client);
}
#endif
#if ENABLE(DEVICE_ORIENTATION)
DeviceOrientationClientMock* toDeviceOrientationClientMock(DeviceOrientationClient* client)
{
- ASSERT(QWebPagePrivate::drtRun);
+ ASSERT(QWebPageAdapter::drtRun);
return static_cast<DeviceOrientationClientMock*>(client);
}
#endif
@@ -198,7 +192,6 @@ DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt()
void DumpRenderTreeSupportQt::initialize()
{
- WebCore::initializeWebCoreQt();
QtDRTNodeRuntime::initialize();
}
@@ -225,58 +218,58 @@ int DumpRenderTreeSupportQt::workerThreadCount()
void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b)
{
- QWebPagePrivate::drtRun = b;
+ QWebPageAdapter::drtRun = b;
#if ENABLE(NETSCAPE_PLUGIN_API) && defined(XP_UNIX)
// PluginViewQt (X11) needs a few workarounds when running under DRT
PluginView::setIsRunningUnderDRT(b);
#endif
}
-void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPageAdapter* adapter, bool enabled)
{
- QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled);
+ adapter->page->settings()->setFrameFlatteningEnabled(enabled);
}
-void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName)
+void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPageAdapter *adapter, const QString& groupName)
{
- page->handle()->page->setGroupName(groupName);
+ adapter->page->setGroupName(groupName);
}
-QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page)
+QString DumpRenderTreeSupportQt::webPageGroupName(QWebPageAdapter* adapter)
{
- return page->handle()->page->groupName();
+ return adapter->page->groupName();
}
-void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script)
+void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPageAdapter* adapter, long callId, const QString& script)
{
#if ENABLE(INSPECTOR)
- if (!page->handle()->page->inspectorController())
+ if (!adapter->page->inspectorController())
return;
- page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script);
+ adapter->page->inspectorController()->evaluateForTestInFrontend(callId, script);
#endif
}
-void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page)
+void DumpRenderTreeSupportQt::webInspectorShow(QWebPageAdapter* adapter)
{
#if ENABLE(INSPECTOR)
- if (!page->handle()->page->inspectorController())
+ if (!adapter->page->inspectorController())
return;
- page->handle()->page->inspectorController()->close();
+ adapter->page->inspectorController()->show();
#endif
}
-void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page)
+void DumpRenderTreeSupportQt::webInspectorClose(QWebPageAdapter* adapter)
{
#if ENABLE(INSPECTOR)
- if (!page->handle()->page->inspectorController())
+ if (!adapter->page->inspectorController())
return;
- page->handle()->page->inspectorController()->show();
+ adapter->page->inspectorController()->close();
#endif
}
-bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrameAdapter *adapter)
{
- return QWebFramePrivate::core(frame)->document()->documentElement();
+ return adapter->frame->document()->documentElement();
}
void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isAutofilled)
@@ -306,9 +299,9 @@ void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const
// Pause a given CSS animation or transition on the target node at a specific time.
// If the animation or transition is already paused, it will update its pause time.
// This method is only intended to be used for testing the CSS animation and transition system.
-bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId)
+bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrameAdapter *adapter, const QString &animationName, double time, const QString &elementId)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
if (!coreFrame)
return false;
@@ -326,9 +319,9 @@ bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &an
return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
}
-bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId)
+bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrameAdapter *adapter, const QString &propertyName, double time, const QString &elementId)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
if (!coreFrame)
return false;
@@ -347,9 +340,9 @@ bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const
}
// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
-int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
+int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrameAdapter *adapter)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
if (!coreFrame)
return false;
@@ -360,9 +353,9 @@ int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
return controller->numberOfActiveAnimations(coreFrame->document());
}
-void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame)
+void DumpRenderTreeSupportQt::clearFrameName(QWebFrameAdapter *adapter)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
coreFrame->tree()->clearName();
}
@@ -381,24 +374,6 @@ void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool wait
gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone);
}
-// Suspend active DOM objects in this frame.
-void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame)
-{
- Frame* coreFrame = QWebFramePrivate::core(frame);
- if (coreFrame->document())
- // FIXME: This function should be changed take a ReasonForSuspension parameter
- // https://bugs.webkit.org/show_bug.cgi?id=45732
- coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
-}
-
-// Resume active DOM objects in this frame.
-void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame)
-{
- Frame* coreFrame = QWebFramePrivate::core(frame);
- if (coreFrame->document())
- coreFrame->document()->resumeActiveDOMObjects();
-}
-
void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
{
SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
@@ -419,39 +394,39 @@ void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forb
SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
}
-void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value)
+void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPageAdapter* adapter, bool value)
{
- page->handle()->page->settings()->setCaretBrowsingEnabled(value);
+ adapter->page->settings()->setCaretBrowsingEnabled(value);
}
-void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPage* page, bool value)
+void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPageAdapter* adapter, bool value)
{
- page->handle()->page->settings()->setAuthorAndUserStylesEnabled(value);
+ adapter->page->settings()->setAuthorAndUserStylesEnabled(value);
}
-void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPageAdapter *adapter, bool enabled)
{
- page->d->smartInsertDeleteEnabled = enabled;
+ static_cast<EditorClientQt*>(adapter->page->editorClient())->setSmartInsertDeleteEnabled(enabled);
}
-void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled)
+void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPageAdapter *adapter, bool enabled)
{
- page->d->selectTrailingWhitespaceEnabled = enabled;
+ static_cast<EditorClientQt*>(adapter->page->editorClient())->setSelectTrailingWhitespaceEnabled(enabled);
}
-void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value)
+void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPageAdapter* adapter, const QString& name, const QString& value)
{
- page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+ adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
}
-bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name)
+bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPageAdapter *adapter, const QString& name)
{
- return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+ return adapter->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
}
-bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, const QStringList& optionArray)
+bool DumpRenderTreeSupportQt::findString(QWebPageAdapter *adapter, const QString& string, const QStringList& optionArray)
{
// 1. Parse the options from the array
WebCore::FindOptions options = 0;
@@ -473,7 +448,7 @@ bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string,
}
// 2. find the string
- WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+ WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
return frame && frame->editor()->findString(string, options);
}
@@ -514,9 +489,9 @@ QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWe
return res;
}
-QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
+QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter)
{
- WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+ WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
QVariantList selectedRange;
RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
@@ -538,9 +513,9 @@ QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
}
-QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length)
+QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length)
{
- WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+ WebCore::Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
QVariantList rect;
if ((location + length < location) && (location + length))
@@ -556,9 +531,9 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page,
return rect;
}
-bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId)
+bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrameAdapter *adapter, const QString& elementId)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
if (!coreFrame)
return false;
@@ -574,9 +549,9 @@ bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame*
return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
}
-void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPage* page)
+void DumpRenderTreeSupportQt::setWindowsBehaviorAsEditingBehavior(QWebPageAdapter* adapter)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
if (!corePage)
return;
corePage->settings()->setEditingBehaviorType(EditingWindowsBehavior);
@@ -676,15 +651,15 @@ void DumpRenderTreeSupportQt::dumpNotification(bool b)
#endif
}
-QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
+QString DumpRenderTreeSupportQt::viewportAsText(QWebPageAdapter* adapter, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
{
- WebCore::ViewportArguments args = page->d->viewportArguments();
+ WebCore::ViewportArguments args = adapter->viewportArguments();
float devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
- /* desktop-width */ 980,
- /* device-width */ deviceSize.width(),
- /* device-height */ deviceSize.height(),
+ /* desktop-width */980,
+ /* device-width */deviceSize.width(),
+ /* device-height */deviceSize.height(),
devicePixelRatio,
availableSize);
WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
@@ -692,72 +667,72 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, c
QString res;
res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
- static_cast<int>(conf.layoutSize.width()),
- static_cast<int>(conf.layoutSize.height()),
- conf.initialScale,
- conf.minimumScale,
- conf.maximumScale,
- conf.userScalable);
+ static_cast<int>(conf.layoutSize.width()),
+ static_cast<int>(conf.layoutSize.height()),
+ conf.initialScale,
+ conf.minimumScale,
+ conf.maximumScale,
+ conf.userScalable);
return res;
}
-void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin)
+void DumpRenderTreeSupportQt::scalePageBy(QWebFrameAdapter* adapter, float scalefactor, const QPoint& origin)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
if (Page* page = coreFrame->page())
page->setPageScaleFactor(scalefactor, origin);
}
-void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPage* page, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPageAdapter* adapter, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
{
#if ENABLE(DEVICE_ORIENTATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->deviceOrientationClient());
mockClient->setOrientation(DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
#endif
}
-void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page)
+void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPageAdapter* adapter)
{
#if ENABLE(GEOLOCATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
mockClient->reset();
#endif
}
-void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool allowed)
+void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPageAdapter* adapter, bool allowed)
{
#if ENABLE(GEOLOCATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
mockClient->setPermission(allowed);
#endif
}
-void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double latitude, double longitude, double accuracy)
+void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPageAdapter* adapter, double latitude, double longitude, double accuracy)
{
#if ENABLE(GEOLOCATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
#endif
}
-void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPage* page, const QString& message)
+void DumpRenderTreeSupportQt::setMockGeolocationPositionUnavailableError(QWebPageAdapter* adapter, const QString& message)
{
#if ENABLE(GEOLOCATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(GeolocationController::from(corePage)->client());
mockClient->setPositionUnavailableError(message);
#endif
}
-int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPage* page)
+int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPageAdapter* adapter)
{
#if ENABLE(GEOLOCATION)
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
GeolocationClientMock* mockClient = toGeolocationClientMock(GeolocationController::from(corePage)->client());
return mockClient->numberOfPendingPermissionRequests();
#else
@@ -794,9 +769,9 @@ QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(con
return kids;
}
-bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::shouldClose(QWebFrameAdapter *adapter)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
return coreFrame->loader()->shouldClose();
}
@@ -805,7 +780,7 @@ void DumpRenderTreeSupportQt::clearScriptWorlds()
m_worldMap.clear();
}
-void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script)
+void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrameAdapter *adapter, int worldID, const QString& script)
{
QWebScriptWorld* scriptWorld;
if (!worldID) {
@@ -816,7 +791,7 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in
} else
scriptWorld = m_worldMap.value(worldID);
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
ScriptController* proxy = coreFrame->script();
@@ -825,14 +800,14 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in
proxy->executeScriptInWorld(scriptWorld->world(), script, true);
}
-void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode)
+void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPageAdapter* adapter, const QString& sourceCode)
{
- page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames);
+ adapter->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames);
}
-void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPage* page)
+void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPageAdapter* adapter)
{
- page->handle()->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld());
+ adapter->page->group().removeUserStyleSheetsFromWorld(mainThreadNormalWorld());
}
void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title)
@@ -842,31 +817,31 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti
#endif
}
-void DumpRenderTreeSupportQt::setDefersLoading(QWebPage* page, bool flag)
+void DumpRenderTreeSupportQt::setDefersLoading(QWebPageAdapter* adapter, bool flag)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
if (corePage)
corePage->setDefersLoading(flag);
}
-void DumpRenderTreeSupportQt::goBack(QWebPage* page)
+void DumpRenderTreeSupportQt::goBack(QWebPageAdapter* adapter)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
if (corePage)
corePage->goBack();
}
// API Candidate?
-QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
+QString DumpRenderTreeSupportQt::responseMimeType(QWebFrameAdapter* adapter)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
return docLoader->responseMIMEType();
}
-void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame)
+void DumpRenderTreeSupportQt::clearOpener(QWebFrameAdapter* adapter)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
coreFrame->loader()->setOpener(0);
}
@@ -875,40 +850,16 @@ void DumpRenderTreeSupportQt::addURLToRedirect(const QString& origin, const QStr
FrameLoaderClientQt::URLsToRedirect[origin] = destination;
}
-void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPage* page, bool enable)
+void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPageAdapter* adapter, bool enable)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
if (corePage)
corePage->settings()->setInteractiveFormValidationEnabled(enable);
}
-#ifndef QT_NO_MENU
-static QStringList iterateContextMenu(QMenu* menu)
-{
- if (!menu)
- return QStringList();
-
- QStringList items;
- QList<QAction *> actions = menu->actions();
- for (int i = 0; i < actions.count(); ++i) {
- if (actions.at(i)->isSeparator())
- items << QLatin1String("<separator>");
- else
- items << actions.at(i)->text();
- if (actions.at(i)->menu())
- items << iterateContextMenu(actions.at(i)->menu());
- }
- return items;
-}
-#endif
-
-QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page)
+QStringList DumpRenderTreeSupportQt::contextMenu(QWebPageAdapter* page)
{
-#ifndef QT_NO_CONTEXTMENU
- return iterateContextMenu(page->d->currentContextMenu.data());
-#else
- return QStringList();
-#endif
+ return page->menuActionsAsText();
}
double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
@@ -916,18 +867,18 @@ double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
return Settings::defaultMinDOMTimerInterval();
}
-void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double interval)
+void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPageAdapter* adapter, double interval)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
if (!corePage)
return;
corePage->settings()->setMinDOMTimerInterval(interval);
}
-bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl)
+bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPageAdapter *adapter, const QUrl& url, const QUrl& firstPartyUrl)
{
- Page* corePage = QWebPagePrivate::core(page);
+ Page* corePage = adapter->page;
return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl);
}
@@ -936,12 +887,12 @@ void DumpRenderTreeSupportQt::enableMockScrollbars()
Settings::setMockScrollbarsEnabled(true);
}
-QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
+QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrameAdapter* adapter, const QString& elementId)
{
QUrl res;
#if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
if (!coreFrame)
return res;
@@ -967,10 +918,10 @@ QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const
}
// API Candidate?
-void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
+void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrameAdapter* adapter, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
{
KURL kurl(baseUrl);
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
WebCore::ResourceRequest request(kurl);
const QByteArray utf8 = html.toUtf8();
WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
@@ -978,9 +929,9 @@ void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString&
coreFrame->loader()->load(request, substituteData, false);
}
-void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* text)
+void DumpRenderTreeSupportQt::confirmComposition(QWebPageAdapter *adapter, const char* text)
{
- Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
+ Frame* frame = adapter->page->focusController()->focusedOrMainFrame();
if (!frame)
return;
@@ -997,15 +948,9 @@ void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* tex
editor->insertText(String::fromUTF8(text), 0);
}
-QString DumpRenderTreeSupportQt::layerTreeAsText(QWebFrame* frame)
-{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
- return coreFrame->layerTreeAsText();
-}
-
-void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrame* frame)
+void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrameAdapter* adapter)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
Q_ASSERT(window);
@@ -1022,9 +967,9 @@ void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context)
WebCoreTestSupport::injectInternalsObject(context);
}
-void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
+void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrameAdapter* adapter)
{
- WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
+ WebCore::Frame* coreFrame = adapter->frame;
JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
Q_ASSERT(window);
@@ -1041,9 +986,9 @@ void DumpRenderTreeSupportQt::resetInternalsObject(JSContextRef context)
WebCoreTestSupport::resetInternalsObject(context);
}
-QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
+QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrameAdapter* adapter)
{
- Frame* frame = QWebFramePrivate::core(qframe);
+ Frame* frame = adapter->frame;
PrintContext printContext(frame);
QRect rect = frame->view()->frameRect();
@@ -1084,119 +1029,21 @@ QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
return image;
}
-void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrame* frame, bool enable)
+void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrameAdapter* adapter, bool enable)
{
- QWebFramePrivate::core(frame)->view()->setTracksRepaints(enable);
+ adapter->frame->view()->setTracksRepaints(enable);
}
-bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrame* frame)
+bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrameAdapter* adapter)
{
- return QWebFramePrivate::core(frame)->view()->isTrackingRepaints();
+ return adapter->frame->view()->isTrackingRepaints();
}
-void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrame* frame, QVector<QRect>& result)
+void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrameAdapter* adapter, QVector<QRect>& result)
{
- Frame* coreFrame = QWebFramePrivate::core(frame);
+ Frame* coreFrame = adapter->frame;
const Vector<IntRect>& rects = coreFrame->view()->trackedRepaintRects();
result.resize(rects.size());
for (size_t i = 0; i < rects.size(); ++i)
result.append(rects[i]);
}
-
-// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
-
-void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
-{
- DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame);
-}
-
-void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame)
-{
- DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame)
-{
- DumpRenderTreeSupportQt::clearFrameName(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_garbageCollector_collect()
-{
- DumpRenderTreeSupportQt::garbageCollectorCollect();
-}
-
-void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone)
-{
- DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone);
-}
-
-int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount()
-{
- return DumpRenderTreeSupportQt::javaScriptObjectsCount();
-}
-
-int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame)
-{
- return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame);
-}
-
-void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
-{
- DumpRenderTreeSupportQt::overwritePluginDirectories();
-}
-
-bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId)
-{
- return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId);
-}
-
-bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId)
-{
- return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId);
-}
-
-void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists()
-{
- DumpRenderTreeSupportQt::resetOriginAccessWhiteLists();
-}
-
-void QWEBKIT_EXPORT qt_drt_run(bool b)
-{
- DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b);
-}
-
-void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
-{
- DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains);
-}
-
-QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page)
-{
- return DumpRenderTreeSupportQt::webPageGroupName(page);
-}
-
-void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName)
-{
- DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName);
-}
-
-void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
-{
- DumpRenderTreeSupportQt::dumpFrameLoader(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
-{
- DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
-{
- DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
-}
-
-void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
-{
- DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
-}
-
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
index d0600ffa7..72505b8d3 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -43,7 +43,8 @@ class QtDRTNodeRuntime;
class QWebElement;
class QWebFrame;
-class QWebPage;
+class QWebFrameAdapter;
+class QWebPageAdapter;
class QWebHistoryItem;
class QWebScriptWorld;
@@ -89,25 +90,23 @@ public:
static void initialize();
- static void executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value);
- static bool isCommandEnabled(QWebPage* page, const QString& name);
- static bool findString(QWebPage* page, const QString& string, const QStringList& optionArray);
- static void setSmartInsertDeleteEnabled(QWebPage* page, bool enabled);
- static void setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled);
- static QVariantList selectedRange(QWebPage* page);
- static QVariantList firstRectForCharacterRange(QWebPage* page, int location, int length);
- static void confirmComposition(QWebPage*, const char* text);
+ static void executeCoreCommandByName(QWebPageAdapter*, const QString& name, const QString& value);
+ static bool isCommandEnabled(QWebPageAdapter*, const QString& name);
+ static bool findString(QWebPageAdapter*, const QString&, const QStringList& optionArray);
+ static void setSmartInsertDeleteEnabled(QWebPageAdapter*, bool enabled);
+ static void setSelectTrailingWhitespaceEnabled(QWebPageAdapter*, bool enabled);
+ static QVariantList selectedRange(QWebPageAdapter*);
+ static QVariantList firstRectForCharacterRange(QWebPageAdapter*, int location, int length);
+ static void confirmComposition(QWebPageAdapter*, const char* text);
- static bool pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId);
- static bool pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId);
- static void suspendActiveDOMObjects(QWebFrame* frame);
- static void resumeActiveDOMObjects(QWebFrame* frame);
+ static bool pauseAnimation(QWebFrameAdapter*, const QString& name, double time, const QString& elementId);
+ static bool pauseTransitionOfProperty(QWebFrameAdapter*, const QString& name, double time, const QString& elementId);
static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme);
- static void setFrameFlatteningEnabled(QWebPage*, bool);
- static void setCaretBrowsingEnabled(QWebPage* page, bool value);
- static void setAuthorAndUserStylesEnabled(QWebPage*, bool);
- static void setDumpRenderTreeModeEnabled(bool b);
+ static void setFrameFlatteningEnabled(QWebPageAdapter*, bool);
+ static void setCaretBrowsingEnabled(QWebPageAdapter*, bool value);
+ static void setAuthorAndUserStylesEnabled(QWebPageAdapter*, bool);
+ static void setDumpRenderTreeModeEnabled(bool);
static void garbageCollectorCollect();
static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone);
@@ -115,20 +114,20 @@ public:
static void setValueForUser(const QWebElement&, const QString& value);
static int javaScriptObjectsCount();
static void clearScriptWorlds();
- static void evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script);
+ static void evaluateScriptInIsolatedWorld(QWebFrameAdapter*, int worldID, const QString& script);
- static void webInspectorExecuteScript(QWebPage* page, long callId, const QString& script);
- static void webInspectorShow(QWebPage* page);
- static void webInspectorClose(QWebPage* page);
+ static void webInspectorExecuteScript(QWebPageAdapter*, long callId, const QString& script);
+ static void webInspectorShow(QWebPageAdapter*);
+ static void webInspectorClose(QWebPageAdapter*);
- static QString webPageGroupName(QWebPage *page);
- static void webPageSetGroupName(QWebPage* page, const QString& groupName);
- static void clearFrameName(QWebFrame* frame);
+ static QString webPageGroupName(QWebPageAdapter*);
+ static void webPageSetGroupName(QWebPageAdapter*, const QString& groupName);
+ static void clearFrameName(QWebFrameAdapter*);
static void overwritePluginDirectories();
- static int numberOfActiveAnimations(QWebFrame*);
- static bool hasDocumentElement(QWebFrame* frame);
- static bool elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId);
- static void setWindowsBehaviorAsEditingBehavior(QWebPage*);
+ static int numberOfActiveAnimations(QWebFrameAdapter*);
+ static bool hasDocumentElement(QWebFrameAdapter*);
+ static bool elementDoesAutoCompleteForElementWithId(QWebFrameAdapter*, const QString& elementId);
+ static void setWindowsBehaviorAsEditingBehavior(QWebPageAdapter*);
static void clearAllApplicationCaches();
@@ -136,86 +135,84 @@ public:
static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
static void resetOriginAccessWhiteLists();
- static void setMockDeviceOrientation(QWebPage*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
+ static void setMockDeviceOrientation(QWebPageAdapter*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
- static void resetGeolocationMock(QWebPage*);
- static void setMockGeolocationPermission(QWebPage*, bool allowed);
- static void setMockGeolocationPosition(QWebPage*, double latitude, double longitude, double accuracy);
- static void setMockGeolocationPositionUnavailableError(QWebPage*, const QString& message);
- static int numberOfPendingGeolocationPermissionRequests(QWebPage*);
+ static void resetGeolocationMock(QWebPageAdapter*);
+ static void setMockGeolocationPermission(QWebPageAdapter*, bool allowed);
+ static void setMockGeolocationPosition(QWebPageAdapter*, double latitude, double longitude, double accuracy);
+ static void setMockGeolocationPositionUnavailableError(QWebPageAdapter*, const QString& message);
+ static int numberOfPendingGeolocationPermissionRequests(QWebPageAdapter*);
static int workerThreadCount();
static QString markerTextForListItem(const QWebElement& listItem);
- static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element);
+ static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement&);
- static void dumpFrameLoader(bool b);
+ static void dumpFrameLoader(bool);
static void dumpProgressFinishedCallback(bool);
- static void dumpUserGestureInFrameLoader(bool b);
- static void dumpResourceLoadCallbacks(bool b);
- static void dumpResourceResponseMIMETypes(bool b);
+ static void dumpUserGestureInFrameLoader(bool);
+ static void dumpResourceLoadCallbacks(bool);
+ static void dumpResourceResponseMIMETypes(bool);
static void dumpResourceLoadCallbacksPath(const QString& path);
static void dumpWillCacheResponseCallbacks(bool);
- static void setWillSendRequestReturnsNullOnRedirect(bool b);
- static void setWillSendRequestReturnsNull(bool b);
- static void setWillSendRequestClearHeaders(const QStringList& headers);
- static void dumpHistoryCallbacks(bool b);
- static void dumpVisitedLinksCallbacks(bool b);
+ static void setWillSendRequestReturnsNullOnRedirect(bool);
+ static void setWillSendRequestReturnsNull(bool);
+ static void setWillSendRequestClearHeaders(const QStringList&);
+ static void dumpHistoryCallbacks(bool);
+ static void dumpVisitedLinksCallbacks(bool);
- static void setDeferMainResourceDataLoad(bool b);
+ static void setDeferMainResourceDataLoad(bool);
- static void dumpEditingCallbacks(bool b);
- static void dumpSetAcceptsEditing(bool b);
+ static void dumpEditingCallbacks(bool);
+ static void dumpSetAcceptsEditing(bool);
- static void dumpNotification(bool b);
+ static void dumpNotification(bool);
+ static QString viewportAsText(QWebPageAdapter*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize);
- static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem& historyItem);
- static bool isTargetItem(const QWebHistoryItem& historyItem);
- static QString historyItemTarget(const QWebHistoryItem& historyItem);
+ static QMap<QString, QWebHistoryItem> getChildHistoryItems(const QWebHistoryItem&);
+ static bool isTargetItem(const QWebHistoryItem&);
+ static QString historyItemTarget(const QWebHistoryItem&);
- static bool shouldClose(QWebFrame* frame);
+ static bool shouldClose(QWebFrameAdapter*);
static void setCustomPolicyDelegate(bool enabled, bool permissive);
- static void addUserStyleSheet(QWebPage* page, const QString& sourceCode);
- static void removeUserStyleSheets(QWebPage*);
+ static void addUserStyleSheet(QWebPageAdapter*, const QString& sourceCode);
+ static void removeUserStyleSheets(QWebPageAdapter*);
static void simulateDesktopNotificationClick(const QString& title);
- static QString viewportAsText(QWebPage*, int deviceDPI, const QSize& deviceSize, const QSize& availableSize);
- static void scalePageBy(QWebFrame*, float scale, const QPoint& origin);
+ static void scalePageBy(QWebFrameAdapter*, float scale, const QPoint& origin);
- static QString responseMimeType(QWebFrame*);
- static void clearOpener(QWebFrame*);
+ static QString responseMimeType(QWebFrameAdapter*);
+ static void clearOpener(QWebFrameAdapter*);
static void addURLToRedirect(const QString& origin, const QString& destination);
- static QStringList contextMenu(QWebPage*);
+ static QStringList contextMenu(QWebPageAdapter*);
static double defaultMinimumTimerInterval(); // Not really tied to WebView
- static void setMinimumTimerInterval(QWebPage*, double);
+ static void setMinimumTimerInterval(QWebPageAdapter*, double);
- static QUrl mediaContentUrlByElementId(QWebFrame*, const QString& elementId);
- static void setAlternateHtml(QWebFrame*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
+ static QUrl mediaContentUrlByElementId(QWebFrameAdapter*, const QString& elementId);
+ static void setAlternateHtml(QWebFrameAdapter*, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl);
- static QString layerTreeAsText(QWebFrame*);
-
- static void injectInternalsObject(QWebFrame*);
+ static void injectInternalsObject(QWebFrameAdapter*);
static void injectInternalsObject(JSContextRef);
- static void resetInternalsObject(QWebFrame*);
+ static void resetInternalsObject(QWebFrameAdapter*);
static void resetInternalsObject(JSContextRef);
- static void setInteractiveFormValidationEnabled(QWebPage*, bool);
+ static void setInteractiveFormValidationEnabled(QWebPageAdapter*, bool);
- static void setDefersLoading(QWebPage*, bool flag);
- static void goBack(QWebPage*);
+ static void setDefersLoading(QWebPageAdapter*, bool flag);
+ static void goBack(QWebPageAdapter*);
- static bool thirdPartyCookiePolicyAllows(QWebPage*, const QUrl&, const QUrl& firstPartyUrl);
+ static bool thirdPartyCookiePolicyAllows(QWebPageAdapter*, const QUrl&, const QUrl& firstPartyUrl);
static void enableMockScrollbars();
- static QImage paintPagesWithBoundaries(QWebFrame*);
+ static QImage paintPagesWithBoundaries(QWebFrameAdapter*);
- static void setTrackRepaintRects(QWebFrame*, bool enable);
- static bool trackRepaintRects(QWebFrame*);
- static void getTrackedRepaintRects(QWebFrame*, QVector<QRect>& result);
+ static void setTrackRepaintRects(QWebFrameAdapter*, bool enable);
+ static bool trackRepaintRects(QWebFrameAdapter*);
+ static void getTrackedRepaintRects(QWebFrameAdapter*, QVector<QRect>& result);
};
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index eb73c9e9d..78c36f2b9 100644
--- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -32,7 +32,6 @@
#include "EditorClientQt.h"
#include "Document.h"
-#include "UndoStepQt.h"
#include "Editor.h"
#include "FocusController.h"
#include "Frame.h"
@@ -44,6 +43,7 @@
#include "Page.h"
#include "Pasteboard.h"
#include "PlatformKeyboardEvent.h"
+#include "QWebPageAdapter.h"
#include "QWebPageClient.h"
#include "Range.h"
#include "Settings.h"
@@ -51,11 +51,10 @@
#include "StylePropertySet.h"
#include "WindowsKeyboardCodes.h"
#include "qguiapplication.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
#include <QClipboard>
-#include <QUndoStack>
+#include <QKeyEvent>
+#include <QKeySequence>
#include <stdio.h>
#include <wtf/OwnPtr.h>
@@ -80,8 +79,8 @@ static QString dumpRange(WebCore::Range *range)
WebCore::ExceptionCode code;
QString str = QString::fromLatin1("range from %1 of %2 to %3 of %4")
- .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
- .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
+ .arg(range->startOffset(code)).arg(dumpPath(range->startContainer(code)))
+ .arg(range->endOffset(code)).arg(dumpPath(range->endContainer(code)));
return str;
}
@@ -104,7 +103,7 @@ bool EditorClientQt::shouldDeleteRange(Range* range)
bool EditorClientQt::shouldShowDeleteInterface(HTMLElement* element)
{
- if (QWebPagePrivate::drtRun)
+ if (QWebPageAdapter::drtRun)
return element->getAttribute(classAttr) == "needsDeletionUI";
return false;
}
@@ -148,7 +147,7 @@ bool EditorClientQt::shouldInsertText(const String& string, Range* range, Editor
};
printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n",
- QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]);
+ QString(string).toUtf8().constData(), dumpRange(range).toUtf8().constData(), insertactionstring[action]);
}
return acceptsEditing;
}
@@ -166,19 +165,18 @@ bool EditorClientQt::shouldChangeSelectedRange(Range* currentRange, Range* propo
};
printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n",
- dumpRange(currentRange).toUtf8().constData(),
- dumpRange(proposedRange).toUtf8().constData(),
- affinitystring[selectionAffinity], boolstring[stillSelecting]);
+ dumpRange(currentRange).toUtf8().constData(),
+ dumpRange(proposedRange).toUtf8().constData(),
+ affinitystring[selectionAffinity], boolstring[stillSelecting]);
}
return acceptsEditing;
}
-bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style,
- WebCore::Range* range)
+bool EditorClientQt::shouldApplyStyle(WebCore::StylePropertySet* style, WebCore::Range* range)
{
if (dumpEditingCallbacks)
printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
- QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
+ QString(style->asText()).toUtf8().constData(), dumpRange(range).toUtf8().constData());
return acceptsEditing;
}
@@ -199,9 +197,8 @@ void EditorClientQt::respondToChangedContents()
{
if (dumpEditingCallbacks)
printf("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n");
- m_page->d->updateEditorActions();
- emit m_page->contentsChanged();
+ m_page->respondToChangedContents();
}
void EditorClientQt::respondToChangedSelection(Frame* frame)
@@ -220,8 +217,7 @@ void EditorClientQt::respondToChangedSelection(Frame* frame)
Pasteboard::generalPasteboard()->setSelectionMode(oldSelectionMode);
}
- m_page->d->updateEditorActions();
- emit m_page->selectionChanged();
+ m_page->respondToChangedSelection();
if (!frame->editor()->ignoreCompositionSelectionChange())
emit m_page->microFocusChanged();
}
@@ -250,10 +246,10 @@ bool EditorClientQt::selectWordBeforeMenuEvent()
void EditorClientQt::registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep> step)
{
#ifndef QT_NO_UNDOSTACK
- Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+ Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
if (m_inUndoRedo || (frame && !frame->editor()->lastEditCommand() /* HACK!! Don't recreate undos */))
return;
- m_page->undoStack()->push(new UndoStepQt(step));
+ m_page->registerUndoStep(step);
#endif // QT_NO_UNDOSTACK
}
@@ -264,7 +260,7 @@ void EditorClientQt::registerRedoStep(WTF::PassRefPtr<WebCore::UndoStep>)
void EditorClientQt::clearUndoRedoOperations()
{
#ifndef QT_NO_UNDOSTACK
- return m_page->undoStack()->clear();
+ return m_page->clearUndoStack();
#endif
}
@@ -283,7 +279,7 @@ bool EditorClientQt::canUndo() const
#ifdef QT_NO_UNDOSTACK
return false;
#else
- return m_page->undoStack()->canUndo();
+ return m_page->canUndo();
#endif
}
@@ -292,7 +288,7 @@ bool EditorClientQt::canRedo() const
#ifdef QT_NO_UNDOSTACK
return false;
#else
- return m_page->undoStack()->canRedo();
+ return m_page->canRedo();
#endif
}
@@ -300,7 +296,7 @@ void EditorClientQt::undo()
{
#ifndef QT_NO_UNDOSTACK
m_inUndoRedo = true;
- m_page->undoStack()->undo();
+ m_page->undo();
m_inUndoRedo = false;
#endif
}
@@ -309,7 +305,7 @@ void EditorClientQt::redo()
{
#ifndef QT_NO_UNDOSTACK
m_inUndoRedo = true;
- m_page->undoStack()->redo();
+ m_page->redo();
m_inUndoRedo = false;
#endif
}
@@ -324,7 +320,7 @@ bool EditorClientQt::shouldInsertNode(Node* node, Range* range, EditorInsertActi
};
printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).toUtf8().constData(),
- dumpRange(range).toUtf8().constData(), insertactionstring[action]);
+ dumpRange(range).toUtf8().constData(), insertactionstring[action]);
}
return acceptsEditing;
}
@@ -336,18 +332,18 @@ void EditorClientQt::pageDestroyed()
bool EditorClientQt::smartInsertDeleteEnabled()
{
- return m_page->d->smartInsertDeleteEnabled;
+ return m_smartInsertDeleteEnabled;
}
void EditorClientQt::toggleSmartInsertDelete()
{
- bool current = m_page->d->smartInsertDeleteEnabled;
- m_page->d->smartInsertDeleteEnabled = !current;
+ bool current = m_smartInsertDeleteEnabled;
+ m_smartInsertDeleteEnabled = !current;
}
bool EditorClientQt::isSelectTrailingWhitespaceEnabled()
{
- return m_page->d->selectTrailingWhitespaceEnabled;
+ return m_selectTrailingWhitespaceEnabled;
}
void EditorClientQt::toggleContinuousSpellChecking()
@@ -416,7 +412,7 @@ const char* editorCommandForKeyDownEvent(const KeyboardEvent* event)
void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
{
- Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+ Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
if (!frame)
return;
@@ -444,20 +440,19 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
}
#ifndef QT_NO_SHORTCUT
- QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
- if (action != QWebPage::NoWebAction && !doSpatialNavigation) {
- const char* cmd = QWebPagePrivate::editorCommandForWebActions(action);
+ const char* cmd = m_page->editorCommandForKeyEvent(kevent->qtEvent());
+ if (cmd && !doSpatialNavigation) {
// WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
// so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated
// (e.g. Tab that inserts a Tab character, or Enter).
- if (cmd && frame->editor()->command(cmd).isTextInsertion()
+ if (frame->editor()->command(cmd).isTextInsertion()
&& kevent->type() == PlatformEvent::RawKeyDown)
return;
- m_page->triggerAction(action);
+ m_page->triggerActionForKeyEvent(kevent->qtEvent());
event->setDefaultHandled();
return;
- } else
+ }
#endif // QT_NO_SHORTCUT
{
String commandName = editorCommandForKeyDownEvent(event);
@@ -501,7 +496,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
}
// Non editable content.
- if (m_page->handle()->page->settings()->caretBrowsingEnabled()) {
+ if (m_page->page->settings()->caretBrowsingEnabled()) {
switch (kevent->windowsVirtualKeyCode()) {
case VK_LEFT:
case VK_RIGHT:
@@ -511,15 +506,13 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
case VK_END:
{
#ifndef QT_NO_SHORTCUT
- QWebPage::WebAction action = QWebPagePrivate::editorActionForKeyEvent(kevent->qtEvent());
- ASSERT(action != QWebPage::NoWebAction);
- m_page->triggerAction(action);
+ m_page->triggerActionForKeyEvent(kevent->qtEvent());
event->setDefaultHandled();
#endif
return;
}
case VK_PRIOR: // PageUp
- case VK_NEXT: // PageDown
+ case VK_NEXT: // PageDown
{
String commandName = editorCommandForKeyDownEvent(event);
ASSERT(!commandName.isEmpty());
@@ -532,7 +525,7 @@ void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event)
#ifndef QT_NO_SHORTCUT
if (kevent->qtEvent() == QKeySequence::Copy) {
- m_page->triggerAction(QWebPage::Copy);
+ m_page->triggerCopyAction();
event->setDefaultHandled();
return;
}
@@ -543,8 +536,12 @@ void EditorClientQt::handleInputMethodKeydown(KeyboardEvent*)
{
}
-EditorClientQt::EditorClientQt(QWebPage* page)
- : m_page(page), m_editing(false), m_inUndoRedo(false)
+EditorClientQt::EditorClientQt(QWebPageAdapter* pageAdapter)
+ : m_page(pageAdapter)
+ , m_editing(false)
+ , m_inUndoRedo(false)
+ , m_smartInsertDeleteEnabled(true)
+ , m_selectTrailingWhitespaceEnabled(false)
{
}
@@ -607,12 +604,12 @@ void EditorClientQt::willSetInputMethodState()
void EditorClientQt::setInputMethodState(bool active)
{
- QWebPageClient* webPageClient = m_page->d->client.get();
+ QWebPageClient* webPageClient = m_page->client.data();
if (webPageClient) {
Qt::InputMethodHints hints;
HTMLInputElement* inputElement = 0;
- Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
+ Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
if (frame && frame->document() && frame->document()->focusedNode())
if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag))
inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
diff --git a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
index 863c67b71..c49be4a40 100644
--- a/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/EditorClientQt.h
@@ -36,12 +36,13 @@
#include <wtf/RefCounted.h>
class QWebPage;
+class QWebPageAdapter;
namespace WebCore {
class EditorClientQt : public EditorClient {
public:
- EditorClientQt(QWebPage* page);
+ EditorClientQt(QWebPageAdapter*);
virtual void pageDestroyed();
virtual void frameWillDetachPage(Frame*) { }
@@ -109,14 +110,19 @@ public:
bool isEditing() const;
+ void setSmartInsertDeleteEnabled(bool b) { m_smartInsertDeleteEnabled = b; }
+ void setSelectTrailingWhitespaceEnabled(bool b) { m_selectTrailingWhitespaceEnabled = b; }
+
static bool dumpEditingCallbacks;
static bool acceptsEditing;
private:
TextCheckerClientQt m_textCheckerClient;
- QWebPage* m_page;
+ QWebPageAdapter* m_page;
bool m_editing;
bool m_inUndoRedo; // our undo stack works differently - don't re-enter!
+ bool m_smartInsertDeleteEnabled;
+ bool m_selectTrailingWhitespaceEnabled;
};
}
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 0731d9315..7a23ee268 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -59,7 +59,10 @@
#include "PluginDatabase.h"
#include "ProgressTracker.h"
#include "QNetworkReplyHandler.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "QWebPageClient.h"
+#include "QtPluginWidgetAdapter.h"
#include "RenderPart.h"
#include "ResourceHandle.h"
#include "ResourceHandleInternal.h"
@@ -69,34 +72,30 @@
#include "Settings.h"
#include "ViewportArguments.h"
#include "WebEventConversion.h"
-
-#include "qwebframe.h"
-#include "qwebframe_p.h"
+#include "qwebhistory.h"
#include "qwebhistory_p.h"
#include "qwebhistoryinterface.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
#include "qwebpluginfactory.h"
#include <QCoreApplication>
#include <QDebug>
#include <QFileInfo>
-#include <QGraphicsScene>
-#include <QGraphicsWidget>
+#include <QMouseEvent>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QStringList>
#include <wtf/OwnPtr.h>
+#include <wtf/text/StringBuilder.h>
static QMap<unsigned long, QString> dumpAssignedUrls;
// Compare with the file "WebKit/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm".
static QString drtDescriptionSuitableForTestResult(WebCore::Frame* webCoreFrame)
{
- QWebFrame* frame = QWebFramePrivate::kit(webCoreFrame);
- QString name = frame->frameName();
+ QWebFrameAdapter* frame = QWebFrameAdapter::kit(webCoreFrame);
+ QString name = webCoreFrame->tree()->uniqueName();
- bool isMainFrame = frame == frame->page()->mainFrame();
+ bool isMainFrame = frame == frame->pageAdapter->mainFrameAdapter();
if (isMainFrame) {
if (!name.isEmpty())
return QString::fromLatin1("main frame \"%1\"").arg(name);
@@ -216,24 +215,24 @@ FrameLoaderClientQt::~FrameLoaderClientQt()
{
}
-void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame)
+void FrameLoaderClientQt::setFrame(QWebFrameAdapter* webFrame, Frame* frame)
{
m_webFrame = webFrame;
m_frame = frame;
- if (!m_webFrame || !m_webFrame->page()) {
+ if (!m_webFrame || !m_webFrame->pageAdapter) {
qWarning("FrameLoaderClientQt::setFrame frame without Page!");
return;
}
connect(this, SIGNAL(loadProgress(int)),
- m_webFrame->page(), SIGNAL(loadProgress(int)));
+ m_webFrame->pageAdapter->handle(), SIGNAL(loadProgress(int)));
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)),
- m_webFrame->page(), SIGNAL(unsupportedContent(QNetworkReply*)));
+ m_webFrame->pageAdapter->handle(), SIGNAL(unsupportedContent(QNetworkReply*)));
connect(this, SIGNAL(titleChanged(QString)),
- m_webFrame, SIGNAL(titleChanged(QString)));
+ m_webFrame->handle(), SIGNAL(titleChanged(QString)));
}
void FrameLoaderClientQt::callPolicyFunction(FramePolicyFunction function, PolicyAction action)
@@ -261,11 +260,11 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
ASSERT(m_frame);
ASSERT(m_webFrame);
- QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base);
+ QObject* qWebPage = m_webFrame->pageAdapter->handle();
+ QBrush brush = qWebPage->property("palette").value<QPalette>().brush(QPalette::Base);
QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor();
- QWebPage* page = m_webFrame->page();
- const QSize preferredLayoutSize = page->preferredContentsSize();
+ const QSize preferredLayoutSize = qWebPage->property("preferredContentsSize").toSize();
ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal);
ScrollbarMode vScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Vertical);
@@ -275,17 +274,18 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
// The HistoryController will update the scroll position later if needed.
IntRect currentVisibleContentRect = m_frame->view() ? IntRect(IntPoint::zero(), m_frame->view()->fixedVisibleContentRect().size()) : IntRect();
- m_frame->createView(m_webFrame->page()->viewportSize(),
- backgroundColor, !backgroundColor.alpha(),
- preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(),
- currentVisibleContentRect,
- preferredLayoutSize.isValid(),
- hScrollbar, hLock,
- vScrollbar, vLock);
+ m_frame->createView(qWebPage->property("viewportSize").toSize(),
+ backgroundColor, !backgroundColor.alpha(),
+ preferredLayoutSize.isValid() ? IntSize(preferredLayoutSize) : IntSize(),
+ currentVisibleContentRect,
+ preferredLayoutSize.isValid(),
+ hScrollbar, hLock,
+ vScrollbar, vLock);
bool isMainFrame = m_frame == m_frame->page()->mainFrame();
- if (isMainFrame && page->d->client) {
- bool resizesToContents = page->d->client->viewResizesToContentsEnabled();
+ if (isMainFrame &&m_webFrame->pageAdapter->client) {
+ bool resizesToContents = m_webFrame->pageAdapter->client->viewResizesToContentsEnabled();
+
m_frame->view()->setPaintsEntireContents(resizesToContents);
m_frame->view()->setDelegatesScrolling(resizesToContents);
}
@@ -392,8 +392,8 @@ void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage()
if (!m_webFrame)
return;
- m_webFrame->d->emitUrlChanged();
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->emitUrlChanged();
+ m_webFrame->pageAdapter->updateNavigationActions();
}
@@ -440,7 +440,7 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad()
return;
emitLoadStarted();
postProgressEstimateChangedNotification();
- emit m_webFrame->provisionalLoad();
+ m_webFrame->didStartProvisionalLoad();
}
@@ -478,8 +478,8 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
if (m_frame->tree()->parent() || !m_webFrame)
return;
- m_webFrame->d->emitUrlChanged();
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->emitUrlChanged();
+ m_webFrame->pageAdapter->updateNavigationActions();
// We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle()
// will be called very soon with the correct title.
@@ -490,7 +490,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
if (!isMainFrame)
return;
- emit m_webFrame->page()->viewportChangeRequested();
+ emit m_webFrame->pageAdapter->emitViewportChangeRequested();
}
@@ -499,7 +499,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
if (dumpFrameLoaderCallbacks)
printf("%s - didFinishDocumentLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- if (QWebPagePrivate::drtRun) {
+ if (QWebPageAdapter::drtRun) {
int unloadEventCount = m_frame->document()->domWindow()->pendingUnloadEventListeners();
if (unloadEventCount)
printf("%s - has %u onunload handler(s)\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), unloadEventCount);
@@ -508,7 +508,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
if (m_frame->tree()->parent() || !m_webFrame)
return;
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->pageAdapter->updateNavigationActions();
}
@@ -520,7 +520,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
if (!m_webFrame)
return;
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->pageAdapter->updateNavigationActions();
emitLoadFinished(true);
}
@@ -530,7 +530,7 @@ void FrameLoaderClientQt::dispatchDidLayout(LayoutMilestones milestones)
return;
if (milestones & DidFirstVisuallyNonEmptyLayout)
- emit m_webFrame->initialLayoutCompleted();
+ m_webFrame->emitInitialLayoutCompleted();
}
void FrameLoaderClientQt::dispatchShow()
@@ -545,8 +545,7 @@ void FrameLoaderClientQt::cancelPolicyCheck()
}
-void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function,
- PassRefPtr<FormState>)
+void FrameLoaderClientQt::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>)
{
notImplemented();
// FIXME: This is surely too simple.
@@ -560,7 +559,7 @@ void FrameLoaderClientQt::postProgressStartedNotification()
m_isOriginatingLoad = true;
if (m_frame->tree()->parent() || !m_webFrame)
return;
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->pageAdapter->updateNavigationActions();
}
void FrameLoaderClientQt::postProgressEstimateChangedNotification()
@@ -577,14 +576,11 @@ void FrameLoaderClientQt::postProgressFinishedNotification()
// Send a mousemove event to:
// (1) update the cursor to change according to whatever is underneath the mouse cursor right now;
// (2) display the tool tip if the mouse hovers a node which has a tool tip.
- if (m_frame && m_frame->eventHandler() && m_webFrame->page()) {
- QWidget* view = m_webFrame->page()->view();
- if (view && view->hasFocus()) {
- QPoint localPos = view->mapFromGlobal(QCursor::pos());
- if (view->rect().contains(localPos)) {
- QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
- m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0));
- }
+ if (m_frame && m_frame->eventHandler() && m_webFrame) {
+ QPoint localPos;
+ if (m_webFrame->handleProgressFinished(&localPos)) {
+ QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ m_frame->eventHandler()->mouseMoved(convertMouseEvent(&event, 0));
}
}
}
@@ -655,7 +651,7 @@ void FrameLoaderClientQt::frameLoadCompleted()
// Note that this can be called multiple times.
if (!m_webFrame)
return;
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->pageAdapter->updateNavigationActions();
}
@@ -663,7 +659,7 @@ void FrameLoaderClientQt::restoreViewState()
{
if (!m_webFrame)
return;
- emit m_webFrame->page()->restoreFrameStateRequested(m_webFrame);
+ m_webFrame->pageAdapter->emitRestoreFrameStateRequested(m_webFrame);
}
@@ -700,21 +696,23 @@ void FrameLoaderClientQt::setTitle(const StringWithDirection& title, const KURL&
String FrameLoaderClientQt::userAgent(const KURL& url)
{
- if (m_webFrame) {
- return m_webFrame->page()->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r'));
- }
+ if (m_webFrame)
+ return m_webFrame->pageAdapter->userAgentForUrl(url).remove(QLatin1Char('\n')).remove(QLatin1Char('\r'));
return String();
}
void FrameLoaderClientQt::dispatchDidReceiveIcon()
{
if (m_webFrame)
- emit m_webFrame->iconChanged();
+ m_webFrame->emitIconChanged();
}
void FrameLoaderClientQt::frameLoaderDestroyed()
{
- delete m_webFrame;
+ // Delete QWebFrame (handle()), which owns QWebFramePrivate, which
+ // _is_ a QWebFrameAdapter.
+ if (m_webFrame)
+ delete m_webFrame->handle();
m_frame = 0;
m_webFrame = 0;
@@ -732,7 +730,7 @@ void FrameLoaderClientQt::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* w
return;
if (m_webFrame)
- m_webFrame->d->didClearWindowObject();
+ m_webFrame->didClearWindowObject();
}
void FrameLoaderClientQt::documentElementAvailable()
@@ -744,7 +742,7 @@ void FrameLoaderClientQt::didPerformFirstNavigation() const
{
if (m_frame->tree()->parent() || !m_webFrame)
return;
- m_webFrame->page()->d->updateNavigationActions();
+ m_webFrame->pageAdapter->updateNavigationActions();
}
void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
@@ -760,8 +758,8 @@ void FrameLoaderClientQt::registerForIconNotification(bool shouldRegister)
void FrameLoaderClientQt::onIconLoadedForPageURL(const QString& url)
{
#if ENABLE(ICONDATABASE)
- if (m_webFrame && m_webFrame->url() == url)
- emit m_webFrame->iconChanged();
+ if (m_webFrame && m_webFrame->url == url)
+ m_webFrame->emitIconChanged();
#endif
}
@@ -799,16 +797,16 @@ void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks()
if (!loader->clientRedirectSourceForHistory().isNull()) {
if (dumpHistoryCallbacks) {
printf("WebView performed a client redirect from \"%s\" to \"%s\".\n",
- qPrintable(QString(loader->clientRedirectSourceForHistory())),
- qPrintable(QString(loader->clientRedirectDestinationForHistory())));
+ qPrintable(QString(loader->clientRedirectSourceForHistory())),
+ qPrintable(QString(loader->clientRedirectDestinationForHistory())));
}
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
if (dumpHistoryCallbacks) {
printf("WebView performed a server redirect from \"%s\" to \"%s\".\n",
- qPrintable(QString(loader->serverRedirectSourceForHistory())),
- qPrintable(QString(loader->serverRedirectDestinationForHistory())));
+ qPrintable(QString(loader->serverRedirectSourceForHistory())),
+ qPrintable(QString(loader->serverRedirectDestinationForHistory())));
}
}
}
@@ -850,7 +848,7 @@ void FrameLoaderClientQt::didDetectXSS(const KURL&, bool)
void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item)
{
QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item));
- emit m_webFrame->page()->saveFrameStateRequested(m_webFrame, &historyItem);
+ m_webFrame->pageAdapter->emitSaveFrameStateRequested(m_webFrame, &historyItem);
}
bool FrameLoaderClientQt::canCachePage() const
@@ -896,7 +894,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c
WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request)
{
ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().string(),
- QCoreApplication::translate("QWebFrame", "Request cancelled", 0));
+ QCoreApplication::translate("QWebFrame", "Request cancelled", 0));
error.setIsCancellation(true);
return error;
}
@@ -916,38 +914,38 @@ enum {
WebCore::ResourceError FrameLoaderClientQt::blockedError(const WebCore::ResourceRequest& request)
{
return ResourceError("WebKitErrorDomain", WebKitErrorCannotUseRestrictedPort, request.url().string(),
- QCoreApplication::translate("QWebFrame", "Request blocked", 0));
+ QCoreApplication::translate("QWebFrame", "Request blocked", 0));
}
WebCore::ResourceError FrameLoaderClientQt::cannotShowURLError(const WebCore::ResourceRequest& request)
{
return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowURL, request.url().string(),
- QCoreApplication::translate("QWebFrame", "Cannot show URL", 0));
+ QCoreApplication::translate("QWebFrame", "Cannot show URL", 0));
}
WebCore::ResourceError FrameLoaderClientQt::interruptedForPolicyChangeError(const WebCore::ResourceRequest& request)
{
return ResourceError("WebKitErrorDomain", WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(),
- QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0));
+ QCoreApplication::translate("QWebFrame", "Frame load interrupted by policy change", 0));
}
WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
{
return ResourceError("WebKitErrorDomain", WebKitErrorCannotShowMIMEType, response.url().string(),
- QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0));
+ QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0));
}
WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response)
{
return ResourceError("QtNetwork", QNetworkReply::ContentNotFoundError, response.url().string(),
- QCoreApplication::translate("QWebFrame", "File does not exist", 0));
+ QCoreApplication::translate("QWebFrame", "File does not exist", 0));
}
WebCore::ResourceError FrameLoaderClientQt::pluginWillHandleLoadError(const WebCore::ResourceResponse& response)
{
return ResourceError("WebKit", WebKitErrorPluginWillHandleLoad, response.url().string(),
- QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0));
+ QCoreApplication::translate("QWebFrame", "Loading is handled by the media engine", 0));
}
bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError& error)
@@ -991,8 +989,7 @@ void FrameLoaderClientQt::download(WebCore::ResourceHandle* handle, const WebCor
QNetworkReplyHandler* handler = handle->getInternal()->m_job;
QNetworkReply* reply = handler->release();
if (reply) {
- QWebPage* page = m_webFrame->page();
- if (page->forwardUnsupportedContent())
+ if (m_webFrame->pageAdapter->forwardUnsupportedContent)
emit unsupportedContent(reply);
else
reply->abort();
@@ -1024,9 +1021,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
{
if (dumpResourceLoadCallbacks)
printf("%s - willSendRequest %s redirectResponse %s\n",
- qPrintable(dumpAssignedUrls[identifier]),
- qPrintable(drtDescriptionSuitableForTestResult(newRequest)),
- (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse)));
+ qPrintable(dumpAssignedUrls[identifier]),
+ qPrintable(drtDescriptionSuitableForTestResult(newRequest)),
+ (redirectResponse.isNull()) ? "(null)" : qPrintable(drtDescriptionSuitableForTestResult(redirectResponse)));
if (sendRequestReturnsNull) {
blockRequest(newRequest);
@@ -1043,11 +1040,11 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
QString host = url.host();
QString urlScheme = url.scheme().toLower();
- if (QWebPagePrivate::drtRun
+ if (QWebPageAdapter::drtRun
&& !host.isEmpty()
&& (urlScheme == QLatin1String("http") || urlScheme == QLatin1String("https"))) {
- QUrl testURL = m_webFrame->page()->mainFrame()->requestedUrl();
+ QUrl testURL = m_webFrame->pageAdapter->mainFrameAdapter()->frameLoaderClient->lastRequestedUrl();
QString testHost = testURL.host();
QString testURLScheme = testURL.scheme().toLower();
@@ -1061,9 +1058,9 @@ void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsi
}
for (int i = 0; i < sendRequestClearHeaders.size(); ++i)
- newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString());
+ newRequest.setHTTPHeaderField(sendRequestClearHeaders.at(i).toLocal8Bit().constData(), QString());
- if (QWebPagePrivate::drtRun) {
+ if (QWebPageAdapter::drtRun) {
QMap<QString, QString>::const_iterator it = URLsToRedirect.constFind(url.toString());
if (it != URLsToRedirect.constEnd())
newRequest.setURL(QUrl(it.value()));
@@ -1094,17 +1091,17 @@ void FrameLoaderClientQt::dispatchDidReceiveResponse(WebCore::DocumentLoader*, u
m_response = response;
if (dumpWillCacheResponseCallbacks)
printf("%s - willCacheResponse: called\n",
- qPrintable(dumpAssignedUrls[identifier]));
+ qPrintable(dumpAssignedUrls[identifier]));
if (dumpResourceLoadCallbacks)
printf("%s - didReceiveResponse %s\n",
- qPrintable(dumpAssignedUrls[identifier]),
- qPrintable(drtDescriptionSuitableForTestResult(response)));
+ qPrintable(dumpAssignedUrls[identifier]),
+ qPrintable(drtDescriptionSuitableForTestResult(response)));
if (dumpResourceResponseMIMETypes) {
printf("%s has MIME type %s\n",
- qPrintable(QString(response.url().lastPathComponent())),
- qPrintable(QString(response.mimeType())));
+ qPrintable(QString(response.url().lastPathComponent())),
+ qPrintable(QString(response.mimeType())));
}
}
@@ -1116,15 +1113,15 @@ void FrameLoaderClientQt::dispatchDidFinishLoading(WebCore::DocumentLoader*, uns
{
if (dumpResourceLoadCallbacks)
printf("%s - didFinishLoading\n",
- (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"));
+ (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"));
}
void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const WebCore::ResourceError& error)
{
if (dumpResourceLoadCallbacks)
printf("%s - didFailLoadingWithError: %s\n",
- (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"),
- qPrintable(drtDescriptionSuitableForTestResult(error)));
+ (dumpAssignedUrls.contains(identifier) ? qPrintable(dumpAssignedUrls[identifier]) : "<unknown>"),
+ qPrintable(drtDescriptionSuitableForTestResult(error)));
}
bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int)
@@ -1135,27 +1132,19 @@ bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::Docume
bool FrameLoaderClientQt::callErrorPageExtension(const WebCore::ResourceError& error)
{
- QWebPage* page = m_webFrame->page();
- if (!page->supportsExtension(QWebPage::ErrorPageExtension))
+ QWebPageAdapter* page = m_webFrame->pageAdapter;
+ if (!page->supportsErrorPageExtension())
return false;
-
- 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 false;
-
+ QWebPageAdapter::ErrorPageOption option;
option.url = QUrl(error.failingURL());
option.frame = m_webFrame;
+ option.domain = error.domain();
option.error = error.errorCode();
option.errorString = error.localizedDescription();
- QWebPage::ErrorPageExtensionReturn output;
- if (!page->extension(QWebPage::ErrorPageExtension, &option, &output))
+ QWebPageAdapter::ErrorPageReturn output;
+
+ if (!page->errorPageExtension(&option, &output))
return false;
KURL baseUrl(output.baseUrl);
@@ -1200,10 +1189,10 @@ WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage(const WebCore::Navigatio
{
if (!m_webFrame)
return 0;
- QWebPage *newPage = m_webFrame->page()->createWindow(QWebPage::WebBrowserWindow);
+ QWebPageAdapter* newPage = m_webFrame->pageAdapter->createWindow(/* modalDialog = */ false);
if (!newPage)
return 0;
- return newPage->mainFrame()->d->frame;
+ return newPage->mainFrameAdapter()->frame;
}
void FrameLoaderClientQt::dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest&)
@@ -1230,9 +1219,8 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc
{
Q_ASSERT(m_webFrame);
QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext()));
- QWebPage* page = m_webFrame->page();
- if (!page->d->acceptNavigationRequest(0, r, QWebPage::NavigationType(action.type()))) {
+ if (!m_webFrame->pageAdapter->acceptNavigationRequest(0, r, (int)action.type())) {
if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
m_frame->loader()->resetMultipleFormSubmissionProtection();
@@ -1251,7 +1239,6 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
{
Q_ASSERT(m_webFrame);
QNetworkRequest r(request.toNetworkRequest(m_frame->loader()->networkingContext()));
- QWebPage*page = m_webFrame->page();
PolicyAction result;
// Currently, this is only enabled by DRT.
@@ -1260,27 +1247,27 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
for (const Event* event = action.event(); event; event = event->underlyingEvent()) {
if (event->isMouseEvent()) {
const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event);
- node = QWebFramePrivate::core(m_webFrame)->eventHandler()->hitTestResultAtPoint(
+ node = m_webFrame->frame->eventHandler()->hitTestResultAtPoint(
mouseEvent->absoluteLocation(), false).innerNonSharedNode();
break;
}
}
printf("Policy delegate: attempt to load %s with navigation type '%s'%s\n",
- qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
- (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
+ qPrintable(drtDescriptionSuitableForTestResult(request.url())), navigationTypeToString(action.type()),
+ (node) ? qPrintable(QString::fromLatin1(" originating from ") + drtDescriptionSuitableForTestResult(node, 0)) : "");
if (policyDelegatePermissive)
result = PolicyUse;
else
result = PolicyIgnore;
- page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()));
+ m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type());
callPolicyFunction(function, result);
return;
}
- if (!page->d->acceptNavigationRequest(m_webFrame, r, QWebPage::NavigationType(action.type()))) {
+ if (!m_webFrame->pageAdapter->acceptNavigationRequest(m_webFrame, r, (int)action.type())) {
if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted)
m_frame->loader()->resetMultipleFormSubmissionProtection();
@@ -1305,40 +1292,39 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request,
if (!m_webFrame)
return;
- emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext()));
+ m_webFrame->pageAdapter->emitDownloadRequested(request.toNetworkRequest(m_frame->loader()->networkingContext()));
}
-PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
- const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
+PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
{
if (!m_webFrame)
return 0;
QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name);
- if (url.isEmpty())
- frameData.url = blankURL();
- else
- frameData.url = url;
-
frameData.referrer = referrer;
frameData.allowsScrolling = allowsScrolling;
frameData.marginWidth = marginWidth;
frameData.marginHeight = marginHeight;
- QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData);
+ QWebFrameAdapter* childWebFrame = m_webFrame->createChildFrame(&frameData);
// The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
- if (!webFrame.data()->d->frame->page()) {
+ if (!childWebFrame->frame->page()) {
+ QPointer<QObject> qWebFrame = childWebFrame->handle();
frameData.frame.release();
- ASSERT(webFrame.isNull());
+ ASSERT_UNUSED(qWebFrame, !qWebFrame);
return 0;
}
- emit m_webFrame->page()->frameCreated(webFrame.data());
+ m_webFrame->pageAdapter->emitFrameCreated(childWebFrame);
// FIXME: Set override encoding if we have one.
- m_frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get());
+ KURL urlToLoad = url;
+ if (urlToLoad.isEmpty())
+ urlToLoad = blankURL();
+
+ m_frame->loader()->loadURLIntoChildFrame(urlToLoad, frameData.referrer, frameData.frame.get());
// The frame's onload handler may have removed it from the document.
if (!frameData.frame->tree()->parent())
@@ -1399,44 +1385,45 @@ static const CSSPropertyID qstyleSheetProperties[] = {
const unsigned numqStyleSheetProperties = sizeof(qstyleSheetProperties) / sizeof(qstyleSheetProperties[0]);
-class QtPluginWidget: public Widget
-{
+class QtPluginWidget: public Widget {
public:
- QtPluginWidget(QWidget* w = 0): Widget(w) {}
+ QtPluginWidget(QtPluginWidgetAdapter* w)
+ : Widget(w->handle())
+ , m_adapter(w)
+ {
+ setBindingObject(w->handle());
+ }
+
~QtPluginWidget()
{
- if (platformWidget())
- platformWidget()->deleteLater();
+ delete m_adapter;
}
+
+ inline QtPluginWidgetAdapter* widgetAdapter() const
+ {
+ return m_adapter;
+ }
+
virtual void invalidateRect(const IntRect& r)
{
if (platformWidget())
- static_cast<QWidget*>(platformWidget())->update(r);
+ widgetAdapter()->update(r);
}
virtual void frameRectsChanged()
{
- QWidget* widget = static_cast<QWidget*>(platformWidget());
+ QtPluginWidgetAdapter* widget = widgetAdapter();
if (!widget)
return;
-
- IntRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
- widget->setGeometry(windowRect);
+ QRect windowRect = convertToContainingWindow(IntRect(0, 0, frameRect().width(), frameRect().height()));
ScrollView* parentScrollView = parent();
- if (!parentScrollView)
- return;
-
- ASSERT(parentScrollView->isFrameView());
- IntRect clipRect(static_cast<FrameView*>(parentScrollView)->windowClipRect());
- clipRect.move(-windowRect.x(), -windowRect.y());
- clipRect.intersect(widget->rect());
-
- QRegion clipRegion = QRegion(clipRect);
- widget->setMask(clipRegion);
-
- handleVisibility();
-
- widget->update();
+ QRect clipRect;
+ if (parentScrollView) {
+ ASSERT(parentScrollView->isFrameView());
+ clipRect = static_cast<FrameView*>(parentScrollView)->windowClipRect();
+ clipRect.translate(-windowRect.x(), -windowRect.y());
+ }
+ widget->setGeometryAndClip(windowRect, clipRect, isVisible());
}
virtual void show()
@@ -1444,75 +1431,25 @@ public:
Widget::show();
handleVisibility();
}
+ virtual void hide()
+ {
+ if (platformWidget())
+ widgetAdapter()->setVisible(false);
+ }
private:
+ QtPluginWidgetAdapter* m_adapter;
+
void handleVisibility()
{
if (!isVisible())
return;
-
- QWidget* widget = static_cast<QWidget*>(platformWidget());
- // If setMask is set with an empty QRegion, no clipping will
- // be performed, so in that case we hide the platformWidget.
- QRegion mask = widget->mask();
- widget->setVisible(!mask.isEmpty());
+ widgetAdapter()->setVisible(true);
}
};
-#if !defined(QT_NO_GRAPHICSVIEW)
-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: Make the code handle 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)
- {
- setBindingObject(graphicsWidget);
- }
-
- QGraphicsWidget* graphicsWidget;
-};
-#endif // QT_NO_GRAPHICSVIEW
-
-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)
+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)
{
// qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.string() << mimeType;
// qDebug()<<"------\t url = "<<url.string();
@@ -1535,72 +1472,55 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
QString urlStr(url.string());
QUrl qurl = urlStr;
- QObject* object = 0;
+ QObject* pluginAdapter = 0;
if (mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget") {
- object = m_webFrame->page()->createPlugin(classid, qurl, params, values);
+ pluginAdapter = m_webFrame->pageAdapter->createPlugin(classid, qurl, params, values);
#ifndef QT_NO_STYLE_STYLESHEET
- QWidget* widget = qobject_cast<QWidget*>(object);
+ QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter);
if (widget && mimeType == "application/x-qt-styled-widget") {
- QString styleSheet = element->getAttribute("style");
+ StringBuilder styleSheet;
+ styleSheet.append(element->getAttribute("style"));
if (!styleSheet.isEmpty())
- styleSheet += QLatin1Char(';');
+ styleSheet.append(';');
for (unsigned i = 0; i < numqStyleSheetProperties; ++i) {
CSSPropertyID property = qstyleSheetProperties[i];
- styleSheet += QString::fromLatin1(getPropertyName(property));
- styleSheet += QLatin1Char(':');
- styleSheet += CSSComputedStyleDeclaration::create(element)->getPropertyValue(property);
- styleSheet += QLatin1Char(';');
+ styleSheet.append(getPropertyName(property));
+ styleSheet.append(':');
+ styleSheet.append(CSSComputedStyleDeclaration::create(element)->getPropertyValue(property));
+ styleSheet.append(';');
}
- widget->setStyleSheet(styleSheet);
+ widget->setStyleSheet(styleSheet.toString());
}
#endif // QT_NO_STYLE_STYLESHEET
}
- if (!object) {
- QWebPluginFactory* factory = m_webFrame->page()->pluginFactory();
+ if (!pluginAdapter) {
+ QWebPluginFactory* factory = m_webFrame->pageAdapter->pluginFactory;
if (factory)
- object = factory->create(mimeType, qurl, params, values);
+ pluginAdapter = m_webFrame->pageAdapter->adapterForWidget(factory->create(mimeType, qurl, params, values));
}
-
- if (object) {
- QWidget* widget = qobject_cast<QWidget*>(object);
+ if (pluginAdapter) {
+ QtPluginWidgetAdapter* widget = qobject_cast<QtPluginWidgetAdapter*>(pluginAdapter);
if (widget) {
- QWidget* parentWidget = 0;
- if (m_webFrame->page()->d->client)
- parentWidget = qobject_cast<QWidget*>(m_webFrame->page()->d->client->pluginParent());
+ QObject* parentWidget = 0;
+ if (m_webFrame->pageAdapter->client)
+ parentWidget = m_webFrame->pageAdapter->client->pluginParent();
if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
- widget->setParent(parentWidget);
- widget->hide();
- RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget());
- w->setPlatformWidget(widget);
+ widget->setWidgetParent(parentWidget);
+ widget->setVisible(false);
+ RefPtr<QtPluginWidget> w = adoptRef(new QtPluginWidget(widget));
// Make sure it's invisible until properly placed into the layout.
w->setFrameRect(IntRect(0, 0, 0, 0));
return w;
}
-#if !defined(QT_NO_GRAPHICSVIEW)
- QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(object);
- if (graphicsWidget) {
- QGraphicsObject* parentWidget = 0;
- if (m_webFrame->page()->d->client)
- parentWidget = qobject_cast<QGraphicsObject*>(m_webFrame->page()->d->client->pluginParent());
- graphicsWidget->hide();
- if (parentWidget) // Don't reparent to nothing (i.e. keep whatever parent QWebPage::createPlugin() chose.
- graphicsWidget->setParentItem(parentWidget);
- RefPtr<QtPluginGraphicsWidget> w = QtPluginGraphicsWidget::create(graphicsWidget);
- // Make sure it's invisible until properly placed into the layout.
- w->setFrameRect(IntRect(0, 0, 0, 0));
- return w;
- }
-#endif // QT_NO_GRAPHICSVIEW
-
// FIXME: Make things work for widgetless plugins as well.
- delete object;
+ delete pluginAdapter;
}
#if ENABLE(NETSCAPE_PLUGIN_API)
else { // NPAPI Plugins
@@ -1632,8 +1552,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
m_hasSentResponseToPlugin = false;
}
-PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url,
- const Vector<String>& paramNames, const Vector<String>& paramValues)
+PassRefPtr<Widget> FrameLoaderClientQt::createJavaAppletWidget(const IntSize& pluginSize, HTMLAppletElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
return createPlugin(pluginSize, element, url, paramNames, paramValues, "application/x-java-applet", true);
}
@@ -1645,23 +1564,26 @@ String FrameLoaderClientQt::overrideMediaType() const
QString FrameLoaderClientQt::chooseFile(const QString& oldFile)
{
- return m_webFrame->page()->chooseFile(m_webFrame, oldFile);
+ QStringList result = m_webFrame->pageAdapter->chooseFiles(m_webFrame, /*allowMulti*/ false, (QStringList() << oldFile));
+ return result.isEmpty() ? QString() : result.first();
}
PassRefPtr<FrameNetworkingContext> FrameLoaderClientQt::createNetworkingContext()
{
- QVariant value = m_webFrame->page()->property("_q_MIMESniffingDisabled");
+ QVariant value = m_webFrame->pageAdapter->handle()->property("_q_MIMESniffingDisabled");
bool MIMESniffingDisabled = value.isValid() && value.toBool();
- return FrameNetworkingContextQt::create(m_frame, m_webFrame, !MIMESniffingDisabled, m_webFrame->page()->networkAccessManager());
+ return FrameNetworkingContextQt::create(m_frame, m_webFrame->handle(), !MIMESniffingDisabled);
+}
+
+QWebFrameAdapter* FrameLoaderClientQt::webFrame() const
+{
+ return m_webFrame;
}
void FrameLoaderClientQt::emitLoadStarted()
{
- QWebPage* webPage = m_webFrame->page();
- if (m_isOriginatingLoad && webPage)
- emit webPage->loadStarted();
- emit m_webFrame->loadStarted();
+ m_webFrame->emitLoadStarted(m_isOriginatingLoad);
}
void FrameLoaderClientQt::emitLoadFinished(bool ok)
@@ -1670,10 +1592,7 @@ void FrameLoaderClientQt::emitLoadFinished(bool ok)
const bool wasOriginatingLoad = m_isOriginatingLoad;
m_isOriginatingLoad = false;
- QWebPage* webPage = m_webFrame->page();
- if (wasOriginatingLoad && webPage)
- emit webPage->loadFinished(ok);
- emit m_webFrame->loadFinished(ok);
+ m_webFrame->emitLoadFinished(wasOriginatingLoad, ok);
}
}
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 03102de3e..a2b4ede93 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -30,14 +30,15 @@
#ifndef FrameLoaderClientQt_h
#define FrameLoaderClientQt_h
-
+#include "FormState.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
+#include "HTMLFormElement.h"
#include "KURL.h"
-#include "WebCore/plugins/PluginView.h"
#include "ResourceError.h"
#include "ResourceResponse.h"
+#include "WebCore/plugins/PluginView.h"
#include <QUrl>
#include <qobject.h>
#include <wtf/Forward.h>
@@ -49,6 +50,7 @@ class QNetworkReply;
QT_END_NAMESPACE
class QWebFrame;
+class QWebFrameAdapter;
namespace WebCore {
@@ -65,8 +67,8 @@ struct LoadErrorResetToken;
class FrameLoaderClientQt : public QObject, public FrameLoaderClient {
Q_OBJECT
- friend class ::QWebFrame;
- void callPolicyFunction(FramePolicyFunction function, PolicyAction action);
+ friend class ::QWebFrameAdapter;
+ void callPolicyFunction(FramePolicyFunction, PolicyAction);
bool callErrorPageExtension(const ResourceError&);
Q_SIGNALS:
@@ -79,7 +81,7 @@ public:
~FrameLoaderClientQt();
virtual void frameLoaderDestroyed();
- void setFrame(QWebFrame* webFrame, Frame* frame);
+ void setFrame(QWebFrameAdapter*, Frame*);
virtual bool hasWebView() const; // mainly for assertions
@@ -128,9 +130,9 @@ public:
virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
virtual void dispatchShow();
- virtual void dispatchDecidePolicyForResponse(FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
- virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&);
- virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>);
+ virtual void dispatchDecidePolicyForResponse(FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
+ virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&);
+ virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>);
virtual void cancelPolicyCheck();
virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&);
@@ -204,8 +206,7 @@ public:
virtual bool canCachePage() const;
virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
- virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
- const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+ virtual PassRefPtr<Frame> createFrame(const KURL&, const String& name, HTMLFrameOwnerElement*, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
virtual void recreatePlugin(Widget*) { }
virtual void redirectDataToPlugin(Widget* pluginWidget);
@@ -227,6 +228,8 @@ public:
const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; }
+ QWebFrameAdapter* webFrame() const;
+
static bool dumpFrameLoaderCallbacks;
static bool dumpProgressFinishedCallback;
static bool dumpUserGestureInFrameLoaderCallbacks;
@@ -251,7 +254,7 @@ private:
void emitLoadFinished(bool ok);
Frame *m_frame;
- QWebFrame *m_webFrame;
+ QWebFrameAdapter *m_webFrame;
ResourceResponse m_response;
// Plugin view to redirect data to
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp
index 7e99624b5..5e665313f 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp
@@ -18,29 +18,28 @@
*/
#include "config.h"
-
#include "FrameNetworkingContextQt.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
+#include "qwebsettings.h"
+
#include <QNetworkAccessManager>
#include <QNetworkCookie>
#include <QNetworkCookieJar>
namespace WebCore {
-FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager)
+FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled)
: FrameNetworkingContext(frame)
, m_originatingObject(originatingObject)
- , m_networkAccessManager(networkAccessManager)
, m_mimeSniffingEnabled(mimeSniffingEnabled)
{
}
-PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager* networkAccessManager)
+PassRefPtr<FrameNetworkingContextQt> FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled)
{
- return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled, networkAccessManager));
+ return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled));
}
QObject* FrameNetworkingContextQt::originatingObject() const
@@ -50,7 +49,7 @@ QObject* FrameNetworkingContextQt::originatingObject() const
QNetworkAccessManager* FrameNetworkingContextQt::networkAccessManager() const
{
- return (qobject_cast<QWebFrame*>(m_originatingObject))->page()->networkAccessManager();
+ return QWebFrameAdapter::kit(frame())->pageAdapter->networkAccessManager();
}
bool FrameNetworkingContextQt::mimeSniffingEnabled() const
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h
index c95e630ac..b58abe48d 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h
@@ -26,10 +26,10 @@ namespace WebCore {
class FrameNetworkingContextQt : public FrameNetworkingContext {
public:
- static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*);
+ static PassRefPtr<FrameNetworkingContextQt> create(Frame*, QObject* originatingObject, bool mimeSniffingEnabled);
private:
- FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled, QNetworkAccessManager*);
+ FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled);
virtual QObject* originatingObject() const;
virtual QNetworkAccessManager* networkAccessManager() const;
@@ -37,7 +37,6 @@ private:
virtual bool thirdPartyCookiePolicyPermission(const QUrl&) const;
QObject* m_originatingObject;
- QNetworkAccessManager* m_networkAccessManager;
bool m_mimeSniffingEnabled;
};
diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
index 3b244c657..25e357aba 100644
--- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
@@ -23,7 +23,6 @@
#include "ChromeClientQt.h"
#if USE(QT_MULTIMEDIA)
-#include "FullScreenVideoWidget.h"
#include "MediaPlayerPrivateQt.h"
#endif
#include "HTMLNames.h"
@@ -40,10 +39,8 @@
#endif
#if USE(QT_MULTIMEDIA)
-#include <QGraphicsVideoItem>
#include <QMediaPlayer>
#endif
-#include <QWidget>
namespace WebCore {
@@ -90,49 +87,6 @@ void GStreamerFullScreenVideoHandler::exitFullScreen()
}
#endif
-#if USE(QT_MULTIMEDIA)
-bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false;
-
-DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
- : QWebFullScreenVideoHandler()
- , m_fullScreenWidget(new FullScreenVideoWidget)
-{
- connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed()));
- m_fullScreenWidget->hide();
-
- m_fullScreenWidget->close();
-}
-
-DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler()
-{
- delete m_fullScreenWidget;
-}
-
-bool DefaultFullScreenVideoHandler::requiresFullScreenForVideoPlayback() const
-{
- static bool initialized = false;
- if (!initialized) {
- QByteArray forceFullScreen = qgetenv("QT_WEBKIT_FORCE_FULLSCREEN_VIDEO");
- if (!forceFullScreen.isEmpty())
- s_shouldForceFullScreenVideoPlayback = true;
-
- initialized = true;
- }
-
- return s_shouldForceFullScreenVideoPlayback;
-}
-
-void DefaultFullScreenVideoHandler::enterFullScreen(QMediaPlayer* player)
-{
- m_fullScreenWidget->show(player);
-}
-
-void DefaultFullScreenVideoHandler::exitFullScreen()
-{
- m_fullScreenWidget->close();
-}
-#endif
-
FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
: m_chromeClient(chromeClient)
, m_videoElement(0)
@@ -140,10 +94,7 @@ FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
Q_ASSERT(m_chromeClient);
#if USE(QT_MULTIMEDIA)
- m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler().leakPtr();
- if (!m_FullScreenVideoHandler)
- m_FullScreenVideoHandler = new DefaultFullScreenVideoHandler;
-
+ m_FullScreenVideoHandler = m_chromeClient->createFullScreenVideoHandler();
if (m_FullScreenVideoHandler)
connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose()));
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h
index 34bc90c0d..81a288da5 100644
--- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h
@@ -65,25 +65,6 @@ private:
};
#endif
-// We do not use ENABLE or USE because moc does not expand these macros.
-#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
-class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
- Q_OBJECT
-public:
- DefaultFullScreenVideoHandler();
- virtual ~DefaultFullScreenVideoHandler();
- bool requiresFullScreenForVideoPlayback() const;
-
-public Q_SLOTS:
- void enterFullScreen(QMediaPlayer*);
- void exitFullScreen();
-
-private:
- static bool s_shouldForceFullScreenVideoPlayback;
- FullScreenVideoWidget *m_fullScreenWidget;
-};
-#endif
-
class FullScreenVideoQt : public QObject {
Q_OBJECT
public:
diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
index bb5e2b9f6..4105d02c6 100644
--- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.cpp
@@ -25,6 +25,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "FullScreenVideoWidget.h"
#include <QApplication>
@@ -35,7 +36,7 @@
static const int gHideMouseCursorDelay = 3000;
-namespace WebCore {
+namespace WebKit {
FullScreenVideoWidget::FullScreenVideoWidget()
: QVideoWidget()
diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h
index 7e7f8df1c..201cc49d1 100644
--- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h
+++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoWidget.h
@@ -35,7 +35,7 @@ QT_BEGIN_NAMESPACE
class QMediaPlayer;
QT_END_NAMESPACE
-namespace WebCore {
+namespace WebKit {
class FullScreenVideoWidget : public QVideoWidget {
Q_OBJECT
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
index b6b4d70bd..26d1b407a 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
@@ -33,10 +33,8 @@
#include "GeolocationPosition.h"
#include "HTMLFormElement.h"
#include "Page.h"
-#include "qwebframe.h"
-#include "qwebframe_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include <QtLocation/QGeoPositionInfoSource>
@@ -44,8 +42,8 @@ namespace WebCore {
static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service";
-GeolocationClientQt::GeolocationClientQt(const QWebPage* page)
- : m_page(page)
+GeolocationClientQt::GeolocationClientQt(const QWebPageAdapter* page)
+ : m_webPage(page)
, m_lastPosition(0)
, m_location(0)
{
@@ -85,12 +83,9 @@ void GeolocationClientQt::positionUpdated(const QGeoPositionInfo& geoPosition)
double timeStampInSeconds = geoPosition.timestamp().toMSecsSinceEpoch() / 1000;
- m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude,
- accuracy, providesAltitude, altitude,
- providesAltitudeAccuracy, altitudeAccuracy,
- providesHeading, heading, providesSpeed, speed);
+ m_lastPosition = GeolocationPosition::create(timeStampInSeconds, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
- WebCore::Page* page = QWebPagePrivate::core(m_page);
+ WebCore::Page* page = m_webPage->page;
GeolocationController::from(page)->positionChanged(m_lastPosition.get());
}
@@ -100,7 +95,7 @@ void GeolocationClientQt::startUpdating()
connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
if (!m_location) {
- WebCore::Page* page = QWebPagePrivate::core(m_page);
+ WebCore::Page* page = m_webPage->page;
RefPtr<WebCore::GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, failedToStartServiceErrorMessage);
GeolocationController::from(page)->errorOccurred(error.get());
return;
@@ -124,14 +119,14 @@ void GeolocationClientQt::setEnableHighAccuracy(bool)
void GeolocationClientQt::requestPermission(Geolocation* geolocation)
{
ASSERT(geolocation);
- QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame());
+ QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame());
GeolocationPermissionClientQt::geolocationPermissionClient()->requestGeolocationPermissionForFrame(webFrame, geolocation);
}
void GeolocationClientQt::cancelPermissionRequest(Geolocation* geolocation)
{
ASSERT(geolocation);
- QWebFrame* webFrame = QWebFramePrivate::kit(geolocation->frame());
+ QWebFrameAdapter* webFrame = QWebFrameAdapter::kit(geolocation->frame());
GeolocationPermissionClientQt::geolocationPermissionClient()->cancelGeolocationPermissionRequestForFrame(webFrame, geolocation);
}
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
index 2e94bdebc..c2287867f 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
@@ -28,16 +28,16 @@
#include "GeolocationClient.h"
+#include <QGeoPositionInfo>
#include <QObject>
#include <wtf/RefPtr.h>
-#include <QtLocation/QGeoPositionInfo>
QT_BEGIN_NAMESPACE
class QGeoPositionInfoSource;
QT_END_NAMESPACE
-class QWebPage;
+class QWebPageAdapter;
namespace WebCore {
@@ -46,7 +46,7 @@ class GeolocationClientQt : public QObject, public GeolocationClient {
Q_OBJECT
public:
- GeolocationClientQt(const QWebPage*);
+ GeolocationClientQt(const QWebPageAdapter*);
virtual ~GeolocationClientQt();
virtual void geolocationDestroyed();
@@ -63,7 +63,7 @@ private Q_SLOTS:
void positionUpdated(const QGeoPositionInfo&);
private:
- const QWebPage* m_page;
+ const QWebPageAdapter* m_webPage;
RefPtr<GeolocationPosition> m_lastPosition;
QGeoPositionInfoSource* m_location;
};
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp
index 7500e993f..04e47688a 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp
@@ -32,10 +32,9 @@
#include "GeolocationPermissionClientQt.h"
#include "Geolocation.h"
-
-#include "qwebframe.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "qwebkitglobal.h"
-#include "qwebpage.h"
namespace WebCore {
@@ -60,36 +59,30 @@ GeolocationPermissionClientQt::~GeolocationPermissionClientQt()
{
}
-void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrame* webFrame, Geolocation* listener)
+void GeolocationPermissionClientQt::requestGeolocationPermissionForFrame(QWebFrameAdapter* webFrame, Geolocation* listener)
{
m_pendingPermissionRequests.insert(webFrame, listener);
- QWebPage* page = webFrame->page();
- emit page->featurePermissionRequested(webFrame, QWebPage::Geolocation);
+ QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page());
+ page->geolocationPermissionRequested(webFrame);
}
-void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrame* webFrame, Geolocation* listener)
+void GeolocationPermissionClientQt::cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter* webFrame, Geolocation* listener)
{
m_pendingPermissionRequests.remove(webFrame);
- QWebPage* page = webFrame->page();
- emit page->featurePermissionRequestCanceled(webFrame, QWebPage::Geolocation);
+ QWebPageAdapter* page = QWebPageAdapter::kit(webFrame->frame->page());
+ page->geolocationPermissionRequestCancelled(webFrame);
}
-void GeolocationPermissionClientQt::setPermission(QWebFrame* webFrame, QWebPage::PermissionPolicy permission)
+void GeolocationPermissionClientQt::setPermission(QWebFrameAdapter* webFrame, bool granted)
{
if (!m_pendingPermissionRequests.contains(webFrame))
return;
Geolocation* listener = m_pendingPermissionRequests.value(webFrame);
-
- if (permission == QWebPage::PermissionGrantedByUser)
- listener->setIsAllowed(true);
- else if (permission == QWebPage::PermissionDeniedByUser)
- listener->setIsAllowed(false);
- else
- return;
+ listener->setIsAllowed(granted);
m_pendingPermissionRequests.remove(webFrame);
}
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h
index 1b4540d87..71183b497 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h
@@ -34,12 +34,11 @@
#if ENABLE(GEOLOCATION)
#include "Geolocation.h"
-#include "qwebpage.h"
#include <QHash>
-class QWebFrame;
-class QWebPage;
+class QWebFrameAdapter;
+class QWebPageAdapter;
namespace WebCore {
@@ -48,13 +47,13 @@ public:
GeolocationPermissionClientQt();
~GeolocationPermissionClientQt();
- void requestGeolocationPermissionForFrame(QWebFrame*, Geolocation*);
- void cancelGeolocationPermissionRequestForFrame(QWebFrame*, Geolocation*);
- void setPermission(QWebFrame*, QWebPage::PermissionPolicy);
+ void requestGeolocationPermissionForFrame(QWebFrameAdapter*, Geolocation*);
+ void cancelGeolocationPermissionRequestForFrame(QWebFrameAdapter*, Geolocation*);
+ void setPermission(QWebFrameAdapter*, bool /*granted*/);
static GeolocationPermissionClientQt* geolocationPermissionClient();
private:
- QHash<QWebFrame*, Geolocation*> m_pendingPermissionRequests;
+ QHash<QWebFrameAdapter*, Geolocation*> m_pendingPermissionRequests;
};
}
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
index d6065c14e..385fe9c39 100644
--- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
@@ -44,21 +44,31 @@
#include "qwebelement_p.h"
#include <JavaScriptCore/runtime/InitializeThreading.h>
-#include <QApplication>
-#include <QStyle>
#include <wtf/MainThread.h>
namespace WebKit {
-// Called also from WebKit2's WebProcess.
-Q_DECL_EXPORT void initializeWebKit2Theme()
+static QtStyleFactoryFunction initCallback = 0;
+
+void setWebKitWidgetsInitCallback(QtStyleFactoryFunction callback)
{
- if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") {
- WebCore::RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
+ initCallback = callback;
+}
+
+// Called also from WebKit2's WebProcess
+Q_DECL_EXPORT void initializeWebKitQt()
+{
+ if (initCallback) {
+ WebCore::RenderThemeQStyle::setStyleFactoryFunction(initCallback);
WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle);
}
}
+Q_DECL_EXPORT void setImagePlatformResource(const char* name, const QPixmap& pixmap)
+{
+ WebCore::Image::setPlatformResource(name, pixmap);
+}
+
}
namespace WebCore {
@@ -79,18 +89,10 @@ void initializeWebCoreQt()
PlatformStrategiesQt::initialize();
QtWebElementRuntime::initialize();
- RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
- RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle);
-
#if USE(QTKIT)
InitWebCoreSystemInterface();
#endif
- // QWebSettings::SearchCancelButtonGraphic
- Image::setPlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
- // QWebSettings::SearchCancelButtonPressedGraphic
- Image::setPlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
-
initialized = true;
}
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h
index df1aaf776..56ea74321 100644
--- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.h
@@ -30,6 +30,22 @@
#ifndef InitWebCoreQt_h
#define InitWebCoreQt_h
+#include "qimage.h"
+
+namespace WebCore {
+class Page;
+class QStyleFacade;
+}
+typedef WebCore::QStyleFacade* (*QtStyleFactoryFunction)(WebCore::Page*);
+
+namespace WebKit {
+
+void setWebKitWidgetsInitCallback(QtStyleFactoryFunction);
+Q_DECL_EXPORT void initializeWebKitQt();
+Q_DECL_EXPORT void setImagePlatformResource(const char* /* name */, const QPixmap&);
+
+}
+
namespace WebCore {
void initializeWebCoreQt();
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp
new file mode 100644
index 000000000..71886037d
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "InitWebKitQt.h"
+
+#include "InitWebCoreQt.h"
+
+#include "QStyleFacadeImp.h"
+
+#include <QApplication>
+#include <QStyle>
+
+namespace WebKit {
+
+Q_DECL_EXPORT void initializeWebKitWidgets()
+{
+ static bool initialized = false;
+ if (initialized)
+ return;
+
+ setWebKitWidgetsInitCallback(QStyleFacadeImp::create);
+ initializeWebKitQt();
+
+ // QWebSettings::SearchCancelButtonGraphic
+ setImagePlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
+ // QWebSettings::SearchCancelButtonPressedGraphic
+ setImagePlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
+
+ initialized = true;
+}
+
+}
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h
new file mode 100644
index 000000000..fbb2d18f7
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebKitQt.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 InitWebKitQt_h
+#define InitWebKitQt_h
+
+namespace WebKit {
+
+Q_DECL_EXPORT void initializeWebKitWidgets();
+
+}
+#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index 025ad659d..1bfaa7b70 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -38,62 +38,22 @@
#include "InspectorServerQt.h"
#include "NotImplemented.h"
#include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "ScriptDebugServer.h"
-#include "qwebinspector.h"
-#include "qwebinspector_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
-#include "qwebview.h"
+#include <QCoreApplication>
+#include <QFile>
+#include <QNetworkRequest>
+#include <QSettings>
+#include <QUrl>
+#include <QVariant>
#include <wtf/text/CString.h>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFile>
-#include <QtCore/QSettings>
-#include <QtCore/QVariant>
namespace WebCore {
static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/");
static const QLatin1String settingStorageTypeSuffix(".type");
-class InspectorClientWebPage : public QWebPage {
- Q_OBJECT
- friend class InspectorClientQt;
-public:
- InspectorClientWebPage(QObject* parent = 0)
- : QWebPage(parent)
- {
- connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared()));
- }
-
- QWebPage* createWindow(QWebPage::WebWindowType)
- {
- QWebView* view = new QWebView;
- QWebPage* page = new QWebPage;
- view->setPage(page);
- view->setAttribute(Qt::WA_DeleteOnClose);
- return page;
- }
-
-public Q_SLOTS:
- void javaScriptWindowObjectCleared()
- {
-#ifndef QT_NO_PROPERTIES
- QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects");
- if (!inspectorJavaScriptWindowObjects.isValid())
- return;
- QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap();
- QWebFrame* frame = mainFrame();
- QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin();
- for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) {
- QString name = it.key();
- QVariant value = it.value();
- QObject* obj = value.value<QObject*>();
- frame->addToJavaScriptWindowObject(name, obj);
- }
-#endif
- }
-};
-
namespace {
#if ENABLE(INSPECTOR)
@@ -112,7 +72,7 @@ public:
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>(name)));
+ qPrintable(static_cast<QString>(name)));
return String();
}
@@ -134,7 +94,7 @@ public:
QSettings qsettings;
if (qsettings.status() == QSettings::AccessError) {
qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].",
- qPrintable(static_cast<QString>(name)));
+ qPrintable(static_cast<QString>(name)));
return;
}
@@ -175,7 +135,7 @@ private:
}
-InspectorClientQt::InspectorClientQt(QWebPage* page)
+InspectorClientQt::InspectorClientQt(QWebPageAdapter* page)
: m_inspectedWebPage(page)
, m_frontendWebPage(0)
, m_frontendClient(0)
@@ -204,12 +164,12 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC
{
WebCore::InspectorFrontendChannel* frontendChannel = 0;
#if ENABLE(INSPECTOR)
- OwnPtr<QWebView> inspectorView = adoptPtr(new QWebView);
- // FIXME: Where does inspectorPage get deleted?
- InspectorClientWebPage* inspectorPage = new InspectorClientWebPage(inspectorView.get());
- inspectorView->setPage(inspectorPage);
+ QObject* view = 0;
+ QWebPageAdapter* inspectorPage = 0;
+ m_inspectedWebPage->createWebInspector(&view, &inspectorPage);
+ OwnPtr<QObject> inspectorView = adoptPtr(view);
- QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector();
+ QObject* inspector = m_inspectedWebPage->inspectorHandle();
// Remote frontend was attached.
if (m_remoteFrontEndChannel)
return 0;
@@ -228,21 +188,20 @@ WebCore::InspectorFrontendChannel* InspectorClientQt::openInspectorFrontend(WebC
#ifndef QT_NO_PROPERTIES
QVariant inspectorJavaScriptWindowObjects = inspector->property("_q_inspectorJavaScriptWindowObjects");
if (inspectorJavaScriptWindowObjects.isValid())
- inspectorPage->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects);
+ inspectorPage->handle()->setProperty("_q_inspectorJavaScriptWindowObjects", inspectorJavaScriptWindowObjects);
#endif
- inspectorView->page()->mainFrame()->load(inspectorUrl);
- m_inspectedWebPage->d->inspectorFrontend = inspectorView.get();
- inspector->d->setFrontend(inspectorView.get());
+ inspectorPage->mainFrameAdapter()->load(QNetworkRequest(inspectorUrl));
+ m_inspectedWebPage->setInspectorFrontend(inspectorView.get());
// Is 'controller' the same object as 'inspectorController' (which appears to be unused)?
- InspectorController* controller = inspectorView->page()->d->page->inspectorController();
- OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), this));
+ InspectorController* controller = inspectorPage->page->inspectorController();
+ OwnPtr<InspectorFrontendClientQt> frontendClient = adoptPtr(new InspectorFrontendClientQt(m_inspectedWebPage, inspectorView.release(), inspectorPage->page, this));
m_frontendClient = frontendClient.get();
controller->setInspectorFrontendClient(frontendClient.release());
m_frontendWebPage = inspectorPage;
// Web Inspector should not belong to any other page groups since it is a specialized debugger window.
- m_frontendWebPage->handle()->page->setGroupName("__WebInspectorPageGroup__");
+ m_frontendWebPage->page->setGroupName("__WebInspectorPageGroup__");
frontendChannel = this;
#endif
return frontendChannel;
@@ -273,7 +232,7 @@ void InspectorClientQt::attachAndReplaceRemoteFrontend(InspectorServerRequestHan
{
#if ENABLE(INSPECTOR)
m_remoteFrontEndChannel = channel;
- m_inspectedWebPage->d->inspectorController()->connectFrontend(this);
+ m_inspectedWebPage->page->inspectorController()->connectFrontend(this);
#endif
}
@@ -281,7 +240,7 @@ void InspectorClientQt::detachRemoteFrontend()
{
#if ENABLE(INSPECTOR)
m_remoteFrontEndChannel = 0;
- m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
+ m_inspectedWebPage->page->inspectorController()->disconnectFrontend();
#endif
}
@@ -292,9 +251,9 @@ void InspectorClientQt::highlight()
void InspectorClientQt::hideHighlight()
{
- WebCore::Frame* frame = m_inspectedWebPage->d->page->mainFrame();
+ WebCore::Frame* frame = m_inspectedWebPage->page->mainFrame();
if (frame) {
- QRect rect = m_inspectedWebPage->mainFrame()->geometry();
+ QRect rect = m_inspectedWebPage->mainFrameAdapter()->frameRect();
if (!rect.isEmpty())
frame->view()->invalidateRect(rect);
}
@@ -311,7 +270,7 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message)
if (!m_frontendWebPage)
return false;
- Page* frontendPage = QWebPagePrivate::core(m_frontendWebPage);
+ Page* frontendPage = m_frontendWebPage->page;
return doDispatchMessageOnFrontendPage(frontendPage, message);
#else
return false;
@@ -319,8 +278,8 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message)
}
#if ENABLE(INSPECTOR)
-InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient)
- : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, adoptPtr(new InspectorFrontendSettingsQt()))
+InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt* inspectorClient)
+ : InspectorFrontendClientLocal(inspectedWebPage->page->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsQt()))
, m_inspectedWebPage(inspectedWebPage)
, m_inspectorView(inspectorView)
, m_destroyingInspectorView(false)
@@ -386,10 +345,8 @@ void InspectorFrontendClientQt::inspectedURLChanged(const String& newURL)
void InspectorFrontendClientQt::updateWindowTitle()
{
- if (m_inspectedWebPage->d->inspector) {
- QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL);
- m_inspectedWebPage->d->inspector->setWindowTitle(caption);
- }
+ QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL);
+ m_inspectedWebPage->setInspectorWindowTitle(caption);
}
void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorController)
@@ -399,20 +356,20 @@ void InspectorFrontendClientQt::destroyInspectorView(bool notifyInspectorControl
m_destroyingInspectorView = true;
// Inspected page may have already been destroyed.
- if (m_inspectedWebPage && m_inspectedWebPage->d->inspector) {
+ if (m_inspectedWebPage) {
// Clear reference from QWebInspector to the frontend view.
- m_inspectedWebPage->d->inspector->d->setFrontend(0);
+ m_inspectedWebPage->setInspectorFrontend(0);
}
#if ENABLE(INSPECTOR)
if (notifyInspectorController)
- m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
+ m_inspectedWebPage->page->inspectorController()->disconnectFrontend();
#endif
if (m_inspectorClient)
m_inspectorClient->releaseFrontendPage();
// Clear pointer before deleting WebView to avoid recursive calls to its destructor.
- OwnPtr<QWebView> inspectorView = m_inspectorView.release();
+ OwnPtr<QObject> inspectorView = m_inspectorView.release();
}
void InspectorFrontendClientQt::inspectorClientDestroyed()
@@ -424,4 +381,3 @@ void InspectorFrontendClientQt::inspectorClientDestroyed()
#endif
}
-#include "InspectorClientQt.moc"
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h
index 49ba000ad..c6da4d61c 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h
@@ -33,11 +33,14 @@
#include "InspectorClient.h"
#include "InspectorFrontendChannel.h"
#include "InspectorFrontendClientLocal.h"
-#include <QtCore/QString>
+
+#include <QObject>
+#include <QString>
#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
+class QWebPageAdapter;
class QWebPage;
class QWebView;
@@ -48,7 +51,7 @@ class Page;
class InspectorClientQt : public InspectorClient, public InspectorFrontendChannel {
public:
- InspectorClientQt(QWebPage*);
+ InspectorClientQt(QWebPageAdapter*);
virtual void inspectorDestroyed();
@@ -67,8 +70,8 @@ public:
void detachRemoteFrontend();
private:
- QWebPage* m_inspectedWebPage;
- QWebPage* m_frontendWebPage;
+ QWebPageAdapter* m_inspectedWebPage;
+ QWebPageAdapter* m_frontendWebPage;
InspectorFrontendClientQt* m_frontendClient;
bool m_remoteInspector;
InspectorServerRequestHandlerQt* m_remoteFrontEndChannel;
@@ -78,7 +81,7 @@ private:
class InspectorFrontendClientQt : public InspectorFrontendClientLocal {
public:
- InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient);
+ InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt*);
virtual ~InspectorFrontendClientQt();
virtual void frontendLoaded();
@@ -93,7 +96,7 @@ public:
virtual void attachWindow();
virtual void detachWindow();
- virtual void setAttachedWindowHeight(unsigned height);
+ virtual void setAttachedWindowHeight(unsigned);
virtual void inspectedURLChanged(const String& newURL);
@@ -102,8 +105,8 @@ public:
private:
void updateWindowTitle();
void destroyInspectorView(bool notifyInspectorController);
- QWebPage* m_inspectedWebPage;
- OwnPtr<QWebView> m_inspectorView;
+ QWebPageAdapter* m_inspectedWebPage;
+ OwnPtr<QObject> m_inspectorView;
QString m_inspectedURL;
bool m_destroyingInspectorView;
InspectorClientQt* m_inspectorClient;
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp
new file mode 100644
index 000000000..dc4730b32
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorClientWebPage.h"
+
+#include <qwebframe.h>
+
+using namespace WebKit;
+
+InspectorClientWebPage::InspectorClientWebPage()
+{
+ QWebView* view = new QWebView;
+ view->setPage(this);
+ setParent(view);
+ connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(javaScriptWindowObjectCleared()));
+}
+
+QWebPage* InspectorClientWebPage::createWindow(QWebPage::WebWindowType)
+{
+ QWebView* view = new QWebView;
+ QWebPage* page = new QWebPage;
+ view->setPage(page);
+ view->setAttribute(Qt::WA_DeleteOnClose);
+ return page;
+}
+
+void InspectorClientWebPage::javaScriptWindowObjectCleared()
+{
+ QVariant inspectorJavaScriptWindowObjects = property("_q_inspectorJavaScriptWindowObjects");
+ if (!inspectorJavaScriptWindowObjects.isValid())
+ return;
+ QMap<QString, QVariant> javaScriptNameObjectMap = inspectorJavaScriptWindowObjects.toMap();
+ QWebFrame* frame = mainFrame();
+ QMap<QString, QVariant>::const_iterator it = javaScriptNameObjectMap.constBegin();
+ for ( ; it != javaScriptNameObjectMap.constEnd(); ++it) {
+ QString name = it.key();
+ QVariant value = it.value();
+ QObject* obj = value.value<QObject*>();
+ frame->addToJavaScriptWindowObject(name, obj);
+ }
+}
+
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h
new file mode 100644
index 000000000..887f29b0c
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorClientWebPage.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef InspectorClientWebPage_h
+#define InspectorClientWebPage_h
+
+#include <qwebpage.h>
+#include <qwebview.h>
+
+namespace WebKit {
+
+class InspectorClientWebPage : public QWebPage {
+ Q_OBJECT
+ friend class InspectorClientQt;
+public:
+ InspectorClientWebPage();
+
+ QWebPage* createWindow(QWebPage::WebWindowType);
+
+public Q_SLOTS:
+ void javaScriptWindowObjectCleared();
+};
+
+} // namespace WebKit
+
+#endif // InspectorClientWebPage_h
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index 65bbad0f0..abf9c3f78 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -23,16 +23,15 @@
#include "InspectorClientQt.h"
#include "InspectorController.h"
#include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "qhttpheader_p.h"
-#include "qwebpage.h"
-#include "qwebpage_p.h"
#include <QFile>
#include <QString>
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
#include <QUrl>
-#include <QWidget>
#include <qendian.h>
#include <wtf/SHA1.h>
#include <wtf/text/Base64.h>
@@ -224,12 +223,11 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
// If no path is specified, generate an index page.
if (m_path.isEmpty() || (m_path == QString(QLatin1Char('/')))) {
QString indexHtml = QLatin1String("<html><head><title>Remote Web Inspector</title></head><body><ul>\n");
- for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin();
- it != m_server->m_inspectorClients.end();
- ++it) {
+ for (QMap<int, InspectorClientQt* >::const_iterator it = m_server->m_inspectorClients.begin(); it != m_server->m_inspectorClients.end(); ++it) {
+
indexHtml.append(QString::fromLatin1("<li><a href=\"/webkit/inspector/inspector.html?page=%1\">%2</li>\n")
- .arg(it.key())
- .arg(it.value()->m_inspectedWebPage->mainFrame()->url().toString()));
+ .arg(it.key())
+ .arg(QUrl(it.value()->m_inspectedWebPage->mainFrameAdapter()->url).toString()));
}
indexHtml.append(QLatin1String("</ul></body></html>"));
response = indexHtml.toLatin1();
@@ -356,8 +354,8 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead()
#if ENABLE(INSPECTOR)
if (m_inspectorClient) {
- InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController();
- inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
+ InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->page->inspectorController();
+ inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
}
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
index b0bb0c79d..2754b58d9 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
@@ -45,8 +45,8 @@ public:
void listen(quint16 port);
- void registerClient(InspectorClientQt* client);
- void unregisterClient(InspectorClientQt* client);
+ void registerClient(InspectorClientQt*);
+ void unregisterClient(InspectorClientQt*);
void close();
InspectorClientQt* inspectorClientForPage(int pageNum);
@@ -70,7 +70,7 @@ class InspectorServerRequestHandlerQt : public QObject {
Q_OBJECT
public:
- InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server);
+ InspectorServerRequestHandlerQt(QTcpSocket* tcpConnection, InspectorServerQt*);
virtual ~InspectorServerRequestHandlerQt();
virtual int webSocketSend(const QString& message);
virtual int webSocketSend(const char *payload, size_t length);
diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
index 56ed0b4cb..06840c455 100644
--- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp
@@ -33,18 +33,16 @@
#include "NotificationPresenterClientQt.h"
#include "Document.h"
-#include "DumpRenderTreeSupportQt.h"
#include "EventNames.h"
#include "KURL.h"
#include "Page.h"
+#include "QWebFrameAdapter.h"
+#include "QWebPageAdapter.h"
#include "QtPlatformPlugin.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
#include "UserGestureIndicator.h"
-
-#include "qwebframe_p.h"
#include "qwebkitglobal.h"
-#include "qwebpage.h"
namespace WebCore {
@@ -72,10 +70,6 @@ NotificationWrapper::NotificationWrapper()
, m_displayEventTimer(this, &NotificationWrapper::sendDisplayEvent)
{
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
-
-#ifndef QT_NO_SYSTEMTRAYICON
- m_notificationIcon = nullptr;
-#endif
m_presenter = nullptr;
#endif
}
@@ -209,7 +203,6 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
#ifndef QT_NO_SYSTEMTRAYICON
if (!dumpNotification)
wrapper->m_closeTimer.startOneShot(notificationTimeout);
- wrapper->m_notificationIcon = adoptPtr(new QSystemTrayIcon());
#endif
}
@@ -227,9 +220,9 @@ void NotificationPresenterClientQt::displayNotification(Notification* notificati
}
#ifndef QT_NO_SYSTEMTRAYICON
- wrapper->connect(wrapper->m_notificationIcon.get(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked()));
- wrapper->m_notificationIcon->show();
- wrapper->m_notificationIcon->showMessage(notification->title(), notification->body());
+ wrapper->connect(m_systemTrayIcon.data(), SIGNAL(messageClicked()), wrapper, SLOT(notificationClicked()));
+ QMetaObject::invokeMethod(m_systemTrayIcon.data(), "show");
+ QMetaObject::invokeMethod(m_systemTrayIcon.data(), "showMessage", Q_ARG(QString, notification->title()), Q_ARG(QString, notification->body()));
#endif
}
@@ -324,11 +317,10 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co
CallbacksInfo info;
info.m_frame = toFrame(context);
info.m_callbacks.append(cb);
- m_pendingPermissionRequests.insert(context, info);
if (toPage(context) && toFrame(context)) {
m_pendingPermissionRequests.insert(context, info);
- emit toPage(context)->featurePermissionRequested(toFrame(context), QWebPage::Notifications);
+ toPage(context)->notificationsPermissionRequested(toFrame(context));
}
}
}
@@ -346,10 +338,10 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC
if (iter == m_pendingPermissionRequests.end())
return;
- QWebFrame* frame = iter.value().m_frame;
+ QWebFrameAdapter* frame = iter.value().m_frame;
if (!frame)
return;
- QWebPage* page = frame->page();
+ QWebPageAdapter* page = QWebPageAdapter::kit(frame->frame->page());
m_pendingPermissionRequests.erase(iter);
if (!page)
@@ -358,7 +350,7 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC
if (dumpNotification)
printf("DESKTOP NOTIFICATION PERMISSION REQUEST CANCELLED: %s\n", QString(context->securityOrigin()->toString()).toUtf8().constData());
- emit page->featurePermissionRequestCanceled(frame, QWebPage::Notifications);
+ page->notificationsPermissionRequestCancelled(frame);
}
void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame)
@@ -436,13 +428,13 @@ void NotificationPresenterClientQt::dumpShowText(Notification* notification)
printf("DESKTOP NOTIFICATION: contents at %s\n", QString(notification->url().string()).toUtf8().constData());
else {
printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
- notification->dir() == "rtl" ? "(RTL)" : "",
+ notification->dir() == "rtl" ? "(RTL)" : "",
QString(notification->iconURL().string()).toUtf8().constData(), QString(notification->title()).toUtf8().constData(),
QString(notification->body()).toUtf8().constData());
}
}
-QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
+QWebPageAdapter* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
{
if (!context || context->isWorkerContext())
return 0;
@@ -453,10 +445,10 @@ QWebPage* NotificationPresenterClientQt::toPage(ScriptExecutionContext* context)
if (!page || !page->mainFrame())
return 0;
- return QWebFramePrivate::kit(page->mainFrame())->page();
+ return QWebPageAdapter::kit(page);
}
-QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context)
+QWebFrameAdapter* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* context)
{
if (!context || context->isWorkerContext())
return 0;
@@ -465,7 +457,7 @@ QWebFrame* NotificationPresenterClientQt::toFrame(ScriptExecutionContext* contex
if (!document || !document->frame())
return 0;
- return QWebFramePrivate::kit(document->frame());
+ return QWebFrameAdapter::kit(document->frame());
}
#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
index 5819b4d80..78668f35f 100644
--- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h
@@ -36,14 +36,13 @@
#include "NotificationClient.h"
#include "QtPlatformPlugin.h"
#include "Timer.h"
-
#include "qwebkitplatformplugin.h"
#include <QMultiHash>
-#include <QSystemTrayIcon>
+#include <QScopedPointer>
-class QWebFrame;
-class QWebPage;
+class QWebFrameAdapter;
+class QWebPageAdapter;
namespace WebCore {
@@ -55,7 +54,7 @@ class NotificationWrapper : public QObject, public QWebNotificationData {
Q_OBJECT
public:
NotificationWrapper();
- ~NotificationWrapper() {}
+ ~NotificationWrapper() { }
void close();
void close(Timer<NotificationWrapper>*);
@@ -69,14 +68,12 @@ public Q_SLOTS:
void notificationClosed();
void notificationClicked();
-public:
-#ifndef QT_NO_SYSTEMTRAYICON
- OwnPtr<QSystemTrayIcon> m_notificationIcon;
-#endif
-
+private:
OwnPtr<QWebNotificationPresenter> m_presenter;
Timer<NotificationWrapper> m_closeTimer;
Timer<NotificationWrapper> m_displayEventTimer;
+
+ friend class NotificationPresenterClientQt;
};
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
@@ -109,6 +106,10 @@ public:
static bool dumpNotification;
void addClient() { m_clientCount++; }
+#ifndef QT_NO_SYSTEMTRAYICON
+ bool hasSystemTrayIcon() const { return !m_systemTrayIcon.isNull(); }
+ void setSystemTrayIcon(QObject* icon) { m_systemTrayIcon.reset(icon); }
+#endif
void removeClient();
static NotificationPresenterClientQt* notificationPresenter();
@@ -124,12 +125,12 @@ private:
void detachNotification(Notification*);
void dumpReplacedIdText(Notification*);
void dumpShowText(Notification*);
- QWebPage* toPage(ScriptExecutionContext*);
- QWebFrame* toFrame(ScriptExecutionContext*);
+ QWebPageAdapter* toPage(ScriptExecutionContext*);
+ QWebFrameAdapter* toFrame(ScriptExecutionContext*);
int m_clientCount;
struct CallbacksInfo {
- QWebFrame* m_frame;
+ QWebFrameAdapter* m_frame;
QList<RefPtr<VoidCallback> > m_callbacks;
};
QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests;
@@ -137,10 +138,13 @@ private:
NotificationsQueue m_notifications;
QtPlatformPlugin m_platformPlugin;
+#ifndef QT_NO_SYSTEMTRAYICON
+ QScopedPointer<QObject> m_systemTrayIcon;
+#endif
};
-#endif
+#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
}
-#endif
+#endif // NotificationPresenterClientQt_h
diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 141f98e30..92ab84b64 100644
--- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -35,8 +35,7 @@
#if USE(3D_GRAPHICS)
#include <QWindow>
-static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context,
- PlatformGraphicsSurface3D* surface, QObject** surfaceOwner)
+static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner)
{
#ifdef QT_OPENGL_LIB
*context = 0;
@@ -73,7 +72,7 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG
QWindow* QWebPageClient::ownerWindow() const
{
- QWidget* widget = ownerWidget();
+ QWidget* widget = qobject_cast<QWidget*>(ownerWidget());
if (!widget)
return 0;
if (QWindow *window = widget->windowHandle())
@@ -204,7 +203,7 @@ int PageClientQWidget::screenNumber() const
return 0;
}
-QWidget* PageClientQWidget::ownerWidget() const
+QObject* PageClientQWidget::ownerWidget() const
{
return view;
}
@@ -238,9 +237,7 @@ void PageClientQWidget::setWidgetVisible(Widget* widget, bool visible)
}
#if USE(3D_GRAPHICS)
-void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
- PlatformGraphicsSurface3D* surface,
- QObject** surfaceOwner)
+void PageClientQWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner)
{
createPlatformGraphicsContext3DFromWidget(view, context, surface, surfaceOwner);
}
@@ -363,7 +360,7 @@ int PageClientQGraphicsWidget::screenNumber() const
return 0;
}
-QWidget* PageClientQGraphicsWidget::ownerWidget() const
+QObject* PageClientQGraphicsWidget::ownerWidget() const
{
if (QGraphicsScene* scene = view->scene()) {
const QList<QGraphicsView*> views = scene->views();
@@ -428,11 +425,9 @@ QRectF PageClientQGraphicsWidget::windowRect() const
#endif // QT_NO_GRAPHICSVIEW
#if USE(3D_GRAPHICS)
-void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context,
- PlatformGraphicsSurface3D* surface,
- QObject** surfaceOwner)
+void PageClientQGraphicsWidget::createPlatformGraphicsContext3D(PlatformGraphicsContext3D* context, PlatformGraphicsSurface3D* surface, QObject** surfaceOwner)
{
- createPlatformGraphicsContext3DFromWidget(ownerWidget(), context, surface, surfaceOwner);
+ createPlatformGraphicsContext3DFromWidget(qobject_cast<QWidget*>(ownerWidget()), context, surface, surfaceOwner);
}
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h
index e6b9e1694..72dca42c1 100644
--- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.h
@@ -31,15 +31,14 @@
#include "qwebframe_p.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
+#include <Settings.h>
#include <qgraphicsscene.h>
#include <qgraphicsview.h>
#include <qgraphicswidget.h>
+#include <qmetaobject.h>
#include <qscrollbar.h>
#include <qstyleoption.h>
#include <qwidget.h>
-#include <QtCore/qmetaobject.h>
-
-#include <Settings.h>
namespace WebCore {
@@ -75,18 +74,18 @@ public:
virtual void scroll(int dx, int dy, const QRect&);
virtual void update(const QRect& dirtyRect);
- virtual void setInputMethodEnabled(bool enable);
+ virtual void setInputMethodEnabled(bool);
virtual bool inputMethodEnabled() const;
- virtual void setInputMethodHints(Qt::InputMethodHints hints);
+ virtual void setInputMethodHints(Qt::InputMethodHints);
#ifndef QT_NO_CURSOR
virtual QCursor cursor() const;
- virtual void updateCursor(const QCursor& cursor);
+ virtual void updateCursor(const QCursor&);
#endif
virtual QPalette palette() const;
virtual int screenNumber() const;
- virtual QWidget* ownerWidget() const;
+ virtual QObject* ownerWidget() const;
virtual QRect geometryRelativeToOwnerWidget() const;
virtual QObject* pluginParent() const;
@@ -100,9 +99,7 @@ public:
virtual void setWidgetVisible(Widget*, bool visible);
#if USE(3D_GRAPHICS)
- virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
- PlatformGraphicsSurface3D*,
- QObject**);
+ virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**);
#endif
QWidget* view;
@@ -132,9 +129,9 @@ public:
class QGraphicsItemOverlay : public QGraphicsObject {
public:
QGraphicsItemOverlay(QGraphicsWidget* view, QWebPage* p)
- :QGraphicsObject(view)
- , q(view)
- , page(p)
+ : QGraphicsObject(view)
+ , q(view)
+ , page(p)
{
setPos(0, 0);
setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
@@ -172,7 +169,7 @@ public:
#endif
, overlay(0)
{
- Q_ASSERT(view);
+ Q_ASSERT(view);
#if USE(ACCELERATED_COMPOSITING)
// the overlay and stays alive for the lifetime of
// this QGraphicsWebView as the scrollbars are needed when there's no compositing
@@ -186,18 +183,18 @@ public:
virtual void scroll(int dx, int dy, const QRect&);
virtual void update(const QRect& dirtyRect);
- virtual void setInputMethodEnabled(bool enable);
+ virtual void setInputMethodEnabled(bool);
virtual bool inputMethodEnabled() const;
- virtual void setInputMethodHints(Qt::InputMethodHints hints);
+ virtual void setInputMethodHints(Qt::InputMethodHints);
#ifndef QT_NO_CURSOR
virtual QCursor cursor() const;
- virtual void updateCursor(const QCursor& cursor);
+ virtual void updateCursor(const QCursor&);
#endif
virtual QPalette palette() const;
virtual int screenNumber() const;
- virtual QWidget* ownerWidget() const;
+ virtual QObject* ownerWidget() const;
virtual QRect geometryRelativeToOwnerWidget() const;
virtual QObject* pluginParent() const;
@@ -209,9 +206,7 @@ public:
virtual void setWidgetVisible(Widget*, bool);
#if USE(3D_GRAPHICS)
- virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*,
- PlatformGraphicsSurface3D*,
- QObject**);
+ virtual void createPlatformGraphicsContext3D(PlatformGraphicsContext3D*, PlatformGraphicsSurface3D*, QObject**);
#endif
#if USE(TILED_BACKING_STORE)
diff --git a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
index c31d9b007..5d9e755d0 100644
--- a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
@@ -32,16 +32,17 @@
#include "Chrome.h"
#include "ChromeClientQt.h"
+#include "QWebPageAdapter.h"
+#include "qwebhistoryinterface.h"
+#include "qwebpluginfactory.h"
+
#include <IntSize.h>
-#include "NotImplemented.h"
+#include <NotImplemented.h>
#include <Page.h>
#include <PageGroup.h>
#include <PluginDatabase.h>
#include <QCoreApplication>
#include <QLocale>
-#include <qwebhistoryinterface.h>
-#include <qwebpage.h>
-#include <qwebpluginfactory.h>
#include <wtf/MathExtras.h>
using namespace WebCore;
@@ -99,9 +100,9 @@ void PlatformStrategiesQt::refreshPlugins()
void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCore::PluginInfo>& outPlugins)
{
- QWebPage* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage;
+ QWebPageAdapter* qPage = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage;
QWebPluginFactory* factory;
- if (qPage && (factory = qPage->pluginFactory())) {
+ if (qPage && (factory = qPage->pluginFactory)) {
QList<QWebPluginFactory::Plugin> qplugins = factory->plugins();
for (int i = 0; i < qplugins.count(); ++i) {
@@ -117,7 +118,7 @@ void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCo
mimeInfo.type = mimeType.name;
mimeInfo.desc = mimeType.description;
for (int k = 0; k < mimeType.fileExtensions.count(); ++k)
- mimeInfo.extensions.append(mimeType.fileExtensions.at(k));
+ mimeInfo.extensions.append(mimeType.fileExtensions.at(k));
info.mimes.append(mimeInfo);
}
@@ -130,7 +131,7 @@ void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCo
outPlugins.resize(plugins.size());
- for (unsigned int i = 0; i < plugins.size(); ++i) {
+ for (int i = 0; i < plugins.size(); ++i) {
PluginInfo info;
PluginPackage* package = plugins[i];
diff --git a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
index 29e4624eb..72d083f34 100644
--- a/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp
@@ -29,12 +29,11 @@
#include "ChromeClientQt.h"
#include "FrameView.h"
#include "PopupMenuClient.h"
-
#include "qwebkitplatformplugin.h"
class SelectData : public QWebSelectData {
public:
- SelectData(WebCore::PopupMenuClient*& data) : d(data) {}
+ SelectData(WebCore::PopupMenuClient*& data) : d(data) { }
virtual ItemType itemType(int) const;
virtual QString itemText(int idx) const { return QString(d ? d->itemText(idx) : ""); }
diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp
new file mode 100644
index 000000000..5137933a0
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "QGraphicsWidgetPluginImpl.h"
+
+#include <QGraphicsScene>
+#include <QGraphicsWidget>
+
+#ifndef QT_NO_GRAPHICSVIEW
+
+QGraphicsWidgetPluginImpl::~QGraphicsWidgetPluginImpl()
+{
+ m_graphicsWidget->deleteLater();
+}
+
+void QGraphicsWidgetPluginImpl::update(const QRect &rect)
+{
+ QGraphicsScene* scene = m_graphicsWidget->scene();
+ if (scene)
+ scene->update(rect);
+}
+
+void QGraphicsWidgetPluginImpl::setGeometryAndClip(const QRect &geometry, const QRect &, bool)
+{
+ m_graphicsWidget->setGeometry(geometry);
+ // FIXME: Make the code handle clipping of graphics widgets.
+}
+
+void QGraphicsWidgetPluginImpl::setVisible(bool visible)
+{
+ m_graphicsWidget->setVisible(visible);
+}
+
+void QGraphicsWidgetPluginImpl::setWidgetParent(QObject* parent)
+{
+ QGraphicsObject* parentItem = qobject_cast<QGraphicsObject*>(parent);
+ if (parentItem)
+ m_graphicsWidget->setParentItem(parentItem);
+}
+
+QObject* QGraphicsWidgetPluginImpl::handle() const
+{
+ return m_graphicsWidget;
+}
+
+#include "moc_QGraphicsWidgetPluginImpl.cpp"
+
+#endif // !defined(QT_NO_GRAPHICSVIEW)
diff --git a/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h
new file mode 100644
index 000000000..7f758226c
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QGraphicsWidgetPluginImpl.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QGraphicsWidgetPluginImpl_h
+#define QGraphicsWidgetPluginImpl_h
+
+#ifndef QT_NO_GRAPHICSVIEW
+
+#include "QtPluginWidgetAdapter.h"
+
+QT_BEGIN_NAMESPACE
+class QGraphicsWidget;
+QT_END_NAMESPACE
+
+class QGraphicsWidgetPluginImpl : public QtPluginWidgetAdapter {
+ Q_OBJECT
+public:
+ QGraphicsWidgetPluginImpl(QGraphicsWidget *w) : m_graphicsWidget(w) { }
+ virtual ~QGraphicsWidgetPluginImpl();
+ virtual void update(const QRect &) OVERRIDE;
+ virtual void setGeometryAndClip(const QRect&, const QRect&, bool) OVERRIDE;
+ virtual void setVisible(bool);
+ virtual void setStyleSheet(const QString&) OVERRIDE { }
+ virtual void setWidgetParent(QObject*) OVERRIDE;
+ virtual QObject* handle() const OVERRIDE;
+private:
+ QGraphicsWidget *m_graphicsWidget;
+};
+#endif // !defined(QT_NO_GRAPHICSVIEW)
+
+#endif // QGraphicsWidgetPluginImpl_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp
new file mode 100644
index 000000000..e86413cf0
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.cpp
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "QWebFrameAdapter.h"
+
+#include "Frame.h"
+#include "FrameLoaderClientQt.h"
+#include "QWebPageAdapter.h"
+#if ENABLE(GESTURE_EVENTS)
+#include "PlatformGestureEvent.h"
+#include "WebEventConversion.h"
+#endif
+
+#include <QFileInfo>
+#include <QNetworkRequest>
+
+using namespace WebCore;
+
+static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl)
+{
+ switch (cacheLoadControl) {
+ case QNetworkRequest::AlwaysNetwork:
+ return WebCore::ReloadIgnoringCacheData;
+ case QNetworkRequest::PreferCache:
+ return WebCore::ReturnCacheDataElseLoad;
+ case QNetworkRequest::AlwaysCache:
+ return WebCore::ReturnCacheDataDontLoad;
+ default:
+ break;
+ }
+ return WebCore::UseProtocolCachePolicy;
+}
+
+QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame, WebCore::HTMLFrameOwnerElement* ownerFrameElement, const WTF::String& frameName)
+ : name(frameName)
+ , ownerElement(ownerFrameElement)
+ , page(parentPage)
+ , allowsScrolling(true)
+ , marginWidth(0)
+ , marginHeight(0)
+{
+ frameLoaderClient = new FrameLoaderClientQt();
+ frame = Frame::create(page, ownerElement, frameLoaderClient);
+
+ // FIXME: All of the below should probably be moved over into WebCore
+ frame->tree()->setName(name);
+ if (parentFrame)
+ parentFrame->tree()->appendChild(frame);
+}
+
+QWebFrameAdapter::QWebFrameAdapter()
+ : pageAdapter(0)
+ , allowsScrolling(true)
+ , marginWidth(-1)
+ , marginHeight(-1)
+ , frame(0)
+ , frameLoaderClient(0)
+{
+}
+
+QWebFrameAdapter::~QWebFrameAdapter()
+{
+ if (frameLoaderClient)
+ frameLoaderClient->m_webFrame = 0;
+}
+
+void QWebFrameAdapter::load(const QNetworkRequest& req, QNetworkAccessManager::Operation operation, const QByteArray& body)
+{
+ if (frame->tree()->parent())
+ pageAdapter->insideOpenCall = true;
+
+ QUrl url = ensureAbsoluteUrl(req.url());
+
+ WebCore::ResourceRequest request(url);
+
+ switch (operation) {
+ case QNetworkAccessManager::HeadOperation:
+ request.setHTTPMethod("HEAD");
+ break;
+ case QNetworkAccessManager::GetOperation:
+ request.setHTTPMethod("GET");
+ break;
+ case QNetworkAccessManager::PutOperation:
+ request.setHTTPMethod("PUT");
+ break;
+ case QNetworkAccessManager::PostOperation:
+ request.setHTTPMethod("POST");
+ break;
+ case QNetworkAccessManager::DeleteOperation:
+ request.setHTTPMethod("DELETE");
+ break;
+ case QNetworkAccessManager::CustomOperation:
+ request.setHTTPMethod(req.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray().constData());
+ break;
+ case QNetworkAccessManager::UnknownOperation:
+ // eh?
+ break;
+ }
+
+ QVariant cacheLoad = req.attribute(QNetworkRequest::CacheLoadControlAttribute);
+ if (cacheLoad.isValid()) {
+ bool ok;
+ uint cacheLoadValue = cacheLoad.toUInt(&ok);
+ if (ok)
+ request.setCachePolicy(cacheLoadControlToCachePolicy(cacheLoadValue));
+ }
+
+ QList<QByteArray> httpHeaders = req.rawHeaderList();
+ for (int i = 0; i < httpHeaders.size(); ++i) {
+ const QByteArray &headerName = httpHeaders.at(i);
+ request.addHTTPHeaderField(QString::fromLatin1(headerName), QString::fromLatin1(req.rawHeader(headerName)));
+ }
+
+ if (!body.isEmpty())
+ request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size()));
+
+ frame->loader()->load(request, false);
+
+ if (frame->tree()->parent())
+ pageAdapter->insideOpenCall = false;
+}
+
+#if ENABLE(GESTURE_EVENTS)
+void QWebFrameAdapter::handleGestureEvent(QGestureEventFacade* gestureEvent)
+{
+ ASSERT(hasView());
+ switch (gestureEvent->type) {
+ case Qt::TapGesture:
+ frame->eventHandler()->handleGestureEvent(convertGesture(gestureEvent));
+ break;
+ case Qt::TapAndHoldGesture:
+ frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(gestureEvent));
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+#endif
+
+WebCore::IntSize QWebFrameAdapter::scrollPosition() const
+{
+ if (!hasView())
+ return IntSize();
+ return frame->view()->scrollOffset();
+}
+
+IntRect QWebFrameAdapter::frameRect() const
+{
+ if (!hasView())
+ return IntRect();
+ return frame->view()->frameRect();
+}
+
+void QWebFrameAdapter::init(QWebPageAdapter* pageAdapter)
+{
+ QWebFrameData frameData(pageAdapter->page);
+ init(pageAdapter, &frameData);
+}
+
+void QWebFrameAdapter::init(QWebPageAdapter* pageAdapter, QWebFrameData* frameData)
+{
+ this->pageAdapter = pageAdapter;
+ allowsScrolling = frameData->allowsScrolling;
+ marginWidth = frameData->marginWidth;
+ marginHeight = frameData->marginHeight;
+ frame = frameData->frame.get();
+ frameLoaderClient = frameData->frameLoaderClient;
+ frameLoaderClient->setFrame(this, frame);
+
+ frame->init();
+}
+
+QWebFrameAdapter* QWebFrameAdapter::kit(const Frame* frame)
+{
+ return static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
+}
+
+QUrl QWebFrameAdapter::ensureAbsoluteUrl(const QUrl& url)
+{
+ if (!url.isValid() || !url.isRelative())
+ return url;
+
+ // This contains the URL with absolute path but without
+ // the query and the fragment part.
+ QUrl baseUrl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath());
+
+ // The path is removed so the query and the fragment parts are there.
+ QString pathRemoved = url.toString(QUrl::RemovePath);
+ QUrl toResolve(pathRemoved);
+
+ return baseUrl.resolved(toResolve);
+}
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h
new file mode 100644
index 000000000..17c41d539
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebFrameAdapter.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QWebFrameAdapter_h
+#define QWebFrameAdapter_h
+
+#include "FrameLoaderClientQt.h"
+#include "PlatformEvent.h"
+
+#include <FrameView.h>
+#include <IntRect.h>
+#include <IntSize.h>
+#include <KURL.h>
+
+#include <QNetworkAccessManager>
+#include <QSize>
+
+namespace WebCore {
+class Frame;
+}
+
+QT_BEGIN_NAMESPACE
+class QPoint;
+QT_END_NAMESPACE
+
+#if ENABLE(GESTURE_EVENTS)
+class QGestureEventFacade;
+#endif
+class QWebFrame;
+class QWebPageAdapter;
+
+class QWebFrameData {
+public:
+ QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0, WebCore::HTMLFrameOwnerElement* = 0, const WTF::String& frameName = WTF::String());
+
+ WTF::String name;
+ WebCore::HTMLFrameOwnerElement* ownerElement;
+ WebCore::Page* page;
+ RefPtr<WebCore::Frame> frame;
+ WebCore::FrameLoaderClientQt* frameLoaderClient;
+
+ WTF::String referrer;
+ bool allowsScrolling;
+ int marginWidth;
+ int marginHeight;
+};
+
+class QWebFrameAdapter {
+public:
+ static QUrl ensureAbsoluteUrl(const QUrl&);
+
+ QWebFrameAdapter();
+ virtual ~QWebFrameAdapter();
+
+ virtual QWebFrame* apiHandle() = 0;
+ virtual QObject* handle() = 0;
+ virtual void contentsSizeDidChange(const QSize&) = 0;
+ virtual int scrollBarPolicy(Qt::Orientation) const = 0;
+ virtual void emitUrlChanged() = 0;
+ virtual void didStartProvisionalLoad() = 0;
+ virtual void didClearWindowObject() = 0;
+ virtual bool handleProgressFinished(QPoint*) = 0;
+ virtual void emitInitialLayoutCompleted() = 0;
+ virtual void emitIconChanged() = 0;
+ virtual void emitLoadStarted(bool originatingLoad) = 0;
+ virtual void emitLoadFinished(bool originatingLoad, bool ok) = 0;
+ virtual QWebFrameAdapter* createChildFrame(QWebFrameData*) = 0;
+
+ void load(const QNetworkRequest&, QNetworkAccessManager::Operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
+ inline bool hasView() const { return frame && frame->view(); }
+#if ENABLE(GESTURE_EVENTS)
+ void handleGestureEvent(QGestureEventFacade*);
+#endif
+ QWebFrameAdapter* createFrame(QWebFrameData*);
+
+ WebCore::IntSize scrollPosition() const;
+ WebCore::IntRect frameRect() const;
+ QWebPageAdapter* pageAdapter;
+
+// protected:
+ bool allowsScrolling;
+ int marginWidth;
+ int marginHeight;
+
+// private:
+ void init(QWebPageAdapter*);
+ void init(QWebPageAdapter*, QWebFrameData*);
+
+ WebCore::Frame *frame;
+ WebCore::FrameLoaderClientQt *frameLoaderClient;
+ WebCore::KURL url;
+
+ static QWebFrameAdapter* kit(const WebCore::Frame*);
+
+// friend class ChromeClientQt;
+};
+
+#endif // QWebFrameAdapter_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
new file mode 100644
index 000000000..3d639d99a
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "QWebPageAdapter.h"
+
+#include "Chrome.h"
+#include "ChromeClientQt.h"
+#include "NotificationPresenterClientQt.h"
+#include "QWebFrameAdapter.h"
+#include "UndoStepQt.h"
+#include "qwebpluginfactory.h"
+#include "qwebsettings.h"
+#include <Page.h>
+#include <QNetworkAccessManager>
+
+using namespace WebCore;
+
+bool QWebPageAdapter::drtRun = false;
+
+QWebPageAdapter::QWebPageAdapter()
+ : settings(0)
+ , page(0)
+ , pluginFactory(0)
+ , forwardUnsupportedContent(false)
+ , insideOpenCall(false)
+ , networkManager(0)
+{
+}
+
+QWebPageAdapter::~QWebPageAdapter()
+{
+ delete page;
+ delete settings;
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ NotificationPresenterClientQt::notificationPresenter()->removeClient();
+#endif
+}
+
+void QWebPageAdapter::init(Page* page)
+{
+ this->page = page;
+ settings = new QWebSettings(page->settings());
+
+#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
+ WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter());
+#endif
+}
+
+void QWebPageAdapter::deletePage()
+{
+ delete page;
+ page = 0;
+}
+
+QWebPageAdapter* QWebPageAdapter::kit(Page* page)
+{
+ return static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage;
+}
+
+ViewportArguments QWebPageAdapter::viewportArguments()
+{
+ return page ? page->viewportArguments() : WebCore::ViewportArguments();
+}
+
+
+void QWebPageAdapter::registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep> step)
+{
+ createUndoStep(QSharedPointer<UndoStepQt>(new UndoStepQt(step)));
+}
+
+void QWebPageAdapter::setNetworkAccessManager(QNetworkAccessManager *manager)
+{
+ if (manager == networkManager)
+ return;
+ if (networkManager && networkManager->parent() == handle())
+ delete networkManager;
+ networkManager = manager;
+}
+
+QNetworkAccessManager* QWebPageAdapter::networkAccessManager()
+{
+ if (!networkManager)
+ networkManager = new QNetworkAccessManager(handle());
+ return networkManager;
+}
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
new file mode 100644
index 000000000..48298922e
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QWebPageAdapter_h
+#define QWebPageAdapter_h
+
+#include "QWebPageClient.h"
+#include "ViewportArguments.h"
+
+#include <qnetworkrequest.h>
+#include <qrect.h>
+#include <qscopedpointer.h>
+#include <qsharedpointer.h>
+#include <qstring.h>
+#include <qurl.h>
+
+QT_BEGIN_NAMESPACE
+class QKeyEvent;
+class QNetworkAccessManager;
+QT_END_NAMESPACE
+
+namespace WebCore {
+class Page;
+class ChromeClientQt;
+class GeolocationClientQt;
+class UndoStep;
+}
+
+class QtPluginWidgetAdapter;
+class QWebFrameAdapter;
+class QWebHistoryItem;
+class QWebPageClient;
+class QWebPluginFactory;
+class QWebSecurityOrigin;
+class QWebSelectMethod;
+class QWebSettings;
+class QWebFullScreenVideoHandler;
+class UndoStepQt;
+
+
+class QWebPageAdapter {
+public:
+ QWebPageAdapter();
+ virtual ~QWebPageAdapter();
+
+ void init(WebCore::Page*);
+ // Called manually from ~QWebPage destructor to ensure that
+ // the QWebPageAdapter and the QWebPagePrivate are intact when
+ // various destruction callbacks from WebCore::Page::~Page() hit us.
+ void deletePage();
+
+ virtual void show() = 0;
+ virtual void setFocus() = 0;
+ virtual void unfocus() = 0;
+ virtual void setWindowRect(const QRect&) = 0;
+ virtual QSize viewportSize() const = 0;
+ virtual QWebPageAdapter* createWindow(bool /*dialog*/) = 0;
+ virtual QObject* handle() = 0;
+ virtual void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) = 0;
+ virtual void javaScriptAlert(QWebFrameAdapter*, const QString& msg) = 0;
+ virtual bool javaScriptConfirm(QWebFrameAdapter*, const QString& msg) = 0;
+ virtual bool javaScriptPrompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) = 0;
+ virtual bool shouldInterruptJavaScript() = 0;
+ virtual void printRequested(QWebFrameAdapter*) = 0;
+ virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) = 0;
+ virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) = 0;
+ virtual void setToolTip(const QString&) = 0;
+ virtual QStringList chooseFiles(QWebFrameAdapter*, bool allowMultiple, const QStringList& suggestedFileNames) = 0;
+ virtual QColor colorSelectionRequested(const QColor& selectedColor) = 0;
+ virtual QWebSelectMethod* createSelectPopup() = 0;
+ virtual QRect viewRectRelativeToWindow() = 0;
+
+#if USE(QT_MULTIMEDIA)
+ virtual QWebFullScreenVideoHandler* createFullScreenVideoHandler() = 0;
+#endif
+ virtual void geolocationPermissionRequested(QWebFrameAdapter*) = 0;
+ virtual void geolocationPermissionRequestCancelled(QWebFrameAdapter*) = 0;
+ virtual void notificationsPermissionRequested(QWebFrameAdapter*) = 0;
+ virtual void notificationsPermissionRequestCancelled(QWebFrameAdapter*) = 0;
+
+ virtual void respondToChangedContents() = 0;
+ virtual void respondToChangedSelection() = 0;
+ virtual void microFocusChanged() = 0;
+ virtual void triggerCopyAction() = 0;
+ virtual void triggerActionForKeyEvent(QKeyEvent*) = 0;
+ virtual void clearUndoStack() = 0;
+ virtual bool canUndo() const = 0;
+ virtual bool canRedo() const = 0;
+ virtual void undo() = 0;
+ virtual void redo() = 0;
+ virtual const char* editorCommandForKeyEvent(QKeyEvent*) = 0;
+ virtual void createUndoStep(QSharedPointer<UndoStepQt>) = 0;
+
+ virtual void updateNavigationActions() = 0;
+
+ virtual QWebFrameAdapter* mainFrameAdapter() = 0;
+
+ virtual QObject* inspectorHandle() = 0;
+ virtual void setInspectorFrontend(QObject*) = 0;
+ virtual void setInspectorWindowTitle(const QString&) = 0;
+ virtual void createWebInspector(QObject** inspectorView, QWebPageAdapter** inspectorPage) = 0;
+ virtual QStringList menuActionsAsText() = 0;
+ virtual void emitViewportChangeRequested() = 0;
+ virtual bool acceptNavigationRequest(QWebFrameAdapter*, const QNetworkRequest&, int type) = 0;
+ virtual void emitRestoreFrameStateRequested(QWebFrameAdapter *) = 0;
+ virtual void emitSaveFrameStateRequested(QWebFrameAdapter *, QWebHistoryItem*) = 0;
+ virtual void emitDownloadRequested(const QNetworkRequest&) = 0;
+ virtual void emitFrameCreated(QWebFrameAdapter*) = 0;
+ virtual QString userAgentForUrl(const QUrl&) const = 0;
+ virtual bool supportsErrorPageExtension() const = 0;
+ struct ErrorPageOption {
+ QUrl url;
+ QWebFrameAdapter* frame;
+ QString domain;
+ int error;
+ QString errorString;
+ };
+ struct ErrorPageReturn {
+ QString contentType;
+ QString encoding;
+ QUrl baseUrl;
+ QByteArray content;
+ };
+ virtual bool errorPageExtension(ErrorPageOption*, ErrorPageReturn*) = 0;
+ virtual QtPluginWidgetAdapter* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) = 0;
+ virtual QtPluginWidgetAdapter* adapterForWidget(QObject*) const = 0;
+
+
+ static QWebPageAdapter* kit(WebCore::Page*);
+ WebCore::ViewportArguments viewportArguments();
+ void registerUndoStep(WTF::PassRefPtr<WebCore::UndoStep>);
+
+ void setNetworkAccessManager(QNetworkAccessManager*);
+ QNetworkAccessManager* networkAccessManager();
+
+ QWebSettings *settings;
+
+ WebCore::Page *page;
+ QScopedPointer<QWebPageClient> client;
+
+ QWebPluginFactory *pluginFactory;
+
+ bool forwardUnsupportedContent;
+ bool insideOpenCall;
+
+private:
+ QNetworkAccessManager *networkManager;
+
+public:
+ static bool drtRun;
+
+ friend class WebCore::ChromeClientQt;
+ friend class WebCore::GeolocationClientQt;
+};
+
+#endif // QWebPageAdapter_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp
new file mode 100644
index 000000000..a196df50d
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "QWebUndoCommand.h"
+
+#include "UndoStepQt.h"
+
+#ifndef QT_NO_UNDOCOMMAND
+QWebUndoCommand::QWebUndoCommand(QSharedPointer<UndoStepQt> undoStep, QUndoCommand* parent)
+ : QUndoCommand(parent)
+ , m_step(undoStep)
+{
+ Q_ASSERT(undoStep);
+ setText(m_step->text());
+}
+
+void QWebUndoCommand::undo()
+{
+ m_step->undo();
+}
+
+void QWebUndoCommand::redo()
+{
+ m_step->redo();
+}
+
+#endif // QT_NO_UNDOCOMMAND
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h
new file mode 100644
index 000000000..6e6121adc
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWebUndoCommand.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QWebUndoCommand_h
+#define QWebUndoCommand_h
+
+#include <qsharedpointer.h>
+#include <qundostack.h>
+
+class UndoStepQt;
+
+#ifndef QT_NO_UNDOCOMMAND
+
+class QWebUndoCommand : public QUndoCommand {
+public:
+ QWebUndoCommand(QSharedPointer<UndoStepQt>, QUndoCommand *parent = 0);
+
+ void undo();
+ void redo();
+
+private:
+ QSharedPointer<UndoStepQt> m_step;
+};
+
+#endif // QT_NO_UNDOCOMMAND
+
+#endif // QWebUndoCommand_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp
new file mode 100644
index 000000000..2beabf1d0
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 "QWidgetPluginImpl.h"
+
+#include <QWidget>
+
+QWidgetPluginImpl::~QWidgetPluginImpl()
+{
+ m_widget->deleteLater();
+}
+
+void QWidgetPluginImpl::update(const QRect &rect)
+{
+ m_widget->update(rect);
+}
+
+void QWidgetPluginImpl::setGeometryAndClip(const QRect &geometry, const QRect &clipRect, bool isVisible)
+{
+ m_widget->setGeometry(geometry);
+ if (!clipRect.isNull()) {
+ QRect clip(clipRect.intersected(m_widget->rect()));
+ m_widget->setMask(QRegion(clip));
+ }
+ m_widget->update();
+ setVisible(isVisible);
+}
+
+void QWidgetPluginImpl::setVisible(bool visible)
+{
+ // If setMask is set with an empty QRegion, no clipping will
+ // be performed, so in that case we hide the platformWidget.
+ QRegion mask = m_widget->mask();
+ m_widget->setVisible(visible && !mask.isEmpty());
+}
+
+void QWidgetPluginImpl::setStyleSheet(const QString &stylesheet)
+{
+ m_widget->setStyleSheet(stylesheet);
+}
+
+void QWidgetPluginImpl::setWidgetParent(QObject *parent)
+{
+ if (!parent->isWidgetType())
+ return;
+ m_widget->setParent(qobject_cast<QWidget*>(parent));
+}
+
+QObject* QWidgetPluginImpl::handle() const
+{
+ return m_widget;
+}
+
+#include "moc_QWidgetPluginImpl.cpp"
diff --git a/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h
new file mode 100644
index 000000000..7459b7eff
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QWidgetPluginImpl.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QWidgetPluginImpl_h
+#define QWidgetPluginImpl_h
+
+#include "QtPluginWidgetAdapter.h"
+
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+
+class QWidgetPluginImpl : public QtPluginWidgetAdapter {
+ Q_OBJECT
+public:
+ QWidgetPluginImpl(QWidget *w) : m_widget(w) { }
+ virtual ~QWidgetPluginImpl();
+ virtual void update(const QRect &) OVERRIDE;
+ virtual void setGeometryAndClip(const QRect&, const QRect&, bool isVisible) OVERRIDE;
+ virtual void setVisible(bool) OVERRIDE;
+ virtual void setStyleSheet(const QString&) OVERRIDE;
+ virtual void setWidgetParent(QObject *) OVERRIDE;
+ virtual QObject* handle() const OVERRIDE;
+private:
+ QWidget *m_widget;
+};
+
+#endif // QWidgetPluginImpl_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
index cdc6ee0c9..b2fbf624a 100644
--- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp
@@ -23,18 +23,18 @@
#ifndef QT_NO_COMBOBOX
-#include "ChromeClientQt.h"
-#include "QtWebComboBox.h"
+#include "QWebPageAdapter.h"
#include "QWebPageClient.h"
+#include "QtWebComboBox.h"
#include "qgraphicswebview.h"
#include <QGraphicsProxyWidget>
#include <QtGui/QStandardItemModel>
namespace WebCore {
-QtFallbackWebPopup::QtFallbackWebPopup(const ChromeClientQt* chromeClient)
+QtFallbackWebPopup::QtFallbackWebPopup(const QWebPageAdapter* page)
: m_combo(0)
- , m_chromeClient(chromeClient)
+ , m_page(page)
{
}
@@ -63,9 +63,8 @@ void QtFallbackWebPopup::show(const QWebSelectData& data)
proxy->setWidget(m_combo);
proxy->setGeometry(rect);
} else {
- m_combo->setParent(pageClient()->ownerWidget());
- m_combo->setGeometry(QRect(rect.left(), rect.top(),
- rect.width(), m_combo->sizeHint().height()));
+ m_combo->setParent(qobject_cast<QWidget*>(pageClient()->ownerWidget()));
+ m_combo->setGeometry(QRect(rect.left(), rect.top(), rect.width(), m_combo->sizeHint().height()));
}
m_combo->showPopupAtCursorPosition();
@@ -131,7 +130,7 @@ void QtFallbackWebPopup::deleteComboBox()
QWebPageClient* QtFallbackWebPopup::pageClient() const
{
- return m_chromeClient->platformPageClient();
+ return m_page->client.data();
}
}
diff --git a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
index f753373be..69b49bdbf 100644
--- a/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
+++ b/Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h
@@ -23,8 +23,6 @@
#include "qwebkitplatformplugin.h"
#include <wtf/Platform.h>
-#include <QComboBox>
-
#ifndef QT_NO_COMBOBOX
QT_BEGIN_NAMESPACE
@@ -32,16 +30,16 @@ class QGraphicsProxyWidget;
QT_END_NAMESPACE
class QWebPageClient;
+class QWebPageAdapter;
namespace WebCore {
-class ChromeClientQt;
class QtWebComboBox;
class QtFallbackWebPopup : public QWebSelectMethod {
Q_OBJECT
public:
- QtFallbackWebPopup(const ChromeClientQt*);
+ QtFallbackWebPopup(const QWebPageAdapter*);
~QtFallbackWebPopup();
virtual void show(const QWebSelectData&);
@@ -59,7 +57,7 @@ private Q_SLOTS:
private:
QtWebComboBox* m_combo;
- const ChromeClientQt* m_chromeClient;
+ const QWebPageAdapter* m_page;
QRect m_geometry;
QFont m_font;
diff --git a/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h
new file mode 100644
index 000000000..8494d3db2
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QtPluginWidgetAdapter.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Digia Plc 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 QtPluginWidgetAdapter_h
+#define QtPluginWidgetAdapter_h
+
+#include <QObject>
+#include <QRect>
+#include <QString>
+
+class QtPluginWidgetAdapter : public QObject {
+ Q_OBJECT
+public:
+ virtual void update(const QRect&) = 0;
+ virtual void setGeometryAndClip(const QRect&, const QRect&, bool isVisible = false) = 0;
+ virtual void setVisible(bool) = 0;
+ virtual void setStyleSheet(const QString&) = 0;
+ virtual void setWidgetParent(QObject*) = 0;
+ virtual QObject* handle() const = 0;
+};
+
+#endif // QtPluginWidgetAdapter_h
diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
index f52465f0d..2c22cd476 100644
--- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.cpp
@@ -41,8 +41,7 @@ QtWebComboBox::QtWebComboBox()
void QtWebComboBox::showPopupAtCursorPosition()
{
- QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
- Qt::LeftButton, Qt::NoModifier);
+ QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(this, &event);
}
diff --git a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h
index 426475766..e32427edf 100644
--- a/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h
+++ b/Source/WebKit/qt/WebCoreSupport/QtWebComboBox.h
@@ -21,9 +21,8 @@
#ifndef QtWebComboBox_h
#define QtWebComboBox_h
-#include <wtf/Platform.h>
-
#include <QComboBox>
+#include <wtf/Platform.h>
#ifndef QT_NO_COMBOBOX
diff --git a/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h b/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
index 11a964105..4ae8582a3 100644
--- a/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h
@@ -27,7 +27,7 @@ namespace WebCore {
class SearchPopupMenuQt : public SearchPopupMenu {
public:
- SearchPopupMenuQt(PassRefPtr<PopupMenu> popup);
+ SearchPopupMenuQt(PassRefPtr<PopupMenu>);
virtual PopupMenu* popupMenu();
virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
diff --git a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp
index 15df2ee50..6e2d54f78 100644
--- a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.cpp
@@ -20,9 +20,10 @@
#include "config.h"
#include "UndoStepQt.h"
+#include <qobject.h>
+
using namespace WebCore;
-#ifndef QT_NO_UNDOCOMMAND
static QString undoNameForEditAction(const EditAction editAction)
{
switch (editAction) {
@@ -106,26 +107,18 @@ static QString undoNameForEditAction(const EditAction editAction)
return QString();
}
-UndoStepQt::UndoStepQt(WTF::RefPtr<UndoStep> step, QUndoCommand *parent)
- : QUndoCommand(parent)
- , m_step(step)
- , m_first(true)
-{
- setText(undoNameForEditAction(step->editingAction()));
-}
-#else
UndoStepQt::UndoStepQt(WTF::RefPtr<UndoStep> step)
: m_step(step)
, m_first(true)
{
+ m_text = undoNameForEditAction(step->editingAction());
}
-#endif
+
UndoStepQt::~UndoStepQt()
{
}
-
void UndoStepQt::redo()
{
if (m_first) {
@@ -143,5 +136,9 @@ void UndoStepQt::undo()
m_step->unapply();
}
+QString UndoStepQt::text() const
+{
+ return m_text;
+}
// vim: ts=4 sw=4 et
diff --git a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h
index 3c143403a..85d7991c3 100644
--- a/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/UndoStepQt.h
@@ -20,29 +20,24 @@
#ifndef UndoStepQt_h
#define UndoStepQt_h
-#include <QUndoCommand>
#include <UndoStep.h>
+
+#include <qstring.h>
#include <wtf/RefPtr.h>
-class UndoStepQt
-#ifndef QT_NO_UNDOCOMMAND
- : public QUndoCommand
-#endif
-{
+class UndoStepQt {
public:
-#ifndef QT_NO_UNDOCOMMAND
- UndoStepQt(WTF::RefPtr<WebCore::UndoStep> step, QUndoCommand *parent = 0);
-#else
- UndoStepQt(WTF::RefPtr<WebCore::UndoStep> step);
-#endif
+ UndoStepQt(WTF::RefPtr<WebCore::UndoStep>);
~UndoStepQt();
void redo();
void undo();
+ QString text() const;
private:
WTF::RefPtr<WebCore::UndoStep> m_step;
bool m_first;
+ QString m_text;
};
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
index d6159241e..4449c1557 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
@@ -27,13 +27,8 @@
#include "PlatformTouchEvent.h"
#include "PlatformTouchPoint.h"
#include "PlatformWheelEvent.h"
-#include <QApplication>
-#include <QGesture>
-#include <QGestureEvent>
-#include <QGraphicsSceneMouseEvent>
#include <QTouchEvent>
#include <QWheelEvent>
-#include <QWidget>
#include <wtf/CurrentTime.h>
namespace WebCore {
@@ -53,54 +48,28 @@ static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers key
static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, PlatformEvent::Type& mouseEventType, MouseButton& mouseButton)
{
- enum { MouseEvent, GraphicsSceneMouseEvent } frameworkMouseEventType;
switch (event->type()) {
case QEvent::MouseButtonDblClick:
case QEvent::MouseButtonPress:
- frameworkMouseEventType = MouseEvent;
mouseEventType = PlatformEvent::MousePressed;
break;
case QEvent::MouseButtonRelease:
- frameworkMouseEventType = MouseEvent;
mouseEventType = PlatformEvent::MouseReleased;
break;
case QEvent::MouseMove:
- frameworkMouseEventType = MouseEvent;
- mouseEventType = PlatformEvent::MouseMoved;
- break;
- case QEvent::GraphicsSceneMouseDoubleClick:
- case QEvent::GraphicsSceneMousePress:
- frameworkMouseEventType = GraphicsSceneMouseEvent;
- mouseEventType = PlatformEvent::MousePressed;
- break;
- case QEvent::GraphicsSceneMouseRelease:
- frameworkMouseEventType = GraphicsSceneMouseEvent;
- mouseEventType = PlatformEvent::MouseReleased;
- break;
- case QEvent::GraphicsSceneMouseMove:
- frameworkMouseEventType = GraphicsSceneMouseEvent;
mouseEventType = PlatformEvent::MouseMoved;
break;
default:
ASSERT_NOT_REACHED();
- frameworkMouseEventType = MouseEvent;
mouseEventType = PlatformEvent::MouseMoved;
break;
}
Qt::MouseButtons mouseButtons;
- switch (frameworkMouseEventType) {
- case MouseEvent: {
- const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event);
- mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button();
- break;
- }
- case GraphicsSceneMouseEvent: {
- const QGraphicsSceneMouseEvent* mouseEvent = static_cast<const QGraphicsSceneMouseEvent*>(event);
- mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button();
- break;
- }
- }
+
+ const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event);
+ mouseButtons = mouseEventType == PlatformEvent::MouseMoved ? mouseEvent->buttons() : mouseEvent->button();
+
if (mouseButtons & Qt::LeftButton)
mouseButton = LeftButton;
@@ -114,27 +83,9 @@ static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, Platform
class WebKitPlatformMouseEvent : public PlatformMouseEvent {
public:
- WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent*, int clickCount);
WebKitPlatformMouseEvent(QInputEvent*, int clickCount);
};
-WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
-{
- m_timestamp = WTF::currentTime();
-
- // FIXME: Why don't we handle a context menu event here as we do in PlatformMouseEvent(QInputEvent*, int)?
- // See <https://bugs.webkit.org/show_bug.cgi?id=60728>.
- PlatformEvent::Type type;
- mouseEventTypeAndMouseButtonFromQEvent(event, type, m_button);
-
- m_type = type;
- m_position = IntPoint(event->pos().toPoint());
- m_globalPosition = IntPoint(event->screenPos());
-
- m_clickCount = clickCount;
- mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_modifiers);
-}
-
WebKitPlatformMouseEvent::WebKitPlatformMouseEvent(QInputEvent* event, int clickCount)
{
m_timestamp = WTF::currentTime();
@@ -169,21 +120,15 @@ PlatformMouseEvent convertMouseEvent(QInputEvent* event, int clickCount)
return WebKitPlatformMouseEvent(event, clickCount);
}
-PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
-{
- return WebKitPlatformMouseEvent(event, clickCount);
-}
-
class WebKitPlatformWheelEvent : public PlatformWheelEvent {
public:
- WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent*);
- WebKitPlatformWheelEvent(QWheelEvent*);
+ WebKitPlatformWheelEvent(QWheelEvent*, int wheelScrollLines);
private:
- void applyDelta(int delta, Qt::Orientation);
+ void applyDelta(int delta, Qt::Orientation, int wheelScrollLines);
};
-void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation)
+void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation, int wheelScrollLines)
{
if (orientation == Qt::Horizontal) {
m_deltaX = delta;
@@ -198,22 +143,11 @@ void WebKitPlatformWheelEvent::applyDelta(int delta, Qt::Orientation orientation
// Since we request the scroll delta by the pixel, convert the wheel delta to pixel delta using the standard scroll step.
// Use the same single scroll step as QTextEdit (in QTextEditPrivate::init [h,v]bar->setSingleStep)
static const float cDefaultQtScrollStep = 20.f;
- m_deltaX = m_wheelTicksX * QApplication::wheelScrollLines() * cDefaultQtScrollStep;
- m_deltaY = m_wheelTicksY * QApplication::wheelScrollLines() * cDefaultQtScrollStep;
+ m_deltaX = m_wheelTicksX * wheelScrollLines * cDefaultQtScrollStep;
+ m_deltaY = m_wheelTicksY * wheelScrollLines * cDefaultQtScrollStep;
}
-WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QGraphicsSceneWheelEvent* e)
-{
- m_timestamp = WTF::currentTime();
- mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), m_modifiers);
- m_position = e->pos().toPoint();
- m_globalPosition = e->screenPos();
- m_granularity = ScrollByPixelWheelEvent;
- m_directionInvertedFromDevice = false;
- applyDelta(e->delta(), e->orientation());
-}
-
-WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e)
+WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e, int wheelScrollLines)
{
m_timestamp = WTF::currentTime();
mouseEventModifiersFromQtKeyboardModifiers(e->modifiers(), m_modifiers);
@@ -221,7 +155,7 @@ WebKitPlatformWheelEvent::WebKitPlatformWheelEvent(QWheelEvent* e)
m_globalPosition = e->globalPos();
m_granularity = ScrollByPixelWheelEvent;
m_directionInvertedFromDevice = false;
- applyDelta(e->delta(), e->orientation());
+ applyDelta(e->delta(), e->orientation(), wheelScrollLines);
}
#if ENABLE(TOUCH_EVENTS)
@@ -309,43 +243,35 @@ WebKitPlatformTouchPoint::WebKitPlatformTouchPoint(const QTouchEvent::TouchPoint
#if ENABLE(GESTURE_EVENTS)
class WebKitPlatformGestureEvent : public PlatformGestureEvent {
public:
- WebKitPlatformGestureEvent(const QGestureEvent*, const QGesture*);
+ WebKitPlatformGestureEvent(QGestureEventFacade*);
};
-WebKitPlatformGestureEvent::WebKitPlatformGestureEvent(const QGestureEvent* event, const QGesture* gesture)
+static inline PlatformEvent::Type toPlatformEventType(Qt::GestureType type)
{
- switch (gesture->gestureType()) {
- case Qt::TapGesture: {
- m_type = PlatformEvent::GestureTap;
- QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position();
- m_globalPosition = globalPos.toPoint();
- m_position = event->widget()->mapFromGlobal(globalPos.toPoint());
- break;
- }
- case Qt::TapAndHoldGesture: {
- m_type = PlatformEvent::GestureLongPress;
- QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position();
- m_globalPosition = globalPos.toPoint();
- m_position = event->widget()->mapFromGlobal(globalPos.toPoint());
- break;
- }
+ switch (type) {
+ case Qt::TapGesture:
+ return PlatformEvent::GestureTap;
+ case Qt::TapAndHoldGesture:
+ return PlatformEvent::GestureLongPress;
default:
ASSERT_NOT_REACHED();
- break;
+ return PlatformEvent::NoType;
}
- m_timestamp = WTF::currentTime();
}
-#endif
-
-PlatformWheelEvent convertWheelEvent(QWheelEvent* event)
+WebKitPlatformGestureEvent::WebKitPlatformGestureEvent(QGestureEventFacade* event)
{
- return WebKitPlatformWheelEvent(event);
+ m_type = toPlatformEventType(event->type);
+ m_globalPosition = event->globalPos;
+ m_position = event->pos;
+ m_timestamp = WTF::currentTime();
}
-PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent* event)
+#endif
+
+PlatformWheelEvent convertWheelEvent(QWheelEvent* event, int wheelScrollLines)
{
- return WebKitPlatformWheelEvent(event);
+ return WebKitPlatformWheelEvent(event, wheelScrollLines);
}
#if ENABLE(TOUCH_EVENTS)
@@ -356,10 +282,9 @@ PlatformTouchEvent convertTouchEvent(QTouchEvent* event)
#endif
#if ENABLE(GESTURE_EVENTS)
-PlatformGestureEvent convertGesture(QGestureEvent* event, QGesture* gesture)
+PlatformGestureEvent convertGesture(QGestureEventFacade* event)
{
- return WebKitPlatformGestureEvent(event, gesture);
+ return WebKitPlatformGestureEvent(event);
}
#endif
-
}
diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h
index 3224eee90..0cf8cd849 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h
+++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h
@@ -19,27 +19,30 @@
Boston, MA 02110-1301, USA.
*/
-#include <qglobal.h>
+#ifndef WebEventConversion_h
+#define WebEventConversion_h
+
+#include <QPoint>
QT_BEGIN_NAMESPACE
class QInputEvent;
-class QGraphicsSceneMouseEvent;
class QWheelEvent;
-class QGraphicsSceneWheelEvent;
class QTouchEvent;
-class QGesture;
-class QGestureEvent;
QT_END_NAMESPACE
+struct QGestureEventFacade {
+ Qt::GestureType type;
+ QPoint globalPos;
+ QPoint pos;
+};
+
namespace WebCore {
class PlatformMouseEvent;
class PlatformWheelEvent;
PlatformMouseEvent convertMouseEvent(QInputEvent*, int clickCount);
-PlatformMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent*, int clickCount);
-PlatformWheelEvent convertWheelEvent(QWheelEvent*);
-PlatformWheelEvent convertWheelEvent(QGraphicsSceneWheelEvent*);
+PlatformWheelEvent convertWheelEvent(QWheelEvent*, int wheelScrollLines);
#if ENABLE(TOUCH_EVENTS)
class PlatformTouchEvent;
@@ -48,6 +51,8 @@ PlatformTouchEvent convertTouchEvent(QTouchEvent*);
#if ENABLE(GESTURE_EVENTS)
class PlatformGestureEvent;
-PlatformGestureEvent convertGesture(QGestureEvent*, QGesture*);
+PlatformGestureEvent convertGesture(QGestureEventFacade*);
#endif
}
+
+#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h b/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h
index 467b5ba37..9b03d4afc 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h
+++ b/Source/WebKit/qt/WebCoreSupport/WebSystemInterface.h
@@ -26,6 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef WebSystemInterface_h
+#define WebSystemInterface_h
+
#include <stdint.h>
void InitWebCoreSystemInterface();
+
+#endif
diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index ff40b55f0..9f51f3f01 100644
--- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -27,6 +27,7 @@
#include <QLineEdit>
#include <QMainWindow>
#include <QMenu>
+#include <QMimeDatabase>
#include <QPushButton>
#include <QStateMachine>
#include <QStyle>
@@ -281,10 +282,11 @@ public:
JSTestPage(QObject* parent = 0)
: QWebPage(parent) {}
-public Q_SLOTS:
- bool shouldInterruptJavaScript() {
+ virtual bool shouldInterruptJavaScript()
+ {
return true;
}
+public Q_SLOTS:
void requestPermission(QWebFrame* frame, QWebPage::Feature feature)
{
if (m_allowGeolocation)
@@ -548,7 +550,7 @@ void tst_QWebPage::loadHtml5Video()
QByteArray url("http://does.not/exist?a=1%2Cb=2");
m_view->setHtml("<p><video id ='video' src='" + url + "' autoplay/></p>");
QTest::qWait(2000);
- QUrl mUrl = DumpRenderTreeSupportQt::mediaContentUrlByElementId(m_page->mainFrame(), "video");
+ QUrl mUrl = DumpRenderTreeSupportQt::mediaContentUrlByElementId(m_page->mainFrame()->handle(), "video");
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=65452", Continue);
QCOMPARE(mUrl.toEncoded(), url);
#else
@@ -1026,12 +1028,12 @@ void tst_QWebPage::multiplePageGroupsAndLocalStorage()
view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path1"));
- DumpRenderTreeSupportQt::webPageSetGroupName(view1.page(), "group1");
+ DumpRenderTreeSupportQt::webPageSetGroupName(view1.page()->handle(), "group1");
view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path2"));
- DumpRenderTreeSupportQt::webPageSetGroupName(view2.page(), "group2");
- QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()), QString("group1"));
- QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view2.page()), QString("group2"));
+ DumpRenderTreeSupportQt::webPageSetGroupName(view2.page()->handle(), "group2");
+ QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()->handle()), QString("group1"));
+ QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view2.page()->handle()), QString("group2"));
view1.setHtml(QString("<html><body> </body></html>"), QUrl("http://www.myexample.com"));
@@ -2968,79 +2970,43 @@ void tst_QWebPage::findText()
}
}
-struct ImageExtensionMap {
- const char* extension;
- const char* mimeType;
-};
-
-static const ImageExtensionMap extensionMap[] = {
- { "bmp", "image/bmp" },
- { "css", "text/css" },
- { "gif", "image/gif" },
- { "html", "text/html" },
- { "htm", "text/html" },
- { "ico", "image/x-icon" },
- { "jpeg", "image/jpeg" },
- { "jpg", "image/jpeg" },
- { "js", "application/x-javascript" },
- { "mng", "video/x-mng" },
- { "pbm", "image/x-portable-bitmap" },
- { "pgm", "image/x-portable-graymap" },
- { "pdf", "application/pdf" },
- { "png", "image/png" },
- { "ppm", "image/x-portable-pixmap" },
- { "rss", "application/rss+xml" },
- { "svg", "image/svg+xml" },
- { "text", "text/plain" },
- { "tif", "image/tiff" },
- { "tiff", "image/tiff" },
- { "txt", "text/plain" },
- { "xbm", "image/x-xbitmap" },
- { "xml", "text/xml" },
- { "xpm", "image/x-xpm" },
- { "xsl", "text/xsl" },
- { "xhtml", "application/xhtml+xml" },
- { "wml", "text/vnd.wap.wml" },
- { "wmlc", "application/vnd.wap.wmlc" },
- { 0, 0 }
-};
-
static QString getMimeTypeForExtension(const QString &ext)
{
- const ImageExtensionMap *e = extensionMap;
- while (e->extension) {
- if (ext.compare(QLatin1String(e->extension), Qt::CaseInsensitive) == 0)
- return QLatin1String(e->mimeType);
- ++e;
- }
+ QMimeType mimeType = QMimeDatabase().mimeTypeForFile(QStringLiteral("filename.") + ext.toLower(), QMimeDatabase::MatchExtension);
+ if (mimeType.isValid() && !mimeType.isDefault())
+ return mimeType.name();
return QString();
}
void tst_QWebPage::supportedContentType()
{
- QStringList contentTypes;
+ QStringList contentTypes;
- // Add supported non image types...
- contentTypes << "text/html" << "text/xml" << "text/xsl" << "text/plain" << "text/"
- << "application/xml" << "application/xhtml+xml" << "application/vnd.wap.xhtml+xml"
- << "application/rss+xml" << "application/atom+xml" << "application/json";
+ // Add supported non image types...
+ contentTypes << "text/html" << "text/xml" << "text/xsl" << "text/plain" << "text/"
+ << "application/xml" << "application/xhtml+xml" << "application/vnd.wap.xhtml+xml"
+ << "application/rss+xml" << "application/atom+xml" << "application/json";
- // Add supported image types...
- Q_FOREACH(const QByteArray& imageType, QImageWriter::supportedImageFormats()) {
- const QString mimeType = getMimeTypeForExtension(imageType);
- if (!mimeType.isEmpty())
- contentTypes << mimeType;
- }
+#if ENABLE_MHTML
+ contentTypes << "application/x-mimearchive";
+#endif
+
+ // Add supported image types...
+ Q_FOREACH(const QByteArray& imageType, QImageWriter::supportedImageFormats()) {
+ const QString mimeType = getMimeTypeForExtension(imageType);
+ if (!mimeType.isEmpty())
+ contentTypes << mimeType;
+ }
- // Get the mime types supported by webkit...
- const QStringList supportedContentTypes = m_page->supportedContentTypes();
+ // Get the mime types supported by webkit...
+ const QStringList supportedContentTypes = m_page->supportedContentTypes();
- Q_FOREACH(const QString& mimeType, contentTypes)
- QVERIFY2(supportedContentTypes.contains(mimeType), QString("'%1' is not a supported content type!").arg(mimeType).toLatin1());
+ Q_FOREACH(const QString& mimeType, contentTypes)
+ QVERIFY2(supportedContentTypes.contains(mimeType), QString("'%1' is not a supported content type!").arg(mimeType).toLatin1());
- Q_FOREACH(const QString& mimeType, contentTypes)
- QVERIFY2(m_page->supportsContentType(mimeType), QString("Cannot handle content types '%1'!").arg(mimeType).toLatin1());
+ Q_FOREACH(const QString& mimeType, contentTypes)
+ QVERIFY2(m_page->supportsContentType(mimeType), QString("Cannot handle content types '%1'!").arg(mimeType).toLatin1());
}
@@ -3062,35 +3028,35 @@ void tst_QWebPage::thirdPartyCookiePolicy()
QVERIFY(m_page->networkAccessManager()->cookieJar());
// These are all first-party cookies, so should pass.
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.com"), QUrl("http://example.com")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.com"), QUrl("http://doc.example.com")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://aaa.www.example.com"), QUrl("http://doc.example.com")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://example.com"), QUrl("http://www.example.com")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.co.uk"), QUrl("http://example.co.uk")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.co.uk"), QUrl("http://doc.example.co.uk")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://aaa.www.example.co.uk"), QUrl("http://doc.example.co.uk")));
- QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://example.co.uk"), QUrl("http://www.example.co.uk")));
// These are all third-party cookies, so should fail.
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.com"), QUrl("http://slashdot.org")));
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://example.com"), QUrl("http://anotherexample.com")));
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://anotherexample.com"), QUrl("http://example.com")));
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://www.example.co.uk"), QUrl("http://slashdot.co.uk")));
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://example.co.uk"), QUrl("http://anotherexample.co.uk")));
- QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page,
+ QVERIFY(!DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(m_page->handle(),
QUrl("http://anotherexample.co.uk"), QUrl("http://example.co.uk")));
}