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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 6024008: Consider the popup window position when the window shows upward. This patch depends on WebKit patch. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use SetBounds(). Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
6 6
7 // If this gets included after the gtk headers, then a bunch of compiler 7 // If this gets included after the gtk headers, then a bunch of compiler
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts
9 // badly with net::URLRequestStatus::Status. 9 // badly with net::URLRequestStatus::Status.
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // ignore them so we don't re-allocate the backing store. We will paint 553 // ignore them so we don't re-allocate the backing store. We will paint
554 // everything again when we become selected again. 554 // everything again when we become selected again.
555 is_hidden_ = true; 555 is_hidden_ = true;
556 556
557 // If we have a renderer, then inform it that we are being hidden so it can 557 // If we have a renderer, then inform it that we are being hidden so it can
558 // reduce its resource utilization. 558 // reduce its resource utilization.
559 GetRenderWidgetHost()->WasHidden(); 559 GetRenderWidgetHost()->WasHidden();
560 } 560 }
561 561
562 void RenderWidgetHostViewGtk::SetSize(const gfx::Size& size) { 562 void RenderWidgetHostViewGtk::SetSize(const gfx::Size& size) {
563 gfx::Rect rect = GetViewBounds();
Evan Stade 2011/02/16 22:03:17 are you sure this works? I think the origin of Get
Peter Kasting 2011/02/16 22:04:21 It's supposed to be, per the header comments. The
honten.org 2011/02/16 22:49:59 Yes, GetViewBounds() actually returns screen coord
honten.org 2011/02/17 08:45:37 Oops, I was wrong. After I double-checked it, I n
honten.org 2011/02/18 09:11:26 Done.
564 rect.set_size(size);
565 SetBounds(rect);
566 }
567
568 void RenderWidgetHostViewGtk::SetBounds(const gfx::Rect& rect) {
563 // This is called when webkit has sent us a Move message. 569 // This is called when webkit has sent us a Move message.
564 int width = std::min(size.width(), kMaxWindowWidth); 570 int width = std::min(rect.width(), kMaxWindowWidth);
565 int height = std::min(size.height(), kMaxWindowHeight); 571 int height = std::min(rect.height(), kMaxWindowHeight);
566 if (IsPopup()) { 572 if (IsPopup()) {
567 // We're a popup, honor the size request. 573 // We're a popup, honor the size request.
568 gtk_widget_set_size_request(view_.get(), width, height); 574 gtk_widget_set_size_request(view_.get(), width, height);
575 gtk_window_move(GTK_WINDOW(gtk_widget_get_parent(view_.get())),
576 rect.x(), rect.y());
569 } else { 577 } else {
honten.org 2011/02/17 08:45:37 As Peter pointed out, I should move gtk_window_mov
honten.org 2011/02/18 09:11:26 Done.
570 #if defined(TOOLKIT_VIEWS) 578 #if defined(TOOLKIT_VIEWS)
571 // TOOLKIT_VIEWS' resize logic flow matches windows. so we go ahead and 579 // TOOLKIT_VIEWS' resize logic flow matches windows. so we go ahead and
572 // size the widget. In GTK+, the size of the widget is determined by its 580 // size the widget. In GTK+, the size of the widget is determined by its
573 // children. 581 // children.
574 gtk_widget_set_size_request(view_.get(), width, height); 582 gtk_widget_set_size_request(view_.get(), width, height);
575 #endif 583 #endif
576 } 584 }
577 // Update the size of the RWH. 585 // Update the size of the RWH.
578 if (requested_size_.width() != width || 586 if (requested_size_.width() != width ||
579 requested_size_.height() != height) { 587 requested_size_.height() != height) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1129 }
1122 1130
1123 // static 1131 // static
1124 RenderWidgetHostView* 1132 RenderWidgetHostView*
1125 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 1133 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
1126 gfx::NativeView widget) { 1134 gfx::NativeView widget) {
1127 gpointer user_data = g_object_get_data(G_OBJECT(widget), 1135 gpointer user_data = g_object_get_data(G_OBJECT(widget),
1128 kRenderWidgetHostViewKey); 1136 kRenderWidgetHostViewKey);
1129 return reinterpret_cast<RenderWidgetHostView*>(user_data); 1137 return reinterpret_cast<RenderWidgetHostView*>(user_data);
1130 } 1138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698