OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 ash::WindowResizer::kBoundsChange_Resizes; | 1092 ash::WindowResizer::kBoundsChange_Resizes; |
1093 } | 1093 } |
1094 | 1094 |
1095 gfx::Rect ShellSurface::GetVisibleBounds() const { | 1095 gfx::Rect ShellSurface::GetVisibleBounds() const { |
1096 // Use |geometry_| if set, otherwise use the visual bounds of the surface. | 1096 // Use |geometry_| if set, otherwise use the visual bounds of the surface. |
1097 return geometry_.IsEmpty() ? gfx::Rect(surface_->window()->layer()->size()) | 1097 return geometry_.IsEmpty() ? gfx::Rect(surface_->window()->layer()->size()) |
1098 : geometry_; | 1098 : geometry_; |
1099 } | 1099 } |
1100 | 1100 |
1101 gfx::Point ShellSurface::GetSurfaceOrigin() const { | 1101 gfx::Point ShellSurface::GetSurfaceOrigin() const { |
1102 gfx::Rect window_bounds = widget_->GetNativeWindow()->bounds(); | 1102 gfx::Rect window_bounds = widget_->GetWindowBoundsInScreen(); |
1103 | 1103 |
1104 // If initial bounds were specified then surface origin is always relative | 1104 // If initial bounds were specified then surface origin is always relative |
1105 // to those bounds. | 1105 // to those bounds. |
1106 if (!initial_bounds_.IsEmpty()) | 1106 if (!initial_bounds_.IsEmpty()) |
1107 return initial_bounds_.origin() - window_bounds.OffsetFromOrigin(); | 1107 return initial_bounds_.origin() - window_bounds.OffsetFromOrigin(); |
1108 | 1108 |
1109 gfx::Rect visible_bounds = GetVisibleBounds(); | 1109 gfx::Rect visible_bounds = GetVisibleBounds(); |
1110 switch (resize_component_) { | 1110 switch (resize_component_) { |
1111 case HTCAPTION: | 1111 case HTCAPTION: |
1112 return origin_ - visible_bounds.OffsetFromOrigin(); | 1112 return origin_ - visible_bounds.OffsetFromOrigin(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 shadow_origin -= origin.OffsetFromOrigin(); | 1224 shadow_origin -= origin.OffsetFromOrigin(); |
1225 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); | 1225 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); |
1226 | 1226 |
1227 shadow_overlay_->SetBounds(shadow_bounds); | 1227 shadow_overlay_->SetBounds(shadow_bounds); |
1228 shadow_underlay_->SetBounds(shadow_bounds); | 1228 shadow_underlay_->SetBounds(shadow_bounds); |
1229 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1229 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
1230 } | 1230 } |
1231 } | 1231 } |
1232 | 1232 |
1233 } // namespace exo | 1233 } // namespace exo |
OLD | NEW |