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

Unified 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: Fix Mac, and change rwhv according to the move. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_gtk.cc
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 5ef533dea8fd6912004f05859bb5833fc9e791e3..b64dc54d99b8b5eb8376109a27b3654f06b22958 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -602,9 +602,15 @@ void RenderWidgetHostViewGtk::WasHidden() {
}
void RenderWidgetHostViewGtk::SetSize(const gfx::Size& size) {
+ gfx::Rect rect = GetViewBounds();
+ rect.set_size(size);
+ SetBounds(rect);
Evan Stade 2011/02/22 19:56:19 this is backwards. SetBounds should use SetSize, n
honten.org 2011/02/23 01:31:57 Done.
+}
+
+void RenderWidgetHostViewGtk::SetBounds(const gfx::Rect& rect) {
// This is called when webkit has sent us a Move message.
- int width = std::min(size.width(), kMaxWindowWidth);
- int height = std::min(size.height(), kMaxWindowHeight);
+ int width = std::min(rect.width(), kMaxWindowWidth);
+ int height = std::min(rect.height(), kMaxWindowHeight);
if (IsPopup()) {
// We're a popup, honor the size request.
gtk_widget_set_size_request(view_.get(), width, height);
@@ -616,6 +622,11 @@ void RenderWidgetHostViewGtk::SetSize(const gfx::Size& size) {
gtk_widget_set_size_request(view_.get(), width, height);
#endif
}
+
+ GtkWidget* parent_widget = gtk_widget_get_parent(view_.get());
+ if (GTK_IS_WINDOW(parent_widget))
+ gtk_window_move(GTK_WINDOW(parent_widget), rect.x(), rect.y());
+
// Update the size of the RWH.
if (requested_size_.width() != width ||
requested_size_.height() != height) {
@@ -663,8 +674,9 @@ bool RenderWidgetHostViewGtk::IsShowing() {
}
gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const {
- GtkAllocation* alloc = &view_.get()->allocation;
- return gfx::Rect(alloc->x, alloc->y,
+ gint x, y;
+ gtk_widget_get_pointer(view_.get(), &x, &y);
Evan Stade 2011/02/22 19:56:19 I fail to see how the location of the pointer is r
honten.org 2011/02/23 01:31:57 Roll back. On 2011/02/22 19:56:19, Evan Stade wrot
+ return gfx::Rect(x, y,
requested_size_.width(),
requested_size_.height());
}
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_gtk.h ('k') | chrome/browser/renderer_host/render_widget_host_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698