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

Side by Side Diff: ui/aura/root_window.cc

Issue 12848004: Add shortcut keys to ui scaling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 18 matching lines...) Expand all
29 #include "ui/base/gestures/gesture_types.h" 29 #include "ui/base/gestures/gesture_types.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/base/view_prop.h" 31 #include "ui/base/view_prop.h"
32 #include "ui/compositor/compositor.h" 32 #include "ui/compositor/compositor.h"
33 #include "ui/compositor/dip_util.h" 33 #include "ui/compositor/dip_util.h"
34 #include "ui/compositor/layer.h" 34 #include "ui/compositor/layer.h"
35 #include "ui/compositor/layer_animator.h" 35 #include "ui/compositor/layer_animator.h"
36 #include "ui/gfx/display.h" 36 #include "ui/gfx/display.h"
37 #include "ui/gfx/point3_f.h" 37 #include "ui/gfx/point3_f.h"
38 #include "ui/gfx/point_conversions.h" 38 #include "ui/gfx/point_conversions.h"
39 #include "ui/gfx/rect_conversions.h"
40 #include "ui/gfx/screen.h" 39 #include "ui/gfx/screen.h"
40 #include "ui/gfx/size_conversions.h"
41 41
42 using std::vector; 42 using std::vector;
43 43
44 namespace aura { 44 namespace aura {
45 45
46 namespace { 46 namespace {
47 47
48 const char kRootWindowForAcceleratedWidget[] = 48 const char kRootWindowForAcceleratedWidget[] =
49 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; 49 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__";
50 50
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 CleanupGestureRecognizerState(*iter); 752 CleanupGestureRecognizerState(*iter);
753 } 753 }
754 } 754 }
755 755
756 void RootWindow::UpdateWindowSize(const gfx::Size& host_size) { 756 void RootWindow::UpdateWindowSize(const gfx::Size& host_size) {
757 gfx::Rect bounds(host_size); 757 gfx::Rect bounds(host_size);
758 bounds.Inset(host_->GetInsets()); 758 bounds.Inset(host_->GetInsets());
759 bounds = ui::ConvertRectToDIP(layer(), bounds); 759 bounds = ui::ConvertRectToDIP(layer(), bounds);
760 gfx::RectF new_bounds(bounds); 760 gfx::RectF new_bounds(bounds);
761 layer()->transform().TransformRect(&new_bounds); 761 layer()->transform().TransformRect(&new_bounds);
762
763 // It makes little sense to scale beyond the original 762 // It makes little sense to scale beyond the original
764 // resolution. 763 // resolution.
765 DCHECK_LE(root_window_scale_, GetDeviceScaleFactor()); 764 DCHECK_LE(root_window_scale_, GetDeviceScaleFactor());
766 // Apply |root_window_scale_| twice as the downscaling 765 // Apply |root_window_scale_| twice as the downscaling
767 // is already applied once in |SetTransformInternal()|. 766 // is already applied once in |SetTransformInternal()|.
768 // TODO(oshima): This is a bit ugly. Consider specifying 767 // TODO(oshima): This is a bit ugly. Consider specifying
769 // the pseudo host resolution instead. 768 // the pseudo host resolution instead.
770 new_bounds.Scale(root_window_scale_ * root_window_scale_); 769 new_bounds.Scale(root_window_scale_ * root_window_scale_);
771 // Ignore the origin because RootWindow's insets are handled by 770 // Ignore the origin because RootWindow's insets are handled by
772 // the transform. 771 // the transform.
773 SetBounds(gfx::Rect(gfx::ToNearestRect(new_bounds).size())); 772 // Round the size because the bounds is no longer aligned to
773 // backing pixel when |root_window_scale_| is specified
774 // (850 height at 1.25 scale becomes 1062.5 for example.)
775 SetBounds(gfx::Rect(gfx::ToRoundedSize(new_bounds.size())));
774 } 776 }
775 777
776 void RootWindow::OnWindowAddedToRootWindow(Window* attached) { 778 void RootWindow::OnWindowAddedToRootWindow(Window* attached) {
777 if (attached->IsVisible() && 779 if (attached->IsVisible() &&
778 attached->ContainsPointInRoot(GetLastMouseLocationInRoot())) 780 attached->ContainsPointInRoot(GetLastMouseLocationInRoot()))
779 PostMouseMoveEventAfterWindowChange(); 781 PostMouseMoveEventAfterWindowChange();
780 } 782 }
781 783
782 bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) { 784 bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) {
783 return event_dispatch_target_ == target; 785 return event_dispatch_target_ == target;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // currently broken. See/ crbug.com/107931. 1090 // currently broken. See/ crbug.com/107931.
1089 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 1091 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
1090 orig_mouse_location, 1092 orig_mouse_location,
1091 orig_mouse_location, 1093 orig_mouse_location,
1092 ui::EF_IS_SYNTHESIZED); 1094 ui::EF_IS_SYNTHESIZED);
1093 event.set_system_location(Env::GetInstance()->last_mouse_location()); 1095 event.set_system_location(Env::GetInstance()->last_mouse_location());
1094 OnHostMouseEvent(&event); 1096 OnHostMouseEvent(&event);
1095 } 1097 }
1096 1098
1097 } // namespace aura 1099 } // namespace aura
OLDNEW
« ash/display/display_manager.cc ('K') | « chrome/browser/about_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698