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

Unified Diff: chrome/browser/ui/gtk/find_bar_gtk.cc

Issue 8773025: GTK: More removal of raw GtkWidget->allocation access. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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/ui/gtk/find_bar_gtk.cc
diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc
index 28fa758726c84a3f00da1b4f64ea83119720ad0f..0c6ce13e8032bd32a1dc947475142256a438526d 100644
--- a/chrome/browser/ui/gtk/find_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/find_bar_gtk.cc
@@ -372,7 +372,9 @@ void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result,
if (!result.selection_rect().IsEmpty()) {
selection_rect_ = result.selection_rect();
int xposition = GetDialogPosition(result.selection_rect()).x();
- if (xposition != widget()->allocation.x)
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget(), &allocation);
+ if (xposition != allocation.x)
Reposition();
}
@@ -814,12 +816,9 @@ gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget,
// (*cough*Clearlooks*cough*) don't do any blending and use thickness to
// make sure that widgets never overlap.
int padding = gtk_widget_get_style(widget)->xthickness;
- GdkRectangle rec = {
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width - padding,
- widget->allocation.height
- };
+ GdkRectangle rec;
+ gtk_widget_get_allocation(widget, &rec);
+ rec.width -= padding;
gtk_util::DrawTextEntryBackground(bar->text_entry_, widget,
&event->area, &rec);
@@ -831,11 +830,14 @@ gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget,
// Used to handle custom painting of |container_|.
gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
FindBarGtk* bar) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+
if (bar->theme_service_->UsingNativeTheme()) {
- if (bar->container_width_ != widget->allocation.width ||
- bar->container_height_ != widget->allocation.height) {
+ if (bar->container_width_ != allocation.width ||
+ bar->container_height_ != allocation.height) {
std::vector<GdkPoint> mask_points = MakeFramePolygonPoints(
- widget->allocation.width, widget->allocation.height, FRAME_MASK);
+ allocation.width, allocation.height, FRAME_MASK);
GdkRegion* mask_region = gdk_region_polygon(&mask_points[0],
mask_points.size(),
GDK_EVEN_ODD_RULE);
@@ -844,8 +846,8 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
gdk_window_shape_combine_region(widget->window, mask_region, 0, 0);
gdk_region_destroy(mask_region);
- bar->container_width_ = widget->allocation.width;
- bar->container_height_ = widget->allocation.height;
+ bar->container_width_ = allocation.width;
+ bar->container_height_ = allocation.height;
}
GdkDrawable* drawable = GDK_DRAWABLE(e->window);
@@ -856,19 +858,19 @@ gboolean FindBarGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e,
// Stroke the frame border.
std::vector<GdkPoint> points = MakeFramePolygonPoints(
- widget->allocation.width, widget->allocation.height, FRAME_STROKE);
+ allocation.width, allocation.height, FRAME_STROKE);
gdk_draw_lines(drawable, gc, &points[0], points.size());
g_object_unref(gc);
} else {
- if (bar->container_width_ != widget->allocation.width ||
- bar->container_height_ != widget->allocation.height) {
+ if (bar->container_width_ != allocation.width ||
+ bar->container_height_ != allocation.height) {
// Reset the shape.
gdk_window_shape_combine_region(widget->window, NULL, 0, 0);
SetDialogShape(bar->container_);
- bar->container_width_ = widget->allocation.width;
- bar->container_height_ = widget->allocation.height;
+ bar->container_width_ = allocation.width;
+ bar->container_height_ = allocation.height;
}
cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
« no previous file with comments | « chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_chrome_link_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698