[Qt] Remove unnecessary initialize method from QQuickWebView.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Nov 2011 21:06:41 +0000 (21:06 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Nov 2011 21:06:41 +0000 (21:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72905

Reviewed by Kenneth Rohde Christiansen.

We don't need this level of indirection.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebView::QQuickWebView):
* UIProcess/API/qt/qquickwebview_p_p.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100950 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

index 2829dac..e23dd93 100644 (file)
@@ -1,3 +1,17 @@
+2011-11-21  Alexis Menard  <alexis.menard@openbossa.org>
+
+        [Qt] Remove unnecessary initialize method from QQuickWebView.
+        https://bugs.webkit.org/show_bug.cgi?id=72905
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        We don't need this level of indirection.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebView::QQuickWebView):
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+
 2011-11-21  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
         [Qt][WK2] Implement loadHtml API for QQuickWebView
index bf83f5a..1a486ac 100644 (file)
@@ -36,8 +36,8 @@
 #include <QtWidgets/QInputDialog>
 #include <WKOpenPanelResultListener.h>
 
-QQuickWebViewPrivate::QQuickWebViewPrivate()
-    : q_ptr(0)
+QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+    : q_ptr(viewport)
     , alertDialog(0)
     , confirmDialog(0)
     , promptDialog(0)
@@ -45,6 +45,19 @@ QQuickWebViewPrivate::QQuickWebViewPrivate()
     , transitioningToNewPage(false)
     , useTraditionalDesktopBehaviour(false)
 {
+    viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
+
+    QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
+    pageView.reset(new QQuickWebPage(viewport));
+
+    QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
+    setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, 0, this, contextRef, pageGroupRef));
+    pageViewPrivate->setPageProxy(pageProxy.data());
+
+    QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);
+    pageProxy->init();
+
+    QObject::connect(pageProxy.data(), SIGNAL(updateNavigationState()), q_ptr, SIGNAL(navigationStateChanged()));
 }
 
 void QQuickWebViewPrivate::enableMouseEvents()
@@ -65,24 +78,6 @@ void QQuickWebViewPrivate::disableMouseEvents()
     pageView->setAcceptHoverEvents(false);
 }
 
-void QQuickWebViewPrivate::initialize(QQuickWebView* viewport, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
-{
-    q_ptr = viewport;
-    viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
-
-    QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
-    pageView.reset(new QQuickWebPage(viewport));
-
-    QQuickWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    setPageProxy(new QtWebPageProxy(pageView.data(), q_ptr, 0, this, contextRef, pageGroupRef));
-    pageViewPrivate->setPageProxy(pageProxy.data());
-
-    QWebPreferencesPrivate::get(pageProxy->preferences())->setAttribute(QWebPreferencesPrivate::AcceleratedCompositingEnabled, true);
-    pageProxy->init();
-
-    QObject::connect(pageProxy.data(), SIGNAL(updateNavigationState()), q_ptr, SIGNAL(navigationStateChanged()));
-}
-
 void QQuickWebViewPrivate::initializeDesktop(QQuickWebView* viewport)
 {
     if (interactionEngine) {
@@ -474,21 +469,19 @@ void QQuickWebViewExperimental::setPromptDialog(QDeclarativeComponent* promptDia
 
 QQuickWebView::QQuickWebView(QQuickItem* parent)
     : QQuickItem(parent)
-    , d_ptr(new QQuickWebViewPrivate)
+    , d_ptr(new QQuickWebViewPrivate(this))
     , m_experimental(new QQuickWebViewExperimental(this))
 {
     Q_D(QQuickWebView);
-    d->initialize(this);
     d->initializeTouch(this);
 }
 
 QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent)
     : QQuickItem(parent)
-    , d_ptr(new QQuickWebViewPrivate)
+    , d_ptr(new QQuickWebViewPrivate(this, contextRef, pageGroupRef))
     , m_experimental(new QQuickWebViewExperimental(this))
 {
     Q_D(QQuickWebView);
-    d->initialize(this, contextRef, pageGroupRef);
     // Used by WebKitTestRunner.
     d->setUseTraditionalDesktopBehaviour(true);
 }
index e646c80..3ae2561 100644 (file)
@@ -45,10 +45,9 @@ class QQuickWebViewPrivate : public WebKit::QtPolicyInterface {
     friend class QQuickWebViewExperimental;
 
 public:
-    QQuickWebViewPrivate();
+    QQuickWebViewPrivate(QQuickWebView* viewport, WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
     virtual ~QQuickWebViewPrivate() { }
     void setPageProxy(QtWebPageProxy*);
-    void initialize(QQuickWebView* viewport, WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
     void initializeTouch(QQuickWebView* viewport);
     void initializeDesktop(QQuickWebView* viewport);
     void enableMouseEvents();