summaryrefslogtreecommitdiffstats
path: root/lib/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2013-06-28 14:28:10 +0200
committerAndras Becsi <andras.becsi@digia.com>2013-06-28 14:49:39 +0200
commit5c078a9670a85df2127c311a9c7b6e18d6823214 (patch)
tree5b06b6e3729fcc52dd2190b5372d62ede2806d4a /lib/render_widget_host_view_qt.cpp
parentdcf6d270caa61421d11eaf191370b772613ced9e (diff)
Avoild calls to RenderWidgetHostViewQt::GetNativeView()
Override RenderWidgetHostView::GetPhysicalBackingSize() since the implementation in RenderWidgetHostViewBase calls GetNativeView only to get the device scale factor of the screen. This way we can avoid calls to GetNativeView for now. Add a new macro QT_NOT_USED to mark evaluated and currently unused and possibly unneded functions and mark gfx::NativeView related functions in our render widget host view implementation as unused. Change-Id: I32011334fe06618cb47ea649d2f6e4393310dc13 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'lib/render_widget_host_view_qt.cpp')
-rw-r--r--lib/render_widget_host_view_qt.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/render_widget_host_view_qt.cpp b/lib/render_widget_host_view_qt.cpp
index 644635f38..0ec764398 100644
--- a/lib/render_widget_host_view_qt.cpp
+++ b/lib/render_widget_host_view_qt.cpp
@@ -49,11 +49,13 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/common/gpu/gpu_messages.h"
+#include "ui/gfx/size_conversions.h"
#include <QEvent>
#include <QFocusEvent>
#include <QKeyEvent>
#include <QMouseEvent>
+#include <QScreen>
#include <QWheelEvent>
#include <QWindow>
@@ -147,22 +149,39 @@ void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& rect)
SetSize(rect.size());
}
-// FIXME: Should this really return a QWindow pointer?
+gfx::Size RenderWidgetHostViewQt::GetPhysicalBackingSize() const
+{
+ if (!m_delegate)
+ return gfx::Size();
+
+ const QScreen* screen = m_delegate->window()->screen();
+ return gfx::ToCeiledSize(gfx::ScaleSize(GetViewBounds().size(), screen->devicePixelRatio()));
+}
+
gfx::NativeView RenderWidgetHostViewQt::GetNativeView() const
{
- QT_NOT_YET_IMPLEMENTED
+ // gfx::NativeView is a typedef to a platform specific view
+ // pointer (HWND, NSView*, GtkWidget*) and other ports use
+ // this function in the renderer_host layer when setting up
+ // the view hierarchy and for generating snapshots in tests.
+ // Since we manage the view hierarchy in Qt we can possibly
+ // avoid calls to this.
+ QT_NOT_USED
return gfx::NativeView();
}
gfx::NativeViewId RenderWidgetHostViewQt::GetNativeViewId() const
{
- QT_NOT_YET_IMPLEMENTED
- return gfx::NativeViewId();
+ // This function is used in IPC in place of GetNativeView
+ // and we can possibly avoid calls for now.
+ QT_NOT_USED
+ return m_delegate->window()->winId();
}
gfx::NativeViewAccessible RenderWidgetHostViewQt::GetNativeViewAccessible()
{
- NOTIMPLEMENTED();
+ // We are not using accessibility features at this point.
+ QT_NOT_USED
return NULL;
}