Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / base / cocoa / underlay_opengl_hosting_window.mm
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
3 // found in the LICENSE file.
4
5 #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
6
7 #include "base/logging.h"
8
9 @implementation UnderlayOpenGLHostingWindow
10
11 - (id)initWithContentRect:(NSRect)contentRect
12                 styleMask:(NSUInteger)windowStyle
13                   backing:(NSBackingStoreType)bufferingType
14                     defer:(BOOL)deferCreation {
15   // It is invalid to create windows with zero width or height. It screws things
16   // up royally:
17   // - It causes console spew: <http://crbug.com/78973>
18   // - It breaks Expose: <http://sourceforge.net/projects/heat-meteo/forums/forum/268087/topic/4582610>
19   //
20   // This is a banned practice
21   // <http://www.chromium.org/developers/coding-style/cocoa-dos-and-donts>. Do
22   // not do this. Use kWindowSizeDeterminedLater in
23   // ui/base/cocoa/window_size_constants.h instead.
24   //
25   // (This is checked here because UnderlayOpenGLHostingWindow is the base of
26   // most Chromium windows, not because this is related to its functionality.)
27   DCHECK(!NSIsEmptyRect(contentRect));
28   self = [super initWithContentRect:contentRect
29                           styleMask:windowStyle
30                             backing:bufferingType
31                              defer:deferCreation];
32   return self;
33 }
34
35 @end