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

Unified Diff: chrome/browser/views/find_bar_view.cc

Issue 3167027: Merge 56737 - Fix numerous alignment problems, both horizontal and vertical, ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 years, 4 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/views/find_bar_view.cc
===================================================================
--- chrome/browser/views/find_bar_view.cc (revision 56738)
+++ chrome/browser/views/find_bar_view.cc (working copy)
@@ -15,6 +15,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/find_bar_host.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/view_ids.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
@@ -23,6 +24,7 @@
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/label.h"
+#include "views/widget/widget.h"
// The amount of whitespace to have before the find button.
static const int kWhiteSpaceAfterMatchCountLabel = 1;
@@ -230,16 +232,26 @@
void FindBarView::Paint(gfx::Canvas* canvas) {
SkPaint paint;
+ // Determine the find bar size as well as the offset from which to tile the
+ // toolbar background image. First, get the widget bounds.
+ gfx::Rect bounds;
+ GetWidget()->GetBounds(&bounds, true);
+ // Now convert from screen to parent coordinates.
+ gfx::Point origin(bounds.origin());
+ BrowserView* browser_view = host()->browser_view();
+ ConvertPointToView(NULL, browser_view, &origin);
+ bounds.set_origin(origin);
+ // Finally, calculate the background image tiling offset.
+ origin = browser_view->OffsetPointForToolbarBackgroundImage(origin);
+
// First, we draw the background image for the whole dialog (3 images: left,
// middle and right). Note, that the window region has been set by the
// controller, so the whitespace in the left and right background images is
// actually outside the window region and is therefore not drawn. See
// FindInPageWidgetWin::CreateRoundedWindowEdges() for details.
ThemeProvider* tp = GetThemeProvider();
- gfx::Rect bounds;
- host()->GetThemePosition(&bounds);
- canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), bounds.x(),
- bounds.y(), 0, 0, bounds.width(), bounds.height());
+ canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), origin.x(),
+ origin.y(), 0, 0, bounds.width(), bounds.height());
// Now flip the canvas for the rest of the graphics if in RTL mode.
canvas->Save();
« no previous file with comments | « chrome/browser/views/dropdown_bar_host.cc ('k') | chrome/browser/views/frame/app_panel_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698