Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Unified Diff: content/browser/renderer_host/legacy_render_widget_host_win.cc

Issue 1283913002: Improve scroll performance on Windows 10 with high precision touchpads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8dcdaf63c98cd899bbae46fbbcb7a77e848774ce 100644
--- a/content/browser/renderer_host/legacy_render_widget_host_win.cc
+++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc
@@ -18,6 +18,7 @@
#include "ui/base/win/internal_constants.h"
#include "ui/base/win/window_event_target.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/win/direct_manipulation.h"
#include "ui/gfx/win/dpi.h"
namespace content {
@@ -75,6 +76,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 +89,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 +131,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_ =
+ gfx::win::DirectManipulationHelper::CreateInstance();
+ if (direct_manipulation_helper_)
+ direct_manipulation_helper_->Initialize(hwnd());
+
return !!SUCCEEDED(hr);
}
@@ -242,6 +254,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;
}

Powered by Google App Engine
This is Rietveld 408576698