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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_screen_position_client.cc

Issue 2747723004: Revert of Correctly update the popup window position (patchset #6 id:160001 of https://codereview.c… (Closed)
Patch Set: Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/views/widget/desktop_aura/desktop_screen_position_client.h" 5 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h"
6 6
7 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 7 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
8 8
9 namespace views { 9 namespace views {
10 10
(...skipping 20 matching lines...) Expand all
31 DesktopScreenPositionClient::~DesktopScreenPositionClient() { 31 DesktopScreenPositionClient::~DesktopScreenPositionClient() {
32 aura::client::SetScreenPositionClient(root_window_, NULL); 32 aura::client::SetScreenPositionClient(root_window_, NULL);
33 } 33 }
34 34
35 void DesktopScreenPositionClient::SetBounds(aura::Window* window, 35 void DesktopScreenPositionClient::SetBounds(aura::Window* window,
36 const gfx::Rect& bounds, 36 const gfx::Rect& bounds,
37 const display::Display& display) { 37 const display::Display& display) {
38 // TODO(jam): Use the 3rd parameter, |display|. 38 // TODO(jam): Use the 3rd parameter, |display|.
39 aura::Window* root = window->GetRootWindow(); 39 aura::Window* root = window->GetRootWindow();
40 40
41 // This method assumes that |window| does not have an associated
42 // DesktopNativeWidgetAura.
41 internal::NativeWidgetPrivate* desktop_native_widget = 43 internal::NativeWidgetPrivate* desktop_native_widget =
42 DesktopNativeWidgetAura::ForWindow(root); 44 DesktopNativeWidgetAura::ForWindow(root);
43 // The screen bounds request to the content_window_ should be interpreted as
44 // a widget bounds change.
45 if (desktop_native_widget &&
46 desktop_native_widget->GetNativeView() == window) {
47 desktop_native_widget->GetWidget()->SetBounds(bounds);
48 return;
49 }
50 // The following logic assumes that |window| does not have an associated
51 // DesktopNativeWidgetAura.
52 DCHECK(!desktop_native_widget || 45 DCHECK(!desktop_native_widget ||
53 desktop_native_widget->GetNativeView() != window); 46 desktop_native_widget->GetNativeView() != window);
54 47
55 if (PositionWindowInScreenCoordinates(window)) { 48 if (PositionWindowInScreenCoordinates(window)) {
56 // The caller expects windows we consider "embedded" to be placed in the 49 // The caller expects windows we consider "embedded" to be placed in the
57 // screen coordinate system. So we need to offset the root window's 50 // screen coordinate system. So we need to offset the root window's
58 // position (which is in screen coordinates) from these bounds. 51 // position (which is in screen coordinates) from these bounds.
59 52
60 gfx::Point origin = bounds.origin(); 53 gfx::Point origin = bounds.origin();
61 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); 54 aura::Window::ConvertPointToTarget(window->parent(), root, &origin);
62 55
63 gfx::Point host_origin = GetOriginInScreen(root); 56 gfx::Point host_origin = GetOriginInScreen(root);
64 origin.Offset(-host_origin.x(), -host_origin.y()); 57 origin.Offset(-host_origin.x(), -host_origin.y());
65 window->SetBounds(gfx::Rect(origin, bounds.size())); 58 window->SetBounds(gfx::Rect(origin, bounds.size()));
66 return; 59 return;
67 } 60 }
68 61
69 window->SetBounds(bounds); 62 window->SetBounds(bounds);
70 } 63 }
71 64
72 } // namespace views 65 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698