Index: Source/WebCore/platform/graphics/FloatRect.cpp |
diff --git a/Source/WebCore/platform/graphics/FloatRect.cpp b/Source/WebCore/platform/graphics/FloatRect.cpp |
index eb165182b7bec41c90d9a82e3dd5623f81439123..f99284015fbfadd0d245ccdf9cfb1aca13f34375 100644 |
--- a/Source/WebCore/platform/graphics/FloatRect.cpp |
+++ b/Source/WebCore/platform/graphics/FloatRect.cpp |
@@ -93,6 +93,27 @@ void FloatRect::intersect(const FloatRect& other) |
setLocationAndSizeFromEdges(l, t, r, b); |
} |
+bool FloatRect::inclusiveIntersect(const FloatRect& other) |
+{ |
+ float l = std::max(x(), other.x()); |
+ float t = std::max(y(), other.y()); |
+ float r = std::min(maxX(), other.maxX()); |
+ float b = std::min(maxY(), other.maxY()); |
+ |
+ // Return a clean empty rectangle for non-intersecting cases. |
+ if (l > r || t > b) { |
+ l = 0; |
+ t = 0; |
+ r = 0; |
+ b = 0; |
+ return false; |
+ } |
+ |
+ setLocationAndSizeFromEdges(l, t, r, b); |
+ return true; |
+} |
+ |
+ |
void FloatRect::unite(const FloatRect& other) |
{ |
// Handle empty special cases first. |