Index: ash/display/display_util.cc |
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc |
index 2bb842eb2d704cc6f18e1e8ecf604f5dcc39333f..48827004896d3e5b7c20dedae221a8a31c1583b7 100644 |
--- a/ash/display/display_util.cc |
+++ b/ash/display/display_util.cc |
@@ -10,6 +10,7 @@ |
#include "ash/display/display_manager.h" |
#include "ash/host/ash_window_tree_host.h" |
#include "ash/shell.h" |
+#include "ash/wm/window_util.h" |
Jun Mukai
2015/05/12 17:08:46
Is this necessary?
oshima
2015/05/12 18:24:25
Done.
|
#include "ui/aura/env.h" |
#include "ui/aura/window_tree_host.h" |
#include "ui/gfx/geometry/point.h" |
@@ -164,31 +165,21 @@ gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host, |
aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
gfx::Rect native_bounds = host->GetBounds(); |
native_bounds.Inset(ash_host->GetHostInsets()); |
- |
- bool vertical = bounds_in_screen.width() < bounds_in_screen.height(); |
- gfx::Point start_in_native; |
- gfx::Point end_in_native; |
- |
- if (vertical) { |
- start_in_native = bounds_in_screen.origin(); |
- end_in_native = start_in_native; |
- end_in_native.set_y(bounds_in_screen.bottom()); |
- } else { |
- start_in_native = bounds_in_screen.origin(); |
- end_in_native = start_in_native; |
- end_in_native.set_x(bounds_in_screen.right()); |
- } |
+ gfx::Point start_in_native = bounds_in_screen.origin(); |
+ gfx::Point end_in_native(bounds_in_screen.right(), bounds_in_screen.bottom()); |
Jun Mukai
2015/05/12 17:08:46
nit: end_in_native = bounds_in_screen.bottom_right
oshima
2015/05/12 18:24:25
Done.
|
ConvertPointFromScreenToNative(host, &start_in_native); |
ConvertPointFromScreenToNative(host, &end_in_native); |
- if (vertical) { |
+ |
+ if (std::abs(start_in_native.x() - end_in_native.x()) < |
+ std::abs(start_in_native.y() - end_in_native.y())) { |
// vertical in native |
int x = std::abs(native_bounds.x() - start_in_native.x()) < |
std::abs(native_bounds.right() - start_in_native.x()) |
? native_bounds.x() |
: native_bounds.right() - 1; |
return gfx::Rect(x, std::min(start_in_native.y(), end_in_native.y()), 1, |
- end_in_native.y() - start_in_native.y()); |
+ std::abs(end_in_native.y() - start_in_native.y())); |
} else { |
// horizontal in native |
int y = std::abs(native_bounds.y() - start_in_native.y()) < |
@@ -196,7 +187,7 @@ gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host, |
? native_bounds.y() |
: native_bounds.bottom() - 1; |
return gfx::Rect(std::min(start_in_native.x(), end_in_native.x()), y, |
- end_in_native.x() - start_in_native.x(), 1); |
+ std::abs(end_in_native.x() - start_in_native.x()), 1); |
} |
} |