Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1326)

Unified Diff: Source/core/rendering/exclusions/ExclusionPolygon.cpp

Issue 14892005: [CSS Exclusions] ExclusionShape bounding box methods should return LayoutRects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: reverted LineSegment logicalLeft,Right type change Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/exclusions/ExclusionPolygon.cpp
diff --git a/Source/core/rendering/exclusions/ExclusionPolygon.cpp b/Source/core/rendering/exclusions/ExclusionPolygon.cpp
index b89d1e5d40af2253959bcff7f8505aaf0c2c2892..1157041a79855fb6531f1759b801243710e59baf 100644
--- a/Source/core/rendering/exclusions/ExclusionPolygon.cpp
+++ b/Source/core/rendering/exclusions/ExclusionPolygon.cpp
@@ -347,14 +347,14 @@ static void computeOverlappingEdgeXProjections(const FloatPolygon& polygon, floa
sortExclusionIntervals(result);
}
-void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const
+void ExclusionPolygon::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatPolygon& polygon = shapeMarginBounds();
if (polygon.isEmpty())
return;
float y1 = logicalTop;
- float y2 = y1 + logicalHeight;
+ float y2 = logicalTop + logicalHeight;
Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
computeXIntersections(polygon, y1, true, y1XIntervals);
@@ -375,14 +375,14 @@ void ExclusionPolygon::getExcludedIntervals(float logicalTop, float logicalHeigh
}
}
-void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const
+void ExclusionPolygon::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
{
const FloatPolygon& polygon = shapePaddingBounds();
if (polygon.isEmpty())
return;
float y1 = logicalTop;
- float y2 = y1 + logicalHeight;
+ float y2 = logicalTop + logicalHeight;
Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
computeXIntersections(polygon, y1, true, y1XIntervals);
@@ -427,24 +427,28 @@ static inline bool aboveOrToTheLeft(const FloatRect& r1, const FloatRect& r2)
return false;
}
-bool ExclusionPolygon::firstIncludedIntervalLogicalTop(float minLogicalIntervalTop, const FloatSize& minLogicalIntervalSize, float& result) const
+bool ExclusionPolygon::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit& result) const
{
+ float minIntervalTop = minLogicalIntervalTop;
+ float minIntervalHeight = minLogicalIntervalSize.height();
+ float minIntervalWidth = minLogicalIntervalSize.width();
+
const FloatPolygon& polygon = shapePaddingBounds();
const FloatRect boundingBox = polygon.boundingBox();
- if (minLogicalIntervalSize.width() > boundingBox.width())
+ if (minIntervalWidth > boundingBox.width())
return false;
- float minY = std::max(boundingBox.y(), minLogicalIntervalTop);
- float maxY = minY + minLogicalIntervalSize.height();
+ float minY = std::max(boundingBox.y(), minIntervalTop);
+ float maxY = minY + minIntervalHeight;
if (maxY > boundingBox.maxY())
return false;
Vector<const FloatPolygonEdge*> edges;
- polygon.overlappingEdges(minLogicalIntervalTop, boundingBox.maxY(), edges);
+ polygon.overlappingEdges(minIntervalTop, boundingBox.maxY(), edges);
- float dx = minLogicalIntervalSize.width() / 2;
- float dy = minLogicalIntervalSize.height() / 2;
+ float dx = minIntervalWidth / 2;
+ float dy = minIntervalHeight / 2;
Vector<OffsetPolygonEdge> offsetEdges;
for (unsigned i = 0; i < edges.size(); ++i) {
@@ -478,7 +482,7 @@ bool ExclusionPolygon::firstIncludedIntervalLogicalTop(float minLogicalIntervalT
offsetEdges.append(offsetEdgeBuffer[j]);
}
- offsetEdges.append(OffsetPolygonEdge(polygon, minLogicalIntervalTop, FloatSize(0, dy)));
+ offsetEdges.append(OffsetPolygonEdge(polygon, minIntervalTop, FloatSize(0, dy)));
FloatPoint offsetEdgesIntersection;
FloatRect firstFitRect;
@@ -491,7 +495,7 @@ bool ExclusionPolygon::firstIncludedIntervalLogicalTop(float minLogicalIntervalT
FloatRect potentialFirstFitRect(potentialFirstFitLocation, minLogicalIntervalSize);
if ((offsetEdges[i].basis() == OffsetPolygonEdge::LineTop
|| offsetEdges[j].basis() == OffsetPolygonEdge::LineTop
- || potentialFirstFitLocation.y() >= minLogicalIntervalTop)
+ || potentialFirstFitLocation.y() >= minIntervalTop)
&& (!firstFitFound || aboveOrToTheLeft(potentialFirstFitRect, firstFitRect))
&& polygon.contains(offsetEdgesIntersection)
&& firstFitRectInPolygon(polygon, potentialFirstFitRect, offsetEdges[i].edgeIndex(), offsetEdges[j].edgeIndex())) {
@@ -503,7 +507,7 @@ bool ExclusionPolygon::firstIncludedIntervalLogicalTop(float minLogicalIntervalT
}
if (firstFitFound)
- result = firstFitRect.y();
+ result = LayoutUnit::fromFloatCeil(firstFitRect.y());
return firstFitFound;
}
« no previous file with comments | « Source/core/rendering/exclusions/ExclusionPolygon.h ('k') | Source/core/rendering/exclusions/ExclusionRectangle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698