Index: ui/gfx/rect_conversions.cc |
diff --git a/ui/gfx/rect_conversions.cc b/ui/gfx/rect_conversions.cc |
index c548828aa2a9662b023e8421d1511f6e5fd3d937..ac7767b3204de84881b752a43c5c4a09d3e18744 100644 |
--- a/ui/gfx/rect_conversions.cc |
+++ b/ui/gfx/rect_conversions.cc |
@@ -16,8 +16,8 @@ Rect ToEnclosingRect(const RectF& rect) { |
int min_y = ToFlooredInt(rect.y()); |
float max_x = rect.right(); |
float max_y = rect.bottom(); |
- int width = std::max(ToCeiledInt(max_x) - min_x, 0); |
- int height = std::max(ToCeiledInt(max_y) - min_y, 0); |
+ int width = rect.width() == 0 ? 0 : std::max(ToCeiledInt(max_x) - min_x, 0); |
+ int height = rect.height() == 0 ? 0 : std::max(ToCeiledInt(max_y) - min_y, 0); |
return Rect(min_x, min_y, width, height); |
} |