mirror of
https://github.com/servo/servo.git
synced 2025-09-23 05:10:09 +01:00
script: Calculate proper border box for resizeobserver (#38988)
Implements more of calculate_box_size, ensuring that the proper rectangle is returned when the border box is requested. Testing: WPT Fixes: Partially #38811 --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com> Co-authored-by: Jo Steven Novaryo <65610990+stevennovaryo@users.noreply.github.com>
This commit is contained in:
parent
433a461044
commit
4ea714e6d2
2 changed files with 34 additions and 7 deletions
|
@ -311,11 +311,18 @@ fn calculate_box_size(target: &Element, observed_box: &ResizeObserverBoxOptions)
|
|||
// but the spec will expand to cover all fragments.
|
||||
target
|
||||
.upcast::<Node>()
|
||||
.border_boxes()
|
||||
.pop()
|
||||
.content_box()
|
||||
.unwrap_or_else(Rect::zero)
|
||||
},
|
||||
// TODO(#31182): add support for border box, and device pixel size, calculations.
|
||||
ResizeObserverBoxOptions::Border_box => {
|
||||
// Note: only taking first fragment,
|
||||
// but the spec will expand to cover all fragments.
|
||||
target
|
||||
.upcast::<Node>()
|
||||
.border_box()
|
||||
.unwrap_or_else(Rect::zero)
|
||||
},
|
||||
// TODO(#31182): add support for device pixel size calculations.
|
||||
_ => Rect::zero(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue