Index: ui/gfx/geometry/rect_conversions.cc |
diff --git a/ui/gfx/geometry/rect_conversions.cc b/ui/gfx/geometry/rect_conversions.cc |
index b4ef3d44ec9c4e434b93ae64531cde2f6197014e..fbb51f3cd9ecaa77e254b1c74597a4b860049067 100644 |
--- a/ui/gfx/geometry/rect_conversions.cc |
+++ b/ui/gfx/geometry/rect_conversions.cc |
@@ -12,19 +12,22 @@ |
namespace gfx { |
+// This is the minimum size of a float rect dimension for use to include it |
+// in the enclosing int rect. |
+static const float kEmptyDimension = 0.1f; |
Peter Mayo
2017/03/20 18:53:50
That is too big - it causes unittests to fail. (oc
|
Rect ToEnclosingRect(const RectF& rect) { |
int min_x = ToFlooredInt(rect.x()); |
int min_y = ToFlooredInt(rect.y()); |
float max_x = rect.right(); |
float max_y = rect.bottom(); |
int width = |
- rect.width() == 0 |
+ rect.width() < kEmptyDimension |
? 0 |
: std::max( |
ToCeiledInt(static_cast<double>(ToCeiledInt(max_x)) - min_x), |
0); |
int height = |
- rect.height() == 0 |
+ rect.height() < kEmptyDimension |
? 0 |
: std::max( |
ToCeiledInt(static_cast<double>(ToCeiledInt(max_y)) - min_y), |