mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibWeb: Fix a few const-ness issues
This commit is contained in:
parent
70a2ca7fc0
commit
c0b2fa74ac
36 changed files with 123 additions and 121 deletions
|
@ -256,7 +256,7 @@ void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS:
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#queue-a-microtask
|
||||
void queue_a_microtask(DOM::Document* document, JS::SafeFunction<void()> steps)
|
||||
void queue_a_microtask(DOM::Document const* document, JS::SafeFunction<void()> steps)
|
||||
{
|
||||
// 1. If event loop was not given, set event loop to the implied event loop.
|
||||
auto& event_loop = HTML::main_thread_event_loop();
|
||||
|
|
|
@ -115,7 +115,7 @@ private:
|
|||
EventLoop& main_thread_event_loop();
|
||||
void old_queue_global_task_with_document(HTML::Task::Source, DOM::Document&, JS::SafeFunction<void()> steps);
|
||||
void queue_global_task(HTML::Task::Source, JS::Object&, JS::SafeFunction<void()> steps);
|
||||
void queue_a_microtask(DOM::Document*, JS::SafeFunction<void()> steps);
|
||||
void queue_a_microtask(DOM::Document const*, JS::SafeFunction<void()> steps);
|
||||
void perform_a_microtask_checkpoint();
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
Task::Task(Source source, DOM::Document* document, JS::SafeFunction<void()> steps)
|
||||
Task::Task(Source source, DOM::Document const* document, JS::SafeFunction<void()> steps)
|
||||
: m_source(source)
|
||||
, m_steps(move(steps))
|
||||
, m_document(JS::make_handle(document))
|
||||
|
@ -30,11 +30,6 @@ bool Task::is_runnable() const
|
|||
return !m_document.ptr() || m_document->is_fully_active();
|
||||
}
|
||||
|
||||
DOM::Document* Task::document()
|
||||
{
|
||||
return m_document.ptr();
|
||||
}
|
||||
|
||||
DOM::Document const* Task::document() const
|
||||
{
|
||||
return m_document.ptr();
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
JavaScriptEngine,
|
||||
};
|
||||
|
||||
static NonnullOwnPtr<Task> create(Source source, DOM::Document* document, JS::SafeFunction<void()> steps)
|
||||
static NonnullOwnPtr<Task> create(Source source, DOM::Document const* document, JS::SafeFunction<void()> steps)
|
||||
{
|
||||
return adopt_own(*new Task(source, document, move(steps)));
|
||||
}
|
||||
|
@ -40,17 +40,16 @@ public:
|
|||
Source source() const { return m_source; }
|
||||
void execute();
|
||||
|
||||
DOM::Document* document();
|
||||
DOM::Document const* document() const;
|
||||
|
||||
bool is_runnable() const;
|
||||
|
||||
private:
|
||||
Task(Source, DOM::Document*, JS::SafeFunction<void()> steps);
|
||||
Task(Source, DOM::Document const*, JS::SafeFunction<void()> steps);
|
||||
|
||||
Source m_source { Source::Unspecified };
|
||||
JS::SafeFunction<void()> m_steps;
|
||||
JS::Handle<DOM::Document> m_document;
|
||||
JS::Handle<DOM::Document const> m_document;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ void HTMLScriptElement::prepare_script()
|
|||
else if (m_script_type == ScriptType::Module) {
|
||||
// Fetch an external module script graph given url, settings object, options, and onComplete.
|
||||
// FIXME: Pass options.
|
||||
fetch_external_module_script_graph(url, settings_object, [this](auto const* result) {
|
||||
fetch_external_module_script_graph(url, settings_object, [this](auto* result) {
|
||||
// 1. Mark as ready el given result.
|
||||
if (!result)
|
||||
mark_as_ready(ResultState::Null {});
|
||||
|
@ -382,7 +382,7 @@ void HTMLScriptElement::prepare_script()
|
|||
|
||||
// 2. Fetch an inline module script graph, given source text, base URL, settings object, options, and with the following steps given result:
|
||||
// FIXME: Pass options
|
||||
fetch_inline_module_script_graph(m_document->url().to_deprecated_string(), source_text, base_url, document().relevant_settings_object(), [this](auto const* result) {
|
||||
fetch_inline_module_script_graph(m_document->url().to_deprecated_string(), source_text, base_url, document().relevant_settings_object(), [this](auto* result) {
|
||||
// 1. Mark as ready el given result.
|
||||
if (!result)
|
||||
mark_as_ready(ResultState::Null {});
|
||||
|
|
|
@ -616,7 +616,7 @@ HTMLParser::AdjustedInsertionLocation HTMLParser::find_appropriate_place_for_ins
|
|||
return adjusted_insertion_location;
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<DOM::Element> HTMLParser::create_element_for(HTMLToken const& token, DeprecatedFlyString const& namespace_, DOM::Node const& intended_parent)
|
||||
JS::NonnullGCPtr<DOM::Element> HTMLParser::create_element_for(HTMLToken const& token, DeprecatedFlyString const& namespace_, DOM::Node& intended_parent)
|
||||
{
|
||||
// FIXME: 1. If the active speculative HTML parser is not null, then return the result of creating a speculative mock element given given namespace, the tag name of the given token, and the attributes of the given token.
|
||||
// FIXME: 2. Otherwise, optionally create a speculative mock element given given namespace, the tag name of the given token, and the attributes of the given token.
|
||||
|
@ -3562,7 +3562,7 @@ DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
|
|||
{
|
||||
// The algorithm takes as input a DOM Element, Document, or DocumentFragment referred to as the node.
|
||||
VERIFY(node.is_element() || node.is_document() || node.is_document_fragment());
|
||||
JS::NonnullGCPtr<DOM::Node> actual_node = node;
|
||||
JS::NonnullGCPtr<DOM::Node const> actual_node = node;
|
||||
|
||||
if (is<DOM::Element>(node)) {
|
||||
auto& element = verify_cast<DOM::Element>(node);
|
||||
|
|
|
@ -119,7 +119,7 @@ private:
|
|||
|
||||
void generate_implied_end_tags(DeprecatedFlyString const& exception = {});
|
||||
void generate_all_implied_end_tags_thoroughly();
|
||||
JS::NonnullGCPtr<DOM::Element> create_element_for(HTMLToken const&, DeprecatedFlyString const& namespace_, DOM::Node const& intended_parent);
|
||||
JS::NonnullGCPtr<DOM::Element> create_element_for(HTMLToken const&, DeprecatedFlyString const& namespace_, DOM::Node& intended_parent);
|
||||
|
||||
struct AdjustedInsertionLocation {
|
||||
JS::GCPtr<DOM::Node> parent;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
// https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-self
|
||||
JS::NonnullGCPtr<WorkerGlobalScope> self() const { return *this; }
|
||||
JS::NonnullGCPtr<WorkerGlobalScope const> self() const { return *this; }
|
||||
|
||||
JS::NonnullGCPtr<WorkerLocation> location() const;
|
||||
JS::NonnullGCPtr<WorkerNavigator> navigator() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue