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

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

Issue 1679393002: Multiple DPI Tracking for ScreenWin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback EXCEPT rect_util Rename Created 4 years, 10 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
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_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 13 matching lines...) Expand all
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "base/win/wrapped_window_proc.h" 25 #include "base/win/wrapped_window_proc.h"
26 #include "content/browser/plugin_process_host.h" 26 #include "content/browser/plugin_process_host.h"
27 #include "content/browser/plugin_service_impl.h" 27 #include "content/browser/plugin_service_impl.h"
28 #include "content/common/plugin_constants_win.h" 28 #include "content/common/plugin_constants_win.h"
29 #include "content/common/webplugin_geometry.h" 29 #include "content/common/webplugin_geometry.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/child_process_data.h" 31 #include "content/public/browser/child_process_data.h"
32 #include "content/public/common/content_switches.h" 32 #include "content/public/common/content_switches.h"
33 #include "ui/gfx/gdi_util.h" 33 #include "ui/gfx/gdi_util.h"
34 #include "ui/gfx/win/dpi.h" 34 #include "ui/gfx/screen_win.h"
35 #include "ui/gfx/win/hwnd_util.h" 35 #include "ui/gfx/win/hwnd_util.h"
36 #endif 36 #endif
37 37
38 namespace content { 38 namespace content {
39 39
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 41
42 namespace { 42 namespace {
43 43
44 // |window| is the plugin HWND, created and destroyed in the plugin process. 44 // |window| is the plugin HWND, created and destroyed in the plugin process.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 base::Bind(&NotifyPluginProcessHostHelper, window, new_parent, 144 base::Bind(&NotifyPluginProcessHostHelper, window, new_parent,
145 kMaxTries)); 145 kMaxTries));
146 return new_parent; 146 return new_parent;
147 } 147 }
148 148
149 BOOL CALLBACK PaintEnumChildProc(HWND hwnd, LPARAM lparam) { 149 BOOL CALLBACK PaintEnumChildProc(HWND hwnd, LPARAM lparam) {
150 if (!PluginServiceImpl::GetInstance()->IsPluginWindow(hwnd)) 150 if (!PluginServiceImpl::GetInstance()->IsPluginWindow(hwnd))
151 return TRUE; 151 return TRUE;
152 152
153 gfx::Rect* rect = reinterpret_cast<gfx::Rect*>(lparam); 153 gfx::Rect* rect = reinterpret_cast<gfx::Rect*>(lparam);
154 gfx::Rect rect_in_pixels = gfx::win::DIPToScreenRect(*rect); 154 gfx::Rect rect_in_pixels = gfx::ScreenWin::DIPToScreenRect(hwnd, *rect);
155 static UINT msg = RegisterWindowMessage(kPaintMessageName); 155 static UINT msg = RegisterWindowMessage(kPaintMessageName);
156 WPARAM wparam = MAKEWPARAM(rect_in_pixels.x(), rect_in_pixels.y()); 156 WPARAM wparam = MAKEWPARAM(rect_in_pixels.x(), rect_in_pixels.y());
157 lparam = MAKELPARAM(rect_in_pixels.width(), rect_in_pixels.height()); 157 lparam = MAKELPARAM(rect_in_pixels.width(), rect_in_pixels.height());
158 158
159 // SendMessage gets the message across much quicker than PostMessage, since it 159 // SendMessage gets the message across much quicker than PostMessage, since it
160 // doesn't get queued. When the plugin thread calls PeekMessage or other 160 // doesn't get queued. When the plugin thread calls PeekMessage or other
161 // Win32 APIs, sent messages are dispatched automatically. 161 // Win32 APIs, sent messages are dispatched automatically.
162 SendNotifyMessage(hwnd, msg, wparam, lparam); 162 SendNotifyMessage(hwnd, msg, wparam, lparam);
163 163
164 return TRUE; 164 return TRUE;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // if Windows tries to paint it synchronously inside EndDeferWindowsPos 258 // if Windows tries to paint it synchronously inside EndDeferWindowsPos
259 // then it won't have the data and it will flash white. So instead we 259 // then it won't have the data and it will flash white. So instead we
260 // manually redraw the plugin. 260 // manually redraw the plugin.
261 // Why not do this for native Windows? Not sure if there are any 261 // Why not do this for native Windows? Not sure if there are any
262 // performance issues with this. 262 // performance issues with this.
263 flags |= SWP_NOREDRAW; 263 flags |= SWP_NOREDRAW;
264 } 264 }
265 #endif 265 #endif
266 266
267 if (move.rects_valid) { 267 if (move.rects_valid) {
268 gfx::Rect clip_rect_in_pixel = gfx::win::DIPToScreenRect(move.clip_rect); 268 gfx::Rect clip_rect_in_pixel =
269 gfx::ScreenWin::DIPToScreenRect(window, move.clip_rect);
269 HRGN hrgn = ::CreateRectRgn(clip_rect_in_pixel.x(), 270 HRGN hrgn = ::CreateRectRgn(clip_rect_in_pixel.x(),
270 clip_rect_in_pixel.y(), 271 clip_rect_in_pixel.y(),
271 clip_rect_in_pixel.right(), 272 clip_rect_in_pixel.right(),
272 clip_rect_in_pixel.bottom()); 273 clip_rect_in_pixel.bottom());
273 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects); 274 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects);
274 275
275 // Note: System will own the hrgn after we call SetWindowRgn, 276 // Note: System will own the hrgn after we call SetWindowRgn,
276 // so we don't need to call DeleteObject(hrgn) 277 // so we don't need to call DeleteObject(hrgn)
277 ::SetWindowRgn(window, hrgn, 278 ::SetWindowRgn(window, hrgn,
278 !move.clip_rect.IsEmpty() && (flags & SWP_NOREDRAW) == 0); 279 !move.clip_rect.IsEmpty() && (flags & SWP_NOREDRAW) == 0);
279 280
280 #if defined(USE_AURA) 281 #if defined(USE_AURA)
281 // When using the software compositor, if the clipping rectangle is empty 282 // When using the software compositor, if the clipping rectangle is empty
282 // then DeferWindowPos won't redraw the newly uncovered area under the 283 // then DeferWindowPos won't redraw the newly uncovered area under the
283 // plugin. 284 // plugin.
284 if (clip_rect_in_pixel.IsEmpty() && 285 if (clip_rect_in_pixel.IsEmpty() &&
285 !GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) { 286 !GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) {
286 RECT r; 287 RECT r;
287 GetClientRect(window, &r); 288 GetClientRect(window, &r);
288 MapWindowPoints(window, parent, reinterpret_cast<POINT*>(&r), 2); 289 MapWindowPoints(window, parent, reinterpret_cast<POINT*>(&r), 2);
289 invalidate_rects.push_back(r); 290 invalidate_rects.push_back(r);
290 } 291 }
291 #endif 292 #endif
292 } else { 293 } else {
293 flags |= SWP_NOMOVE; 294 flags |= SWP_NOMOVE;
294 flags |= SWP_NOSIZE; 295 flags |= SWP_NOSIZE;
295 } 296 }
296 297
297 gfx::Rect window_rect_in_pixel = 298 gfx::Rect window_rect_in_pixel =
298 gfx::win::DIPToScreenRect(move.window_rect); 299 gfx::ScreenWin::DIPToScreenRect(window, move.window_rect);
299 defer_window_pos_info = ::DeferWindowPos(defer_window_pos_info, 300 defer_window_pos_info = ::DeferWindowPos(defer_window_pos_info,
300 window, NULL, 301 window, NULL,
301 window_rect_in_pixel.x(), 302 window_rect_in_pixel.x(),
302 window_rect_in_pixel.y(), 303 window_rect_in_pixel.y(),
303 window_rect_in_pixel.width(), 304 window_rect_in_pixel.width(),
304 window_rect_in_pixel.height(), 305 window_rect_in_pixel.height(),
305 flags); 306 flags);
306 307
307 if (!defer_window_pos_info) { 308 if (!defer_window_pos_info) {
308 DCHECK(false) << "DeferWindowPos failed, so all plugin moves ignored."; 309 DCHECK(false) << "DeferWindowPos failed, so all plugin moves ignored.";
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 } 696 }
696 697
697 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( 698 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace(
698 const gfx::Point& point, 699 const gfx::Point& point,
699 cc::SurfaceId original_surface, 700 cc::SurfaceId original_surface,
700 gfx::Point* transformed_point) { 701 gfx::Point* transformed_point) {
701 *transformed_point = point; 702 *transformed_point = point;
702 } 703 }
703 704
704 } // namespace content 705 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/child/npapi/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698