Index: ui/gfx/geometry/rect.cc |
diff --git a/ui/gfx/geometry/rect.cc b/ui/gfx/geometry/rect.cc |
index e7a3aa2aac93f14eb96c4832a130f4bbeafa9253..2a78d0b5c6e3696adeee8d5ffffa32b034e819f9 100644 |
--- a/ui/gfx/geometry/rect.cc |
+++ b/ui/gfx/geometry/rect.cc |
@@ -71,10 +71,16 @@ void Rect::Inset(int left, int top, int right, int bottom) { |
void Rect::Offset(int horizontal, int vertical) { |
origin_ += Vector2d(horizontal, vertical); |
+ // Ensure that width and height remain valid. |
+ set_width(width()); |
+ set_height(height()); |
} |
void Rect::operator+=(const Vector2d& offset) { |
origin_ += offset; |
+ // Ensure that width and height remain valid. |
+ set_width(width()); |
+ set_height(height()); |
} |
void Rect::operator-=(const Vector2d& offset) { |