1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 02:24:59 +00:00

LibWeb: A whole bunch of work towards spec-compliant <script> elements

This is still very unfinished, but there's at least a skeleton of code.
This commit is contained in:
Andreas Kling 2020-05-24 22:00:46 +02:00
parent 3a30180e1e
commit 45da08a1e6
8 changed files with 365 additions and 34 deletions

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/Function.h>
#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
@ -37,6 +38,35 @@ public:
virtual void inserted_into(Node&) override;
virtual void children_changed() override;
bool is_non_blocking() const { return m_non_blocking; }
void set_parser_document(Badge<HTMLDocumentParser>, Document&);
void set_non_blocking(Badge<HTMLDocumentParser>, bool);
void prepare_script(Badge<HTMLDocumentParser>);
private:
void script_became_ready();
void when_the_script_is_ready(Function<void()>);
WeakPtr<Document> m_parser_document;
WeakPtr<Document> m_preparation_time_document;
bool m_non_blocking { false };
bool m_already_started { false };
bool m_parser_inserted { false };
bool m_from_an_external_file { false };
bool m_script_ready { false };
bool m_ready_to_be_parser_executed { false };
Function<void()> m_script_ready_callback;
String m_script_source;
};
template<>
inline bool is<HTMLScriptElement>(const Node& node)
{
return is<Element>(node) && to<Element>(node).tag_name().equals_ignoring_case("script");
}
}