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

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

Issue 357810044: More wip
Patch Set: Created 5 years, 5 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..638b2cb1becc05e1be09b5a1d71ed257f13830d0 100644
--- a/Source/WebCore/platform/graphics/FloatRect.cpp
+++ b/Source/WebCore/platform/graphics/FloatRect.cpp
@@ -93,6 +93,25 @@ void FloatRect::intersect(const FloatRect& other)
setLocationAndSizeFromEdges(l, t, r, b);
}
+bool FloatRect::edgeInclusiveIntersect(const FloatRect& other)
+{
+ FloatPoint newLocation(std::max(x(), other.x()), std::max(y(), other.y()));
+ FloatPoint newMaxPoint(std::min(maxX(), other.maxX()), std::min(maxY(), other.maxY()));
+
+ bool intersects = true;
+
+ // Return a clean empty rectangle for non-intersecting cases.
+ if (newLocation.x() > newMaxPoint.x() || newLocation.y() > newMaxPoint.y()) {
+ newLocation = { };
+ newMaxPoint = { };
+ intersects = false;
+ }
+
+ m_location = newLocation;
+ m_size = newMaxPoint - newLocation;
+ return intersects;
+}
+
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