[Webkit-unassigned] [Bug 38787] CSS3: We should have a smooth transition between different border radius widths

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Apr 17 21:30:50 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=38787





--- Comment #2 from Simon Fraser (smfr) <simon.fraser at apple.com>  2011-04-17 21:30:50 PST ---
Created an attachment (id=89988)
 --> (https://bugs.webkit.org/attachment.cgi?id=89988&action=review)
One possible rendering

On possible rendering for this is shown in the attachment. The code for that looks something like:


diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp
index b3ea499..8f14716 100644
--- a/Source/WebCore/rendering/style/RenderStyle.cpp
+++ b/Source/WebCore/rendering/style/RenderStyle.cpp
@@ -803,15 +803,30 @@ RoundedIntRect RenderStyle::getRoundedBorderFor(const IntRect& rect) const
 {
     RoundedIntRect::Radii radii = calcRadiiFor(surround->border, rect.width(), rect.height());
     radii.scale(calcConstraintScaleFor(rect, radii));
+    
+    // Further constrain the radii
+    int leftWidth = borderLeftWidth();
+    int rightWidth = borderRightWidth();
+    int topWidth = borderTopWidth();
+    int bottomWidth = borderBottomWidth();
+    
+    int maxLeftRadius = rect.width() - rightWidth;
+    int maxRightRadius = rect.width() - leftWidth;
+    int maxTopRadius = rect.width() - bottomWidth;
+    int maxBottomRadius = rect.width() - topWidth;
+    
+    radii.setTopLeft(IntSize(min(radii.topLeft().width(), maxLeftRadius), min(radii.topLeft().height(), maxTopRadius)));
+    radii.setTopRight(IntSize(min(radii.topRight().width(), maxRightRadius), min(radii.topRight().height(), maxTopRadius)));
+    radii.setBottomLeft(IntSize(min(radii.bottomLeft().width(), maxLeftRadius), min(radii.bottomLeft().height(), maxBottomRadius)));
+    radii.setBottomRight(IntSize(min(radii.bottomRight().width(), maxRightRadius), min(radii.bottomRight().height(), maxBottomRadius)));
+    
     return RoundedIntRect(rect, radii);
 }

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list