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 upElements with a combination of 'border' and 'border-radius' are drawn incorrectly #20922
Comments
| is the code that is responsible for creating a border radius value that is added to display list items. It would be worth creating a minimal testcase so it's easier to trace the code that ends up reaching there. |
|
Perfect, will do. Thanks! |
|
It may be that our display list is correct and webrender is interpreting it incorrectly. @gw3583 does this ring any bells? |
|
I think the issue might be here: webrender/src/util.rs extract_inner_rect_impl. I'll have another look in a bit and if needed will try to build the webrenderer and use that to find where it's going wrong. |
|
It doesn't ring any bells. It's certainly possible it could be a bug in WR, although I don't think we've seen anything like this in Gecko thus far. One option would be to build wrench (the standalone WR reftest tool) and see if you can reproduce it in wrench by modifying some of the border reftests (for example https://github.com/servo/webrender/tree/master/wrench/reftests/border). |
|
If you can reproduce it there, that would rule out Servo being the issue. |
|
Perfect, I'll try that. Thanks! |
|
Running the border-tests using:
in WebRender outputs failing tests (both on 'master' & on 'auto'):
Is this to be expected (as in tests written but not yet implemented), or should these reftests always pass? I think this is indeed a WR issue. See servo/webrender/issues/2754 |
|
For the reftests, you'll need to use the headless script to run them - this will ensure that they are drawn with a software rasterizer for consistency between machines:
|
|
The test snippet from #20922 (comment) is fixed, but the original website link still renders incorrectly. |
|
Switching the img to a div shows the expected circular background color with the borders appearing over top as expected. |
|
Do you have idea where the code that controls this would be located? |
|
@jdm ^ |
Of course, it's not clear to me if ultimately the problem is that:
|
|
So, 2 things:
Does that help pin down the problem? Other differences, irrelevant to the current problem but might be worthwhile to think about:
|
|
Found a duplicate (well, probably duplicate) issue, it's a lot more obvious with the example they use: #22818 |
|
Ignore #20922 (comment), I'm wrong, it's definitely drawing a round border and then drawing the rectangular image on top of that. It's obvious if you toss a panic in before the image gets drawn. All the dimensions are correct when I measure with GIMP (as far as I know, I have very little web dev experience). It seems like the image stops drawing at the outer edge of the border rather than the inner edge, or it's on top when it should not be. I assume the issue is probably somewhere in here? https://github.com/servo/servo/blob/master/components/layout/display_list/builder.rs#L1720 |
|
The CSS specification defines an order in which elements are painted in https://www.w3.org/TR/CSS2/zindex.html#painting-order. Given this, I believe that painting borders before the image content is correct. Since changing the border-radius to 0 in the testcase shows the border correctly, this suggests to me that the calculations for border-radius interact poorly with the calculations for where to draw the border, which suggests that the error is in https://github.com/servo/servo/blob/master/components/layout/display_list/builder.rs#L1731-L1739 or https://github.com/servo/servo/blob/master/components/layout/display_list/builder.rs#L574-L590 |
Fix combination of border and border-radius being drawn incorrectly fixes #20922 - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20922 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___
Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20922 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___
Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20922 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___
Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #20922 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because ___







Excuse my narcism here for posting my own profile picture, but I was checking out my own website in servo. What I noticed is that my profile picture that is supposed to be round, get's drawn incorrectly:
Google Chrome:

Servo:

When I try to create a 'circular' element with the following attributes:
To me it looks like the image gets square borders and then is rounded, instead of the other way around. I'm interested in contributing to servo and would love to pick this issue up if you think it's doable.