diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 22:49:56 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 22:49:56 +0000 |
commit | 51570ddfc079a32dc5e78887f730b7aa270b916e (patch) | |
tree | 4d3d5ce45a9fa1ddd2c51bae99dee23912a57b8a | |
parent | 58f8a6595678f5c84d6f40a1ce4ad0ab0aaa8f8c (diff) | |
download | chromium_src-51570ddfc079a32dc5e78887f730b7aa270b916e.zip chromium_src-51570ddfc079a32dc5e78887f730b7aa270b916e.tar.gz chromium_src-51570ddfc079a32dc5e78887f730b7aa270b916e.tar.bz2 |
Make the tabstrip transparent (doesn't paint a background) by
turning the window off for the gtk_fixed that represents the
tabstrip. For some reason, this caused the tabs to render relative to
the top of the window, so adjust the tab painting via the event
area offset.
BUG=13789
Review URL: http://codereview.chromium.org/131069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18762 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 2 | ||||
-rwxr-xr-x | chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 7 | ||||
-rwxr-xr-x | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.h | 12 |
4 files changed, 8 insertions, 31 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 17a6bdf..041bc73 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -343,7 +343,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser) gtk_container_add(GTK_CONTAINER(window_container_), window_vbox); tabstrip_.reset(new TabStripGtk(browser_->tabstrip_model())); - tabstrip_->Init(browser_->profile()); + tabstrip_->Init(); // Build the titlebar (tabstrip + header space + min/max/close buttons). titlebar_.reset(new BrowserTitlebar(this, window_)); diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 112f33a..95d1360 100755 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -515,9 +515,10 @@ void TabRendererGtk::PaintTab(GdkEventExpose* event) { return; // The tab is rendered into a windowless widget whose offset is at the - // coordinate [x(), y()]. Translate by that offset so we can render at (0,0) - // to match windows rendering metrics. - canvas.TranslateInt(x(), y()); + // coordinate [x(), y()]. Additionally, the parent widget is windowless, and + // it has an offset of event->area. Translate by these offsets so we can + // render at (0,0) to match windows rendering metrics. + canvas.TranslateInt(x() + event->area.x, y() + event->area.y); Paint(&canvas); } diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 516a343..06b88e8 100755 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -463,17 +463,10 @@ TabStripGtk::~TabStripGtk() { tab_data_.clear(); } -void TabStripGtk::Init(Profile* profile) { - ThemeProvider* theme_provider = profile->GetThemeProvider(); - +void TabStripGtk::Init() { model_->AddObserver(this); - int background_type = profile->IsOffTheRecord() ? - IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; - background_ = theme_provider->GetBitmapNamed(background_type); - tabstrip_.Own(gtk_fixed_new()); - gtk_fixed_set_has_window(GTK_FIXED(tabstrip_.get()), TRUE); gtk_widget_set_size_request(tabstrip_.get(), -1, TabGtk::GetMinimumUnselectedSize().height()); gtk_widget_set_app_paintable(tabstrip_.get(), TRUE); @@ -1431,8 +1424,6 @@ gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event, event->area.height = tabstrip->bounds_.height(); gdk_region_union_with_rect(event->region, &event->area); - tabstrip->PaintBackground(widget, event); - // Paint the New Tab button. gtk_container_propagate_expose(GTK_CONTAINER(tabstrip->tabstrip_.get()), tabstrip->newtab_button_->widget(), event); @@ -1549,13 +1540,6 @@ void TabStripGtk::OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip) { tabstrip->model_->delegate()->AddBlankTab(true); } -void TabStripGtk::PaintBackground(GtkWidget* widget, GdkEventExpose* event) { - gfx::CanvasPaint canvas(event); - // Offset the background by the height of the titlebar. - canvas.TileImageInt(*background_, 0, widget->allocation.y, 0, 0, - bounds_.width(), bounds_.height()); -} - void TabStripGtk::SetTabBounds(TabGtk* tab, const gfx::Rect& bounds) { tab->SetBounds(bounds); gtk_fixed_move(GTK_FIXED(tabstrip_.get()), tab->widget(), diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index 417653c..01fbf39 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -29,10 +29,8 @@ class TabStripGtk : public TabStripModelObserver, virtual ~TabStripGtk(); // Initialize and load the TabStrip into a container. - // TODO(jhawkins): We have to pass in |profile| in order to get a pointer to - // the theme provider. In views, all instances of views::View have access to - // the theme provider. - void Init(Profile* profile); + // TODO(tc): Pass in theme provider so we can properly theme the tabs. + void Init(); void Show(); void Hide(); @@ -207,9 +205,6 @@ class TabStripGtk : public TabStripModelObserver, // Handles the clicked signal from the new tab button. static void OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip); - // Renders the tabstrip background. - void PaintBackground(GtkWidget* widget, GdkEventExpose* event); - // Sets the bounds of the tab and moves the tab widget to those bounds. void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds); @@ -361,9 +356,6 @@ class TabStripGtk : public TabStripModelObserver, // Our model. TabStripModel* model_; - // The bitmap we use to paint the colored background. - SkBitmap* background_; - // The currently running animation. scoped_ptr<TabAnimation> active_animation_; |