mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
LibWeb: Store computed CSS font size as CSSPixels
The value is originally set using a `CSSPixels` value converted to double, then when it is used it is always converted back to a `CSSPixels` again. Let's just store it as that instead.
This commit is contained in:
parent
d792461714
commit
607a398917
5 changed files with 11 additions and 11 deletions
|
@ -1712,7 +1712,7 @@ CSSPixels FormattingContext::box_baseline(Box const& box) const
|
|||
return box_state.content_height() + box_state.margin_box_top();
|
||||
case CSS::VerticalAlign::TextTop:
|
||||
// TextTop: Align the top of the box with the top of the parent's content area (see 10.6.1).
|
||||
return CSSPixels::nearest_value_for(box.computed_values().font_size());
|
||||
return box.computed_values().font_size();
|
||||
case CSS::VerticalAlign::TextBottom:
|
||||
// TextTop: Align the bottom of the box with the bottom of the parent's content area (see 10.6.1).
|
||||
return box_state.content_height() - CSSPixels::nearest_value_for(box.containing_block()->font().pixel_metrics().descent * 2);
|
||||
|
|
|
@ -321,7 +321,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
// m_font is used by Length::to_px() when resolving sizes against this layout node.
|
||||
// That's why it has to be set before everything else.
|
||||
m_font = computed_style.computed_font();
|
||||
computed_values.set_font_size(computed_style.property(CSS::PropertyID::FontSize)->as_length().length().to_px(*this).to_double());
|
||||
computed_values.set_font_size(computed_style.property(CSS::PropertyID::FontSize)->as_length().length().to_px(*this));
|
||||
computed_values.set_font_weight(round_to<int>(computed_style.property(CSS::PropertyID::FontWeight)->as_number().number()));
|
||||
m_line_height = computed_style.line_height(*this);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue