diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index 569cb86e9eb..941a1387092 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -409,6 +409,7 @@ pub trait FragmentDisplayListBuilding { state: &mut DisplayListBuildState, display_list_section: DisplayListSection, absolute_bounds: &Rect, + clip_bounds: &Rect, 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, + clip_bounds: &Rect, 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,