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

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_ui.cc

Issue 2671713003: Gtk3: Fix border colors on Gtk3.20 (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/libgtkui/gtk_ui.h" 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <pango/pango.h> 8 #include <pango/pango.h>
9 #include <X11/Xcursor/Xcursor.h> 9 #include <X11/Xcursor/Xcursor.h>
10 10
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 ui::NativeTheme::kColorId_TextfieldDefaultColor); 821 ui::NativeTheme::kColorId_TextfieldDefaultColor);
822 // The NTP header is the color that surrounds the current active 822 // The NTP header is the color that surrounds the current active
823 // thumbnail on the NTP, and acts as the border of the "Recent 823 // thumbnail on the NTP, and acts as the border of the "Recent
824 // Links" box. It would be awesome if they were separated so we 824 // Links" box. It would be awesome if they were separated so we
825 // could use GetBorderColor() for the border around the "Recent 825 // could use GetBorderColor() for the border around the "Recent
826 // Links" section, but matching the frame color is more important. 826 // Links" section, but matching the frame color is more important.
827 colors_[ThemeProperties::COLOR_NTP_HEADER] = 827 colors_[ThemeProperties::COLOR_NTP_HEADER] =
828 colors_[ThemeProperties::COLOR_FRAME]; 828 colors_[ThemeProperties::COLOR_FRAME];
829 #else 829 #else
830 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); 830 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar");
831 SkColor toolbar_text_color = color_utils::GetReadableColor(
832 GetFgColor("GtkToolbar#toolbar GtkLabel#label"),
833 toolbar_color);
831 834
832 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = 835 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color;
833 GetFgColor("GtkToolbar#toolbar GtkLabel#label");
834 836
835 // Tabs use the same background color as the toolbar, so use the 837 // Tabs use the same background color as the toolbar, so use the
836 // toolbar text color as the tab text color. 838 // toolbar text color as the tab text color.
837 SkColor tab_text_color = 839 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color;
838 GetFgColor("GtkToolbar#toolbar.horizontal GtkLabel#label"); 840 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color;
839 colors_[ThemeProperties::COLOR_TAB_TEXT] = tab_text_color;
840 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = tab_text_color;
841 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = 841 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
842 color_utils::BlendTowardOppositeLuma(tab_text_color, 50); 842 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50);
843 843
844 inactive_selection_bg_color_ = 844 inactive_selection_bg_color_ =
845 GetBgColor("GtkEntry#entry:backdrop #selection:selected"); 845 GetBgColor("GtkEntry#entry:backdrop #selection:selected");
846 inactive_selection_fg_color_ = 846 inactive_selection_fg_color_ =
847 GetFgColor("GtkEntry#entry:backdrop #selection:selected"); 847 GetFgColor("GtkEntry#entry:backdrop #selection:selected");
848 848
849 SkColor toolbar_separator_horizontal = 849 SkColor toolbar_separator_horizontal =
850 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal"); 850 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal");
851 SkColor toolbar_separator_vertical = 851 SkColor toolbar_separator_vertical =
852 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical"); 852 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical");
853 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = 853 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] =
854 toolbar_color; 854 toolbar_color;
855 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = 855 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] =
856 GetFgColor("GtkToolbar#toolbar GtkLabel#label"); 856 toolbar_text_color;
857 // Separates the toolbar from the bookmark bar or butter bars. 857 // Separates the toolbar from the bookmark bar or butter bars.
858 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = 858 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] =
859 toolbar_separator_horizontal; 859 toolbar_separator_horizontal;
860 // Separates entries in the downloads bar. 860 // Separates entries in the downloads bar.
861 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = 861 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] =
862 toolbar_separator_vertical; 862 toolbar_separator_vertical;
863 // Separates the bookmark bar from the web content. 863 // Separates the bookmark bar from the web content.
864 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = 864 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] =
865 toolbar_separator_horizontal; 865 toolbar_separator_horizontal;
866 866
867 // These colors represent the border drawn around tabs and between 867 // These colors represent the border drawn around tabs and between
868 // the tabstrip and toolbar. It's unclear if the selectors used are 868 // the tabstrip and toolbar.
869 // correct, but they seem to give reasonable results. 869 SkColor header_button_border =
870 SkColor entry_border = 870 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button");
871 GetBorderColor("#headerbar.header-bar.titlebar GtkEntry#entry"); 871 SkColor header_button_inactive_border = GetBorderColor(
872 SkColor entry_inactive_border = 872 "#headerbar.header-bar.titlebar:backdrop GtkButton#button");
873 GetBorderColor("#headerbar.header-bar.titlebar:backdrop GtkEntry#entry");
874 // Unlike with toolbars, we always want a border around tabs, so let 873 // Unlike with toolbars, we always want a border around tabs, so let
875 // ThemeService choose the border color if the theme doesn't provide one. 874 // ThemeService choose the border color if the theme doesn't provide one.
876 if (SkColorGetA(entry_border) && SkColorGetA(entry_inactive_border)) { 875 if (SkColorGetA(header_button_border) &&
877 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = entry_border; 876 SkColorGetA(header_button_inactive_border)) {
877 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] =
878 header_button_border;
878 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = 879 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] =
879 entry_inactive_border; 880 header_button_inactive_border;
880 } 881 }
881 882
882 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = GetBgColor(""); 883 SkColor ntp_bg = GetBgColor("");
883 colors_[ThemeProperties::COLOR_NTP_TEXT] = GetFgColor(""); 884 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = ntp_bg;
884 colors_[ThemeProperties::COLOR_NTP_HEADER] = GetBorderColor("GtkEntry#entry"); 885 colors_[ThemeProperties::COLOR_NTP_TEXT] =
886 color_utils::GetReadableColor(GetFgColor("GtkLabel#label"), ntp_bg);
887 colors_[ThemeProperties::COLOR_NTP_HEADER] =
888 GetBorderColor("GtkButton#button");
885 #endif 889 #endif
886 890
887 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; 891 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color;
888 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; 892 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color;
889 893
890 colors_[ThemeProperties::COLOR_NTP_LINK] = 894 colors_[ThemeProperties::COLOR_NTP_LINK] =
891 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); 895 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled);
892 896
893 // Generate the colors that we pass to WebKit. 897 // Generate the colors that we pass to WebKit.
894 SetScrollbarColors(); 898 SetScrollbarColors();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1043
1040 float GtkUi::GetDeviceScaleFactor() const { 1044 float GtkUi::GetDeviceScaleFactor() const {
1041 return device_scale_factor_; 1045 return device_scale_factor_;
1042 } 1046 }
1043 1047
1044 } // namespace libgtkui 1048 } // namespace libgtkui
1045 1049
1046 views::LinuxUI* BuildGtkUi() { 1050 views::LinuxUI* BuildGtkUi() {
1047 return new libgtkui::GtkUi; 1051 return new libgtkui::GtkUi;
1048 } 1052 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698