Index: third_party/WebKit/Source/platform/graphics/Path.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/Path.cpp b/third_party/WebKit/Source/platform/graphics/Path.cpp |
index 2fd75f846eb85a9d762f0115ee9bc2a8ea9b0e00..b163fa41326e1d38a190eb148ccd8e41bef2638c 100644 |
--- a/third_party/WebKit/Source/platform/graphics/Path.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/Path.cpp |
@@ -115,14 +115,31 @@ bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) |
return strokePath(strokeData).contains(WebCoreFloatToSkScalar(point.x()), WebCoreFloatToSkScalar(point.y())); |
} |
-FloatRect Path::boundingRect() const |
+namespace { |
+ |
+FloatRect pathBounds(const SkPath& path, Path::BoundsType boundsType) |
+{ |
+ SkRect bounds; |
+ if (boundsType == Path::BoundsType::Conservative |
+ || !TightBounds(path, &bounds) |
+ || bounds.isEmpty()) // workaround for https://bugs.chromium.org/p/skia/issues/detail?id=5555 |
+ return path.getBounds(); |
+ |
+ DCHECK(boundsType == Path::BoundsType::Exact); |
fs
2016/07/21 19:21:40
(DCHECK_EQ? Or maybe that doesn't for enum class,
f(malita)
2016/07/22 18:40:01
Done.
|
+ return bounds; |
+} |
+ |
+} // anonymous ns |
+ |
+// TODO(fmalita): evaluate returning exact bounds in all cases. |
+FloatRect Path::boundingRect(BoundsType boundsType) const |
{ |
- return m_path.getBounds(); |
+ return pathBounds(m_path, boundsType); |
} |
-FloatRect Path::strokeBoundingRect(const StrokeData& strokeData) const |
+FloatRect Path::strokeBoundingRect(const StrokeData& strokeData, BoundsType boundsType) const |
{ |
- return strokePath(strokeData).getBounds(); |
+ return pathBounds(strokePath(strokeData), boundsType); |
} |
static FloatPoint* convertPathPoints(FloatPoint dst[], const SkPoint src[], int count) |