Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upClamp border corner radius #2187
Conversation
|
This is a bit too restrictive - corner radii of more than half the width or height are permitted in CSS if the neighboring corner leaves enough space. See the testcase in #2174 for an example. Here's the code in Firefox that limits corner radii: https://searchfox.org/mozilla-central/rev/f5f1c3f294f89cfd242c3af9eb2c40d19d5e04e7/layout/generic/nsFrame.cpp#1699-1720 |
9b64ffc
to
182b886
|
@mstange I've taken another stab at it, I'm not experienced at reading the specs but I think this matches the Gecko functionality. with the following YAML which incorporates your case in #2174:
|
|
Looks like one failing reftest:
|
|
Depending on what the differences are, it may just be a case of re-generating the reference image. If you open the |
|
Compared to the reference the circle looks like it gets a tad bit tighter which shifts everything over a few pixels. May just be the result of how the CSS distribution algorithm works. I will regenerate the test if everything else here looks good. |
|
@subsevenx2001, you added this test in #1975; can you check whether this test still tests what it's supposed to test if this PR lands? |
|
The patch looks good to me; it's definitely much easier to understand than the Gecko code. I would move the calls to |
|
@mstange |
|
Thanks! I'm just confused why the radius of 40.5 was necessary in the test, instead of just 40. Because Gecko should have limited the radius to 40 on the Gecko side before sending it to WebRender. |
|
Ok, but with the change in this PR we will treat it as 40. |
d31c417
to
b9d9ffa
|
Upon further investigation this case also looks glitched on Firefox Nightly with |
|
OK, is this ready for review / merge then? |
|
@glennw it is, I just am not sure what was decided w.r.t regenerating the |
|
I think you can just regenerate the reference. The scenario that I was concerned about is rather theoretical. |
|
Done. |
|
Looks good, thanks! I'll set up a gecko try run with this shortly, and if that's all green, this should be good to merge. |
|
Oh, wait - was there a reftest to go with this PR? |
|
I can quick add one to this PR |
|
@glennw done :) |
|
Pending Gecko try here: https://hg.mozilla.org/try/rev/7fbf230e21b8ef4310dfb76fa6db5cf57bb81c56 If this is all green when complete, this is ready to merge. |
|
Try looks green. @bors-servo r+ |
|
|
Clamp border corner radius Fixes #2183 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2187) <!-- Reviewable:end -->
|
|
| let bottom_right_radius = &mut radius.bottom_right; | ||
| let bottom_left_radius = &mut radius.bottom_left; | ||
|
|
||
| let sum = top_left_radius.width + bottom_left_radius.width; |
This comment has been minimized.
This comment has been minimized.
| ratio = f32::min(ratio, info.rect.size.width / sum); | ||
| } | ||
|
|
||
| let sum = top_right_radius.width + bottom_right_radius.width; |
This comment has been minimized.
This comment has been minimized.
Fix a bug in the corner radius overlap calculation. This fixes a bug in #2187 which I only noticed after the pull request was merged. I'm also adding a test. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2286) <!-- Reviewable:end -->



nc4rrillo commentedDec 7, 2017
•
edited
Fixes #2183
This change is