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_base.h" | 5 #include "ui/gfx/size_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 // This file provides the implementation for SizeBase template and | 9 // This file provides the implementation for SizeBase template and |
| 10 // used to instantiate the base class for Size and SizeF classes. | 10 // used to instantiate the base class for Size and SizeF classes. |
| 11 #if !defined(UI_IMPLEMENTATION) | 11 #if !defined(UI_IMPLEMENTATION) |
| 12 #error "This file is intended for UI implementation only" | 12 #error "This file is intended for UI implementation only" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 | 16 |
| 17 template<typename Class, typename Type> | 17 template<typename Class, typename Type> |
| 18 void SizeBase<Class, Type>::set_width(Type width) { | 18 void SizeBase<Class, Type>::set_width(Type width) { |
| 19 #if !defined(OS_ANDROID) | |
|
danakj
2013/01/09 01:53:21
can you stick a todo here to remove this with the
nyquist
2013/01/09 01:57:44
Done.
| |
| 19 DCHECK(!(width < 0)); | 20 DCHECK(!(width < 0)); |
| 21 #endif | |
| 20 width_ = width < 0 ? 0 : width; | 22 width_ = width < 0 ? 0 : width; |
| 21 } | 23 } |
| 22 | 24 |
| 23 template<typename Class, typename Type> | 25 template<typename Class, typename Type> |
| 24 void SizeBase<Class, Type>::set_height(Type height) { | 26 void SizeBase<Class, Type>::set_height(Type height) { |
| 27 #if !defined(OS_ANDROID) | |
| 25 DCHECK(!(height < 0)); | 28 DCHECK(!(height < 0)); |
| 29 #endif | |
| 26 height_ = height < 0 ? 0 : height; | 30 height_ = height < 0 ? 0 : height; |
| 27 } | 31 } |
| 28 | 32 |
| 29 template<typename Class, typename Type> | 33 template<typename Class, typename Type> |
| 30 SizeBase<Class, Type>::SizeBase(Type width, Type height) | 34 SizeBase<Class, Type>::SizeBase(Type width, Type height) |
| 31 : width_(width < 0 ? 0 : width), | 35 : width_(width < 0 ? 0 : width), |
| 32 height_(height < 0 ? 0 : height) { | 36 height_(height < 0 ? 0 : height) { |
| 37 #if !defined(OS_ANDROID) | |
| 33 DCHECK(!(width < 0)); | 38 DCHECK(!(width < 0)); |
| 34 DCHECK(!(height < 0)); | 39 DCHECK(!(height < 0)); |
| 40 #endif | |
| 35 } | 41 } |
| 36 | 42 |
| 37 } // namespace gfx | 43 } // namespace gfx |
| OLD | NEW |