2010-12-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt][WK2] Add the QWKContext API class to wrap the WebContext.
        https://bugs.webkit.org/show_bug.cgi?id=50750

        * UIProcess/API/qt/WKView.h:
        * UIProcess/API/qt/qgraphicswkview.cpp:
        (QGraphicsWKView::QGraphicsWKView):
        Change the WKPageNamespaceRef argument to QWKContext*
        * UIProcess/API/qt/qgraphicswkview.h:
        * UIProcess/API/qt/qwkcontext.cpp: Added.
        * UIProcess/API/qt/qwkcontext.h: Added.
        * UIProcess/API/qt/qwkcontext_p.h: Added.
        * UIProcess/API/qt/qwkpage.cpp:
        (QWKPagePrivate::QWKPagePrivate):
        (QWKPage::QWKPage):
        Change the WKPageNamespaceRef argument to QWKContext*
        * UIProcess/API/qt/qwkpage.h:
        * UIProcess/API/qt/qwkpage_p.h:
        * WebKit2.pro:
2010-12-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt][WK2] Add the QWKContext API class to wrap the WebContext.
        https://bugs.webkit.org/show_bug.cgi?id=50750

        * MiniBrowser/qt/BrowserView.cpp:
        (BrowserView::BrowserView):
        * MiniBrowser/qt/BrowserView.h:
        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
        (WTR::WebView::WebView):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73716 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bd6974cf
