summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 22:18:34 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 22:18:34 +0000
commit7f1654c7b6a85ec08b0080b68124bb39471b1a16 (patch)
treeeed0f994e4880c110e6bc9a06c390f59a6666a80 /chrome
parentb9c9d58dbb1e4ef201f3230f78c3755b4c96bf9a (diff)
downloadchromium_src-7f1654c7b6a85ec08b0080b68124bb39471b1a16.zip
chromium_src-7f1654c7b6a85ec08b0080b68124bb39471b1a16.tar.gz
chromium_src-7f1654c7b6a85ec08b0080b68124bb39471b1a16.tar.bz2
GTK: Remove problematic theme styles from the location bar.
BUG=27103 TEST=Use xfce-stellar theme. There shouldn't be an inner box in the location bar and typing shouldn't cause text to move up and down. Review URL: http://codereview.chromium.org/399087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index f9c5b13..8966fbb 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -77,6 +77,30 @@ PropertyAccessor<AutocompleteEditState>* GetStateAccessor() {
return &state;
}
+// Set up style properties to override the default GtkTextView; if a theme has
+// overridden some of these properties, an inner-line will be displayed inside
+// the fake GtkTextEntry.
+void SetEntryStyle() {
+ static bool style_was_set = false;
+
+ if (style_was_set)
+ return;
+ style_was_set = true;
+
+ gtk_rc_parse_string(
+ "style \"chrome-location-bar-entry\" {"
+ " xthickness = 0\n"
+ " ythickness = 0\n"
+ " GtkWidget::focus_padding = 0\n"
+ " GtkWidget::focus-line-width = 0\n"
+ " GtkWidget::interior_focus = 0\n"
+ " GtkWidget::internal-padding = 0\n"
+ " GtkContainer::border-width = 0\n"
+ "}\n"
+ "widget \"*chrome-location-bar-entry\" "
+ "style \"chrome-location-bar-entry\"");
+}
+
} // namespace
AutocompleteEditViewGtk::AutocompleteEditViewGtk(
@@ -140,6 +164,8 @@ AutocompleteEditViewGtk::~AutocompleteEditViewGtk() {
}
void AutocompleteEditViewGtk::Init() {
+ SetEntryStyle();
+
// The height of the text view is going to change based on the font used. We
// don't want to stretch the height, and we want it vertically centered.
alignment_.Own(gtk_alignment_new(0., 0.5, 1.0, 0.0));
@@ -161,6 +187,9 @@ void AutocompleteEditViewGtk::Init() {
browser_defaults::kAutocompleteEditFontPixelSizeInPopup :
browser_defaults::kAutocompleteEditFontPixelSize);
+ // See SetEntryStyle() comments.
+ gtk_widget_set_name(text_view_, "chrome-location-bar-entry");
+
// The text view was floating. It will now be owned by the alignment.
gtk_container_add(GTK_CONTAINER(alignment_.get()), text_view_);