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) | |
| 20 // TODO(aelias): Remove these ifdefs for Android. See http://crbug.com/168927 | 19 // TODO(aelias): Remove these ifdefs for Android. See http://crbug.com/168927 |
|
piman
2013/01/10 17:52:06
nit: remove TODO
Jerome
2013/01/10 19:21:55
Done.
| |
| 21 DCHECK(!(width < 0)); | 20 DCHECK(!(width < 0)); |
| 22 #endif | |
| 23 width_ = width < 0 ? 0 : width; | 21 width_ = width < 0 ? 0 : width; |
| 24 } | 22 } |
| 25 | 23 |
| 26 template<typename Class, typename Type> | 24 template<typename Class, typename Type> |
| 27 void SizeBase<Class, Type>::set_height(Type height) { | 25 void SizeBase<Class, Type>::set_height(Type height) { |
| 28 #if !defined(OS_ANDROID) | |
| 29 DCHECK(!(height < 0)); | 26 DCHECK(!(height < 0)); |
| 30 #endif | |
| 31 height_ = height < 0 ? 0 : height; | 27 height_ = height < 0 ? 0 : height; |
| 32 } | 28 } |
| 33 | 29 |
| 34 template<typename Class, typename Type> | 30 template<typename Class, typename Type> |
| 35 SizeBase<Class, Type>::SizeBase(Type width, Type height) | 31 SizeBase<Class, Type>::SizeBase(Type width, Type height) |
| 36 : width_(width < 0 ? 0 : width), | 32 : width_(width < 0 ? 0 : width), |
| 37 height_(height < 0 ? 0 : height) { | 33 height_(height < 0 ? 0 : height) { |
| 38 #if !defined(OS_ANDROID) | |
| 39 DCHECK(!(width < 0)); | 34 DCHECK(!(width < 0)); |
| 40 DCHECK(!(height < 0)); | 35 DCHECK(!(height < 0)); |
| 41 #endif | |
| 42 } | 36 } |
| 43 | 37 |
| 44 } // namespace gfx | 38 } // namespace gfx |
| OLD | NEW |