| Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
 | 
| diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
 | 
| index 1925e13cd9d18a880669eba77bdc66c6416b08fd..29d8e1c3c007eaae9ed7723376a00f51e4de8e64 100644
 | 
| --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
 | 
| +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
 | 
| @@ -8,6 +8,7 @@
 | 
|  #include <set>
 | 
|  
 | 
|  #include <pango/pango.h>
 | 
| +#include <X11/Xlib.h>
 | 
|  
 | 
|  #include "base/command_line.h"
 | 
|  #include "base/debug/leak_annotations.h"
 | 
| @@ -49,6 +50,7 @@
 | 
|  #include "ui/gfx/image/image.h"
 | 
|  #include "ui/gfx/skbitmap_operations.h"
 | 
|  #include "ui/gfx/skia_util.h"
 | 
| +#include "ui/gfx/x/x11_types.h"
 | 
|  #include "ui/resources/grit/ui_resources.h"
 | 
|  #include "ui/views/controls/button/label_button.h"
 | 
|  #include "ui/views/controls/button/label_button_border.h"
 | 
| @@ -378,20 +380,27 @@ gfx::FontRenderParams GetGtkFontRenderParams() {
 | 
|    return params;
 | 
|  }
 | 
|  
 | 
| -double GetDPI() {
 | 
| +double GetBaseDPI() {
 | 
| +  XDisplay* xdisplay = gfx::GetXDisplay();
 | 
| +  int xscreen = DefaultScreen(xdisplay);
 | 
| +  return (DisplayHeight(xdisplay, xscreen) * 25.4) /
 | 
| +         DisplayHeightMM(xdisplay, xscreen);
 | 
| +}
 | 
| +
 | 
| +double GetFontDPI() {
 | 
|    GtkSettings* gtk_settings = gtk_settings_get_default();
 | 
|    CHECK(gtk_settings);
 | 
|    gint gtk_dpi = -1;
 | 
|    g_object_get(gtk_settings, "gtk-xft-dpi", >k_dpi, NULL);
 | 
|  
 | 
|    // GTK multiplies the DPI by 1024 before storing it.
 | 
| -  return (gtk_dpi > 0) ? gtk_dpi / 1024.0 : 96.0;
 | 
| +  return (gtk_dpi > 0) ? gtk_dpi / 1024.0 : GetBaseDPI();
 | 
|  }
 | 
|  
 | 
|  // Queries GTK for its font DPI setting and returns the number of pixels in a
 | 
|  // point.
 | 
|  double GetPixelsInPoint(float device_scale_factor) {
 | 
| -  double dpi = GetDPI();
 | 
| +  double dpi = GetFontDPI();
 | 
|  
 | 
|    // Take device_scale_factor into account — if Chrome already scales the
 | 
|    // entire UI up by 2x, we should not also scale up.
 | 
| @@ -1424,10 +1433,9 @@ void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
 | 
|  }
 | 
|  
 | 
|  float Gtk2UI::GetDeviceScaleFactor() const {
 | 
| -  const int kCSSDefaultDPI = 96;
 | 
| -  float scale = GetDPI() / kCSSDefaultDPI;
 | 
| -  // Round to 2 decimals, e.g. to 1.33.
 | 
| -  return roundf(scale * 100) / 100;
 | 
| +  float scale = GetFontDPI() / GetBaseDPI();
 | 
| +  // Round to 1 decimal, e.g. to 1.4.
 | 
| +  return roundf(scale * 10) / 10;
 | 
|  }
 | 
|  
 | 
|  }  // namespace libgtk2ui
 | 
| 
 |