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: chrome

Servo: 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

Most upvoted comments

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:

Screenshot from 2020-04-14 10-58-27 Screenshot from 2020-04-14 10-58-43

Switching the img to a div shows the expected circular background color with the borders appearing over top as expected.