Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background follow ups #25594

Merged
merged 10 commits into from Jan 25, 2020

Apply `background-clip` to `background-color`

  • Loading branch information
SimonSapin committed Jan 24, 2020
commit f39c3ff38b8eaa85411ae4bdc6d8adccbb08cc04
@@ -270,10 +270,11 @@ impl<'a> BuilderForBoxFragment<'a> {
let b = self.fragment.style.get_background();
let background_color = self.fragment.style.resolve_color(b.background_color);
if background_color.alpha > 0 {
let mut common = builder.common_properties(self.border_rect);
if let Some(clip_id) = self.border_edge_clip(builder) {
common.clip_id = clip_id
}
// https://drafts.csswg.org/css-backgrounds/#background-color
// “The background color is clipped according to the background-clip
// value associated with the bottom-most background image layer.”
let layer_index = b.background_image.0.len() - 1;
let (_, common) = background::painting_area(self, builder, layer_index);
builder.wr.push_rect(&common, rgba(background_color))
}
// Reverse because the property is top layer first, we want to paint bottom layer first.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.