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` 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 ___
This commit is contained in:
bors-servo 2020-05-02 10:24:16 -04:00 committed by GitHub
commit 73abf56e99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 2 deletions

View file

@ -1733,8 +1733,18 @@ impl Fragment {
build_border_radius_for_inner_rect(stacking_relative_border_box, &self.style); build_border_radius_for_inner_rect(stacking_relative_border_box, &self.style);
if !radii.is_zero() { if !radii.is_zero() {
let clip_id = // This is already calculated inside of build_border_radius_for_inner_rect(), it would be
state.add_late_clip_node(stacking_relative_border_box.to_layout(), radii); // nice if it were only calculated once.
let border_widths = self
.style
.logical_border_width()
.to_physical(self.style.writing_mode);
let clip_id = state.add_late_clip_node(
stacking_relative_border_box
.inner_rect(border_widths)
.to_layout(),
radii,
);
state.current_clipping_and_scrolling = ClippingAndScrolling::simple(clip_id); state.current_clipping_and_scrolling = ClippingAndScrolling::simple(clip_id);
} }

View file

@ -0,0 +1,2 @@
[border-radius-image.html]
expected: FAIL

View file

@ -896,6 +896,19 @@
{} {}
] ]
], ],
"border-radius-image.html": [
"2e30ba4bcb40b0fd50ae2c35992e06423720b26e",
[
null,
[
[
"/_mozilla/css/border-radius-image-ref.html",
"=="
]
],
{}
]
],
"border_black_groove.html": [ "border_black_groove.html": [
"49e1647a6f71e320770225ad537b4fd4020bd700", "49e1647a6f71e320770225ad537b4fd4020bd700",
[ [
@ -8670,6 +8683,10 @@
"0dddcf89d26d6ac1efe7b0d65e5607a3ed771b46", "0dddcf89d26d6ac1efe7b0d65e5607a3ed771b46",
[] []
], ],
"border-radius-image-ref.html": [
"3aa9bea5a48a4d809fabf1108049a24365edb07f",
[]
],
"border_black_solid.html": [ "border_black_solid.html": [
"63ef95bef813b5c3a75c0da4cd7773f35db3c5ff", "63ef95bef813b5c3a75c0da4cd7773f35db3c5ff",
[] []

View file

@ -0,0 +1,2 @@
[border-radius-image.html]
fuzzy: /_mozilla/css/border-radius-image-ref.html:63;696

View file

@ -0,0 +1,10 @@
<style>
#ref {
width: 100px;
height: 100px;
border: 10px solid black;
border-radius: 60px;
background-color: #00ff00;
}
</style>
<div id="ref"></div>

View file

@ -0,0 +1,9 @@
<link rel="match" href="border-radius-image-ref.html">
<!-- Border-radius should apply to the actual image as well as the border -->
<style>
img {
border: 10px solid black;
border-radius: 60px;
}
</style>
<img src="/images/green-1x1.png" width=100 height=100>