ソースを参照

LibWeb: Remove the HTML blink element

Support for this element has been removed from all major engines years
ago already, and it's currently the only reason we have a weird
"visible" flag on Layout::Node (which we toggle on a timer here..)
Andreas Kling 1 年間 前
コミット
0a133ccba4

+ 0 - 1
Meta/gn/secondary/Userland/Libraries/LibWeb/HTML/BUILD.gn

@@ -39,7 +39,6 @@ source_set("HTML") {
     "HTMLAudioElement.cpp",
     "HTMLBRElement.cpp",
     "HTMLBaseElement.cpp",
-    "HTMLBlinkElement.cpp",
     "HTMLBodyElement.cpp",
     "HTMLButtonElement.cpp",
     "HTMLCanvasElement.cpp",

+ 0 - 1
Userland/Libraries/LibWeb/CMakeLists.txt

@@ -272,7 +272,6 @@ set(SOURCES
     HTML/HTMLAudioElement.cpp
     HTML/HTMLBRElement.cpp
     HTML/HTMLBaseElement.cpp
-    HTML/HTMLBlinkElement.cpp
     HTML/HTMLBodyElement.cpp
     HTML/HTMLButtonElement.cpp
     HTML/HTMLCanvasElement.cpp

+ 0 - 3
Userland/Libraries/LibWeb/DOM/ElementFactory.cpp

@@ -14,7 +14,6 @@
 #include <LibWeb/HTML/HTMLAudioElement.h>
 #include <LibWeb/HTML/HTMLBRElement.h>
 #include <LibWeb/HTML/HTMLBaseElement.h>
-#include <LibWeb/HTML/HTMLBlinkElement.h>
 #include <LibWeb/HTML/HTMLBodyElement.h>
 #include <LibWeb/HTML/HTMLButtonElement.h>
 #include <LibWeb/HTML/HTMLCanvasElement.h>
@@ -282,8 +281,6 @@ static JS::NonnullGCPtr<Element> create_html_element(JS::Realm& realm, Document&
         return realm.heap().allocate<HTML::HTMLAudioElement>(realm, document, move(qualified_name));
     if (lowercase_tag_name == HTML::TagNames::base)
         return realm.heap().allocate<HTML::HTMLBaseElement>(realm, document, move(qualified_name));
-    if (lowercase_tag_name == HTML::TagNames::blink)
-        return realm.heap().allocate<HTML::HTMLBlinkElement>(realm, document, move(qualified_name));
     if (lowercase_tag_name == HTML::TagNames::body)
         return realm.heap().allocate<HTML::HTMLBodyElement>(realm, document, move(qualified_name));
     if (lowercase_tag_name == HTML::TagNames::br)

+ 0 - 1
Userland/Libraries/LibWeb/Forward.h

@@ -335,7 +335,6 @@ class HTMLAnchorElement;
 class HTMLAreaElement;
 class HTMLAudioElement;
 class HTMLBaseElement;
-class HTMLBlinkElement;
 class HTMLBodyElement;
 class HTMLBRElement;
 class HTMLButtonElement;

+ 0 - 33
Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.cpp

@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/HTML/HTMLBlinkElement.h>
-#include <LibWeb/Layout/Node.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();
-}
-
-}

+ 0 - 28
Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.h

@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibCore/Forward.h>
-#include <LibWeb/HTML/HTMLElement.h>
-
-namespace Web::HTML {
-
-class HTMLBlinkElement final : public HTMLElement {
-    WEB_PLATFORM_OBJECT(HTMLBlinkElement, HTMLElement);
-
-public:
-    virtual ~HTMLBlinkElement() override;
-
-private:
-    HTMLBlinkElement(DOM::Document&, DOM::QualifiedName);
-
-    void blink();
-
-    NonnullRefPtr<Platform::Timer> m_timer;
-};
-
-}