Reland: Updating calls to offscreen buffers to use a size of (0,0) when they do not require an actual buffer

These updates would enable the surfaceless context extension where available.

BUG=377497

Review URL: https://codereview.chromium.org/303223002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273691 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc
index 8018fe8..58d955b 100644
--- a/ui/gl/gl_surface_osmesa.cc
+++ b/ui/gl/gl_surface_osmesa.cc
@@ -14,6 +14,10 @@
 GLSurfaceOSMesa::GLSurfaceOSMesa(unsigned format, const gfx::Size& size)
     : format_(format),
       size_(size) {
+  // Implementations of OSMesa surface do not support having a 0 size. In such
+  // cases use a (1, 1) surface.
+  if (size_.GetArea() == 0)
+    size_.SetSize(1, 1);
 }
 
 bool GLSurfaceOSMesa::Initialize() {