diff options
author | Pierre Rossi <pierre.rossi@digia.com> | 2013-07-31 16:07:01 +0200 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@gmail.com> | 2013-08-02 11:24:21 +0200 |
commit | d1e168102555e903d41394484f5a8a0c13f1548f (patch) | |
tree | 5ba2ed679bbe39793a5def5399fc6366a36671ec /lib/widgets | |
parent | 0161c0aca53be2c73e983c12995104308823e41b (diff) |
Don't pass the RWHV to the AdapterClient
As this looks like a layering violation.
Instead, rely on WebContentsViewImpl::CreateRenderViewForRenderManager
querying the WebContentsView's size before setting it on the
RenderWidgetHostView. The WebContentsView now gets the size of the
actual view through the Adapter interface.
Then, in RenderWidgetHostViewQt, we now forward the resize request
to the delegate.
Change-Id: Ide679f6d114508cc7c9ffac83daad19d16764a4d
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'lib/widgets')
-rw-r--r-- | lib/widgets/Api/qwebcontentsview.cpp | 9 | ||||
-rw-r--r-- | lib/widgets/Api/qwebcontentsview_p.h | 3 | ||||
-rw-r--r-- | lib/widgets/render_widget_host_view_qt_delegate_widget.cpp | 5 | ||||
-rw-r--r-- | lib/widgets/render_widget_host_view_qt_delegate_widget.h | 1 |
4 files changed, 15 insertions, 3 deletions
diff --git a/lib/widgets/Api/qwebcontentsview.cpp b/lib/widgets/Api/qwebcontentsview.cpp index 612f7699b..c1e182b3b 100644 --- a/lib/widgets/Api/qwebcontentsview.cpp +++ b/lib/widgets/Api/qwebcontentsview.cpp @@ -77,11 +77,16 @@ void QWebContentsViewPrivate::loadingStateChanged() } } -RenderWidgetHostViewQtDelegate *QWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt* rwhv) +QRectF QWebContentsViewPrivate::viewportRect() const +{ + Q_Q(const QWebContentsView); + return q->geometry(); +} + +RenderWidgetHostViewQtDelegate *QWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate() { Q_Q(QWebContentsView); RenderWidgetHostViewQtDelegateWidget *viewDelegate = new RenderWidgetHostViewQtDelegateWidget(q); - viewDelegate->resetView(rwhv); // Parent the RWHVQtDelegate directly, this might have to be changed to handle popups and fullscreen. q->layout()->addWidget(viewDelegate); return viewDelegate; diff --git a/lib/widgets/Api/qwebcontentsview_p.h b/lib/widgets/Api/qwebcontentsview_p.h index ba3739c4b..badf72673 100644 --- a/lib/widgets/Api/qwebcontentsview_p.h +++ b/lib/widgets/Api/qwebcontentsview_p.h @@ -58,10 +58,11 @@ class QWebContentsViewPrivate : public WebContentsAdapterClient public: QWebContentsViewPrivate(); - virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQt *) Q_DECL_OVERRIDE; + virtual RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate() Q_DECL_OVERRIDE; virtual void titleChanged(const QString&) Q_DECL_OVERRIDE; virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE; virtual void loadingStateChanged() Q_DECL_OVERRIDE; + virtual QRectF viewportRect() const Q_DECL_OVERRIDE; bool m_isLoading; QScopedPointer<WebContentsAdapter> adapter; diff --git a/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp index 4164ce242..1e696537e 100644 --- a/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/lib/widgets/render_widget_host_view_qt_delegate_widget.cpp @@ -115,6 +115,11 @@ void RenderWidgetHostViewQtDelegateWidget::updateCursor(const QCursor &cursor) QWidget::setCursor(cursor); } +void RenderWidgetHostViewQtDelegateWidget::resize(int width, int height) +{ + QWidget::resize(width, height); +} + void RenderWidgetHostViewQtDelegateWidget::paintEvent(QPaintEvent * event) { QPainter painter(this); diff --git a/lib/widgets/render_widget_host_view_qt_delegate_widget.h b/lib/widgets/render_widget_host_view_qt_delegate_widget.h index 514c276df..240f29ba5 100644 --- a/lib/widgets/render_widget_host_view_qt_delegate_widget.h +++ b/lib/widgets/render_widget_host_view_qt_delegate_widget.h @@ -63,6 +63,7 @@ public: virtual QWindow* window() const; virtual void update(const QRect& rect = QRect()); virtual void updateCursor(const QCursor &); + virtual void resize(int width, int height); protected: void paintEvent(QPaintEvent * event); |