| Index: ui/gfx/size_base_impl.h
|
| diff --git a/ui/gfx/size_base_impl.h b/ui/gfx/size_base_impl.h
|
| index 4eca7410f075fea8a8ca73e6cf329216e36e2e70..e76748030603042bca2f120ad53d6f855e016749 100644
|
| --- a/ui/gfx/size_base_impl.h
|
| +++ b/ui/gfx/size_base_impl.h
|
| @@ -16,7 +16,9 @@
|
| namespace gfx {
|
|
|
| template<typename Class, typename Type>
|
| -SizeBase<Class, Type>::SizeBase(Type width, Type height) {
|
| +SizeBase<Class, Type>::SizeBase(Type width, Type height)
|
| + : allow_negative_size_(false),
|
| + crash_if_negative_(false) {
|
| set_width(width);
|
| set_height(height);
|
| }
|
| @@ -26,8 +28,9 @@ SizeBase<Class, Type>::~SizeBase() {}
|
|
|
| template<typename Class, typename Type>
|
| void SizeBase<Class, Type>::set_width(Type width) {
|
| - if (width < 0) {
|
| - NOTREACHED() << "negative width:" << width;
|
| + if (!allow_negative_size_ && width < 0) {
|
| + if (crash_if_negative_)
|
| + NOTREACHED() << "negative width:" << width;
|
| width = 0;
|
| }
|
| width_ = width;
|
| @@ -35,8 +38,9 @@ void SizeBase<Class, Type>::set_width(Type width) {
|
|
|
| template<typename Class, typename Type>
|
| void SizeBase<Class, Type>::set_height(Type height) {
|
| - if (height < 0) {
|
| - NOTREACHED() << "negative height:" << height;
|
| + if (!allow_negative_size_ && height < 0) {
|
| + if (crash_if_negative_)
|
| + NOTREACHED() << "negative height:" << height;
|
| height = 0;
|
| }
|
| height_ = height;
|
|
|