1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:55:10 +00:00

LibWeb: Add LayoutStyle, a place to store style info for layout & paint

StyleProperties is really only the specified "input" to what eventually
becomes the used/computed style we use for layout and painting.

Unlike StyleProperties, LayoutStyle will have strongly typed values for
everything it contains (i.e no CSS::ValueID or strings, etc.)

This first patch moves z-index into LayoutStyle.
This commit is contained in:
Andreas Kling 2020-06-24 14:17:05 +02:00
parent 5e83a97fa2
commit 6f28f08096
5 changed files with 76 additions and 4 deletions

View file

@ -216,8 +216,16 @@ LayoutNodeWithStyle::LayoutNodeWithStyle(const Node* node, NonnullRefPtr<StylePr
, m_specified_style(move(style))
{
m_has_style = true;
m_position = m_specified_style->position();
m_text_align = m_specified_style->text_align();
apply_style(this->specified_style());
}
void LayoutNodeWithStyle::apply_style(const StyleProperties& specified_style)
{
auto& style = static_cast<MutableLayoutStyle&>(m_style);
m_position = specified_style.position();
m_text_align = specified_style.text_align();
style.set_z_index(specified_style.z_index());
}
}