| 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/libgtkui/gtk_util.h" |    5 #include "chrome/browser/ui/libgtkui/gtk_util.h" | 
|    6  |    6  | 
|    7 #include <dlfcn.h> |    7 #include <dlfcn.h> | 
|    8 #include <gdk/gdk.h> |    8 #include <gdk/gdk.h> | 
|    9 #include <gdk/gdkx.h> |    9 #include <gdk/gdkx.h> | 
|   10 #include <gtk/gtk.h> |   10 #include <gtk/gtk.h> | 
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  365   } |  365   } | 
|  366 } |  366 } | 
|  367  |  367  | 
|  368 void RemoveBorders(GtkStyleContext* context) { |  368 void RemoveBorders(GtkStyleContext* context) { | 
|  369   static GtkCssProvider* provider = GetCssProvider( |  369   static GtkCssProvider* provider = GetCssProvider( | 
|  370       "* {" |  370       "* {" | 
|  371       "border-style: none;" |  371       "border-style: none;" | 
|  372       "border-radius: 0px;" |  372       "border-radius: 0px;" | 
|  373       "border-width: 0px;" |  373       "border-width: 0px;" | 
|  374       "border-image-width: 0px;" |  374       "border-image-width: 0px;" | 
 |  375       "box-shadow: none;" | 
|  375       "padding: 0px;" |  376       "padding: 0px;" | 
|  376       "margin: 0px;" |  377       "margin: 0px;" | 
 |  378       "outline: none;" | 
 |  379       "outline-width: 0px;" | 
|  377       "}"); |  380       "}"); | 
|  378   ApplyCssToContext(context, provider); |  381   ApplyCssToContext(context, provider); | 
|  379 } |  382 } | 
|  380  |  383  | 
|  381 void AddBorders(GtkStyleContext* context) { |  384 void AddBorders(GtkStyleContext* context) { | 
|  382   static GtkCssProvider* provider = GetCssProvider( |  385   static GtkCssProvider* provider = GetCssProvider( | 
|  383       "* {" |  386       "* {" | 
|  384       "border-style: solid;" |  387       "border-style: solid;" | 
|  385       "border-radius: 0px;" |  388       "border-radius: 0px;" | 
|  386       "border-width: 1px;" |  389       "border-width: 1px;" | 
 |  390       "box-shadow: none;" | 
|  387       "padding: 0px;" |  391       "padding: 0px;" | 
|  388       "margin: 0px;" |  392       "margin: 0px;" | 
 |  393       "outline: none;" | 
 |  394       "outline-width: 0px;" | 
|  389       "}"); |  395       "}"); | 
|  390   ApplyCssToContext(context, provider); |  396   ApplyCssToContext(context, provider); | 
|  391 } |  397 } | 
|  392  |  398  | 
|  393 // A 1x1 cairo surface that GTK can render into. |  399 // A 1x1 cairo surface that GTK can render into. | 
|  394 class PixelSurface { |  400 class PixelSurface { | 
|  395  public: |  401  public: | 
|  396   PixelSurface() |  402   PixelSurface() | 
|  397       : surface_(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1)), |  403       : surface_(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1)), | 
|  398         cairo_(cairo_create(surface_)) {} |  404         cairo_(cairo_create(surface_)) {} | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  454  |  460  | 
|  455   AddBorders(context); |  461   AddBorders(context); | 
|  456   PixelSurface surface; |  462   PixelSurface surface; | 
|  457   RenderBackground(surface.cairo(), context); |  463   RenderBackground(surface.cairo(), context); | 
|  458   gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); |  464   gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); | 
|  459   return surface.GetPixelValue(); |  465   return surface.GetPixelValue(); | 
|  460 } |  466 } | 
|  461 #endif |  467 #endif | 
|  462  |  468  | 
|  463 }  // namespace libgtkui |  469 }  // namespace libgtkui | 
| OLD | NEW |