mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
9567e211e7
Instead of using Core::EventLoop and Core::Timer directly, LibWeb now goes through a Web::Platform abstraction layer instead. This will allow us to plug in Qt's event loop (and QTimer) over in Ladybird, to avoid having to deal with multiple event loops.
32 lines
741 B
C++
32 lines
741 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/HTML/HTMLBlinkElement.h>
|
|
#include <LibWeb/Platform/Timer.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
HTMLBlinkElement::HTMLBlinkElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
: HTMLElement(document, move(qualified_name))
|
|
, m_timer(Platform::Timer::create())
|
|
{
|
|
m_timer->set_interval(500);
|
|
m_timer->on_timeout = [this] { blink(); };
|
|
m_timer->start();
|
|
}
|
|
|
|
HTMLBlinkElement::~HTMLBlinkElement() = default;
|
|
|
|
void HTMLBlinkElement::blink()
|
|
{
|
|
if (!layout_node())
|
|
return;
|
|
|
|
layout_node()->set_visible(!layout_node()->is_visible());
|
|
layout_node()->set_needs_display();
|
|
}
|
|
|
|
}
|