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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2583873002: Correctly update the popup window position (Closed)
Patch Set: test added Created 3 years, 11 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
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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 574 }
575 #endif 575 #endif
576 } 576 }
577 577
578 #if defined(OS_WIN) 578 #if defined(OS_WIN)
579 if (legacy_render_widget_host_HWND_) 579 if (legacy_render_widget_host_HWND_)
580 legacy_render_widget_host_HWND_->Hide(); 580 legacy_render_widget_host_HWND_->Hide();
581 #endif 581 #endif
582 } 582 }
583 583
584 aura::Window* RenderWidgetHostViewAura::GetToplevelWindow() {
585 return window_->GetToplevelWindow();
586 }
587
584 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { 588 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
585 // For a SetSize operation, we don't care what coordinate system the origin 589 // For a SetSize operation, we don't care what coordinate system the origin
586 // of the window is in, it's only important to make sure that the origin 590 // of the window is in, it's only important to make sure that the origin
587 // remains constant after the operation. 591 // remains constant after the operation.
588 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); 592 InternalSetBounds(gfx::Rect(window_->bounds().origin(), size));
589 } 593 }
590 594
591 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { 595 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
592 gfx::Point relative_origin(rect.origin()); 596 display::Display display =
593 597 popup_parent_host_view_
594 // RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but 598 ? display::Screen::GetScreen()->GetDisplayNearestWindow(
595 // Window::SetBounds() takes parent coordinates, so do the conversion here. 599 popup_parent_host_view_->window_)
596 aura::Window* root = window_->GetRootWindow(); 600 : display::Screen::GetScreen()->GetDisplayMatching(rect);
597 if (root) { 601 GetToplevelWindow()->SetBoundsInScreen(rect, display);
598 aura::client::ScreenPositionClient* screen_position_client =
599 aura::client::GetScreenPositionClient(root);
600 if (screen_position_client) {
601 screen_position_client->ConvertPointFromScreen(
602 window_->parent(), &relative_origin);
603 }
604 }
605
606 InternalSetBounds(gfx::Rect(relative_origin, rect.size()));
607 } 602 }
608 603
609 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const { 604 gfx::Vector2dF RenderWidgetHostViewAura::GetLastScrollOffset() const {
610 return last_scroll_offset_; 605 return last_scroll_offset_;
611 } 606 }
612 607
613 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { 608 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const {
614 return window_; 609 return window_;
615 } 610 }
616 611
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 2378
2384 void RenderWidgetHostViewAura::SetPopupChild( 2379 void RenderWidgetHostViewAura::SetPopupChild(
2385 RenderWidgetHostViewAura* popup_child_host_view) { 2380 RenderWidgetHostViewAura* popup_child_host_view) {
2386 popup_child_host_view_ = popup_child_host_view; 2381 popup_child_host_view_ = popup_child_host_view;
2387 event_handler_->SetPopupChild( 2382 event_handler_->SetPopupChild(
2388 popup_child_host_view, 2383 popup_child_host_view,
2389 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); 2384 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr);
2390 } 2385 }
2391 2386
2392 } // namespace content 2387 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698