diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-29 21:37:15 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-29 21:37:15 +0000 |
commit | 0c74a1a853187ee05d5adfdfcee8cfd313b016cd (patch) | |
tree | 792e0059f157de971ebeffce5ed94c0e2184cb7f | |
parent | 9c684b6c36110ce0e4cee0dbd851ff00d8fb1dac (diff) | |
download | chromium_src-0c74a1a853187ee05d5adfdfcee8cfd313b016cd.zip chromium_src-0c74a1a853187ee05d5adfdfcee8cfd313b016cd.tar.gz chromium_src-0c74a1a853187ee05d5adfdfcee8cfd313b016cd.tar.bz2 |
GTK: Align theme overlays correctly.
Make every calculation of the vertical offset go through the same function, and
make sure that the overlay actually uses the offset instead of always being top
aligned.
BUG=63475
TEST=Install the GlossyBlue theme. Maximize the window. There shouldn't be any discontinuity in the curve (because the overlay is being rendered in the correct place.)
Review URL: http://codereview.chromium.org/5379008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67591 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 14 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.h | 5 |
2 files changed, 13 insertions, 6 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index d08212b..f175e71 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -546,8 +546,7 @@ void BrowserWindowGtk::DrawPopupFrame(cairo_t* cr, int image_name = GetThemeFrameResource(); CairoCachedSurface* surface = theme_provider->GetUnthemedSurfaceNamed( image_name, widget); - surface->SetSource( - cr, 0, UseCustomFrame() ? 0 : -kCustomFrameBackgroundVerticalOffset); + surface->SetSource(cr, 0, GetVerticalOffset()); cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REFLECT); cairo_rectangle(cr, event->area.x, event->area.y, event->area.width, event->area.height); @@ -565,9 +564,7 @@ void BrowserWindowGtk::DrawCustomFrame(cairo_t* cr, CairoCachedSurface* surface = theme_provider->GetSurfaceNamed( image_name, widget); if (event->area.y < surface->Height()) { - int offset = (IsMaximized() || (!UseCustomFrame())) ? - -kCustomFrameBackgroundVerticalOffset : 0; - surface->SetSource(cr, 0, offset); + surface->SetSource(cr, 0, GetVerticalOffset()); // The frame background isn't tiled vertically. cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); @@ -581,11 +578,16 @@ void BrowserWindowGtk::DrawCustomFrame(cairo_t* cr, CairoCachedSurface* theme_overlay = theme_provider->GetSurfaceNamed( IsActive() ? IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE, widget); - theme_overlay->SetSource(cr, 0, 0); + theme_overlay->SetSource(cr, 0, GetVerticalOffset()); cairo_paint(cr); } } +int BrowserWindowGtk::GetVerticalOffset() { + return (IsMaximized() || (!UseCustomFrame())) ? + -kCustomFrameBackgroundVerticalOffset : 0; +} + int BrowserWindowGtk::GetThemeFrameResource() { bool off_the_record = browser()->profile()->IsOffTheRecord(); int image_name; diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index d11c2c1..1a73b0f 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -298,6 +298,11 @@ class BrowserWindowGtk : public BrowserWindow, // Draws the normal custom frame using theme_frame. void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event); + // The background frame image needs to be offset by the size of the top of + // the window to the top of the tabs when the full skyline isn't displayed + // for some reason. + int GetVerticalOffset(); + // Returns which frame image we should use based on the window's current // activation state / incognito state. int GetThemeFrameResource(); |