2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2020-02-06 11:04:03 -03:00
|
|
|
#include <LibCore/Timer.h>
|
2020-03-07 06:32:51 -03:00
|
|
|
#include <LibWeb/CSS/StyleProperties.h>
|
|
|
|
|
#include <LibWeb/CSS/StyleValue.h>
|
2020-07-26 10:08:16 -03:00
|
|
|
#include <LibWeb/HTML/HTMLBlinkElement.h>
|
2020-11-22 11:53:01 -03:00
|
|
|
#include <LibWeb/Layout/Node.h>
|
2019-10-09 16:25:29 -03:00
|
|
|
|
2020-07-28 13:20:36 -03:00
|
|
|
namespace Web::HTML {
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2021-02-07 07:20:15 -03:00
|
|
|
HTMLBlinkElement::HTMLBlinkElement(DOM::Document& document, QualifiedName qualified_name)
|
|
|
|
|
: HTMLElement(document, move(qualified_name))
|
2020-02-02 08:34:39 -03:00
|
|
|
, m_timer(Core::Timer::construct())
|
2019-10-09 16:25:29 -03:00
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
}
|
2020-03-07 06:27:02 -03:00
|
|
|
|
|
|
|
|
}
|