mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #16127 - jbendig:issue_14954, r=emilio
Add full parsing/serialization for mask-repeat and background-repeat I implemented full parsing and serialization for the mask-repeat and background-repeat style properties. I think some more tests are required but I'm not what I'm missing. I'd appreciate some direction. I also had to modify some layout code to get my changes to compile. As a result, background-repeat should work individually in both directions now too. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #14954. <!-- Either: --> - [ ] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16127) <!-- Reviewable:end -->
This commit is contained in:
commit
f2cd9efa96
8 changed files with 237 additions and 68 deletions
|
@ -768,45 +768,45 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
let mut stretch_size = image_size;
|
||||
|
||||
// Adjust origin and size based on background-repeat
|
||||
match *get_cyclic(&background.background_repeat.0, index) {
|
||||
background_repeat::single_value::T::no_repeat => {
|
||||
let background_repeat = get_cyclic(&background.background_repeat.0, index);
|
||||
match background_repeat.0 {
|
||||
background_repeat::single_value::RepeatKeyword::NoRepeat => {
|
||||
bounds.origin.x = anchor_origin_x;
|
||||
bounds.origin.y = anchor_origin_y;
|
||||
bounds.size.width = image_size.width;
|
||||
bounds.size.height = image_size.height;
|
||||
}
|
||||
background_repeat::single_value::T::repeat_x => {
|
||||
bounds.origin.y = anchor_origin_y;
|
||||
bounds.size.height = image_size.height;
|
||||
background_repeat::single_value::RepeatKeyword::Repeat => {
|
||||
ImageFragmentInfo::tile_image(&mut bounds.origin.x,
|
||||
&mut bounds.size.width,
|
||||
anchor_origin_x,
|
||||
image_size.width);
|
||||
}
|
||||
background_repeat::single_value::T::repeat_y => {
|
||||
bounds.origin.x = anchor_origin_x;
|
||||
bounds.size.width = image_size.width;
|
||||
ImageFragmentInfo::tile_image(&mut bounds.origin.y,
|
||||
&mut bounds.size.height,
|
||||
anchor_origin_y,
|
||||
image_size.height);
|
||||
}
|
||||
background_repeat::single_value::T::repeat => {
|
||||
ImageFragmentInfo::tile_image(&mut bounds.origin.x,
|
||||
&mut bounds.size.width,
|
||||
anchor_origin_x,
|
||||
image_size.width);
|
||||
ImageFragmentInfo::tile_image(&mut bounds.origin.y,
|
||||
&mut bounds.size.height,
|
||||
anchor_origin_y,
|
||||
image_size.height);
|
||||
}
|
||||
background_repeat::single_value::T::space => {
|
||||
background_repeat::single_value::RepeatKeyword::Space => {
|
||||
ImageFragmentInfo::tile_image_spaced(&mut bounds.origin.x,
|
||||
&mut bounds.size.width,
|
||||
&mut tile_spacing.width,
|
||||
anchor_origin_x,
|
||||
image_size.width);
|
||||
|
||||
}
|
||||
background_repeat::single_value::RepeatKeyword::Round => {
|
||||
ImageFragmentInfo::tile_image_round(&mut bounds.origin.x,
|
||||
&mut bounds.size.width,
|
||||
anchor_origin_x,
|
||||
&mut stretch_size.width);
|
||||
}
|
||||
};
|
||||
match background_repeat.1 {
|
||||
background_repeat::single_value::RepeatKeyword::NoRepeat => {
|
||||
bounds.origin.y = anchor_origin_y;
|
||||
bounds.size.height = image_size.height;
|
||||
}
|
||||
background_repeat::single_value::RepeatKeyword::Repeat => {
|
||||
ImageFragmentInfo::tile_image(&mut bounds.origin.y,
|
||||
&mut bounds.size.height,
|
||||
anchor_origin_y,
|
||||
image_size.height);
|
||||
}
|
||||
background_repeat::single_value::RepeatKeyword::Space => {
|
||||
ImageFragmentInfo::tile_image_spaced(&mut bounds.origin.y,
|
||||
&mut bounds.size.height,
|
||||
&mut tile_spacing.height,
|
||||
|
@ -814,11 +814,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
image_size.height);
|
||||
|
||||
}
|
||||
background_repeat::single_value::T::round => {
|
||||
ImageFragmentInfo::tile_image_round(&mut bounds.origin.x,
|
||||
&mut bounds.size.width,
|
||||
anchor_origin_x,
|
||||
&mut stretch_size.width);
|
||||
background_repeat::single_value::RepeatKeyword::Round => {
|
||||
ImageFragmentInfo::tile_image_round(&mut bounds.origin.y,
|
||||
&mut bounds.size.height,
|
||||
anchor_origin_y,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue