| Index: chrome/browser/ui/libgtkui/gtk_ui.cc
|
| diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc
|
| index dd59476a70333754846827023d83ff534227c372..e17e70c07bf1e0970464edb8d4429d0db9d5105d 100644
|
| --- a/chrome/browser/ui/libgtkui/gtk_ui.cc
|
| +++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
|
| @@ -177,8 +177,36 @@ class GtkButtonImageSource : public gfx::ImageSkiaSource {
|
| gtk_style_context_set_state(context, state_flags);
|
| gtk_render_background(context, cr, 0, 0, width, height);
|
| gtk_render_frame(context, cr, 0, 0, width, height);
|
| - if (focus_)
|
| - gtk_render_focus(context, cr, 0, 0, width, height);
|
| + if (focus_) {
|
| + gfx::Rect focus_rect(width, height);
|
| +
|
| + if (!GtkVersionCheck(3, 14)) {
|
| + gint focus_pad;
|
| + gtk_style_context_get_style(context, "focus-padding", &focus_pad,
|
| + nullptr);
|
| + focus_rect.Inset(focus_pad, focus_pad);
|
| +
|
| + if (state_ == ui::NativeTheme::kPressed) {
|
| + gint child_displacement_x, child_displacement_y;
|
| + gboolean displace_focus;
|
| + gtk_style_context_get_style(
|
| + context, "child-displacement-x", &child_displacement_x,
|
| + "child-displacement-y", &child_displacement_y, "displace-focus",
|
| + &displace_focus, nullptr);
|
| + if (displace_focus)
|
| + focus_rect.Offset(child_displacement_x, child_displacement_y);
|
| + }
|
| + }
|
| +
|
| + if (!GtkVersionCheck(3, 20)) {
|
| + GtkBorder border;
|
| + gtk_style_context_get_border(context, state_flags, &border);
|
| + focus_rect.Inset(border.left, border.top, border.right, border.bottom);
|
| + }
|
| +
|
| + gtk_render_focus(context, cr, focus_rect.x(), focus_rect.y(),
|
| + focus_rect.width(), focus_rect.height());
|
| + }
|
| #endif
|
|
|
| cairo_destroy(cr);
|
|
|