1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibHTML: Implement the <blink> element

Just in time for Serenity's 1st birthday, here is the <blink> element!

This patch adds a bunch of different mechanisms to enable partial
repaints of the layout tree (LayoutNode::set_needs_display()))
It also adds LayoutNode::is_visible(), which can be toggled to prevent
a LayoutNode from rendering anything (it still takes up space though.)
This commit is contained in:
Andreas Kling 2019-10-09 21:25:29 +02:00
parent 33043941f9
commit fdbad6284c
16 changed files with 140 additions and 0 deletions

View file

@ -76,6 +76,16 @@ public:
virtual void split_into_lines(LayoutBlock& container);
bool is_visible() const { return m_visible; }
void set_visible(bool visible) { m_visible = visible; }
void set_needs_display();
bool is_ancestor_of(const LayoutNode&) const;
template<typename Callback>
void for_each_fragment_of_this(Callback);
protected:
explicit LayoutNode(const Node*);
@ -88,6 +98,7 @@ private:
Rect m_rect;
bool m_inline { false };
bool m_has_style { false };
bool m_visible { true };
};
class LayoutNodeWithStyle : public LayoutNode {
@ -119,3 +130,12 @@ inline const LayoutNodeWithStyle* LayoutNode::parent() const
{
return static_cast<const LayoutNodeWithStyle*>(TreeNode<LayoutNode>::parent());
}
inline bool LayoutNode::is_ancestor_of(const LayoutNode& other) const
{
for (auto* ancestor = other.parent(); ancestor; ancestor = ancestor->parent()) {
if (ancestor == this)
return true;
}
return false;
}