mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
layout: Fix radius percentage resolution.
By resolving against the corresponding dimension of the border box, instead of against the width. Fixes #16764
This commit is contained in:
parent
39471cda1b
commit
c9ab75b013
2 changed files with 20 additions and 8 deletions
|
@ -478,10 +478,22 @@ pub fn specified(length: LengthOrPercentage, containing_length: Au) -> Au {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn specified_border_radius(radius: BorderRadiusSize, containing_length: Au) -> Size2D<Au> {
|
||||
/// Computes a border radius size against the containing size.
|
||||
///
|
||||
/// Note that percentages in `border-radius` are resolved against the relevant
|
||||
/// box dimension instead of only against the width per [1]:
|
||||
///
|
||||
/// > Percentages: Refer to corresponding dimension of the border box.
|
||||
///
|
||||
/// [1]: https://drafts.csswg.org/css-backgrounds-3/#border-radius
|
||||
pub fn specified_border_radius(
|
||||
radius: BorderRadiusSize,
|
||||
containing_size: Size2D<Au>)
|
||||
-> Size2D<Au>
|
||||
{
|
||||
let generics::BorderRadiusSize(size) = radius;
|
||||
let w = specified(size.width, containing_length);
|
||||
let h = specified(size.height, containing_length);
|
||||
let w = specified(size.width, containing_size.width);
|
||||
let h = specified(size.height, containing_size.height);
|
||||
Size2D::new(w, h)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue