OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #include "ui/base/gestures/gesture_types.h" | 32 #include "ui/base/gestures/gesture_types.h" |
33 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
34 #include "ui/base/view_prop.h" | 34 #include "ui/base/view_prop.h" |
35 #include "ui/compositor/compositor.h" | 35 #include "ui/compositor/compositor.h" |
36 #include "ui/compositor/dip_util.h" | 36 #include "ui/compositor/dip_util.h" |
37 #include "ui/compositor/layer.h" | 37 #include "ui/compositor/layer.h" |
38 #include "ui/compositor/layer_animator.h" | 38 #include "ui/compositor/layer_animator.h" |
39 #include "ui/gfx/display.h" | 39 #include "ui/gfx/display.h" |
40 #include "ui/gfx/point3_f.h" | 40 #include "ui/gfx/point3_f.h" |
41 #include "ui/gfx/point_conversions.h" | 41 #include "ui/gfx/point_conversions.h" |
| 42 #include "ui/gfx/rect_f.h" |
| 43 #include "ui/gfx/rect_conversions.h" |
42 #include "ui/gfx/screen.h" | 44 #include "ui/gfx/screen.h" |
43 | 45 |
44 using std::vector; | 46 using std::vector; |
45 | 47 |
46 namespace aura { | 48 namespace aura { |
47 | 49 |
48 namespace { | 50 namespace { |
49 | 51 |
50 const char kRootWindowForAcceleratedWidget[] = | 52 const char kRootWindowForAcceleratedWidget[] = |
51 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; | 53 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 916 |
915 void RootWindow::OnHostResized(const gfx::Size& size) { | 917 void RootWindow::OnHostResized(const gfx::Size& size) { |
916 DispatchHeldMouseMove(); | 918 DispatchHeldMouseMove(); |
917 // The compositor should have the same size as the native root window host. | 919 // The compositor should have the same size as the native root window host. |
918 // Get the latest scale from display because it might have been changed. | 920 // Get the latest scale from display because it might have been changed. |
919 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this), | 921 compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this), |
920 size); | 922 size); |
921 gfx::Size old(bounds().size()); | 923 gfx::Size old(bounds().size()); |
922 // The layer, and all the observers should be notified of the | 924 // The layer, and all the observers should be notified of the |
923 // transformed size of the root window. | 925 // transformed size of the root window. |
924 gfx::Rect bounds(ui::ConvertSizeToDIP(layer(), size)); | 926 gfx::RectF bounds(ui::ConvertSizeToDIP(layer(), size)); |
925 layer()->transform().TransformRect(&bounds); | 927 layer()->transform().TransformRect(&bounds); |
926 SetBounds(bounds); | 928 SetBounds(gfx::ToEnclosingRect(bounds)); |
927 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 929 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
928 OnRootWindowResized(this, old)); | 930 OnRootWindowResized(this, old)); |
929 } | 931 } |
930 | 932 |
931 float RootWindow::GetDeviceScaleFactor() { | 933 float RootWindow::GetDeviceScaleFactor() { |
932 return compositor()->device_scale_factor(); | 934 return compositor()->device_scale_factor(); |
933 } | 935 } |
934 | 936 |
935 RootWindow* RootWindow::AsRootWindow() { | 937 RootWindow* RootWindow::AsRootWindow() { |
936 return this; | 938 return this; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1031 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
1030 orig_mouse_location, | 1032 orig_mouse_location, |
1031 orig_mouse_location, | 1033 orig_mouse_location, |
1032 ui::EF_IS_SYNTHESIZED); | 1034 ui::EF_IS_SYNTHESIZED); |
1033 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1035 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
1034 OnHostMouseEvent(&event); | 1036 OnHostMouseEvent(&event); |
1035 #endif | 1037 #endif |
1036 } | 1038 } |
1037 | 1039 |
1038 } // namespace aura | 1040 } // namespace aura |
OLD | NEW |