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

Side by Side Diff: chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc

Issue 8885016: GTK: Even more changes from raw allocation access to gtk_widget_get_allocation(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove temporary Created 9 years 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
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/ui/gtk/infobars/infobar_container_gtk.h" 5 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/browser/infobars/infobar_delegate.h" 12 #include "chrome/browser/infobars/infobar_delegate.h"
13 #include "chrome/browser/platform_util.h" 13 #include "chrome/browser/platform_util.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 15 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
16 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
17 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" 17 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
18 #include "third_party/skia/include/effects/SkGradientShader.h" 18 #include "third_party/skia/include/effects/SkGradientShader.h"
19 #include "ui/base/gtk/gtk_compat.h"
19 #include "ui/gfx/canvas_skia_paint.h" 20 #include "ui/gfx/canvas_skia_paint.h"
20 #include "ui/gfx/color_utils.h" 21 #include "ui/gfx/color_utils.h"
21 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
22 #include "ui/gfx/skia_utils_gtk.h" 23 #include "ui/gfx/skia_utils_gtk.h"
23 24
24 InfoBarContainerGtk::InfoBarContainerGtk(InfoBarContainer::Delegate* delegate, 25 InfoBarContainerGtk::InfoBarContainerGtk(InfoBarContainer::Delegate* delegate,
25 Profile* profile) 26 Profile* profile)
26 : InfoBarContainer(delegate), 27 : InfoBarContainer(delegate),
27 profile_(profile), 28 profile_(profile),
28 container_(gtk_vbox_new(FALSE, 0)) { 29 container_(gtk_vbox_new(FALSE, 0)) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 int x = browser_window ? 127 int x = browser_window ?
127 browser_window->GetXPositionOfLocationIcon(sender) : 0; 128 browser_window->GetXPositionOfLocationIcon(sender) : 0;
128 129
129 for (; it != infobars_gtk_.end(); ++it) { 130 for (; it != infobars_gtk_.end(); ++it) {
130 // Find the location of the arrow in |sender|'s coordinate space relative 131 // Find the location of the arrow in |sender|'s coordinate space relative
131 // to the infobar. 132 // to the infobar.
132 int y = 0; 133 int y = 0;
133 gtk_widget_translate_coordinates((*it)->widget(), sender, 134 gtk_widget_translate_coordinates((*it)->widget(), sender,
134 0, 0, 135 0, 0,
135 NULL, &y); 136 NULL, &y);
136 if (GTK_WIDGET_NO_WINDOW(sender)) 137 if (!gtk_widget_get_has_window(sender)) {
137 y += sender->allocation.y; 138 GtkAllocation allocation;
139 gtk_widget_get_allocation(sender, &allocation);
140 y += allocation.y;
141 }
138 142
139 // We rely on the +1 in the y calculation so we hide the bottom of the drawn 143 // We rely on the +1 in the y calculation so we hide the bottom of the drawn
140 // triangle just right outside the view bounds. 144 // triangle just right outside the view bounds.
141 gfx::Rect bounds(x - (*it)->arrow_half_width(), 145 gfx::Rect bounds(x - (*it)->arrow_half_width(),
142 y - (*it)->arrow_height() + 1, 146 y - (*it)->arrow_height() + 1,
143 2 * (*it)->arrow_half_width(), 147 2 * (*it)->arrow_half_width(),
144 (*it)->arrow_target_height()); 148 (*it)->arrow_target_height());
145 149
146 PaintArrowOn(sender, expose, bounds, *it); 150 PaintArrowOn(sender, expose, bounds, *it);
147 } 151 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 184
181 skia::PlatformCanvasPaint canvas(expose, false); 185 skia::PlatformCanvasPaint canvas(expose, false);
182 canvas.drawPath(path, paint); 186 canvas.drawPath(path, paint);
183 187
184 paint.setShader(NULL); 188 paint.setShader(NULL);
185 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(source->GetBorderColor()), 189 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(source->GetBorderColor()),
186 SkColorGetA(grad_colors[0]))); 190 SkColorGetA(grad_colors[0])));
187 paint.setStyle(SkPaint::kStroke_Style); 191 paint.setStyle(SkPaint::kStroke_Style);
188 canvas.drawPath(path, paint); 192 canvas.drawPath(path, paint);
189 } 193 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/download/download_shelf_gtk.cc ('k') | chrome/browser/ui/gtk/infobars/infobar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698