Rename clipping_area to painting_area

https://drafts.csswg.org/css-backgrounds/#background-painting-area
This commit is contained in:
Simon Sapin 2020-01-20 18:34:45 +01:00
parent c8c198a172
commit 9fedade396

View file

@ -38,7 +38,7 @@ pub(super) fn layout_layer(
) -> Option<Layer> { ) -> Option<Layer> {
let b = fragment_builder.fragment.style.get_background(); let b = fragment_builder.fragment.style.get_background();
let clipping_area = match get_cyclic(&b.background_clip.0, layer_index) { let painting_area = match get_cyclic(&b.background_clip.0, layer_index) {
Clip::ContentBox => fragment_builder.content_rect(), Clip::ContentBox => fragment_builder.content_rect(),
Clip::PaddingBox => fragment_builder.padding_rect(), Clip::PaddingBox => fragment_builder.padding_rect(),
Clip::BorderBox => &fragment_builder.border_rect, Clip::BorderBox => &fragment_builder.border_rect,
@ -132,8 +132,8 @@ pub(super) fn layout_layer(
&mut tile_spacing.width, &mut tile_spacing.width,
repeat_x, repeat_x,
get_cyclic(&b.background_position_x.0, layer_index), get_cyclic(&b.background_position_x.0, layer_index),
clipping_area.origin.x - positioning_area.origin.x, painting_area.origin.x - positioning_area.origin.x,
clipping_area.size.width, painting_area.size.width,
positioning_area.size.width, positioning_area.size.width,
); );
let result_y = layout_1d( let result_y = layout_1d(
@ -141,8 +141,8 @@ pub(super) fn layout_layer(
&mut tile_spacing.height, &mut tile_spacing.height,
repeat_y, repeat_y,
get_cyclic(&b.background_position_y.0, layer_index), get_cyclic(&b.background_position_y.0, layer_index),
clipping_area.origin.y - positioning_area.origin.y, painting_area.origin.y - positioning_area.origin.y,
clipping_area.size.height, painting_area.size.height,
positioning_area.size.height, positioning_area.size.height,
); );
let bounds = units::LayoutRect::new( let bounds = units::LayoutRect::new(
@ -151,7 +151,7 @@ pub(super) fn layout_layer(
); );
// The 'backgound-clip' property maps directly to `clip_rect` in `CommonItemProperties`: // The 'backgound-clip' property maps directly to `clip_rect` in `CommonItemProperties`:
let mut common = builder.common_properties(*clipping_area); let mut common = builder.common_properties(*painting_area);
fragment_builder.with_border_edge_clip(builder, &mut common); fragment_builder.with_border_edge_clip(builder, &mut common);
Some(Layer { Some(Layer {
@ -170,8 +170,8 @@ fn layout_1d(
tile_spacing: &mut f32, tile_spacing: &mut f32,
mut repeat: Repeat, mut repeat: Repeat,
position: &LengthPercentage, position: &LengthPercentage,
clipping_area_origin: f32, painting_area_origin: f32,
clipping_area_size: f32, painting_area_size: f32,
positioning_area_size: f32, positioning_area_size: f32,
) -> Layout1DResult { ) -> Layout1DResult {
// https://drafts.csswg.org/css-backgrounds/#background-repeat // https://drafts.csswg.org/css-backgrounds/#background-repeat
@ -214,9 +214,9 @@ fn layout_1d(
// * Its bottom-right is the bottom-right of `clip_rect` // * Its bottom-right is the bottom-right of `clip_rect`
// * Its top-left is the top-left of first tile. // * Its top-left is the top-left of first tile.
let tile_stride = *tile_size + *tile_spacing; let tile_stride = *tile_size + *tile_spacing;
let offset = position - clipping_area_origin; let offset = position - painting_area_origin;
let bounds_origin = position - tile_stride * (offset / tile_stride).ceil(); let bounds_origin = position - tile_stride * (offset / tile_stride).ceil();
let bounds_size = clipping_area_size - bounds_origin - clipping_area_origin; let bounds_size = painting_area_size - bounds_origin - painting_area_origin;
Layout1DResult { Layout1DResult {
repeat: true, repeat: true,
bounds_origin, bounds_origin,