mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
LibWeb: Move font list from NodeWithStyle to ComputedValues
Same here, no need for this to live in NodeWithStyle. Inheritance behavior for free in ComputedValues.
This commit is contained in:
parent
c82d517447
commit
bc3a16396e
5 changed files with 7 additions and 33 deletions
|
@ -349,7 +349,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
// NOTE: We have to be careful that font-related properties get set in the right order.
|
||||
// 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_list = computed_style.computed_font_list();
|
||||
computed_values.set_font_list(computed_style.computed_font_list());
|
||||
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()));
|
||||
computed_values.set_line_height(computed_style.line_height());
|
||||
|
@ -873,7 +873,6 @@ void NodeWithStyle::propagate_style_to_anonymous_wrappers()
|
|||
auto& table_wrapper = *static_cast<TableWrapper*>(parent());
|
||||
static_cast<CSS::MutableComputedValues&>(static_cast<CSS::ComputedValues&>(const_cast<CSS::ImmutableComputedValues&>(table_wrapper.computed_values()))).inherit_from(m_computed_values);
|
||||
transfer_table_box_computed_values_to_wrapper_computed_values(table_wrapper.m_computed_values);
|
||||
table_wrapper.set_font_list(*m_font_list);
|
||||
}
|
||||
|
||||
// Propagate style to all anonymous children (except table wrappers!)
|
||||
|
@ -881,7 +880,6 @@ void NodeWithStyle::propagate_style_to_anonymous_wrappers()
|
|||
if (child.is_anonymous() && !is<TableWrapper>(child)) {
|
||||
auto& child_computed_values = static_cast<CSS::MutableComputedValues&>(static_cast<CSS::ComputedValues&>(const_cast<CSS::ImmutableComputedValues&>(child.computed_values())));
|
||||
child_computed_values.inherit_from(m_computed_values);
|
||||
child.set_font_list(*m_font_list);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -943,7 +941,6 @@ JS::NonnullGCPtr<NodeWithStyle> NodeWithStyle::create_anonymous_wrapper() const
|
|||
{
|
||||
auto wrapper = heap().allocate_without_realm<BlockContainer>(const_cast<DOM::Document&>(document()), nullptr, m_computed_values.clone_inherited_values());
|
||||
static_cast<CSS::MutableComputedValues&>(wrapper->m_computed_values).set_display(CSS::Display(CSS::DisplayOutside::Block, CSS::DisplayInside::Flow));
|
||||
wrapper->m_font_list = m_font_list;
|
||||
return *wrapper;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue