| 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 18 matching lines...) Expand all Loading... |
| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 CleanupGestureRecognizerState(*iter); | 764 CleanupGestureRecognizerState(*iter); |
| 765 } | 765 } |
| 766 } | 766 } |
| 767 | 767 |
| 768 void RootWindow::UpdateWindowSize(const gfx::Size& host_size) { | 768 void RootWindow::UpdateWindowSize(const gfx::Size& host_size) { |
| 769 gfx::Rect bounds(host_size); | 769 gfx::Rect bounds(host_size); |
| 770 bounds.Inset(host_->GetInsets()); | 770 bounds.Inset(host_->GetInsets()); |
| 771 bounds = ui::ConvertRectToDIP(layer(), bounds); | 771 bounds = ui::ConvertRectToDIP(layer(), bounds); |
| 772 gfx::RectF new_bounds(bounds); | 772 gfx::RectF new_bounds(bounds); |
| 773 layer()->transform().TransformRect(&new_bounds); | 773 layer()->transform().TransformRect(&new_bounds); |
| 774 | |
| 775 // It makes little sense to scale beyond the original | 774 // It makes little sense to scale beyond the original |
| 776 // resolution. | 775 // resolution. |
| 777 DCHECK_LE(root_window_scale_, GetDeviceScaleFactor()); | 776 DCHECK_LE(root_window_scale_, GetDeviceScaleFactor()); |
| 778 // Apply |root_window_scale_| twice as the downscaling | 777 // Apply |root_window_scale_| twice as the downscaling |
| 779 // is already applied once in |SetTransformInternal()|. | 778 // is already applied once in |SetTransformInternal()|. |
| 780 // TODO(oshima): This is a bit ugly. Consider specifying | 779 // TODO(oshima): This is a bit ugly. Consider specifying |
| 781 // the pseudo host resolution instead. | 780 // the pseudo host resolution instead. |
| 782 new_bounds.Scale(root_window_scale_ * root_window_scale_); | 781 new_bounds.Scale(root_window_scale_ * root_window_scale_); |
| 783 // Ignore the origin because RootWindow's insets are handled by | 782 // Ignore the origin because RootWindow's insets are handled by |
| 784 // the transform. | 783 // the transform. |
| 785 SetBounds(gfx::Rect(gfx::ToNearestRect(new_bounds).size())); | 784 // Round the size because the bounds is no longer aligned to |
| 785 // backing pixel when |root_window_scale_| is specified |
| 786 // (850 height at 1.25 scale becomes 1062.5 for example.) |
| 787 SetBounds(gfx::Rect(gfx::ToRoundedSize(new_bounds.size()))); |
| 786 } | 788 } |
| 787 | 789 |
| 788 void RootWindow::OnWindowAddedToRootWindow(Window* attached) { | 790 void RootWindow::OnWindowAddedToRootWindow(Window* attached) { |
| 789 if (attached->IsVisible() && | 791 if (attached->IsVisible() && |
| 790 attached->ContainsPointInRoot(GetLastMouseLocationInRoot())) | 792 attached->ContainsPointInRoot(GetLastMouseLocationInRoot())) |
| 791 PostMouseMoveEventAfterWindowChange(); | 793 PostMouseMoveEventAfterWindowChange(); |
| 792 } | 794 } |
| 793 | 795 |
| 794 bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) { | 796 bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) { |
| 795 return event_dispatch_target_ == target; | 797 return event_dispatch_target_ == target; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 // currently broken. See/ crbug.com/107931. | 1100 // currently broken. See/ crbug.com/107931. |
| 1099 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1101 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
| 1100 orig_mouse_location, | 1102 orig_mouse_location, |
| 1101 orig_mouse_location, | 1103 orig_mouse_location, |
| 1102 ui::EF_IS_SYNTHESIZED); | 1104 ui::EF_IS_SYNTHESIZED); |
| 1103 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1105 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
| 1104 OnHostMouseEvent(&event); | 1106 OnHostMouseEvent(&event); |
| 1105 } | 1107 } |
| 1106 | 1108 |
| 1107 } // namespace aura | 1109 } // namespace aura |
| OLD | NEW |