OLD | NEW |
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/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { | 155 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { |
156 // This is used for positioning the download shelf arrow animation, | 156 // This is used for positioning the download shelf arrow animation, |
157 // as well as sizing some other widgets in Windows. In GTK the size is | 157 // as well as sizing some other widgets in Windows. In GTK the size is |
158 // managed for us, so it appears to be only used for the download shelf | 158 // managed for us, so it appears to be only used for the download shelf |
159 // animation. | 159 // animation. |
160 int x = 0; | 160 int x = 0; |
161 int y = 0; | 161 int y = 0; |
162 GdkWindow* expanded_window = gtk_widget_get_window(expanded_.get()); | 162 GdkWindow* expanded_window = gtk_widget_get_window(expanded_.get()); |
163 if (expanded_window) | 163 if (expanded_window) |
164 gdk_window_get_origin(expanded_window, &x, &y); | 164 gdk_window_get_origin(expanded_window, &x, &y); |
165 out->SetRect(x + expanded_->allocation.x, y + expanded_->allocation.y, | 165 |
| 166 GtkAllocation allocation; |
| 167 gtk_widget_get_allocation(expanded_.get(), &allocation); |
| 168 out->SetRect(x + allocation.x, y + allocation.y, |
166 requested_size_.width(), requested_size_.height()); | 169 requested_size_.width(), requested_size_.height()); |
167 } | 170 } |
168 | 171 |
169 void TabContentsViewGtk::SetPageTitle(const string16& title) { | 172 void TabContentsViewGtk::SetPageTitle(const string16& title) { |
170 // Set the window name to include the page title so it's easier to spot | 173 // Set the window name to include the page title so it's easier to spot |
171 // when debugging (e.g. via xwininfo -tree). | 174 // when debugging (e.g. via xwininfo -tree). |
172 gfx::NativeView content_view = GetContentNativeView(); | 175 gfx::NativeView content_view = GetContentNativeView(); |
173 if (content_view) { | 176 if (content_view) { |
174 GdkWindow* content_window = gtk_widget_get_window(content_view); | 177 GdkWindow* content_window = gtk_widget_get_window(content_view); |
175 if (content_window) { | 178 if (content_window) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 requested_size_ = size; | 414 requested_size_ = size; |
412 | 415 |
413 // We manually tell our RWHV to resize the renderer content. This avoids | 416 // We manually tell our RWHV to resize the renderer content. This avoids |
414 // spurious resizes from GTK+. | 417 // spurious resizes from GTK+. |
415 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); | 418 RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); |
416 if (rwhv) | 419 if (rwhv) |
417 rwhv->SetSize(size); | 420 rwhv->SetSize(size); |
418 if (tab_contents_->interstitial_page()) | 421 if (tab_contents_->interstitial_page()) |
419 tab_contents_->interstitial_page()->SetSize(size); | 422 tab_contents_->interstitial_page()->SetSize(size); |
420 } | 423 } |
OLD | NEW |