mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibWeb: Use CSSPixelFraction
to represent aspect ratios
This allows us to retain perfect precision for aspect ratios derived from either the intrinsic sizes of replaced elements, or the `aspect-ratio` CSS property.
This commit is contained in:
parent
4fb209d25f
commit
34c5043cbe
22 changed files with 57 additions and 55 deletions
|
@ -37,11 +37,11 @@ HTML::HTMLVideoElement const& VideoBox::dom_node() const
|
|||
|
||||
void VideoBox::prepare_for_replaced_layout()
|
||||
{
|
||||
auto width = static_cast<float>(dom_node().video_width());
|
||||
set_natural_width(CSSPixels(width));
|
||||
CSSPixels width = dom_node().video_width();
|
||||
set_natural_width(width);
|
||||
|
||||
auto height = static_cast<float>(dom_node().video_height());
|
||||
set_natural_height(CSSPixels(height));
|
||||
CSSPixels height = dom_node().video_height();
|
||||
set_natural_height(height);
|
||||
|
||||
if (width != 0 && height != 0)
|
||||
set_natural_aspect_ratio(width / height);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue