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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 12317157: Fix touch scaling for high dpi windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding extra safety logic to address XP failure. Created 7 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/base/win/dpi.h » ('j') | ui/base/win/dpi.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_win.h" 5 #include "content/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <InputScope.h> 7 #include <InputScope.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 &touch_event_.touches[touch_event_.touchesLength++]; 2065 &touch_event_.touches[touch_event_.touchesLength++];
2066 point->state = WebKit::WebTouchPoint::StatePressed; 2066 point->state = WebKit::WebTouchPoint::StatePressed;
2067 point->id = GetMappedTouch(touch_input->dwID); 2067 point->id = GetMappedTouch(touch_input->dwID);
2068 UpdateTouchPoint(point, touch_input); 2068 UpdateTouchPoint(point, touch_input);
2069 return point; 2069 return point;
2070 } 2070 }
2071 2071
2072 bool WebTouchState::UpdateTouchPoint( 2072 bool WebTouchState::UpdateTouchPoint(
2073 WebKit::WebTouchPoint* touch_point, 2073 WebKit::WebTouchPoint* touch_point,
2074 TOUCHINPUT* touch_input) { 2074 TOUCHINPUT* touch_input) {
2075 CPoint coordinates(TOUCH_COORD_TO_PIXEL(touch_input->x), 2075 CPoint coordinates(
2076 TOUCH_COORD_TO_PIXEL(touch_input->y)); 2076 TOUCH_COORD_TO_PIXEL(touch_input->x) / ui::win::GetDPIScaleFromRegistry(),
2077 TOUCH_COORD_TO_PIXEL(touch_input->y) / ui::win::GetDPIScaleFromRegistry());
2077 int radius_x = 1; 2078 int radius_x = 1;
2078 int radius_y = 1; 2079 int radius_y = 1;
2079 if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) { 2080 if (touch_input->dwMask & TOUCHINPUTMASKF_CONTACTAREA) {
2080 radius_x = TOUCH_COORD_TO_PIXEL(touch_input->cxContact); 2081 radius_x = TOUCH_COORD_TO_PIXEL(touch_input->cxContact);
2081 radius_y = TOUCH_COORD_TO_PIXEL(touch_input->cyContact); 2082 radius_y = TOUCH_COORD_TO_PIXEL(touch_input->cyContact);
2082 } 2083 }
2083 2084
2084 // Detect and exclude stationary moves. 2085 // Detect and exclude stationary moves.
2085 if (GetTouchType(*touch_input) == TOUCHEVENTF_MOVE && 2086 if (GetTouchType(*touch_input) == TOUCHEVENTF_MOVE &&
2086 touch_point->screenPosition.x == coordinates.x && 2087 touch_point->screenPosition.x == coordinates.x &&
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 2134
2134 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total, 2135 if (!total || !GetTouchInputInfo((HTOUCHINPUT)lparam, total,
2135 points, sizeof(TOUCHINPUT))) { 2136 points, sizeof(TOUCHINPUT))) {
2136 TRACE_EVENT0("browser", "EarlyOut_NothingToDo"); 2137 TRACE_EVENT0("browser", "EarlyOut_NothingToDo");
2137 return 0; 2138 return 0;
2138 } 2139 }
2139 2140
2140 if (total == 1 && (points[0].dwFlags & TOUCHEVENTF_DOWN)) { 2141 if (total == 1 && (points[0].dwFlags & TOUCHEVENTF_DOWN)) {
2141 pointer_down_context_ = true; 2142 pointer_down_context_ = true;
2142 last_touch_location_ = gfx::Point( 2143 last_touch_location_ = gfx::Point(
2143 TOUCH_COORD_TO_PIXEL(points[0].x), 2144 TOUCH_COORD_TO_PIXEL(points[0].x) / ui::win::GetDPIScaleFromRegistry(),
2144 TOUCH_COORD_TO_PIXEL(points[0].y)); 2145 TOUCH_COORD_TO_PIXEL(points[0].y) / ui::win::GetDPIScaleFromRegistry());
2145 } 2146 }
2146 2147
2147 bool should_forward = render_widget_host_->ShouldForwardTouchEvent() && 2148 bool should_forward = render_widget_host_->ShouldForwardTouchEvent() &&
2148 touch_events_enabled_; 2149 touch_events_enabled_;
2149 2150
2150 // Send a copy of the touch events on to the gesture recognizer. 2151 // Send a copy of the touch events on to the gesture recognizer.
2151 for (size_t start = 0; start < total;) { 2152 for (size_t start = 0; start < total;) {
2152 start += touch_state_->UpdateTouchPoints(points + start, total - start); 2153 start += touch_state_->UpdateTouchPoints(points + start, total - start);
2153 if (should_forward) { 2154 if (should_forward) {
2154 if (touch_state_->is_changed()) 2155 if (touch_state_->is_changed())
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 return new RenderWidgetHostViewWin(widget); 3091 return new RenderWidgetHostViewWin(widget);
3091 } 3092 }
3092 3093
3093 // static 3094 // static
3094 void RenderWidgetHostViewPort::GetDefaultScreenInfo( 3095 void RenderWidgetHostViewPort::GetDefaultScreenInfo(
3095 WebKit::WebScreenInfo* results) { 3096 WebKit::WebScreenInfo* results) {
3096 GetScreenInfoForWindow(results, 0); 3097 GetScreenInfoForWindow(results, 0);
3097 } 3098 }
3098 3099
3099 } // namespace content 3100 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/base/win/dpi.h » ('j') | ui/base/win/dpi.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698