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

Unified Diff: Source/platform/geometry/FloatRoundedRect.cpp

Issue 1136083002: Drop assert for degenerate cases in FloatRoundedRect::radiusCenterRect() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/platform/geometry/FloatRoundedRectTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/FloatRoundedRect.cpp
diff --git a/Source/platform/geometry/FloatRoundedRect.cpp b/Source/platform/geometry/FloatRoundedRect.cpp
index 8875445361c7e0320d13003495e753fbd073c231..9193b02b5a51449f7668bc727b6540426d494fb0 100644
--- a/Source/platform/geometry/FloatRoundedRect.cpp
+++ b/Source/platform/geometry/FloatRoundedRect.cpp
@@ -158,12 +158,14 @@ static inline float cornerRectIntercept(float y, const FloatRect& cornerRect)
FloatRect FloatRoundedRect::radiusCenterRect() const
{
- ASSERT(isRenderable());
- int minX = m_rect.x() + std::max(m_radii.topLeft().width(), m_radii.bottomLeft().width());
- int minY = m_rect.y() + std::max(m_radii.topLeft().height(), m_radii.topRight().height());
- int maxX = m_rect.maxX() - std::max(m_radii.topRight().width(), m_radii.bottomRight().width());
- int maxY = m_rect.maxY() - std::max(m_radii.bottomLeft().height(), m_radii.bottomRight().height());
- return FloatRect(minX, minY, maxX - minX, maxY - minY);
+ FloatRectOutsets maximumRadiusInsets(
+ -std::max(m_radii.topLeft().height(), m_radii.topRight().height()),
+ -std::max(m_radii.topRight().width(), m_radii.bottomRight().width()),
+ -std::max(m_radii.bottomLeft().height(), m_radii.bottomRight().height()),
+ -std::max(m_radii.topLeft().width(), m_radii.bottomLeft().width()));
+ FloatRect centerRect(m_rect);
+ centerRect.expand(maximumRadiusInsets);
+ return centerRect;
}
bool FloatRoundedRect::xInterceptsAtY(float y, float& minXIntercept, float& maxXIntercept) const
« no previous file with comments | « no previous file | Source/platform/geometry/FloatRoundedRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698