mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
61
Libraries/LibHTML/CSS/StyledNode.h
Normal file
61
Libraries/LibHTML/CSS/StyledNode.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <LibHTML/TreeNode.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
|
||||
class Node;
|
||||
|
||||
enum class Display {
|
||||
None,
|
||||
Block,
|
||||
Inline,
|
||||
};
|
||||
|
||||
class StyledNode : public TreeNode<StyledNode> {
|
||||
public:
|
||||
static NonnullRefPtr<StyledNode> create(const Node& node)
|
||||
{
|
||||
return adopt(*new StyledNode(&node));
|
||||
}
|
||||
~StyledNode();
|
||||
|
||||
const Node* node() const { return m_node; }
|
||||
|
||||
template<typename Callback>
|
||||
inline void for_each_child(Callback callback) const
|
||||
{
|
||||
for (auto* node = first_child(); node; node = node->next_sibling())
|
||||
callback(*node);
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
inline void for_each_child(Callback callback)
|
||||
{
|
||||
for (auto* node = first_child(); node; node = node->next_sibling())
|
||||
callback(*node);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_property_values.set(name, move(value));
|
||||
}
|
||||
|
||||
Display display() const;
|
||||
|
||||
protected:
|
||||
explicit StyledNode(const Node*);
|
||||
|
||||
private:
|
||||
const Node* m_node { nullptr };
|
||||
HashMap<String, NonnullRefPtr<StyleValue>> m_property_values;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue