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

Unified Diff: trunk/src/ash/root_window_controller.cc

Issue 108343005: Revert 240542 "Make sure the dragged window is smaller than work..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | trunk/src/ash/root_window_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ash/root_window_controller.cc
===================================================================
--- trunk/src/ash/root_window_controller.cc (revision 240586)
+++ trunk/src/ash/root_window_controller.cc (working copy)
@@ -51,7 +51,6 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/tooltip_client.h"
-#include "ui/aura/client/window_types.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
@@ -98,46 +97,15 @@
return container;
}
-float ToRelativeValue(int value, int src, int dst) {
- return static_cast<float>(value) / static_cast<float>(src) * dst;
-}
-
-void MoveOriginRelativeToSize(const gfx::Size& src_size,
- const gfx::Size& dst_size,
- gfx::Rect* bounds_in_out) {
- gfx::Point origin = bounds_in_out->origin();
- bounds_in_out->set_origin(gfx::Point(
- ToRelativeValue(origin.x(), src_size.width(), dst_size.width()),
- ToRelativeValue(origin.y(), src_size.height(), dst_size.height())));
-}
-
// Reparents |window| to |new_parent|.
void ReparentWindow(aura::Window* window, aura::Window* new_parent) {
- const gfx::Size src_size = window->parent()->bounds().size();
- const gfx::Size dst_size = new_parent->bounds().size();
// Update the restore bounds to make it relative to the display.
wm::WindowState* state = wm::GetWindowState(window);
gfx::Rect restore_bounds;
bool has_restore_bounds = state->HasRestoreBounds();
-
- // TODO(oshima): snapped state should be handled by the layout manager.
- bool update_bounds = state->IsNormalShowState() || state->IsMinimized();
- gfx::Rect local_bounds;
- if (update_bounds) {
- local_bounds = state->window()->bounds();
- MoveOriginRelativeToSize(src_size, dst_size, &local_bounds);
- }
-
- if (has_restore_bounds) {
+ if (has_restore_bounds)
restore_bounds = state->GetRestoreBoundsInParent();
- MoveOriginRelativeToSize(src_size, dst_size, &restore_bounds);
- }
-
new_parent->AddChild(window);
-
- if (update_bounds)
- window->SetBounds(local_bounds);
-
if (has_restore_bounds)
state->SetRestoreBoundsInParent(restore_bounds);
}
« no previous file with comments | « no previous file | trunk/src/ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698