mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 16:58:52 +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:
parent
33043941f9
commit
fdbad6284c
Notes:
sideshowbarker
2024-07-19 11:44:38 +09:00
Author: https://github.com/awesomekling
Commit: fdbad6284c
16 changed files with 140 additions and 0 deletions
27
Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
Normal file
27
Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <LibCore/CTimer.h>
|
||||
#include <LibHTML/CSS/StyleProperties.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
#include <LibHTML/DOM/HTMLBlinkElement.h>
|
||||
#include <LibHTML/Layout/LayoutNode.h>
|
||||
|
||||
HTMLBlinkElement::HTMLBlinkElement(Document& document, const String& tag_name)
|
||||
: HTMLElement(document, tag_name)
|
||||
, m_timer(CTimer::construct())
|
||||
{
|
||||
m_timer->set_interval(500);
|
||||
m_timer->on_timeout = [this] { blink(); };
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
HTMLBlinkElement::~HTMLBlinkElement()
|
||||
{
|
||||
}
|
||||
|
||||
void HTMLBlinkElement::blink()
|
||||
{
|
||||
if (!layout_node())
|
||||
return;
|
||||
|
||||
layout_node()->set_visible(!layout_node()->is_visible());
|
||||
layout_node()->set_needs_display();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue