summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gtk/find_bar_gtk.cc22
-rw-r--r--chrome/browser/gtk/gtk_util.cc4
-rw-r--r--chrome/browser/gtk/gtk_util.h4
3 files changed, 24 insertions, 6 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc
index 65d6e83..b7beac2 100644
--- a/chrome/browser/gtk/find_bar_gtk.cc
+++ b/chrome/browser/gtk/find_bar_gtk.cc
@@ -274,10 +274,6 @@ void FindBarGtk::InitWidgets() {
gtk_container_set_border_width(GTK_CONTAINER(match_count_centerer), 1);
gtk_container_add(GTK_CONTAINER(match_count_event_box_), match_count_label_);
- // Until we switch to vector graphics, force the font size.
- gtk_util::ForceFontSizePixels(text_entry_, 13.4); // 13.4px == 10pt @ 96dpi
- gtk_util::ForceFontSizePixels(match_count_centerer, 13.4);
-
gtk_box_pack_end(GTK_BOX(content_hbox), match_count_centerer,
FALSE, FALSE, 0);
gtk_box_pack_end(GTK_BOX(content_hbox), text_entry_, TRUE, TRUE, 0);
@@ -460,6 +456,12 @@ void FindBarGtk::Observe(NotificationType type,
gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, NULL);
+ // Prevent forced font sizes because it causes the jump up and down
+ // character movement (http://crbug.com/22614), and because it will
+ // prevent centering of the text entry.
+ gtk_util::UndoForceFontSize(text_entry_);
+ gtk_util::UndoForceFontSize(match_count_label_);
+
gtk_widget_set_size_request(content_event_box_, -1, -1);
gtk_widget_modify_bg(content_event_box_, GTK_STATE_NORMAL, NULL);
@@ -489,6 +491,10 @@ void FindBarGtk::Observe(NotificationType type,
gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL,
&kEntryTextColor);
+ // Until we switch to vector graphics, force the font size.
+ gtk_util::ForceFontSizePixels(text_entry_, 13.4); // 13.4px == 10pt @ 96dpi
+ gtk_util::ForceFontSizePixels(match_count_label_, 13.4);
+
// Force the text widget height so it lines up with the buttons regardless
// of font size.
gtk_widget_set_size_request(content_event_box_, -1, 20);
@@ -767,11 +773,15 @@ gboolean FindBarGtk::OnContentEventBoxExpose(GtkWidget* widget,
GdkEventExpose* event,
FindBarGtk* bar) {
if (bar->theme_provider_->UseGtkTheme()) {
- // Draw the text entry background around where we input stuff.
+ // Draw the text entry background around where we input stuff. Note the
+ // decrement to |width|. We do this because some theme engines
+ // (*cough*Clearlooks*cough*) don't do any blending and use thickness to
+ // make sure that widgets never overlap.
+ int padding = gtk_widget_get_style(widget)->xthickness;
GdkRectangle rec = {
widget->allocation.x,
widget->allocation.y,
- widget->allocation.width,
+ widget->allocation.width - padding,
widget->allocation.height
};
diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc
index cc22399..c4b1ab0 100644
--- a/chrome/browser/gtk/gtk_util.cc
+++ b/chrome/browser/gtk/gtk_util.cc
@@ -367,6 +367,10 @@ void ForceFontSizePixels(GtkWidget* widget, double size_pixels) {
gtk_widget_modify_font(widget, font_desc);
}
+void UndoForceFontSize(GtkWidget* widget) {
+ gtk_widget_modify_font(widget, NULL);
+}
+
gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
if (!widget->window) {
NOTREACHED() << "Must only be called on realized widgets.";
diff --git a/chrome/browser/gtk/gtk_util.h b/chrome/browser/gtk/gtk_util.h
index 5b8104a..5b15380 100644
--- a/chrome/browser/gtk/gtk_util.h
+++ b/chrome/browser/gtk/gtk_util.h
@@ -110,6 +110,10 @@ void RemoveAllChildren(GtkWidget* container);
// Force the font size of the widget to |size_pixels|.
void ForceFontSizePixels(GtkWidget* widget, double size_pixels);
+// Undoes the effects of a previous ForceFontSizePixels() call. Safe to call
+// even if ForceFontSizePixels() was never called.
+void UndoForceFontSize(GtkWidget* widget);
+
// Gets the position of a gtk widget in screen coordinates.
gfx::Point GetWidgetScreenPosition(GtkWidget* widget);