diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2019-09-21 15:32:17 +0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-28 18:29:42 +0200 |
commit | fd0aa5dd43bdf9b3184a891481157113496de4cb (patch) | |
tree | 6aa9442e2e68c78d794e6d93f8b7ac3a9e0c6e47 /Libraries/LibHTML/CSS/StyleProperties.h | |
parent | a9ebd676e5446f2d1da1c93c5dd4e2dc98f2b1ba (diff) | |
download | serenity-fd0aa5dd43bdf9b3184a891481157113496de4cb.zip |
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 ^)
Diffstat (limited to 'Libraries/LibHTML/CSS/StyleProperties.h')
-rw-r--r-- | Libraries/LibHTML/CSS/StyleProperties.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Libraries/LibHTML/CSS/StyleProperties.h b/Libraries/LibHTML/CSS/StyleProperties.h new file mode 100644 index 0000000000..d449363de5 --- /dev/null +++ b/Libraries/LibHTML/CSS/StyleProperties.h @@ -0,0 +1,23 @@ +#pragma once + +#include <AK/HashMap.h> +#include <AK/NonnullRefPtr.h> +#include <LibHTML/CSS/StyleValue.h> + +class StyleProperties { +public: + template<typename Callback> + inline void for_each_property(Callback callback) const + { + for (auto& it : m_property_values) + callback(it.key, *it.value); + } + + void set_property(const String& name, NonnullRefPtr<StyleValue> value); + Optional<NonnullRefPtr<StyleValue>> property(const String& name) const; + + Length length_or_fallback(const StringView& property_name, const Length& fallback) const; + +private: + HashMap<String, NonnullRefPtr<StyleValue>> m_property_values; +}; |