mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibHTML: Get rid of the style tree
We now create a layout tree directly from the DOM tree. This way we don't actually lose text nodes ^)
This commit is contained in:
parent
a9ebd676e5
commit
fd0aa5dd43
22 changed files with 126 additions and 261 deletions
22
Libraries/LibHTML/CSS/StyleProperties.cpp
Normal file
22
Libraries/LibHTML/CSS/StyleProperties.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <LibHTML/CSS/StyleProperties.h>
|
||||
|
||||
void StyleProperties::set_property(const String& name, NonnullRefPtr<StyleValue> value)
|
||||
{
|
||||
m_property_values.set(name, move(value));
|
||||
}
|
||||
|
||||
Optional<NonnullRefPtr<StyleValue>> StyleProperties::property(const String& name) const
|
||||
{
|
||||
auto it = m_property_values.find(name);
|
||||
if (it == m_property_values.end())
|
||||
return {};
|
||||
return it->value;
|
||||
}
|
||||
|
||||
Length StyleProperties::length_or_fallback(const StringView& property_name, const Length& fallback) const
|
||||
{
|
||||
auto value = property(property_name);
|
||||
if (!value.has_value())
|
||||
return fallback;
|
||||
return value.value()->to_length();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue