Index: Source/WebCore/platform/graphics/LayoutRect.cpp |
diff --git a/Source/WebCore/platform/graphics/LayoutRect.cpp b/Source/WebCore/platform/graphics/LayoutRect.cpp |
index fd0b6994c334d2569682e2340a1b51969119b341..7f449fba56243b1b4d0d14d517bdc75c266b93b1 100644 |
--- a/Source/WebCore/platform/graphics/LayoutRect.cpp |
+++ b/Source/WebCore/platform/graphics/LayoutRect.cpp |
@@ -71,6 +71,22 @@ void LayoutRect::intersect(const LayoutRect& other) |
m_size = newMaxPoint - newLocation; |
} |
+bool LayoutRect::inclusiveIntersect(const LayoutRect& other) |
+{ |
+ LayoutPoint newLocation(std::max(x(), other.x()), std::max(y(), other.y())); |
+ LayoutPoint newMaxPoint(std::min(maxX(), other.maxX()), std::min(maxY(), other.maxY())); |
+ |
+ if (newLocation.x() > newMaxPoint.x() || newLocation.y() > newMaxPoint.y()) { |
+ newLocation = LayoutPoint(0, 0); |
+ newMaxPoint = LayoutPoint(0, 0); |
+ return false; |
+ } |
+ |
+ m_location = newLocation; |
+ m_size = newMaxPoint - newLocation; |
+ return true; |
+} |
+ |
void LayoutRect::unite(const LayoutRect& other) |
{ |
// Handle empty special cases first. |