OLD | NEW |
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/gtk/autofill/autofill_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/i18n/rtl.h" | |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 11 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
13 #include "chrome/browser/ui/gtk/gtk_util.h" | 12 #include "chrome/browser/ui/gtk/gtk_util.h" |
14 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
16 #include "ui/base/gtk/gtk_compat.h" | 15 #include "ui/base/gtk/gtk_compat.h" |
17 #include "ui/base/gtk/gtk_hig_constants.h" | 16 #include "ui/base/gtk/gtk_hig_constants.h" |
18 #include "ui/base/gtk/gtk_windowing.h" | 17 #include "ui/base/gtk/gtk_windowing.h" |
19 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 int value_text_width = controller_->GetNameFontForRow(index).GetStringWidth( | 229 int value_text_width = controller_->GetNameFontForRow(index).GetStringWidth( |
231 controller_->names()[index]); | 230 controller_->names()[index]); |
232 | 231 |
233 // Center the text within the line. | 232 // Center the text within the line. |
234 int row_height = entry_rect.height(); | 233 int row_height = entry_rect.height(); |
235 int value_content_y = std::max( | 234 int value_content_y = std::max( |
236 entry_rect.y(), | 235 entry_rect.y(), |
237 entry_rect.y() + | 236 entry_rect.y() + |
238 (row_height - controller_->GetNameFontForRow(index).GetHeight()) / 2); | 237 (row_height - controller_->GetNameFontForRow(index).GetHeight()) / 2); |
239 | 238 |
240 bool is_rtl = base::i18n::IsRTL(); | 239 bool is_rtl = controller_->IsRTL(); |
241 int value_content_x = is_rtl ? | 240 int value_content_x = is_rtl ? |
242 entry_rect.width() - value_text_width - kEndPadding : kEndPadding; | 241 entry_rect.width() - value_text_width - kEndPadding : kEndPadding; |
243 | 242 |
244 cairo_save(cairo_context); | 243 cairo_save(cairo_context); |
245 cairo_move_to(cairo_context, value_content_x, value_content_y); | 244 cairo_move_to(cairo_context, value_content_x, value_content_y); |
246 pango_cairo_show_layout(cairo_context, layout_); | 245 pango_cairo_show_layout(cairo_context, layout_); |
247 cairo_restore(cairo_context); | 246 cairo_restore(cairo_context); |
248 | 247 |
249 // Use this to figure out where all the other Autofill items should be placed. | 248 // Use this to figure out where all the other Autofill items should be placed. |
250 int x_align_left = is_rtl ? kEndPadding : entry_rect.width() - kEndPadding; | 249 int x_align_left = is_rtl ? kEndPadding : entry_rect.width() - kEndPadding; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 pango_cairo_show_layout(cairo_context, layout_); | 288 pango_cairo_show_layout(cairo_context, layout_); |
290 cairo_restore(cairo_context); | 289 cairo_restore(cairo_context); |
291 } | 290 } |
292 | 291 |
293 AutofillPopupView* AutofillPopupView::Create( | 292 AutofillPopupView* AutofillPopupView::Create( |
294 AutofillPopupController* controller) { | 293 AutofillPopupController* controller) { |
295 return new AutofillPopupViewGtk(controller); | 294 return new AutofillPopupViewGtk(controller); |
296 } | 295 } |
297 | 296 |
298 } // namespace autofill | 297 } // namespace autofill |
OLD | NEW |