mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #6035 - Jinwoo-Song:fix_background_image_position, r=pcwalton
According to CSS2.1 spec, background image should be positioned on padding box. Spec: http://www.w3.org/TR/CSS21/colors.html#propdef-background-position Fixes #6034. r? @jdm cc @yichoi <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6035) <!-- Reviewable:end -->
This commit is contained in:
commit
e25444c263
3 changed files with 49 additions and 2 deletions
|
@ -435,8 +435,11 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
let vertical_position = model::specified(background.background_position.vertical,
|
||||
bounds.size.height - image_size.height);
|
||||
|
||||
let abs_x = virtual_origin_x + horizontal_position;
|
||||
let abs_y = virtual_origin_y + vertical_position;
|
||||
// Background image should be positioned on the padding box basis.
|
||||
let border = style.logical_border_width().to_physical(style.writing_mode);
|
||||
|
||||
let abs_x = border.left + virtual_origin_x + horizontal_position;
|
||||
let abs_y = border.top + virtual_origin_y + vertical_position;
|
||||
|
||||
// Adjust origin and size based on background-repeat
|
||||
match background.background_repeat {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue