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

Unified Diff: ui/views/controls/native/native_view_host.cc

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/drag_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/native/native_view_host.cc
diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
index 736ff6125b9ea17d82599d8e2308de1d201c351e..3b5b18b1cc940c053666557e689d5f7fe1467bc8 100644
--- a/ui/views/controls/native/native_view_host.cc
+++ b/ui/views/controls/native/native_view_host.cc
@@ -5,6 +5,7 @@
#include "ui/views/controls/native/native_view_host.h"
#include "base/logging.h"
+#include "ui/base/win/dpi.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/native/native_view_host_wrapper.h"
#include "ui/views/widget/widget.h"
@@ -99,7 +100,15 @@ void NativeViewHost::Layout() {
// positioned in the coordinate system of the Widget, not the current
// view. Also, they should be positioned respecting the border insets
// of the native view.
- gfx::Rect local_bounds = ConvertRectToWidget(GetContentsBounds());
+ gfx::Rect contents_bounds = GetContentsBounds();
+#if defined(ENABLE_HIDPI)
+ // TODO: This code probably needs to be copied into the fast_resize handler, above.
+ static float dpi_scale = ui::GetDPIScale();
+ contents_bounds.SetRect(dpi_scale * contents_bounds.x(),
+ dpi_scale * contents_bounds.y(), dpi_scale * contents_bounds.width(),
+ dpi_scale * contents_bounds.height());
+#endif
+ gfx::Rect local_bounds = ConvertRectToWidget(contents_bounds);
native_wrapper_->ShowWidget(local_bounds.x(), local_bounds.y(),
local_bounds.width(),
local_bounds.height());
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698