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

Unified Diff: chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc

Issue 10987018: Share Font Code for New Autofill. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
index 856d0c7cf1a4d1da673403d0539c04175cd113bb..e7a13e032315d1427008449c83c0582cdaa4214f 100644
--- a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
+++ b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
@@ -61,9 +61,6 @@ const int kDeleteIconWidth = 16;
// Height of the delete icon in pixels.
const int kDeleteIconHeight = 16;
-// Size difference between value text and label text in pixels.
-const int kLabelFontSizeDelta = -2;
-
gfx::Rect GetWindowRect(GdkWindow* window) {
return gfx::Rect(gdk_window_get_width(window),
gdk_window_get_height(window));
@@ -108,8 +105,6 @@ AutofillPopupViewGtk::AutofillPopupViewGtk(
g_signal_connect(window_, "button-release-event",
G_CALLBACK(HandleButtonReleaseThunk), this);
- label_font_ = value_font_.DeriveFont(kLabelFontSizeDelta);
-
// Cache the layout so we don't have to create it for every expose.
layout_ = gtk_widget_create_pango_layout(window_, NULL);
}
@@ -314,13 +309,13 @@ void AutofillPopupViewGtk::DrawAutofillEntry(cairo_t* cairo_context,
}
// Draw the value.
- SetLayoutText(autofill_values()[index], value_font_, kValueTextColor);
- int value_text_width = value_font_.GetStringWidth(autofill_values()[index]);
+ SetLayoutText(autofill_values()[index], value_font(), kValueTextColor);
+ int value_text_width = value_font().GetStringWidth(autofill_values()[index]);
// Center the text within the line.
int value_content_y = std::max(
entry_rect.y(),
- entry_rect.y() + ((kRowHeight - value_font_.GetHeight()) / 2));
+ entry_rect.y() + ((kRowHeight - value_font().GetHeight()) / 2));
bool is_rtl = base::i18n::IsRTL();
cairo_save(cairo_context);
@@ -379,14 +374,14 @@ void AutofillPopupViewGtk::DrawAutofillEntry(cairo_t* cairo_context,
}
// Draw the label text.
- SetLayoutText(autofill_labels()[index], label_font_, kLabelTextColor);
+ SetLayoutText(autofill_labels()[index], label_font(), kLabelTextColor);
x_align_left +=
- is_rtl ? 0 : -label_font_.GetStringWidth(autofill_labels()[index]);
+ is_rtl ? 0 : -label_font().GetStringWidth(autofill_labels()[index]);
// Center the text within the line.
int label_content_y = std::max(
entry_rect.y(),
- entry_rect.y() + ((kRowHeight - label_font_.GetHeight()) / 2));
+ entry_rect.y() + ((kRowHeight - label_font().GetHeight()) / 2));
cairo_save(cairo_context);
cairo_move_to(cairo_context, x_align_left, label_content_y);
@@ -428,9 +423,9 @@ int AutofillPopupViewGtk::GetPopupRequiredWidth() {
DCHECK_EQ(autofill_values().size(), autofill_labels().size());
for (size_t i = 0; i < autofill_values().size(); ++i) {
int row_size = kEndPadding +
- value_font_.GetStringWidth(autofill_values()[i]) +
+ value_font().GetStringWidth(autofill_values()[i]) +
kLabelPadding +
- label_font_.GetStringWidth(autofill_labels()[i]);
+ label_font().GetStringWidth(autofill_labels()[i]);
// Add the Autofill icon size, if required.
if (!autofill_icons()[i].empty())
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698