Chromium Code Reviews| 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 "ui/gfx/size.h" | 5 #include "ui/gfx/size.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(OS_MACOSX) | 9 #elif defined(OS_MACOSX) |
| 10 #include <CoreGraphics/CGGeometry.h> | 10 #include <CoreGraphics/CGGeometry.h> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 return s; | 45 return s; |
| 46 } | 46 } |
| 47 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
| 48 CGSize Size::ToCGSize() const { | 48 CGSize Size::ToCGSize() const { |
| 49 return CGSizeMake(width_, height_); | 49 return CGSizeMake(width_, height_); |
| 50 } | 50 } |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 void Size::set_width(int width) { | 53 void Size::set_width(int width) { |
| 54 if (width < 0) { | 54 if (width < 0) { |
| 55 NOTREACHED() << "negative width:" << width; | 55 // NOTREACHED() << "negative width:" << width; |
|
tfarina
2012/03/28 16:16:04
please, revert this change.
| |
| 56 width = 0; | 56 width = 0; |
| 57 } | 57 } |
| 58 width_ = width; | 58 width_ = width; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void Size::set_height(int height) { | 61 void Size::set_height(int height) { |
| 62 if (height < 0) { | 62 if (height < 0) { |
| 63 NOTREACHED() << "negative height:" << height; | 63 NOTREACHED() << "negative height:" << height; |
| 64 height = 0; | 64 height = 0; |
| 65 } | 65 } |
| 66 height_ = height; | 66 height_ = height; |
| 67 } | 67 } |
| 68 | 68 |
| 69 std::string Size::ToString() const { | 69 std::string Size::ToString() const { |
| 70 return base::StringPrintf("%dx%d", width_, height_); | 70 return base::StringPrintf("%dx%d", width_, height_); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace gfx | 73 } // namespace gfx |
| OLD | NEW |