diff options
17 files changed, 65 insertions, 33 deletions
diff --git a/chrome/app/theme/back_noborder.png b/chrome/app/theme/back_noborder.png Binary files differnew file mode 100644 index 0000000..8e59fad --- /dev/null +++ b/chrome/app/theme/back_noborder.png diff --git a/chrome/app/theme/forward_noborder.png b/chrome/app/theme/forward_noborder.png Binary files differnew file mode 100644 index 0000000..17559b5 --- /dev/null +++ b/chrome/app/theme/forward_noborder.png diff --git a/chrome/app/theme/go_noborder.png b/chrome/app/theme/go_noborder.png Binary files differnew file mode 100644 index 0000000..1180e8b --- /dev/null +++ b/chrome/app/theme/go_noborder.png diff --git a/chrome/app/theme/go_noborder_center.png b/chrome/app/theme/go_noborder_center.png Binary files differnew file mode 100644 index 0000000..f856a19 --- /dev/null +++ b/chrome/app/theme/go_noborder_center.png diff --git a/chrome/app/theme/home_noborder.png b/chrome/app/theme/home_noborder.png Binary files differnew file mode 100644 index 0000000..6c463a2 --- /dev/null +++ b/chrome/app/theme/home_noborder.png diff --git a/chrome/app/theme/reload_noborder.png b/chrome/app/theme/reload_noborder.png Binary files differnew file mode 100644 index 0000000..d9adf19 --- /dev/null +++ b/chrome/app/theme/reload_noborder.png diff --git a/chrome/app/theme/star_noborder.png b/chrome/app/theme/star_noborder.png Binary files differindex 438a18f..ac73d2c 100644 --- a/chrome/app/theme/star_noborder.png +++ b/chrome/app/theme/star_noborder.png diff --git a/chrome/app/theme/star_noborder_center.png b/chrome/app/theme/star_noborder_center.png Binary files differnew file mode 100644 index 0000000..87bef3f --- /dev/null +++ b/chrome/app/theme/star_noborder_center.png diff --git a/chrome/app/theme/starred_noborder.png b/chrome/app/theme/starred_noborder.png Binary files differindex fa47a19..93b5463 100644 --- a/chrome/app/theme/starred_noborder.png +++ b/chrome/app/theme/starred_noborder.png diff --git a/chrome/app/theme/starred_noborder_center.png b/chrome/app/theme/starred_noborder_center.png Binary files differnew file mode 100644 index 0000000..5113f95 --- /dev/null +++ b/chrome/app/theme/starred_noborder_center.png diff --git a/chrome/app/theme/stop_noborder.png b/chrome/app/theme/stop_noborder.png Binary files differnew file mode 100644 index 0000000..012e254 --- /dev/null +++ b/chrome/app/theme/stop_noborder.png diff --git a/chrome/app/theme/stop_noborder_center.png b/chrome/app/theme/stop_noborder_center.png Binary files differnew file mode 100644 index 0000000..57996fb --- /dev/null +++ b/chrome/app/theme/stop_noborder_center.png diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index df90eeb..0f14619 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -12,6 +12,7 @@ <release seq="1"> <includes> <include name="IDR_BACK" file="back.png" type="BINDATA" /> + <include name="IDR_BACK_NOBORDER" file="back_noborder.png" type="BINDATA" /> <include name="IDR_BACK_D" file="back_d.png" type="BINDATA" /> <include name="IDR_BACK_H" file="back_h.png" type="BINDATA" /> <include name="IDR_BACK_P" file="back_p.png" type="BINDATA" /> @@ -27,10 +28,13 @@ <include name="IDR_DROP_H" file="drop_h.png" type="BINDATA" /> <include name="IDR_DROP_P" file="drop_p.png" type="BINDATA" /> <include name="IDR_FORWARD" file="forward.png" type="BINDATA" /> + <include name="IDR_FORWARD_NOBORDER" file="forward_noborder.png" type="BINDATA" /> <include name="IDR_FORWARD_D" file="forward_d.png" type="BINDATA" /> <include name="IDR_FORWARD_H" file="forward_h.png" type="BINDATA" /> <include name="IDR_FORWARD_P" file="forward_p.png" type="BINDATA" /> <include name="IDR_GO" file="go.png" type="BINDATA" /> + <include name="IDR_GO_NOBORDER" file="go_noborder.png" type="BINDATA" /> + <include name="IDR_GO_NOBORDER_CENTER" file="go_noborder_center.png" type="BINDATA" /> <include name="IDR_GO_H" file="go_h.png" type="BINDATA" /> <include name="IDR_GO_P" file="go_p.png" type="BINDATA" /> <include name="IDR_INFO_BUBBLE_CLOSE" file="bubble_close.png" type="BINDATA" /> @@ -40,15 +44,18 @@ <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="location_bar_keyword_search_r.png" type="BINDATA" /> <include name="IDR_PLUGIN" file="plugin.png" type="BINDATA" /> <include name="IDR_RELOAD" file="reload.png" type="BINDATA" /> + <include name="IDR_RELOAD_NOBORDER" file="reload_noborder.png" type="BINDATA" /> <include name="IDR_RELOAD_H" file="reload_h.png" type="BINDATA" /> <include name="IDR_RELOAD_P" file="reload_p.png" type="BINDATA" /> <include name="IDR_STAR" file="star.png" type="BINDATA" /> <include name="IDR_STAR_NOBORDER" file="star_noborder.png" type="BINDATA" /> + <include name="IDR_STAR_NOBORDER_CENTER" file="star_noborder_center.png" type="BINDATA" /> <include name="IDR_STAR_D" file="star_d.png" type="BINDATA" /> <include name="IDR_STAR_H" file="star_h.png" type="BINDATA" /> <include name="IDR_STAR_P" file="star_p.png" type="BINDATA" /> <include name="IDR_STARRED" file="starred.png" type="BINDATA" /> <include name="IDR_STARRED_NOBORDER" file="starred_noborder.png" type="BINDATA" /> + <include name="IDR_STARRED_NOBORDER_CENTER" file="starred_noborder_center.png" type="BINDATA" /> <include name="IDR_STARRED_H" file="starred_h.png" type="BINDATA" /> <include name="IDR_STARRED_P" file="starred_p.png" type="BINDATA" /> <include name="IDR_TAB_ACTIVE_CENTER" file="tab_active_center.png" type="BINDATA" /> @@ -136,6 +143,8 @@ <include name="IDR_THROBBER_23" file="vista_frame_throbber_23.ico" type="ICON" /> <include name="IDR_THROBBER_24" file="vista_frame_throbber_24.ico" type="ICON" /> <include name="IDR_STOP" file="stop.png" type="BINDATA" /> + <include name="IDR_STOP_NOBORDER" file="stop_noborder.png" type="BINDATA" /> + <include name="IDR_STOP_NOBORDER_CENTER" file="stop_noborder_center.png" type="BINDATA" /> <include name="IDR_STOP_H" file="stop_h.png" type="BINDATA" /> <include name="IDR_STOP_P" file="stop_p.png" type="BINDATA" /> <!-- The following (IDR_FIND_DLG_[LEFT|RIGHT|MIDDLE]_[BB]_BACKGROUND) are deprecated but are kept around for the Linux port --> @@ -239,6 +248,7 @@ <include name="IDR_CLOSE_BAR_H" file="close_bar_h.png" type="BINDATA" /> <include name="IDR_CLOSE_BAR_P" file="close_bar_p.png" type="BINDATA" /> <include name="IDR_HOME" file="home.png" type="BINDATA" /> + <include name="IDR_HOME_NOBORDER" file="home_noborder.png" type="BINDATA" /> <include name="IDR_HOME_H" file="home_h.png" type="BINDATA" /> <include name="IDR_HOME_P" file="home_p.png" type="BINDATA" /> <include name="IDR_HISTORY_FAVICON" file="history_favicon.png" type="BINDATA" /> diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index b6af887..c6da8b9 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -142,10 +142,12 @@ static const int kToolbarButtonIDs[] = { IDR_FORWARD, IDR_FORWARD_D, IDR_FORWARD_H, IDR_FORWARD_P, IDR_RELOAD, IDR_RELOAD_H, IDR_RELOAD_P, IDR_HOME, IDR_HOME_H, IDR_HOME_P, - IDR_STAR, IDR_STAR_NOBORDER, IDR_STAR_D, IDR_STAR_H, IDR_STAR_P, - IDR_STARRED, IDR_STARRED_NOBORDER, IDR_STARRED_H, IDR_STARRED_P, - IDR_GO, IDR_GO_H, IDR_GO_P, - IDR_STOP, IDR_STOP_H, IDR_STOP_P, + IDR_STAR, IDR_STAR_NOBORDER, IDR_STAR_NOBORDER_CENTER, IDR_STAR_D, IDR_STAR_H, + IDR_STAR_P, + IDR_STARRED, IDR_STARRED_NOBORDER, IDR_STARRED_NOBORDER_CENTER, IDR_STARRED_H, + IDR_STARRED_P, + IDR_GO, IDR_GO_NOBORDER, IDR_GO_NOBORDER_CENTER, IDR_GO_H, IDR_GO_P, + IDR_STOP, IDR_STOP_NOBORDER, IDR_STOP_NOBORDER_CENTER, IDR_STOP_H, IDR_STOP_P, IDR_MENU_PAGE, IDR_MENU_PAGE_RTL, IDR_MENU_CHROME, IDR_MENU_CHROME_RTL, IDR_MENU_DROPARROW, diff --git a/chrome/browser/gtk/go_button_gtk.cc b/chrome/browser/gtk/go_button_gtk.cc index dfcae5e..ec9f594 100644 --- a/chrome/browser/gtk/go_button_gtk.cc +++ b/chrome/browser/gtk/go_button_gtk.cc @@ -203,18 +203,17 @@ void GoButtonGtk::UpdateThemeButtons() { bool use_gtk = theme_provider_ && theme_provider_->UseGtkTheme(); if (use_gtk) { - // TODO(erg): Waiting for Glen to make a version of these that don't have a - // button border on it. + GdkPixbuf* pixbuf = NULL; if (intended_mode_ == MODE_GO) { - gtk_button_set_image( - GTK_BUTTON(widget_.get()), - gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_BUTTON)); + pixbuf = theme_provider_->GetPixbufNamed(IDR_GO_NOBORDER_CENTER); } else { - gtk_button_set_image( - GTK_BUTTON(widget_.get()), - gtk_image_new_from_stock(GTK_STOCK_STOP, GTK_ICON_SIZE_BUTTON)); + pixbuf = theme_provider_->GetPixbufNamed(IDR_STOP_NOBORDER_CENTER); } + gtk_button_set_image( + GTK_BUTTON(widget_.get()), + gtk_image_new_from_pixbuf(pixbuf)); + gtk_widget_set_size_request(widget_.get(), -1, -1); gtk_widget_set_app_paintable(widget_.get(), FALSE); gtk_widget_set_double_buffered(widget_.get(), TRUE); diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index a9e331b..4a4075f 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -30,6 +30,17 @@ const skia::HSL kExactColor = { -1, -1, -1 }; const skia::HSL kDefaultFrameShift = { -1, -1, 0.4 }; +// Minimum difference between the toolbar and the button color before we try a +// different color. +const double kMinimumLuminanceDifference = 0.1; + +// Converts a GdkColor to a SkColor. +SkColor GdkToSkColor(GdkColor* color) { + return SkColorSetRGB(color->red >> 8, + color->green >> 8, + color->blue >> 8); +} + } // namespace // static @@ -175,7 +186,9 @@ void GtkThemeProvider::LoadGtkValues() { GdkColor frame_color = window_style->bg[GTK_STATE_SELECTED]; GdkColor inactive_frame_color = window_style->bg[GTK_STATE_INSENSITIVE]; + GdkColor toolbar_color = window_style->bg[GTK_STATE_NORMAL]; GdkColor button_color = window_style->bg[GTK_STATE_SELECTED]; + GdkColor label_color = label_style->text[GTK_STATE_NORMAL]; GtkSettings* settings = gtk_settings_get_default(); bool theme_has_frame_color = false; @@ -205,28 +218,39 @@ void GtkThemeProvider::LoadGtkValues() { // color, change the luminosity of the frame color downwards to 80% of what // it currently is. This is in a futile attempt to match the default // metacity and xfwm themes. - SkColor shifted = - skia::HSLShift(SkColorSetRGB((frame_color.red >> 8), - (frame_color.green >> 8), - (frame_color.blue >> 8)), - kDefaultFrameShift); + SkColor shifted = skia::HSLShift(GdkToSkColor(&frame_color), + kDefaultFrameShift); frame_color.pixel = 0; frame_color.red = SkColorGetR(shifted) * kSkiaToGDKMultiplier; frame_color.green = SkColorGetG(shifted) * kSkiaToGDKMultiplier; frame_color.blue = SkColorGetB(shifted) * kSkiaToGDKMultiplier; } + // By default, the button tint color is the background selection color. But + // this can be unreadable in some dark themes, so we set a minimum contrast + // between the button color and the toolbar color. + skia::HSL button_hsl; + skia::SkColorToHSL(GdkToSkColor(&button_color), button_hsl); + skia::HSL toolbar_hsl; + skia::SkColorToHSL(GdkToSkColor(&toolbar_color), toolbar_hsl); + double hsl_difference = fabs(button_hsl.l - toolbar_hsl.l); + if (hsl_difference <= kMinimumLuminanceDifference) { + // Not enough contrast. Try the text color instead. + skia::HSL label_hsl; + skia::SkColorToHSL(GdkToSkColor(&label_color), label_hsl); + double label_difference = fabs(label_hsl.l - toolbar_hsl.l); + if (label_difference >= kMinimumLuminanceDifference) { + button_color = label_color; + } + } + SetThemeColorFromGtk(kColorFrame, &frame_color); // Skip COLOR_FRAME_INACTIVE and the incognito colors, as they will be // autogenerated from tints. - SetThemeColorFromGtk(kColorToolbar, - &window_style->bg[GTK_STATE_NORMAL]); - SetThemeColorFromGtk(kColorTabText, - &label_style->text[GTK_STATE_NORMAL]); - SetThemeColorFromGtk(kColorBackgroundTabText, - &label_style->text[GTK_STATE_NORMAL]); - SetThemeColorFromGtk(kColorBookmarkText, - &label_style->text[GTK_STATE_NORMAL]); + SetThemeColorFromGtk(kColorToolbar, &toolbar_color); + SetThemeColorFromGtk(kColorTabText, &label_color); + SetThemeColorFromGtk(kColorBackgroundTabText, &label_color); + SetThemeColorFromGtk(kColorBookmarkText, &label_color); SetThemeColorFromGtk(kColorControlBackground, &window_style->bg[GTK_STATE_NORMAL]); SetThemeColorFromGtk(kColorButtonBackground, @@ -257,17 +281,14 @@ void GtkThemeProvider::LoadGtkValues() { } void GtkThemeProvider::SetThemeColorFromGtk(const char* id, GdkColor* color) { - SetColor(id, SkColorSetRGB(color->red >> 8, - color->green >> 8, - color->blue >> 8)); + SetColor(id, GdkToSkColor(color)); } void GtkThemeProvider::SetThemeTintFromGtk(const char* id, GdkColor* color, const skia::HSL& default_tint) { skia::HSL hsl; - skia::SkColorToHSL(SkColorSetRGB((color->red >> 8), - (color->green >> 8), - (color->blue >> 8)), hsl); + skia::SkColorToHSL(GdkToSkColor(color), hsl); + if (default_tint.s != -1) hsl.s = default_tint.s; diff --git a/chrome/browser/gtk/toolbar_star_toggle_gtk.cc b/chrome/browser/gtk/toolbar_star_toggle_gtk.cc index 9e844d7..ed4f524c 100644 --- a/chrome/browser/gtk/toolbar_star_toggle_gtk.cc +++ b/chrome/browser/gtk/toolbar_star_toggle_gtk.cc @@ -96,9 +96,9 @@ void ToolbarStarToggleGtk::UpdateGTKButton() { if (use_gtk) { GdkPixbuf* pixbuf = NULL; if (is_starred_) { - pixbuf = theme_provider_->GetPixbufNamed(IDR_STARRED_NOBORDER); + pixbuf = theme_provider_->GetPixbufNamed(IDR_STARRED_NOBORDER_CENTER); } else { - pixbuf = theme_provider_->GetPixbufNamed(IDR_STAR_NOBORDER); + pixbuf = theme_provider_->GetPixbufNamed(IDR_STAR_NOBORDER_CENTER); } gtk_button_set_image( |