Fix gradient position if background-clip is present.

This commit is contained in:
Pyfisch 2017-04-17 14:09:05 +02:00
parent 1c4ae53a88
commit c9461985c1

View file

@ -409,6 +409,7 @@ pub trait FragmentDisplayListBuilding {
state: &mut DisplayListBuildState,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip_bounds: &Rect<Au>,
clip: &ClippingRegion,
gradient: &Gradient,
style: &ServoComputedValues);
@ -803,6 +804,7 @@ impl FragmentDisplayListBuilding for Fragment {
Some(computed::Image::Gradient(ref gradient)) => {
self.build_display_list_for_background_gradient(state,
display_list_section,
&absolute_bounds,
&bounds,
&clip,
gradient,
@ -1132,18 +1134,19 @@ impl FragmentDisplayListBuilding for Fragment {
state: &mut DisplayListBuildState,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip_bounds: &Rect<Au>,
clip: &ClippingRegion,
gradient: &Gradient,
style: &ServoComputedValues) {
let mut clip = clip.clone();
clip.intersect_rect(absolute_bounds);
clip.intersect_rect(clip_bounds);
let border = style.logical_border_width().to_physical(style.writing_mode);
let border_padding = self.border_padding.to_physical(style.writing_mode);
let mut bounds = *absolute_bounds;
bounds.origin.x += border.left;
bounds.origin.y += border.top;
bounds.size.width -= border.horizontal();
bounds.size.height -= border.vertical();
bounds.origin.x = bounds.origin.x + border_padding.left;
bounds.origin.y = bounds.origin.y + border_padding.top;
bounds.size.width = bounds.size.width - border_padding.horizontal();
bounds.size.height = bounds.size.height - border_padding.vertical();
let base = state.create_base_display_item(&bounds,
&clip,