| Index: content/browser/renderer_host/render_widget_host_view_win.cc
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
|
| index 152a51fcce93175428e06a0f5940dbb22cf42fd0..6e45365620f8b074049a15b78c71e7575c90e514 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_win.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_win.cc
|
| @@ -52,6 +52,7 @@
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFactory.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFactory.h"
|
| #include "ui/base/events/event.h"
|
| #include "ui/base/events/event_utils.h"
|
| #include "ui/base/ime/composition_text.h"
|
| @@ -61,6 +62,7 @@
|
| #include "ui/base/touch/touch_device_win.h"
|
| #include "ui/base/ui_base_switches.h"
|
| #include "ui/base/view_prop.h"
|
| +#include "ui/base/win/dpi.h"
|
| #include "ui/base/win/hwnd_util.h"
|
| #include "ui/base/win/mouse_wheel_util.h"
|
| #include "ui/gfx/canvas.h"
|
| @@ -300,6 +302,13 @@ bool ShouldSendPinchGesture() {
|
| return pinch_allowed;
|
| }
|
|
|
| +void GetScreenInfoForWindow(WebKit::WebScreenInfo* results,
|
| + gfx::NativeViewId id) {
|
| + *results = WebKit::WebScreenInfoFactory::screenInfo(
|
| + gfx::NativeViewFromId(id));
|
| + results->deviceScaleFactor = ui::win::GetDeviceScaleFactor();
|
| +}
|
| +
|
| } // namespace
|
|
|
| const wchar_t kRenderWidgetHostHWNDClass[] = L"Chrome_RenderWidgetHostHWND";
|
| @@ -464,7 +473,7 @@ void RenderWidgetHostViewWin::WasHidden() {
|
| }
|
|
|
| void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) {
|
| - SetBounds(gfx::Rect(GetViewBounds().origin(), size));
|
| + SetBounds(gfx::Rect(GetPixelBounds().origin(), size));
|
| }
|
|
|
| void RenderWidgetHostViewWin::SetBounds(const gfx::Rect& rect) {
|
| @@ -597,6 +606,10 @@ bool RenderWidgetHostViewWin::IsShowing() {
|
| }
|
|
|
| gfx::Rect RenderWidgetHostViewWin::GetViewBounds() const {
|
| + return ui::win::ScreenToDIPRect(GetPixelBounds());
|
| +}
|
| +
|
| +gfx::Rect RenderWidgetHostViewWin::GetPixelBounds() const {
|
| CRect window_rect;
|
| GetWindowRect(&window_rect);
|
| return gfx::Rect(window_rect);
|
| @@ -697,7 +710,7 @@ void RenderWidgetHostViewWin::Redraw() {
|
|
|
| // Send the invalid rect in screen coordinates.
|
| gfx::Rect invalid_screen_rect(damage_bounds);
|
| - invalid_screen_rect.Offset(GetViewBounds().OffsetFromOrigin());
|
| + invalid_screen_rect.Offset(GetPixelBounds().OffsetFromOrigin());
|
|
|
| PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect);
|
| }
|
| @@ -2363,6 +2376,10 @@ void RenderWidgetHostViewWin::AcceleratedPaint(HDC dc) {
|
| accelerated_surface_->Present(dc);
|
| }
|
|
|
| +void RenderWidgetHostViewWin::GetScreenInfo(WebKit::WebScreenInfo* results) {
|
| + GetScreenInfoForWindow(results, GetNativeViewId());
|
| +}
|
| +
|
| gfx::Rect RenderWidgetHostViewWin::GetBoundsInRootWindow() {
|
| RECT window_rect = {0};
|
| HWND root_window = GetAncestor(m_hWnd, GA_ROOT);
|
| @@ -2377,7 +2394,8 @@ gfx::Rect RenderWidgetHostViewWin::GetBoundsInRootWindow() {
|
| rect.Inset(GetSystemMetrics(SM_CXSIZEFRAME),
|
| GetSystemMetrics(SM_CYSIZEFRAME));
|
| }
|
| - return rect;
|
| +
|
| + return ui::win::ScreenToDIPRect(rect);
|
| }
|
|
|
| // Creates a HWND within the RenderWidgetHostView that will serve as a host
|
| @@ -2722,6 +2740,11 @@ void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message,
|
| return;
|
| }
|
|
|
| + gfx::Point point = ui::win::ScreenToDIPPoint(
|
| + gfx::Point(static_cast<short>(LOWORD(lparam)),
|
| + static_cast<short>(HIWORD(lparam))));
|
| + lparam = (point.y() << 16) + point.x();
|
| +
|
| WebMouseEvent event(
|
| WebInputEventFactory::mouseEvent(m_hWnd, message, wparam, lparam));
|
|
|
| @@ -2974,7 +2997,7 @@ LRESULT RenderWidgetHostViewWin::OnQueryCharPosition(
|
| }
|
| ClientToScreen(&target_rect);
|
|
|
| - RECT document_rect = GetViewBounds().ToRECT();
|
| + RECT document_rect = GetPixelBounds().ToRECT();
|
| ClientToScreen(&document_rect);
|
|
|
| position->pt.x = target_rect.left;
|
| @@ -3018,4 +3041,10 @@ RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
|
| return new RenderWidgetHostViewWin(widget);
|
| }
|
|
|
| +// static
|
| +void RenderWidgetHostViewPort::GetDefaultScreenInfo(
|
| + WebKit::WebScreenInfo* results) {
|
| + GetScreenInfoForWindow(results, 0);
|
| +}
|
| +
|
| } // namespace content
|
|
|