servo: Elements with a combination of 'border' and 'border-radius' are drawn incorrectly
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:
border: 3px solid #fff;
border-radius: 100px; /* note, border-radius >= 75px for the element do be 'circular' */
width: 150px;
height: 150px;
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.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (16 by maintainers)
Commits related to this issue
- Fix combination of border and border-radius being drawn incorrectly fixes #20922 — committed to dralley/servo by dralley 7 years ago
- Fix combination of border and border-radius being drawn incorrectly fixes #20922 — committed to dralley/servo by dralley 7 years ago
- Auto merge of #26215 - dralley:fix-image-border, r=<try> Fix combination of border and border-radius being drawn incorrectly fixes #20922 - [x] `./mach build -d` does not report any errors - [x] `.... — committed to servo/servo by bors-servo 7 years ago
- Fix combination of border and border-radius being drawn incorrectly fixes #20922 — committed to dralley/servo by dralley 7 years ago
- Auto merge of #26215 - dralley:fix-image-border, r=<try> Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build ... — committed to servo/servo by bors-servo 7 years ago
- Auto merge of #26215 - dralley:fix-image-border, r=jdm Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build -d... — committed to servo/servo by bors-servo 7 years ago
- Auto merge of #26215 - dralley:fix-image-border, r=jdm Fix combination of border and border-radius being drawn incorrectly fixes #20922 Manual testcase in the attached issue - [x] `./mach build -d... — committed to servo/servo by bors-servo 7 years ago
https://github.com/servo/servo/blob/11edbfc159e30b5dffdf9df4e1880ba02cc3f0f8/components/layout/display_list/background.rs#L714 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.
Layout 2020, meanwhile, looks like this:
Switching the img to a div shows the expected circular background color with the borders appearing over top as expected.