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

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

Issue 19681003: Fix issue where window bounds were being passed with wrong coordinates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.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 "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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 old_child->popup_parent_host_view_ = NULL; 670 old_child->popup_parent_host_view_ = NULL;
671 } 671 }
672 popup_parent_host_view_->popup_child_host_view_ = this; 672 popup_parent_host_view_->popup_child_host_view_ = this;
673 window_->SetType(aura::client::WINDOW_TYPE_MENU); 673 window_->SetType(aura::client::WINDOW_TYPE_MENU);
674 window_->Init(ui::LAYER_TEXTURED); 674 window_->Init(ui::LAYER_TEXTURED);
675 window_->SetName("RenderWidgetHostViewAura"); 675 window_->SetName("RenderWidgetHostViewAura");
676 676
677 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); 677 aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow();
678 window_->SetDefaultParentByRootWindow(root, bounds_in_screen); 678 window_->SetDefaultParentByRootWindow(root, bounds_in_screen);
679 679
680 // TODO(erg): While I could make sure details of the StackingClient are 680 SetBounds(bounds_in_screen);
681 // hidden behind aura, hiding the details of the ScreenPositionClient will
682 // take another effort.
683 aura::client::ScreenPositionClient* screen_position_client =
684 aura::client::GetScreenPositionClient(root);
685 gfx::Point origin_in_parent(bounds_in_screen.origin());
686 if (screen_position_client) {
687 screen_position_client->ConvertPointFromScreen(
688 window_->parent(), &origin_in_parent);
689 }
690 SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size()));
691 Show(); 681 Show();
692 } 682 }
693 683
694 void RenderWidgetHostViewAura::InitAsFullscreen( 684 void RenderWidgetHostViewAura::InitAsFullscreen(
695 RenderWidgetHostView* reference_host_view) { 685 RenderWidgetHostView* reference_host_view) {
696 is_fullscreen_ = true; 686 is_fullscreen_ = true;
697 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); 687 window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
698 window_->Init(ui::LAYER_TEXTURED); 688 window_->Init(ui::LAYER_TEXTURED);
699 window_->SetName("RenderWidgetHostViewAura"); 689 window_->SetName("RenderWidgetHostViewAura");
700 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 690 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (root_window) { 746 if (root_window) {
757 HWND parent = root_window->GetAcceleratedWidget(); 747 HWND parent = root_window->GetAcceleratedWidget();
758 LPARAM lparam = reinterpret_cast<LPARAM>(this); 748 LPARAM lparam = reinterpret_cast<LPARAM>(this);
759 749
760 EnumChildWindows(parent, HideWindowsCallback, lparam); 750 EnumChildWindows(parent, HideWindowsCallback, lparam);
761 } 751 }
762 #endif 752 #endif
763 } 753 }
764 754
765 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { 755 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
766 SetBounds(gfx::Rect(window_->bounds().origin(), size)); 756 gfx::Rect bounds = window_->GetBoundsInScreen();
757 bounds.set_size(size);
758 SetBounds(bounds);
767 } 759 }
768 760
769 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { 761 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
770 window_->SetBounds(rect); 762 aura::RootWindow* root_window = window_->GetRootWindow();
sky 2013/07/22 14:48:28 Please add a comment as to why this is necessary.
763 aura::client::ScreenPositionClient* screen_position_client =
764 aura::client::GetScreenPositionClient(root_window);
sky 2013/07/22 14:48:28 nit: indent 2 more.
765 gfx::Point origin_in_parent(rect.origin());
766 if (screen_position_client) {
767 screen_position_client->ConvertPointFromScreen(
768 window_->parent(), &origin_in_parent);
769 }
770
771 window_->SetBounds(gfx::Rect(origin_in_parent, rect.size()));
771 host_->WasResized(); 772 host_->WasResized();
772 MaybeCreateResizeLock(); 773 MaybeCreateResizeLock();
773 if (touch_editing_client_) { 774 if (touch_editing_client_) {
774 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, 775 touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_,
775 selection_focus_rect_); 776 selection_focus_rect_);
776 } 777 }
777 } 778 }
778 779
779 void RenderWidgetHostViewAura::MaybeCreateResizeLock() { 780 void RenderWidgetHostViewAura::MaybeCreateResizeLock() {
780 gfx::Size desired_size = window_->bounds().size(); 781 gfx::Size desired_size = window_->bounds().size();
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 RenderWidgetHost* widget) { 3125 RenderWidgetHost* widget) {
3125 return new RenderWidgetHostViewAura(widget); 3126 return new RenderWidgetHostViewAura(widget);
3126 } 3127 }
3127 3128
3128 // static 3129 // static
3129 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3130 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3130 GetScreenInfoForWindow(results, NULL); 3131 GetScreenInfoForWindow(results, NULL);
3131 } 3132 }
3132 3133
3133 } // namespace content 3134 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698