Commit 47fde80a authored by varkha@chromium.org's avatar varkha@chromium.org

Prevents crash when docking a detached panel while fullscreen window is active

BUG=344909
TEST=Manual - follow steps in the bug.

Review URL: https://codereview.chromium.org/172243005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252155 0039d316-1c4b-4281-b951-d872f2087c98
parent fbb8a259
...@@ -301,8 +301,11 @@ struct CompareMinimumHeight { ...@@ -301,8 +301,11 @@ struct CompareMinimumHeight {
// Half of |delta| is used as a transition point at which windows could ideally // Half of |delta| is used as a transition point at which windows could ideally
// swap positions. // swap positions.
struct CompareWindowPos { struct CompareWindowPos {
CompareWindowPos(aura::Window* dragged_window, float delta) CompareWindowPos(aura::Window* dragged_window,
aura::Window* docked_container,
float delta)
: dragged_window_(dragged_window), : dragged_window_(dragged_window),
docked_container_(docked_container),
delta_(delta / 2) {} delta_(delta / 2) {}
bool operator()(WindowWithHeight window_with_height1, bool operator()(WindowWithHeight window_with_height1,
...@@ -312,9 +315,9 @@ struct CompareWindowPos { ...@@ -312,9 +315,9 @@ struct CompareWindowPos {
aura::Window* win1(window_with_height1.window()); aura::Window* win1(window_with_height1.window());
aura::Window* win2(window_with_height2.window()); aura::Window* win2(window_with_height2.window());
gfx::Rect win1_bounds = ScreenUtil::ConvertRectToScreen( gfx::Rect win1_bounds = ScreenUtil::ConvertRectToScreen(
win1->parent(), win1->GetTargetBounds()); docked_container_, win1->GetTargetBounds());
gfx::Rect win2_bounds = ScreenUtil::ConvertRectToScreen( gfx::Rect win2_bounds = ScreenUtil::ConvertRectToScreen(
win2->parent(), win2->GetTargetBounds()); docked_container_, win2->GetTargetBounds());
win1_bounds.set_height(window_with_height1.height_); win1_bounds.set_height(window_with_height1.height_);
win2_bounds.set_height(window_with_height2.height_); win2_bounds.set_height(window_with_height2.height_);
// If one of the windows is the |dragged_window_| attempt to make an // If one of the windows is the |dragged_window_| attempt to make an
...@@ -354,6 +357,7 @@ struct CompareWindowPos { ...@@ -354,6 +357,7 @@ struct CompareWindowPos {
private: private:
aura::Window* dragged_window_; aura::Window* dragged_window_;
aura::Window* docked_container_;
float delta_; float delta_;
}; };
...@@ -1155,12 +1159,13 @@ void DockedWindowLayoutManager::FanOutChildren( ...@@ -1155,12 +1159,13 @@ void DockedWindowLayoutManager::FanOutChildren(
// windows. // windows.
std::sort(visible_windows->begin(), visible_windows->end(), std::sort(visible_windows->begin(), visible_windows->end(),
CompareWindowPos(is_dragged_from_dock_ ? dragged_window_ : NULL, CompareWindowPos(is_dragged_from_dock_ ? dragged_window_ : NULL,
dock_container_,
delta)); delta));
for (std::vector<WindowWithHeight>::iterator iter = visible_windows->begin(); for (std::vector<WindowWithHeight>::iterator iter = visible_windows->begin();
iter != visible_windows->end(); ++iter) { iter != visible_windows->end(); ++iter) {
aura::Window* window = iter->window(); aura::Window* window = iter->window();
gfx::Rect bounds = ScreenUtil::ConvertRectToScreen( gfx::Rect bounds = ScreenUtil::ConvertRectToScreen(
window->parent(), window->GetTargetBounds()); dock_container_, window->GetTargetBounds());
// A window is extended or shrunk to be as close as possible to the ideal // A window is extended or shrunk to be as close as possible to the ideal
// docked area width. Windows that were resized by a user are kept at their // docked area width. Windows that were resized by a user are kept at their
// existing size. // existing size.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment