Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1237)

Unified Diff: Source/WebCore/platform/graphics/FloatRect.cpp

Issue 359780043: WIP for IO
Patch Set: 22 tests pass Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/platform/graphics/FloatRect.h ('k') | Source/WebCore/platform/graphics/LayoutRect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « Source/WebCore/platform/graphics/FloatRect.h ('k') | Source/WebCore/platform/graphics/LayoutRect.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b