Index: content/browser/renderer_host/legacy_render_widget_host_win.cc |
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc |
index 5126ad2bc2da97d1c829ad9f6913ecaeb5de0424..af9d6b229e1802bf5b3f3378a92ab283a5c8bff5 100644 |
--- a/content/browser/renderer_host/legacy_render_widget_host_win.cc |
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc |
@@ -75,6 +75,8 @@ HWND LegacyRenderWidgetHostHWND::GetParent() { |
void LegacyRenderWidgetHostHWND::Show() { |
::ShowWindow(hwnd(), SW_SHOW); |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->Activate(hwnd()); |
} |
void LegacyRenderWidgetHostHWND::Hide() { |
@@ -86,6 +88,8 @@ void LegacyRenderWidgetHostHWND::SetBounds(const gfx::Rect& bounds) { |
::SetWindowPos(hwnd(), NULL, bounds_in_pixel.x(), bounds_in_pixel.y(), |
bounds_in_pixel.width(), bounds_in_pixel.height(), |
SWP_NOREDRAW); |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->SetBounds(bounds_in_pixel); |
} |
void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { |
@@ -126,6 +130,13 @@ bool LegacyRenderWidgetHostHWND::Init() { |
CHILDID_SELF); |
} |
+ // Direct Manipulation is enabled on Windows 10+. The CreateInstance function |
+ // returns NULL if Direct Manipulation is not available. |
+ direct_manipulation_helper_.reset( |
+ gfx::win::DirectManipulationHelper::CreateInstance()); |
+ if (direct_manipulation_helper_) |
+ direct_manipulation_helper_->Initialize(hwnd()); |
+ |
return !!SUCCEEDED(hr); |
} |
@@ -242,6 +253,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, |
handled = TRUE; |
} |
} |
+ |
+ if (direct_manipulation_helper_ && |
+ (message == WM_MOUSEWHEEL || message == WM_MOUSEHWHEEL)) { |
+ direct_manipulation_helper_->HandleMouseWheel(hwnd(), message, w_param, |
+ l_param); |
+ } |
return ret; |
} |