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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2732383002: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 614cf33dae234dbd63c544851f9cf51abc98fd07..8b82837d49623b25af8e29a761ea17bce6bc0298 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -581,10 +581,6 @@ void RenderWidgetHostViewAura::Hide() {
#endif
}
-aura::Window* RenderWidgetHostViewAura::GetToplevelWindow() {
- return window_->GetToplevelWindow();
-}
-
void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
// For a SetSize operation, we don't care what coordinate system the origin
// of the window is in, it's only important to make sure that the origin
@@ -593,12 +589,21 @@ void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
}
void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
- display::Display display =
- popup_parent_host_view_
- ? display::Screen::GetScreen()->GetDisplayNearestWindow(
- popup_parent_host_view_->window_)
- : display::Screen::GetScreen()->GetDisplayMatching(rect);
- GetToplevelWindow()->SetBoundsInScreen(rect, display);
+ gfx::Point relative_origin(rect.origin());
+
+ // RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but
+ // Window::SetBounds() takes parent coordinates, so do the conversion here.
+ aura::Window* root = window_->GetRootWindow();
+ if (root) {
+ aura::client::ScreenPositionClient* screen_position_client =
+ aura::client::GetScreenPositionClient(root);
+ if (screen_position_client) {
+ screen_position_client->ConvertPointFromScreen(window_->parent(),
+ &relative_origin);
+ }
+ }
+
+ InternalSetBounds(gfx::Rect(relative_origin, rect.size()));
}
gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const {

Powered by Google App Engine
This is Rietveld 408576698