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

Unified Diff: Source/core/rendering/shapes/BoxShape.cpp

Issue 454123002: Refactor getExcludedIntervals since only one LineSegment is ever returned (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/shapes/BoxShape.cpp
diff --git a/Source/core/rendering/shapes/BoxShape.cpp b/Source/core/rendering/shapes/BoxShape.cpp
index 6b581b8f75aac330c26ae6dcfd4db3ed788211b0..54417d2ba51a54b2e3a09222098ad67ccf42415d 100644
--- a/Source/core/rendering/shapes/BoxShape.cpp
+++ b/Source/core/rendering/shapes/BoxShape.cpp
@@ -52,28 +52,24 @@ FloatRoundedRect BoxShape::shapeMarginBounds() const
return marginBounds;
}
-void BoxShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const
+LineSegment BoxShape::getExcludedInterval(LayoutUnit logicalTop, LayoutUnit logicalHeight) const
{
const FloatRoundedRect& marginBounds = shapeMarginBounds();
if (marginBounds.isEmpty() || !lineOverlapsShapeMarginBounds(logicalTop, logicalHeight))
- return;
+ return LineSegment();
float y1 = logicalTop.toFloat();
float y2 = (logicalTop + logicalHeight).toFloat();
const FloatRect& rect = marginBounds.rect();
- if (!marginBounds.isRounded()) {
- result.append(LineSegment(marginBounds.rect().x(), marginBounds.rect().maxX()));
- return;
- }
+ if (!marginBounds.isRounded())
+ return LineSegment(marginBounds.rect().x(), marginBounds.rect().maxX());
float topCornerMaxY = std::max<float>(marginBounds.topLeftCorner().maxY(), marginBounds.topRightCorner().maxY());
float bottomCornerMinY = std::min<float>(marginBounds.bottomLeftCorner().y(), marginBounds.bottomRightCorner().y());
- if (topCornerMaxY <= bottomCornerMinY && y1 <= topCornerMaxY && y2 >= bottomCornerMinY) {
- result.append(LineSegment(rect.x(), rect.maxX()));
- return;
- }
+ if (topCornerMaxY <= bottomCornerMinY && y1 <= topCornerMaxY && y2 >= bottomCornerMinY)
+ return LineSegment(rect.x(), rect.maxX());
float x1 = rect.maxX();
float x2 = rect.x();
@@ -97,7 +93,7 @@ void BoxShape::getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHei
}
ASSERT(x2 >= x1);
- result.append(LineSegment(x1, x2));
+ return LineSegment(x1, x2);
}
void BoxShape::buildDisplayPaths(DisplayPaths& paths) const

Powered by Google App Engine
This is Rietveld 408576698