2010-12-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt][WK2] Add the QWKContext API class to wrap the WebContext.
https://bugs.webkit.org/show_bug.cgi?id=50750
* UIProcess/API/qt/WKView.h:
* UIProcess/API/qt/qgraphicswkview.cpp:
(QGraphicsWKView::QGraphicsWKView):
Change the WKPageNamespaceRef argument to QWKContext*
* UIProcess/API/qt/qgraphicswkview.h:
* UIProcess/API/qt/qwkcontext.cpp: Added.
* UIProcess/API/qt/qwkcontext.h: Added.
* UIProcess/API/qt/qwkcontext_p.h: Added.
* UIProcess/API/qt/qwkpage.cpp:
(QWKPagePrivate::QWKPagePrivate):
(QWKPage::QWKPage):
Change the WKPageNamespaceRef argument to QWKContext*
* UIProcess/API/qt/qwkpage.h:
* UIProcess/API/qt/qwkpage_p.h:
* WebKit2.pro:
2010-12-10 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
......@@ -21,6 +21,7 @@
#define WKView_h
#include <WebKit2/qgraphicswkview.h>
#include <WebKit2/qwkcontext.h>
#include <WebKit2/qwkpage.h>
#include <WebKit2/qwkpreferences.h>
......
......@@ -57,7 +57,7 @@ struct QGraphicsWKViewPrivate {
bool m_isChangingScale;
};
QGraphicsWKView::QGraphicsWKView(WKPageNamespaceRef pageNamespaceRef, BackingStoreType backingStoreType, QGraphicsItem* parent)
QGraphicsWKView::QGraphicsWKView(QWKContext* context, BackingStoreType backingStoreType, QGraphicsItem* parent)
: QGraphicsWidget(parent)
, d(new QGraphicsWKViewPrivate(this))
{
......@@ -79,7 +79,7 @@ QGraphicsWKView::QGraphicsWKView(WKPageNamespaceRef pageNamespaceRef, BackingSto
break;
}
d->page = new QWKPage(pageNamespaceRef);
d->page = new QWKPage(context);
d->page->d->init(size().toSize(), drawingAreaProxy);
connect(d->page, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
connect(d->page, SIGNAL(loadStarted()), this, SIGNAL(loadStarted()));
......
......@@ -11,6 +11,7 @@ QT_BEGIN_NAMESPACE
class QCursor;
QT_END_NAMESPACE
class QWKContext;
class QGraphicsWKViewPrivate;
WKStringRef WKStringCreateWithQString(const QString& qString);
......@@ -23,7 +24,7 @@ class QWEBKIT_EXPORT QGraphicsWKView : public QGraphicsWidget {
public:
enum BackingStoreType { Simple, Tiled };
QGraphicsWKView(WKPageNamespaceRef namespaceRef, BackingStoreType backingStoreType = Simple, QGraphicsItem* parent = 0);
QGraphicsWKView(QWKContext* context, BackingStoreType backingStoreType = Simple, QGraphicsItem* parent = 0);
virtual ~QGraphicsWKView();
......
/*
* Copyright (C) 2010 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 program 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 program; 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 "qwkcontext.h"
#include "qwkcontext_p.h"
#include "WebPlatformStrategies.h"
using namespace WebKit;
static inline void initializePlatformStrategiesIfNeeded()
{
static bool initialized = false;
if (initialized)
return;
WebPlatformStrategies::initialize();
initialized = true;
}
QWKContextPrivate::QWKContextPrivate(QWKContext* qq)
: q(qq)
{
initializePlatformStrategiesIfNeeded();
}
QWKContextPrivate::~QWKContextPrivate()
{
}
QWKContext::QWKContext(QObject* parent)
: QObject(parent)
, d(new QWKContextPrivate(this))
{
d->context = WebContext::create(String());
d->pageNamespace = d->context->createPageNamespace();
}
QWKContext::QWKContext(WKPageNamespaceRef pageNamespaceRef, QObject* parent)
: QObject(parent)
, d(new QWKContextPrivate(this))
{
d->pageNamespace = toImpl(pageNamespaceRef);
d->context = d->pageNamespace->context();
}
QWKContext::~QWKContext()
{
delete d;
}
#include "moc_qwkcontext.cpp"
/*
Copyright (C) 2010 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 qwkcontext_h
#define qwkcontext_h
#include "qwebkitglobal.h"
#include <QObject>
#include <WebKit2/WKPageNamespace.h>
class QWKContextPrivate;
class QWEBKIT_EXPORT QWKContext : public QObject {
Q_OBJECT
public:
QWKContext(QObject* parent = 0);
virtual ~QWKContext();
// Bridge from the C API
QWKContext(WKPageNamespaceRef pageNamespaceRef, QObject* parent = 0);
private:
QWKContextPrivate* d;
friend class QWKPagePrivate;
};
#endif /* qwkcontext_h */
/*
Copyright (C) 2010 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 qwkcontext_p_h
#define qwkcontext_p_h
#include "WebContext.h"
#include "WebPageNamespace.h"
#include <wtf/RefPtr.h>
class QWKContextPrivate {
public:
QWKContextPrivate(QWKContext*);
~QWKContextPrivate();
QWKContext* q;
RefPtr<WebKit::WebContext> context;
RefPtr<WebKit::WebPageNamespace> pageNamespace;
};
#endif /* qkcontext_p_h */
......@@ -24,6 +24,8 @@
#include "qwkpreferences_p.h"
#include "ClientImpl.h"
#include "qwkcontext.h"
#include "qwkcontext_p.h"
#include "qwkhistory.h"
#include "qwkhistory_p.h"
#include "FindIndicator.h"
......@@ -32,7 +34,6 @@
#include "WebContext.h"
#include "WebContextMenuProxyQt.h"
#include "WebEventFactoryQt.h"
#include "WebPlatformStrategies.h"
#include "WebPopupMenuProxyQt.h"
#include "WKStringQt.h"
#include "WKURLQt.h"
......@@ -52,24 +53,14 @@
using namespace WebKit;
using namespace WebCore;
static inline void initializePlatformStrategiesIfNeeded()
{
static bool initialized = false;
if (initialized)
return;
WebPlatformStrategies::initialize();
initialized = true;
}
QWKPagePrivate::QWKPagePrivate(QWKPage* qq, WKPageNamespaceRef namespaceRef)
QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c)
: q(qq)
, context(c)
, preferences(0)
, createNewPageFn(0)
{
initializePlatformStrategiesIfNeeded();
memset(actions, 0, sizeof(actions));
page = toImpl(namespaceRef)->createWebPage(0); // Page gets a ref to namespace.
page = context->d->pageNamespace->createWebPage(0);
page->setPageClient(this);
history = QWKHistoryPrivate::createHistory(page->backForwardList());
}
......@@ -312,8 +303,8 @@ void QWKPagePrivate::touchEvent(QTouchEvent* event)
#endif
}
QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
: d(new QWKPagePrivate(this, namespaceRef))
QWKPage::QWKPage(QWKContext* context)
: d(new QWKPagePrivate(this, context))
{
WKPageLoaderClient loadClient = {
0, /* version */
......
......@@ -10,9 +10,9 @@
#include <QUrl>
#include <WebKit2/WKBase.h>
#include <WebKit2/WKPage.h>
#include <WebKit2/WKPageNamespace.h>
class QCursor;
class QWKContext;
class QWKGraphicsWidget;
class QWKPreferences;
class QWKPagePrivate;
......@@ -66,7 +66,7 @@ public:
friend class QWKPage;
};
QWKPage(WKPageNamespaceRef);
QWKPage(QWKContext*);
virtual ~QWKPage();
WKPageRef pageRef() const;
......@@ -102,6 +102,7 @@ public:
void setPageAndTextZoomFactors(qreal pageZoomFactor, qreal textZoomFactor);
QWKHistory* history() const;
QWKContext* context() const;
void findZoomableAreaForPoint(const QPoint&);
......
......@@ -36,7 +36,7 @@ class QWKPreferences;
class QWKPagePrivate : WebKit::PageClient {
public:
QWKPagePrivate(QWKPage*, WKPageNamespaceRef);
QWKPagePrivate(QWKPage*, QWKContext*);
~QWKPagePrivate();
static QWKPagePrivate* get(QWKPage* page) { return page->d; }
......@@ -92,6 +92,7 @@ public:
QWKPage* q;
QWKContext* context;
QWKHistory* history;
QAction* actions[QWKPage::WebActionCount];
......
......@@ -147,6 +147,7 @@ INCLUDEPATH = \
WebProcess/WebCoreSupport \
WebProcess/WebCoreSupport/qt \
WebProcess/WebPage \
WebProcess/qt \
$$INCLUDEPATH
INCLUDEPATH += \
......@@ -296,6 +297,8 @@ HEADERS += \
UIProcess/API/cpp/qt/WKURLQt.h \
UIProcess/API/qt/ClientImpl.h \
UIProcess/API/qt/qgraphicswkview.h \
UIProcess/API/qt/qwkcontext.h \
UIProcess/API/qt/qwkcontext_p.h \
UIProcess/API/qt/qwkhistory.h \
UIProcess/API/qt/qwkhistory_p.h \
UIProcess/API/qt/qwkpage.h \
......@@ -486,6 +489,7 @@ SOURCES += \
UIProcess/API/cpp/qt/WKURLQt.cpp \
UIProcess/API/qt/ClientImpl.cpp \
UIProcess/API/qt/qgraphicswkview.cpp \
UIProcess/API/qt/qwkcontext.cpp \
UIProcess/API/qt/qwkhistory.cpp \
UIProcess/API/qt/qwkpage.cpp \
UIProcess/API/qt/qwkpreferences.cpp \
......
2010-12-10 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt][WK2] Add the QWKContext API class to wrap the WebContext.
https://bugs.webkit.org/show_bug.cgi?id=50750
* MiniBrowser/qt/BrowserView.cpp:
(BrowserView::BrowserView):
* MiniBrowser/qt/BrowserView.h:
* WebKitTestRunner/qt/PlatformWebViewQt.cpp:
(WTR::WebView::WebView):
2010-12-10 Joone Hur <joone@kldp.org>
Reviewed by Eric Seidel.
......
......@@ -29,7 +29,6 @@
#include "BrowserView.h"
#include <QGraphicsScene>
#include "WKContext.h"
static QWKPage* createNewPage(QWKPage* page)
{
......@@ -39,11 +38,9 @@ static QWKPage* createNewPage(QWKPage* page)
BrowserView::BrowserView(QGraphicsWKView::BackingStoreType backingStoreType, QWidget* parent)
: QGraphicsView(parent)
, m_item(0)
, m_context(WKContextGetSharedProcessContext())
, m_context(new QWKContext(this))
{
WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(m_context.get()));
m_item = new QGraphicsWKView(pageNamespace.get(), backingStoreType, 0);
m_item = new QGraphicsWKView(m_context, backingStoreType, 0);
setScene(new QGraphicsScene(this));
scene()->addItem(m_item);
......
......@@ -31,7 +31,7 @@
#include <QGraphicsView>
#include "qgraphicswkview.h"
#include "WKRetainPtr.h"
#include "qwkcontext.h"
class BrowserView : public QGraphicsView {
Q_OBJECT
......@@ -48,7 +48,7 @@ protected:
private:
QGraphicsWKView* m_item;
WKRetainPtr<WKContextRef> m_context;
QWKContext* m_context;
};
#endif
......@@ -26,6 +26,7 @@
#include "PlatformWebView.h"
#include "qgraphicswkview.h"
#include "qwkcontext.h"
#include <QtGui>
namespace WTR {
......@@ -44,7 +45,7 @@ private:
WebView::WebView(WKPageNamespaceRef namespaceRef)
: QGraphicsView()
, m_item(new QGraphicsWKView(namespaceRef))
, m_item(new QGraphicsWKView(new QWKContext(namespaceRef, this)))
{
setScene(new QGraphicsScene(this));
scene()->addItem(m_item);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment