hash,date,author,commit_message,is_merge,masked_commit_message,type,git_diff 0df72136702796e3bdcca10e822da76a1b1ef1bd,2019-08-25 23:23:57,rhin123,terminal: Fixed bounding issue when clearing the selection on type,False,Fixed bounding issue when clearing the selection on type,terminal,"diff --git a/Applications/Terminal/TerminalWidget.cpp b/Applications/Terminal/TerminalWidget.cpp index ce59aa767724..d08094263de6 100644 --- a/Applications/Terminal/TerminalWidget.cpp +++ b/Applications/Terminal/TerminalWidget.cpp @@ -177,7 +177,7 @@ void TerminalWidget::keydown_event(GKeyEvent& event) auto min_selection_row = min(m_selection_start.row(), m_selection_end.row()); auto max_selection_row = max(m_selection_start.row(), m_selection_end.row()); - if (future_cursor_column <= max(m_selection_start.column(), m_selection_end.column()) && m_terminal.cursor_row() >= min_selection_row && m_terminal.cursor_row() <= max_selection_row) { + if (future_cursor_column <= last_selection_column_on_row(m_terminal.cursor_row()) && m_terminal.cursor_row() >= min_selection_row && m_terminal.cursor_row() <= max_selection_row) { m_selection_end = {}; update(); } @@ -464,8 +464,8 @@ String TerminalWidget::selected_text() const auto end = normalized_selection_end(); for (int row = start.row(); row <= end.row(); ++row) { - int first_column = row == start.row() ? start.column() : 0; - int last_column = row == end.row() ? end.column() : m_terminal.columns() - 1; + int first_column = first_selection_column_on_row(row); + int last_column = last_selection_column_on_row(row); for (int column = first_column; column <= last_column; ++column) { auto& line = m_terminal.line(row); if (line.attributes[column].is_untouched()) { @@ -482,6 +482,16 @@ String TerminalWidget::selected_text() const return builder.to_string(); } +int TerminalWidget::first_selection_column_on_row(int row) const +{ + return row == normalized_selection_start().row() ? normalized_selection_start().column() : 0; +} + +int TerminalWidget::last_selection_column_on_row(int row) const +{ + return row == normalized_selection_end().row() ? normalized_selection_end().column() : m_terminal.columns() - 1; +} + void TerminalWidget::terminal_history_changed() { bool was_max = m_scrollbar->value() == m_scrollbar->max(); diff --git a/Applications/Terminal/TerminalWidget.h b/Applications/Terminal/TerminalWidget.h index e4c7b0ba26db..4307c45d29f5 100644 --- a/Applications/Terminal/TerminalWidget.h +++ b/Applications/Terminal/TerminalWidget.h @@ -66,6 +66,8 @@ class TerminalWidget final : public GFrame void invalidate_cursor(); Size compute_base_size() const; + int first_selection_column_on_row(int row) const; + int last_selection_column_on_row(int row) const; VT::Terminal m_terminal;" ba6ffea03c295c6725d830c7d77a290891881466,2019-02-04 18:00:03,Andreas Kling,kernel: Process should send SIGCHLD to its parent when it dies.,False,Process should send SIGCHLD to its parent when it dies.,kernel,"diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 68dc757ce28f..009b4baf8b7d 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2172,6 +2172,11 @@ void Process::die() m_fds.clear(); m_tty = nullptr; destroy_all_windows(); + + InterruptDisabler disabler; + if (auto* parent_process = Process::from_pid(m_ppid)) { + parent_process->send_signal(SIGCHLD, this); + } } size_t Process::amount_virtual() const diff --git a/Userland/guitest2.cpp b/Userland/guitest2.cpp index 444e0d5a0f75..37693fac7f54 100644 --- a/Userland/guitest2.cpp +++ b/Userland/guitest2.cpp @@ -16,6 +16,7 @@ #include #include #include +#include class ClockWidget final : public GWidget { public: @@ -69,8 +70,15 @@ static GWindow* make_font_test_window(); static GWindow* make_launcher_window(); static GWindow* make_clock_window(); +void handle_sigchld(int) +{ + dbgprintf(""Got SIGCHLD\n""); +} + int main(int argc, char** argv) { + signal(SIGCHLD, handle_sigchld); + GEventLoop loop; #if 0 auto* font_test_window = make_font_test_window();" 062c9efa8813e66461c5978b3bfc06de85ad5d76,2023-02-26 17:39:16,Tim Ledbetter,"pixelpaint: Add ""Delete Mask"" action",False,"Add ""Delete Mask"" action",pixelpaint,"diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp index b1b7dd9c1274..8869c2dd8566 100644 --- a/Userland/Applications/PixelPaint/Layer.cpp +++ b/Userland/Applications/PixelPaint/Layer.cpp @@ -317,6 +317,13 @@ ErrorOr Layer::create_mask() return {}; } +void Layer::delete_mask() +{ + m_mask_bitmap = nullptr; + set_edit_mode(EditMode::Content); + update_cached_bitmap(); +} + Gfx::Bitmap& Layer::currently_edited_bitmap() { switch (edit_mode()) { diff --git a/Userland/Applications/PixelPaint/Layer.h b/Userland/Applications/PixelPaint/Layer.h index d3b76c06ca51..ef4156f4eae7 100644 --- a/Userland/Applications/PixelPaint/Layer.h +++ b/Userland/Applications/PixelPaint/Layer.h @@ -46,6 +46,7 @@ class Layer Gfx::Bitmap* mask_bitmap() { return m_mask_bitmap; } ErrorOr create_mask(); + void delete_mask(); Gfx::Bitmap& get_scratch_edited_bitmap(); Gfx::IntSize size() const { return content_bitmap().size(); } diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 6fd63d35f2ef..705286cce2ef 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -82,6 +82,7 @@ MainWidget::MainWidget() m_palette_widget->set_image_editor(nullptr); m_tool_properties_widget->set_enabled(false); set_actions_enabled(false); + set_mask_actions_for_layer(nullptr); } update_window_modified(); }); @@ -106,6 +107,7 @@ MainWidget::MainWidget() }; // Ensure that our undo/redo actions are in sync with the current editor. image_editor_did_update_undo_stack(); + set_mask_actions_for_layer(image_editor.active_layer()); }; } @@ -739,23 +741,38 @@ ErrorOr MainWidget::initialize_menubar(GUI::Window& window) m_layer_menu->add_action(*m_layer_via_cut); m_layer_menu->add_separator(); - m_layer_menu->add_action(GUI::Action::create( - ""Add M&ask"", { Mod_Ctrl | Mod_Shift, Key_M }, g_icon_bag.add_mask, [&](auto&) { + + auto create_layer_mask_callback = [&](auto const& action_name, Function mask_function) { + return [&, mask_function = move(mask_function)](GUI::Action&) { auto* editor = current_image_editor(); VERIFY(editor); - auto active_layer = editor->active_layer(); + auto* active_layer = editor->active_layer(); if (!active_layer) return; - if (auto maybe_error = active_layer->create_mask(); maybe_error.is_error()) { - GUI::MessageBox::show_error(&window, DeprecatedString::formatted(""Failed to create layer mask: {}"", maybe_error.release_error())); - return; - } + mask_function(active_layer); - editor->did_complete_action(""Add Mask""); + editor->did_complete_action(action_name); editor->update(); m_layer_list_widget->repaint(); + set_mask_actions_for_layer(active_layer); + }; + }; + + m_add_mask_action = GUI::Action::create( + ""Add M&ask"", { Mod_Ctrl | Mod_Shift, Key_M }, g_icon_bag.add_mask, create_layer_mask_callback(""Add Mask"", [&](Layer* active_layer) { + VERIFY(!active_layer->is_masked()); + if (auto maybe_error = active_layer->create_mask(); maybe_error.is_error()) + GUI::MessageBox::show_error(&window, DeprecatedString::formatted(""Failed to create layer mask: {}"", maybe_error.release_error())); })); + m_layer_menu->add_action(*m_add_mask_action); + + m_delete_mask_action = GUI::Action::create( + ""Delete Mask"", create_layer_mask_callback(""Delete Mask"", [&](Layer* active_layer) { + VERIFY(active_layer->is_masked()); + active_layer->delete_mask(); + })); + m_layer_menu->add_action(*m_delete_mask_action); m_layer_menu->add_separator(); @@ -1115,6 +1132,22 @@ void MainWidget::set_actions_enabled(bool enabled) m_zoom_combobox->set_enabled(enabled); } +void MainWidget::set_mask_actions_for_layer(Layer* layer) +{ + if (!layer) { + m_add_mask_action->set_visible(true); + m_delete_mask_action->set_visible(false); + m_add_mask_action->set_enabled(false); + return; + } + + m_add_mask_action->set_enabled(true); + + auto masked = layer->is_masked(); + m_add_mask_action->set_visible(!masked); + m_delete_mask_action->set_visible(masked); +} + void MainWidget::open_image(FileSystemAccessClient::File file) { auto try_load = m_loader.load_from_file(file.release_stream()); @@ -1165,6 +1198,7 @@ ErrorOr MainWidget::create_image_from_clipboard() m_layer_list_widget->set_image(image); m_layer_list_widget->set_selected_layer(layer); + set_mask_actions_for_layer(layer); return {}; } @@ -1196,6 +1230,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr image) return; m_layer_list_widget->set_selected_layer(layer); m_layer_properties_widget->set_layer(layer); + set_mask_actions_for_layer(layer); }; image_editor.on_title_change = [&](auto const& title) { diff --git a/Userland/Applications/PixelPaint/MainWidget.h b/Userland/Applications/PixelPaint/MainWidget.h index b30bc5b222fa..b419b4f0f100 100644 --- a/Userland/Applications/PixelPaint/MainWidget.h +++ b/Userland/Applications/PixelPaint/MainWidget.h @@ -56,6 +56,7 @@ class MainWidget : public GUI::Widget { void image_editor_did_update_undo_stack(); void set_actions_enabled(bool enabled); + void set_mask_actions_for_layer(Layer* active_layer); virtual void drag_enter_event(GUI::DragEvent&) override; virtual void drop_event(GUI::DropEvent&) override; @@ -110,6 +111,9 @@ class MainWidget : public GUI::Widget { RefPtr m_layer_via_copy; RefPtr m_layer_via_cut; + RefPtr m_add_mask_action; + RefPtr m_delete_mask_action; + Gfx::IntPoint m_last_image_editor_mouse_position; };" 7e8d3e370f34fd935be7ad2c35176fb50d23b12a,2023-12-30 23:20:29,Luke Wilde,libweb: Treat BufferSource as a DataView/ArrayBuffer/TA in IDL overloads,False,Treat BufferSource as a DataView/ArrayBuffer/TA in IDL overloads,libweb,"diff --git a/Tests/LibWeb/Text/expected/Wasm/WebAssembly-instantiate.txt b/Tests/LibWeb/Text/expected/Wasm/WebAssembly-instantiate.txt new file mode 100644 index 000000000000..a10952f22b1e --- /dev/null +++ b/Tests/LibWeb/Text/expected/Wasm/WebAssembly-instantiate.txt @@ -0,0 +1,16 @@ +------------- +ArrayBuffer +------------- +Hello from wasm!!!!!! +FIXME: Run test for Uint8Array. Not running due to flakiness. +FIXME: Run test for Uint8ClampedArray. Not running due to flakiness. +FIXME: Run test for Uint16Array. Not running due to flakiness. +FIXME: Run test for Uint32Array. Not running due to flakiness. +FIXME: Run test for Int8Array. Not running due to flakiness. +FIXME: Run test for Int16Array. Not running due to flakiness. +FIXME: Run test for Float32Array. Not running due to flakiness. +FIXME: Run test for Float64Array. Not running due to flakiness. +FIXME: Run test for BigUint64Array. Not running due to flakiness. +FIXME: Run test for BigInt64Array. Not running due to flakiness. +FIXME: Run test for DataView. Not running due to flakiness. +FIXME: Run test for WebAssembly.Module. Not running due to flakiness. \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/Wasm/WebAssembly-instantiate.html b/Tests/LibWeb/Text/input/Wasm/WebAssembly-instantiate.html new file mode 100644 index 000000000000..7015f87bb90e --- /dev/null +++ b/Tests/LibWeb/Text/input/Wasm/WebAssembly-instantiate.html @@ -0,0 +1,111 @@ + + diff --git a/Userland/Libraries/LibWeb/WebIDL/OverloadResolution.cpp b/Userland/Libraries/LibWeb/WebIDL/OverloadResolution.cpp index 8678c460b278..3a5007b4bab8 100644 --- a/Userland/Libraries/LibWeb/WebIDL/OverloadResolution.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/OverloadResolution.cpp @@ -186,7 +186,7 @@ JS::ThrowCompletionOr resolve_overload(JS::VM& vm, IDL::Effect // then remove from S all other entries. else if (value.is_object() && is(value.as_object()) && has_overload_with_argument_type_or_subtype_matching(overloads, i, [](IDL::Type const& type) { - if (type.is_plain() && type.name() == ""ArrayBuffer"") + if (type.is_plain() && (type.name() == ""ArrayBuffer"" || type.name() == ""BufferSource"")) return true; if (type.is_object()) return true; @@ -204,7 +204,7 @@ JS::ThrowCompletionOr resolve_overload(JS::VM& vm, IDL::Effect // then remove from S all other entries. else if (value.is_object() && is(value.as_object()) && has_overload_with_argument_type_or_subtype_matching(overloads, i, [](IDL::Type const& type) { - if (type.is_plain() && type.name() == ""DataView"") + if (type.is_plain() && (type.name() == ""DataView"" || type.name() == ""BufferSource"")) return true; if (type.is_object()) return true; @@ -222,7 +222,7 @@ JS::ThrowCompletionOr resolve_overload(JS::VM& vm, IDL::Effect // then remove from S all other entries. else if (value.is_object() && value.as_object().is_typed_array() && has_overload_with_argument_type_or_subtype_matching(overloads, i, [&](IDL::Type const& type) { - if (type.is_plain() && type.name() == static_cast(value.as_object()).element_name()) + if (type.is_plain() && (type.name() == static_cast(value.as_object()).element_name() || type.name() == ""BufferSource"")) return true; if (type.is_object()) return true;" eb5aae24f404571e750f6537cb97de95ababb686,2023-03-17 22:09:08,Timothy Flynn,libjs: Move creation of fallible VM objects to its creation factory,False,Move creation of fallible VM objects to its creation factory,libjs,"diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 47ed699bf86c..64c90a6d0ace 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -36,7 +36,20 @@ namespace JS { NonnullRefPtr VM::create(OwnPtr custom_data) { - return adopt_ref(*new VM(move(custom_data))); + ErrorMessages error_messages {}; + error_messages[to_underlying(ErrorMessage::OutOfMemory)] = String::from_utf8(ErrorType::OutOfMemory.message()).release_value_but_fixme_should_propagate_errors(); + + auto vm = adopt_ref(*new VM(move(custom_data), move(error_messages))); + + WellKnownSymbols well_known_symbols { +#define __JS_ENUMERATE(SymbolName, snake_name) \ + Symbol::create(*vm, ""Symbol."" #SymbolName##_string.release_value_but_fixme_should_propagate_errors(), false), + JS_ENUMERATE_WELL_KNOWN_SYMBOLS +#undef __JS_ENUMERATE + }; + + vm->set_well_known_symbols(move(well_known_symbols)); + return vm; } template @@ -47,8 +60,9 @@ static constexpr auto make_single_ascii_character_strings(IndexSequence()); -VM::VM(OwnPtr custom_data) +VM::VM(OwnPtr custom_data, ErrorMessages error_messages) : m_heap(*this) + , m_error_messages(move(error_messages)) , m_custom_data(move(custom_data)) { m_empty_string = m_heap.allocate_without_realm(String {}); @@ -150,13 +164,6 @@ VM::VM(OwnPtr custom_data) // NOTE: Since LibJS has no way of knowing whether the current environment is a browser we always // call HostEnsureCanAddPrivateElement when needed. }; - -#define __JS_ENUMERATE(SymbolName, snake_name) \ - m_well_known_symbol_##snake_name = Symbol::create(*this, ""Symbol."" #SymbolName##_string.release_value_but_fixme_should_propagate_errors(), false); - JS_ENUMERATE_WELL_KNOWN_SYMBOLS -#undef __JS_ENUMERATE - - m_error_messages[to_underlying(ErrorMessage::OutOfMemory)] = String::from_utf8(ErrorType::OutOfMemory.message()).release_value_but_fixme_should_propagate_errors(); } String const& VM::error_message(ErrorMessage type) const diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 287b53dfad90..e306ef2a5127 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -68,7 +68,7 @@ class VM : public RefCounted { #define __JS_ENUMERATE(SymbolName, snake_name) \ Symbol* well_known_symbol_##snake_name() const \ { \ - return m_well_known_symbol_##snake_name; \ + return m_well_known_symbols.snake_name; \ } JS_ENUMERATE_WELL_KNOWN_SYMBOLS #undef __JS_ENUMERATE @@ -269,7 +269,16 @@ class VM : public RefCounted { Function(Object&)> host_ensure_can_add_private_element; private: - explicit VM(OwnPtr); + using ErrorMessages = AK::Array; + + struct WellKnownSymbols { +#define __JS_ENUMERATE(SymbolName, snake_name) \ + GCPtr snake_name; + JS_ENUMERATE_WELL_KNOWN_SYMBOLS +#undef __JS_ENUMERATE + }; + + VM(OwnPtr, ErrorMessages); ThrowCompletionOr property_binding_initialization(BindingPattern const& binding, Value value, Environment* environment); ThrowCompletionOr iterator_binding_initialization(BindingPattern const& binding, Iterator& iterator_record, Environment* environment); @@ -280,6 +289,8 @@ class VM : public RefCounted { ThrowCompletionOr import_module_dynamically(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability); void finish_dynamic_import(ScriptOrModule referencing_script_or_module, ModuleRequest module_request, PromiseCapability const& promise_capability, Promise* inner_promise); + void set_well_known_symbols(WellKnownSymbols well_known_symbols) { m_well_known_symbols = move(well_known_symbols); } + HashMap> m_string_cache; HashMap> m_deprecated_string_cache; @@ -301,7 +312,7 @@ class VM : public RefCounted { GCPtr m_empty_string; GCPtr m_single_ascii_character_strings[128] {}; - AK::Array m_error_messages; + ErrorMessages m_error_messages; struct StoredModule { ScriptOrModule referencing_script_or_module; @@ -315,10 +326,7 @@ class VM : public RefCounted { Vector m_loaded_modules; -#define __JS_ENUMERATE(SymbolName, snake_name) \ - GCPtr m_well_known_symbol_##snake_name; - JS_ENUMERATE_WELL_KNOWN_SYMBOLS -#undef __JS_ENUMERATE + WellKnownSymbols m_well_known_symbols; u32 m_execution_generation { 0 };" 80bb62b9cc4d1f4bc7ef8d88fbde05dd11a19f11,2020-10-23 22:43:06,Linus Groh,libjs: Distinguish between statement and declaration,False,Distinguish between statement and declaration,libjs,"diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 355377880f5b..dba379fb1e43 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -172,6 +172,12 @@ class Expression : public ASTNode { class Declaration : public Statement { }; +class ErrorDeclaration final : public Declaration { +public: + Value execute(Interpreter&, GlobalObject&) const override { return js_undefined(); } + const char* class_name() const override { return ""ErrorDeclaration""; } +}; + class FunctionNode { public: struct Parameter { diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp index 893db52aadc0..51ea22e96b3f 100644 --- a/Libraries/LibJS/Parser.cpp +++ b/Libraries/LibJS/Parser.cpp @@ -241,7 +241,13 @@ NonnullRefPtr Parser::parse_program() bool first = true; m_parser_state.m_use_strict_directive = UseStrictDirectiveState::Looking; while (!done()) { - if (match_statement()) { + if (match_declaration()) { + program->append(parse_declaration()); + if (first) { + first = false; + m_parser_state.m_use_strict_directive = UseStrictDirectiveState::None; + } + } else if (match_statement()) { program->append(parse_statement()); if (first) { if (m_parser_state.m_use_strict_directive == UseStrictDirectiveState::Found) { @@ -252,7 +258,7 @@ NonnullRefPtr Parser::parse_program() m_parser_state.m_use_strict_directive = UseStrictDirectiveState::None; } } else { - expected(""statement""); + expected(""statement or declaration""); consume(); } } @@ -266,7 +272,7 @@ NonnullRefPtr Parser::parse_program() return program; } -NonnullRefPtr Parser::parse_statement() +NonnullRefPtr Parser::parse_declaration() { switch (m_parser_state.m_current_token.type()) { case TokenType::Class: @@ -276,13 +282,24 @@ NonnullRefPtr Parser::parse_statement() m_parser_state.m_function_scopes.last().append(declaration); return declaration; } + case TokenType::Let: + case TokenType::Const: + return parse_variable_declaration(); + default: + expected(""declaration""); + consume(); + return create_ast_node(); + } +} + +NonnullRefPtr Parser::parse_statement() +{ + switch (m_parser_state.m_current_token.type()) { case TokenType::CurlyOpen: return parse_block_statement(); case TokenType::Return: return parse_return_statement(); case TokenType::Var: - case TokenType::Let: - case TokenType::Const: return parse_variable_declaration(); case TokenType::For: return parse_for_statement(); @@ -314,11 +331,13 @@ NonnullRefPtr Parser::parse_statement() return result.release_nonnull(); } if (match_expression()) { + if (match(TokenType::Function)) + syntax_error(""Function declaration not allowed in single-statement context""); auto expr = parse_expression(0); consume_or_insert_semicolon(); return create_ast_node(move(expr)); } - expected(""statement (missing switch case)""); + expected(""statement""); consume(); return create_ast_node(); } @@ -614,7 +633,7 @@ NonnullRefPtr Parser::parse_primary_expression() case TokenType::New: return parse_new_expression(); default: - expected(""primary expression (missing switch case)""); + expected(""primary expression""); consume(); return create_ast_node(); } @@ -676,7 +695,7 @@ NonnullRefPtr Parser::parse_unary_prefixed_expression() consume(); return create_ast_node(UnaryOp::Delete, parse_expression(precedence, associativity)); default: - expected(""primary expression (missing switch case)""); + expected(""primary expression""); consume(); return create_ast_node(); } @@ -1076,7 +1095,7 @@ NonnullRefPtr Parser::parse_secondary_expression(NonnullRefPtr(); } @@ -1209,8 +1228,11 @@ NonnullRefPtr Parser::parse_block_statement(bool& is_strict) } while (!done() && !match(TokenType::CurlyClose)) { - if (match(TokenType::Semicolon)) { - consume(); + if (match_declaration()) { + block->append(parse_declaration()); + + if (first && !initial_strict_mode_state) + m_parser_state.m_use_strict_directive = UseStrictDirectiveState::None; } else if (match_statement()) { block->append(parse_statement()); @@ -1222,7 +1244,7 @@ NonnullRefPtr Parser::parse_block_statement(bool& is_strict) m_parser_state.m_use_strict_directive = UseStrictDirectiveState::None; } } else { - expected(""statement""); + expected(""statement or declaration""); consume(); } @@ -1508,8 +1530,14 @@ NonnullRefPtr Parser::parse_switch_case() NonnullRefPtrVector consequent; TemporaryChange break_change(m_parser_state.m_in_break_context, true); - while (match_statement()) - consequent.append(parse_statement()); + for (;;) { + if (match_declaration()) + consequent.append(parse_declaration()); + else if (match_statement()) + consequent.append(parse_statement()); + else + break; + } return create_ast_node(move(test), move(consequent)); } @@ -1635,18 +1663,6 @@ bool Parser::match(TokenType type) const return m_parser_state.m_current_token.type() == type; } -bool Parser::match_variable_declaration() const -{ - switch (m_parser_state.m_current_token.type()) { - case TokenType::Var: - case TokenType::Let: - case TokenType::Const: - return true; - default: - return false; - } -} - bool Parser::match_expression() const { auto type = m_parser_state.m_current_token.type(); @@ -1740,17 +1756,13 @@ bool Parser::match_statement() const { auto type = m_parser_state.m_current_token.type(); return match_expression() - || type == TokenType::Function || type == TokenType::Return - || type == TokenType::Let - || type == TokenType::Class || type == TokenType::Do || type == TokenType::If || type == TokenType::Throw || type == TokenType::Try || type == TokenType::While || type == TokenType::For - || type == TokenType::Const || type == TokenType::CurlyOpen || type == TokenType::Switch || type == TokenType::Break @@ -1760,6 +1772,23 @@ bool Parser::match_statement() const || type == TokenType::Semicolon; } +bool Parser::match_declaration() const +{ + auto type = m_parser_state.m_current_token.type(); + return type == TokenType::Function + || type == TokenType::Class + || type == TokenType::Const + || type == TokenType::Let; +} + +bool Parser::match_variable_declaration() const +{ + auto type = m_parser_state.m_current_token.type(); + return type == TokenType::Var + || type == TokenType::Let + || type == TokenType::Const; +} + bool Parser::match_identifier_name() const { return m_parser_state.m_current_token.is_identifier_name(); diff --git a/Libraries/LibJS/Parser.h b/Libraries/LibJS/Parser.h index 2fd3c99b2212..007e8b6879c7 100644 --- a/Libraries/LibJS/Parser.h +++ b/Libraries/LibJS/Parser.h @@ -60,6 +60,7 @@ class Parser { NonnullRefPtr parse_function_node(u8 parse_options = FunctionNodeParseOptions::CheckForFunctionAndName); Vector parse_function_parameters(int& function_length, u8 parse_options = 0); + NonnullRefPtr parse_declaration(); NonnullRefPtr parse_statement(); NonnullRefPtr parse_block_statement(); NonnullRefPtr parse_block_statement(bool& is_strict); @@ -147,6 +148,7 @@ class Parser { bool match_unary_prefixed_expression() const; bool match_secondary_expression(Vector forbidden = {}) const; bool match_statement() const; + bool match_declaration() const; bool match_variable_declaration() const; bool match_identifier_name() const; bool match_property_key() const; diff --git a/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js b/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js new file mode 100644 index 000000000000..5e263427bc28 --- /dev/null +++ b/Libraries/LibJS/Tests/parser-declaration-in-single-statement-context.js @@ -0,0 +1,6 @@ +test(""Declaration in single-statement context is a syntax error"", () => { + expect(""if (0) const foo = 1"").not.toEval(); + expect(""while (0) function foo() {}"").not.toEval(); + expect(""for (var 0;;) class foo() {}"").not.toEval(); + expect(""do let foo = 1 while (0)"").not.toEval(); +});" 251c063897d661e13eaf224dab766b43997a9e03,2023-02-18 05:22:47,Kenneth Myhra,libweb: Make factory method of DOM::DOMTokenList fallible,False,Make factory method of DOM::DOMTokenList fallible,libweb,"diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp index ff519dafeb58..aad7f31c7874 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp @@ -52,10 +52,10 @@ inline void replace_in_ordered_set(Vector& set, StringView ite namespace Web::DOM { -DOMTokenList* DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute) +WebIDL::ExceptionOr> DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute) { auto& realm = associated_element.realm(); - return realm.heap().allocate(realm, associated_element, move(associated_attribute)).release_allocated_value_but_fixme_should_propagate_errors(); + return MUST_OR_THROW_OOM(realm.heap().allocate(realm, associated_element, move(associated_attribute))); } // https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2 diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.h b/Userland/Libraries/LibWeb/DOM/DOMTokenList.h index 60dda71782c9..79b2daac1ff8 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.h +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.h @@ -23,7 +23,7 @@ class DOMTokenList final : public Bindings::LegacyPlatformObject { WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject); public: - static DOMTokenList* create(Element const& associated_element, DeprecatedFlyString associated_attribute); + static WebIDL::ExceptionOr> create(Element const& associated_element, DeprecatedFlyString associated_attribute); ~DOMTokenList() = default; void associated_attribute_changed(StringView value); diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 614b4af169ad..69f1eabcb87f 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -455,7 +455,7 @@ NonnullRefPtr Element::resolved_css_values() DOMTokenList* Element::class_list() { if (!m_class_list) - m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_); + m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_).release_value_but_fixme_should_propagate_errors(); return m_class_list; }" 48b59aaeb1e66093bcc680c05c83e9a3d38173db,2022-07-18 19:27:58,Kenneth Myhra,libweb: Mark body argument of extract_body() as const reference,False,Mark body argument of extract_body() as const reference,libweb,"diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index c8b78821dc85..2b4b0145b4b7 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -311,7 +311,7 @@ Optional XMLHttpRequest::extract_mime_type(Fetch::HeaderLis } // https://fetch.spec.whatwg.org/#concept-bodyinit-extract -static XMLHttpRequest::BodyWithType extract_body(XMLHttpRequestBodyInit& body) +static XMLHttpRequest::BodyWithType extract_body(XMLHttpRequestBodyInit const& body) { if (body.has>()) { return {" fdf03852c968f11b942376aa225248cdc26bd904,2021-02-20 00:53:05,Andreas Kling,kernel: Slap UNMAP_AFTER_INIT on a whole bunch of functions,False,Slap UNMAP_AFTER_INIT on a whole bunch of functions,kernel,"diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index cc34e5dc5f23..64e377f439a9 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -454,24 +454,24 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH ASSERT_NOT_REACHED(); } -void register_interrupt_handler(u8 index, void (*f)()) +UNMAP_AFTER_INIT void register_interrupt_handler(u8 index, void (*f)()) { s_idt[index].low = 0x00080000 | LSW((f)); s_idt[index].high = ((u32)(f)&0xffff0000) | 0x8e00; } -void register_user_callable_interrupt_handler(u8 index, void (*f)()) +UNMAP_AFTER_INIT void register_user_callable_interrupt_handler(u8 index, void (*f)()) { s_idt[index].low = 0x00080000 | LSW((f)); s_idt[index].high = ((u32)(f)&0xffff0000) | 0xef00; } -void flush_idt() +UNMAP_AFTER_INIT void flush_idt() { asm(""lidt %0"" ::""m""(s_idtr)); } -static void idt_init() +UNMAP_AFTER_INIT static void idt_init() { s_idtr.address = s_idt; s_idtr.limit = 256 * 8 - 1; @@ -815,7 +815,7 @@ Processor& Processor::by_id(u32 cpu) } } -void Processor::cpu_detect() +UNMAP_AFTER_INIT void Processor::cpu_detect() { // NOTE: This is called during Processor::early_initialize, we cannot // safely log at this point because we don't have kmalloc @@ -900,7 +900,7 @@ void Processor::cpu_detect() set_feature(CPUFeature::RDSEED); } -void Processor::cpu_setup() +UNMAP_AFTER_INIT void Processor::cpu_setup() { // NOTE: This is called during Processor::early_initialize, we cannot // safely log at this point because we don't have kmalloc @@ -1013,7 +1013,7 @@ String Processor::features_string() const return builder.build(); } -void Processor::early_initialize(u32 cpu) +UNMAP_AFTER_INIT void Processor::early_initialize(u32 cpu) { m_self = this; @@ -1048,7 +1048,7 @@ void Processor::early_initialize(u32 cpu) ASSERT(¤t() == this); // sanity check } -void Processor::initialize(u32 cpu) +UNMAP_AFTER_INIT void Processor::initialize(u32 cpu) { ASSERT(m_self == this); ASSERT(¤t() == this); // sanity check @@ -1774,7 +1774,7 @@ u32 Processor::smp_wake_n_idle_processors(u32 wake_count) return did_wake_count; } -void Processor::smp_enable() +UNMAP_AFTER_INIT void Processor::smp_enable() { size_t msg_pool_size = Processor::count() * 100u; size_t msg_entries_cnt = Processor::count(); @@ -2167,7 +2167,7 @@ void Processor::deferred_call_queue(void (*callback)(void*), void* data, void (* cur_proc.deferred_call_queue_entry(entry); } -void Processor::gdt_init() +UNMAP_AFTER_INIT void Processor::gdt_init() { m_gdt_length = 0; m_gdtr.address = nullptr; diff --git a/Kernel/Console.cpp b/Kernel/Console.cpp index 4efe2fec790b..3229281f717c 100644 --- a/Kernel/Console.cpp +++ b/Kernel/Console.cpp @@ -36,7 +36,7 @@ static AK::Singleton s_the; static Kernel::SpinLock g_console_lock; -void Console::initialize() +UNMAP_AFTER_INIT void Console::initialize() { s_the.ensure_instance(); } @@ -51,7 +51,7 @@ bool Console::is_initialized() return s_the.is_initialized(); } -Console::Console() +UNMAP_AFTER_INIT Console::Console() : CharacterDevice(5, 1) { } diff --git a/Kernel/Devices/FullDevice.cpp b/Kernel/Devices/FullDevice.cpp index cbe5ca0d1d9b..f68524f5b9ad 100644 --- a/Kernel/Devices/FullDevice.cpp +++ b/Kernel/Devices/FullDevice.cpp @@ -32,12 +32,12 @@ namespace Kernel { -FullDevice::FullDevice() +UNMAP_AFTER_INIT FullDevice::FullDevice() : CharacterDevice(1, 7) { } -FullDevice::~FullDevice() +UNMAP_AFTER_INIT FullDevice::~FullDevice() { } diff --git a/Kernel/Devices/I8042Controller.cpp b/Kernel/Devices/I8042Controller.cpp index 8798ea1c49bf..451ee1b51384 100644 --- a/Kernel/Devices/I8042Controller.cpp +++ b/Kernel/Devices/I8042Controller.cpp @@ -33,7 +33,7 @@ namespace Kernel { static I8042Controller* s_the; -void I8042Controller::initialize() +UNMAP_AFTER_INIT void I8042Controller::initialize() { if (ACPI::Parser::the()->have_8042()) new I8042Controller; @@ -45,7 +45,7 @@ I8042Controller& I8042Controller::the() return *s_the; } -I8042Controller::I8042Controller() +UNMAP_AFTER_INIT I8042Controller::I8042Controller() { ASSERT(!s_the); s_the = this; diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp index 260e8d9aa8b4..6b4d05c65349 100644 --- a/Kernel/Devices/NullDevice.cpp +++ b/Kernel/Devices/NullDevice.cpp @@ -42,12 +42,12 @@ NullDevice& NullDevice::the() return *s_the; } -NullDevice::NullDevice() +UNMAP_AFTER_INIT NullDevice::NullDevice() : CharacterDevice(1, 3) { } -NullDevice::~NullDevice() +UNMAP_AFTER_INIT NullDevice::~NullDevice() { } diff --git a/Kernel/Devices/RandomDevice.cpp b/Kernel/Devices/RandomDevice.cpp index 728e5456b4ae..69351535a7da 100644 --- a/Kernel/Devices/RandomDevice.cpp +++ b/Kernel/Devices/RandomDevice.cpp @@ -29,12 +29,12 @@ namespace Kernel { -RandomDevice::RandomDevice() +UNMAP_AFTER_INIT RandomDevice::RandomDevice() : CharacterDevice(1, 8) { } -RandomDevice::~RandomDevice() +UNMAP_AFTER_INIT RandomDevice::~RandomDevice() { } diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp index f0b0302f6428..299ecaac3afe 100644 --- a/Kernel/Devices/ZeroDevice.cpp +++ b/Kernel/Devices/ZeroDevice.cpp @@ -30,12 +30,12 @@ namespace Kernel { -ZeroDevice::ZeroDevice() +UNMAP_AFTER_INIT ZeroDevice::ZeroDevice() : CharacterDevice(1, 5) { } -ZeroDevice::~ZeroDevice() +UNMAP_AFTER_INIT ZeroDevice::~ZeroDevice() { } diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index d71933b617e9..d7fc8fa278bb 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -44,7 +44,7 @@ static AK::Singleton s_the; static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase? static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY; -void VFS::initialize() +UNMAP_AFTER_INIT void VFS::initialize() { s_the.ensure_instance(); } @@ -54,14 +54,14 @@ VFS& VFS::the() return *s_the; } -VFS::VFS() +UNMAP_AFTER_INIT VFS::VFS() { #if VFS_DEBUG klog() << ""VFS: Constructing VFS""; #endif } -VFS::~VFS() +UNMAP_AFTER_INIT VFS::~VFS() { } diff --git a/Kernel/Heap/SlabAllocator.cpp b/Kernel/Heap/SlabAllocator.cpp index 47e913978a9e..55720013c4f5 100644 --- a/Kernel/Heap/SlabAllocator.cpp +++ b/Kernel/Heap/SlabAllocator.cpp @@ -141,7 +141,7 @@ void for_each_allocator(Callback callback) callback(s_slab_allocator_128); } -void slab_alloc_init() +UNMAP_AFTER_INIT void slab_alloc_init() { s_slab_allocator_16.init(128 * KiB); s_slab_allocator_32.init(128 * KiB); diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp index 6b17a52538b5..e2697dfa468c 100644 --- a/Kernel/Heap/kmalloc.cpp +++ b/Kernel/Heap/kmalloc.cpp @@ -211,7 +211,7 @@ void kmalloc_enable_expand() g_kmalloc_global->allocate_backup_memory(); } -void kmalloc_init() +UNMAP_AFTER_INIT void kmalloc_init() { // Zero out heap since it's placed after end_of_kernel_bss. memset(kmalloc_eternal_heap, 0, sizeof(kmalloc_eternal_heap)); diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index 0350e7284ef7..888ec06761ed 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -146,7 +146,7 @@ APIC& APIC::the() return *s_apic; } -void APIC::initialize() +UNMAP_AFTER_INIT void APIC::initialize() { ASSERT(!APIC::initialized()); s_apic.ensure_instance(); @@ -234,7 +234,7 @@ u8 APIC::spurious_interrupt_vector() + reinterpret_cast(&varname) \ - reinterpret_cast(&apic_ap_start)) -bool APIC::init_bsp() +UNMAP_AFTER_INIT bool APIC::init_bsp() { // FIXME: Use the ACPI MADT table if (!MSR::have()) @@ -300,7 +300,7 @@ bool APIC::init_bsp() return true; } -void APIC::do_boot_aps() +UNMAP_AFTER_INIT void APIC::do_boot_aps() { ASSERT(m_processor_enabled_cnt > 1); u32 aps_to_enable = m_processor_enabled_cnt - 1; @@ -400,7 +400,7 @@ void APIC::do_boot_aps() #endif } -void APIC::boot_aps() +UNMAP_AFTER_INIT void APIC::boot_aps() { if (m_processor_enabled_cnt <= 1) return; @@ -421,7 +421,7 @@ void APIC::boot_aps() m_apic_ap_continue.store(1, AK::MemoryOrder::memory_order_release); } -void APIC::enable(u32 cpu) +UNMAP_AFTER_INIT void APIC::enable(u32 cpu) { if (cpu >= 8) { // TODO: x2apic support? @@ -472,7 +472,7 @@ Thread* APIC::get_idle_thread(u32 cpu) const return m_ap_idle_threads[cpu - 1]; } -void APIC::init_finished(u32 cpu) +UNMAP_AFTER_INIT void APIC::init_finished(u32 cpu) { // This method is called once the boot stack is no longer needed ASSERT(cpu > 0); @@ -525,7 +525,7 @@ void APIC::send_ipi(u32 cpu) write_icr(ICRReg(IRQ_APIC_IPI + IRQ_VECTOR_BASE, ICRReg::Fixed, ICRReg::Logical, ICRReg::Assert, ICRReg::TriggerMode::Edge, ICRReg::NoShorthand, cpu)); } -APICTimer* APIC::initialize_timers(HardwareTimerBase& calibration_timer) +UNMAP_AFTER_INIT APICTimer* APIC::initialize_timers(HardwareTimerBase& calibration_timer) { if (!m_apic_base) return nullptr; diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp index 55878dc9eb61..e0f43b8ae3a4 100644 --- a/Kernel/Interrupts/InterruptManagement.cpp +++ b/Kernel/Interrupts/InterruptManagement.cpp @@ -56,7 +56,7 @@ InterruptManagement& InterruptManagement::the() return *s_interrupt_management; } -void InterruptManagement::initialize() +UNMAP_AFTER_INIT void InterruptManagement::initialize() { ASSERT(!InterruptManagement::initialized()); s_interrupt_management = new InterruptManagement(); @@ -125,7 +125,7 @@ RefPtr InterruptManagement::get_responsible_irq_controller(u8 int ASSERT_NOT_REACHED(); } -PhysicalAddress InterruptManagement::search_for_madt() +UNMAP_AFTER_INIT PhysicalAddress InterruptManagement::search_for_madt() { dbgln(""Early access to ACPI tables for interrupt setup""); auto rsdp = ACPI::StaticParsing::find_rsdp(); @@ -134,13 +134,13 @@ PhysicalAddress InterruptManagement::search_for_madt() return ACPI::StaticParsing::find_table(rsdp.value(), ""APIC""); } -InterruptManagement::InterruptManagement() +UNMAP_AFTER_INIT InterruptManagement::InterruptManagement() : m_madt(search_for_madt()) { m_interrupt_controllers.resize(1); } -void InterruptManagement::switch_to_pic_mode() +UNMAP_AFTER_INIT void InterruptManagement::switch_to_pic_mode() { klog() << ""Interrupts: Switch to Legacy PIC mode""; InterruptDisabler disabler; @@ -159,7 +159,7 @@ void InterruptManagement::switch_to_pic_mode() } } -void InterruptManagement::switch_to_ioapic_mode() +UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode() { klog() << ""Interrupts: Switch to IOAPIC mode""; InterruptDisabler disabler; @@ -196,7 +196,7 @@ void InterruptManagement::switch_to_ioapic_mode() APIC::the().init_bsp(); } -void InterruptManagement::locate_apic_data() +UNMAP_AFTER_INIT void InterruptManagement::locate_apic_data() { ASSERT(!m_madt.is_null()); auto madt = map_typed(m_madt); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index d1675c2ee817..973b9a06eba2 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -78,7 +78,7 @@ ProcessID Process::allocate_pid() return next_pid.fetch_add(1, AK::MemoryOrder::memory_order_acq_rel); } -void Process::initialize() +UNMAP_AFTER_INIT void Process::initialize() { g_modules = new HashMap>; diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 62cadec3f72e..de785601f93b 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -168,7 +168,7 @@ void Scheduler::queue_runnable_thread(Thread& thread) g_ready_queues_mask |= (1u << priority); } -void Scheduler::start() +UNMAP_AFTER_INIT void Scheduler::start() { ASSERT_INTERRUPTS_DISABLED(); @@ -488,7 +488,7 @@ Process* Scheduler::colonel() return s_colonel_process; } -void Scheduler::initialize() +UNMAP_AFTER_INIT void Scheduler::initialize() { ASSERT(&Processor::current() != nullptr); // sanity check diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp index cef533d6a01c..dc0c24d4fb1c 100644 --- a/Kernel/TTY/PTYMultiplexer.cpp +++ b/Kernel/TTY/PTYMultiplexer.cpp @@ -42,7 +42,7 @@ PTYMultiplexer& PTYMultiplexer::the() return *s_the; } -PTYMultiplexer::PTYMultiplexer() +UNMAP_AFTER_INIT PTYMultiplexer::PTYMultiplexer() : CharacterDevice(5, 2) { m_freelist.ensure_capacity(s_max_pty_pairs); @@ -50,7 +50,7 @@ PTYMultiplexer::PTYMultiplexer() m_freelist.unchecked_append(i - 1); } -PTYMultiplexer::~PTYMultiplexer() +UNMAP_AFTER_INIT PTYMultiplexer::~PTYMultiplexer() { } diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 47d6ae9e60bb..5fa2e52141c2 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -49,7 +49,7 @@ void VirtualConsole::flush_vga_cursor() IO::out8(0x3d5, LSB(value)); } -void VirtualConsole::initialize() +UNMAP_AFTER_INIT void VirtualConsole::initialize() { s_vga_buffer = (u8*)0xc00b8000; s_active_console = -1; @@ -63,7 +63,7 @@ void VirtualConsole::set_graphical(bool graphical) m_graphical = graphical; } -VirtualConsole::VirtualConsole(const unsigned index) +UNMAP_AFTER_INIT VirtualConsole::VirtualConsole(const unsigned index) : TTY(4, index) , m_index(index) , m_terminal(*this) @@ -76,7 +76,7 @@ VirtualConsole::VirtualConsole(const unsigned index) s_consoles[index] = this; } -VirtualConsole::~VirtualConsole() +UNMAP_AFTER_INIT VirtualConsole::~VirtualConsole() { ASSERT_NOT_REACHED(); } diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 891a5672fe27..b906bcb48383 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -48,7 +48,7 @@ namespace Kernel { SpinLock Thread::g_tid_map_lock; READONLY_AFTER_INIT HashMap* Thread::g_tid_map; -void Thread::initialize() +UNMAP_AFTER_INIT void Thread::initialize() { g_tid_map = new HashMap(); } diff --git a/Kernel/Time/APICTimer.cpp b/Kernel/Time/APICTimer.cpp index 2b0a80e24fec..a7bf3052a66a 100644 --- a/Kernel/Time/APICTimer.cpp +++ b/Kernel/Time/APICTimer.cpp @@ -36,7 +36,7 @@ namespace Kernel { #define APIC_TIMER_MEASURE_CPU_CLOCK -APICTimer* APICTimer::initialize(u8 interrupt_number, HardwareTimerBase& calibration_source) +UNMAP_AFTER_INIT APICTimer* APICTimer::initialize(u8 interrupt_number, HardwareTimerBase& calibration_source) { auto* timer = new APICTimer(interrupt_number, nullptr); if (!timer->calibrate(calibration_source)) { @@ -46,13 +46,13 @@ APICTimer* APICTimer::initialize(u8 interrupt_number, HardwareTimerBase& calibra return timer; } -APICTimer::APICTimer(u8 interrupt_number, Function callback) +UNMAP_AFTER_INIT APICTimer::APICTimer(u8 interrupt_number, Function callback) : HardwareTimer(interrupt_number, move(callback)) { disable_remap(); } -bool APICTimer::calibrate(HardwareTimerBase& calibration_source) +UNMAP_AFTER_INIT bool APICTimer::calibrate(HardwareTimerBase& calibration_source) { ASSERT_INTERRUPTS_DISABLED(); diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index 1ac2a4b1cd83..aaf336b833b8 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -145,7 +145,7 @@ u64 TimeManagement::uptime_ms() const return ms; } -void TimeManagement::initialize(u32 cpu) +UNMAP_AFTER_INIT void TimeManagement::initialize(u32 cpu) { if (cpu == 0) { ASSERT(!s_the.is_initialized()); @@ -187,7 +187,7 @@ time_t TimeManagement::boot_time() const return RTC::boot_time(); } -TimeManagement::TimeManagement() +UNMAP_AFTER_INIT TimeManagement::TimeManagement() { bool probe_non_legacy_hardware_timers = !(kernel_command_line().lookup(""time"").value_or(""modern"") == ""legacy""); if (ACPI::is_enabled()) { @@ -255,7 +255,7 @@ bool TimeManagement::is_hpet_periodic_mode_allowed() ASSERT_NOT_REACHED(); } -bool TimeManagement::probe_and_set_non_legacy_hardware_timers() +UNMAP_AFTER_INIT bool TimeManagement::probe_and_set_non_legacy_hardware_timers() { if (!ACPI::is_enabled()) return false; @@ -309,7 +309,7 @@ bool TimeManagement::probe_and_set_non_legacy_hardware_timers() return true; } -bool TimeManagement::probe_and_set_legacy_hardware_timers() +UNMAP_AFTER_INIT bool TimeManagement::probe_and_set_legacy_hardware_timers() { if (ACPI::is_enabled()) { if (ACPI::Parser::the()->x86_specific_flags().cmos_rtc_not_present) { diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index b780f826556e..90e764575d4a 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -81,7 +81,7 @@ bool MemoryManager::is_initialized() return s_the != nullptr; } -MemoryManager::MemoryManager() +UNMAP_AFTER_INIT MemoryManager::MemoryManager() { ScopedSpinLock lock(s_mm_lock); m_kernel_page_directory = PageDirectory::create_kernel_page_directory(); @@ -104,11 +104,11 @@ MemoryManager::MemoryManager() m_lazy_committed_page = allocate_committed_user_physical_page(); } -MemoryManager::~MemoryManager() +UNMAP_AFTER_INIT MemoryManager::~MemoryManager() { } -void MemoryManager::protect_kernel_image() +UNMAP_AFTER_INIT void MemoryManager::protect_kernel_image() { ScopedSpinLock page_lock(kernel_page_directory().get_lock()); // Disable writing to the kernel text and rodata segments. @@ -125,7 +125,7 @@ void MemoryManager::protect_kernel_image() } } -void MemoryManager::protect_readonly_after_init_memory() +UNMAP_AFTER_INIT void MemoryManager::protect_readonly_after_init_memory() { ScopedSpinLock mm_lock(s_mm_lock); ScopedSpinLock page_lock(kernel_page_directory().get_lock()); @@ -153,9 +153,10 @@ void MemoryManager::unmap_memory_after_init() } dmesgln(""Unmapped {} KiB of kernel text after init! :^)"", (end - start) / KiB); + //Processor::halt(); } -void MemoryManager::register_reserved_ranges() +UNMAP_AFTER_INIT void MemoryManager::register_reserved_ranges() { ASSERT(!m_physical_memory_ranges.is_empty()); ContiguousReservedMemoryRange range; @@ -194,7 +195,7 @@ bool MemoryManager::is_allowed_to_mmap_to_userspace(PhysicalAddress start_addres return false; } -void MemoryManager::parse_memory_map() +UNMAP_AFTER_INIT void MemoryManager::parse_memory_map() { RefPtr physical_region; @@ -414,7 +415,7 @@ void MemoryManager::release_pte(PageDirectory& page_directory, VirtualAddress va } } -void MemoryManager::initialize(u32 cpu) +UNMAP_AFTER_INIT void MemoryManager::initialize(u32 cpu) { auto mm_data = new MemoryManagerData; Processor::current().set_mm_data(*mm_data); diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 19f4a6836ddf..5bc207c76153 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -54,7 +54,7 @@ extern ""C"" PageDirectoryEntry* boot_pdpt[4]; extern ""C"" PageDirectoryEntry boot_pd0[1024]; extern ""C"" PageDirectoryEntry boot_pd3[1024]; -PageDirectory::PageDirectory() +UNMAP_AFTER_INIT PageDirectory::PageDirectory() { m_range_allocator.initialize_with_range(VirtualAddress(0xc0800000), 0x3f000000); m_identity_range_allocator.initialize_with_range(VirtualAddress(FlatPtr(0x00000000)), 0x00200000); diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 002a0a6841ac..fff7ec64b7de 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -116,7 +116,7 @@ static Processor s_bsp_processor; // global but let's keep it ""private"" // Once multi-tasking is ready, we spawn a new thread that starts in the // init_stage2() function. Initialization continues there. -extern ""C"" [[noreturn]] void init() +extern ""C"" UNMAP_AFTER_INIT [[noreturn]] void init() { setup_serial_debug(); @@ -196,7 +196,7 @@ extern ""C"" [[noreturn]] void init() // // The purpose of init_ap() is to initialize APs for multi-tasking. // -extern ""C"" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info) +extern ""C"" UNMAP_AFTER_INIT [[noreturn]] void init_ap(u32 cpu, Processor* processor_info) { processor_info->early_initialize(cpu); @@ -213,7 +213,7 @@ extern ""C"" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info) // This method is called once a CPU enters the scheduler and its idle thread // At this point the initial boot stack can be freed // -extern ""C"" void init_finished(u32 cpu) +extern ""C"" UNMAP_AFTER_INIT void init_finished(u32 cpu) { if (cpu == 0) { // TODO: we can reuse the boot stack, maybe for kmalloc()? @@ -323,7 +323,7 @@ void init_stage2(void*) ASSERT_NOT_REACHED(); } -void setup_serial_debug() +UNMAP_AFTER_INIT void setup_serial_debug() { // serial_debug will output all the klog() and dbgln() data to COM1 at // 8-N-1 57600 baud. this is particularly useful for debugging the boot" bf16349c5b8490a0bf944e960f4c813c9e605c47,2022-02-17 15:27:17,Daniel Bertalan,libweb: Fix -Wmismatched-tags warning from Clang,False,Fix -Wmismatched-tags warning from Clang,libweb,"diff --git a/Userland/Libraries/LibWeb/DOM/DOMEventListener.h b/Userland/Libraries/LibWeb/DOM/DOMEventListener.h index cc26636195fe..bee4fdbbdc46 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMEventListener.h +++ b/Userland/Libraries/LibWeb/DOM/DOMEventListener.h @@ -13,7 +13,8 @@ namespace Web::DOM { // https://dom.spec.whatwg.org/#concept-event-listener // NOTE: The spec calls this ""event listener"", and it's *importantly* not the same as ""EventListener"" -struct DOMEventListener : RefCounted { +class DOMEventListener : RefCounted { +public: DOMEventListener(); ~DOMEventListener();" 62daa6f73c817044b254176a0af314a6a0e68ccd,2020-06-26 21:57:12,Andreas Kling,libweb: Add the 'float' CSS property to LayoutStyle,False,Add the 'float' CSS property to LayoutStyle,libweb,"diff --git a/Libraries/LibWeb/CSS/StyleProperties.cpp b/Libraries/LibWeb/CSS/StyleProperties.cpp index 4b57e0928fdb..d241ac2dae80 100644 --- a/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -263,6 +263,21 @@ Optional StyleProperties::white_space() const return {}; } +Optional StyleProperties::float_() const +{ + auto value = property(CSS::PropertyID::Float); + if (!value.has_value() || !value.value()->is_string()) + return {}; + auto string = value.value()->to_string(); + if (string == ""none"") + return CSS::Float::None; + if (string == ""left"") + return CSS::Float::Left; + if (string == ""right"") + return CSS::Float::Right; + return {}; +} + CSS::Display StyleProperties::display() const { auto display = string_or_fallback(CSS::PropertyID::Display, ""inline""); diff --git a/Libraries/LibWeb/CSS/StyleProperties.h b/Libraries/LibWeb/CSS/StyleProperties.h index 13d3a3c84e63..b95684a0bf6e 100644 --- a/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Libraries/LibWeb/CSS/StyleProperties.h @@ -62,6 +62,7 @@ class StyleProperties : public RefCounted { Color color_or_fallback(CSS::PropertyID, const Document&, Color fallback) const; CSS::TextAlign text_align() const; CSS::Display display() const; + Optional float_() const; Optional white_space() const; const Gfx::Font& font() const diff --git a/Libraries/LibWeb/CSS/StyleValue.h b/Libraries/LibWeb/CSS/StyleValue.h index 3b44181d266a..257cb29c64d1 100644 --- a/Libraries/LibWeb/CSS/StyleValue.h +++ b/Libraries/LibWeb/CSS/StyleValue.h @@ -143,6 +143,12 @@ enum class WhiteSpace { PreWrap, }; +enum class Float { + None, + Left, + Right, +}; + } class StyleValue : public RefCounted { diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp index 3c6ab3313e59..a410c930a5f3 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.cpp +++ b/Libraries/LibWeb/Layout/LayoutNode.cpp @@ -181,6 +181,13 @@ Gfx::FloatPoint LayoutNode::box_type_agnostic_position() const return position; } +bool LayoutNode::is_floating() const +{ + if (!has_style()) + return false; + return style().float_() != CSS::Float::None; +} + bool LayoutNode::is_absolutely_positioned() const { if (!has_style()) @@ -216,6 +223,10 @@ void LayoutNodeWithStyle::apply_style(const StyleProperties& specified_style) if (white_space.has_value()) style.set_white_space(white_space.value()); + auto float_ = specified_style.float_(); + if (float_.has_value()) + style.set_float(float_.value()); + style.set_z_index(specified_style.z_index()); style.set_width(specified_style.length_or_fallback(CSS::PropertyID::Width, {})); style.set_min_width(specified_style.length_or_fallback(CSS::PropertyID::MinWidth, {})); diff --git a/Libraries/LibWeb/Layout/LayoutNode.h b/Libraries/LibWeb/Layout/LayoutNode.h index d48a7ddb7b14..cb5ccc08e6ed 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.h +++ b/Libraries/LibWeb/Layout/LayoutNode.h @@ -181,6 +181,7 @@ class LayoutNode : public TreeNode { }; virtual void paint(PaintContext&, PaintPhase); + bool is_floating() const; bool is_absolutely_positioned() const; bool is_fixed_position() const; diff --git a/Libraries/LibWeb/Layout/LayoutStyle.h b/Libraries/LibWeb/Layout/LayoutStyle.h index 3dfe08ae4b26..5fb42325e105 100644 --- a/Libraries/LibWeb/Layout/LayoutStyle.h +++ b/Libraries/LibWeb/Layout/LayoutStyle.h @@ -34,6 +34,7 @@ namespace Web { class InitialValues { public: + static CSS::Float float_() { return CSS::Float::None; } static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; } }; @@ -45,6 +46,7 @@ struct BorderData { class LayoutStyle { public: + CSS::Float float_() const { return m_float; } Optional z_index() const { return m_z_index; } CSS::TextAlign text_align() const { return m_text_align; } CSS::Position position() const { return m_position; } @@ -66,6 +68,7 @@ class LayoutStyle { const BorderData& border_bottom() const { return m_border_bottom; } protected: + CSS::Float m_float { InitialValues::float_() }; Optional m_z_index; CSS::TextAlign m_text_align; CSS::Position m_position; @@ -90,6 +93,7 @@ class ImmutableLayoutStyle final : public LayoutStyle { class MutableLayoutStyle final : public LayoutStyle { public: + void set_float(CSS::Float value) { m_float = value; } void set_z_index(Optional value) { m_z_index = value; } void set_text_align(CSS::TextAlign text_align) { m_text_align = text_align; } void set_position(CSS::Position position) { m_position = position; }" ba92c07a7577176918348134dd3cca8e92822e1a,2019-05-18 06:27:38,Robin Burchell,kernel: Make sure to clear FD sets when preparing for a select,False,Make sure to clear FD sets when preparing for a select,kernel,"diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index ea5cd6493540..c91d5c1e8741 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1751,9 +1751,9 @@ int Process::sys$select(const Syscall::SC_select_params* params) // FIXME: Return -EINVAL if timeout is invalid. auto transfer_fds = [this, nfds] (fd_set* set, auto& vector) -> int { + vector.clear_with_capacity(); if (!set) return 0; - vector.clear_with_capacity(); auto bitmap = Bitmap::wrap((byte*)set, FD_SETSIZE); for (int i = 0; i < nfds; ++i) { if (bitmap.get(i)) {" 7b82334e2f9b6705f1cf62e8920a117c38b1e92f,2020-08-07 00:11:13,Linus Groh,userland: Use Core::ArgsParser for 'rmdir',False,Use Core::ArgsParser for 'rmdir',userland,"diff --git a/Userland/rmdir.cpp b/Userland/rmdir.cpp index c72d0b06a6a0..4d321bb9ab3f 100644 --- a/Userland/rmdir.cpp +++ b/Userland/rmdir.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -35,11 +36,13 @@ int main(int argc, char** argv) return 1; } - if (argc != 2) { - fprintf(stderr, ""usage: rmdir \n""); - return 1; - } - int rc = rmdir(argv[1]); + const char* path; + + Core::ArgsParser args_parser; + args_parser.add_positional_argument(path, ""Directory to remove"", ""path""); + args_parser.parse(argc, argv); + + int rc = rmdir(path); if (rc < 0) { perror(""rmdir""); return 1;" 33c0dc08a7780a7af7955efeca14dcdd9eab8527,2020-01-13 00:32:11,Sergey Bugaev,kernel: Don't forget to copy & destroy root_directory_for_procfs,False,Don't forget to copy & destroy root_directory_for_procfs,kernel,"diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index e14c8d65ba6a..0d184962433e 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -577,7 +577,7 @@ Optional procfs$pid_root(InodeIdentifier identifier) auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier)); if (!handle) return {}; - return handle->process().root_directory_for_procfs().absolute_path().to_byte_buffer(); + return handle->process().root_directory_relative_to_global_root().absolute_path().to_byte_buffer(); } Optional procfs$self(InodeIdentifier) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 8f5800728c5b..3fb0cac1a812 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -578,6 +578,7 @@ pid_t Process::sys$fork(RegisterDump& regs) Thread* child_first_thread = nullptr; auto* child = new Process(child_first_thread, m_name, m_uid, m_gid, m_pid, m_ring, m_cwd, m_executable, m_tty, this); child->m_root_directory = m_root_directory; + child->m_root_directory_relative_to_global_root = m_root_directory_relative_to_global_root; child->m_promises = m_promises; child->m_execpromises = m_execpromises; @@ -2769,6 +2770,7 @@ void Process::finalize() m_executable = nullptr; m_cwd = nullptr; m_root_directory = nullptr; + m_root_directory_relative_to_global_root = nullptr; m_elf_loader = nullptr; disown_all_shared_buffers(); @@ -4325,7 +4327,7 @@ int Process::sys$set_process_boost(pid_t pid, int amount) return 0; } -int Process::sys$chroot(const char* user_path, size_t path_length) +int Process::sys$chroot(const char* user_path, size_t path_length, int mount_flags) { if (!is_superuser()) return -EPERM; @@ -4350,11 +4352,11 @@ Custody& Process::root_directory() return *m_root_directory; } -Custody& Process::root_directory_for_procfs() +Custody& Process::root_directory_relative_to_global_root() { - if (!m_root_directory_for_procfs) - m_root_directory_for_procfs = root_directory(); - return *m_root_directory_for_procfs; + if (!m_root_directory_relative_to_global_root) + m_root_directory_relative_to_global_root = root_directory(); + return *m_root_directory_relative_to_global_root; } void Process::set_root_directory(const Custody& root) diff --git a/Kernel/Process.h b/Kernel/Process.h index 5921e3070373..429b449952d5 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -339,7 +339,7 @@ class Process : public InlineLinkedListNode u32 priority_boost() const { return m_priority_boost; } Custody& root_directory(); - Custody& root_directory_for_procfs(); + Custody& root_directory_relative_to_global_root(); void set_root_directory(const Custody&); bool has_promises() const { return m_promises; } @@ -407,7 +407,7 @@ class Process : public InlineLinkedListNode RefPtr m_executable; RefPtr m_cwd; RefPtr m_root_directory; - RefPtr m_root_directory_for_procfs; + RefPtr m_root_directory_relative_to_global_root; RefPtr m_tty;" dbda5a9a4ccfa3ab8e2e913800559f95dde48291,2021-06-26 23:36:55,Linus Groh,libjs: Move install_error_cause() from Object to Error,False,Move install_error_cause() from Object to Error,libjs,"diff --git a/Userland/Libraries/LibJS/Runtime/Error.cpp b/Userland/Libraries/LibJS/Runtime/Error.cpp index c2fb594ce5c7..8eddcc68b850 100644 --- a/Userland/Libraries/LibJS/Runtime/Error.cpp +++ b/Userland/Libraries/LibJS/Runtime/Error.cpp @@ -29,6 +29,21 @@ Error::Error(Object& prototype) { } +// 20.5.8.1 InstallErrorCause ( O, options ), https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause +void Error::install_error_cause(Value options) +{ + auto& vm = this->vm(); + if (!options.is_object()) + return; + auto& options_object = options.as_object(); + if (!options_object.has_property(vm.names.cause)) + return; + auto cause = options_object.get(vm.names.cause).value_or(js_undefined()); + if (vm.exception()) + return; + define_property(vm.names.cause, cause, Attribute::Writable | Attribute::Configurable); +} + #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \ ClassName* ClassName::create(GlobalObject& global_object) \ { \ diff --git a/Userland/Libraries/LibJS/Runtime/Error.h b/Userland/Libraries/LibJS/Runtime/Error.h index 774a376dd5a8..765ff8d27b5e 100644 --- a/Userland/Libraries/LibJS/Runtime/Error.h +++ b/Userland/Libraries/LibJS/Runtime/Error.h @@ -21,6 +21,8 @@ class Error : public Object { explicit Error(Object& prototype); virtual ~Error() override = default; + + void install_error_cause(Value options); }; // NOTE: Making these inherit from Error is not required by the spec but diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index b0dd99ba16e7..3571e23541eb 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1125,21 +1125,6 @@ Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const return {}; } -// 20.5.8.1 InstallErrorCause ( O, options ), https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause -void Object::install_error_cause(Value options) -{ - auto& vm = this->vm(); - if (!options.is_object()) - return; - auto& options_object = options.as_object(); - if (!options_object.has_property(vm.names.cause)) - return; - auto cause = options_object.get(vm.names.cause).value_or(js_undefined()); - if (vm.exception()) - return; - define_property(vm.names.cause, cause, Attribute::Writable | Attribute::Configurable); -} - Value Object::invoke_internal(const StringOrSymbol& property_name, Optional arguments) { auto& vm = this->vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 91f47be76ceb..bd8fb0575ed4 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -135,8 +135,6 @@ class Object : public Cell { IndexedProperties& indexed_properties() { return m_indexed_properties; } void set_indexed_property_elements(Vector&& values) { m_indexed_properties = IndexedProperties(move(values)); } - void install_error_cause(Value options); - [[nodiscard]] Value invoke_internal(const StringOrSymbol& property_name, Optional arguments); template" 896db187e5f2651abba3be006f18e24d598542b1,2020-06-07 13:44:41,Andreas Kling,"libweb: Move Frame.{cpp,h} into a new Frame/ directory",False,"Move Frame.{cpp,h} into a new Frame/ directory",libweb,"diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index 4028612c15c9..a5e40d6c103f 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index e39a350ef23e..b66a84ab52ac 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -64,7 +64,8 @@ set(SOURCES DOMTreeModel.cpp Dump.cpp FontCache.cpp - Frame.cpp + Frame/EventHandler.cpp + Frame/Frame.cpp Layout/BoxModelMetrics.cpp Layout/LayoutBlock.cpp Layout/LayoutBox.cpp diff --git a/Libraries/LibWeb/CSS/StyleValue.cpp b/Libraries/LibWeb/CSS/StyleValue.cpp index 33218278c01f..f088274ea121 100644 --- a/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValue.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 74e979c35094..1f130fddcd38 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/DOM/HTMLFormElement.cpp b/Libraries/LibWeb/DOM/HTMLFormElement.cpp index e4eef82a584d..d714fe813058 100644 --- a/Libraries/LibWeb/DOM/HTMLFormElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLFormElement.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp b/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp index d35e0207e426..8f48779c5718 100644 --- a/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLIFrameElement.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/DOM/HTMLInputElement.cpp b/Libraries/LibWeb/DOM/HTMLInputElement.cpp index 219af95e19e0..e34f9cb75280 100644 --- a/Libraries/LibWeb/DOM/HTMLInputElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLInputElement.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/DOM/Window.cpp b/Libraries/LibWeb/DOM/Window.cpp index 55dce4c5e3f6..10a70c530566 100644 --- a/Libraries/LibWeb/DOM/Window.cpp +++ b/Libraries/LibWeb/DOM/Window.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace Web { diff --git a/Libraries/LibWeb/Frame.cpp b/Libraries/LibWeb/Frame/Frame.cpp similarity index 99% rename from Libraries/LibWeb/Frame.cpp rename to Libraries/LibWeb/Frame/Frame.cpp index 8985e2ede0bc..221edad879db 100644 --- a/Libraries/LibWeb/Frame.cpp +++ b/Libraries/LibWeb/Frame/Frame.cpp @@ -25,7 +25,7 @@ */ #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/Frame.h b/Libraries/LibWeb/Frame/Frame.h similarity index 97% rename from Libraries/LibWeb/Frame.h rename to Libraries/LibWeb/Frame/Frame.h index cc98cbb62909..3a84cdfd6ac8 100644 --- a/Libraries/LibWeb/Frame.h +++ b/Libraries/LibWeb/Frame/Frame.h @@ -55,7 +55,7 @@ class Frame : public TreeNode { void set_document(Document*); PageView* page_view() { return is_main_frame() ? m_page_view : main_frame().m_page_view; } - const PageView* page_view() const{ return is_main_frame() ? m_page_view : main_frame().m_page_view; } + const PageView* page_view() const { return is_main_frame() ? m_page_view : main_frame().m_page_view; } const Gfx::Size& size() const { return m_size; } void set_size(const Gfx::Size&); diff --git a/Libraries/LibWeb/Layout/LayoutBox.cpp b/Libraries/LibWeb/Layout/LayoutBox.cpp index 1095a94ff949..27add6241fec 100644 --- a/Libraries/LibWeb/Layout/LayoutBox.cpp +++ b/Libraries/LibWeb/Layout/LayoutBox.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/Layout/LayoutDocument.cpp b/Libraries/LibWeb/Layout/LayoutDocument.cpp index 6a14af9b0b1b..bf6d8c33ec3c 100644 --- a/Libraries/LibWeb/Layout/LayoutDocument.cpp +++ b/Libraries/LibWeb/Layout/LayoutDocument.cpp @@ -25,7 +25,7 @@ */ #include -#include +#include #include #include diff --git a/Libraries/LibWeb/Layout/LayoutFrame.cpp b/Libraries/LibWeb/Layout/LayoutFrame.cpp index 3a39c42dcb20..e71ecee7d258 100644 --- a/Libraries/LibWeb/Layout/LayoutFrame.cpp +++ b/Libraries/LibWeb/Layout/LayoutFrame.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp index e838162a4bb0..a9039492fd4a 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.cpp +++ b/Libraries/LibWeb/Layout/LayoutNode.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/Layout/LayoutWidget.cpp b/Libraries/LibWeb/Layout/LayoutWidget.cpp index 0c64e5ba7cc7..e8f68bf4b289 100644 --- a/Libraries/LibWeb/Layout/LayoutWidget.cpp +++ b/Libraries/LibWeb/Layout/LayoutWidget.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/Libraries/LibWeb/Loader/FrameLoader.cpp b/Libraries/LibWeb/Loader/FrameLoader.cpp index afd595bfaf5f..e0cbcd8f6651 100644 --- a/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/PageView.cpp b/Libraries/LibWeb/PageView.cpp index 2bf457bb8846..2271b9f2909c 100644 --- a/Libraries/LibWeb/PageView.cpp +++ b/Libraries/LibWeb/PageView.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include " 34261e54901f015fbc5763f6d3ac724006291cfa,2024-10-11 20:56:54,Aliaksandr Kalenik,libweb: Don't produce save & restore commands for scroll frame id change,False,Don't produce save & restore commands for scroll frame id change,libweb,"diff --git a/Userland/Libraries/LibWeb/Painting/ClippableAndScrollable.cpp b/Userland/Libraries/LibWeb/Painting/ClippableAndScrollable.cpp index d79dc893f484..a3d41153747a 100644 --- a/Userland/Libraries/LibWeb/Painting/ClippableAndScrollable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ClippableAndScrollable.cpp @@ -47,12 +47,11 @@ void ClippableAndScrollable::apply_clip(PaintContext& context) const auto& display_list_recorder = context.display_list_recorder(); display_list_recorder.save(); - auto saved_scroll_frame_id = display_list_recorder.scroll_frame_id(); for (auto const& clip_rect : clip_rects) { Optional clip_scroll_frame_id; if (clip_rect.enclosing_scroll_frame) clip_scroll_frame_id = clip_rect.enclosing_scroll_frame->id(); - display_list_recorder.set_scroll_frame_id(clip_scroll_frame_id); + display_list_recorder.push_scroll_frame_id(clip_scroll_frame_id); auto rect = context.rounded_device_rect(clip_rect.rect).to_type(); auto corner_radii = clip_rect.corner_radii.as_corners(context); if (corner_radii.has_any_radius()) { @@ -60,8 +59,8 @@ void ClippableAndScrollable::apply_clip(PaintContext& context) const } else { display_list_recorder.add_clip_rect(rect); } + display_list_recorder.pop_scroll_frame_id(); } - display_list_recorder.set_scroll_frame_id(saved_scroll_frame_id); } void ClippableAndScrollable::restore_clip(PaintContext& context) const diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp index 39ae395560d4..38fe974714b7 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp +++ b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.cpp @@ -12,14 +12,16 @@ namespace Web::Painting { DisplayListRecorder::DisplayListRecorder(DisplayList& command_list) : m_command_list(command_list) { - m_state_stack.append(State()); } DisplayListRecorder::~DisplayListRecorder() = default; void DisplayListRecorder::append(Command&& command) { - m_command_list.append(move(command), state().scroll_frame_id); + Optional scroll_frame_id; + if (!m_scroll_frame_id_stack.is_empty()) + scroll_frame_id = m_scroll_frame_id_stack.last(); + m_command_list.append(move(command), scroll_frame_id); } void DisplayListRecorder::paint_nested_display_list(RefPtr display_list, Gfx::IntRect rect) @@ -261,15 +263,21 @@ void DisplayListRecorder::translate(Gfx::IntPoint delta) void DisplayListRecorder::save() { append(Save {}); - m_state_stack.append(m_state_stack.last()); } void DisplayListRecorder::restore() { append(Restore {}); +} - VERIFY(m_state_stack.size() > 1); - m_state_stack.take_last(); +void DisplayListRecorder::push_scroll_frame_id(Optional id) +{ + m_scroll_frame_id_stack.append(id); +} + +void DisplayListRecorder::pop_scroll_frame_id() +{ + (void)m_scroll_frame_id_stack.take_last(); } void DisplayListRecorder::push_stacking_context(PushStackingContextParams params) @@ -282,12 +290,12 @@ void DisplayListRecorder::push_stacking_context(PushStackingContextParams params .matrix = params.transform.matrix, }, .clip_path = params.clip_path }); - m_state_stack.append(State()); + m_scroll_frame_id_stack.append({}); } void DisplayListRecorder::pop_stacking_context() { - m_state_stack.take_last(); + (void)m_scroll_frame_id_stack.take_last(); append(PopStackingContext {}); } diff --git a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h index 37738e4a88cf..db151c2a9592 100644 --- a/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h +++ b/Userland/Libraries/LibWeb/Painting/DisplayListRecorder.h @@ -103,15 +103,8 @@ class DisplayListRecorder { void translate(Gfx::IntPoint delta); - void set_scroll_frame_id(Optional id) - { - state().scroll_frame_id = id; - } - - Optional scroll_frame_id() const - { - return state().scroll_frame_id; - } + void push_scroll_frame_id(Optional id); + void pop_scroll_frame_id(); void save(); void restore(); @@ -157,13 +150,7 @@ class DisplayListRecorder { void append(Command&& command); private: - struct State { - Optional scroll_frame_id; - }; - State& state() { return m_state_stack.last(); } - State const& state() const { return m_state_stack.last(); } - - Vector m_state_stack; + Vector> m_scroll_frame_id_stack; DisplayList& m_command_list; }; diff --git a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp index c54b484485ee..21769a4029db 100644 --- a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp @@ -37,15 +37,15 @@ void InlinePaintable::before_paint(PaintContext& context, PaintPhase) const apply_clip(context); if (scroll_frame_id().has_value()) { - context.display_list_recorder().save(); - context.display_list_recorder().set_scroll_frame_id(scroll_frame_id().value()); + context.display_list_recorder().push_scroll_frame_id(scroll_frame_id().value()); } } void InlinePaintable::after_paint(PaintContext& context, PaintPhase) const { - if (scroll_frame_id().has_value()) - context.display_list_recorder().restore(); + if (scroll_frame_id().has_value()) { + context.display_list_recorder().pop_scroll_frame_id(); + } restore_clip(context); } diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 79801815c2a2..1cab96f22478 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -477,15 +477,15 @@ BorderRadiiData PaintableBox::normalized_border_radii_data(ShrinkRadiiForBorders void PaintableBox::apply_scroll_offset(PaintContext& context, PaintPhase) const { if (scroll_frame_id().has_value()) { - context.display_list_recorder().save(); - context.display_list_recorder().set_scroll_frame_id(scroll_frame_id().value()); + context.display_list_recorder().push_scroll_frame_id(scroll_frame_id().value()); } } void PaintableBox::reset_scroll_offset(PaintContext& context, PaintPhase) const { - if (scroll_frame_id().has_value()) - context.display_list_recorder().restore(); + if (scroll_frame_id().has_value()) { + context.display_list_recorder().pop_scroll_frame_id(); + } } void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase phase) const @@ -687,7 +687,7 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const } if (own_scroll_frame_id().has_value()) { - context.display_list_recorder().set_scroll_frame_id(own_scroll_frame_id().value()); + context.display_list_recorder().push_scroll_frame_id(own_scroll_frame_id().value()); } } @@ -716,6 +716,10 @@ void PaintableWithLines::paint(PaintContext& context, PaintPhase phase) const if (should_clip_overflow) { context.display_list_recorder().restore(); + + if (own_scroll_frame_id().has_value()) { + context.display_list_recorder().pop_scroll_frame_id(); + } } } diff --git a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp index 3fb691d81e42..fa1bd5968477 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp @@ -31,8 +31,7 @@ void SVGSVGPaintable::before_children_paint(PaintContext& context, PaintPhase ph PaintableBox::before_children_paint(context, phase); if (phase != PaintPhase::Foreground) return; - context.display_list_recorder().save(); - context.display_list_recorder().set_scroll_frame_id(scroll_frame_id()); + context.display_list_recorder().push_scroll_frame_id(scroll_frame_id()); } void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const @@ -40,7 +39,7 @@ void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase pha PaintableBox::after_children_paint(context, phase); if (phase != PaintPhase::Foreground) return; - context.display_list_recorder().restore(); + context.display_list_recorder().pop_scroll_frame_id(); } static Gfx::FloatMatrix4x4 matrix_with_scaled_translation(Gfx::FloatMatrix4x4 matrix, float scale) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index b8f43c67e658..8f9aa97888b2 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -335,8 +335,9 @@ void StackingContext::paint(PaintContext& context) const if (has_css_transform) { paintable_box().apply_clip_overflow_rect(context, PaintPhase::Foreground); } - if (paintable().is_paintable_box() && paintable_box().scroll_frame_id().has_value()) - context.display_list_recorder().set_scroll_frame_id(*paintable_box().scroll_frame_id()); + if (paintable().is_paintable_box() && paintable_box().scroll_frame_id().has_value()) { + context.display_list_recorder().push_scroll_frame_id(*paintable_box().scroll_frame_id()); + } context.display_list_recorder().push_stacking_context(push_stacking_context_params); if (paintable().is_paintable_box()) { @@ -353,6 +354,9 @@ void StackingContext::paint(PaintContext& context) const paint_internal(context); context.display_list_recorder().pop_stacking_context(); + if (paintable().is_paintable_box() && paintable_box().scroll_frame_id().has_value()) { + context.display_list_recorder().pop_scroll_frame_id(); + } if (has_css_transform) paintable_box().clear_clip_overflow_rect(context, PaintPhase::Foreground); context.display_list_recorder().restore();" 758d816b23e86cbe9f24471988e73f3c15f8c080,2021-08-05 23:47:08,K-Adam,libweb: Clear SVG context after SVGSVGBox children are painted,False,Clear SVG context after SVGSVGBox children are painted,libweb,"diff --git a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp index bbbd9a613785..f53bbbbebe10 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp @@ -37,6 +37,7 @@ void SVGSVGBox::after_children_paint(PaintContext& context, PaintPhase phase) SVGGraphicsBox::after_children_paint(context, phase); if (phase != PaintPhase::Foreground) return; + context.clear_svg_context(); } } diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.h b/Userland/Libraries/LibWeb/Painting/PaintContext.h index 6ae814994d62..682601c1587e 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintContext.h +++ b/Userland/Libraries/LibWeb/Painting/PaintContext.h @@ -29,6 +29,7 @@ class PaintContext { bool has_svg_context() const { return m_svg_context.has_value(); } SVGContext& svg_context() { return m_svg_context.value(); } void set_svg_context(SVGContext context) { m_svg_context = context; } + void clear_svg_context() { m_svg_context.clear(); } bool should_show_line_box_borders() const { return m_should_show_line_box_borders; } void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }" 23f3857cdd404275044be599666081e1a8a7a287,2022-07-21 20:09:22,Idan Horowitz,systemserver: Create /tmp/semaphore on startup,False,Create /tmp/semaphore on startup,systemserver,"diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index c2ae144d7683..8f78d72691ad 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -465,6 +465,15 @@ static ErrorOr create_tmp_coredump_directory() return {}; } +static ErrorOr create_tmp_semaphore_directory() +{ + dbgln(""Creating /tmp/semaphore directory""); + auto old_umask = umask(0); + TRY(Core::System::mkdir(""/tmp/semaphore""sv, 0777)); + umask(old_umask); + return {}; +} + ErrorOr serenity_main(Main::Arguments arguments) { bool user = false; @@ -481,6 +490,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (!user) { TRY(create_tmp_coredump_directory()); + TRY(create_tmp_semaphore_directory()); TRY(determine_system_mode()); }" 91cbdc67de2564b29cdaf99f379f24874401c396,2023-01-18 17:16:12,Timothy Flynn,libcore: Default-initialize the FileWatcher event mask,False,Default-initialize the FileWatcher event mask,libcore,"diff --git a/Userland/Libraries/LibCore/FileWatcher.h b/Userland/Libraries/LibCore/FileWatcher.h index 2a0ece2df8dc..1fef985abac9 100644 --- a/Userland/Libraries/LibCore/FileWatcher.h +++ b/Userland/Libraries/LibCore/FileWatcher.h @@ -28,7 +28,7 @@ struct FileWatcherEvent { ChildCreated = 1 << 3, ChildDeleted = 1 << 4, }; - Type type; + Type type { Type::Invalid }; DeprecatedString event_path; };" e036f4a78616a1eb72d2d372eda78724fb917fa3,2021-08-05 22:49:40,Linus Groh,libjs: Make regulate_iso_date() and iso_date_from_fields() use ISODate,False,Make regulate_iso_date() and iso_date_from_fields() use ISODate,libjs,"diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 934a38415c09..100cc75c47b1 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -659,7 +659,7 @@ double resolve_iso_month(GlobalObject& global_object, Object& fields) } // 12.1.38 ISODateFromFields ( fields, options ), https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields -Optional iso_date_from_fields(GlobalObject& global_object, Object& fields, Object& options) +Optional iso_date_from_fields(GlobalObject& global_object, Object& fields, Object& options) { auto& vm = global_object.vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h index 94fea7120a8d..fe2c9bd13c86 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include namespace JS::Temporal { @@ -58,7 +58,7 @@ u16 to_iso_day_of_year(i32 year, u8 month, u8 day); u8 to_iso_week_of_year(i32 year, u8 month, u8 day); String build_iso_month_code(u8 month); double resolve_iso_month(GlobalObject&, Object& fields); -Optional iso_date_from_fields(GlobalObject&, Object& fields, Object& options); +Optional iso_date_from_fields(GlobalObject&, Object& fields, Object& options); i32 iso_year(Object& temporal_object); u8 iso_month(Object& temporal_object); String iso_month_code(Object& temporal_object); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp index d5113409ffea..3ddfde0fa448 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp @@ -161,7 +161,7 @@ PlainDate* to_temporal_date(GlobalObject& global_object, Value item, Object* opt } // 3.5.4 RegulateISODate ( year, month, day, overflow ), https://tc39.es/proposal-temporal/#sec-temporal-regulateisodate -Optional regulate_iso_date(GlobalObject& global_object, double year, double month, double day, String const& overflow) +Optional regulate_iso_date(GlobalObject& global_object, double year, double month, double day, String const& overflow) { auto& vm = global_object.vm(); // 1. Assert: year, month, and day are integers. @@ -187,7 +187,7 @@ Optional regulate_iso_date(GlobalObject& global_object, double yea return {}; } // b. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day }. - return TemporalDate { .year = y, .month = m, .day = d, .calendar = {} }; + return ISODate { .year = y, .month = m, .day = d }; } // 4. If overflow is ""constrain"", then else if (overflow == ""constrain""sv) { @@ -206,7 +206,7 @@ Optional regulate_iso_date(GlobalObject& global_object, double yea day = constrain_to_range(day, 1, iso_days_in_month(y, month)); // c. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day }. - return TemporalDate { .year = y, .month = static_cast(month), .day = static_cast(day), .calendar = {} }; + return ISODate { .year = y, .month = static_cast(month), .day = static_cast(day) }; } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h index 6cab0c015dbf..b0985fe52dfd 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h @@ -7,7 +7,6 @@ #pragma once -#include #include namespace JS::Temporal { @@ -43,7 +42,7 @@ struct ISODate { PlainDate* create_temporal_date(GlobalObject&, i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, FunctionObject* new_target = nullptr); PlainDate* to_temporal_date(GlobalObject&, Value item, Object* options = nullptr); -Optional regulate_iso_date(GlobalObject&, double year, double month, double day, String const& overflow); +Optional regulate_iso_date(GlobalObject&, double year, double month, double day, String const& overflow); bool is_valid_iso_date(i32 year, u8 month, u8 day); ISODate balance_iso_date(i32 year, i32 month, i32 day); i8 compare_iso_date(i32 year1, u8 month1, u8 day1, i32 year2, u8 month2, u8 day2); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp index 745f47e442ed..974bd0447241 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include " 8ba18dfd404543290774f21ee3ed6c802e3371cd,2024-02-20 15:25:10,Aliaksandr Kalenik,libweb: Schedule repainting from EventLoop::process(),False,Schedule repainting from EventLoop::process(),libweb,"diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index dcb5ff2736f0..923be22bca1f 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -213,7 +214,12 @@ void EventLoop::process() // FIXME: 15. Invoke the mark paint timing algorithm for each Document object in docs. - // FIXME: 16. For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state. + // 16. For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state. + for_each_fully_active_document_in_docs([&](DOM::Document& document) { + auto* browsing_context = document.browsing_context(); + auto& page = browsing_context->page(); + page.client().schedule_repaint(); + }); // 13. If all of the following are true // - this is a window event loop diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index c2f402df5e7b..9e05a7d7ef47 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -302,6 +302,8 @@ class PageClient : public JS::Cell { virtual void inspector_did_request_dom_tree_context_menu([[maybe_unused]] i32 node_id, [[maybe_unused]] CSSPixelPoint position, [[maybe_unused]] String const& type, [[maybe_unused]] Optional const& tag, [[maybe_unused]] Optional const& attribute_name, [[maybe_unused]] Optional const& attribute_value) { } virtual void inspector_did_execute_console_script([[maybe_unused]] String const& script) { } + virtual void schedule_repaint() = 0; + protected: virtual ~PageClient() = default; }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp b/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp index 9c32a874a529..ada4cb118394 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp @@ -48,6 +48,7 @@ class SVGDecodedImageData::SVGPageClient final : public PageClient { virtual CSS::PreferredColorScheme preferred_color_scheme() const override { return m_host_page.client().preferred_color_scheme(); } virtual void request_file(FileRequest) override { } virtual void paint(DevicePixelRect const&, Gfx::Bitmap&, Web::PaintOptions = {}) override { } + virtual void schedule_repaint() override { } private: explicit SVGPageClient(Page& host_page) diff --git a/Userland/Services/WebContent/PageClient.cpp b/Userland/Services/WebContent/PageClient.cpp index 56d2ed76debd..52f0f882b6ee 100644 --- a/Userland/Services/WebContent/PageClient.cpp +++ b/Userland/Services/WebContent/PageClient.cpp @@ -222,12 +222,12 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta void PageClient::set_viewport_rect(Web::DevicePixelRect const& rect) { page().top_level_traversable()->set_viewport_rect(page().device_to_css_rect(rect)); - schedule_repaint(); + Web::HTML::main_thread_event_loop().schedule(); } void PageClient::page_did_invalidate(Web::CSSPixelRect const&) { - schedule_repaint(); + Web::HTML::main_thread_event_loop().schedule(); } void PageClient::page_did_request_cursor_change(Gfx::StandardCursor cursor) diff --git a/Userland/Services/WebContent/PageClient.h b/Userland/Services/WebContent/PageClient.h index 318647f4cde1..11af94568f60 100644 --- a/Userland/Services/WebContent/PageClient.h +++ b/Userland/Services/WebContent/PageClient.h @@ -28,7 +28,7 @@ class PageClient final : public Web::PageClient { static void set_use_gpu_painter(); - void schedule_repaint(); + virtual void schedule_repaint() override; virtual Web::Page& page() override { return *m_page; } virtual Web::Page const& page() const override { return *m_page; } diff --git a/Userland/Services/WebWorker/PageHost.h b/Userland/Services/WebWorker/PageHost.h index 55e41a8e1da4..61a2b8ef8379 100644 --- a/Userland/Services/WebWorker/PageHost.h +++ b/Userland/Services/WebWorker/PageHost.h @@ -30,6 +30,7 @@ class PageHost final : public Web::PageClient { virtual Web::CSS::PreferredColorScheme preferred_color_scheme() const override; virtual void paint(Web::DevicePixelRect const&, Gfx::Bitmap&, Web::PaintOptions = {}) override; virtual void request_file(Web::FileRequest) override; + virtual void schedule_repaint() override {}; private: explicit PageHost(ConnectionFromClient&);" 95d00553c97911a438c0e7113cc0cce65bd5385c,2023-08-05 23:33:09,Hendiadyoin1,libweb: Use default comparator for PixelUnits,False,Use default comparator for PixelUnits,libweb,"diff --git a/Userland/Libraries/LibWeb/PixelUnits.cpp b/Userland/Libraries/LibWeb/PixelUnits.cpp index b373d9935ebe..fc13a0c39ad6 100644 --- a/Userland/Libraries/LibWeb/PixelUnits.cpp +++ b/Userland/Libraries/LibWeb/PixelUnits.cpp @@ -56,10 +56,7 @@ bool CSSPixels::might_be_saturated() const return raw_value() == NumericLimits::max() || raw_value() == NumericLimits::min(); } -bool CSSPixels::operator==(CSSPixels const& other) const -{ - return raw_value() == other.raw_value(); -} +bool CSSPixels::operator==(CSSPixels const& other) const = default; CSSPixels& CSSPixels::operator++() {" 1e6afa9fd51885a0f42d3d986c4ed109b9f3b504,2021-10-30 01:36:49,Timothy Flynn,base: Add tests for data: URLs and large list-style-image to lists.html,False,Add tests for data: URLs and large list-style-image to lists.html,base,"diff --git a/Base/res/html/misc/lists.html b/Base/res/html/misc/lists.html index 643ca41ed705..45cd33d3822f 100644 --- a/Base/res/html/misc/lists.html +++ b/Base/res/html/misc/lists.html @@ -44,6 +44,18 @@

ul

  • Another entry
  • +

    list-style: outside url(90s-bg.png)

    +
      +
    • Entry one
    • +
    • Another entry
    • +
    + +

    list-style: outside url(data:image/png)

    +
      +
    • Entry one
    • +
    • Another entry
    • +
    +

    ol

    default

      " 72e959d753bb7bdf4ba6f7bff9aea3459391de60,2023-07-27 11:32:44,Aliaksandr Kalenik,libweb: Fix calculation of bitmap size in BorderRadiusCornerClipper,False,Fix calculation of bitmap size in BorderRadiusCornerClipper,libweb,"diff --git a/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp b/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp index 9027129b5cd0..5ce47713a894 100644 --- a/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp +++ b/Userland/Libraries/LibWeb/Painting/BorderRadiusCornerClipper.cpp @@ -21,11 +21,19 @@ ErrorOr BorderRadiusCornerClipper::create(PaintContex DevicePixelSize corners_bitmap_size { max( - top_left.horizontal_radius + top_right.horizontal_radius, - bottom_left.horizontal_radius + bottom_right.horizontal_radius), + max( + top_left.horizontal_radius + top_right.horizontal_radius, + top_left.horizontal_radius + bottom_right.horizontal_radius), + max( + bottom_left.horizontal_radius + top_right.horizontal_radius, + bottom_left.horizontal_radius + bottom_right.horizontal_radius)), max( - top_left.vertical_radius + bottom_left.vertical_radius, - top_right.vertical_radius + bottom_right.vertical_radius) + max( + top_left.vertical_radius + bottom_left.vertical_radius, + top_left.vertical_radius + bottom_right.vertical_radius), + max( + top_right.vertical_radius + bottom_left.vertical_radius, + top_right.vertical_radius + bottom_right.vertical_radius)) }; RefPtr corner_bitmap;" cddaeb43d31304a5cb7ccdf8cf08a2bdbfff84cf,2020-05-26 18:05:10,Sergey Bugaev,"kernel: Introduce ""sigaction"" pledge",False,"Introduce ""sigaction"" pledge",kernel,"diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index fa3599dec54d..20921c3e2b4a 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2711,7 +2711,7 @@ int Process::sys$sigpending(sigset_t* set) int Process::sys$sigaction(int signum, const sigaction* act, sigaction* old_act) { - REQUIRE_PROMISE(stdio); + REQUIRE_PROMISE(sigaction); if (signum < 1 || signum >= 32 || signum == SIGKILL || signum == SIGSTOP) return -EINVAL; if (!validate_read_typed(act)) diff --git a/Kernel/Process.h b/Kernel/Process.h index f24789fbdc84..fa52440707e5 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -72,6 +72,7 @@ extern VirtualAddress g_return_to_ring3_from_signal_trampoline; __ENUMERATE_PLEDGE_PROMISE(video) \ __ENUMERATE_PLEDGE_PROMISE(accept) \ __ENUMERATE_PLEDGE_PROMISE(settime) \ + __ENUMERATE_PLEDGE_PROMISE(sigaction) \ __ENUMERATE_PLEDGE_PROMISE(shared_buffer) enum class Pledge : u32 {" 0c75a14b4fe0c432e25ae797d5722ab3729660f7,2022-01-06 00:35:12,Timothy Flynn,ak: Move TimeSpecType concept inside the AK namespace,False,Move TimeSpecType concept inside the AK namespace,ak,"diff --git a/AK/Time.h b/AK/Time.h index 806bc160af72..64f13230edf7 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -15,6 +15,8 @@ struct timeval; struct timespec; +namespace AK { + // Concept to detect types which look like timespec without requiring the type. template concept TimeSpecType = requires(T t) @@ -23,10 +25,6 @@ concept TimeSpecType = requires(T t) t.tv_nsec; }; -// FIXME: remove once Clang formats these properly. -// clang-format off -namespace AK { - // Month and day start at 1. Month must be >= 1 and <= 12. // The return value is 0-indexed, that is 0 is Sunday, 1 is Monday, etc. // Day may be negative or larger than the number of days @@ -298,7 +296,6 @@ inline bool operator!=(const T& a, const T& b) } } -// clang-format on using AK::day_of_week; using AK::day_of_year;" 82182f4560dd163bde695597a983326b0372f75d,2023-04-08 22:53:44,Nico Weber,libgfx: Give PrefixCodeGroup a deleted copy ctor,False,Give PrefixCodeGroup a deleted copy ctor,libgfx,"diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp index f067057b6ab5..5b2a3abf00ac 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoader.cpp @@ -356,6 +356,10 @@ ErrorOr CanonicalCode::read_symbol(LittleEndianInputBitStream& bit_stream) // ""From here on, we refer to this set as a prefix code group."" class PrefixCodeGroup { public: + PrefixCodeGroup() = default; + PrefixCodeGroup(PrefixCodeGroup&&) = default; + PrefixCodeGroup(PrefixCodeGroup const&) = delete; + CanonicalCode& operator[](int i) { return m_codes[i]; } CanonicalCode const& operator[](int i) const { return m_codes[i]; }" 64d48bcdc13809fcf08f50632646ee63d8d71c5a,2022-06-12 04:58:26,Andrew Kaster,libc: Force default visibility for the _ctype_ symbol,False,Force default visibility for the _ctype_ symbol,libc,"diff --git a/Userland/Libraries/LibC/ctype.h b/Userland/Libraries/LibC/ctype.h index b7493b813879..62bbbbb866a9 100644 --- a/Userland/Libraries/LibC/ctype.h +++ b/Userland/Libraries/LibC/ctype.h @@ -20,7 +20,7 @@ __BEGIN_DECLS #define _X 0100 #define _B 0200 -extern char const _ctype_[256]; +extern char const _ctype_[256] __attribute__((visibility(""default""))); static inline int __inline_isalnum(int c) {" 4491ef8ae68945f9a94f09ce321f206b9bea4498,2022-08-23 01:25:19,Andreas Kling,pixelpaint: Relayout ImageEditor immediately when image rect changes,False,Relayout ImageEditor immediately when image rect changes,pixelpaint,"diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 57d58f9ef26a..e3db66dc171b 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -551,6 +551,7 @@ void ImageEditor::image_did_change_rect(Gfx::IntRect const& new_image_rect) { set_original_rect(new_image_rect); set_content_rect(new_image_rect); + relayout(); } void ImageEditor::image_select_layer(Layer* layer)" 71f2c342c41c9b4771d8accaa644922303634882,2022-04-21 16:46:56,Tim Schumacher,kernel: Limit free space between randomized memory allocations,False,Limit free space between randomized memory allocations,kernel,"diff --git a/Kernel/Memory/RegionTree.cpp b/Kernel/Memory/RegionTree.cpp index 81d1fffe7cb3..ac2d55093d9c 100644 --- a/Kernel/Memory/RegionTree.cpp +++ b/Kernel/Memory/RegionTree.cpp @@ -121,6 +121,26 @@ ErrorOr RegionTree::allocate_range_randomized(size_t size, size_t if (!m_total_range.contains(random_address, size)) continue; +#if ARCH(I386) + // Attempt to limit the amount of wasted address space on platforms with small address sizes (read: i686). + // This works by only allowing arbitrary random allocations until a certain threshold, to create more possibilities for placing mappings. + // After the threshold has been reached, new allocations can only be placed randomly within a certain range from the adjacent allocations. + VirtualAddress random_address_end { random_address.get() + size }; + constexpr size_t max_allocations_until_limited = 200; + constexpr size_t max_space_between_allocations = 1 * MiB; + + if (m_regions.size() >= max_allocations_until_limited) { + auto* lower_allocation = m_regions.find_largest_not_above(random_address.get()); + auto* upper_allocation = m_regions.find_smallest_not_below(random_address_end.get()); + + bool lower_in_range = (!lower_allocation || random_address - lower_allocation->range().end() <= VirtualAddress(max_space_between_allocations)); + bool upper_in_range = (!upper_allocation || upper_allocation->range().base() - random_address_end <= VirtualAddress(max_space_between_allocations)); + + if (!upper_in_range && !lower_in_range) + continue; + } +#endif + auto range_or_error = allocate_range_specific(random_address, size); if (!range_or_error.is_error()) return range_or_error.release_value();" 2f23912a55715304d8546f705e09dae6c6afaa36,2024-06-05 19:07:05,Andreas Kling,libgfx: Remove unused cruft from Painter.h,False,Remove unused cruft from Painter.h,libgfx,"diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h index b9a7638f8274..091a79c780e3 100644 --- a/Userland/Libraries/LibGfx/Painter.h +++ b/Userland/Libraries/LibGfx/Painter.h @@ -45,8 +45,6 @@ ALWAYS_INLINE static Color color_for_format(BitmapFormat format, ARGB32 value) class Painter { public: - static constexpr int LINE_SPACING = 4; - explicit Painter(Gfx::Bitmap&); ~Painter() = default; @@ -166,6 +164,4 @@ class PainterStateSaver { Painter& m_painter; }; -ByteString parse_ampersand_string(StringView, Optional* underline_offset = nullptr); - }" 5a983c238bdf3008d58bd7ee75d40b22e1b9b402,2020-06-07 22:59:40,Linus Groh,"libjs: Use switch/case for Value::to_{string{_w/o_side_effects},boolean}",False,"Use switch/case for Value::to_{string{_w/o_side_effects},boolean}",libjs,"diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index e823cb54094b..0df5149a6f48 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -70,38 +70,32 @@ Accessor& Value::as_accessor() String Value::to_string_without_side_effects() const { - if (is_boolean()) - return as_bool() ? ""true"" : ""false""; - - if (is_null()) - return ""null""; - - if (is_undefined()) + switch (m_type) { + case Type::Undefined: return ""undefined""; - - if (is_number()) { + case Type::Null: + return ""null""; + case Type::Boolean: + return m_value.as_bool ? ""true"" : ""false""; + case Type::Number: if (is_nan()) return ""NaN""; - if (is_infinity()) - return as_double() < 0 ? ""-Infinity"" : ""Infinity""; - + return is_negative_infinity() ? ""-Infinity"" : ""Infinity""; if (is_integer()) return String::number(as_i32()); - return String::format(""%.4f"", as_double()); - } - - if (is_string()) + return String::format(""%.4f"", m_value.as_double); + case Type::String: return m_value.as_string->string(); - - if (is_symbol()) - return as_symbol().to_string(); - - if (is_accessor()) + case Type::Symbol: + return m_value.as_symbol->to_string(); + case Type::Object: + return String::format(""[object %s]"", as_object().class_name()); + case Type::Accessor: return """"; - - ASSERT(is_object()); - return String::format(""[object %s]"", as_object().class_name()); + default: + ASSERT_NOT_REACHED(); + } } PrimitiveString* Value::to_primitive_string(Interpreter& interpreter) @@ -116,60 +110,53 @@ PrimitiveString* Value::to_primitive_string(Interpreter& interpreter) String Value::to_string(Interpreter& interpreter) const { - if (is_boolean()) - return as_bool() ? ""true"" : ""false""; - - if (is_null()) - return ""null""; - - if (is_undefined()) + switch (m_type) { + case Type::Undefined: return ""undefined""; - - if (is_number()) { + case Type::Null: + return ""null""; + case Type::Boolean: + return m_value.as_bool ? ""true"" : ""false""; + case Type::Number: if (is_nan()) return ""NaN""; - if (is_infinity()) - return as_double() < 0 ? ""-Infinity"" : ""Infinity""; - + return is_negative_infinity() ? ""-Infinity"" : ""Infinity""; if (is_integer()) return String::number(as_i32()); - return String::format(""%.4f"", as_double()); - } - - if (is_symbol()) { + return String::format(""%.4f"", m_value.as_double); + case Type::String: + return m_value.as_string->string(); + case Type::Symbol: interpreter.throw_exception(""Can't convert symbol to string""); return {}; - } - - if (is_object()) { + case Type::Object: { auto primitive_value = as_object().to_primitive(PreferredType::String); if (interpreter.exception()) return {}; return primitive_value.to_string(interpreter); } - - ASSERT(is_string()); - return m_value.as_string->string(); + default: + ASSERT_NOT_REACHED(); + } } bool Value::to_boolean() const { switch (m_type) { + case Type::Undefined: + case Type::Null: + return false; case Type::Boolean: return m_value.as_bool; case Type::Number: - if (is_nan()) { + if (is_nan()) return false; - } - return !(m_value.as_double == 0 || m_value.as_double == -0); - case Type::Null: - case Type::Undefined: - return false; + return m_value.as_double != 0; case Type::String: - return !as_string().string().is_empty(); - case Type::Object: + return !m_value.as_string->string().is_empty(); case Type::Symbol: + case Type::Object: return true; default: ASSERT_NOT_REACHED(); @@ -185,37 +172,30 @@ Value Value::to_primitive(Interpreter&, PreferredType preferred_type) const Object* Value::to_object(Interpreter& interpreter) const { - if (is_object()) - return &const_cast(as_object()); - - if (is_string()) - return StringObject::create(interpreter.global_object(), *m_value.as_string); - - if (is_symbol()) - return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol); - - if (is_number()) - return NumberObject::create(interpreter.global_object(), m_value.as_double); - - if (is_boolean()) - return BooleanObject::create(interpreter.global_object(), m_value.as_bool); - - if (is_null() || is_undefined()) { + switch (m_type) { + case Type::Undefined: + case Type::Null: interpreter.throw_exception(""ToObject on null or undefined.""); return nullptr; + case Type::Boolean: + return BooleanObject::create(interpreter.global_object(), m_value.as_bool); + case Type::Number: + return NumberObject::create(interpreter.global_object(), m_value.as_double); + case Type::String: + return StringObject::create(interpreter.global_object(), *m_value.as_string); + case Type::Symbol: + return SymbolObject::create(interpreter.global_object(), *m_value.as_symbol); + case Type::Object: + return &const_cast(as_object()); + default: + dbg() << ""Dying because I can't to_object() on "" << *this; + ASSERT_NOT_REACHED(); } - - dbg() << ""Dying because I can't to_object() on "" << *this; - ASSERT_NOT_REACHED(); } Value Value::to_number(Interpreter& interpreter) const { switch (m_type) { - case Type::Empty: - case Type::Accessor: - ASSERT_NOT_REACHED(); - return {}; case Type::Undefined: return js_nan(); case Type::Null: @@ -241,14 +221,15 @@ Value Value::to_number(Interpreter& interpreter) const case Type::Symbol: interpreter.throw_exception(""Can't convert symbol to number""); return {}; - case Type::Object: + case Type::Object: { auto primitive = m_value.as_object->to_primitive(PreferredType::Number); if (interpreter.exception()) return {}; return primitive.to_number(interpreter); } - - ASSERT_NOT_REACHED(); + default: + ASSERT_NOT_REACHED(); + } } i32 Value::as_i32() const @@ -597,8 +578,6 @@ bool same_value_non_numeric(Interpreter&, Value lhs, Value rhs) ASSERT(lhs.type() == rhs.type()); switch (lhs.type()) { - case Value::Type::Empty: - ASSERT_NOT_REACHED(); case Value::Type::Undefined: case Value::Type::Null: return true;" 5c35807878e71e65cf477a279e638cd963284867,2024-10-15 03:24:53,John Diamond,documentation: Suggest installing clang-format version 18 precisely,False,Suggest installing clang-format version 18 precisely,documentation,"diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c26e33277b21..42bfe88fb32a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,7 +63,7 @@ Nobody is perfect, and sometimes we mess things up. That said, here are some goo **Do:** * Write in idiomatic project-style C++23, using the `AK` containers in all code. -* Conform to the project coding style found in [CodingStyle.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 18 or later) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-18. +* Conform to the project coding style found in [CodingStyle.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/CodingStyle.md). Use `clang-format` (version 18) to automatically format C++ files. See [AdvancedBuildInstructions.md](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/AdvancedBuildInstructions.md#clang-format-updates) for instructions on how to get an up-to-date version if your OS distribution does not ship clang-format-18. * Choose expressive variable, function and class names. Make it as obvious as possible what the code is doing. * Split your changes into separate, atomic commits (i.e. A commit per feature or fix, where the build, tests and the system are all functioning). * Make sure your commits are rebased on the master branch. diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index 410c4419fad2..5401097a1536 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -126,7 +126,7 @@ brew install autoconf autoconf-archive automake ccache cmake ffmpeg nasm ninja p If you wish to use clang from homebrew instead: ``` -brew install llvm +brew install llvm@18 ``` If you also plan to use the Qt chrome on macOS: diff --git a/Documentation/CodingStyle.md b/Documentation/CodingStyle.md index 56f1e88bb363..b34c9121d510 100644 --- a/Documentation/CodingStyle.md +++ b/Documentation/CodingStyle.md @@ -2,7 +2,7 @@ For low-level styling (spaces, parentheses, brace placement, etc), all code should follow the format specified in `.clang-format` in the project root. -**Important: Make sure you use `clang-format` version 18 or later!** +**Important: Make sure you use `clang-format` version 18!** This document describes the coding style used for C++ code in the Ladybird Browser project. All new code should conform to this style. diff --git a/Documentation/QtCreatorConfiguration.md b/Documentation/QtCreatorConfiguration.md index a9beed92b71a..c547c685e991 100644 --- a/Documentation/QtCreatorConfiguration.md +++ b/Documentation/QtCreatorConfiguration.md @@ -38,7 +38,7 @@ Qt Creator should be set up correctly now, go ahead and explore the project and ## Auto-Formatting -You can use `clang-format` to help you with the [style guide](CodingStyle.md). Before you proceed, check that you're actually using clang-format version 18, as some OSes will ship older clang-format versions by default. +You can use `clang-format` to help you with the [style guide](CodingStyle.md). Before you proceed, check that you're actually using clang-format version 18, as some OSes will ship other clang-format versions by default. - In QtCreator, go to ""Help > About Plugins…"" - Find the `Beautifier (experimental)` row (for example, by typing `beau` into the search) diff --git a/Documentation/SelfHostedRunners.md b/Documentation/SelfHostedRunners.md index 3804d33a7108..65ef3ff003c3 100644 --- a/Documentation/SelfHostedRunners.md +++ b/Documentation/SelfHostedRunners.md @@ -22,7 +22,7 @@ sudo add-apt-repository ppa:canonical-server/server-backports wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' apt update -apt install git build-essential make cmake clang-format-16 gcc-13 g++-13 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt +apt install git build-essential make cmake clang-format-18 gcc-13 g++-13 libstdc++-13-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt ``` ### Force usage of GCC 13 ```shell" 161c862f2193f1f565cbe37b102d3003f4c69f78,2019-08-27 10:23:23,Andreas Kling,windowserver: Add an icon for the system menu / About action,False,Add an icon for the system menu / About action,windowserver,"diff --git a/Base/res/icons/16x16/ladybug.png b/Base/res/icons/16x16/ladybug.png new file mode 100644 index 000000000000..525126859dcd Binary files /dev/null and b/Base/res/icons/16x16/ladybug.png differ diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index 5d738584de3e..04dcb9022a80 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -67,7 +67,7 @@ WSWindowManager::WSWindowManager() m_system_menu->add_item(make(*m_system_menu, WSMenuItem::Separator)); m_system_menu->add_item(make(*m_system_menu, 100, ""Reload WM Config File"")); m_system_menu->add_item(make(*m_system_menu, WSMenuItem::Separator)); - m_system_menu->add_item(make(*m_system_menu, 200, ""About..."")); + m_system_menu->add_item(make(*m_system_menu, 200, ""About..."", String(), true, false, false, load_png(""/res/icons/16x16/ladybug.png""))); m_system_menu->add_item(make(*m_system_menu, WSMenuItem::Separator)); m_system_menu->add_item(make(*m_system_menu, 300, ""Shutdown..."")); m_system_menu->on_item_activation = [this, apps](WSMenuItem& item) {" bd72ff566959d8a3fc77e9b5f6b47d475453e3e8,2024-07-19 12:52:08,Tim Ledbetter,libweb: Expose `ChildNode` methods on the `DocumentType` IDL interface,False,Expose `ChildNode` methods on the `DocumentType` IDL interface,libweb,"diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.idl b/Userland/Libraries/LibWeb/DOM/DocumentType.idl index 7834d9d49d92..2c389387d2ec 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.idl +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.idl @@ -8,3 +8,5 @@ interface DocumentType : Node { readonly attribute DOMString publicId; readonly attribute DOMString systemId; }; + +DocumentType includes ChildNode;" 0ebf56efb028669b4c24c8193c2d13ced8397512,2020-09-01 02:34:55,asynts,libcompress: Add support for dynamic deflate blocks.,False,Add support for dynamic deflate blocks.,libcompress,"diff --git a/Libraries/LibCompress/Deflate.cpp b/Libraries/LibCompress/Deflate.cpp index f1257ee0bfec..e827bdffe84e 100644 --- a/Libraries/LibCompress/Deflate.cpp +++ b/Libraries/LibCompress/Deflate.cpp @@ -217,7 +217,8 @@ size_t DeflateDecompressor::read(Bytes bytes) } if (block_type == 0b10) { - CanonicalCode literal_codes, distance_codes; + CanonicalCode literal_codes; + Optional distance_codes; decode_codes(literal_codes, distance_codes); m_state = State::ReadingCompressedBlock; @@ -345,12 +346,97 @@ u32 DeflateDecompressor::decode_distance(u32 symbol) ASSERT_NOT_REACHED(); } -void DeflateDecompressor::decode_codes(CanonicalCode&, CanonicalCode&) +void DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Optional& distance_code) { - // FIXME: This was already implemented but I removed it because it was quite chaotic and untested. - // I am planning to come back to this. @asynts - // https://github.com/SerenityOS/serenity/blob/208cb995babb13e0af07bb9d3219f0a9fe7bca7d/Libraries/LibCompress/Deflate.cpp#L144-L242 - TODO(); + auto literal_code_count = m_input_stream.read_bits(5) + 257; + auto distance_code_count = m_input_stream.read_bits(5) + 1; + auto code_length_count = m_input_stream.read_bits(4) + 4; + + // First we have to extract the code lengths of the code that was used to encode the code lengths of + // the code that was used to encode the block. + + u8 code_lengths_code_lengths[19] = { 0 }; + for (size_t i = 0; i < code_length_count; ++i) { + static const size_t indices[] { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; + code_lengths_code_lengths[indices[i]] = m_input_stream.read_bits(3); + } + + // Now we can extract the code that was used to encode the code lengths of the code that was used to + // encode the block. + + auto code_length_code_result = CanonicalCode::from_bytes({ code_lengths_code_lengths, sizeof(code_lengths_code_lengths) }); + if (!code_length_code_result.has_value()) { + m_error = true; + return; + } + const auto code_length_code = code_length_code_result.value(); + + // Next we extract the code lengths of the code that was used to encode the block. + + Vector code_lengths; + while (code_lengths.size() < literal_code_count + distance_code_count) { + auto symbol = code_length_code.read_symbol(m_input_stream); + + if (symbol <= 15) { + code_lengths.append(static_cast(symbol)); + continue; + } else if (symbol == 17) { + auto nrepeat = 3 + m_input_stream.read_bits(3); + for (size_t j = 0; j < nrepeat; ++j) + code_lengths.append(0); + continue; + } else if (symbol == 18) { + auto nrepeat = 11 + m_input_stream.read_bits(7); + for (size_t j = 0; j < nrepeat; ++j) + code_lengths.append(0); + continue; + } else { + ASSERT(symbol == 16); + + if (code_lengths.is_empty()) { + m_error = true; + return; + } + + auto nrepeat = 3 + m_input_stream.read_bits(3); + for (size_t j = 0; j < nrepeat; ++j) + code_lengths.append(code_lengths.last()); + } + } + + if (code_lengths.size() != literal_code_count + distance_code_count) { + m_error = true; + return; + } + + // Now we extract the code that was used to encode literals and lengths in the block. + + auto literal_code_result = CanonicalCode::from_bytes(code_lengths.span().trim(literal_code_count)); + if (!literal_code_result.has_value()) { + m_error = true; + return; + } + literal_code = literal_code_result.value(); + + // Now we extract the code that was used to encode distances in the block. + + if (distance_code_count == 1) { + auto length = code_lengths[literal_code_count]; + + if (length == 0) { + return; + } else if (length != 1) { + m_error = true; + return; + } + } + + auto distance_code_result = CanonicalCode::from_bytes(code_lengths.span().slice(literal_code_count)); + if (!distance_code_result.has_value()) { + m_error = true; + return; + } + distance_code = distance_code_result.value(); } } diff --git a/Libraries/LibCompress/Deflate.h b/Libraries/LibCompress/Deflate.h index 8b54214cbb52..a567c7b9d370 100644 --- a/Libraries/LibCompress/Deflate.h +++ b/Libraries/LibCompress/Deflate.h @@ -99,7 +99,7 @@ class DeflateDecompressor final : public InputStream { private: u32 decode_run_length(u32); u32 decode_distance(u32); - void decode_codes(CanonicalCode&, CanonicalCode&); + void decode_codes(CanonicalCode& literal_code, Optional& distance_code); bool m_read_final_bock { false };" 5c6326ae230ded7783ce949ec72b0323d9af41f4,2022-03-21 00:30:25,thankyouverycool,libgui: Add automatic scrolling to GlyphMapWidget,False,Add automatic scrolling to GlyphMapWidget,libgui,"diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp index bd4d3d2683ca..80fbb4eb675a 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.cpp +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.cpp @@ -54,6 +54,19 @@ GlyphMapWidget::GlyphMapWidget() horizontal_scrollbar().set_visible(false); did_change_font(); set_active_glyph('A'); + + m_automatic_selection_scroll_timer = add(20, [this] { + if (!m_in_drag_select) { + m_automatic_selection_scroll_timer->stop(); + return; + } + auto glyph = glyph_at_position_clamped(m_last_mousemove_position); + m_selection.extend_to(glyph); + set_active_glyph(glyph, ShouldResetSelection::No); + scroll_to_glyph(glyph); + update(); + }); + m_automatic_selection_scroll_timer->stop(); } void GlyphMapWidget::resize_event(ResizeEvent& event) @@ -168,6 +181,7 @@ void GlyphMapWidget::mousedown_event(MouseEvent& event) if (event.shift()) m_selection.extend_to(glyph); m_in_drag_select = true; + m_automatic_selection_scroll_timer->start(); set_active_glyph(glyph, event.shift() ? ShouldResetSelection::No : ShouldResetSelection::Yes); } } @@ -187,14 +201,7 @@ void GlyphMapWidget::mouseup_event(GUI::MouseEvent& event) void GlyphMapWidget::mousemove_event(GUI::MouseEvent& event) { - if (!m_in_drag_select) - return; - - auto glyph = glyph_at_position_clamped(event.position()); - m_selection.extend_to(glyph); - set_active_glyph(glyph, ShouldResetSelection::No); - scroll_to_glyph(glyph); - update(); + m_last_mousemove_position = event.position(); } void GlyphMapWidget::doubleclick_event(MouseEvent& event) diff --git a/Userland/Libraries/LibGUI/GlyphMapWidget.h b/Userland/Libraries/LibGUI/GlyphMapWidget.h index b5ac0b8df5d2..9d1dfe2b3c9c 100644 --- a/Userland/Libraries/LibGUI/GlyphMapWidget.h +++ b/Userland/Libraries/LibGUI/GlyphMapWidget.h @@ -8,6 +8,7 @@ #pragma once +#include #include #include #include @@ -94,6 +95,8 @@ class GlyphMapWidget final : public AbstractScrollableWidget { int m_visible_glyphs { 0 }; bool m_in_drag_select { false }; Unicode::CodePointRange m_active_range { 0x0000, 0x10FFFF }; + RefPtr m_automatic_selection_scroll_timer; + Gfx::IntPoint m_last_mousemove_position; }; }" 6fff03713ccc1bb82bffe172cc41f2d5c28901dc,2022-12-25 20:28:58,Andrew Kaster,ladybird: Ensure that installed ladybird can launch WebContent process,False,Ensure that installed ladybird can launch WebContent process,ladybird,"diff --git a/Ladybird/CMakeLists.txt b/Ladybird/CMakeLists.txt index cd145cbcbff5..bc58b994b030 100644 --- a/Ladybird/CMakeLists.txt +++ b/Ladybird/CMakeLists.txt @@ -96,9 +96,9 @@ add_custom_target(debug qt_finalize_executable(ladybird) +add_subdirectory(WebContent) +add_dependencies(ladybird WebContent) + if(NOT CMAKE_SKIP_INSTALL_RULES) include(cmake/InstallRules.cmake) endif() - -add_subdirectory(WebContent) -add_dependencies(ladybird WebContent) diff --git a/Ladybird/WebContent/CMakeLists.txt b/Ladybird/WebContent/CMakeLists.txt index 5d4d995d95ca..1b174ebbe638 100644 --- a/Ladybird/WebContent/CMakeLists.txt +++ b/Ladybird/WebContent/CMakeLists.txt @@ -1,10 +1,10 @@ set(WEBCONTENT_SOURCE_DIR ${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/) set(WEBCONTENT_SOURCES - ${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.cpp - ${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalObject.cpp - ${WEBCONTENT_SOURCE_DIR}/PageHost.cpp - ${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp + ${WEBCONTENT_SOURCE_DIR}/ConnectionFromClient.cpp + ${WEBCONTENT_SOURCE_DIR}/ConsoleGlobalObject.cpp + ${WEBCONTENT_SOURCE_DIR}/PageHost.cpp + ${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp ../EventLoopPluginQt.cpp ../FontPluginQt.cpp ../ImageCodecPluginLadybird.cpp @@ -14,7 +14,7 @@ set(WEBCONTENT_SOURCES ../WebSocketClientManagerLadybird.cpp ../WebSocketLadybird.cpp main.cpp -) +) qt_add_executable(WebContent ${WEBCONTENT_SOURCES}) diff --git a/Ladybird/WebContent/main.cpp b/Ladybird/WebContent/main.cpp index 911348b3b16b..2623693cfa66 100644 --- a/Ladybird/WebContent/main.cpp +++ b/Ladybird/WebContent/main.cpp @@ -38,10 +38,10 @@ ErrorOr serenity_main(Main::Arguments arguments) // FIXME: Refactor things so we can get rid of this somehow. Core::EventLoop event_loop; - platform_init(); - QGuiApplication app(arguments.argc, arguments.argv); + platform_init(); + Web::Platform::EventLoopPlugin::install(*new Ladybird::EventLoopPluginQt); Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird); diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp index c3b82d33a483..071c4f72297d 100644 --- a/Ladybird/WebContentView.cpp +++ b/Ladybird/WebContentView.cpp @@ -570,6 +570,8 @@ void WebContentView::create_client() MUST(Core::System::setenv(""FD_PASSING_SOCKET""sv, fd_passing_socket_string, true)); auto rc = execlp(""./WebContent/WebContent"", ""WebContent"", nullptr); + if (rc < 0) + rc = execlp((QCoreApplication::applicationDirPath() + ""/WebContent"").toStdString().c_str(), ""WebContent"", nullptr); if (rc < 0) perror(""execlp""); VERIFY_NOT_REACHED(); diff --git a/Ladybird/cmake/InstallRules.cmake b/Ladybird/cmake/InstallRules.cmake index d2a5932c29aa..592d2f522479 100644 --- a/Ladybird/cmake/InstallRules.cmake +++ b/Ladybird/cmake/InstallRules.cmake @@ -18,10 +18,23 @@ install(TARGETS ladybird DESTINATION ${CMAKE_INSTALL_LIBDIR} ) +install(TARGETS WebContent + EXPORT ladybirdTargets + RUNTIME + COMPONENT ladybird_Runtime + DESTINATION ${CMAKE_INSTALL_BINDIR} + BUNDLE + COMPONENT ladybird_Runtime + DESTINATION bundle +) + include(""${Lagom_SOURCE_DIR}/get_linked_lagom_libraries.cmake"") get_linked_lagom_libraries(ladybird ladybird_lagom_libraries) +get_linked_lagom_libraries(WebContent webcontent_lagom_libraries) +list(APPEND all_required_lagom_libraries ${ladybird_lagom_libraries} ${webcontent_lagom_libraries}) +list(REMOVE_DUPLICATES all_required_lagom_libraries) -install(TARGETS ${ladybird_lagom_libraries} +install(TARGETS ${all_required_lagom_libraries} EXPORT ladybirdTargets COMPONENT ladybird_Runtime LIBRARY diff --git a/Ladybird/main.cpp b/Ladybird/main.cpp index df5241edb00d..e61cbb52158b 100644 --- a/Ladybird/main.cpp +++ b/Ladybird/main.cpp @@ -17,18 +17,18 @@ Browser::Settings* s_settings; ErrorOr serenity_main(Main::Arguments arguments) { - platform_init(); - - // NOTE: We only instantiate this to ensure that Gfx::FontDatabase has its default queries initialized. - Gfx::FontDatabase::set_default_font_query(""Katica 10 400 0""); - Gfx::FontDatabase::set_fixed_width_font_query(""Csilla 10 400 0""); - // NOTE: This is only used for the Core::Socket inside the IPC connections. // FIXME: Refactor things so we can get rid of this somehow. Core::EventLoop event_loop; QApplication app(arguments.argc, arguments.argv); + platform_init(); + + // NOTE: We only instantiate this to ensure that Gfx::FontDatabase has its default queries initialized. + Gfx::FontDatabase::set_default_font_query(""Katica 10 400 0""); + Gfx::FontDatabase::set_fixed_width_font_query(""Csilla 10 400 0""); + String url; Core::ArgsParser args_parser; args_parser.set_general_help(""The Ladybird web browser :^)"");" 20dbbdf90c271a948a7cf809227d9998424b8424,2022-03-04 00:19:50,Karol Kosek,spreadsheet: Simplify enabling actions on selection,False,Simplify enabling actions on selection,spreadsheet,"diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 746ff3b2b31f..733f8b518743 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -274,10 +274,13 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) auto& sheet = *sheet_ptr; VERIFY(!selection.is_empty()); + m_cut_action->set_enabled(true); + m_copy_action->set_enabled(true); + m_current_cell_label->set_enabled(true); + m_cell_value_editor->set_enabled(true); if (selection.size() == 1) { auto& position = selection.first(); - m_current_cell_label->set_enabled(true); m_current_cell_label->set_text(position.to_cell_identifier(sheet)); auto& cell = sheet.ensure(position); @@ -292,9 +295,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) sheet.update(); update(); }; - m_cell_value_editor->set_enabled(true); - m_cut_action->set_enabled(true); - m_copy_action->set_enabled(true); static_cast(const_cast(m_cell_value_editor->syntax_highlighter()))->set_cell(&cell); return; } @@ -302,7 +302,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) // There are many cells selected, change all of them. StringBuilder builder; builder.appendff(""<{}>"", selection.size()); - m_current_cell_label->set_enabled(true); m_current_cell_label->set_text(builder.string_view()); Vector cells; @@ -331,7 +330,6 @@ void SpreadsheetWidget::setup_tabs(NonnullRefPtrVector new_sheets) update(); } }; - m_cell_value_editor->set_enabled(true); static_cast(const_cast(m_cell_value_editor->syntax_highlighter()))->set_cell(&first_cell); }; m_selected_view->on_selection_dropped = [&]() {" e75eb21a54d41a1f77abe6f7ca0f158eca987baa,2023-01-04 16:20:03,implicitfield,"libweb: Support ""start"" and ""end"" values for justify-content",False,"Support ""start"" and ""end"" values for justify-content",libweb,"diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index 9c306150b908..34cdc7fb463f 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -142,6 +142,8 @@ ""optimizequality=smooth"" ], ""justify-content"": [ + ""start"", + ""end"", ""flex-start"", ""flex-end"", ""center"", diff --git a/Userland/Libraries/LibWeb/CSS/Identifiers.json b/Userland/Libraries/LibWeb/CSS/Identifiers.json index 24c25a7f94e8..a4b4628b62a8 100644 --- a/Userland/Libraries/LibWeb/CSS/Identifiers.json +++ b/Userland/Libraries/LibWeb/CSS/Identifiers.json @@ -109,6 +109,7 @@ ""double"", ""e-resize"", ""enabled"", + ""end"", ""ew-resize"", ""fantasy"", ""fast"", @@ -249,6 +250,7 @@ ""srgb"", ""standalone"", ""standard"", + ""start"", ""static"", ""sticky"", ""stretch"", diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index c730e67b69a4..1d7b6aaa9fec 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -1231,6 +1231,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space() bool justification_is_centered = false; switch (flex_container().computed_values().justify_content()) { + case CSS::JustifyContent::Start: case CSS::JustifyContent::FlexStart: if (is_direction_reverse()) { flex_region_render_cursor = FlexRegionRenderCursor::Right; @@ -1239,6 +1240,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space() initial_offset = 0; } break; + case CSS::JustifyContent::End: case CSS::JustifyContent::FlexEnd: if (is_direction_reverse()) { initial_offset = 0; @@ -2002,6 +2004,20 @@ Gfx::FloatPoint FlexFormattingContext::calculate_static_position(Box const& box) bool pack_from_end = true; float main_offset = 0; switch (flex_container().computed_values().justify_content()) { + case CSS::JustifyContent::Start: + if (is_direction_reverse()) { + main_offset = specified_main_size(flex_container()); + } else { + main_offset = 0; + } + break; + case CSS::JustifyContent::End: + if (is_direction_reverse()) { + main_offset = 0; + } else { + main_offset = specified_main_size(flex_container()); + } + break; case CSS::JustifyContent::FlexStart: if (is_direction_reverse()) { pack_from_end = false;" a15ed8743d03c6c683f19447be20ca7dac768485,2021-11-11 02:28:58,Andreas Kling,ak: Make ByteBuffer::try_* functions return ErrorOr,False,Make ByteBuffer::try_* functions return ErrorOr,ak,"diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 641371cd68fb..045c6ebfd408 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2021, Gunnar Beutner * * SPDX-License-Identifier: BSD-2-Clause @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -27,8 +28,7 @@ class ByteBuffer { ByteBuffer(ByteBuffer const& other) { - auto ok = try_resize(other.size()); - VERIFY(ok); + MUST(try_resize(other.size())); VERIFY(m_size == other.size()); __builtin_memcpy(data(), other.data(), other.size()); } @@ -54,8 +54,7 @@ class ByteBuffer { if (m_size > other.size()) { trim(other.size(), true); } else { - auto ok = try_resize(other.size()); - VERIFY(ok); + MUST(try_resize(other.size())); } __builtin_memcpy(data(), other.data(), other.size()); } @@ -65,7 +64,7 @@ class ByteBuffer { [[nodiscard]] static Optional create_uninitialized(size_t size) { auto buffer = ByteBuffer(); - if (!buffer.try_resize(size)) + if (buffer.try_resize(size).is_error()) return {}; return { move(buffer) }; } @@ -157,64 +156,58 @@ class ByteBuffer { ALWAYS_INLINE void resize(size_t new_size) { - auto ok = try_resize(new_size); - VERIFY(ok); + MUST(try_resize(new_size)); } ALWAYS_INLINE void ensure_capacity(size_t new_capacity) { - auto ok = try_ensure_capacity(new_capacity); - VERIFY(ok); + MUST(try_ensure_capacity(new_capacity)); } - [[nodiscard]] ALWAYS_INLINE bool try_resize(size_t new_size) + ErrorOr try_resize(size_t new_size) { if (new_size <= m_size) { trim(new_size, false); - return true; + return {}; } - if (!try_ensure_capacity(new_size)) - return false; + TRY(try_ensure_capacity(new_size)); m_size = new_size; - return true; + return {}; } - [[nodiscard]] ALWAYS_INLINE bool try_ensure_capacity(size_t new_capacity) + ErrorOr try_ensure_capacity(size_t new_capacity) { if (new_capacity <= capacity()) - return true; + return {}; return try_ensure_capacity_slowpath(new_capacity); } void append(ReadonlyBytes const& bytes) { - auto ok = try_append(bytes); - VERIFY(ok); + MUST(try_append(bytes)); } void append(void const* data, size_t data_size) { append({ data, data_size }); } - [[nodiscard]] bool try_append(ReadonlyBytes const& bytes) + ErrorOr try_append(ReadonlyBytes const& bytes) { return try_append(bytes.data(), bytes.size()); } - [[nodiscard]] bool try_append(void const* data, size_t data_size) + ErrorOr try_append(void const* data, size_t data_size) { if (data_size == 0) - return true; + return {}; VERIFY(data != nullptr); int old_size = size(); - if (!try_resize(size() + data_size)) - return false; + TRY(try_resize(size() + data_size)); __builtin_memcpy(this->data() + old_size, data, data_size); - return true; + return {}; } void operator+=(ByteBuffer const& other) { - auto ok = try_append(other.data(), other.size()); - VERIFY(ok); + MUST(try_append(other.data(), other.size())); } void overwrite(size_t offset, void const* data, size_t data_size) @@ -269,12 +262,12 @@ class ByteBuffer { m_inline = true; } - [[nodiscard]] NEVER_INLINE bool try_ensure_capacity_slowpath(size_t new_capacity) + NEVER_INLINE ErrorOr try_ensure_capacity_slowpath(size_t new_capacity) { new_capacity = kmalloc_good_size(new_capacity); auto new_buffer = (u8*)kmalloc(new_capacity); if (!new_buffer) - return false; + return Error::from_errno(ENOMEM); if (m_inline) { __builtin_memcpy(new_buffer, data(), m_size); @@ -286,7 +279,7 @@ class ByteBuffer { m_outline_buffer = new_buffer; m_outline_capacity = new_capacity; m_inline = false; - return true; + return {}; } union { diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index df4331f9ca7f..f382be467c24 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -18,18 +18,19 @@ namespace AK { -inline bool StringBuilder::will_append(size_t size) +inline ErrorOr StringBuilder::will_append(size_t size) { Checked needed_capacity = m_buffer.size(); needed_capacity += size; VERIFY(!needed_capacity.has_overflow()); // Prefer to completely use the existing capacity first if (needed_capacity <= m_buffer.capacity()) - return true; + return {}; Checked expanded_capacity = needed_capacity; expanded_capacity *= 2; VERIFY(!expanded_capacity.has_overflow()); - return m_buffer.try_ensure_capacity(expanded_capacity.value()); + TRY(m_buffer.try_ensure_capacity(expanded_capacity.value())); + return {}; } StringBuilder::StringBuilder(size_t initial_capacity) @@ -41,10 +42,8 @@ void StringBuilder::append(StringView const& str) { if (str.is_empty()) return; - auto ok = will_append(str.length()); - VERIFY(ok); - ok = m_buffer.try_append(str.characters_without_null_termination(), str.length()); - VERIFY(ok); + MUST(will_append(str.length())); + MUST(m_buffer.try_append(str.characters_without_null_termination(), str.length())); } void StringBuilder::append(char const* characters, size_t length) @@ -54,10 +53,8 @@ void StringBuilder::append(char const* characters, size_t length) void StringBuilder::append(char ch) { - auto ok = will_append(1); - VERIFY(ok); - ok = m_buffer.try_append(&ch, 1); - VERIFY(ok); + MUST(will_append(1)); + MUST(m_buffer.try_append(&ch, 1)); } void StringBuilder::appendvf(char const* fmt, va_list ap) diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index bc29e12f06c7..fc7f830dc457 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -64,7 +64,7 @@ class StringBuilder { } private: - bool will_append(size_t); + ErrorOr will_append(size_t); u8* data() { return m_buffer.data(); } u8 const* data() const { return m_buffer.data(); } diff --git a/Tests/LibTLS/TestTLSHandshake.cpp b/Tests/LibTLS/TestTLSHandshake.cpp index 9494f258e891..6218e5b0d1a5 100644 --- a/Tests/LibTLS/TestTLSHandshake.cpp +++ b/Tests/LibTLS/TestTLSHandshake.cpp @@ -96,7 +96,7 @@ TEST_CASE(test_TLS_hello_handshake) loop.quit(1); } else { // print_buffer(data.value(), 16); - if (!contents.try_append(data.value().data(), data.value().size())) { + if (contents.try_append(data.value().data(), data.value().size()).is_error()) { FAIL(""Allocation failure""); loop.quit(1); } diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index ec3d4c4efd28..9751c28df237 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -67,7 +67,7 @@ static bool handle_disassemble_command(const String& command, void* first_instru auto value = g_debug_session->peek(reinterpret_cast(first_instruction) + i); if (!value.has_value()) break; - if (!code.try_append(&value, sizeof(u32))) + if (code.try_append(&value, sizeof(u32)).is_error()) break; } diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index d521a78aff5b..d91bd4b1f1cd 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -460,7 +460,7 @@ static bool fill_getserv_buffers(const char* line, ssize_t read) break; } auto alias = split_line[i].to_byte_buffer(); - if (!alias.try_append(""\0"", sizeof(char))) + if (alias.try_append(""\0"", sizeof(char)).is_error()) return false; __getserv_alias_list_buffer.append(move(alias)); } @@ -630,7 +630,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read) if (split_line[i].starts_with('#')) break; auto alias = split_line[i].to_byte_buffer(); - if (!alias.try_append(""\0"", sizeof(char))) + if (alias.try_append(""\0"", sizeof(char)).is_error()) return false; __getproto_alias_list_buffer.append(move(alias)); } diff --git a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp index c901febe4163..90f957cfc971 100644 --- a/Userland/Libraries/LibCrypto/ASN1/PEM.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/PEM.cpp @@ -39,7 +39,7 @@ ByteBuffer decode_pem(ReadonlyBytes data) dbgln(""Failed to decode PEM, likely bad Base64""); return {}; } - if (!decoded.try_append(b64decoded.value().data(), b64decoded.value().size())) { + if (decoded.try_append(b64decoded.value().data(), b64decoded.value().size()).is_error()) { dbgln(""Failed to decode PEM, likely OOM condition""); return {}; } diff --git a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h index b1b1a569a932..3193c772d430 100644 --- a/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h +++ b/Userland/Libraries/LibCrypto/PK/Code/EMSA_PSS.h @@ -152,8 +152,8 @@ class EMSA_PSS : public Code { for (size_t counter = 0; counter < length / HashFunction::DigestSize - 1; ++counter) { hash_fn.update(seed); hash_fn.update((u8*)&counter, 4); - if (!T.try_append(hash_fn.digest().data, HashFunction::DigestSize)) { - dbgln(""EMSA_PSS: MGF1 digest failed, not enough space""); + if (auto result = T.try_append(hash_fn.digest().data, HashFunction::DigestSize); result.is_error()) { + dbgln(""EMSA_PSS: MGF1 digest failed: {}"", result.error()); return; } } diff --git a/Userland/Libraries/LibGfx/BMPWriter.cpp b/Userland/Libraries/LibGfx/BMPWriter.cpp index 87377707a161..e52f9d07f03c 100644 --- a/Userland/Libraries/LibGfx/BMPWriter.cpp +++ b/Userland/Libraries/LibGfx/BMPWriter.cpp @@ -143,8 +143,8 @@ ByteBuffer BMPWriter::dump(const RefPtr bitmap, DibHeader dib_header) } } - if (!buffer.try_append(pixel_data.data(), pixel_data.size())) - dbgln(""Failed to write {} bytes of pixel data to buffer"", pixel_data.size()); + if (auto result = buffer.try_append(pixel_data.data(), pixel_data.size()); result.is_error()) + dbgln(""Failed to write {} bytes of pixel data to buffer: {}"", pixel_data.size(), result.error()); return buffer; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index c55c70e08eb0..1969aed99a0d 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -370,7 +370,7 @@ void Editor::insert(const u32 cp) StringBuilder builder; builder.append(Utf32View(&cp, 1)); auto str = builder.build(); - if (!m_pending_chars.try_append(str.characters(), str.length())) + if (m_pending_chars.try_append(str.characters(), str.length()).is_error()) return; readjust_anchored_styles(m_cursor, ModificationKind::Insertion); diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index 1872c0e9b8e2..a591060c47ae 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -273,8 +273,8 @@ bool Parser::initialize_hint_tables() if (!buffer_result.has_value()) return false; possible_merged_stream_buffer = buffer_result.release_value(); - auto ok = possible_merged_stream_buffer.try_append(primary_hint_stream->bytes()); - ok = ok && possible_merged_stream_buffer.try_append(overflow_hint_stream->bytes()); + auto ok = !possible_merged_stream_buffer.try_append(primary_hint_stream->bytes()).is_error(); + ok = ok && !possible_merged_stream_buffer.try_append(overflow_hint_stream->bytes()).is_error(); if (!ok) return false; hint_stream_bytes = possible_merged_stream_buffer.bytes(); diff --git a/Userland/Libraries/LibSQL/Heap.cpp b/Userland/Libraries/LibSQL/Heap.cpp index 7bf8bf9fd612..fb99fa5fa483 100644 --- a/Userland/Libraries/LibSQL/Heap.cpp +++ b/Userland/Libraries/LibSQL/Heap.cpp @@ -75,7 +75,7 @@ bool Heap::write_block(u32 block, ByteBuffer& buffer) VERIFY(buffer.size() <= BLOCKSIZE); auto sz = buffer.size(); if (sz < BLOCKSIZE) { - if (!buffer.try_resize(BLOCKSIZE)) + if (buffer.try_resize(BLOCKSIZE).is_error()) return false; memset(buffer.offset_pointer((int)sz), 0, BLOCKSIZE - sz); } diff --git a/Userland/Libraries/LibTLS/HandshakeClient.cpp b/Userland/Libraries/LibTLS/HandshakeClient.cpp index 7299f3418a6f..8a4304eea298 100644 --- a/Userland/Libraries/LibTLS/HandshakeClient.cpp +++ b/Userland/Libraries/LibTLS/HandshakeClient.cpp @@ -119,7 +119,7 @@ bool TLSv12::compute_master_secret_from_pre_master_secret(size_t length) return false; } - if (!m_context.master_key.try_resize(length)) { + if (m_context.master_key.try_resize(length).is_error()) { dbgln(""Couldn't allocate enough space for the master key :(""); return false; } diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 0488dba08933..d654fd4f626a 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -56,8 +56,7 @@ void TLSv12::write_packet(ByteBuffer& packet) if (m_context.tls_buffer.size() + packet.size() > 16 * KiB) schedule_or_perform_flush(true); - auto ok = m_context.tls_buffer.try_append(packet.data(), packet.size()); - if (!ok) { + if (m_context.tls_buffer.try_append(packet.data(), packet.size()).is_error()) { // Toooooo bad, drop the record on the ground. return; } @@ -498,7 +497,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) } else { dbgln_if(TLS_DEBUG, ""application data message of size {}"", plain.size()); - if (!m_context.application_buffer.try_append(plain.data(), plain.size())) { + if (m_context.application_buffer.try_append(plain.data(), plain.size()).is_error()) { payload_res = (i8)Error::DecryptionFailed; auto packet = build_alert(true, (u8)AlertDescription::DecryptionFailed); write_packet(packet); diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp index 8f31933d9c2c..bce3c2fd14fe 100644 --- a/Userland/Libraries/LibTLS/TLSv12.cpp +++ b/Userland/Libraries/LibTLS/TLSv12.cpp @@ -35,7 +35,7 @@ void TLSv12::consume(ReadonlyBytes record) dbgln_if(TLS_DEBUG, ""Consuming {} bytes"", record.size()); - if (!m_context.message_buffer.try_append(record)) { + if (m_context.message_buffer.try_append(record).is_error()) { dbgln(""Not enough space in message buffer, dropping the record""); return; } diff --git a/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h b/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h index 5f127365f8a4..aeec26d1f6a8 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/AbstractMachine.h @@ -349,7 +349,7 @@ class MemoryInstance { return false; } auto previous_size = m_size; - if (!m_data.try_resize(new_size)) + if (m_data.try_resize(new_size).is_error()) return false; m_size = new_size; // The spec requires that we zero out everything on grow diff --git a/Userland/Libraries/LibWasm/Parser/Parser.cpp b/Userland/Libraries/LibWasm/Parser/Parser.cpp index c201265088cc..d2ae4d4561c5 100644 --- a/Userland/Libraries/LibWasm/Parser/Parser.cpp +++ b/Userland/Libraries/LibWasm/Parser/Parser.cpp @@ -739,7 +739,7 @@ ParseResult CustomSection::parse(InputStream& stream) return name.error(); ByteBuffer data_buffer; - if (!data_buffer.try_resize(64)) + if (data_buffer.try_resize(64).is_error()) return ParseError::OutOfMemory; while (!stream.has_any_error() && !stream.unreliable_eof()) { @@ -747,7 +747,7 @@ ParseResult CustomSection::parse(InputStream& stream) auto size = stream.read({ buf, 16 }); if (size == 0) break; - if (!data_buffer.try_append(buf, size)) + if (data_buffer.try_append(buf, size).is_error()) return with_eof_check(stream, ParseError::HugeAllocationRequested); } diff --git a/Userland/Services/InspectorServer/InspectableProcess.cpp b/Userland/Services/InspectorServer/InspectableProcess.cpp index 140d8a14277b..578945c31435 100644 --- a/Userland/Services/InspectorServer/InspectableProcess.cpp +++ b/Userland/Services/InspectorServer/InspectableProcess.cpp @@ -57,8 +57,8 @@ String InspectableProcess::wait_for_response() auto packet = m_socket->read(remaining_bytes); if (packet.size() == 0) break; - if (!data.try_append(packet.data(), packet.size())) { - dbgln(""Failed to append {} bytes to data buffer"", packet.size()); + if (auto result = data.try_append(packet.data(), packet.size()); result.is_error()) { + dbgln(""Failed to append {} bytes to data buffer: {}"", packet.size(), result.error()); break; } remaining_bytes -= packet.size(); diff --git a/Userland/Utilities/pro.cpp b/Userland/Utilities/pro.cpp index 6bf653d1bc0d..28091cf683c5 100644 --- a/Userland/Utilities/pro.cpp +++ b/Userland/Utilities/pro.cpp @@ -122,7 +122,8 @@ class ConditionalOutputFileStream final : public OutputFileStream { { if (!m_condition()) { write_to_buffer:; - if (!m_buffer.try_append(bytes.data(), bytes.size())) + // FIXME: Propagate errors. + if (m_buffer.try_append(bytes.data(), bytes.size()).is_error()) return 0; return bytes.size(); } diff --git a/Userland/Utilities/test-crypto.cpp b/Userland/Utilities/test-crypto.cpp index 1d94219d0076..456966439f65 100644 --- a/Userland/Utilities/test-crypto.cpp +++ b/Userland/Utilities/test-crypto.cpp @@ -165,9 +165,8 @@ static void tls(const char* message, size_t len) g_loop.quit(0); }; } - auto ok = write.try_append(message, len); - ok = ok && write.try_append(""\r\n"", 2); - VERIFY(ok); + MUST(write.try_append(message, len)); + MUST(write.try_append(""\r\n"", 2)); } static void aes_cbc(const char* message, size_t len) @@ -2039,7 +2038,7 @@ static void tls_test_client_hello() loop.quit(1); } else { // print_buffer(data.value(), 16); - if (!contents.try_append(data.value().data(), data.value().size())) { + if (contents.try_append(data.value().data(), data.value().size()).is_error()) { FAIL(Allocation failed); loop.quit(1); }" d38c4ac8b5438aefd97adba91c77748fb1565d68,2021-12-13 02:21:08,Jelle Raaijmakers,libgl: Add stubs for `glLightf` and `glLightfv`,False,Add stubs for `glLightf` and `glLightfv`,libgl,"diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 36646ae92a33..23f7e1bd9a58 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -429,6 +429,8 @@ GLAPI void glFogf(GLenum pname, GLfloat param); GLAPI void glFogi(GLenum pname, GLint param); GLAPI void glPixelStorei(GLenum pname, GLint param); GLAPI void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void glLightf(GLenum light, GLenum pname, GLfloat param); +GLAPI void glLightfv(GLenum light, GLenum pname, GLfloat* param); #ifdef __cplusplus } diff --git a/Userland/Libraries/LibGL/GLLights.cpp b/Userland/Libraries/LibGL/GLLights.cpp index 24fb654cfb5a..6aa9c2ab0bae 100644 --- a/Userland/Libraries/LibGL/GLLights.cpp +++ b/Userland/Libraries/LibGL/GLLights.cpp @@ -6,9 +6,22 @@ #include ""GL/gl.h"" #include ""GLContext.h"" +#include extern GL::GLContext* g_gl_context; +void glLightf(GLenum light, GLenum pname, GLfloat param) +{ + // FIXME: implement + dbgln_if(GL_DEBUG, ""glLightf({}, {}, {}): unimplemented"", light, pname, param); +} + +void glLightfv(GLenum light, GLenum pname, GLfloat* param) +{ + // FIXME: implement + dbgln_if(GL_DEBUG, ""glLightfv({}, {}, {}): unimplemented"", light, pname, param); +} + void glShadeModel(GLenum mode) { g_gl_context->gl_shade_model(mode);" c4f49e343ad3ca69f72190bd9ade49084c973822,2024-02-21 01:05:34,Aliaksandr Kalenik,libweb: Fix division by zero in `solve_replaced_size_constraint()`,False,Fix division by zero in `solve_replaced_size_constraint()`,libweb,"diff --git a/Tests/LibWeb/Layout/expected/zero-size-replaced-box-with-aspect-ratio.txt b/Tests/LibWeb/Layout/expected/zero-size-replaced-box-with-aspect-ratio.txt new file mode 100644 index 000000000000..2908f2e0ea25 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/zero-size-replaced-box-with-aspect-ratio.txt @@ -0,0 +1,13 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x16 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x0 children: not-inline + BlockContainer
      at (8,8) content-size 0x0 children: inline + frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 100x100] baseline: 100 + SVGSVGBox at (8,8) content-size 100x100 [SVG] children: not-inline + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x16] overflow: [0,0 800x108] + PaintableWithLines (BlockContainer) [8,8 784x0] overflow: [8,8 100x100] + PaintableWithLines (BlockContainer
      ) [8,8 0x0] overflow: [8,8 100x100] + SVGSVGPaintable (SVGSVGBox) [8,8 100x100] diff --git a/Tests/LibWeb/Layout/input/zero-size-replaced-box-with-aspect-ratio.html b/Tests/LibWeb/Layout/input/zero-size-replaced-box-with-aspect-ratio.html new file mode 100644 index 000000000000..7a308b1d9f5f --- /dev/null +++ b/Tests/LibWeb/Layout/input/zero-size-replaced-box-with-aspect-ratio.html @@ -0,0 +1,8 @@ + +
      diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index dc9112ad4dfb..4e8eccf0dde6 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -283,14 +283,16 @@ CSSPixelSize FormattingContext::solve_replaced_size_constraint(CSSPixels input_w if (input_width > max_width && input_height < min_height) return { max_width, min_height }; - if (input_width > max_width && input_height > max_height && max_width / input_width <= max_height / input_height) - return { max_width, max(min_height, max_width / aspect_ratio) }; - if (input_width > max_width && input_height > max_height && max_width / input_width > max_height / input_height) - return { max(min_width, max_height * aspect_ratio), max_height }; - if (input_width < min_width && input_height < min_height && min_width / input_width <= min_height / input_height) - return { min(max_width, min_height * aspect_ratio), min_height }; - if (input_width < min_width && input_height < min_height && min_width / input_width > min_height / input_height) - return { min_width, min(max_height, min_width / aspect_ratio) }; + if (input_width > 0) { + if (input_width > max_width && input_height > max_height && max_width / input_width <= max_height / input_height) + return { max_width, max(min_height, max_width / aspect_ratio) }; + if (input_width > max_width && input_height > max_height && max_width / input_width > max_height / input_height) + return { max(min_width, max_height * aspect_ratio), max_height }; + if (input_width < min_width && input_height < min_height && min_width / input_width <= min_height / input_height) + return { min(max_width, min_height * aspect_ratio), min_height }; + if (input_width < min_width && input_height < min_height && min_width / input_width > min_height / input_height) + return { min_width, min(max_height, min_width / aspect_ratio) }; + } if (input_width > max_width) return { max_width, max(max_width / aspect_ratio, min_height) };" 98183ef572298e5541b1cdabc2021c1cd24f3373,2022-01-26 02:53:09,Ali Mohammad Pur,meta: Correct the PNP ID download condition,False,Correct the PNP ID download condition,meta,"diff --git a/Meta/CMake/pnp_ids.cmake b/Meta/CMake/pnp_ids.cmake index 4ee371f8f2e1..8396006af52a 100644 --- a/Meta/CMake/pnp_ids.cmake +++ b/Meta/CMake/pnp_ids.cmake @@ -5,7 +5,7 @@ set(PNP_IDS_URL http://www.uefi.org/uefi-pnp-export) set(PNP_IDS_EXPORT_PATH ${CMAKE_BINARY_DIR}/pnp.ids.html) set(PNP_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PNP_IDS_FILE}) -if(ENABLE_PNP_IDS_DOWNLOAD AND NOT EXISTS ${PNP_IDS_PATH}) +if(ENABLE_PNP_IDS_DOWNLOAD AND NOT EXISTS ${PNP_IDS_EXPORT_PATH}) message(STATUS ""Downloading PNP ID database from ${PNP_IDS_URL}..."") file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR}) file(DOWNLOAD ${PNP_IDS_URL} ${PNP_IDS_EXPORT_PATH} INACTIVITY_TIMEOUT 10)" d5aab4204ab52423829f5b1a9c937fc3aa8a2776,2024-04-19 01:14:53,Cubic Love,base: Add manpage for Screenshot,False,Add manpage for Screenshot,base,"diff --git a/Base/usr/share/man/man1/Applications/Screenshot.md b/Base/usr/share/man/man1/Applications/Screenshot.md new file mode 100644 index 000000000000..6a5f5ac741ab --- /dev/null +++ b/Base/usr/share/man/man1/Applications/Screenshot.md @@ -0,0 +1,28 @@ +## Name + +![Icon](/res/icons/16x16/app-screenshot.png) Screenshot + +[Open](file:///bin/Screenshot) + +## Synopsis + +```**sh +$ Screenshot +``` + +## Description + +`Screenshot` is an application for taking screenshots. + +Its interface remains invisible in screenshots, ensuring a clean capture. + +## Options + +* **Whole desktop** - Capture the entire user interface, including the cursor if it's visible on the desktop. +* **Selected area** - Click and drag to select a specific area. Release the mouse button to take a screenshot. The cursor will not be included. +* **Edit in Pixel Paint** - Open the screenshot as a new image in [Pixel Paint](help://man/1/Applications/PixelPaint) for quick annotations. +* **Select Folder** - Customize the destination folder for saving screenshots. By default, they are saved in the *Pictures* folder. + +## See Also + +* [`shot`(1)](help://man/1/shot) Command line screenshot tool with more options" 47dd1b9f8b4c901ebb0f0448383632507c8c4e8f,2022-11-30 16:13:13,Timothy Flynn,libsql: Don't copy strings when searching for a column's index,False,Don't copy strings when searching for a column's index,libsql,"diff --git a/Userland/Libraries/LibSQL/Tuple.cpp b/Userland/Libraries/LibSQL/Tuple.cpp index 04fa97813f2c..c0dc6cc9e4c7 100644 --- a/Userland/Libraries/LibSQL/Tuple.cpp +++ b/Userland/Libraries/LibSQL/Tuple.cpp @@ -79,13 +79,12 @@ Tuple& Tuple::operator=(Tuple const& other) return *this; } -Optional Tuple::index_of(String name) const +Optional Tuple::index_of(StringView name) const { - auto n = move(name); for (auto ix = 0u; ix < m_descriptor->size(); ix++) { auto& part = (*m_descriptor)[ix]; - if (part.name == n) { - return (int)ix; + if (part.name == name) { + return ix; } } return {}; diff --git a/Userland/Libraries/LibSQL/Tuple.h b/Userland/Libraries/LibSQL/Tuple.h index 0488128097e8..297510f7a569 100644 --- a/Userland/Libraries/LibSQL/Tuple.h +++ b/Userland/Libraries/LibSQL/Tuple.h @@ -70,7 +70,7 @@ class Tuple { [[nodiscard]] u32 hash() const; protected: - [[nodiscard]] Optional index_of(String) const; + [[nodiscard]] Optional index_of(StringView) const; void copy_from(Tuple const&); virtual void serialize(Serializer&) const; virtual void deserialize(Serializer&);" 02c9f4c951d1a46330b4da6c276f6d95b978e090,2020-04-11 03:03:02,4ourbit,libjs: Improve Object.defineProperty test,False,Improve Object.defineProperty test,libjs,"diff --git a/Libraries/LibJS/Tests/Object.defineProperty.js b/Libraries/LibJS/Tests/Object.defineProperty.js index 0208d607b4ef..f27a2332be9a 100644 --- a/Libraries/LibJS/Tests/Object.defineProperty.js +++ b/Libraries/LibJS/Tests/Object.defineProperty.js @@ -26,6 +26,7 @@ try { try { Object.defineProperty(o, ""bar"", { value: ""xx"", enumerable: false }); + assert(false); } catch (e) { assert(e.name === ""TypeError""); }" 7a8104e79b9c8b4bb63d9ad8386ed73125ca07a5,2022-07-19 15:19:38,Lucas CHOLLET,libgui: Add MoveLineUpOrDownCommand,False,Add MoveLineUpOrDownCommand,libgui,"diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp index 5f2d6cfc0d92..028a7bb24e82 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.cpp +++ b/Userland/Libraries/LibGUI/EditingEngine.cpp @@ -259,8 +259,11 @@ EditingEngine::DidMoveALine EditingEngine::move_one_up(KeyEvent const& event) { if (m_editor->cursor().line() > 0 || m_editor->is_wrapping_enabled()) { if (event.ctrl() && event.shift()) { - move_selected_lines_up(); - return DidMoveALine::Yes; + if (MoveLineUpOrDownCommand::valid_operation(*this, VerticalDirection::Up)) { + m_editor->execute(Badge {}, event, *this); + return DidMoveALine::Yes; + } + return DidMoveALine::No; } TextPosition new_cursor; if (m_editor->is_wrapping_enabled()) { @@ -280,8 +283,11 @@ EditingEngine::DidMoveALine EditingEngine::move_one_down(KeyEvent const& event) { if (m_editor->cursor().line() < (m_editor->line_count() - 1) || m_editor->is_wrapping_enabled()) { if (event.ctrl() && event.shift()) { - move_selected_lines_down(); - return DidMoveALine::Yes; + if (MoveLineUpOrDownCommand::valid_operation(*this, VerticalDirection::Down)) { + m_editor->execute(Badge {}, event, *this); + return DidMoveALine::Yes; + } + return DidMoveALine::No; } TextPosition new_cursor; if (m_editor->is_wrapping_enabled()) { @@ -353,6 +359,11 @@ void EditingEngine::move_to_last_line() m_editor->set_cursor(m_editor->line_count() - 1, m_editor->lines()[m_editor->line_count() - 1].length()); }; +void EditingEngine::get_selection_line_boundaries(Badge, size_t& first_line, size_t& last_line) +{ + get_selection_line_boundaries(first_line, last_line); +} + void EditingEngine::get_selection_line_boundaries(size_t& first_line, size_t& last_line) { auto selection = m_editor->normalized_selection(); @@ -367,67 +378,119 @@ void EditingEngine::get_selection_line_boundaries(size_t& first_line, size_t& la last_line -= 1; } -void EditingEngine::move_selected_lines_up() +void EditingEngine::delete_char() { if (!m_editor->is_editable()) return; - size_t first_line; - size_t last_line; - get_selection_line_boundaries(first_line, last_line); + m_editor->do_delete(); +}; - if (first_line == 0) +void EditingEngine::delete_line() +{ + if (!m_editor->is_editable()) return; + m_editor->delete_current_line(); +}; - auto& lines = m_editor->document().lines(); - lines.insert((int)last_line, lines.take((int)first_line - 1)); - m_editor->set_cursor({ m_editor->cursor().line() - 1, m_editor->cursor().column() }); +MoveLineUpOrDownCommand::MoveLineUpOrDownCommand(TextDocument& document, KeyEvent event, EditingEngine& engine) + : TextDocumentUndoCommand(document) + , m_event(move(event)) + , m_direction(key_code_to_vertical_direction(m_event.key())) + , m_engine(engine) + , m_selection(m_engine.editor().selection()) + , m_cursor(m_engine.editor().cursor()) +{ +} - if (m_editor->has_selection()) { - m_editor->selection().start().set_line(m_editor->selection().start().line() - 1); - m_editor->selection().end().set_line(m_editor->selection().end().line() - 1); - } +void MoveLineUpOrDownCommand::redo() +{ + move_lines(m_direction); +} - m_editor->did_change(); - m_editor->update(); +void MoveLineUpOrDownCommand::undo() +{ + move_lines(!m_direction); } -void EditingEngine::move_selected_lines_down() +bool MoveLineUpOrDownCommand::merge_with(GUI::Command const&) { - if (!m_editor->is_editable()) - return; - size_t first_line; - size_t last_line; - get_selection_line_boundaries(first_line, last_line); + return false; +} - auto& lines = m_editor->document().lines(); - VERIFY(lines.size() != 0); - if (last_line >= lines.size() - 1) - return; +String MoveLineUpOrDownCommand::action_text() const +{ + return ""Move a line""; +} + +bool MoveLineUpOrDownCommand::valid_operation(EditingEngine& engine, VerticalDirection direction) +{ - lines.insert((int)first_line, lines.take((int)last_line + 1)); - m_editor->set_cursor({ m_editor->cursor().line() + 1, m_editor->cursor().column() }); + VERIFY(engine.editor().line_count() != 0); - if (m_editor->has_selection()) { - m_editor->selection().start().set_line(m_editor->selection().start().line() + 1); - m_editor->selection().end().set_line(m_editor->selection().end().line() + 1); - } + auto const& selection = engine.editor().selection().normalized(); + if (selection.is_valid()) { + if ((direction == VerticalDirection::Up && selection.start().line() == 0) || (direction == VerticalDirection::Down && selection.end().line() >= engine.editor().line_count() - 1)) + return false; + } else { + size_t first_line; + size_t last_line; + engine.get_selection_line_boundaries(Badge {}, first_line, last_line); - m_editor->did_change(); - m_editor->update(); + if ((direction == VerticalDirection::Up && first_line == 0) || (direction == VerticalDirection::Down && last_line >= engine.editor().line_count() - 1)) + return false; + } + return true; } -void EditingEngine::delete_char() +TextRange MoveLineUpOrDownCommand::retrieve_selection(VerticalDirection direction) { - if (!m_editor->is_editable()) - return; - m_editor->do_delete(); -}; + if (direction == m_direction) + return m_selection; -void EditingEngine::delete_line() + auto const offset_selection = [this](auto const offset) { + auto tmp = m_selection; + tmp.start().set_line(tmp.start().line() + offset); + tmp.end().set_line(tmp.end().line() + offset); + + return tmp; + }; + + if (direction == VerticalDirection::Up) + return offset_selection(1); + if (direction == VerticalDirection::Down) + return offset_selection(-1); + VERIFY_NOT_REACHED(); +} + +void MoveLineUpOrDownCommand::move_lines(VerticalDirection direction) { - if (!m_editor->is_editable()) + if (m_event.shift() && m_selection.is_valid()) { + m_engine.editor().set_selection(retrieve_selection(direction)); + m_engine.editor().did_update_selection(); + } + + if (!m_engine.editor().is_editable()) return; - m_editor->delete_current_line(); -}; + + size_t first_line; + size_t last_line; + m_engine.get_selection_line_boundaries(Badge {}, first_line, last_line); + + auto const offset = direction == VerticalDirection::Up ? -1 : 1; + auto const insertion_index = direction == VerticalDirection::Up ? last_line : first_line; + auto const moved_line_index = offset + (direction != VerticalDirection::Up ? last_line : first_line); + + auto moved_line = m_document.take_line(moved_line_index); + m_document.insert_line(insertion_index, move(moved_line)); + + m_engine.editor().set_cursor({ m_engine.editor().cursor().line() + offset, m_engine.editor().cursor().column() }); + if (m_engine.editor().has_selection()) { + m_engine.editor().selection().start().set_line(m_engine.editor().selection().start().line() + offset); + m_engine.editor().selection().end().set_line(m_engine.editor().selection().end().line() + offset); + } + + m_engine.editor().did_change(); + m_engine.editor().update(); +} } diff --git a/Userland/Libraries/LibGUI/EditingEngine.h b/Userland/Libraries/LibGUI/EditingEngine.h index 13c71a3dca4c..d6dacb1205dd 100644 --- a/Userland/Libraries/LibGUI/EditingEngine.h +++ b/Userland/Libraries/LibGUI/EditingEngine.h @@ -22,6 +22,8 @@ enum EngineType { Vim, }; +class MoveLineUpOrDownCommand; + class EditingEngine { AK_MAKE_NONCOPYABLE(EditingEngine); AK_MAKE_NONMOVABLE(EditingEngine); @@ -45,6 +47,8 @@ class EditingEngine { bool is_regular() const { return engine_type() == EngineType::Regular; } bool is_vim() const { return engine_type() == EngineType::Vim; } + void get_selection_line_boundaries(Badge, size_t& first_line, size_t& last_line); + protected: EditingEngine() = default; @@ -80,10 +84,27 @@ class EditingEngine { void delete_char(); virtual EngineType engine_type() const = 0; +}; + +class MoveLineUpOrDownCommand : public TextDocumentUndoCommand { +public: + MoveLineUpOrDownCommand(TextDocument&, KeyEvent event, EditingEngine&); + virtual void undo() override; + virtual void redo() override; + bool merge_with(GUI::Command const&) override; + String action_text() const override; + + static bool valid_operation(EditingEngine& engine, VerticalDirection direction); private: - void move_selected_lines_up(); - void move_selected_lines_down(); + void move_lines(VerticalDirection); + TextRange retrieve_selection(VerticalDirection); + + KeyEvent m_event; + VerticalDirection m_direction; + EditingEngine& m_engine; + TextRange m_selection; + TextPosition m_cursor; }; } diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index b5b8dd374f75..547ac759a39e 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -229,6 +229,12 @@ class TextEditor virtual Optional calculated_min_size() const override; + template + inline void execute(Badge, Args&&... args) + { + execute(forward(args)...); + } + protected: explicit TextEditor(Type = Type::MultiLine);" 4aff4249aa570fe33b7520d6977391f3de4944fc,2021-06-15 19:45:09,Mateusz Górzyński,pixelpaint: Alternate selection outline between black and white,False,Alternate selection outline between black and white,pixelpaint,"diff --git a/Userland/Applications/PixelPaint/Selection.cpp b/Userland/Applications/PixelPaint/Selection.cpp index 5d64a0c7093c..4316f960f9b8 100644 --- a/Userland/Applications/PixelPaint/Selection.cpp +++ b/Userland/Applications/PixelPaint/Selection.cpp @@ -22,7 +22,7 @@ Selection::Selection(ImageEditor& editor) { m_marching_ants_timer = Core::Timer::create_repeating(80, [this] { ++m_marching_ants_offset; - m_marching_ants_offset %= marching_ant_length; + m_marching_ants_offset %= (marching_ant_length * 2); if (!is_empty() || m_in_interactive_selection) m_editor.update(); }); @@ -34,8 +34,11 @@ void Selection::draw_marching_ants(Gfx::Painter& painter, Gfx::IntRect const& re int offset = m_marching_ants_offset; auto draw_pixel = [&](int x, int y) { - if ((offset % marching_ant_length) != 0) + if ((offset % (marching_ant_length * 2)) < marching_ant_length) { painter.set_pixel(x, y, Color::Black); + } else { + painter.set_pixel(x, y, Color::White); + } offset++; };" 4107ae1dea5eb4f639df26d620d7479fe177adb5,2023-04-09 16:09:31,Ben Wiederhake,ports: Remove abandoned port 'fheroes2' which was never playable,False,Remove abandoned port 'fheroes2' which was never playable,ports,"diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 059e35bd406e..b82f1b15e1f2 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -61,7 +61,6 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`epsilon`](epsilon/) | graphical calculator simulator | 15.5.0 | https://github.com/numworks/epsilon | | [`expat`](expat/) | Expat XML parser | 2.5.0 | https://libexpat.github.io/ | | [`ffmpeg`](ffmpeg/) | ffmpeg | 5.0 | https://ffmpeg.org | -| [`fheroes2`](fheroes2/) | Free Heroes of Might and Magic II | 0.9.13 | https://github.com/ihhub/fheroes2 | | [`figlet`](figlet/) | FIGlet | 2.2.5 | http://www.figlet.org/ | | [`file`](file/) | file (determine file type) | 5.44 | https://www.darwinsys.com/file/ | | [`findutils`](findutils/) | GNU findutils | 4.9.0 | https://www.gnu.org/software/findutils/ | diff --git a/Ports/fheroes2/package.sh b/Ports/fheroes2/package.sh deleted file mode 100755 index 147b145954c2..000000000000 --- a/Ports/fheroes2/package.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env -S bash ../.port_include.sh -port=fheroes2 -useconfigure=true -version=0.9.13 -depends=(""SDL2"" ""SDL2_image"" ""SDL2_mixer"" ""libpng"" ""zlib"") -configopts=(""-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt"" ""-DUSE_SDL_VERSION=SDL2"" ""-DENABLE_IMAGE=ON"" ""-DGET_HOMM2_DEMO=ON"") -files=""https://github.com/ihhub/fheroes2/archive/refs/tags/${version}.zip fheroes2-${version}.zip 879805bc88c3561d0eedc3dda425e8d9a3c7ae8a80b9f6909797acc72598cc17"" -auth_type=sha256 -launcher_name=""Free Heroes of Might and Magic II"" -launcher_category=Games -launcher_command=/opt/fheroes2/fheroes2 -icon_file=src/resources/fheroes2.ico - -pre_configure() { - export CXXFLAGS=""'-D_GNU_SOURCE'"" -} - -configure() { - run cmake ""${configopts[@]}"" . -} - -post_configure() { - unset CXXFLAGS -} - -install() { - mkdir -p ""${SERENITY_INSTALL_ROOT}/opt/fheroes2/files"" - run cp -r data/ maps/ fheroes2 fheroes2.key ""${SERENITY_INSTALL_ROOT}/opt/fheroes2"" - run cp -r files/data ""${SERENITY_INSTALL_ROOT}/opt/fheroes2/files"" -} diff --git a/Ports/fheroes2/patches/0001-Include-endian.h-on-serenity-as-well.patch b/Ports/fheroes2/patches/0001-Include-endian.h-on-serenity-as-well.patch deleted file mode 100644 index 18326ee2016d..000000000000 --- a/Ports/fheroes2/patches/0001-Include-endian.h-on-serenity-as-well.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Manganiello -Date: Sun, 27 Mar 2022 12:52:11 -0300 -Subject: [PATCH] Include on serenity as well - ---- - src/engine/endian_h2.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/engine/endian_h2.h b/src/engine/endian_h2.h -index 7d1fa27..9144a91 100644 ---- a/src/engine/endian_h2.h -+++ b/src/engine/endian_h2.h -@@ -21,7 +21,7 @@ - #ifndef ENDIAN_H2_H - #define ENDIAN_H2_H - --#if defined( __linux__ ) -+#if defined( __linux__ ) || defined( __serenity__ ) - #include - - #elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) diff --git a/Ports/fheroes2/patches/0002-Use-pkg-config-for-SDL_-and-SDL2.patch b/Ports/fheroes2/patches/0002-Use-pkg-config-for-SDL_-and-SDL2.patch deleted file mode 100644 index 0915ed622126..000000000000 --- a/Ports/fheroes2/patches/0002-Use-pkg-config-for-SDL_-and-SDL2.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Manganiello -Date: Sun, 27 Mar 2022 12:52:11 -0300 -Subject: [PATCH] Use pkg-config for SDL_* and SDL2 - ---- - CMakeLists.txt | 9 ++++++--- - src/engine/CMakeLists.txt | 12 +++++++----- - 2 files changed, 13 insertions(+), 8 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8728264..ebed16e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -26,13 +26,16 @@ option(FHEROES2_STRICT_COMPILATION ""Enable -Werror strict compilation"" OFF) - # - # Library & feature detection - # --find_package(${USE_SDL_VERSION} REQUIRED) --find_package(${USE_SDL_VERSION}_mixer REQUIRED) -+INCLUDE(FindPkgConfig) -+ -+PKG_SEARCH_MODULE(${USE_SDL_VERSION} REQUIRED sdl2) -+PKG_SEARCH_MODULE(${USE_SDL_VERSION}MIXER REQUIRED SDL2_mixer) -+ - find_package(ZLIB REQUIRED) - find_package(Threads) - - if(ENABLE_IMAGE) -- find_package(${USE_SDL_VERSION}_image REQUIRED) -+ PKG_SEARCH_MODULE(${USE_SDL_VERSION}IMAGE REQUIRED SDL2_image) - find_package(PNG REQUIRED) - endif(ENABLE_IMAGE) - -diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt -index 8a1fbeb..b9df312 100644 ---- a/src/engine/CMakeLists.txt -+++ b/src/engine/CMakeLists.txt -@@ -5,19 +5,21 @@ target_compile_definitions(engine PRIVATE - $<$:FHEROES2_IMAGE_SUPPORT> - ) - target_include_directories(engine PUBLIC -- $<$:${${USE_SDL_VERSION}_IMAGE_INCLUDE_DIR}> -- ${${USE_SDL_VERSION}_MIXER_INCLUDE_DIR} -- ${${USE_SDL_VERSION}_INCLUDE_DIR} -+ $<$:${${USE_SDL_VERSION}_IMAGE_INCLUDE_DIRS}> -+ ${${USE_SDL_VERSION}_MIXER_INCLUDE_DIRS} -+ ${${USE_SDL_VERSION}_INCLUDE_DIRS} - $ - $ - ) - target_link_libraries(engine - smacker -- ${${USE_SDL_VERSION}MAIN_LIBRARY} -- ${${USE_SDL_VERSION}_LIBRARY} -+ ${${USE_SDL_VERSION}MAIN_LIBRARIES} -+ ${${USE_SDL_VERSION}_LIBRARIES} - ${${USE_SDL_VERSION}_MIXER_LIBRARIES} - $<$:${${USE_SDL_VERSION}_IMAGE_LIBRARIES}> - $<$:PNG::PNG> -+ $<$:-lSDL2_image> -+ -lSDL2_mixer - Threads::Threads # To match the build settings of the main app - ZLIB::ZLIB - ) diff --git a/Ports/fheroes2/patches/0003-Disable-SDL-s-accelerated-rendering.patch b/Ports/fheroes2/patches/0003-Disable-SDL-s-accelerated-rendering.patch deleted file mode 100644 index 017f43348512..000000000000 --- a/Ports/fheroes2/patches/0003-Disable-SDL-s-accelerated-rendering.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Michael Manganiello -Date: Sun, 27 Mar 2022 12:52:11 -0300 -Subject: [PATCH] Disable SDL's accelerated rendering - ---- - src/engine/screen.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/engine/screen.cpp b/src/engine/screen.cpp -index 9cd9ccb..f4fe315 100644 ---- a/src/engine/screen.cpp -+++ b/src/engine/screen.cpp -@@ -1005,10 +1005,10 @@ namespace - int renderFlags() const - { - if ( _isVSyncEnabled ) { -- return ( SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC ); -+ return ( SDL_RENDERER_SOFTWARE | SDL_RENDERER_PRESENTVSYNC ); - } - -- return SDL_RENDERER_ACCELERATED; -+ return SDL_RENDERER_SOFTWARE; - } - - void _createPalette() diff --git a/Ports/fheroes2/patches/ReadMe.md b/Ports/fheroes2/patches/ReadMe.md deleted file mode 100644 index f40b266b8dfe..000000000000 --- a/Ports/fheroes2/patches/ReadMe.md +++ /dev/null @@ -1,17 +0,0 @@ -# Patches for fheroes2 on SerenityOS - -## `0001-Include-endian.h-on-serenity-as-well.patch` - -Include on serenity as well - - -## `0002-Use-pkg-config-for-SDL_-and-SDL2.patch` - -Use pkg-config for SDL_* and SDL2 - - -## `0003-Disable-SDL-s-accelerated-rendering.patch` - -Disable SDL's accelerated rendering - -" 8e00fba71d4a924c65113c24d07e95fa38ae7919,2024-05-15 03:31:18,MacDue,libweb: Correct naming in `SVGPathPaintable`,False,Correct naming in `SVGPathPaintable`,libweb,"diff --git a/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp index cffb7561fde0..12a61c9e6a10 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp @@ -60,7 +60,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const if (phase != PaintPhase::Foreground) return; - auto& geometry_element = layout_box().dom_node(); + auto& graphics_element = layout_box().dom_node(); auto const* svg_node = layout_box().first_ancestor_of_type(); auto svg_element_rect = svg_node->paintable_box()->absolute_rect(); @@ -114,9 +114,9 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const .transform = paint_transform }; - auto fill_opacity = geometry_element.fill_opacity().value_or(1); - auto winding_rule = to_gfx_winding_rule(geometry_element.fill_rule().value_or(SVG::FillRule::Nonzero)); - if (auto paint_style = geometry_element.fill_paint_style(paint_context); paint_style.has_value()) { + auto fill_opacity = graphics_element.fill_opacity().value_or(1); + auto winding_rule = to_gfx_winding_rule(graphics_element.fill_rule().value_or(SVG::FillRule::Nonzero)); + if (auto paint_style = graphics_element.fill_paint_style(paint_context); paint_style.has_value()) { context.recording_painter().fill_path({ .path = closed_path(), .paint_style = *paint_style, @@ -124,7 +124,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const .opacity = fill_opacity, .translation = offset, }); - } else if (auto fill_color = geometry_element.fill_color(); fill_color.has_value()) { + } else if (auto fill_color = graphics_element.fill_color(); fill_color.has_value()) { context.recording_painter().fill_path({ .path = closed_path(), .color = fill_color->with_opacity(fill_opacity), @@ -133,12 +133,12 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const }); } - auto stroke_opacity = geometry_element.stroke_opacity().value_or(1); + auto stroke_opacity = graphics_element.stroke_opacity().value_or(1); // Note: This is assuming .x_scale() == .y_scale() (which it does currently). - float stroke_thickness = geometry_element.stroke_width().value_or(1) * viewbox_scale; + float stroke_thickness = graphics_element.stroke_width().value_or(1) * viewbox_scale; - if (auto paint_style = geometry_element.stroke_paint_style(paint_context); paint_style.has_value()) { + if (auto paint_style = graphics_element.stroke_paint_style(paint_context); paint_style.has_value()) { context.recording_painter().stroke_path({ .path = path, .paint_style = *paint_style, @@ -146,7 +146,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const .opacity = stroke_opacity, .translation = offset, }); - } else if (auto stroke_color = geometry_element.stroke_color(); stroke_color.has_value()) { + } else if (auto stroke_color = graphics_element.stroke_color(); stroke_color.has_value()) { context.recording_painter().stroke_path({ .path = path, .color = stroke_color->with_opacity(stroke_opacity)," ac23b806a2460f8f7fdf054a05e7f3195ba40e83,2022-09-03 21:27:37,kleines Filmröllchen,libgfx: Make Color::set_alpha constexpr,False,Make Color::set_alpha constexpr,libgfx,"diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index 7e4507107caa..536a0f7aece6 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -134,7 +134,7 @@ class Color { constexpr u8 blue() const { return m_value & 0xff; } constexpr u8 alpha() const { return (m_value >> 24) & 0xff; } - void set_alpha(u8 value) + constexpr void set_alpha(u8 value) { m_value &= 0x00ffffff; m_value |= value << 24;" 1c584e9d801632f28b43da490656a8123b549f50,2021-07-10 23:58:24,Ali Mohammad Pur,libregex: Correctly parse BRE bracket expressions,False,Correctly parse BRE bracket expressions,libregex,"diff --git a/Tests/LibRegex/RegexLibC.cpp b/Tests/LibRegex/RegexLibC.cpp index e922e4525e7b..04794dbc08b5 100644 --- a/Tests/LibRegex/RegexLibC.cpp +++ b/Tests/LibRegex/RegexLibC.cpp @@ -1149,4 +1149,10 @@ TEST_CASE(bre_basic) EXPECT_EQ(regcomp(®ex, ""15{1,2}"", REG_NOSUB | REG_ICASE), REG_NOERR); EXPECT_EQ(regexec(®ex, ""15{1,2}"", 0, NULL, 0), REG_NOERR); regfree(®ex); + + EXPECT_EQ(regcomp(®ex, ""1[56]"", REG_NOSUB | REG_ICASE), REG_NOERR); + EXPECT_EQ(regexec(®ex, ""15"", 0, NULL, 0), REG_NOERR); + EXPECT_EQ(regexec(®ex, ""16"", 0, NULL, 0), REG_NOERR); + EXPECT_EQ(regexec(®ex, ""17"", 0, NULL, 0), REG_NOMATCH); + regfree(®ex); } diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index d794721d9477..814759de4e82 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -481,12 +481,20 @@ bool PosixBasicParser::parse_one_char_or_collation_element(ByteCode& bytecode, s Vector values; size_t bracket_minimum_length = 0; - if (!AbstractPosixParser::parse_bracket_expression(values, bracket_minimum_length)) - return false; - bytecode.insert_bytecode_compare_values(move(values)); - match_length_minimum += bracket_minimum_length; - return !has_error(); + if (match(TokenType::LeftBracket)) { + consume(); + if (!AbstractPosixParser::parse_bracket_expression(values, bracket_minimum_length)) + return false; + + consume(TokenType::RightBracket, Error::MismatchingBracket); + + bytecode.insert_bytecode_compare_values(move(values)); + match_length_minimum += bracket_minimum_length; + return !has_error(); + } + + return set_error(Error::InvalidPattern); } // =============================" a527f5576861f9b1f82069ca5a5fa87f3e133c2d,2023-09-13 01:44:39,Andrew Kaster,libweb: Create StructuredSerialize helpers for Bytes,False,Create StructuredSerialize helpers for Bytes,libweb,"diff --git a/Userland/Libraries/LibWeb/HTML/StructuredSerialize.cpp b/Userland/Libraries/LibWeb/HTML/StructuredSerialize.cpp index 96bb3b60e0b4..0f8525492b69 100644 --- a/Userland/Libraries/LibWeb/HTML/StructuredSerialize.cpp +++ b/Userland/Libraries/LibWeb/HTML/StructuredSerialize.cpp @@ -206,14 +206,13 @@ class Serializer { SerializationMemory& m_memory; // JS value -> index SerializationRecord m_serialized; - WebIDL::ExceptionOr serialize_string(Vector& vector, String const& string) + WebIDL::ExceptionOr serialize_bytes(Vector& vector, ReadonlyBytes bytes) { - u64 const size = string.code_points().byte_length(); - // Append size of the string to the serialized structure. + // Append size of the buffer to the serialized structure. + u64 const size = bytes.size(); TRY_OR_THROW_OOM(m_vm, vector.try_append(bit_cast(&size), 2)); - // Append the bytes of the string to the serialized structure. + // Append the bytes of the buffer to the serialized structure. u64 byte_position = 0; - ReadonlyBytes const bytes = { string.code_points().bytes(), string.code_points().byte_length() }; while (byte_position < size) { u32 combined_value = 0; for (u8 i = 0; i < 4; ++i) { @@ -228,6 +227,11 @@ class Serializer { return {}; } + WebIDL::ExceptionOr serialize_string(Vector& vector, String const& string) + { + return serialize_bytes(vector, { string.code_points().bytes(), string.code_points().byte_length() }); + } + WebIDL::ExceptionOr serialize_string(Vector& vector, JS::PrimitiveString const& primitive_string) { auto string = primitive_string.utf8_string(); @@ -344,25 +348,29 @@ class Deserializer { JS::MarkedVector m_memory; // Index -> JS value Optional m_error; - static WebIDL::ExceptionOr> deserialize_string_primitive(JS::VM& vm, Vector const& vector, u32& position) + static WebIDL::ExceptionOr deserialize_bytes(JS::VM& vm, Vector const& vector, u32& position) { u32 size_bits[2]; size_bits[0] = vector[position++]; size_bits[1] = vector[position++]; u64 const size = *bit_cast(&size_bits); - Vector bytes; - TRY_OR_THROW_OOM(vm, bytes.try_ensure_capacity(size)); + auto bytes = TRY_OR_THROW_OOM(vm, ByteBuffer::create_uninitialized(size)); u64 byte_position = 0; while (position < vector.size() && byte_position < size) { for (u8 i = 0; i < 4; ++i) { - bytes.append(vector[position] >> (i * 8) & 0xFF); - byte_position++; + bytes[byte_position++] = (vector[position] >> (i * 8) & 0xFF); if (byte_position == size) break; } position++; } + return bytes; + } + + static WebIDL::ExceptionOr> deserialize_string_primitive(JS::VM& vm, Vector const& vector, u32& position) + { + auto bytes = TRY(deserialize_bytes(vm, vector, position)); return TRY(Bindings::throw_dom_exception_if_needed(vm, [&vm, &bytes]() { return JS::PrimitiveString::create(vm, StringView { bytes });" 228276a383e9fb76ce94181e3add6679a9a073e4,2024-11-27 15:29:48,devgianlu,libweb: Implement ECDH.importKey,False,Implement ECDH.importKey,libweb,"diff --git a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp index 822f048b3780..d31a30f6d2d2 100644 --- a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp +++ b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp @@ -2740,6 +2740,427 @@ WebIDL::ExceptionOr> ECDH::derive_bits(AlgorithmParams auto slice = TRY_OR_THROW_OOM(realm.vm(), secret.slice(0, length / 8)); return JS::ArrayBuffer::create(realm, move(slice)); } + +// https://w3c.github.io/webcrypto/#ecdh-operations +WebIDL::ExceptionOr> ECDH::import_key(AlgorithmParams const& params, Bindings::KeyFormat key_format, CryptoKey::InternalKeyData key_data, bool extractable, Vector const& usages) +{ + // NOTE: This is a parameter to the function + // 1. Let keyData be the key data to be imported. + + auto const& normalized_algorithm = static_cast(params); + + GC::Ptr key = nullptr; + + // 2. If format is ""spki"": + if (key_format == Bindings::KeyFormat::Spki) { + // 1. If usages is not empty then throw a SyntaxError. + if (!usages.is_empty()) + return WebIDL::SyntaxError::create(m_realm, ""Usages must be empty""_string); + + // 2. Let spki be the result of running the parse a subjectPublicKeyInfo algorithm over keyData. + // 3. If an error occurred while parsing, then throw a DataError. + auto spki = TRY(parse_a_subject_public_key_info(m_realm, key_data.get())); + + // 4. If the algorithm object identifier field of the algorithm AlgorithmIdentifier field of spki + // is not equal to the id-ecPublicKey object identifier defined in [RFC5480], then throw a DataError. + if (spki.algorithm.identifier != ::Crypto::Certificate::ec_public_key_encryption_oid) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // 5. If the parameters field of the algorithm AlgorithmIdentifier field of spki is absent, then throw a DataError. + if (!spki.algorithm.ec_parameters.has_value()) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm parameters""_string); + + // 6. Let params be the parameters field of the algorithm AlgorithmIdentifier field of spki. + auto ec_params = spki.algorithm.ec_parameters; + + // 7. If params is not an instance of the ECParameters ASN.1 type defined in [RFC5480] that specifies a namedCurve, then throw a DataError. + // 8. Let namedCurve be a string whose initial value is undefined. + String named_curve; + + // 9. If params is equivalent to the secp256r1 object identifier defined in [RFC5480]: + if (ec_params == ::Crypto::Certificate::secp256r1_oid) { + // Set namedCurve to ""P-256"". + named_curve = ""P-256""_string; + } + // If params is equivalent to the secp384r1 object identifier defined in [RFC5480]: + else if (ec_params == ::Crypto::Certificate::secp384r1_oid) { + // Set namedCurve to ""P-384"". + named_curve = ""P-384""_string; + } + // If params is equivalent to the secp521r1 object identifier defined in [RFC5480]: + else if (ec_params == ::Crypto::Certificate::secp521r1_oid) { + // Set namedCurve to ""P-521"". + named_curve = ""P-521""_string; + } + + // 10. If namedCurve is not undefined + if (!named_curve.is_empty()) { + // 1. Let publicKey be the Elliptic Curve public key identified by performing + // the conversion steps defined in Section 2.3.4 of [SEC1] to the subjectPublicKey field of spki. + // The uncompressed point format MUST be supported. + // 2. If the implementation does not support the compressed point format and a compressed point is provided, throw a DataError. + if (spki.raw_key[0] != 0x04) + return WebIDL::DataError::create(m_realm, ""Unsupported key format""_string); + + // 3. If a decode error occurs or an identity point is found, throw a DataError. + size_t coord_size; + if (named_curve == ""P-256""sv) + coord_size = 32; + else if (named_curve == ""P-384""sv) + coord_size = 48; + else if (named_curve == ""P-521""sv) + coord_size = 66; + else + VERIFY_NOT_REACHED(); + + // 4. Let key be a new CryptoKey that represents publicKey. + auto public_key = ::Crypto::PK::ECPublicKey<> { + ::Crypto::UnsignedBigInteger::import_data(spki.raw_key.data() + 1, coord_size), + ::Crypto::UnsignedBigInteger::import_data(spki.raw_key.data() + 1 + coord_size, coord_size) + }; + key = CryptoKey::create(m_realm, CryptoKey::InternalKeyData { public_key }); + } else { + // Otherwise: + // 1. Perform any key import steps defined by other applicable specifications, passing format, spki and obtaining namedCurve and key. + // TODO: support 'applicable specifications' + + // 2. If an error occurred or there are no applicable specifications, throw a DataError. + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + } + + // 11. If namedCurve is defined, and not equal to the namedCurve member of normalizedAlgorithm, throw a DataError. + if (!named_curve.is_empty() && named_curve != normalized_algorithm.named_curve) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // TODO: 12. If the key value is not a valid point on the Elliptic Curve identified + // by the namedCurve member of normalizedAlgorithm throw a DataError. + + // 13. Set the [[type]] internal slot of key to ""public"" + key->set_type(Bindings::KeyType::Public); + + // 14. Let algorithm be a new EcKeyAlgorithm. + auto algorithm = EcKeyAlgorithm::create(m_realm); + + // 15. Set the name attribute of algorithm to ""ECDH"". + algorithm->set_name(""ECDH""_string); + + // 16. Set the namedCurve attribute of algorithm to namedCurve. + algorithm->set_named_curve(named_curve); + + // 17. Set the [[algorithm]] internal slot of key to algorithm. + key->set_algorithm(algorithm); + } + + // 2. If format is ""pkcs8"": + else if (key_format == Bindings::KeyFormat::Pkcs8) { + // 1. If usages contains an entry which is not ""deriveKey"" or ""deriveBits"" then throw a SyntaxError. + for (auto const& usage : usages) { + if (usage != Bindings::KeyUsage::Derivekey && usage != Bindings::KeyUsage::Derivebits) { + return WebIDL::SyntaxError::create(m_realm, MUST(String::formatted(""Invalid key usage '{}'"", idl_enum_to_string(usage)))); + } + } + + // 2. Let privateKeyInfo be the result of running the parse a privateKeyInfo algorithm over keyData. + // 3. If an error occurred while parsing, then throw a DataError. + auto private_key_info = TRY(parse_a_private_key_info(m_realm, key_data.get())); + + // 4. If the algorithm object identifier field of the privateKeyAlgorithm PrivateKeyAlgorithm field of privateKeyInfo + // is not equal to the id-ecPublicKey object identifier defined in [RFC5480], then throw a DataError. + if (private_key_info.algorithm.identifier != ::Crypto::Certificate::ec_public_key_encryption_oid) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // 5. If the parameters field of the privateKeyAlgorithm PrivateKeyAlgorithmIdentifier field + // of privateKeyInfo is not present, then throw a DataError. + if (!private_key_info.algorithm.ec_parameters.has_value()) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm parameters""_string); + + // 6. Let params be the parameters field of the privateKeyAlgorithm PrivateKeyAlgorithmIdentifier field of privateKeyInfo. + auto ec_params = private_key_info.algorithm.ec_parameters; + + // 7. If params is not an instance of the ECParameters ASN.1 type defined in [RFC5480] that specifies a namedCurve, then throw a DataError. + // 8. Let namedCurve be a string whose initial value is undefined. + String named_curve; + + // 9. If params is equivalent to the secp256r1 object identifier defined in [RFC5480]: + if (ec_params == ::Crypto::Certificate::secp256r1_oid) { + // Set namedCurve to ""P-256"". + named_curve = ""P-256""_string; + } + // If params is equivalent to the secp384r1 object identifier defined in [RFC5480]: + else if (ec_params == ::Crypto::Certificate::secp384r1_oid) { + // Set namedCurve to ""P-384"". + named_curve = ""P-384""_string; + } + // If params is equivalent to the secp521r1 object identifier defined in [RFC5480]: + else if (ec_params == ::Crypto::Certificate::secp521r1_oid) { + // Set namedCurve to ""P-521"". + named_curve = ""P-521""_string; + } + + // 10. If namedCurve is not undefined + if (!named_curve.is_empty()) { + // 1. Let ecPrivateKey be the result of performing the parse an ASN.1 structure algorithm, + // with data as the privateKey field of privateKeyInfo, structure as the ASN.1 ECPrivateKey + // structure specified in Section 3 of [RFC5915], and exactData set to true. + // NOTE: We already did this in parse_a_private_key_info + // 2. If an error occurred while parsing, then throw a DataError. + auto& ec_private_key = private_key_info.ec; + + // 3. If the parameters field of ecPrivateKey is present, and is not an instance + // of the namedCurve ASN.1 type defined in [RFC5480], or does not contain + // the same object identifier as the parameters field of the privateKeyAlgorithm + // PrivateKeyAlgorithmIdentifier field of privateKeyInfo, throw a DataError. + if (ec_private_key.parameters().has_value() && *ec_private_key.parameters() != ec_params.value_or({})) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm parameters""_string); + + // 4. Let key be a new CryptoKey that represents the Elliptic Curve private key identified + // by performing the conversion steps defined in Section 3 of [RFC5915] using ecPrivateKey. + key = CryptoKey::create(m_realm, CryptoKey::InternalKeyData { ec_private_key }); + } else { + // Otherwise: + // 1. Perform any key import steps defined by other applicable specifications, passing format, spki and obtaining namedCurve and key. + // TODO: support 'applicable specifications' + + // 2. If an error occurred or there are no applicable specifications, throw a DataError. + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + } + + // 11. If namedCurve is defined, and not equal to the namedCurve member of normalizedAlgorithm, throw a DataError. + if (!named_curve.is_empty() && named_curve != normalized_algorithm.named_curve) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // TODO: 12. If the key value is not a valid point on the Elliptic Curve identified + // by the namedCurve member of normalizedAlgorithm throw a DataError. + + // 13. Set the [[type]] internal slot of key to ""private"". + key->set_type(Bindings::KeyType::Private); + + // 14. Let algorithm be a new EcKeyAlgorithm. + auto algorithm = EcKeyAlgorithm::create(m_realm); + + // 15. Set the name attribute of algorithm to ""ECDH"". + algorithm->set_name(""ECDH""_string); + + // 16. Set the namedCurve attribute of algorithm to namedCurve. + algorithm->set_named_curve(named_curve); + + // 17. Set the [[algorithm]] internal slot of key to algorithm. + key->set_algorithm(algorithm); + } + + // 2. If format is ""jwk"": + else if (key_format == Bindings::KeyFormat::Jwk) { + // 1. If keyData is a JsonWebKey dictionary: Let jwk equal keyData. + // Otherwise: Throw a DataError. + if (!key_data.has()) + return WebIDL::DataError::create(m_realm, ""keyData is not a JsonWebKey dictionary""_string); + auto& jwk = key_data.get(); + + // 2. If the d field is present and if usages contains an entry which is not ""deriveKey"" or ""deriveBits"" then throw a SyntaxError. + if (jwk.d.has_value() && !usages.is_empty()) { + for (auto const& usage : usages) { + if (usage != Bindings::KeyUsage::Derivekey && usage != Bindings::KeyUsage::Derivebits) { + return WebIDL::SyntaxError::create(m_realm, MUST(String::formatted(""Invalid key usage '{}'"", idl_enum_to_string(usage)))); + } + } + } + + // 3. If the d field is not present and if usages is not empty then throw a SyntaxError. + if (!jwk.d.has_value() && !usages.is_empty()) + return WebIDL::SyntaxError::create(m_realm, ""Usages must be empty""_string); + + // 4. If the kty field of jwk is not ""EC"", then throw a DataError. + if (jwk.kty != ""EC""sv) + return WebIDL::DataError::create(m_realm, ""Invalid key type""_string); + + // 5. If usages is non-empty and the use field of jwk is present and is not equal to ""enc"" then throw a DataError. + if (!usages.is_empty() && jwk.use.has_value() && *jwk.use != ""enc""sv) + return WebIDL::DataError::create(m_realm, ""Invalid key use""_string); + + // 6. If the key_ops field of jwk is present, and is invalid according to the requirements of JSON Web Key [JWK], + // or it does not contain all of the specified usages values, then throw a DataError. + TRY(validate_jwk_key_ops(m_realm, jwk, usages)); + + // 7. If the ext field of jwk is present and has the value false and extractable is true, then throw a DataError. + if (jwk.ext.has_value() && !*jwk.ext && extractable) + return WebIDL::DataError::create(m_realm, ""Invalid extractable""_string); + + // 8. Let namedCurve be a string whose value is equal to the crv field of jwk. + // NOTE: The spec does not say what to do if crv is missing. + if (!jwk.crv.has_value()) + return WebIDL::DataError::create(m_realm, ""Invalid key crv""_string); + auto named_curve = *jwk.crv; + + // 9. If namedCurve is not equal to the namedCurve member of normalizedAlgorithm, throw a DataError. + if (named_curve != normalized_algorithm.named_curve) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // 10. If namedCurve is ""P-256"", ""P-384"" or ""P-521"": + if (named_curve.is_one_of(""P-256""sv, ""P-384""sv, ""P-521""sv)) { + size_t coord_size; + if (named_curve == ""P-256""sv) + coord_size = 32; + else if (named_curve == ""P-384""sv) + coord_size = 48; + else if (named_curve == ""P-521""sv) + coord_size = 66; + else + VERIFY_NOT_REACHED(); + + // NOTE: according to Section 6.2.1 and 6.2.2 of JSON Web Algorithms [JWA], x and y are always required + if (!jwk.x.has_value() || !jwk.y.has_value()) + return WebIDL::DataError::create(m_realm, ""Invalid key""_string); + + auto maybe_x_bytes = decode_base64url(jwk.x.value()); + if (maybe_x_bytes.is_error()) { + return WebIDL::DataError::create(m_realm, ""Failed to decode base64""_string); + } + auto x_bytes = maybe_x_bytes.release_value(); + if (x_bytes.size() != coord_size) + return WebIDL::DataError::create(m_realm, ""Invalid key size""_string); + + auto maybe_y_bytes = decode_base64url(jwk.y.value()); + if (maybe_y_bytes.is_error()) { + return WebIDL::DataError::create(m_realm, ""Failed to decode base64""_string); + } + auto y_bytes = maybe_y_bytes.release_value(); + if (y_bytes.size() != coord_size) + return WebIDL::DataError::create(m_realm, ""Invalid key size""_string); + + auto public_key = ::Crypto::PK::ECPublicKey<> { + ::Crypto::UnsignedBigInteger::import_data(x_bytes), + ::Crypto::UnsignedBigInteger::import_data(y_bytes), + }; + + // If the d field is present: + if (jwk.d.has_value()) { + // 1. If jwk does not meet the requirements of Section 6.2.2 of JSON Web Algorithms [JWA], then throw a DataError. + auto maybe_d_bytes = decode_base64url(jwk.d.value()); + if (maybe_d_bytes.is_error()) { + return WebIDL::DataError::create(m_realm, ""Failed to decode base64""_string); + } + auto d_bytes = maybe_d_bytes.release_value(); + if (d_bytes.size() != coord_size) + return WebIDL::DataError::create(m_realm, ""Invalid key size""_string); + + // 2. Let key be a new CryptoKey object that represents the Elliptic Curve private key identified + // by interpreting jwk according to Section 6.2.2 of JSON Web Algorithms [JWA]. + auto private_key = ::Crypto::PK::ECPrivateKey<> { + ::Crypto::UnsignedBigInteger::import_data(d_bytes), + {}, + public_key, + }; + key = CryptoKey::create(m_realm, CryptoKey::InternalKeyData { private_key }); + + // 3. Set the [[type]] internal slot of Key to ""private"". + key->set_type(Bindings::KeyType::Private); + } else { + // Otherwise: + // 1. If jwk does not meet the requirements of Section 6.2.1 of JSON Web Algorithms [JWA], then throw a DataError. + // 2. Let key be a new CryptoKey object that represents the Elliptic Curve public key identified by interpreting + // jwk according to Section 6.2.1 of JSON Web Algorithms [JWA]. + key = CryptoKey::create(m_realm, CryptoKey::InternalKeyData { public_key }); + + // 3. Set the [[type]] internal slot of Key to ""public"". + key->set_type(Bindings::KeyType::Public); + } + } else { + // 1. Perform any key import steps defined by other applicable specifications, passing format, jwk and obtaining key. + // TODO: support 'applicable specifications' + + // 2. If an error occurred or there are no applicable specifications, throw a DataError. + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + } + + // TODO: 11. If the key value is not a valid point on the Elliptic Curve identified + // by the namedCurve member of normalizedAlgorithm throw a DataError. + + // 12. Let algorithm be a new instance of an EcKeyAlgorithm object. + auto algorithm = EcKeyAlgorithm::create(m_realm); + + // 13. Set the name attribute of algorithm to ""ECDH"". + algorithm->set_name(""ECDH""_string); + + // 14. Set the namedCurve attribute of algorithm to namedCurve. + algorithm->set_named_curve(named_curve); + + // 15. Set the [[algorithm]] internal slot of key to algorithm. + key->set_algorithm(algorithm); + } + + // 2. If format is ""raw"": + else if (key_format == Bindings::KeyFormat::Raw) { + // 1. If the namedCurve member of normalizedAlgorithm is not a named curve, then throw a DataError. + if (!normalized_algorithm.named_curve.is_one_of(""P-256""sv, ""P-384""sv, ""P-521""sv)) + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + + // 2. If usages is not the empty list, then throw a SyntaxError. + if (!usages.is_empty()) + return WebIDL::SyntaxError::create(m_realm, ""Usages must be empty""_string); + + // 3. If namedCurve is ""P-256"", ""P-384"" or ""P-521"": + if (normalized_algorithm.named_curve.is_one_of(""P-256""sv, ""P-384""sv, ""P-521""sv)) { + auto key_bytes = key_data.get(); + + size_t coord_size; + if (normalized_algorithm.named_curve == ""P-256""sv) + coord_size = 32; + else if (normalized_algorithm.named_curve == ""P-384""sv) + coord_size = 48; + else if (normalized_algorithm.named_curve == ""P-521""sv) + coord_size = 66; + else + VERIFY_NOT_REACHED(); + + if (key_bytes.size() != 1 + 2 * coord_size) + return WebIDL::DataError::create(m_realm, ""Invalid key size""_string); + + // 1. Let Q be the Elliptic Curve public key on the curve identified by the namedCurve + // member of normalizedAlgorithm identified by performing the conversion steps + // defined in Section 2.3.4 of [SEC1] to keyData. + // The uncompressed point format MUST be supported. + + // 2. If the implementation does not support the compressed point format and a compressed point is provided, throw a DataError. + if (key_bytes[0] != 0x04) + return WebIDL::DataError::create(m_realm, ""Unsupported key format""_string); + + // 3. If a decode error occurs or an identity point is found, throw a DataError. + // 4. Let key be a new CryptoKey that represents Q. + auto public_key = ::Crypto::PK::ECPublicKey<> { + ::Crypto::UnsignedBigInteger::import_data(key_bytes.data() + 1, coord_size), + ::Crypto::UnsignedBigInteger::import_data(key_bytes.data() + 1 + coord_size, coord_size) + }; + + key = CryptoKey::create(m_realm, CryptoKey::InternalKeyData { public_key }); + } else { + // Otherwise: + // 1. Perform any key import steps defined by other applicable specifications, passing format, keyData and obtaining key. + // TODO: support 'applicable specifications' + + // 2. If an error occured or there are no applicable specifications, throw a DataError. + return WebIDL::DataError::create(m_realm, ""Invalid algorithm""_string); + } + + // 4. Let algorithm be a new EcKeyAlgorithm object. + auto algorithm = EcKeyAlgorithm::create(m_realm); + + // 5. Set the name attribute of algorithm to ""ECDH"". + algorithm->set_name(""ECDH""_string); + + // 6. Set the namedCurve attribute of algorithm to equal the namedCurve member of normalizedAlgorithm. + algorithm->set_named_curve(normalized_algorithm.named_curve); + + // 7. Set the [[type]] internal slot of key to ""public"" + key->set_type(Bindings::KeyType::Public); + + // 8. Set the [[algorithm]] internal slot of key to algorithm. + key->set_algorithm(algorithm); + } + + // 3. Return key + return GC::Ref { *key }; +} + // https://wicg.github.io/webcrypto-secure-curves/#ed25519-operations WebIDL::ExceptionOr, GC::Ref>> ED25519::generate_key([[maybe_unused]] AlgorithmParams const& params, bool extractable, Vector const& key_usages) { diff --git a/Libraries/LibWeb/Crypto/CryptoAlgorithms.h b/Libraries/LibWeb/Crypto/CryptoAlgorithms.h index dc005f1ec48c..59edde63de26 100644 --- a/Libraries/LibWeb/Crypto/CryptoAlgorithms.h +++ b/Libraries/LibWeb/Crypto/CryptoAlgorithms.h @@ -496,8 +496,8 @@ class ECDSA : public AlgorithmMethods { class ECDH : public AlgorithmMethods { public: virtual WebIDL::ExceptionOr, GC::Ref>> generate_key(AlgorithmParams const&, bool, Vector const&) override; - // TODO: virtual WebIDL::ExceptionOr> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, bool, Vector const&) override; // TODO: virtual WebIDL::ExceptionOr> export_key(Bindings::KeyFormat, GC::Ref) override; + virtual WebIDL::ExceptionOr> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, bool, Vector const&) override; virtual WebIDL::ExceptionOr> derive_bits(AlgorithmParams const&, GC::Ref, Optional) override; static NonnullOwnPtr create(JS::Realm& realm) { return adopt_own(*new ECDH(realm)); } diff --git a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 30f784cccaa9..3587037a1980 100644 --- a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -805,7 +805,7 @@ SupportedAlgorithmsMap const& supported_algorithms() // FIXME: define_an_algorithm(""exportKey""_string, ""ECDSA""_string); // https://w3c.github.io/webcrypto/#ecdh-registration - // FIXME: define_an_algorithm(""importKey""_string, ""ECDH""_string); + define_an_algorithm(""importKey""_string, ""ECDH""_string); // FIXME: define_an_algorithm(""exportKey""_string, ""ECDH""_string); define_an_algorithm(""deriveBits""_string, ""ECDH""_string); define_an_algorithm(""generateKey""_string, ""ECDH""_string);" bd26e5dce9f71b94159ecc21634250310caed6e8,2024-02-25 03:33:08,Dan Klishch,jsspeccompiler: Parse as raising a number to a power in xspec mode,False,Parse as raising a number to a power in xspec mode,jsspeccompiler,"diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h index 28afd0a52fbc..9937c9608333 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h @@ -253,7 +253,8 @@ class StringLiteral : public Expression { F(MemberAccess) \ F(Minus) \ F(Multiplication) \ - F(Plus) + F(Plus) \ + F(Power) #define NAME(name) name, #define STRINGIFY(name) #name##sv, diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp index e855075440bc..cd1e8f186bd5 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp @@ -106,6 +106,7 @@ void tokenize_string(SpecificationParsingContext& ctx, XML::Node const* node, St enum class TreeType { AlgorithmStep, + NestedExpression, Header, }; @@ -175,6 +176,14 @@ void tokenize_tree(SpecificationParsingContext& ctx, TokenizerState& state, XML: return; } + if (element.name == tag_sup) { + tokens.append({ TokenType::Superscript, """"sv, move(child_location) }); + tokens.append({ TokenType::ParenOpen, """"sv, move(child_location) }); + tokenize_tree(ctx, state, child, TreeType::NestedExpression); + tokens.append({ TokenType::ParenClose, """"sv, move(child_location) }); + return; + } + if (tree_type == TreeType::Header && element.name == tag_span) { auto element_class = get_attribute_by_name(child, attribute_class); if (element_class != class_secnum) @@ -207,7 +216,7 @@ void tokenize_tree(SpecificationParsingContext& ctx, TokenizerState& state, XML: [&](auto const&) {}); } - if (tokens.size() && tokens.last().type == TokenType::MemberAccess) + if (tree_type == TreeType::AlgorithmStep && tokens.size() && tokens.last().type == TokenType::MemberAccess) tokens.last().type = TokenType::Dot; } } diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.h b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.h index 469ad3213867..a2b173cdcf8a 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.h +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.h @@ -22,6 +22,7 @@ inline constexpr StringView tag_ol = ""ol""sv; inline constexpr StringView tag_p = ""p""sv; inline constexpr StringView tag_span = ""span""sv; inline constexpr StringView tag_specification = ""specification""sv; +inline constexpr StringView tag_sup = ""sup""sv; inline constexpr StringView tag_var = ""var""sv; inline constexpr StringView attribute_aoid = ""aoid""sv; diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Token.h b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Token.h index 0b6a48b55274..066cbcc19b1e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Token.h +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Token.h @@ -46,6 +46,7 @@ constexpr i32 closing_bracket_precedence = 18; F(Plus, 6, Invalid, Plus, Invalid, ""plus"") \ F(SectionNumber, -1, Invalid, Invalid, Invalid, ""section number"") \ F(String, -1, Invalid, Invalid, Invalid, ""string literal"") \ + F(Superscript, 4, Invalid, Power, Invalid, ""subscript"") \ F(UnaryMinus, 3, Minus, Invalid, Invalid, ""unary minus"") \ F(Undefined, -1, Invalid, Invalid, Invalid, ""constant"") \ F(Word, -1, Invalid, Invalid, Invalid, ""word"") diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml index 3e99dd81d262..1b2c231f64ba 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml @@ -24,7 +24,7 @@ 𝔽 ( floor - (nowNs / 1000000)). + (nowNs / 106)).
    diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml.expectation b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml.expectation index d8d93a437d50..cdc17c6de011 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml.expectation +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-single-function-simple.xml.expectation @@ -17,5 +17,7 @@ TreeList UnresolvedReference floor BinaryOperation Division Var nowNs - MathematicalConstant 1000000 + BinaryOperation Power + MathematicalConstant 10 + MathematicalConstant 6" caf6dd56809bb305ae1ebffbcc39990c8c8b864c,2023-02-17 21:55:57,FrHun,libgui: Implement calculated sizes for ValueSlider,False,Implement calculated sizes for ValueSlider,libgui,"diff --git a/Userland/Libraries/LibGUI/ValueSlider.cpp b/Userland/Libraries/LibGUI/ValueSlider.cpp index ac8cde7eec4f..e7e7de95e2f2 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.cpp +++ b/Userland/Libraries/LibGUI/ValueSlider.cpp @@ -24,7 +24,7 @@ ValueSlider::ValueSlider(Gfx::Orientation orientation, String suffix) // FIXME: Implement vertical mode VERIFY(orientation == Orientation::Horizontal); - set_fixed_height(20); + set_preferred_size(SpecialDimension::Fit); m_textbox = add(); m_textbox->set_relative_rect({ 0, 0, 34, 20 }); @@ -119,9 +119,14 @@ Gfx::IntRect ValueSlider::bar_rect() const return bar_rect; } +int ValueSlider::knob_length() const +{ + return m_knob_style == KnobStyle::Wide ? 13 : 7; +} + Gfx::IntRect ValueSlider::knob_rect() const { - int knob_thickness = m_knob_style == KnobStyle::Wide ? 13 : 7; + int knob_thickness = knob_length(); Gfx::IntRect knob_rect = bar_rect(); knob_rect.set_width(knob_thickness); @@ -202,4 +207,20 @@ void ValueSlider::mouseup_event(MouseEvent& event) m_dragging = false; } +Optional ValueSlider::calculated_min_size() const +{ + auto content_min_size = m_textbox->effective_min_size(); + + if (orientation() == Gfx::Orientation::Vertical) + return { { content_min_size.width(), content_min_size.height().as_int() + knob_length() } }; + return { { content_min_size.width().as_int() + knob_length(), content_min_size.height() } }; +} + +Optional ValueSlider::calculated_preferred_size() const +{ + if (orientation() == Gfx::Orientation::Vertical) + return { { SpecialDimension::Shrink, SpecialDimension::OpportunisticGrow } }; + return { { SpecialDimension::OpportunisticGrow, SpecialDimension::Shrink } }; +} + } diff --git a/Userland/Libraries/LibGUI/ValueSlider.h b/Userland/Libraries/LibGUI/ValueSlider.h index 191da5a3432d..96db34c37444 100644 --- a/Userland/Libraries/LibGUI/ValueSlider.h +++ b/Userland/Libraries/LibGUI/ValueSlider.h @@ -43,6 +43,10 @@ class ValueSlider : public AbstractSlider { int value_at(Gfx::IntPoint position) const; Gfx::IntRect bar_rect() const; Gfx::IntRect knob_rect() const; + int knob_length() const; + + virtual Optional calculated_min_size() const override; + virtual Optional calculated_preferred_size() const override; String m_suffix {}; Orientation m_orientation { Orientation::Horizontal };" 53c4be926b74e4ad7cd4d95a78c1cb8342098884,2021-02-28 22:49:52,Adam Hodgen,libweb: Set link cursor via the default CSS,False,Set link cursor via the default CSS,libweb,"diff --git a/Userland/Libraries/LibWeb/CSS/Default.css b/Userland/Libraries/LibWeb/CSS/Default.css index e151de6b5fb5..6376d850ddb7 100644 --- a/Userland/Libraries/LibWeb/CSS/Default.css +++ b/Userland/Libraries/LibWeb/CSS/Default.css @@ -2,6 +2,10 @@ html { font-family: sans-serif; } +a { + cursor: pointer; +} + head, link, meta, diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 7b34e9f9bb5c..d2373141683d 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -252,7 +252,6 @@ void OutOfProcessWebView::notify_server_did_request_scroll_into_view(Badge, const URL& url) { - set_override_cursor(Gfx::StandardCursor::Hand); if (on_link_hover) on_link_hover(url); }" 960953923683e91d817e4803c0369809f4ec93b6,2020-07-04 14:19:36,AnotherTest,kernel: Change the value of SO_KEEPALIVE to reflect LibC's constant,False,Change the value of SO_KEEPALIVE to reflect LibC's constant,kernel,"diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index f01cf0aa5349..a07ebf4f579d 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -450,11 +450,11 @@ struct pollfd { #define SO_RCVTIMEO 1 #define SO_SNDTIMEO 2 -#define SO_KEEPALIVE 3 #define SO_ERROR 4 #define SO_PEERCRED 5 #define SO_REUSEADDR 6 #define SO_BINDTODEVICE 7 +#define SO_KEEPALIVE 9 #define IPPROTO_IP 0 #define IPPROTO_ICMP 1" 6f52064c4f41de51c1f062d251fd2d8dcaa9f9b3,2024-11-24 19:00:32,Psychpsyo,libweb: Make SVGs respect their CSS transforms,False,Make SVGs respect their CSS transforms,libweb,"diff --git a/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp b/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp index 90f59a86ecfa..596bd32563b6 100644 --- a/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp +++ b/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp @@ -51,60 +51,61 @@ static Gfx::FloatMatrix4x4 matrix_with_scaled_translation(Gfx::FloatMatrix4x4 ma return matrix; } -void SVGSVGPaintable::paint_descendants(PaintContext& context, PaintableBox const& paintable, PaintPhase phase) +void SVGSVGPaintable::paint_svg_box(PaintContext& context, PaintableBox const& svg_box, PaintPhase phase) { - if (phase != PaintPhase::Foreground) - return; - - auto paint_svg_box = [&](auto& svg_box) { - auto const& computed_values = svg_box.computed_values(); - - auto filters = paintable.computed_values().filter(); - auto masking_area = svg_box.get_masking_area(); - auto needs_to_save_state = computed_values.opacity() < 1 || svg_box.has_css_transform() || svg_box.get_masking_area().has_value() || !filters.is_none(); - - if (needs_to_save_state) { - context.display_list_recorder().save(); - } - - if (computed_values.opacity() < 1) { - context.display_list_recorder().apply_opacity(computed_values.opacity()); - } - - context.display_list_recorder().apply_filters(filters); - - if (svg_box.has_css_transform()) { - auto transform_matrix = svg_box.transform(); - Gfx::FloatPoint transform_origin = svg_box.transform_origin().template to_type(); - auto to_device_pixels_scale = float(context.device_pixels_per_css_pixel()); - context.display_list_recorder().apply_transform(transform_origin.scaled(to_device_pixels_scale), matrix_with_scaled_translation(transform_matrix, to_device_pixels_scale)); + auto const& computed_values = svg_box.computed_values(); + + auto filters = svg_box.computed_values().filter(); + auto masking_area = svg_box.get_masking_area(); + auto needs_to_save_state = computed_values.opacity() < 1 || svg_box.has_css_transform() || svg_box.get_masking_area().has_value() || !filters.is_none(); + + if (needs_to_save_state) { + context.display_list_recorder().save(); + } + + if (computed_values.opacity() < 1) { + context.display_list_recorder().apply_opacity(computed_values.opacity()); + } + + context.display_list_recorder().apply_filters(filters); + + if (svg_box.has_css_transform()) { + auto transform_matrix = svg_box.transform(); + Gfx::FloatPoint transform_origin = svg_box.transform_origin().template to_type(); + auto to_device_pixels_scale = float(context.device_pixels_per_css_pixel()); + context.display_list_recorder().apply_transform(transform_origin.scaled(to_device_pixels_scale), matrix_with_scaled_translation(transform_matrix, to_device_pixels_scale)); + } + + if (masking_area.has_value()) { + if (masking_area->is_empty()) + return; + auto mask_bitmap = svg_box.calculate_mask(context, *masking_area); + if (mask_bitmap) { + auto source_paintable_rect = context.enclosing_device_rect(*masking_area).template to_type(); + auto origin = source_paintable_rect.location(); + context.display_list_recorder().apply_mask_bitmap(origin, mask_bitmap.release_nonnull(), *svg_box.get_mask_type()); } + } - if (masking_area.has_value()) { - if (masking_area->is_empty()) - return; - auto mask_bitmap = svg_box.calculate_mask(context, *masking_area); - if (mask_bitmap) { - auto source_paintable_rect = context.enclosing_device_rect(*masking_area).template to_type(); - auto origin = source_paintable_rect.location(); - context.display_list_recorder().apply_mask_bitmap(origin, mask_bitmap.release_nonnull(), *svg_box.get_mask_type()); - } - } + svg_box.before_paint(context, PaintPhase::Foreground); + svg_box.paint(context, PaintPhase::Foreground); + svg_box.after_paint(context, PaintPhase::Foreground); - svg_box.before_paint(context, PaintPhase::Foreground); - svg_box.paint(context, PaintPhase::Foreground); - svg_box.after_paint(context, PaintPhase::Foreground); + paint_descendants(context, svg_box, phase); - paint_descendants(context, svg_box, phase); + if (needs_to_save_state) { + context.display_list_recorder().restore(); + } +} - if (needs_to_save_state) { - context.display_list_recorder().restore(); - } - }; +void SVGSVGPaintable::paint_descendants(PaintContext& context, PaintableBox const& paintable, PaintPhase phase) +{ + if (phase != PaintPhase::Foreground) + return; paintable.before_children_paint(context, PaintPhase::Foreground); paintable.for_each_child_of_type([&](PaintableBox& child) { - paint_svg_box(child); + paint_svg_box(context, child, phase); return IterationDecision::Continue; }); paintable.after_children_paint(context, PaintPhase::Foreground); diff --git a/Libraries/LibWeb/Painting/SVGSVGPaintable.h b/Libraries/LibWeb/Painting/SVGSVGPaintable.h index cc364b7f989a..c5c3ceee70e2 100644 --- a/Libraries/LibWeb/Painting/SVGSVGPaintable.h +++ b/Libraries/LibWeb/Painting/SVGSVGPaintable.h @@ -23,6 +23,7 @@ class SVGSVGPaintable final : public PaintableBox { Layout::SVGSVGBox const& layout_box() const; + static void paint_svg_box(PaintContext& context, PaintableBox const& svg_box, PaintPhase phase); static void paint_descendants(PaintContext& context, PaintableBox const& paintable, PaintPhase phase); protected: diff --git a/Libraries/LibWeb/Painting/StackingContext.cpp b/Libraries/LibWeb/Painting/StackingContext.cpp index 8d00a0303078..d624158365e0 100644 --- a/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Libraries/LibWeb/Painting/StackingContext.cpp @@ -104,7 +104,7 @@ void StackingContext::paint_svg(PaintContext& context, PaintableBox const& paint paintable.apply_clip_overflow_rect(context, PaintPhase::Foreground); paint_node(paintable, context, PaintPhase::Background); paint_node(paintable, context, PaintPhase::Border); - SVGSVGPaintable::paint_descendants(context, paintable, phase); + SVGSVGPaintable::paint_svg_box(context, paintable, phase); paintable.clear_clip_overflow_rect(context, PaintPhase::Foreground); } diff --git a/Tests/LibWeb/Ref/expected/svg-with-css-transform.html b/Tests/LibWeb/Ref/expected/svg-with-css-transform.html new file mode 100644 index 000000000000..b76f4dfc3e13 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/svg-with-css-transform.html @@ -0,0 +1,12 @@ + + + + + + diff --git a/Tests/LibWeb/Ref/input/svg-with-css-transform.html b/Tests/LibWeb/Ref/input/svg-with-css-transform.html new file mode 100644 index 000000000000..0bc7dcee7976 --- /dev/null +++ b/Tests/LibWeb/Ref/input/svg-with-css-transform.html @@ -0,0 +1,14 @@ + + + + + + +" 5e473a63d30098efbfd6bd076bad1faba88d9e93,2021-11-08 05:06:19,Andreas Kling,ak: Make Error.h pull in Try.h,False,Make Error.h pull in Try.h,ak,"diff --git a/AK/Error.h b/AK/Error.h index f79e2ff1517f..2e7295fbac00 100644 --- a/AK/Error.h +++ b/AK/Error.h @@ -9,6 +9,7 @@ #include #include #include +#include #if defined(__serenity__) && defined(KERNEL) # include " cf8427b7b46798f7e26929bb05dc5ffa33c359a5,2021-12-29 03:47:24,Stephan Unverwerth,profiler: Add source code view,False,Add source code view,profiler,"diff --git a/Userland/DevTools/Profiler/CMakeLists.txt b/Userland/DevTools/Profiler/CMakeLists.txt index d40ca81379c3..e10a82b7d2aa 100644 --- a/Userland/DevTools/Profiler/CMakeLists.txt +++ b/Userland/DevTools/Profiler/CMakeLists.txt @@ -14,6 +14,7 @@ set(SOURCES ProfileModel.cpp SamplesModel.cpp SignpostsModel.cpp + SourceModel.cpp TimelineContainer.cpp TimelineHeader.cpp TimelineTrack.cpp diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index 46349dc85900..3b3df1025cb8 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -8,6 +8,7 @@ #include ""DisassemblyModel.h"" #include ""ProfileModel.h"" #include ""SamplesModel.h"" +#include ""SourceModel.h"" #include #include #include @@ -554,6 +555,23 @@ GUI::Model* Profile::disassembly_model() return m_disassembly_model; } +void Profile::set_source_index(GUI::ModelIndex const& index) +{ + if (m_source_index == index) + return; + m_source_index = index; + auto* node = static_cast(index.internal_data()); + if (!node) + m_source_model = nullptr; + else + m_source_model = SourceModel::create(*this, *node); +} + +GUI::Model* Profile::source_model() +{ + return m_source_model; +} + ProfileNode::ProfileNode(Process const& process) : m_root(true) , m_process(process) diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index e153a9bc7091..78ff901eabce 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -12,6 +12,7 @@ #include ""ProfileModel.h"" #include ""SamplesModel.h"" #include ""SignpostsModel.h"" +#include ""SourceModel.h"" #include #include #include @@ -147,6 +148,7 @@ class Profile { GUI::Model& samples_model(); GUI::Model& signposts_model(); GUI::Model* disassembly_model(); + GUI::Model* source_model(); const Process* find_process(pid_t pid, EventSerialNumber serial) const { @@ -157,6 +159,7 @@ class Profile { } void set_disassembly_index(const GUI::ModelIndex&); + void set_source_index(const GUI::ModelIndex&); const Vector>& roots() const { return m_roots; } @@ -281,8 +284,10 @@ class Profile { RefPtr m_samples_model; RefPtr m_signposts_model; RefPtr m_disassembly_model; + RefPtr m_source_model; GUI::ModelIndex m_disassembly_index; + GUI::ModelIndex m_source_index; Vector> m_roots; Vector m_filtered_event_indices; diff --git a/Userland/DevTools/Profiler/SourceModel.cpp b/Userland/DevTools/Profiler/SourceModel.cpp new file mode 100644 index 000000000000..844d1e9064d7 --- /dev/null +++ b/Userland/DevTools/Profiler/SourceModel.cpp @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2021, Stephan Unverwerth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include ""SourceModel.h"" +#include ""Profile.h"" +#include +#include +#include +#include + +namespace Profiler { + +class SourceFile final { +public: + struct Line { + String content; + size_t num_samples { 0 }; + }; + + static constexpr StringView source_root_path = ""/usr/src/serenity/""sv; + +public: + SourceFile(StringView filename) + { + String source_file_name = filename.replace(""../../"", source_root_path); + + auto maybe_file = Core::File::open(source_file_name, Core::OpenMode::ReadOnly); + if (maybe_file.is_error()) { + dbgln(""Could not map source file \""{}\"". Tried {}. {} (errno={})"", filename, source_file_name, maybe_file.error().string_literal(), maybe_file.error().code()); + return; + } + + auto file = maybe_file.value(); + + while (!file->eof()) + m_lines.append({ file->read_line(1024), 0 }); + } + + void try_add_samples(size_t line, size_t samples) + { + if (line < 1 || line - 1 >= m_lines.size()) + return; + + m_lines[line - 1].num_samples += samples; + } + + Vector const& lines() const { return m_lines; } + +private: + Vector m_lines; +}; + +static Gfx::Bitmap const& heat_gradient() +{ + static RefPtr bitmap; + if (!bitmap) { + bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 101, 1 }).release_value_but_fixme_should_propagate_errors(); + GUI::Painter painter(*bitmap); + painter.fill_rect_with_gradient(Orientation::Horizontal, bitmap->rect(), Color::from_rgb(0xffc080), Color::from_rgb(0xff3000)); + } + return *bitmap; +} + +static Color color_for_percent(int percent) +{ + VERIFY(percent >= 0 && percent <= 100); + return heat_gradient().get_pixel(percent, 0); +} + +SourceModel::SourceModel(Profile& profile, ProfileNode& node) + : m_profile(profile) + , m_node(node) +{ + FlatPtr base_address = 0; + Debug::DebugInfo const* debug_info; + if (auto maybe_kernel_base = Symbolication::kernel_base(); maybe_kernel_base.has_value() && m_node.address() >= *maybe_kernel_base) { + if (!g_kernel_debuginfo_object.has_value()) + return; + base_address = maybe_kernel_base.release_value(); + if (g_kernel_debug_info == nullptr) + g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, String::empty(), base_address); + debug_info = g_kernel_debug_info.ptr(); + } else { + auto const& process = node.process(); + auto const* library_data = process.library_metadata.library_containing(node.address()); + if (!library_data) { + dbgln(""no library data for address {:p}"", node.address()); + return; + } + base_address = library_data->base; + debug_info = &library_data->load_debug_info(base_address); + } + + VERIFY(debug_info != nullptr); + + // Try to read all source files contributing to the selected function and aggregate the samples by line. + HashMap source_files; + for (auto const& pair : node.events_per_address()) { + auto position = debug_info->get_source_position(pair.key - base_address); + if (position.has_value()) { + auto it = source_files.find(position.value().file_path); + if (it == source_files.end()) { + source_files.set(position.value().file_path, SourceFile(position.value().file_path)); + it = source_files.find(position.value().file_path); + } + + it->value.try_add_samples(position.value().line_number, pair.value); + } + } + + // Process source file map and turn content into view model + for (auto const& file_iterator : source_files) { + u32 line_number = 0; + for (auto const& line_iterator : file_iterator.value.lines()) { + line_number++; + + m_source_lines.append({ + (u32)line_iterator.num_samples, + line_iterator.num_samples * 100.0f / node.event_count(), + file_iterator.key, + line_number, + line_iterator.content, + }); + } + } +} + +int SourceModel::row_count(GUI::ModelIndex const&) const +{ + return m_source_lines.size(); +} + +String SourceModel::column_name(int column) const +{ + switch (column) { + case Column::SampleCount: + return m_profile.show_percentages() ? ""% Samples"" : ""# Samples""; + case Column::SourceCode: + return ""Source Code""; + case Column::Location: + return ""Location""; + case Column::LineNumber: + return ""Line""; + default: + VERIFY_NOT_REACHED(); + return {}; + } +} + +struct ColorPair { + Color background; + Color foreground; +}; + +static Optional color_pair_for(SourceLineData const& line) +{ + if (line.percent == 0) + return {}; + + Color background = color_for_percent(line.percent); + Color foreground; + if (line.percent > 50) + foreground = Color::White; + else + foreground = Color::Black; + return ColorPair { background, foreground }; +} + +GUI::Variant SourceModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const +{ + auto const& line = m_source_lines[index.row()]; + + if (role == GUI::ModelRole::BackgroundColor) { + auto colors = color_pair_for(line); + if (!colors.has_value()) + return {}; + return colors.value().background; + } + + if (role == GUI::ModelRole::ForegroundColor) { + auto colors = color_pair_for(line); + if (!colors.has_value()) + return {}; + return colors.value().foreground; + } + + if (role == GUI::ModelRole::Font) { + if (index.column() == Column::SourceCode) + return Gfx::FontDatabase::default_fixed_width_font(); + return {}; + } + + if (role == GUI::ModelRole::Display) { + if (index.column() == Column::SampleCount) { + if (m_profile.show_percentages()) + return ((float)line.event_count / (float)m_node.event_count()) * 100.0f; + return line.event_count; + } + + if (index.column() == Column::Location) + return line.location; + + if (index.column() == Column::LineNumber) + return line.line_number; + + if (index.column() == Column::SourceCode) + return line.source_code; + + return {}; + } + return {}; +} + +} diff --git a/Userland/DevTools/Profiler/SourceModel.h b/Userland/DevTools/Profiler/SourceModel.h new file mode 100644 index 000000000000..9e2fa08f9f1d --- /dev/null +++ b/Userland/DevTools/Profiler/SourceModel.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021, Stephan Unverwerth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Profiler { + +class Profile; +class ProfileNode; + +struct SourceLineData { + u32 event_count { 0 }; + float percent { 0 }; + String location; + u32 line_number { 0 }; + String source_code; +}; + +class SourceModel final : public GUI::Model { +public: + static NonnullRefPtr create(Profile& profile, ProfileNode& node) + { + return adopt_ref(*new SourceModel(profile, node)); + } + + enum Column { + SampleCount, + Location, + LineNumber, + SourceCode, + __Count + }; + + virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; + virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } + virtual String column_name(int) const override; + virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; + virtual bool is_column_sortable(int) const override { return false; } + +private: + SourceModel(Profile&, ProfileNode&); + + Profile& m_profile; + ProfileNode& m_node; + + Vector m_source_lines; +}; + +} diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 2e014d57660e..bb34effc9213 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -153,8 +153,21 @@ ErrorOr serenity_main(Main::Arguments arguments) } }; + auto source_view = TRY(bottom_splitter->try_add()); + source_view->set_visible(false); + + auto update_source_model = [&] { + if (source_view->is_visible() && !tree_view->selection().is_empty()) { + profile->set_source_index(tree_view->selection().first()); + source_view->set_model(profile->source_model()); + } else { + source_view->set_model(nullptr); + } + }; + tree_view->on_selection_change = [&] { update_disassembly_model(); + update_source_model(); }; auto disassembly_action = GUI::Action::create_checkable(""Show &Disassembly"", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file(""/res/icons/16x16/x86.png"").release_value_but_fixme_should_propagate_errors(), [&](auto& action) { @@ -162,6 +175,11 @@ ErrorOr serenity_main(Main::Arguments arguments) update_disassembly_model(); }); + auto source_action = GUI::Action::create_checkable(""Show &Source"", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file(""/res/icons/16x16/x86.png"").release_value_but_fixme_should_propagate_errors(), [&](auto& action) { + source_view->set_visible(action.is_checked()); + update_source_model(); + }); + auto samples_tab = TRY(tab_widget->try_add_tab(""Samples"")); samples_tab->set_layout(); samples_tab->layout()->set_margins(4); @@ -255,11 +273,13 @@ ErrorOr serenity_main(Main::Arguments arguments) profile->set_show_percentages(action.is_checked()); tree_view->update(); disassembly_view->update(); + source_view->update(); }); percent_action->set_checked(false); TRY(view_menu->try_add_action(percent_action)); TRY(view_menu->try_add_action(disassembly_action)); + TRY(view_menu->try_add_action(source_action)); auto help_menu = TRY(window->try_add_menu(""&Help"")); TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {" da7dbc116eafe03867c6aa9bd5fcfa4354ea90e3,2021-04-10 01:23:43,Andreas Kling,"libgui: Use ""Tray"" look & feel for the common locations frame :^)",False,"Use ""Tray"" look & feel for the common locations frame :^)",libgui,"diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 4ca510d4a4a3..c68dbf09e89c 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -223,9 +223,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_ }; auto& common_locations_frame = *widget.find_descendant_of_type_named(""common_locations_frame""); + common_locations_frame.set_background_role(Gfx::ColorRole::Tray); auto add_common_location_button = [&](auto& name, String path) -> GUI::Button& { auto& button = common_locations_frame.add(); - button.set_button_style(Gfx::ButtonStyle::CoolBar); + button.set_button_style(Gfx::ButtonStyle::Tray); + button.set_foreground_role(Gfx::ColorRole::TrayText); button.set_text_alignment(Gfx::TextAlignment::CenterLeft); button.set_text(move(name)); button.set_icon(FileIconProvider::icon_for_path(path).bitmap_for_size(16));" 8bfb665b72430b3c20a34cd5f4e6519d6744fcd5,2021-09-12 05:10:56,Timothy Flynn,libjs: Convert DataView.prototype to be a PrototypeObject,False,Convert DataView.prototype to be a PrototypeObject,libjs,"diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 747200f0fc1a..5688c220056c 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -11,7 +11,7 @@ namespace JS { DataViewPrototype::DataViewPrototype(GlobalObject& global_object) - : Object(*global_object.object_prototype()) + : PrototypeObject(*global_object.object_prototype()) { } @@ -54,22 +54,12 @@ DataViewPrototype::~DataViewPrototype() { } -static DataView* typed_this(VM& vm, GlobalObject& global_object) -{ - auto this_value = vm.this_value(global_object); - if (!this_value.is_object() || !is(this_value.as_object())) { - vm.throw_exception(global_object, ErrorType::NotAnObjectOfType, vm.names.DataView); - return nullptr; - } - return static_cast(&this_value.as_object()); -} - // 25.3.1.1 GetViewValue ( view, requestIndex, isLittleEndian, type ), https://tc39.es/ecma262/#sec-getviewvalue template static Value get_view_value(GlobalObject& global_object, Value request_index, Value is_little_endian) { auto& vm = global_object.vm(); - auto* view = typed_this(vm, global_object); + auto* view = DataViewPrototype::typed_this_value(global_object); if (!view) return {}; @@ -108,7 +98,7 @@ template static Value set_view_value(GlobalObject& global_object, Value request_index, Value is_little_endian, Value value) { auto& vm = global_object.vm(); - auto* view = typed_this(vm, global_object); + auto* view = DataViewPrototype::typed_this_value(global_object); if (!view) return {}; @@ -265,7 +255,7 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_uint_32) // 25.3.4.1 get DataView.prototype.buffer, https://tc39.es/ecma262/#sec-get-dataview.prototype.buffer JS_DEFINE_NATIVE_GETTER(DataViewPrototype::buffer_getter) { - auto* data_view = typed_this(vm, global_object); + auto* data_view = typed_this_value(global_object); if (!data_view) return {}; return data_view->viewed_array_buffer(); @@ -274,7 +264,7 @@ JS_DEFINE_NATIVE_GETTER(DataViewPrototype::buffer_getter) // 25.3.4.2 get DataView.prototype.byteLength, https://tc39.es/ecma262/#sec-get-dataview.prototype.bytelength JS_DEFINE_NATIVE_GETTER(DataViewPrototype::byte_length_getter) { - auto* data_view = typed_this(vm, global_object); + auto* data_view = typed_this_value(global_object); if (!data_view) return {}; if (data_view->viewed_array_buffer()->is_detached()) { @@ -287,7 +277,7 @@ JS_DEFINE_NATIVE_GETTER(DataViewPrototype::byte_length_getter) // 25.3.4.3 get DataView.prototype.byteOffset, https://tc39.es/ecma262/#sec-get-dataview.prototype.byteoffset JS_DEFINE_NATIVE_GETTER(DataViewPrototype::byte_offset_getter) { - auto* data_view = typed_this(vm, global_object); + auto* data_view = typed_this_value(global_object); if (!data_view) return {}; if (data_view->viewed_array_buffer()->is_detached()) { diff --git a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h index 4a7444adf6db..839719c43ba7 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/DataViewPrototype.h @@ -7,11 +7,12 @@ #pragma once #include +#include namespace JS { -class DataViewPrototype final : public Object { - JS_OBJECT(DataViewPrototype, Object); +class DataViewPrototype final : public PrototypeObject { + JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView); public: DataViewPrototype(GlobalObject&);" 24ee5a22024c7fbc9e58fbce4b9c8f202b1ef75a,2022-10-20 00:41:37,Linus Groh,webdriver: Move `GET /session/{session id}/window` impl into Session,False,Move `GET /session/{session id}/window` impl into Session,webdriver,"diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp index fe3844b1026c..92314bcfd890 100644 --- a/Userland/Services/WebDriver/Client.cpp +++ b/Userland/Services/WebDriver/Client.cpp @@ -533,13 +533,9 @@ ErrorOr Client::handle_get_window_handle(Vector/window""); auto* session = TRY(find_session_with_id(parameters[0])); - // 1. If the current top-level browsing context is no longer open, return error with error code no such window. - auto current_window = session->get_window_object(); - if (!current_window.has_value()) - return HttpError { 404, ""no such window"", ""Window not found"" }; - - // 2. Return success with data being the window handle associated with the current top-level browsing context. - return make_json_value(session->current_window_handle()); + // NOTE: Spec steps handled in Session::get_title(). + auto result = TRY(session->get_window_handle()); + return make_json_value(result); } // 11.2 Close Window, https://w3c.github.io/webdriver/#dfn-close-window diff --git a/Userland/Services/WebDriver/Session.cpp b/Userland/Services/WebDriver/Session.cpp index 52265574d5d0..ad059426edac 100644 --- a/Userland/Services/WebDriver/Session.cpp +++ b/Userland/Services/WebDriver/Session.cpp @@ -235,6 +235,18 @@ ErrorOr Session::get_title() return JsonValue(m_browser_connection->get_title()); } +// 11.1 Get Window Handle, https://w3c.github.io/webdriver/#get-window-handle +ErrorOr Session::get_window_handle() +{ + // 1. If the current top-level browsing context is no longer open, return error with error code no such window. + auto current_window = get_window_object(); + if (!current_window.has_value()) + return HttpError { 404, ""no such window"", ""Window not found"" }; + + // 2. Return success with data being the window handle associated with the current top-level browsing context. + return m_current_window_handle; +} + // 11.2 Close Window, https://w3c.github.io/webdriver/#dfn-close-window ErrorOr> Session::close_window() { diff --git a/Userland/Services/WebDriver/Session.h b/Userland/Services/WebDriver/Session.h index 3cf85cee4754..2f09319fbf9f 100644 --- a/Userland/Services/WebDriver/Session.h +++ b/Userland/Services/WebDriver/Session.h @@ -47,6 +47,7 @@ class Session { ErrorOr forward(); ErrorOr refresh(); ErrorOr get_title(); + ErrorOr get_window_handle(); ErrorOr find_element(JsonValue const& payload); ErrorOr find_elements(JsonValue const& payload); ErrorOr find_element_from_element(JsonValue const& payload, StringView parameter_element_id);" c8b286084b8b794680fd364dd17572b2fb5d676a,2023-01-06 16:32:21,Andreas Kling,windowserver: Round menu item font sizes up when calculating height,False,Round menu item font sizes up when calculating height,windowserver,"diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 49646ef776bc..83048cab5cb2 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -95,7 +95,7 @@ int Menu::content_width() const int Menu::item_height() const { - return max(font().preferred_line_height(), s_item_icon_width + 2) + 4; + return max(static_cast(ceilf(font().preferred_line_height())), s_item_icon_width + 2) + 4; } void Menu::redraw()" c0d7f748edd86ea744f4dedc8a2bfd5b612d2812,2024-03-16 21:05:54,Andreas Kling,libweb: Avoid FlyString lookups when setting IDL interface prototypes,False,Avoid FlyString lookups when setting IDL interface prototypes,libweb,"diff --git a/Userland/Libraries/LibWeb/Animations/Animation.cpp b/Userland/Libraries/LibWeb/Animations/Animation.cpp index a64b851ee400..f2dc5d3ad2f8 100644 --- a/Userland/Libraries/LibWeb/Animations/Animation.cpp +++ b/Userland/Libraries/LibWeb/Animations/Animation.cpp @@ -1331,7 +1331,7 @@ Animation::Animation(JS::Realm& realm) void Animation::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Animation""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Animation); } void Animation::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp index 4d018785de91..5d0ea7115adf 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationEffect.cpp @@ -604,7 +604,7 @@ AnimationEffect::AnimationEffect(JS::Realm& realm) void AnimationEffect::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AnimationEffect""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationEffect); } } diff --git a/Userland/Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp b/Userland/Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp index 99c6994b62ec..38feec290d52 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationPlaybackEvent.cpp @@ -32,7 +32,7 @@ AnimationPlaybackEvent::AnimationPlaybackEvent(JS::Realm& realm, FlyString const void AnimationPlaybackEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AnimationPlaybackEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationPlaybackEvent); } } diff --git a/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp b/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp index 2e419d72eff5..7bf4f001f959 100644 --- a/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp +++ b/Userland/Libraries/LibWeb/Animations/AnimationTimeline.cpp @@ -57,7 +57,7 @@ void AnimationTimeline::finalize() void AnimationTimeline::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AnimationTimeline""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationTimeline); } void AnimationTimeline::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Animations/DocumentTimeline.cpp b/Userland/Libraries/LibWeb/Animations/DocumentTimeline.cpp index 5f0bb816ee1d..08d51b5a9c70 100644 --- a/Userland/Libraries/LibWeb/Animations/DocumentTimeline.cpp +++ b/Userland/Libraries/LibWeb/Animations/DocumentTimeline.cpp @@ -77,7 +77,7 @@ DocumentTimeline::DocumentTimeline(JS::Realm& realm, DOM::Document& document, Hi void DocumentTimeline::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DocumentTimeline""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DocumentTimeline); } } diff --git a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 71a12cb2dbb2..55cb35d794c7 100644 --- a/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Userland/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -860,7 +860,7 @@ KeyframeEffect::KeyframeEffect(JS::Realm& realm) void KeyframeEffect::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""KeyframeEffect""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(KeyframeEffect); } void KeyframeEffect::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h index b4531b7c6ea5..8dfd13bd786b 100644 --- a/Userland/Libraries/LibWeb/Bindings/Intrinsics.h +++ b/Userland/Libraries/LibWeb/Bindings/Intrinsics.h @@ -15,6 +15,14 @@ #include #include +#define WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(interface_class, interface_name) \ + do { \ + static auto name = #interface_name##_fly_string; \ + set_prototype(&Bindings::ensure_web_prototype(realm, name)); \ + } while (0) + +#define WEB_SET_PROTOTYPE_FOR_INTERFACE(interface_name) WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(interface_name, interface_name) + namespace Web::Bindings { class Intrinsics final : public JS::Cell { diff --git a/Userland/Libraries/LibWeb/CSS/AnimationEvent.cpp b/Userland/Libraries/LibWeb/CSS/AnimationEvent.cpp index 6ed52600d5d3..aeadc1b694b9 100644 --- a/Userland/Libraries/LibWeb/CSS/AnimationEvent.cpp +++ b/Userland/Libraries/LibWeb/CSS/AnimationEvent.cpp @@ -30,7 +30,7 @@ AnimationEvent::AnimationEvent(JS::Realm& realm, FlyString const& type, Animatio void AnimationEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AnimationEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationEvent); } } diff --git a/Userland/Libraries/LibWeb/CSS/CSSAnimation.cpp b/Userland/Libraries/LibWeb/CSS/CSSAnimation.cpp index f8de7504b3af..f56afa98c859 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSAnimation.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSAnimation.cpp @@ -73,7 +73,7 @@ CSSAnimation::CSSAnimation(JS::Realm& realm) void CSSAnimation::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSAnimation""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSAnimation); } void CSSAnimation::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp index 2a4f2576aaac..b926ffc521fb 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSConditionRule.cpp @@ -31,7 +31,7 @@ void CSSConditionRule::for_each_effective_keyframes_at_rule(Function(realm, ""CSSConditionRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSConditionRule); } } diff --git a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp index 75d46146ac06..a17284f77268 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSFontFaceRule.cpp @@ -30,7 +30,7 @@ CSSFontFaceRule::CSSFontFaceRule(JS::Realm& realm, FontFace&& font_face) void CSSFontFaceRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSFontFaceRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSFontFaceRule); } CSSStyleDeclaration* CSSFontFaceRule::style() diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp index 886b5d915612..b0f36ff0f392 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp @@ -25,7 +25,7 @@ CSSGroupingRule::CSSGroupingRule(JS::Realm& realm, CSSRuleList& rules) void CSSGroupingRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSGroupingRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSGroupingRule); } void CSSGroupingRule::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp index f13e24fb1f95..6449393d5161 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.cpp @@ -45,7 +45,7 @@ CSSImportRule::CSSImportRule(URL url, DOM::Document& document) void CSSImportRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSImportRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSImportRule); } void CSSImportRule::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSKeyframeRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSKeyframeRule.cpp index 1c871c49d582..31583fe7003e 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSKeyframeRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSKeyframeRule.cpp @@ -27,7 +27,7 @@ void CSSKeyframeRule::visit_edges(Visitor& visitor) void CSSKeyframeRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSKeyframeRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSKeyframeRule); } String CSSKeyframeRule::serialized() const diff --git a/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp index 87d27963a825..c41dba48ae2a 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSKeyframesRule.cpp @@ -27,7 +27,7 @@ void CSSKeyframesRule::visit_edges(Visitor& visitor) void CSSKeyframesRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSKeyframesRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSKeyframesRule); } String CSSKeyframesRule::serialized() const diff --git a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp index 90a7c4418dd1..5d82779c846e 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSMediaRule.cpp @@ -28,7 +28,7 @@ CSSMediaRule::CSSMediaRule(JS::Realm& realm, MediaList& media, CSSRuleList& rule void CSSMediaRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSMediaRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSMediaRule); } void CSSMediaRule::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSNamespaceRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSNamespaceRule.cpp index f180736878fe..abb1ae03e7b8 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSNamespaceRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSNamespaceRule.cpp @@ -31,7 +31,7 @@ JS::NonnullGCPtr CSSNamespaceRule::create(JS::Realm& realm, Op void CSSNamespaceRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSNamespaceRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSNamespaceRule); } // https://www.w3.org/TR/cssom/#serialize-a-css-rule diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp index b6a1d3fb0b8e..e6ddfccdfb7a 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp @@ -42,7 +42,7 @@ JS::NonnullGCPtr CSSRuleList::create_empty(JS::Realm& realm) void CSSRuleList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSRuleList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSRuleList); } void CSSRuleList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp index a844b889e651..eca0ba2a3bb2 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp @@ -28,7 +28,7 @@ CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm) void CSSStyleDeclaration::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSStyleDeclaration""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSStyleDeclaration); } JS::NonnullGCPtr PropertyOwningCSSStyleDeclaration::create(JS::Realm& realm, Vector properties, HashMap custom_properties) diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp index fe9dafc0fbec..c5fb5df6c3a5 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp @@ -29,7 +29,7 @@ CSSStyleRule::CSSStyleRule(JS::Realm& realm, Vector>&& s void CSSStyleRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSStyleRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSStyleRule); } void CSSStyleRule::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp index 70c8da6329b5..34a9c7850e67 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleSheet.cpp @@ -111,7 +111,7 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me void CSSStyleSheet::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSStyleSheet""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSStyleSheet); } void CSSStyleSheet::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp index ed1bb01155a5..76a0426ce9cd 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp @@ -27,7 +27,7 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr&& sup void CSSSupportsRule::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CSSSupportsRule""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSSupportsRule); } String CSSSupportsRule::condition_text() const diff --git a/Userland/Libraries/LibWeb/CSS/MediaList.cpp b/Userland/Libraries/LibWeb/CSS/MediaList.cpp index 48e3fcebd553..e811afa80d1d 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaList.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaList.cpp @@ -30,7 +30,7 @@ MediaList::MediaList(JS::Realm& realm, Vector>&& media void MediaList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MediaList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaList); } // https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp index 3f891e014223..cb8b9de37df9 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp @@ -33,7 +33,7 @@ MediaQueryList::MediaQueryList(DOM::Document& document, Vector(realm, ""MediaQueryList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaQueryList); } void MediaQueryList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp index c175a313f069..0bb697149dd5 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryListEvent.cpp @@ -29,7 +29,7 @@ MediaQueryListEvent::~MediaQueryListEvent() = default; void MediaQueryListEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MediaQueryListEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaQueryListEvent); } } diff --git a/Userland/Libraries/LibWeb/CSS/Screen.cpp b/Userland/Libraries/LibWeb/CSS/Screen.cpp index 8f8d3f4814d1..d78a35e87e10 100644 --- a/Userland/Libraries/LibWeb/CSS/Screen.cpp +++ b/Userland/Libraries/LibWeb/CSS/Screen.cpp @@ -29,7 +29,7 @@ Screen::Screen(HTML::Window& window) void Screen::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Screen""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Screen); } void Screen::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp b/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp index 012365d45fb6..ecab95e65069 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleSheetList.cpp @@ -80,7 +80,7 @@ StyleSheetList::StyleSheetList(DOM::Document& document) void StyleSheetList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""StyleSheetList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(StyleSheetList); } void StyleSheetList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/CSS/VisualViewport.cpp b/Userland/Libraries/LibWeb/CSS/VisualViewport.cpp index c4f2b02257c9..d33d1a866432 100644 --- a/Userland/Libraries/LibWeb/CSS/VisualViewport.cpp +++ b/Userland/Libraries/LibWeb/CSS/VisualViewport.cpp @@ -31,7 +31,7 @@ VisualViewport::VisualViewport(DOM::Document& document) void VisualViewport::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""VisualViewport""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(VisualViewport); } void VisualViewport::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp b/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp index 55da3cb9a439..bb90eceb349c 100644 --- a/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp +++ b/Userland/Libraries/LibWeb/Clipboard/Clipboard.cpp @@ -36,7 +36,7 @@ Clipboard::~Clipboard() = default; void Clipboard::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Clipboard""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Clipboard); } // https://w3c.github.io/clipboard-apis/#os-specific-well-known-format diff --git a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp index 21a99a3f7ff4..ddb1fe1861d1 100644 --- a/Userland/Libraries/LibWeb/Crypto/Crypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/Crypto.cpp @@ -33,7 +33,7 @@ Crypto::~Crypto() = default; void Crypto::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Crypto""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Crypto); m_subtle = SubtleCrypto::create(realm); } diff --git a/Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp b/Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp index 59212c4ef53d..d70919db0721 100644 --- a/Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp +++ b/Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp @@ -38,7 +38,7 @@ CryptoKey::~CryptoKey() void CryptoKey::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CryptoKey""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CryptoKey); } void CryptoKey::visit_edges(Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 32f26d67ed85..fce5f418f817 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -44,7 +44,7 @@ SubtleCrypto::~SubtleCrypto() = default; void SubtleCrypto::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SubtleCrypto""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SubtleCrypto); } // https://w3c.github.io/webcrypto/#dfn-normalize-an-algorithm diff --git a/Userland/Libraries/LibWeb/DOM/AbortController.cpp b/Userland/Libraries/LibWeb/DOM/AbortController.cpp index 324b4cb378f1..4b518e788f93 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortController.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortController.cpp @@ -30,7 +30,7 @@ AbortController::~AbortController() = default; void AbortController::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AbortController""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AbortController); } void AbortController::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp index 0b5df2fb26cb..caf638687e7f 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp @@ -30,7 +30,7 @@ AbortSignal::AbortSignal(JS::Realm& realm) void AbortSignal::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AbortSignal""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AbortSignal); } // https://dom.spec.whatwg.org/#abortsignal-add diff --git a/Userland/Libraries/LibWeb/DOM/AbstractRange.cpp b/Userland/Libraries/LibWeb/DOM/AbstractRange.cpp index 9a99a7cc6272..03172f359a45 100644 --- a/Userland/Libraries/LibWeb/DOM/AbstractRange.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbstractRange.cpp @@ -24,7 +24,7 @@ AbstractRange::~AbstractRange() = default; void AbstractRange::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AbstractRange""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AbstractRange); } void AbstractRange::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/Attr.cpp b/Userland/Libraries/LibWeb/DOM/Attr.cpp index 0c07d9e87629..9f778252fb67 100644 --- a/Userland/Libraries/LibWeb/DOM/Attr.cpp +++ b/Userland/Libraries/LibWeb/DOM/Attr.cpp @@ -44,7 +44,7 @@ Attr::Attr(Document& document, QualifiedName qualified_name, String value, Eleme void Attr::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Attr""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Attr); } void Attr::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp index c7b8491abf04..78051696d20c 100644 --- a/Userland/Libraries/LibWeb/DOM/CDATASection.cpp +++ b/Userland/Libraries/LibWeb/DOM/CDATASection.cpp @@ -21,7 +21,7 @@ CDATASection::~CDATASection() = default; void CDATASection::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CDATASection""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CDATASection); } } diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp index 2d3b8aaa7ac0..230c0f8363c5 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.cpp +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.cpp @@ -25,7 +25,7 @@ CharacterData::CharacterData(Document& document, NodeType type, String const& da void CharacterData::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CharacterData""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CharacterData); } // https://dom.spec.whatwg.org/#dom-characterdata-data diff --git a/Userland/Libraries/LibWeb/DOM/Comment.cpp b/Userland/Libraries/LibWeb/DOM/Comment.cpp index 63f174e0d5fa..af33e0e460d7 100644 --- a/Userland/Libraries/LibWeb/DOM/Comment.cpp +++ b/Userland/Libraries/LibWeb/DOM/Comment.cpp @@ -28,7 +28,7 @@ WebIDL::ExceptionOr> Comment::construct_impl(JS::Realm void Comment::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Comment""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Comment); } } diff --git a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp index e22480f24a08..1bdfede699d3 100644 --- a/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp +++ b/Userland/Libraries/LibWeb/DOM/CustomEvent.cpp @@ -34,7 +34,7 @@ CustomEvent::~CustomEvent() = default; void CustomEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CustomEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CustomEvent); } void CustomEvent::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp index 7cbeca47473d..a6a05212801f 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMImplementation.cpp @@ -37,7 +37,7 @@ DOMImplementation::~DOMImplementation() = default; void DOMImplementation::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMImplementation""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMImplementation); } void DOMImplementation::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp index aa4d9351e8e0..fbaf9e101e9f 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp @@ -74,7 +74,7 @@ DOMTokenList::DOMTokenList(Element& associated_element, FlyString associated_att void DOMTokenList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMTokenList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMTokenList); } void DOMTokenList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 6bb5342d1f8f..6af8fe3eccb8 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -374,7 +374,7 @@ Document::~Document() void Document::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Document""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Document); m_selection = heap().allocate(realm, realm, *this); diff --git a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp index 58a0f1754a2a..085c9e34a8c1 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentFragment.cpp @@ -19,7 +19,7 @@ DocumentFragment::DocumentFragment(Document& document) void DocumentFragment::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DocumentFragment""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DocumentFragment); } void DocumentFragment::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp index 925f48d3b6ff..834cd27761bf 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.cpp +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.cpp @@ -24,7 +24,7 @@ DocumentType::DocumentType(Document& document) void DocumentType::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DocumentType""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DocumentType); } } diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 1fe2e8132da3..857bde12c453 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -82,7 +82,7 @@ Element::~Element() = default; void Element::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Element""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Element); m_attributes = NamedNodeMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp index 4a13e479f734..192c54df1423 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.cpp +++ b/Userland/Libraries/LibWeb/DOM/Event.cpp @@ -46,7 +46,7 @@ Event::Event(JS::Realm& realm, FlyString const& type, EventInit const& event_ini void Event::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Event""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Event); } void Event::visit_edges(Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp index 1f44b67a486a..6173efd76069 100644 --- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp @@ -59,7 +59,7 @@ void EventTarget::initialize(JS::Realm& realm) // FIXME: We can't do this for HTML::Window or HTML::WorkerGlobalScope, as this will run when creating the initial global object. // During this time, the ESO is not setup, so it will cause a nullptr dereference in host_defined_intrinsics. if (!is(this)) - set_prototype(&Bindings::ensure_web_prototype(realm, ""EventTarget""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(EventTarget); } void EventTarget::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp index e508db036489..b899f20c60c7 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp @@ -38,7 +38,7 @@ HTMLCollection::~HTMLCollection() = default; void HTMLCollection::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLCollection""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLCollection); } void HTMLCollection::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp index c327f996b6db..86db7f9d0d29 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp +++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp @@ -29,7 +29,7 @@ HTMLFormControlsCollection::~HTMLFormControlsCollection() = default; void HTMLFormControlsCollection::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFormControlsCollection""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFormControlsCollection); } // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmlformcontrolscollection-nameditem diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp index db69ea2256ea..b1bffc92ade9 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp @@ -42,7 +42,7 @@ MutationObserver::~MutationObserver() void MutationObserver::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MutationObserver""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MutationObserver); } void MutationObserver::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp index 3c8c3b7f0f0a..261856f6bd19 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationRecord.cpp @@ -38,7 +38,7 @@ MutationRecord::~MutationRecord() = default; void MutationRecord::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MutationRecord""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MutationRecord); } void MutationRecord::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp index 581427f23c3a..e95f2c967d1c 100644 --- a/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp +++ b/Userland/Libraries/LibWeb/DOM/NamedNodeMap.cpp @@ -36,7 +36,7 @@ NamedNodeMap::NamedNodeMap(Element& element) void NamedNodeMap::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NamedNodeMap""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NamedNodeMap); } void NamedNodeMap::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp index 220087ae5ce0..fe3f6753f9a3 100644 --- a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp +++ b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp @@ -26,7 +26,7 @@ NodeIterator::~NodeIterator() = default; void NodeIterator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NodeIterator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NodeIterator); } void NodeIterator::finalize() diff --git a/Userland/Libraries/LibWeb/DOM/NodeList.cpp b/Userland/Libraries/LibWeb/DOM/NodeList.cpp index 899cecd5aa71..ce2ad6addadd 100644 --- a/Userland/Libraries/LibWeb/DOM/NodeList.cpp +++ b/Userland/Libraries/LibWeb/DOM/NodeList.cpp @@ -21,7 +21,7 @@ NodeList::~NodeList() = default; void NodeList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NodeList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NodeList); } WebIDL::ExceptionOr NodeList::item_value(size_t index) const diff --git a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp index 64da6f890778..5a662cd88640 100644 --- a/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp +++ b/Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp @@ -22,7 +22,7 @@ ProcessingInstruction::ProcessingInstruction(Document& document, String const& d void ProcessingInstruction::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ProcessingInstruction""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ProcessingInstruction); } } diff --git a/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp b/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp index 24b563dab5a0..03a09d16157e 100644 --- a/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp +++ b/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp @@ -29,7 +29,7 @@ RadioNodeList::~RadioNodeList() = default; void RadioNodeList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""RadioNodeList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(RadioNodeList); } static HTML::HTMLInputElement const* radio_button(Node const& node) diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp index ef13773e1f3c..fdfd78e688b4 100644 --- a/Userland/Libraries/LibWeb/DOM/Range.cpp +++ b/Userland/Libraries/LibWeb/DOM/Range.cpp @@ -78,7 +78,7 @@ Range::~Range() void Range::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Range""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Range); } void Range::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp index 9de779f3669a..222d03a76efb 100644 --- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp +++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp @@ -32,7 +32,7 @@ void ShadowRoot::finalize() void ShadowRoot::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ShadowRoot""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ShadowRoot); } // https://dom.spec.whatwg.org/#ref-for-get-the-parent%E2%91%A6 diff --git a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp index bd113c1a9b90..ff9c5d3f4dd5 100644 --- a/Userland/Libraries/LibWeb/DOM/StaticRange.cpp +++ b/Userland/Libraries/LibWeb/DOM/StaticRange.cpp @@ -40,7 +40,7 @@ WebIDL::ExceptionOr> StaticRange::construct_impl(J void StaticRange::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""StaticRange""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(StaticRange); } } diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp index 739ab63e69f8..b9a6921acc88 100644 --- a/Userland/Libraries/LibWeb/DOM/Text.cpp +++ b/Userland/Libraries/LibWeb/DOM/Text.cpp @@ -28,7 +28,7 @@ Text::Text(Document& document, NodeType type, String const& data) void Text::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Text""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Text); } void Text::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp index 00d58b69f1c1..9aff7a8f1827 100644 --- a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp +++ b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp @@ -27,7 +27,7 @@ TreeWalker::~TreeWalker() = default; void TreeWalker::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TreeWalker""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TreeWalker); } void TreeWalker::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp b/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp index 13804e030e2e..4c58d3d8d4c7 100644 --- a/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp +++ b/Userland/Libraries/LibWeb/DOM/XMLDocument.cpp @@ -24,7 +24,7 @@ XMLDocument::XMLDocument(JS::Realm& realm, URL const& url) void XMLDocument::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""XMLDocument""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(XMLDocument); } } diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp index ea076a784877..95510129a667 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp @@ -40,7 +40,7 @@ XMLSerializer::~XMLSerializer() = default; void XMLSerializer::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""XMLSerializer""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(XMLSerializer); } // https://w3c.github.io/DOM-Parsing/#dom-xmlserializer-serializetostring diff --git a/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp index d6d5969ebb29..099c104431c6 100644 --- a/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/DOMURL.cpp @@ -87,7 +87,7 @@ DOMURL::~DOMURL() = default; void DOMURL::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""URL""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(DOMURL, URL); } void DOMURL::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp index 581aab762851..4ce11ff24248 100644 --- a/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParams.cpp @@ -30,7 +30,7 @@ URLSearchParams::~URLSearchParams() = default; void URLSearchParams::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""URLSearchParams""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(URLSearchParams); } void URLSearchParams::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp b/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp index 7f48f4dd3fe0..b2f03fa7d9fe 100644 --- a/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp +++ b/Userland/Libraries/LibWeb/DOMURL/URLSearchParamsIterator.cpp @@ -42,7 +42,7 @@ URLSearchParamsIterator::~URLSearchParamsIterator() = default; void URLSearchParamsIterator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""URLSearchParamsIterator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(URLSearchParamsIterator); } void URLSearchParamsIterator::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp index 0166fa7407f4..f8ddc655b6fd 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp @@ -41,7 +41,7 @@ TextDecoder::~TextDecoder() = default; void TextDecoder::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TextDecoder""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TextDecoder); } // https://encoding.spec.whatwg.org/#dom-textdecoder-decode diff --git a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp index b2c4f8d84319..731f3ca1f93b 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextEncoder.cpp @@ -28,7 +28,7 @@ TextEncoder::~TextEncoder() = default; void TextEncoder::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TextEncoder""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TextEncoder); } // https://encoding.spec.whatwg.org/#dom-textencoder-encode diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp index 011c9bbe952c..fd66ed5d3ffb 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp @@ -42,7 +42,7 @@ Headers::~Headers() = default; void Headers::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Headers""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Headers); } void Headers::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp index d0330b2cfe59..cc5b978c5d96 100644 --- a/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp +++ b/Userland/Libraries/LibWeb/Fetch/HeadersIterator.cpp @@ -42,7 +42,7 @@ HeadersIterator::~HeadersIterator() = default; void HeadersIterator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HeadersIterator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HeadersIterator); } void HeadersIterator::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index c652a4e9480a..ef9dd3e9a61d 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -34,7 +34,7 @@ Request::~Request() = default; void Request::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Request""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Request); } void Request::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index 80c80681b9e6..a86beae7603f 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -31,7 +31,7 @@ Response::~Response() = default; void Response::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Response""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Response); } void Response::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index 4dabe0385e0f..f13c649f9584 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -146,7 +146,7 @@ Blob::~Blob() = default; void Blob::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Blob""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Blob); } WebIDL::ExceptionOr Blob::serialization_steps(HTML::SerializationRecord& record, bool) diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp index 5e882789cf26..507f5e47a08a 100644 --- a/Userland/Libraries/LibWeb/FileAPI/File.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp @@ -29,7 +29,7 @@ File::File(JS::Realm& realm) void File::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""File""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(File); } File::~File() = default; diff --git a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp index 47fc192d9872..50f529ff377a 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileList.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileList.cpp @@ -30,7 +30,7 @@ FileList::~FileList() = default; void FileList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FileList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FileList); } // https://w3c.github.io/FileAPI/#dfn-item diff --git a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp index e52a842d7696..a939beee3e8b 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp @@ -42,7 +42,7 @@ FileReader::FileReader(JS::Realm& realm) void FileReader::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FileReader""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FileReader); } void FileReader::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp b/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp index c1c4c599e340..b974f5ee1000 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMMatrix.cpp @@ -138,7 +138,7 @@ DOMMatrix::~DOMMatrix() = default; void DOMMatrix::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMMatrix""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMMatrix); } // https://drafts.fxtf.org/geometry/#dom-dommatrix-frommatrix diff --git a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp index 6dcc89c1e8e1..90aee5e71478 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp @@ -139,7 +139,7 @@ DOMMatrixReadOnly::~DOMMatrixReadOnly() = default; void DOMMatrixReadOnly::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMMatrixReadOnly""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMMatrixReadOnly); } // https://drafts.fxtf.org/geometry/#create-a-2d-matrix diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp index fb30785437ee..c77c2eaf906a 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp @@ -34,7 +34,7 @@ DOMPoint::~DOMPoint() = default; void DOMPoint::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMPoint""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMPoint); } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp index b6db2e5cc659..035b4ef28350 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.cpp @@ -50,7 +50,7 @@ WebIDL::ExceptionOr> DOMPointReadOnly::matrix_transfo void DOMPointReadOnly::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMPointReadOnly""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMPointReadOnly); } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMQuad.cpp b/Userland/Libraries/LibWeb/Geometry/DOMQuad.cpp index 09aa32472b61..1cc24aea643a 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMQuad.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMQuad.cpp @@ -87,7 +87,7 @@ JS::NonnullGCPtr DOMQuad::get_bounds() const void DOMQuad::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMQuad""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMQuad); } void DOMQuad::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp index bfd627e41482..53be04b73c2a 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRect.cpp @@ -39,7 +39,7 @@ DOMRect::~DOMRect() = default; void DOMRect::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMRect""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMRect); } } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp index c3423b18eaf0..28a46fdc6e0b 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectList.cpp @@ -34,7 +34,7 @@ DOMRectList::~DOMRectList() = default; void DOMRectList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMRectList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMRectList); } void DOMRectList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp index 09d06658417d..5bc74203274d 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp @@ -35,7 +35,7 @@ DOMRectReadOnly::~DOMRectReadOnly() = default; void DOMRectReadOnly::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMRectReadOnly""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMRectReadOnly); } } diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp index dce51667c8b9..6ec2a531f50e 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp @@ -50,7 +50,7 @@ AudioTrack::~AudioTrack() void AudioTrack::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AudioTrack""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioTrack); auto id = s_audio_track_id_allocator.allocate(); m_id = MUST(String::number(id)); diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp b/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp index 218eff9b7304..2748a3f8062f 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp +++ b/Userland/Libraries/LibWeb/HTML/AudioTrackList.cpp @@ -24,7 +24,7 @@ AudioTrackList::AudioTrackList(JS::Realm& realm) void AudioTrackList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AudioTrackList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioTrackList); } // https://html.spec.whatwg.org/multipage/media.html#dom-tracklist-item diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp index 67d4e5b4868c..2819fc09d31a 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp @@ -52,7 +52,7 @@ CanvasGradient::~CanvasGradient() = default; void CanvasGradient::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CanvasGradient""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CanvasGradient); } // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop diff --git a/Userland/Libraries/LibWeb/HTML/CanvasPattern.cpp b/Userland/Libraries/LibWeb/HTML/CanvasPattern.cpp index 72bc546c21b6..c36fd92fc39a 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasPattern.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasPattern.cpp @@ -138,7 +138,7 @@ WebIDL::ExceptionOr> CanvasPattern::create(JS::Realm& r void CanvasPattern::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CanvasPattern""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CanvasPattern); } } diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp index bfea23eab0ea..b0b46ae03f21 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp @@ -34,7 +34,7 @@ CloseEvent::~CloseEvent() = default; void CloseEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CloseEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CloseEvent); } } diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index 614ad80b6234..06d232bfbe6a 100644 --- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp +++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp @@ -33,7 +33,7 @@ CustomElementRegistry::~CustomElementRegistry() = default; void CustomElementRegistry::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CustomElementRegistry""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CustomElementRegistry); } void CustomElementRegistry::visit_edges(Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp index e61fecee5cfc..6cf711d649e5 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp @@ -33,7 +33,7 @@ DOMParser::~DOMParser() = default; void DOMParser::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMParser""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMParser); } // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring diff --git a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp index fe37def2c540..685827306816 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMStringMap.cpp @@ -37,7 +37,7 @@ DOMStringMap::~DOMStringMap() = default; void DOMStringMap::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMStringMap""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMStringMap); } void DOMStringMap::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/DataTransfer.cpp b/Userland/Libraries/LibWeb/HTML/DataTransfer.cpp index 091a3ee22175..2b6370185e18 100644 --- a/Userland/Libraries/LibWeb/HTML/DataTransfer.cpp +++ b/Userland/Libraries/LibWeb/HTML/DataTransfer.cpp @@ -27,7 +27,7 @@ DataTransfer::~DataTransfer() = default; void DataTransfer::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DataTransfer""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DataTransfer); } } diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp index e5d71da44b05..5606bfdb154f 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp @@ -36,7 +36,7 @@ ErrorEvent::~ErrorEvent() = default; void ErrorEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ErrorEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ErrorEvent); } void ErrorEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/FormDataEvent.cpp b/Userland/Libraries/LibWeb/HTML/FormDataEvent.cpp index 64f6a74a6688..95e4992aac68 100644 --- a/Userland/Libraries/LibWeb/HTML/FormDataEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/FormDataEvent.cpp @@ -28,7 +28,7 @@ FormDataEvent::~FormDataEvent() = default; void FormDataEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FormDataEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FormDataEvent); } void FormDataEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index a28027dc9607..56516ed247fb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -23,7 +23,7 @@ HTMLAnchorElement::~HTMLAnchorElement() = default; void HTMLAnchorElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLAnchorElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAnchorElement); } void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index 532c9034cf5a..3654d7c7bd21 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -22,7 +22,7 @@ HTMLAreaElement::~HTMLAreaElement() = default; void HTMLAreaElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLAreaElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAreaElement); } void HTMLAreaElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp index 35d4bbcf60ca..5a7bd7ca127f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp @@ -24,7 +24,7 @@ HTMLAudioElement::~HTMLAudioElement() = default; void HTMLAudioElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLAudioElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLAudioElement); } JS::GCPtr HTMLAudioElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp index ed44de780c53..b1c2e002aa2e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -22,7 +22,7 @@ HTMLBRElement::~HTMLBRElement() = default; void HTMLBRElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLBRElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBRElement); } JS::GCPtr HTMLBRElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index d6e7c1691cb4..26fc0290f463 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -21,7 +21,7 @@ HTMLBaseElement::~HTMLBaseElement() = default; void HTMLBaseElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLBaseElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBaseElement); } void HTMLBaseElement::inserted() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 77613fe38582..377e3f9ee022 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -35,7 +35,7 @@ void HTMLBodyElement::visit_edges(Visitor& visitor) void HTMLBodyElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLBodyElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLBodyElement); } void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index 03a43eb5fd8a..c44a4d2652d9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -22,7 +22,7 @@ HTMLButtonElement::~HTMLButtonElement() = default; void HTMLButtonElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLButtonElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLButtonElement); } HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 0d111573e8c8..72a6123dc22d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -40,7 +40,7 @@ HTMLCanvasElement::~HTMLCanvasElement() = default; void HTMLCanvasElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLCanvasElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLCanvasElement); } void HTMLCanvasElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp index c475227bd917..8283a093068f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp @@ -21,7 +21,7 @@ HTMLDListElement::~HTMLDListElement() = default; void HTMLDListElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDListElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDListElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp index df15102d509c..35f96252e69f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp @@ -21,7 +21,7 @@ HTMLDataElement::~HTMLDataElement() = default; void HTMLDataElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDataElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDataElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp index f5ee101fc8fe..45191c3977d4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp @@ -21,7 +21,7 @@ HTMLDataListElement::~HTMLDataListElement() = default; void HTMLDataListElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDataListElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDataListElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp index 23110e1ebce0..e617970ec470 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp @@ -38,7 +38,7 @@ void HTMLDetailsElement::visit_edges(Cell::Visitor& visitor) void HTMLDetailsElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDetailsElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDetailsElement); } void HTMLDetailsElement::inserted() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index 18642c58d5c2..4f9d08679d92 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -23,7 +23,7 @@ HTMLDialogElement::~HTMLDialogElement() = default; void HTMLDialogElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDialogElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDialogElement); } // https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-show diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp index 8729794e561e..8ff6f957d170 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp @@ -21,7 +21,7 @@ HTMLDirectoryElement::~HTMLDirectoryElement() = default; void HTMLDirectoryElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDirectoryElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDirectoryElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp index 205122d03b07..9ad3a24263c6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp @@ -40,7 +40,7 @@ void HTMLDivElement::apply_presentational_hints(CSS::StyleProperties& style) con void HTMLDivElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDivElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDivElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp index b890e57bbb16..601a70ee9782 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp @@ -30,7 +30,7 @@ JS::NonnullGCPtr HTMLDocument::create(JS::Realm& realm, URL const& void HTMLDocument::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLDocument""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLDocument); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 839e4e838c9a..d8003b881b17 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -48,7 +48,7 @@ HTMLElement::~HTMLElement() = default; void HTMLElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLElement); m_dataset = DOMStringMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp index 67dd6941bcf1..afebbc03e9e5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp @@ -21,7 +21,7 @@ HTMLEmbedElement::~HTMLEmbedElement() = default; void HTMLEmbedElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLEmbedElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLEmbedElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp index d3b371a5edec..eb70c8555c72 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp @@ -28,7 +28,7 @@ HTMLFieldSetElement::~HTMLFieldSetElement() = default; void HTMLFieldSetElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFieldSetElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFieldSetElement); } void HTMLFieldSetElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index ff998a5d32a3..9e6e46205bd3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -108,7 +108,7 @@ HTMLFontElement::~HTMLFontElement() = default; void HTMLFontElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFontElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFontElement); } void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index e973b6194cc7..a43dbe46a935 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -52,7 +52,7 @@ HTMLFormElement::~HTMLFormElement() = default; void HTMLFormElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFormElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFormElement); } void HTMLFormElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp index 570cdbfdc4d8..fb64b872859d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp @@ -21,7 +21,7 @@ HTMLFrameElement::~HTMLFrameElement() = default; void HTMLFrameElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFrameElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameElement); } // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp index bf9fcf04b3bb..0603b4a90417 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp @@ -22,7 +22,7 @@ HTMLFrameSetElement::~HTMLFrameSetElement() = default; void HTMLFrameSetElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLFrameSetElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameSetElement); } void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp index 421108bb3acc..f1f176be01dc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp @@ -21,7 +21,7 @@ HTMLHRElement::~HTMLHRElement() = default; void HTMLHRElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLHRElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLHRElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp index dad17f877f19..5cadf5359173 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp @@ -21,7 +21,7 @@ HTMLHeadElement::~HTMLHeadElement() = default; void HTMLHeadElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLHeadElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLHeadElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index 613e5b76d128..59835cf6b469 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -23,7 +23,7 @@ HTMLHeadingElement::~HTMLHeadingElement() = default; void HTMLHeadingElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLHeadingElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLHeadingElement); } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp index 6274dcd44d24..5470f9ec7709 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp @@ -22,7 +22,7 @@ HTMLHtmlElement::~HTMLHtmlElement() = default; void HTMLHtmlElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLHtmlElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLHtmlElement); } bool HTMLHtmlElement::should_use_body_background_properties() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index da0764c4e492..842b2b8cf0e3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -28,7 +28,7 @@ HTMLIFrameElement::~HTMLIFrameElement() = default; void HTMLIFrameElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLIFrameElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLIFrameElement); } JS::GCPtr HTMLIFrameElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 280a9f666409..ac1215e92c98 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -55,7 +55,7 @@ void HTMLImageElement::finalize() void HTMLImageElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLImageElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLImageElement); m_current_request = ImageRequest::create(realm, document().page()); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 61c62e254192..6aaeee35ca71 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -62,7 +62,7 @@ HTMLInputElement::~HTMLInputElement() = default; void HTMLInputElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLInputElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLInputElement); } void HTMLInputElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp index b51f0d5ea0e7..13f0a3ba2577 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp @@ -21,7 +21,7 @@ HTMLLIElement::~HTMLLIElement() = default; void HTMLLIElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLLIElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLIElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 95a41f7539a1..411a4279b8f9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -22,7 +22,7 @@ HTMLLabelElement::~HTMLLabelElement() = default; void HTMLLabelElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLLabelElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLabelElement); } JS::GCPtr HTMLLabelElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp index 84362407b9c4..aaedddd478f1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp @@ -22,7 +22,7 @@ HTMLLegendElement::~HTMLLegendElement() = default; void HTMLLegendElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLLegendElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLegendElement); } // https://html.spec.whatwg.org/multipage/form-elements.html#dom-legend-form diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index 5d1e03db36d6..9a5e25a5633f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -43,7 +43,7 @@ HTMLLinkElement::~HTMLLinkElement() = default; void HTMLLinkElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLLinkElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLinkElement); } void HTMLLinkElement::inserted() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp index c39ad4b73a5e..99515fa882b6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp @@ -21,7 +21,7 @@ HTMLMapElement::~HTMLMapElement() = default; void HTMLMapElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMapElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMapElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index d386096fe53d..ac39cb23b7d0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -24,7 +24,7 @@ HTMLMarqueeElement::~HTMLMarqueeElement() = default; void HTMLMarqueeElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMarqueeElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMarqueeElement); } void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 4d9193a7a88e..0b4265808bce 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -51,7 +51,7 @@ HTMLMediaElement::~HTMLMediaElement() = default; void HTMLMediaElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMediaElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMediaElement); m_audio_tracks = realm.heap().allocate(realm, realm); m_video_tracks = realm.heap().allocate(realm, realm); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp index e034025a8c8e..06846b6379a9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp @@ -21,7 +21,7 @@ HTMLMenuElement::~HTMLMenuElement() = default; void HTMLMenuElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMenuElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMenuElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index 2bf21c45e585..503bbf26a2cc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -29,7 +29,7 @@ HTMLMetaElement::~HTMLMetaElement() = default; void HTMLMetaElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMetaElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMetaElement); } Optional HTMLMetaElement::http_equiv_state() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp index e677cdbbd3fd..abc3a5c94879 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp @@ -26,7 +26,7 @@ HTMLMeterElement::~HTMLMeterElement() = default; void HTMLMeterElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLMeterElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLMeterElement); } void HTMLMeterElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp index 6925ef7cda17..76f5713f4c10 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp @@ -22,7 +22,7 @@ HTMLModElement::~HTMLModElement() = default; void HTMLModElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLModElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLModElement); } Optional HTMLModElement::default_role() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp index 43fa8c7af933..db264c36467f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp @@ -21,7 +21,7 @@ HTMLOListElement::~HTMLOListElement() = default; void HTMLOListElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLOListElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOListElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index f1d50ccb4bc2..cc90332ca7e2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -39,7 +39,7 @@ HTMLObjectElement::~HTMLObjectElement() = default; void HTMLObjectElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLObjectElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLObjectElement); } void HTMLObjectElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp index 9a06b7f36f8b..95ca8ae293a4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp @@ -21,7 +21,7 @@ HTMLOptGroupElement::~HTMLOptGroupElement() = default; void HTMLOptGroupElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLOptGroupElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptGroupElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index 122c01685b41..b5b14ef25126 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -30,7 +30,7 @@ HTMLOptionElement::~HTMLOptionElement() = default; void HTMLOptionElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLOptionElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptionElement); } void HTMLOptionElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp index b257f4068181..4a2ff0eb406a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp @@ -30,7 +30,7 @@ HTMLOptionsCollection::~HTMLOptionsCollection() = default; void HTMLOptionsCollection::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLOptionsCollection""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptionsCollection); } // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-add diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp index b12bcf0ab807..4dcd3c11a869 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp @@ -21,7 +21,7 @@ HTMLOutputElement::~HTMLOutputElement() = default; void HTMLOutputElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLOutputElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOutputElement); } // https://html.spec.whatwg.org/multipage/form-elements.html#dom-output-defaultvalue diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index 6b06962d39c6..4894f0558e2e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -23,7 +23,7 @@ HTMLParagraphElement::~HTMLParagraphElement() = default; void HTMLParagraphElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLParagraphElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLParagraphElement); } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp index d1d672b4781a..af976e1cadda 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp @@ -21,7 +21,7 @@ HTMLParamElement::~HTMLParamElement() = default; void HTMLParamElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLParamElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLParamElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp index 57cea48918db..7a40a1450504 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp @@ -21,7 +21,7 @@ HTMLPictureElement::~HTMLPictureElement() = default; void HTMLPictureElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLPictureElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLPictureElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index ee2c2e7cf82a..b14d38b060cd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -24,7 +24,7 @@ HTMLPreElement::~HTMLPreElement() = default; void HTMLPreElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLPreElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLPreElement); } void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index bf394a134e89..c0629e1c0394 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -27,7 +27,7 @@ HTMLProgressElement::~HTMLProgressElement() = default; void HTMLProgressElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLProgressElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLProgressElement); } void HTMLProgressElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp index 312f4abda804..91f0073161e8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp @@ -23,7 +23,7 @@ HTMLQuoteElement::~HTMLQuoteElement() = default; void HTMLQuoteElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLQuoteElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLQuoteElement); } Optional HTMLQuoteElement::default_role() const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 57eb0c759618..31ba38b5622b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -35,7 +35,7 @@ HTMLScriptElement::~HTMLScriptElement() = default; void HTMLScriptElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLScriptElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLScriptElement); } void HTMLScriptElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 4bc8958cf21f..46ccb9a5da53 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -37,7 +37,7 @@ HTMLSelectElement::~HTMLSelectElement() = default; void HTMLSelectElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLSelectElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLSelectElement); } void HTMLSelectElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp index 4a52fc9cf262..edb0a3910bf5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp @@ -24,7 +24,7 @@ HTMLSlotElement::~HTMLSlotElement() = default; void HTMLSlotElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLSlotElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLSlotElement); } void HTMLSlotElement::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp index 5ac4a955ba80..c11cd04cb882 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp @@ -23,7 +23,7 @@ HTMLSourceElement::~HTMLSourceElement() = default; void HTMLSourceElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLSourceElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLSourceElement); } // https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element:the-source-element-15 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp index 5999fee08286..3718131ff4e8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp @@ -21,7 +21,7 @@ HTMLSpanElement::~HTMLSpanElement() = default; void HTMLSpanElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLSpanElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLSpanElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 3134fd39202d..13798f7cd9d6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -21,7 +21,7 @@ HTMLStyleElement::~HTMLStyleElement() = default; void HTMLStyleElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLStyleElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLStyleElement); } void HTMLStyleElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 18adcb81ef60..24a6a26bf6e0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -23,7 +23,7 @@ HTMLTableCaptionElement::~HTMLTableCaptionElement() = default; void HTMLTableCaptionElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableCaptionElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableCaptionElement); } // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index e283c4cea10d..0a02c7104b7c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -31,7 +31,7 @@ HTMLTableCellElement::~HTMLTableCellElement() = default; void HTMLTableCellElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableCellElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableCellElement); } void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp index b8123c50cc1d..c14b9ca3b259 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp @@ -22,7 +22,7 @@ HTMLTableColElement::~HTMLTableColElement() = default; void HTMLTableColElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableColElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableColElement); } // https://html.spec.whatwg.org/multipage/tables.html#dom-colgroup-span diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 2161e219a7c4..85c9a4aee684 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -34,7 +34,7 @@ HTMLTableElement::~HTMLTableElement() = default; void HTMLTableElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableElement); } void HTMLTableElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index c917b27fb4d1..ca544937ebf7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -35,7 +35,7 @@ HTMLTableRowElement::~HTMLTableRowElement() = default; void HTMLTableRowElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableRowElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableRowElement); } void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index cd1a71f688e0..332283d6c8e6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -26,7 +26,7 @@ HTMLTableSectionElement::~HTMLTableSectionElement() = default; void HTMLTableSectionElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTableSectionElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTableSectionElement); } void HTMLTableSectionElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp index 0fccdfc10522..0cfb8118615c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp @@ -22,7 +22,7 @@ HTMLTemplateElement::~HTMLTemplateElement() = default; void HTMLTemplateElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTemplateElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTemplateElement); m_content = heap().allocate(realm, m_document->appropriate_template_contents_owner_document()); m_content->set_host(this); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index e059950b3f1c..05ac71e2d51b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -52,7 +52,7 @@ void HTMLTextAreaElement::adjust_computed_style(CSS::StyleProperties& style) void HTMLTextAreaElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTextAreaElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTextAreaElement); } void HTMLTextAreaElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp index 69f9151c011e..1937644bd7a9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp @@ -19,7 +19,7 @@ HTMLTimeElement::HTMLTimeElement(DOM::Document& document, DOM::QualifiedName qua void HTMLTimeElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTimeElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTimeElement); } HTMLTimeElement::~HTMLTimeElement() = default; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp index a65e15158ecf..47e989c1a584 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp @@ -23,7 +23,7 @@ HTMLTitleElement::~HTMLTitleElement() = default; void HTMLTitleElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTitleElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTitleElement); } void HTMLTitleElement::children_changed() diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp index 09c983b04d71..1f4b6403915d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp @@ -21,7 +21,7 @@ HTMLTrackElement::~HTMLTrackElement() = default; void HTMLTrackElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLTrackElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTrackElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp index 6488b8c0b948..93f5ba426521 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp @@ -21,7 +21,7 @@ HTMLUListElement::~HTMLUListElement() = default; void HTMLUListElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLUListElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLUListElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp index 2e5d0102d5cb..94fcbe451269 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp @@ -21,7 +21,7 @@ HTMLUnknownElement::~HTMLUnknownElement() = default; void HTMLUnknownElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLUnknownElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLUnknownElement); } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp index b4f8ad94e0ae..1253455cd869 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp @@ -33,7 +33,7 @@ HTMLVideoElement::~HTMLVideoElement() = default; void HTMLVideoElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""HTMLVideoElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLVideoElement); } void HTMLVideoElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/History.cpp b/Userland/Libraries/LibWeb/HTML/History.cpp index 31bb36efd639..5e6b8a7eaf32 100644 --- a/Userland/Libraries/LibWeb/HTML/History.cpp +++ b/Userland/Libraries/LibWeb/HTML/History.cpp @@ -31,7 +31,7 @@ History::~History() = default; void History::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""History""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(History); } void History::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp index 1fa96c20869b..648de71a04a2 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.cpp +++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp @@ -45,7 +45,7 @@ ImageData::~ImageData() = default; void ImageData::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ImageData""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ImageData); } void ImageData::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Location.cpp b/Userland/Libraries/LibWeb/HTML/Location.cpp index 82ddb7b4116b..c03e199bde46 100644 --- a/Userland/Libraries/LibWeb/HTML/Location.cpp +++ b/Userland/Libraries/LibWeb/HTML/Location.cpp @@ -42,7 +42,7 @@ void Location::visit_edges(Cell::Visitor& visitor) void Location::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Location""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Location); // FIXME: Implement steps 2.-4. diff --git a/Userland/Libraries/LibWeb/HTML/MediaError.cpp b/Userland/Libraries/LibWeb/HTML/MediaError.cpp index 50b335338af8..7f5090481102 100644 --- a/Userland/Libraries/LibWeb/HTML/MediaError.cpp +++ b/Userland/Libraries/LibWeb/HTML/MediaError.cpp @@ -23,7 +23,7 @@ MediaError::MediaError(JS::Realm& realm, Code code, String message) void MediaError::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MediaError""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaError); } } diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp index a3bd14978791..256cef605de1 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp @@ -43,7 +43,7 @@ void MessageChannel::visit_edges(Cell::Visitor& visitor) void MessageChannel::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MessageChannel""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MessageChannel); } MessagePort* MessageChannel::port1() diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp index c5046dfccddb..1f754c62ef1c 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -41,7 +41,7 @@ MessageEvent::~MessageEvent() = default; void MessageEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MessageEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MessageEvent); } void MessageEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp index defc64969b08..f4fef1b06d03 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp @@ -45,7 +45,7 @@ MessagePort::~MessagePort() void MessagePort::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MessagePort""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MessagePort); } void MessagePort::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/MimeType.cpp b/Userland/Libraries/LibWeb/HTML/MimeType.cpp index 571f7ea75e7f..ee12da6d575d 100644 --- a/Userland/Libraries/LibWeb/HTML/MimeType.cpp +++ b/Userland/Libraries/LibWeb/HTML/MimeType.cpp @@ -24,7 +24,7 @@ MimeType::~MimeType() = default; void MimeType::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MimeType""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MimeType); } // https://html.spec.whatwg.org/multipage/system-state.html#concept-mimetype-type diff --git a/Userland/Libraries/LibWeb/HTML/MimeTypeArray.cpp b/Userland/Libraries/LibWeb/HTML/MimeTypeArray.cpp index b55390d758a7..832a0e06ddf9 100644 --- a/Userland/Libraries/LibWeb/HTML/MimeTypeArray.cpp +++ b/Userland/Libraries/LibWeb/HTML/MimeTypeArray.cpp @@ -29,7 +29,7 @@ MimeTypeArray::~MimeTypeArray() = default; void MimeTypeArray::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MimeTypeArray""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MimeTypeArray); } // https://html.spec.whatwg.org/multipage/system-state.html#pdf-viewing-support:support-named-properties-2 diff --git a/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp b/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp index ee1eec390daa..3a63f381a660 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigateEvent.cpp @@ -50,7 +50,7 @@ NavigateEvent::~NavigateEvent() = default; void NavigateEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NavigateEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NavigateEvent); } void NavigateEvent::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Navigation.cpp b/Userland/Libraries/LibWeb/HTML/Navigation.cpp index f78d3b26f6b9..b0ab3321d057 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigation.cpp @@ -76,7 +76,7 @@ Navigation::~Navigation() = default; void Navigation::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Navigation""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Navigation); } void Navigation::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/NavigationCurrentEntryChangeEvent.cpp b/Userland/Libraries/LibWeb/HTML/NavigationCurrentEntryChangeEvent.cpp index f4884eece205..944304e91955 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigationCurrentEntryChangeEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigationCurrentEntryChangeEvent.cpp @@ -32,7 +32,7 @@ NavigationCurrentEntryChangeEvent::~NavigationCurrentEntryChangeEvent() = defaul void NavigationCurrentEntryChangeEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NavigationCurrentEntryChangeEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NavigationCurrentEntryChangeEvent); } void NavigationCurrentEntryChangeEvent::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/NavigationDestination.cpp b/Userland/Libraries/LibWeb/HTML/NavigationDestination.cpp index d42591b1a887..c04dcf7c2104 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigationDestination.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigationDestination.cpp @@ -30,7 +30,7 @@ NavigationDestination::~NavigationDestination() = default; void NavigationDestination::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NavigationDestination""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NavigationDestination); } void NavigationDestination::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp b/Userland/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp index d4f6500a3158..3a1d541e15d1 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp @@ -34,7 +34,7 @@ NavigationHistoryEntry::~NavigationHistoryEntry() = default; void NavigationHistoryEntry::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NavigationHistoryEntry""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NavigationHistoryEntry); } void NavigationHistoryEntry::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/NavigationTransition.cpp b/Userland/Libraries/LibWeb/HTML/NavigationTransition.cpp index 233439ef7417..9d953116b140 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigationTransition.cpp +++ b/Userland/Libraries/LibWeb/HTML/NavigationTransition.cpp @@ -34,7 +34,7 @@ NavigationTransition::~NavigationTransition() = default; void NavigationTransition::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""NavigationTransition""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(NavigationTransition); } void NavigationTransition::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.cpp b/Userland/Libraries/LibWeb/HTML/Navigator.cpp index d60a919f4431..e4da92d0a48d 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigator.cpp @@ -33,7 +33,7 @@ Navigator::~Navigator() = default; void Navigator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Navigator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Navigator); } // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-pdfviewerenabled diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp index da408f86adf9..8e359c8048fb 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp @@ -32,7 +32,7 @@ PageTransitionEvent::~PageTransitionEvent() = default; void PageTransitionEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PageTransitionEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PageTransitionEvent); } } diff --git a/Userland/Libraries/LibWeb/HTML/Plugin.cpp b/Userland/Libraries/LibWeb/HTML/Plugin.cpp index 77b9a95ebee5..6da0e4731577 100644 --- a/Userland/Libraries/LibWeb/HTML/Plugin.cpp +++ b/Userland/Libraries/LibWeb/HTML/Plugin.cpp @@ -30,7 +30,7 @@ Plugin::~Plugin() = default; void Plugin::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Plugin""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Plugin); } // https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin-name diff --git a/Userland/Libraries/LibWeb/HTML/PluginArray.cpp b/Userland/Libraries/LibWeb/HTML/PluginArray.cpp index 69f54007ba16..79104ac199fa 100644 --- a/Userland/Libraries/LibWeb/HTML/PluginArray.cpp +++ b/Userland/Libraries/LibWeb/HTML/PluginArray.cpp @@ -29,7 +29,7 @@ PluginArray::~PluginArray() = default; void PluginArray::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PluginArray""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PluginArray); } // https://html.spec.whatwg.org/multipage/system-state.html#dom-pluginarray-refresh diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp index acdb915d7e99..cb9cd964fdb3 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp @@ -40,7 +40,7 @@ void PromiseRejectionEvent::visit_edges(Cell::Visitor& visitor) void PromiseRejectionEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PromiseRejectionEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PromiseRejectionEvent); } } diff --git a/Userland/Libraries/LibWeb/HTML/Storage.cpp b/Userland/Libraries/LibWeb/HTML/Storage.cpp index 5bdcc03171a5..4c1c3bbade84 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.cpp +++ b/Userland/Libraries/LibWeb/HTML/Storage.cpp @@ -36,7 +36,7 @@ Storage::~Storage() = default; void Storage::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Storage""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Storage); } // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp index 5c3a2b171c54..ea77be544c8d 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp @@ -32,7 +32,7 @@ SubmitEvent::~SubmitEvent() = default; void SubmitEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SubmitEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SubmitEvent); } void SubmitEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp index d7729bd6d35f..c7f7ed45d70e 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp @@ -27,7 +27,7 @@ TextMetrics::~TextMetrics() = default; void TextMetrics::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TextMetrics""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TextMetrics); } } diff --git a/Userland/Libraries/LibWeb/HTML/TimeRanges.cpp b/Userland/Libraries/LibWeb/HTML/TimeRanges.cpp index 5ae17229dce7..0256fb2b0d70 100644 --- a/Userland/Libraries/LibWeb/HTML/TimeRanges.cpp +++ b/Userland/Libraries/LibWeb/HTML/TimeRanges.cpp @@ -21,7 +21,7 @@ TimeRanges::TimeRanges(JS::Realm& realm) void TimeRanges::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TimeRanges""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TimeRanges); } // https://html.spec.whatwg.org/multipage/media.html#dom-timeranges-length diff --git a/Userland/Libraries/LibWeb/HTML/ToggleEvent.cpp b/Userland/Libraries/LibWeb/HTML/ToggleEvent.cpp index e1c1f087a9e5..ab5b33c8d35c 100644 --- a/Userland/Libraries/LibWeb/HTML/ToggleEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/ToggleEvent.cpp @@ -32,7 +32,7 @@ ToggleEvent::ToggleEvent(JS::Realm& realm, FlyString const& event_name, ToggleEv void ToggleEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ToggleEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ToggleEvent); } } diff --git a/Userland/Libraries/LibWeb/HTML/TrackEvent.cpp b/Userland/Libraries/LibWeb/HTML/TrackEvent.cpp index e42548bda2f9..512135089a80 100644 --- a/Userland/Libraries/LibWeb/HTML/TrackEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/TrackEvent.cpp @@ -31,7 +31,7 @@ TrackEvent::TrackEvent(JS::Realm& realm, FlyString const& event_name, TrackEvent void TrackEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TrackEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TrackEvent); } Variant, JS::Handle> TrackEvent::track() const diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp b/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp index 9dec80409a83..d6f598f53a0d 100644 --- a/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp @@ -75,7 +75,7 @@ VideoTrack::~VideoTrack() void VideoTrack::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""VideoTrack""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(VideoTrack); auto id = s_video_track_id_allocator.allocate(); m_id = MUST(String::number(id)); diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp b/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp index ace2faaa54f4..616562de9675 100644 --- a/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp +++ b/Userland/Libraries/LibWeb/HTML/VideoTrackList.cpp @@ -24,7 +24,7 @@ VideoTrackList::VideoTrackList(JS::Realm& realm) void VideoTrackList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""VideoTrackList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(VideoTrackList); } // https://html.spec.whatwg.org/multipage/media.html#dom-tracklist-item diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index c80f5affb34f..10c55fe018aa 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -806,7 +806,7 @@ WebIDL::ExceptionOr Window::initialize_web_interfaces(Badgerealm(); add_window_exposed_interfaces(*this); - Object::set_prototype(&Bindings::ensure_web_prototype(realm, ""Window""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Window); Bindings::WindowGlobalMixin::initialize(realm, *this); WindowOrWorkerGlobalScopeMixin::initialize(realm); diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index bdda083d551f..ca5f5720f41f 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -29,7 +29,7 @@ Worker::Worker(String const& script_url, WorkerOptions const& options, DOM::Docu void Worker::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Worker""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Worker); } void Worker::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp index ad3c772385f3..3267c6ccaacb 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp @@ -37,7 +37,7 @@ void WorkerGlobalScope::initialize_web_interfaces(Badge(realm, ""WorkerGlobalScope""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WorkerGlobalScope); WindowOrWorkerGlobalScopeMixin::initialize(realm); diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp index 1663e031a0a6..40ccac732e91 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp @@ -28,7 +28,7 @@ WorkerNavigator::~WorkerNavigator() = default; void WorkerNavigator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WorkerNavigator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WorkerNavigator); } } diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp index f11cbd8ef139..bd208624e76c 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp +++ b/Userland/Libraries/LibWeb/HighResolutionTime/Performance.cpp @@ -33,7 +33,7 @@ Performance::~Performance() = default; void Performance::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Performance""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Performance); } void Performance::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Internals/Inspector.cpp b/Userland/Libraries/LibWeb/Internals/Inspector.cpp index 2334bd4520f4..761f2c80f9fa 100644 --- a/Userland/Libraries/LibWeb/Internals/Inspector.cpp +++ b/Userland/Libraries/LibWeb/Internals/Inspector.cpp @@ -29,7 +29,7 @@ Inspector::~Inspector() = default; void Inspector::initialize(JS::Realm& realm) { Base::initialize(realm); - Object::set_prototype(&Bindings::ensure_web_prototype(realm, ""Inspector""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Inspector); } void Inspector::inspector_loaded() diff --git a/Userland/Libraries/LibWeb/Internals/Internals.cpp b/Userland/Libraries/LibWeb/Internals/Internals.cpp index c856b615b6d7..523d21f743fe 100644 --- a/Userland/Libraries/LibWeb/Internals/Internals.cpp +++ b/Userland/Libraries/LibWeb/Internals/Internals.cpp @@ -32,7 +32,7 @@ Internals::~Internals() = default; void Internals::initialize(JS::Realm& realm) { Base::initialize(realm); - Object::set_prototype(&Bindings::ensure_web_prototype(realm, ""Internals""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Internals); } void Internals::signal_text_test_is_done() diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp index 28e4c7336787..4309608dd23b 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp @@ -70,7 +70,7 @@ void IntersectionObserver::finalize() void IntersectionObserver::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""IntersectionObserver""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(IntersectionObserver); } void IntersectionObserver::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserverEntry.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserverEntry.cpp index acf6def535f2..705e2a1ee438 100644 --- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserverEntry.cpp +++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserverEntry.cpp @@ -42,7 +42,7 @@ IntersectionObserverEntry::~IntersectionObserverEntry() = default; void IntersectionObserverEntry::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""IntersectionObserverEntry""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(IntersectionObserverEntry); } void IntersectionObserverEntry::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/MathML/MathMLElement.cpp b/Userland/Libraries/LibWeb/MathML/MathMLElement.cpp index 06e1fb1b0c58..c6af7588340a 100644 --- a/Userland/Libraries/LibWeb/MathML/MathMLElement.cpp +++ b/Userland/Libraries/LibWeb/MathML/MathMLElement.cpp @@ -22,7 +22,7 @@ MathMLElement::MathMLElement(DOM::Document& document, DOM::QualifiedName qualifi void MathMLElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MathMLElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MathMLElement); m_dataset = HTML::DOMStringMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp index e259b51030cd..c3a4260c6f9f 100644 --- a/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp +++ b/Userland/Libraries/LibWeb/NavigationTiming/PerformanceTiming.cpp @@ -21,7 +21,7 @@ PerformanceTiming::~PerformanceTiming() = default; void PerformanceTiming::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceTiming""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceTiming); } void PerformanceTiming::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntry.cpp b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntry.cpp index 22872d449b83..cd89a8569375 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntry.cpp +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceEntry.cpp @@ -23,7 +23,7 @@ PerformanceEntry::~PerformanceEntry() = default; void PerformanceEntry::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceEntry""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceEntry); } } diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp index 55ca52f4f9ce..a71807f926c4 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserver.cpp @@ -34,7 +34,7 @@ PerformanceObserver::~PerformanceObserver() = default; void PerformanceObserver::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceObserver""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceObserver); } void PerformanceObserver::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp index 4d0fa9be667e..9ada84eb15d4 100644 --- a/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp +++ b/Userland/Libraries/LibWeb/PerformanceTimeline/PerformanceObserverEntryList.cpp @@ -26,7 +26,7 @@ PerformanceObserverEntryList::~PerformanceObserverEntryList() = default; void PerformanceObserverEntryList::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceObserverEntryList""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceObserverEntryList); } void PerformanceObserverEntryList::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp index 3f0b27726402..d738b14aa529 100644 --- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp +++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp @@ -28,7 +28,7 @@ IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout) void IdleDeadline::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""IdleDeadline""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(IdleDeadline); } IdleDeadline::~IdleDeadline() = default; diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp index f18548b8d576..191867102ec4 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp @@ -36,7 +36,7 @@ ResizeObserver::~ResizeObserver() = default; void ResizeObserver::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ResizeObserver""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ResizeObserver); } void ResizeObserver::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp index 9f04005fa9f4..2c0a4a5640d0 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp @@ -61,7 +61,7 @@ WebIDL::ExceptionOr> ResizeObserverEntry:: void ResizeObserverEntry::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ResizeObserverEntry""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ResizeObserverEntry); } void ResizeObserverEntry::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp index 64cbe591d61f..3b48300efeef 100644 --- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp +++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp @@ -17,7 +17,7 @@ JS_DEFINE_ALLOCATOR(ResizeObserverSize); void ResizeObserverSize::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ResizeObserverSize""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ResizeObserverSize); } // https://drafts.csswg.org/resize-observer-1/#calculate-box-size diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp index 7415dfd8f794..4a12507ed00b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp @@ -30,7 +30,7 @@ SVGAnimatedLength::~SVGAnimatedLength() = default; void SVGAnimatedLength::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGAnimatedLength""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedLength); } void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedNumber.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedNumber.cpp index 4107b84a6afa..76bb3f61c47f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedNumber.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedNumber.cpp @@ -28,7 +28,7 @@ SVGAnimatedNumber::~SVGAnimatedNumber() = default; void SVGAnimatedNumber::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGAnimatedNumber""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedNumber); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedRect.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedRect.cpp index 1735c0b2a0fd..521178f9ebdc 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedRect.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedRect.cpp @@ -23,7 +23,7 @@ SVGAnimatedRect::~SVGAnimatedRect() = default; void SVGAnimatedRect::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGAnimatedRect""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedRect); m_base_val = Geometry::DOMRect::create(realm, { 0, 0, 0, 0 }); m_anim_val = Geometry::DOMRect::create(realm, { 0, 0, 0, 0 }); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedString.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedString.cpp index 83d1c4a1314d..e2d987c87d10 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedString.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedString.cpp @@ -33,7 +33,7 @@ SVGAnimatedString::~SVGAnimatedString() = default; void SVGAnimatedString::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGAnimatedString""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedString); } void SVGAnimatedString::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp index 0f2d750238b8..cb3a21b5e46b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp @@ -24,7 +24,7 @@ SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName q void SVGCircleElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGCircleElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGCircleElement); } void SVGCircleElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp index a9d61e3d776d..f59b0cfa1856 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp @@ -23,7 +23,7 @@ SVGClipPathElement::~SVGClipPathElement() void SVGClipPathElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGClipPathElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement); } JS::GCPtr SVGClipPathElement::create_layout_node(NonnullRefPtr) diff --git a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp index 62457ef9b93e..0300fe017a80 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp @@ -24,7 +24,7 @@ SVGDefsElement::~SVGDefsElement() void SVGDefsElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGDefsElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGDefsElement); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp index 4d0d1904e49e..b46d94bbc0a3 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp @@ -23,7 +23,7 @@ SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_nam void SVGElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGElement); m_dataset = HTML::DOMStringMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp index a0efafc833c8..1672be59be28 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp @@ -21,7 +21,7 @@ SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName void SVGEllipseElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGEllipseElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGEllipseElement); } void SVGEllipseElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp index 0829c26ebccb..8804fb3ebf8f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp @@ -27,7 +27,7 @@ SVGForeignObjectElement::~SVGForeignObjectElement() = default; void SVGForeignObjectElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGForeignObjectElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGForeignObjectElement); // FIXME: These never actually get updated! m_x = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0)); diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp index 6d796378154b..8cec7a7326e8 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp @@ -18,7 +18,7 @@ SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedNa void SVGGeometryElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGGeometryElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGeometryElement); } JS::GCPtr SVGGeometryElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp index c1a724d5e631..df0b5d20b447 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp @@ -135,7 +135,7 @@ JS::GCPtr SVGGradientElement::linked_gradient(HashTabl void SVGGradientElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGGradientElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGradientElement); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index d2facaa10c17..c48c899e76f1 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -29,7 +29,7 @@ SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedNa void SVGGraphicsElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGGraphicsElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGraphicsElement); } void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp index 7ec091617dc1..f68e463727c5 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp @@ -74,7 +74,7 @@ SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value) void SVGLength::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGLength""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLength); } SVGLength::~SVGLength() = default; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp index 55998a3b6a6c..8fe58111c8ae 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp @@ -21,7 +21,7 @@ SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName quali void SVGLineElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGLineElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLineElement); } void SVGLineElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp index 2e78b91e39ab..6dbe62f3745c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp @@ -23,7 +23,7 @@ SVGLinearGradientElement::SVGLinearGradientElement(DOM::Document& document, DOM: void SVGLinearGradientElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGLinearGradientElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLinearGradientElement); } void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGMaskElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGMaskElement.cpp index cb9006807521..0104c0726ae8 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGMaskElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGMaskElement.cpp @@ -24,7 +24,7 @@ SVGMaskElement::~SVGMaskElement() = default; void SVGMaskElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGMaskElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGMaskElement); } JS::GCPtr SVGMaskElement::create_layout_node(NonnullRefPtr) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index b5685a7f1f75..1b462e27ff83 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -92,7 +92,7 @@ SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName quali void SVGPathElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGPathElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPathElement); } void SVGPathElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp index 41c476c15a45..f8808902e730 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp @@ -21,7 +21,7 @@ SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName void SVGPolygonElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGPolygonElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolygonElement); } void SVGPolygonElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp index 0e282d917d3f..0e9ea1d87274 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp @@ -21,7 +21,7 @@ SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedNa void SVGPolylineElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGPolylineElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolylineElement); } void SVGPolylineElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp index f2a282e42aa9..70280c3ae6a0 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp @@ -20,7 +20,7 @@ SVGRadialGradientElement::SVGRadialGradientElement(DOM::Document& document, DOM: void SVGRadialGradientElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGRadialGradientElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRadialGradientElement); } void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index c352a91ebac2..77a9aa976d4b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -23,7 +23,7 @@ SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName quali void SVGRectElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGRectElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRectElement); } void SVGRectElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 35a76c2ab1e8..5d4e709bbe55 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -29,7 +29,7 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualifi void SVGSVGElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGSVGElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGSVGElement); m_view_box_for_bindings = heap().allocate(realm, realm); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGScriptElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGScriptElement.cpp index e4f092eaff83..03e1f031a5e3 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGScriptElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGScriptElement.cpp @@ -21,7 +21,7 @@ SVGScriptElement::SVGScriptElement(DOM::Document& document, DOM::QualifiedName q void SVGScriptElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGScriptElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGScriptElement); } void SVGScriptElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp index 4a8147af9d22..a81e4480ffc6 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp @@ -68,7 +68,7 @@ JS::NonnullGCPtr SVGStopElement::offset() const void SVGStopElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGStopElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGStopElement); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGStyleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGStyleElement.cpp index 5817156eaae3..114ce9065375 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGStyleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGStyleElement.cpp @@ -20,7 +20,7 @@ SVGStyleElement::~SVGStyleElement() = default; void SVGStyleElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGStyleElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGStyleElement); } void SVGStyleElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp index d21da704b700..d59c6b72f41e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp @@ -27,7 +27,7 @@ SVGSymbolElement::SVGSymbolElement(DOM::Document& document, DOM::QualifiedName q void SVGSymbolElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGSymbolElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGSymbolElement); } // https://svgwg.org/svg2-draft/struct.html#SymbolNotes diff --git a/Userland/Libraries/LibWeb/SVG/SVGTSpanElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTSpanElement.cpp index c11504b28b69..59761cfe7264 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTSpanElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTSpanElement.cpp @@ -20,7 +20,7 @@ SVGTSpanElement::SVGTSpanElement(DOM::Document& document, DOM::QualifiedName qua void SVGTSpanElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTSpanElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTSpanElement); } JS::GCPtr SVGTSpanElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp index 38d374c89276..24d4e01688d7 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp @@ -26,7 +26,7 @@ SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::Quali void SVGTextContentElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTextContentElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextContentElement); } Optional SVGTextContentElement::text_anchor() const diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextElement.cpp index af76a7bc6e12..dac940e67d89 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextElement.cpp @@ -19,7 +19,7 @@ SVGTextElement::SVGTextElement(DOM::Document& document, DOM::QualifiedName quali void SVGTextElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTextElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextElement); } JS::GCPtr SVGTextElement::create_layout_node(NonnullRefPtr style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextPathElement.cpp index 38170449574c..ac9fe8b7ce7c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextPathElement.cpp @@ -30,7 +30,7 @@ JS::GCPtr SVGTextPathElement::path_or_shape() const void SVGTextPathElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTextPathElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextPathElement); } void SVGTextPathElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextPositioningElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextPositioningElement.cpp index 58a2c298cd90..13d8c9ba7c16 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextPositioningElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextPositioningElement.cpp @@ -25,7 +25,7 @@ SVGTextPositioningElement::SVGTextPositioningElement(DOM::Document& document, DO void SVGTextPositioningElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTextPositioningElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextPositioningElement); } void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGTitleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTitleElement.cpp index 0c1783d7eafd..19464011cc61 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTitleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTitleElement.cpp @@ -21,7 +21,7 @@ SVGTitleElement::SVGTitleElement(DOM::Document& document, DOM::QualifiedName qua void SVGTitleElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGTitleElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTitleElement); } JS::GCPtr SVGTitleElement::create_layout_node(NonnullRefPtr) diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp index 9aa31151f6fe..37d6a17f2b62 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp @@ -28,7 +28,7 @@ SVGUseElement::SVGUseElement(DOM::Document& document, DOM::QualifiedName qualifi void SVGUseElement::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""SVGUseElement""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGUseElement); // The shadow tree is open (inspectable by script), but read-only. auto shadow_root = heap().allocate(realm, document(), *this, Bindings::ShadowRootMode::Open); diff --git a/Userland/Libraries/LibWeb/Selection/Selection.cpp b/Userland/Libraries/LibWeb/Selection/Selection.cpp index bf90fbe61080..5fc0e7596f4b 100644 --- a/Userland/Libraries/LibWeb/Selection/Selection.cpp +++ b/Userland/Libraries/LibWeb/Selection/Selection.cpp @@ -29,7 +29,7 @@ Selection::~Selection() = default; void Selection::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""Selection""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(Selection); } // https://w3c.github.io/selection-api/#dfn-empty diff --git a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp index 986da72410ad..a7eefe9b3358 100644 --- a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp +++ b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp @@ -41,7 +41,7 @@ WebIDL::ExceptionOr> ByteLengthQueuingStr void ByteLengthQueuingStrategy::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ByteLengthQueuingStrategy""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ByteLengthQueuingStrategy); } } diff --git a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp index 39824f0d7355..9b28ca4a5c30 100644 --- a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp +++ b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp @@ -41,7 +41,7 @@ WebIDL::ExceptionOr> CountQueuingStrategy void CountQueuingStrategy::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""CountQueuingStrategy""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(CountQueuingStrategy); } } diff --git a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp index 243e6383c4f3..df79e0c5f7ea 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp @@ -66,7 +66,7 @@ ReadableByteStreamController::ReadableByteStreamController(JS::Realm& realm) void ReadableByteStreamController::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableByteStreamController""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableByteStreamController); } // https://streams.spec.whatwg.org/#rbs-controller-enqueue diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp index f4eb80abfe4e..bd347de77084 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp @@ -118,7 +118,7 @@ WebIDL::ExceptionOr ReadableStream::tee() void ReadableStream::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableStream""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableStream); } void ReadableStream::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp index 638871c21441..1c923911ca85 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp @@ -27,7 +27,7 @@ ReadableStreamBYOBReader::ReadableStreamBYOBReader(JS::Realm& realm) void ReadableStreamBYOBReader::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableStreamBYOBReader""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableStreamBYOBReader); } // https://streams.spec.whatwg.org/#byob-reader-constructor diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp index d56e9278c2ee..7e87dd3a16f9 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp @@ -30,7 +30,7 @@ ReadableStreamBYOBRequest::ReadableStreamBYOBRequest(JS::Realm& realm) void ReadableStreamBYOBRequest::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableStreamBYOBRequest""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableStreamBYOBRequest); } void ReadableStreamBYOBRequest::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp index 75995c452240..94903519aea3 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp @@ -129,7 +129,7 @@ WebIDL::ExceptionOr ReadableStreamDefaultController::release_steps() void ReadableStreamDefaultController::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableStreamDefaultController""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableStreamDefaultController); } void ReadableStreamDefaultController::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp index fa2df5f94615..34a0b78786a5 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp @@ -52,7 +52,7 @@ ReadableStreamDefaultReader::ReadableStreamDefaultReader(JS::Realm& realm) void ReadableStreamDefaultReader::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ReadableStreamDefaultReader""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ReadableStreamDefaultReader); } void ReadableStreamDefaultReader::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp index e7a970097330..470efd695e9e 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp @@ -84,7 +84,7 @@ TransformStream::~TransformStream() = default; void TransformStream::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TransformStream""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TransformStream); } void TransformStream::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp index c856581fb9ff..c825b6569753 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp +++ b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp @@ -22,7 +22,7 @@ TransformStreamDefaultController::~TransformStreamDefaultController() = default; void TransformStreamDefaultController::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""TransformStreamDefaultController""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(TransformStreamDefaultController); } void TransformStreamDefaultController::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp index bbad973dc68f..022b70010627 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp @@ -108,7 +108,7 @@ WritableStream::WritableStream(JS::Realm& realm) void WritableStream::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WritableStream""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WritableStream); } void WritableStream::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp index 574900edd8a8..877f9a9c6548 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp @@ -128,7 +128,7 @@ WritableStreamDefaultWriter::WritableStreamDefaultWriter(JS::Realm& realm) void WritableStreamDefaultWriter::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WritableStreamDefaultWriter""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WritableStreamDefaultWriter); } void WritableStreamDefaultWriter::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp index 6659dc803ac9..83bfc83de1b3 100644 --- a/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp @@ -27,7 +27,7 @@ FocusEvent::~FocusEvent() = default; void FocusEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FocusEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FocusEvent); } } diff --git a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp index fbfda1384a6b..6dd594d230cd 100644 --- a/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp @@ -727,7 +727,7 @@ KeyboardEvent::~KeyboardEvent() = default; void KeyboardEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""KeyboardEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(KeyboardEvent); } } diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp index d7967125799c..8fc26f64a03c 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp @@ -53,7 +53,7 @@ MouseEvent::~MouseEvent() = default; void MouseEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""MouseEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(MouseEvent); } bool MouseEvent::get_modifier_state(String const& key_arg) const diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp index dc53e963e252..c2a25ec07ab0 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.cpp @@ -38,7 +38,7 @@ UIEvent::~UIEvent() = default; void UIEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""UIEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(UIEvent); } void UIEvent::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp index 21f428b82a6d..9b938ef0b525 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp @@ -29,7 +29,7 @@ WheelEvent::~WheelEvent() = default; void WheelEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WheelEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WheelEvent); } JS::NonnullGCPtr WheelEvent::create(JS::Realm& realm, FlyString const& event_name, WheelEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y) diff --git a/Userland/Libraries/LibWeb/UserTiming/PerformanceMark.cpp b/Userland/Libraries/LibWeb/UserTiming/PerformanceMark.cpp index 8aafdc12dbc4..6ec1f15a52c0 100644 --- a/Userland/Libraries/LibWeb/UserTiming/PerformanceMark.cpp +++ b/Userland/Libraries/LibWeb/UserTiming/PerformanceMark.cpp @@ -101,7 +101,7 @@ FlyString const& PerformanceMark::entry_type() const void PerformanceMark::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceMark""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceMark); } void PerformanceMark::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/UserTiming/PerformanceMeasure.cpp b/Userland/Libraries/LibWeb/UserTiming/PerformanceMeasure.cpp index a8c5918f1e6f..9aab6ebe8f8c 100644 --- a/Userland/Libraries/LibWeb/UserTiming/PerformanceMeasure.cpp +++ b/Userland/Libraries/LibWeb/UserTiming/PerformanceMeasure.cpp @@ -39,7 +39,7 @@ FlyString const& PerformanceMeasure::entry_type() const void PerformanceMeasure::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""PerformanceMeasure""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceMeasure); } void PerformanceMeasure::visit_edges(JS::Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/WebAssembly/Instance.cpp b/Userland/Libraries/LibWeb/WebAssembly/Instance.cpp index d2178f86d605..6bf56018c626 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/Instance.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/Instance.cpp @@ -45,7 +45,7 @@ void Instance::initialize(JS::Realm& realm) auto& vm = this->vm(); Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebAssembly.Instance""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(Instance, WebAssembly.Instance); auto& instance = *Detail::s_instantiated_modules[m_index]; auto& cache = Detail::s_module_caches.at(m_index); diff --git a/Userland/Libraries/LibWeb/WebAssembly/Memory.cpp b/Userland/Libraries/LibWeb/WebAssembly/Memory.cpp index 0292f96352c6..caed9aa77ddd 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/Memory.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/Memory.cpp @@ -44,7 +44,7 @@ Memory::Memory(JS::Realm& realm, Wasm::MemoryAddress address) void Memory::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebAssembly.Memory""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(Memory, WebAssembly.Memory); } // https://webassembly.github.io/spec/js-api/#dom-memory-grow diff --git a/Userland/Libraries/LibWeb/WebAssembly/Module.cpp b/Userland/Libraries/LibWeb/WebAssembly/Module.cpp index fda278574ca1..83abf4043d68 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/Module.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/Module.cpp @@ -34,7 +34,7 @@ Module::Module(JS::Realm& realm, size_t index) void Module::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebAssembly.Module""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(Module, WebAssembly.Module); } Wasm::Module const& Module::module() const diff --git a/Userland/Libraries/LibWeb/WebAssembly/Table.cpp b/Userland/Libraries/LibWeb/WebAssembly/Table.cpp index 15d4df725d76..986b75a12d76 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/Table.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/Table.cpp @@ -66,7 +66,7 @@ Table::Table(JS::Realm& realm, Wasm::TableAddress address) void Table::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebAssembly.Table""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE_WITH_CUSTOM_NAME(Table, WebAssembly.Table); } // https://webassembly.github.io/spec/js-api/#dom-table-grow diff --git a/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp b/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp index 6d0f24c6cc5b..7fc1ad07f6b7 100644 --- a/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp +++ b/Userland/Libraries/LibWeb/WebAudio/AudioContext.cpp @@ -84,7 +84,7 @@ AudioContext::~AudioContext() = default; void AudioContext::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""AudioContext""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(AudioContext); } void AudioContext::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/WebAudio/BaseAudioContext.cpp b/Userland/Libraries/LibWeb/WebAudio/BaseAudioContext.cpp index eeaab2a2f9e1..f9bfce66c46c 100644 --- a/Userland/Libraries/LibWeb/WebAudio/BaseAudioContext.cpp +++ b/Userland/Libraries/LibWeb/WebAudio/BaseAudioContext.cpp @@ -20,7 +20,7 @@ BaseAudioContext::~BaseAudioContext() = default; void BaseAudioContext::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""BaseAudioContext""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(BaseAudioContext); } void BaseAudioContext::set_onstatechange(WebIDL::CallbackType* event_handler) diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp index ad338aac5496..0de708ff7487 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp @@ -32,7 +32,7 @@ WebGLContextEvent::~WebGLContextEvent() = default; void WebGLContextEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebGLContextEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLContextEvent); } } diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp index a8d92f87417e..8396216257b8 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp @@ -65,7 +65,7 @@ WebGLRenderingContext::~WebGLRenderingContext() = default; void WebGLRenderingContext::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebGLRenderingContext""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLRenderingContext); } } diff --git a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp index 406538d589c2..824e73528f25 100644 --- a/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/DOMException.cpp @@ -33,7 +33,7 @@ DOMException::~DOMException() = default; void DOMException::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""DOMException""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMException); } } diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp index c8e5c72a5f7d..4feeed2f986a 100644 --- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp +++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp @@ -115,7 +115,7 @@ WebSocket::~WebSocket() = default; void WebSocket::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""WebSocket""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WebSocket); } ErrorOr WebSocket::establish_web_socket_connection(URL& url_record, Vector& protocols, HTML::EnvironmentSettingsObject& client) diff --git a/Userland/Libraries/LibWeb/XHR/FormData.cpp b/Userland/Libraries/LibWeb/XHR/FormData.cpp index 4365b3d8149a..4b9799e4f94a 100644 --- a/Userland/Libraries/LibWeb/XHR/FormData.cpp +++ b/Userland/Libraries/LibWeb/XHR/FormData.cpp @@ -51,7 +51,7 @@ FormData::~FormData() = default; void FormData::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FormData""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FormData); } // https://xhr.spec.whatwg.org/#dom-formdata-append diff --git a/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp b/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp index 26aa8892757a..606b617c26ff 100644 --- a/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp +++ b/Userland/Libraries/LibWeb/XHR/FormDataIterator.cpp @@ -42,7 +42,7 @@ FormDataIterator::~FormDataIterator() = default; void FormDataIterator::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""FormDataIterator""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(FormDataIterator); } void FormDataIterator::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp index 33808774d7d7..6d10fe7a3c4e 100644 --- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp +++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp @@ -34,7 +34,7 @@ ProgressEvent::~ProgressEvent() = default; void ProgressEvent::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""ProgressEvent""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(ProgressEvent); } } diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 505ea96d8396..7d2dedb932d1 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -81,7 +81,7 @@ XMLHttpRequest::~XMLHttpRequest() = default; void XMLHttpRequest::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""XMLHttpRequest""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(XMLHttpRequest); } void XMLHttpRequest::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp index df81985ab9e4..1da8dab95a7f 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp @@ -22,7 +22,7 @@ XMLHttpRequestUpload::~XMLHttpRequestUpload() = default; void XMLHttpRequestUpload::initialize(JS::Realm& realm) { Base::initialize(realm); - set_prototype(&Bindings::ensure_web_prototype(realm, ""XMLHttpRequestUpload""_fly_string)); + WEB_SET_PROTOTYPE_FOR_INTERFACE(XMLHttpRequestUpload); } }" 5fa40080cdd106666cdf32fc07cfd49b65b66fac,2020-05-18 13:06:00,jarhill0,base: Add peach emoji (U+1F351) 🍑,False,Add peach emoji (U+1F351) 🍑,base,"diff --git a/Base/home/anon/emoji.txt b/Base/home/anon/emoji.txt index e0901b608b02..83ce4104b7a2 100644 --- a/Base/home/anon/emoji.txt +++ b/Base/home/anon/emoji.txt @@ -1,4 +1,5 @@ 🍆 - U+1F346 EGGPLANT +🍑 - U+1F351 PEACH 🐞 - U+1F41E LADY BEETLE 👀 - U+1F440 EYES 👍 - U+1F44D THUMBS UP SIGN diff --git a/Base/res/emoji/U+1F351.png b/Base/res/emoji/U+1F351.png new file mode 100644 index 000000000000..d15245a738e8 Binary files /dev/null and b/Base/res/emoji/U+1F351.png differ" a832ab0f4e36fd4d12214736d318f3bc7550feb7,2020-04-24 23:13:34,Linus Groh,js: Interrupt running script or REPL evaluation when receiving SIGINT,False,Interrupt running script or REPL evaluation when receiving SIGINT,js,"diff --git a/Userland/js.cpp b/Userland/js.cpp index bc9cd5bd5ebb..e3135d2c4406 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -383,6 +383,12 @@ void enable_test_mode(JS::Interpreter& interpreter) interpreter.global_object().put_native_function(""load"", ReplObject::load_file); } +static Function interrupt_interpreter; +void sigint_handler() +{ + interrupt_interpreter(); +} + int main(int argc, char** argv) { bool gc_on_every_allocation = false; @@ -399,8 +405,15 @@ int main(int argc, char** argv) args_parser.add_positional_argument(script_path, ""Path to script file"", ""script"", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); + OwnPtr interpreter; + + interrupt_interpreter = [&] { + auto error = JS::Error::create(interpreter->global_object(), ""Error"", ""Received SIGINT""); + interpreter->throw_exception(error); + }; + if (script_path == nullptr) { - auto interpreter = JS::Interpreter::create(); + interpreter = JS::Interpreter::create(); interpreter->heap().set_should_collect_on_every_allocation(gc_on_every_allocation); if (test_mode) enable_test_mode(*interpreter); @@ -408,6 +421,7 @@ int main(int argc, char** argv) editor = make(); signal(SIGINT, [](int) { + sigint_handler(); editor->interrupted(); }); @@ -620,11 +634,15 @@ int main(int argc, char** argv) editor->on_tab_complete_other_token = [complete](auto& value) { return complete(value); }; repl(*interpreter); } else { - auto interpreter = JS::Interpreter::create(); + interpreter = JS::Interpreter::create(); interpreter->heap().set_should_collect_on_every_allocation(gc_on_every_allocation); if (test_mode) enable_test_mode(*interpreter); + signal(SIGINT, [](int) { + sigint_handler(); + }); + auto file = Core::File::construct(script_path); if (!file->open(Core::IODevice::ReadOnly)) { fprintf(stderr, ""Failed to open %s: %s\n"", script_path, file->error_string());" 631b8e90cd1c271e23d92c46f578fc9cd6dbb81d,2021-09-07 17:28:16,Andreas Kling,kernel: Use KResultOr and TRY() for MasterPTY,False,Use KResultOr and TRY() for MasterPTY,kernel,"diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index d539cbc5f974..20b557392755 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -16,22 +16,12 @@ namespace Kernel { -RefPtr MasterPTY::try_create(unsigned int index) +KResultOr> MasterPTY::try_create(unsigned int index) { - auto buffer_or_error = DoubleBuffer::try_create(); - if (buffer_or_error.is_error()) - return {}; - - auto master_pty = adopt_ref_if_nonnull(new (nothrow) MasterPTY(index, buffer_or_error.release_value())); - if (!master_pty) - return {}; - - auto slave_pty = adopt_ref_if_nonnull(new (nothrow) SlavePTY(*master_pty, index)); - if (!slave_pty) - return {}; - + auto buffer = TRY(DoubleBuffer::try_create()); + auto master_pty = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) MasterPTY(index, move(buffer)))); + auto slave_pty = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) SlavePTY(*master_pty, index))); master_pty->m_slave = slave_pty; - return master_pty; } diff --git a/Kernel/TTY/MasterPTY.h b/Kernel/TTY/MasterPTY.h index 677bea7d3a83..0763654ed6b5 100644 --- a/Kernel/TTY/MasterPTY.h +++ b/Kernel/TTY/MasterPTY.h @@ -16,7 +16,7 @@ class SlavePTY; class MasterPTY final : public CharacterDevice { public: - [[nodiscard]] static RefPtr try_create(unsigned index); + static KResultOr> try_create(unsigned index); virtual ~MasterPTY() override; unsigned index() const { return m_index; } diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp index 537831b74d57..4cb2e2c10ced 100644 --- a/Kernel/TTY/PTYMultiplexer.cpp +++ b/Kernel/TTY/PTYMultiplexer.cpp @@ -42,9 +42,7 @@ KResultOr> PTYMultiplexer::open(int options) return EBUSY; auto master_index = freelist.take_last(); - auto master = MasterPTY::try_create(master_index); - if (!master) - return ENOMEM; + auto master = TRY(MasterPTY::try_create(master_index)); dbgln_if(PTMX_DEBUG, ""PTYMultiplexer::open: Vending master {}"", master->index()); auto description = TRY(OpenFileDescription::try_create(*master)); description->set_rw_mode(options);" 5c0fca0a955c91c41683941a9de159fa87e98446,2019-03-02 13:46:57,Andreas Kling,"filemanager: Make the ""open parent directory"" action actually open ""..""",False,"Make the ""open parent directory"" action actually open ""..""",filemanager,"diff --git a/Applications/FileManager/DirectoryTableView.cpp b/Applications/FileManager/DirectoryTableView.cpp index 0d49aaaa2684..f689a99ff466 100644 --- a/Applications/FileManager/DirectoryTableView.cpp +++ b/Applications/FileManager/DirectoryTableView.cpp @@ -34,3 +34,8 @@ void DirectoryTableView::set_status_message(const String& message) if (on_status_message) on_status_message(message); } + +void DirectoryTableView::open_parent_directory() +{ + model().open(""..""); +} diff --git a/Applications/FileManager/DirectoryTableView.h b/Applications/FileManager/DirectoryTableView.h index 8e80d8350eb9..4d2c369a81dd 100644 --- a/Applications/FileManager/DirectoryTableView.h +++ b/Applications/FileManager/DirectoryTableView.h @@ -11,6 +11,7 @@ class DirectoryTableView final : public GTableView { void open(const String& path); String path() const { return model().path(); } + void open_parent_directory(); Function on_path_change; Function on_status_message; diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 92c9899d0036..ac05d754f938 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -25,8 +25,20 @@ int main(int argc, char** argv) GApplication app(argc, argv); - auto open_parent_directory_action = GAction::create(""Open parent directory"", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, ""/res/icons/parentdirectory16.rgb"", { 16, 16 }), [] (const GAction&) { - dbgprintf(""'Parent directory' action activated!\n""); + auto* window = new GWindow; + window->set_title(""FileManager""); + window->set_rect(20, 200, 640, 480); + window->set_should_exit_app_on_close(true); + + auto* widget = new GWidget; + widget->set_layout(make(Orientation::Vertical)); + + auto* toolbar = new GToolBar(widget); + auto* directory_table_view = new DirectoryTableView(widget); + auto* statusbar = new GStatusBar(widget); + + auto open_parent_directory_action = GAction::create(""Open parent directory"", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, ""/res/icons/parentdirectory16.rgb"", { 16, 16 }), [directory_table_view] (const GAction&) { + directory_table_view->open_parent_directory(); }); auto mkdir_action = GAction::create(""New directory..."", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, ""/res/icons/mkdir16.rgb"", { 16, 16 }), [] (const GAction&) { @@ -65,26 +77,11 @@ int main(int argc, char** argv) app.set_menubar(move(menubar)); - auto* window = new GWindow; - window->set_title(""FileManager""); - window->set_rect(20, 200, 240, 300); - - auto* widget = new GWidget; - window->set_main_widget(widget); - - widget->set_layout(make(Orientation::Vertical)); - - auto* toolbar = new GToolBar(widget); toolbar->add_action(open_parent_directory_action.copy_ref()); toolbar->add_action(mkdir_action.copy_ref()); toolbar->add_action(copy_action.copy_ref()); toolbar->add_action(delete_action.copy_ref()); - auto* directory_table_view = new DirectoryTableView(widget); - - auto* statusbar = new GStatusBar(widget); - statusbar->set_text(""Welcome!""); - directory_table_view->on_path_change = [window] (const String& new_path) { window->set_title(String::format(""FileManager: %s"", new_path.characters())); }; @@ -96,7 +93,7 @@ int main(int argc, char** argv) directory_table_view->open(""/""); directory_table_view->set_focus(true); - window->set_should_exit_app_on_close(true); + window->set_main_widget(widget); window->show(); return app.exec();" 7953bd839175696cc55a56969f0bff9598e08fcf,2022-06-22 22:06:17,Andreas Kling,"libweb: Implement ""transferred size suggestion"" for flex items",False,"Implement ""transferred size suggestion"" for flex items",libweb,"diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 5f5afa99b00d..eb80adeee422 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -654,6 +654,22 @@ float FlexFormattingContext::content_size_suggestion(FlexItem const& item) const return calculate_min_and_max_content_height(item.box).min_content_size; } +// https://drafts.csswg.org/css-flexbox-1/#transferred-size-suggestion +Optional FlexFormattingContext::transferred_size_suggestion(FlexItem const& item) const +{ + // If the item has a preferred aspect ratio and its preferred cross size is definite, + // then the transferred size suggestion is that size + // (clamped by its minimum and maximum cross sizes if they are definite), converted through the aspect ratio. + if (item.box.has_intrinsic_aspect_ratio() && has_definite_cross_size(item.box)) { + auto aspect_ratio = item.box.intrinsic_aspect_ratio().value(); + // FIXME: Clamp cross size to min/max cross size before this conversion. + return resolved_definite_cross_size(item.box) * aspect_ratio; + } + + // It is otherwise undefined. + return {}; +} + // https://drafts.csswg.org/css-flexbox-1/#content-based-minimum-size float FlexFormattingContext::content_based_minimum_size(FlexItem const& item) const { @@ -664,8 +680,13 @@ float FlexFormattingContext::content_based_minimum_size(FlexItem const& item) co return min(specified_size_suggestion.value(), content_size_suggestion(item)); } - // FIXME: otherwise, the smaller of its transferred size suggestion and its content size suggestion - // if the element is replaced and its transferred size suggestion exists; + // otherwise, the smaller of its transferred size suggestion and its content size suggestion + // if the element is replaced and its transferred size suggestion exists; + if (item.box.is_replaced_box()) { + if (auto transferred_size_suggestion = this->transferred_size_suggestion(item); transferred_size_suggestion.has_value()) { + return min(transferred_size_suggestion.value(), content_size_suggestion(item)); + } + } // otherwise its content size suggestion. return content_size_suggestion(item); diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h index d997bdd9731c..0797d9546009 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h @@ -82,6 +82,7 @@ class FlexFormattingContext final : public FormattingContext { float automatic_minimum_size(FlexItem const&) const; float content_based_minimum_size(FlexItem const&) const; Optional specified_size_suggestion(FlexItem const&) const; + Optional transferred_size_suggestion(FlexItem const&) const; float content_size_suggestion(FlexItem const&) const; void set_main_size(Box const&, float size);" d2b8686ae4807ab2791c20e8db7bab700d6e5f15,2022-04-13 02:33:46,Sam Atkins,libweb: Add Formatter for ComponentValues,False,Add Formatter for ComponentValues,libweb,"diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h index 30fa3fa52c59..0c8a49544bd6 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h @@ -44,3 +44,11 @@ class ComponentValue { Variant, NonnullRefPtr> m_value; }; } + +template<> +struct AK::Formatter : Formatter { + ErrorOr format(FormatBuilder& builder, Web::CSS::Parser::ComponentValue const& component_value) + { + return Formatter::format(builder, component_value.to_string()); + } +};" 68576bcf1b91306790eaf1a5b0eee7c42b51fb60,2021-01-31 15:36:00,Andreas Kling,libelf: Call mmap() before constructing the DynamicLoader object,False,Call mmap() before constructing the DynamicLoader object,libelf,"diff --git a/Userland/Libraries/LibC/dlfcn.cpp b/Userland/Libraries/LibC/dlfcn.cpp index bcf6de70ae3c..2a52042804ff 100644 --- a/Userland/Libraries/LibC/dlfcn.cpp +++ b/Userland/Libraries/LibC/dlfcn.cpp @@ -24,14 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -39,6 +31,11 @@ #include #include #include +#include +#include +#include +#include +#include // NOTE: The string here should never include a trailing newline (according to POSIX) String g_dlerror_msg; @@ -85,18 +82,8 @@ void* dlopen(const char* filename, int flags) ScopeGuard close_fd_guard([fd]() { close(fd); }); - struct stat file_stats { - }; - - int ret = fstat(fd, &file_stats); - if (ret < 0) { - g_dlerror_msg = String::formatted(""Unable to stat file {}"", filename); - return nullptr; - } - - auto loader = ELF::DynamicLoader::construct(filename, fd, file_stats.st_size); - - if (!loader->is_valid()) { + auto loader = ELF::DynamicLoader::try_create(fd, filename); + if (!loader || !loader->is_valid()) { g_dlerror_msg = String::formatted(""{} is not a valid ELF dynamic shared object!"", filename); return nullptr; } diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index 81349606ab04..8fa91231fb6c 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -35,16 +35,14 @@ #include #include #include -#include #include #include #include #include #include -#include #include +#include #include -#include #include namespace ELF { @@ -84,14 +82,14 @@ Optional DynamicLinker::lookup_global_symbol( static void map_library(const String& name, int fd) { - struct stat lib_stat; - int rc = fstat(fd, &lib_stat); - ASSERT(!rc); - - auto loader = ELF::DynamicLoader::construct(name.characters(), fd, lib_stat.st_size); + auto loader = ELF::DynamicLoader::try_create(fd, name); + if (!loader) { + dbgln(""Failed to create ELF::DynamicLoader for fd={}, name={}"", fd, name); + ASSERT_NOT_REACHED(); + } loader->set_tls_offset(g_current_tls_offset); - g_loaders.set(name, loader); + g_loaders.set(name, *loader); g_current_tls_offset += loader->tls_size(); } diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp index b7c98085c8e6..5429c99fadd0 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.cpp +++ b/Userland/Libraries/LibELF/DynamicLoader.cpp @@ -30,13 +30,13 @@ #include #include #include - #include #include #include #include #include #include +#include #ifndef __serenity__ static void* mmap_with_name(void* addr, size_t length, int prot, int flags, int fd, off_t offset, const char*) @@ -51,38 +51,45 @@ namespace ELF { static bool s_always_bind_now = false; -NonnullRefPtr DynamicLoader::construct(const char* filename, int fd, size_t size) +RefPtr DynamicLoader::try_create(int fd, String filename) { - return adopt(*new DynamicLoader(filename, fd, size)); -} + struct stat stat; + if (fstat(fd, &stat) < 0) { + perror(""DynamicLoader::try_create fstat""); + return {}; + } -void* DynamicLoader::do_mmap(int fd, size_t size, const String& name) -{ + ASSERT(stat.st_size >= 0); + size_t size = static_cast(stat.st_size); if (size < sizeof(Elf32_Ehdr)) - return MAP_FAILED; + return {}; - String file_mmap_name = String::formatted(""ELF_DYN: {}"", name); - return mmap_with_name(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0, file_mmap_name.characters()); + String file_mmap_name = String::formatted(""ELF_DYN: {}"", filename); + auto* data = mmap_with_name(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0, file_mmap_name.characters()); + if (data == MAP_FAILED) { + perror(""DynamicLoader::try_create mmap""); + return {}; + } + + return adopt(*new DynamicLoader(fd, move(filename), data, size)); } -DynamicLoader::DynamicLoader(const char* filename, int fd, size_t size) - : m_filename(filename) +DynamicLoader::DynamicLoader(int fd, String filename, void* data, size_t size) + : m_filename(move(filename)) , m_file_size(size) , m_image_fd(fd) - , m_file_mapping(do_mmap(m_image_fd, m_file_size, m_filename)) - , m_elf_image((u8*)m_file_mapping, m_file_size) + , m_file_data(data) + , m_elf_image((u8*)m_file_data, m_file_size) { - - if (m_file_mapping == MAP_FAILED) { - m_valid = false; - return; - } - m_tls_size = calculate_tls_size(); - m_valid = validate(); } +DynamicLoader::~DynamicLoader() +{ + munmap(m_file_data, m_file_size); +} + const DynamicObject& DynamicLoader::dynamic_object() const { if (!m_cached_dynamic_object) { @@ -115,15 +122,8 @@ size_t DynamicLoader::calculate_tls_size() const bool DynamicLoader::validate() { - auto* elf_header = (Elf32_Ehdr*)m_file_mapping; - return validate_elf_header(*elf_header, m_file_size) && validate_program_headers(*elf_header, m_file_size, (u8*)m_file_mapping, m_file_size, &m_program_interpreter); -} - -DynamicLoader::~DynamicLoader() -{ - if (MAP_FAILED != m_file_mapping) - munmap(m_file_mapping, m_file_size); - close(m_image_fd); + auto* elf_header = (Elf32_Ehdr*)m_file_data; + return validate_elf_header(*elf_header, m_file_size) && validate_program_headers(*elf_header, m_file_size, (u8*)m_file_data, m_file_size, &m_program_interpreter); } void* DynamicLoader::symbol_for_name(const char* name) @@ -338,7 +338,7 @@ void DynamicLoader::load_program_headers() else data_segment_start = data_region.value().desired_load_address(); - memcpy(data_segment_start.as_ptr(), (u8*)m_file_mapping + data_region.value().offset(), data_region.value().size_in_image()); + memcpy(data_segment_start.as_ptr(), (u8*)m_file_data + data_region.value().offset(), data_region.value().size_in_image()); // FIXME: Initialize the values in the TLS section. Currently, it is zeroed. } diff --git a/Userland/Libraries/LibELF/DynamicLoader.h b/Userland/Libraries/LibELF/DynamicLoader.h index 69f1144296d1..896a7e215817 100644 --- a/Userland/Libraries/LibELF/DynamicLoader.h +++ b/Userland/Libraries/LibELF/DynamicLoader.h @@ -42,8 +42,7 @@ namespace ELF { class DynamicLoader : public RefCounted { public: - static NonnullRefPtr construct(const char* filename, int fd, size_t file_size); - + static RefPtr try_create(int fd, String filename); ~DynamicLoader(); bool is_valid() const { return m_valid; } @@ -79,6 +78,8 @@ class DynamicLoader : public RefCounted { bool is_dynamic() const { return m_elf_image.is_dynamic(); } private: + DynamicLoader(int fd, String filename, void* file_data, size_t file_size); + class ProgramHeaderRegion { public: void set_program_header(const Elf32_Phdr& header) { m_program_header = header; } @@ -105,11 +106,8 @@ class DynamicLoader : public RefCounted { Elf32_Phdr m_program_header; // Explicitly a copy of the PHDR in the image }; - static void* do_mmap(int fd, size_t size, const String& name); const DynamicObject& dynamic_object() const; - explicit DynamicLoader(const char* filename, int fd, size_t file_size); - // Stage 1 void load_program_headers(); @@ -137,7 +135,7 @@ class DynamicLoader : public RefCounted { String m_program_interpreter; size_t m_file_size { 0 }; int m_image_fd { -1 }; - void* m_file_mapping { MAP_FAILED }; + void* m_file_data { nullptr }; ELF::Image m_elf_image; bool m_valid { true };" cf64118821cb3606eebe86239d137a9cd742d4d3,2024-07-04 07:36:13,Daeraxa,documentation: Add libavcodec-free-devel for Fedora build,False,Add libavcodec-free-devel for Fedora build,documentation,"diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md index c731ce9b2dc3..e502bf7e5b96 100644 --- a/Documentation/BuildInstructionsLadybird.md +++ b/Documentation/BuildInstructionsLadybird.md @@ -47,7 +47,7 @@ sudo pacman -S --needed base-devel cmake ffmpeg libgl ninja qt6-base qt6-tools q On Fedora or derivatives: ``` -sudo dnf install cmake libglvnd-devel ninja-build qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland-devel qt6-qtmultimedia-devel ccache liberation-sans-fonts curl zip unzip tar autoconf-archive +sudo dnf install cmake libglvnd-devel ninja-build qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland-devel qt6-qtmultimedia-devel ccache liberation-sans-fonts curl zip unzip tar autoconf-archive libavcodec-free-devel ``` On openSUSE:" 688dd9ea66b83fcba6124ddf7d901e227599cfe8,2020-04-11 13:32:31,Liav A,kernel: Simplify a message in PATAChannel::create(),False,Simplify a message in PATAChannel::create(),kernel,"diff --git a/Kernel/Devices/PATAChannel.cpp b/Kernel/Devices/PATAChannel.cpp index 7d649ddf2b97..b7ed53b87fd6 100644 --- a/Kernel/Devices/PATAChannel.cpp +++ b/Kernel/Devices/PATAChannel.cpp @@ -121,7 +121,7 @@ OwnPtr PATAChannel::create(ChannelType type, bool force_pio) PCI::enumerate_all([&](const PCI::Address& address, PCI::ID id) { if (PCI::get_class(address) == PCI_Mass_Storage_Class && PCI::get_subclass(address) == PCI_IDE_Controller_Subclass) { pci_address = address; - klog() << ""PATAChannel: PATA Controller found! id="" << String::format(""%w"", id.vendor_id) << "":"" << String::format(""%w"", id.device_id); + klog() << ""PATAChannel: PATA Controller found, ID "" << id; } }); return make(pci_address, type, force_pio);" 247951e09c8bcc6e14e50cf4e22b3ecf2d676209,2022-07-08 16:07:01,Kenneth Myhra,libweb: Add URLSearchParams as part of union type for XHR::send(),False,Add URLSearchParams as part of union type for XHR::send(),libweb,"diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index d8b696757910..994f9a06224b 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -52,6 +52,8 @@ static bool is_wrappable_type(Type const& type) return true; if (type.name == ""WebGLRenderingContext"") return true; + if (type.name == ""URLSearchParams"") + return true; return false; } diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 06a69c5666d7..62dbc8d64b12 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -3,6 +3,7 @@ * Copyright (c) 2021, Linus Groh * Copyright (c) 2022, Luke Wilde * Copyright (c) 2022, Ali Mohammad Pur + * Copyright (c) 2022, Kenneth Myhra * * SPDX-License-Identifier: BSD-2-Clause */ @@ -426,6 +427,21 @@ static bool is_header_value(String const& header_value) return true; } +static XMLHttpRequest::BodyWithType safely_extract_body(XMLHttpRequestBodyInit& body) +{ + if (body.has>()) { + return { + body.get>()->to_string().to_byte_buffer(), + ""application/x-www-form-urlencoded;charset=UTF-8"" + }; + } + VERIFY(body.has()); + return { + body.get().to_byte_buffer(), + ""text/plain;charset=UTF-8"" + }; +} + // https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader DOM::ExceptionOr XMLHttpRequest::set_request_header(String const& name, String const& value) { @@ -547,7 +563,7 @@ DOM::ExceptionOr XMLHttpRequest::open(String const& method, String const& } // https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send -DOM::ExceptionOr XMLHttpRequest::send(String body) +DOM::ExceptionOr XMLHttpRequest::send(Optional body) { if (m_ready_state != ReadyState::Opened) return DOM::InvalidStateError::create(""XHR readyState is not OPENED""); @@ -559,6 +575,8 @@ DOM::ExceptionOr XMLHttpRequest::send(String body) if (m_method.is_one_of(""GET""sv, ""HEAD""sv)) body = {}; + auto body_with_type = body.has_value() ? safely_extract_body(body.value()) : XMLHttpRequest::BodyWithType {}; + AK::URL request_url = m_window->associated_document().parse_url(m_url.to_string()); dbgln(""XHR send from {} to {}"", m_window->associated_document().url(), request_url); @@ -578,8 +596,11 @@ DOM::ExceptionOr XMLHttpRequest::send(String body) auto request = LoadRequest::create_for_url_on_page(request_url, m_window->page()); request.set_method(m_method); - if (!body.is_null()) - request.set_body(body.to_byte_buffer()); + if (!body_with_type.body.is_empty()) { + request.set_body(body_with_type.body); + if (!body_with_type.type.is_empty()) + request.set_header(""Content-Type"", body_with_type.type); + } for (auto& it : m_request_headers) request.set_header(it.key, it.value); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h index 678e83ce8ae3..78197897c156 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020-2021, Andreas Kling + * Copyright (c) 2022, Kenneth Myhra * * SPDX-License-Identifier: BSD-2-Clause */ @@ -15,12 +16,15 @@ #include #include #include +#include #include namespace Web::XHR { static constexpr Array http_whitespace_bytes = { '\t', '\n', '\r', ' ' }; +using XMLHttpRequestBodyInit = Variant, String>; + class XMLHttpRequest final : public RefCounted , public Weakable @@ -34,6 +38,11 @@ class XMLHttpRequest final Done = 4, }; + struct BodyWithType { + ByteBuffer body; + String type; + }; + using WrapperType = Bindings::XMLHttpRequestWrapper; static NonnullRefPtr create(HTML::Window& window) @@ -58,7 +67,7 @@ class XMLHttpRequest final DOM::ExceptionOr open(String const& method, String const& url); DOM::ExceptionOr open(String const& method, String const& url, bool async, String const& username = {}, String const& password = {}); - DOM::ExceptionOr send(String body); + DOM::ExceptionOr send(Optional body); DOM::ExceptionOr set_request_header(String const& header, String const& value); void set_response_type(Bindings::XMLHttpRequestResponseType type) { m_response_type = type; } diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl index 56d1c9d1f759..c712fd9aa2ef 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl @@ -1,5 +1,8 @@ #import #import +#import + +typedef (URLSearchParams or USVString) XMLHttpRequestBodyInit; enum XMLHttpRequestResponseType { """", @@ -30,7 +33,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget { undefined open(DOMString method, DOMString url); undefined open(ByteString method, USVString url, boolean async, optional USVString? username = {}, optional USVString? password = {}); undefined setRequestHeader(DOMString name, DOMString value); - undefined send(optional USVString body = {}); + undefined send(optional XMLHttpRequestBodyInit? body = null); ByteString? getResponseHeader(ByteString name); ByteString getAllResponseHeaders();" cfae6523be04d53151083930cff327b94f8702bb,2024-04-04 00:40:01,stelar7,libweb: Implement skeleton of SubtleCrypto.sign,False,Implement skeleton of SubtleCrypto.sign,libweb,"diff --git a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h index 9cc6325a3941..0ac9df25674f 100644 --- a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h +++ b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h @@ -131,6 +131,11 @@ class AlgorithmMethods { return WebIDL::NotSupportedError::create(m_realm, ""decrypt is not supported""_fly_string); } + virtual WebIDL::ExceptionOr> sign(AlgorithmParams const&, JS::NonnullGCPtr, ByteBuffer const&) + { + return WebIDL::NotSupportedError::create(m_realm, ""sign is not supported""_fly_string); + } + virtual WebIDL::ExceptionOr> digest(AlgorithmParams const&, ByteBuffer const&) { return WebIDL::NotSupportedError::create(m_realm, ""digest is not supported""_fly_string); diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 680b5d4151de..e0af98a4a258 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -463,6 +463,63 @@ JS::ThrowCompletionOr> SubtleCrypto::export_key(Bi return verify_cast(*promise->promise()); } +// https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-sign +JS::ThrowCompletionOr> SubtleCrypto::sign(AlgorithmIdentifier const& algorithm, JS::NonnullGCPtr key, JS::Handle const& data_parameter) +{ + auto& realm = this->realm(); + auto& vm = this->vm(); + // 1. Let algorithm and key be the algorithm and key parameters passed to the sign() method, respectively. + + // 2. Let data be the result of getting a copy of the bytes held by the data parameter passed to the sign() method. + auto data_or_error = WebIDL::get_buffer_source_copy(*data_parameter->raw_object()); + if (data_or_error.is_error()) { + VERIFY(data_or_error.error().code() == ENOMEM); + return WebIDL::create_rejected_promise_from_exception(realm, vm.throw_completion(vm.error_message(JS::VM::ErrorMessage::OutOfMemory))); + } + auto data = data_or_error.release_value(); + + // 3. Let normalizedAlgorithm be the result of normalizing an algorithm, with alg set to algorithm and op set to ""sign"". + auto normalized_algorithm = normalize_an_algorithm(realm, algorithm, ""sign""_string); + + // 4. If an error occurred, return a Promise rejected with normalizedAlgorithm. + if (normalized_algorithm.is_error()) + return WebIDL::create_rejected_promise_from_exception(realm, normalized_algorithm.release_error()); + + // 5. Let promise be a new Promise. + auto promise = WebIDL::create_promise(realm); + + // 6. Return promise and perform the remaining steps in parallel. + + Platform::EventLoopPlugin::the().deferred_invoke([&realm, normalized_algorithm = normalized_algorithm.release_value(), promise, key, data = move(data)]() -> void { + HTML::TemporaryExecutionContext context(Bindings::host_defined_environment_settings_object(realm), HTML::TemporaryExecutionContext::CallbacksEnabled::Yes); + // 7. If the following steps or referenced procedures say to throw an error, reject promise with the returned error and then terminate the algorithm. + + // 8. If the name member of normalizedAlgorithm is not equal to the name attribute of the [[algorithm]] internal slot of key then throw an InvalidAccessError. + if (normalized_algorithm.parameter->name != key->algorithm_name()) { + WebIDL::reject_promise(realm, promise, WebIDL::InvalidAccessError::create(realm, ""Algorithm mismatch""_fly_string)); + return; + } + + // 9. If the [[usages]] internal slot of key does not contain an entry that is ""sign"", then throw an InvalidAccessError. + if (!key->internal_usages().contains_slow(Bindings::KeyUsage::Sign)) { + WebIDL::reject_promise(realm, promise, WebIDL::InvalidAccessError::create(realm, ""Key does not support signing""_fly_string)); + return; + } + + // 10. Let result be the result of performing the sign operation specified by normalizedAlgorithm using key and algorithm and with data as message. + auto result = normalized_algorithm.methods->sign(*normalized_algorithm.parameter, key, data); + if (result.is_error()) { + WebIDL::reject_promise(realm, promise, Bindings::dom_exception_to_throw_completion(realm.vm(), result.release_error()).release_value().value()); + return; + } + + // 9. Resolve promise with result. + WebIDL::resolve_promise(realm, promise, result.release_value()); + }); + + return verify_cast(*promise->promise()); +} + SupportedAlgorithmsMap& supported_algorithms_internal() { static SupportedAlgorithmsMap s_supported_algorithms; diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h index 074be20e91b8..6db39dab3eed 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.h @@ -29,6 +29,7 @@ class SubtleCrypto final : public Bindings::PlatformObject { JS::NonnullGCPtr encrypt(AlgorithmIdentifier const& algorithm, JS::NonnullGCPtr key, JS::Handle const& data_parameter); JS::NonnullGCPtr decrypt(AlgorithmIdentifier const& algorithm, JS::NonnullGCPtr key, JS::Handle const& data_parameter); + JS::ThrowCompletionOr> sign(AlgorithmIdentifier const& algorithm, JS::NonnullGCPtr key, JS::Handle const& data_parameter); JS::NonnullGCPtr digest(AlgorithmIdentifier const& algorithm, JS::Handle const& data); diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.idl b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.idl index 9663a1e62e96..d7c457494f2a 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.idl +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.idl @@ -47,7 +47,7 @@ dictionary JsonWebKey interface SubtleCrypto { Promise encrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data); Promise decrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data); - // FIXME: Promise sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data); + Promise sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data); // FIXME: Promise verify(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource signature, BufferSource data); Promise digest(AlgorithmIdentifier algorithm, BufferSource data);" f2a77f0c2ce86584d6e2ef7f579ce77e916916bc,2021-08-23 05:11:53,Maciej Zygmanowski,"base: Add ""Dark"" cursor theme",False,"Add ""Dark"" cursor theme",base,"diff --git a/Base/res/cursor-themes/Dark/Config.ini b/Base/res/cursor-themes/Dark/Config.ini new file mode 100644 index 000000000000..fec44b14a7e7 --- /dev/null +++ b/Base/res/cursor-themes/Dark/Config.ini @@ -0,0 +1,17 @@ +[Cursor] +Hidden=hidden.png +Arrow=arrow.x2y2.png +ResizeH=resize-horizontal.png +ResizeV=resize-vertical.png +ResizeDTLBR=resize-diagonal-tlbr.png +ResizeDBLTR=resize-diagonal-bltr.png +ResizeColumn=resize-column.png +ResizeRow=resize-row.png +IBeam=i-beam.png +Disallowed=disallowed.png +Move=move.png +Hand=hand.x8y4.png +Help=help.x1y1.png +Drag=drag.png +Wait=wait.f14t100.png +Crosshair=crosshair.png diff --git a/Base/res/cursor-themes/Dark/arrow.x2y2-2x.png b/Base/res/cursor-themes/Dark/arrow.x2y2-2x.png new file mode 100644 index 000000000000..6a8d081302e6 Binary files /dev/null and b/Base/res/cursor-themes/Dark/arrow.x2y2-2x.png differ diff --git a/Base/res/cursor-themes/Dark/arrow.x2y2.png b/Base/res/cursor-themes/Dark/arrow.x2y2.png new file mode 100644 index 000000000000..30b5e80f684a Binary files /dev/null and b/Base/res/cursor-themes/Dark/arrow.x2y2.png differ diff --git a/Base/res/cursor-themes/Dark/crosshair-2x.png b/Base/res/cursor-themes/Dark/crosshair-2x.png new file mode 100644 index 000000000000..83a0ccbdc091 Binary files /dev/null and b/Base/res/cursor-themes/Dark/crosshair-2x.png differ diff --git a/Base/res/cursor-themes/Dark/crosshair.png b/Base/res/cursor-themes/Dark/crosshair.png new file mode 100644 index 000000000000..ad8673d1f643 Binary files /dev/null and b/Base/res/cursor-themes/Dark/crosshair.png differ diff --git a/Base/res/cursor-themes/Dark/disallowed.png b/Base/res/cursor-themes/Dark/disallowed.png new file mode 100644 index 000000000000..c7357b9fbe3a Binary files /dev/null and b/Base/res/cursor-themes/Dark/disallowed.png differ diff --git a/Base/res/cursor-themes/Dark/drag.png b/Base/res/cursor-themes/Dark/drag.png new file mode 100644 index 000000000000..dc311a971fd4 Binary files /dev/null and b/Base/res/cursor-themes/Dark/drag.png differ diff --git a/Base/res/cursor-themes/Dark/hand.x8y4.png b/Base/res/cursor-themes/Dark/hand.x8y4.png new file mode 100644 index 000000000000..5597473eb8d7 Binary files /dev/null and b/Base/res/cursor-themes/Dark/hand.x8y4.png differ diff --git a/Base/res/cursor-themes/Dark/help.x1y1.png b/Base/res/cursor-themes/Dark/help.x1y1.png new file mode 100644 index 000000000000..c26b3fe2faa3 Binary files /dev/null and b/Base/res/cursor-themes/Dark/help.x1y1.png differ diff --git a/Base/res/cursor-themes/Dark/hidden.png b/Base/res/cursor-themes/Dark/hidden.png new file mode 100644 index 000000000000..96382d8740a9 Binary files /dev/null and b/Base/res/cursor-themes/Dark/hidden.png differ diff --git a/Base/res/cursor-themes/Dark/i-beam.png b/Base/res/cursor-themes/Dark/i-beam.png new file mode 100644 index 000000000000..b7d92b22c16c Binary files /dev/null and b/Base/res/cursor-themes/Dark/i-beam.png differ diff --git a/Base/res/cursor-themes/Dark/move-2x.png b/Base/res/cursor-themes/Dark/move-2x.png new file mode 100644 index 000000000000..167fbb83e7b2 Binary files /dev/null and b/Base/res/cursor-themes/Dark/move-2x.png differ diff --git a/Base/res/cursor-themes/Dark/move.png b/Base/res/cursor-themes/Dark/move.png new file mode 100644 index 000000000000..7cc7a64f9689 Binary files /dev/null and b/Base/res/cursor-themes/Dark/move.png differ diff --git a/Base/res/cursor-themes/Dark/resize-column-2x.png b/Base/res/cursor-themes/Dark/resize-column-2x.png new file mode 100644 index 000000000000..d498a513d27e Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-column-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-column.png b/Base/res/cursor-themes/Dark/resize-column.png new file mode 100644 index 000000000000..ab7897403dd8 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-column.png differ diff --git a/Base/res/cursor-themes/Dark/resize-diagonal-bltr-2x.png b/Base/res/cursor-themes/Dark/resize-diagonal-bltr-2x.png new file mode 100644 index 000000000000..d020a4ffcd73 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-diagonal-bltr-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-diagonal-bltr.png b/Base/res/cursor-themes/Dark/resize-diagonal-bltr.png new file mode 100644 index 000000000000..0afe0ecb6b42 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-diagonal-bltr.png differ diff --git a/Base/res/cursor-themes/Dark/resize-diagonal-tlbr-2x.png b/Base/res/cursor-themes/Dark/resize-diagonal-tlbr-2x.png new file mode 100644 index 000000000000..fd42d42e67eb Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-diagonal-tlbr-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-diagonal-tlbr.png b/Base/res/cursor-themes/Dark/resize-diagonal-tlbr.png new file mode 100644 index 000000000000..dc4b0b829444 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-diagonal-tlbr.png differ diff --git a/Base/res/cursor-themes/Dark/resize-horizontal-2x.png b/Base/res/cursor-themes/Dark/resize-horizontal-2x.png new file mode 100644 index 000000000000..5db9e9d7a96e Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-horizontal-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-horizontal.png b/Base/res/cursor-themes/Dark/resize-horizontal.png new file mode 100644 index 000000000000..80b98691bb73 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-horizontal.png differ diff --git a/Base/res/cursor-themes/Dark/resize-row-2x.png b/Base/res/cursor-themes/Dark/resize-row-2x.png new file mode 100644 index 000000000000..1b62829d7c0b Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-row-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-row.png b/Base/res/cursor-themes/Dark/resize-row.png new file mode 100644 index 000000000000..7f1c226c7736 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-row.png differ diff --git a/Base/res/cursor-themes/Dark/resize-vertical-2x.png b/Base/res/cursor-themes/Dark/resize-vertical-2x.png new file mode 100644 index 000000000000..3be1baea3034 Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-vertical-2x.png differ diff --git a/Base/res/cursor-themes/Dark/resize-vertical.png b/Base/res/cursor-themes/Dark/resize-vertical.png new file mode 100644 index 000000000000..1d3e1d2f3cee Binary files /dev/null and b/Base/res/cursor-themes/Dark/resize-vertical.png differ diff --git a/Base/res/cursor-themes/Dark/wait.f14t100.png b/Base/res/cursor-themes/Dark/wait.f14t100.png new file mode 100644 index 000000000000..d48441de9811 Binary files /dev/null and b/Base/res/cursor-themes/Dark/wait.f14t100.png differ" d60635cb9df9b4e72702db02b88b26ab9123c2a8,2021-08-23 03:32:09,Andreas Kling,kernel: Convert Processor::in_irq() to static current_in_irq(),False,Convert Processor::in_irq() to static current_in_irq(),kernel,"diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index 42ebcc82b89a..6377f0ddaf2d 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -120,7 +120,7 @@ class Processor { u32 m_gdt_length; u32 m_cpu; - u32 m_in_irq; + FlatPtr m_in_irq {}; volatile u32 m_in_critical {}; static Atomic s_idle_cpu_mask; @@ -329,9 +329,9 @@ class Processor { return Processor::id() == 0; } - ALWAYS_INLINE u32& in_irq() + ALWAYS_INLINE static FlatPtr current_in_irq() { - return m_in_irq; + return read_gs_ptr(__builtin_offsetof(Processor, m_in_irq)); } ALWAYS_INLINE static void restore_in_critical(u32 critical) diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp index 5f26402bfe82..0177559b801d 100644 --- a/Kernel/Arch/x86/common/Interrupts.cpp +++ b/Kernel/Arch/x86/common/Interrupts.cpp @@ -288,7 +288,7 @@ void page_fault_handler(TrapFrame* trap) bool faulted_in_kernel = !(regs.cs & 3); - if (faulted_in_kernel && Processor::current().in_irq()) { + if (faulted_in_kernel && Processor::current_in_irq()) { // If we're faulting in an IRQ handler, first check if we failed // due to safe_memcpy, safe_strnlen, or safe_memset. If we did, // gracefully continue immediately. Because we're in an IRQ handler diff --git a/Kernel/Arch/x86/i386/Processor.cpp b/Kernel/Arch/x86/i386/Processor.cpp index e57861b9f525..e29bec615990 100644 --- a/Kernel/Arch/x86/i386/Processor.cpp +++ b/Kernel/Arch/x86/i386/Processor.cpp @@ -180,7 +180,7 @@ FlatPtr Processor::init_context(Thread& thread, bool leave_crit) void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) { - VERIFY(!in_irq()); + VERIFY(!m_in_irq); VERIFY(m_in_critical == 1); VERIFY(is_kernel_mode()); diff --git a/Kernel/Arch/x86/x86_64/Processor.cpp b/Kernel/Arch/x86/x86_64/Processor.cpp index 2996957aa8fd..6ab4d907c027 100644 --- a/Kernel/Arch/x86/x86_64/Processor.cpp +++ b/Kernel/Arch/x86/x86_64/Processor.cpp @@ -164,7 +164,7 @@ FlatPtr Processor::init_context(Thread& thread, bool leave_crit) void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) { - VERIFY(!in_irq()); + VERIFY(!m_in_irq); VERIFY(m_in_critical == 1); VERIFY(is_kernel_mode()); diff --git a/Kernel/Devices/AsyncDeviceRequest.cpp b/Kernel/Devices/AsyncDeviceRequest.cpp index 84524be30c7c..89f699d04d7d 100644 --- a/Kernel/Devices/AsyncDeviceRequest.cpp +++ b/Kernel/Devices/AsyncDeviceRequest.cpp @@ -135,7 +135,7 @@ void AsyncDeviceRequest::complete(RequestResult result) VERIFY(m_result == Started); m_result = result; } - if (Processor::current().in_irq()) { + if (Processor::current_in_irq()) { ref(); // Make sure we don't get freed Processor::deferred_call_queue([this]() { request_finished(); diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Devices/HID/I8042Controller.cpp index 3f11b7056098..a55326ef923c 100644 --- a/Kernel/Devices/HID/I8042Controller.cpp +++ b/Kernel/Devices/HID/I8042Controller.cpp @@ -132,7 +132,7 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices() bool I8042Controller::irq_process_input_buffer(HIDDevice::Type) { - VERIFY(Processor::current().in_irq()); + VERIFY(Processor::current_in_irq()); u8 status = IO::in8(I8042_STATUS); if (!(status & I8042_BUFFER_FULL)) @@ -167,7 +167,7 @@ bool I8042Controller::do_reset_device(HIDDevice::Type device) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); if (do_send_command(device, 0xff) != I8042_ACK) return false; // Wait until we get the self-test result @@ -179,7 +179,7 @@ u8 I8042Controller::do_send_command(HIDDevice::Type device, u8 command) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); return do_write_to_device(device, command); } @@ -189,7 +189,7 @@ u8 I8042Controller::do_send_command(HIDDevice::Type device, u8 command, u8 data) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); u8 response = do_write_to_device(device, command); if (response == I8042_ACK) @@ -202,7 +202,7 @@ u8 I8042Controller::do_write_to_device(HIDDevice::Type device, u8 data) VERIFY(device != HIDDevice::Type::Unknown); VERIFY(m_lock.is_locked()); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); int attempts = 0; u8 response; diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index cfc9bd313461..99574450291a 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -121,7 +121,7 @@ class File void evaluate_block_conditions() { - if (Processor::current().in_irq()) { + if (Processor::current_in_irq()) { // If called from an IRQ handler we need to delay evaluation // and unblocking of waiting threads. Note that this File // instance may be deleted until the deferred call is executed! @@ -137,7 +137,7 @@ class File private: ALWAYS_INLINE void do_evaluate_block_conditions() { - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); block_condition().unblock(); } diff --git a/Kernel/Locking/Mutex.cpp b/Kernel/Locking/Mutex.cpp index b7271fbf07b5..829001958bac 100644 --- a/Kernel/Locking/Mutex.cpp +++ b/Kernel/Locking/Mutex.cpp @@ -17,7 +17,7 @@ void Mutex::lock(Mode mode, [[maybe_unused]] LockLocation const& location) { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(mode != Mode::Unlocked); auto current_thread = Thread::current(); @@ -143,7 +143,7 @@ void Mutex::unlock() { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); auto current_thread = Thread::current(); SpinlockLocker lock(m_lock); Mode current_mode = m_mode; @@ -253,7 +253,7 @@ auto Mutex::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode { // NOTE: This may be called from an interrupt handler (not an IRQ handler) // and also from within critical sections! - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); auto current_thread = Thread::current(); SpinlockLocker lock(m_lock); auto current_mode = m_mode; @@ -316,7 +316,7 @@ void Mutex::restore_lock(Mode mode, u32 lock_count, [[maybe_unused]] LockLocatio { VERIFY(mode != Mode::Unlocked); VERIFY(lock_count > 0); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); auto current_thread = Thread::current(); bool did_block = false; SpinlockLocker lock(m_lock); diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 469ab4d01f82..fd83dc49d330 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -685,9 +685,9 @@ Region* MemoryManager::find_region_from_vaddr(VirtualAddress vaddr) PageFaultResponse MemoryManager::handle_page_fault(PageFault const& fault) { VERIFY_INTERRUPTS_DISABLED(); - if (Processor::current().in_irq()) { + if (Processor::current_in_irq()) { dbgln(""CPU[{}] BUG! Page fault while handling IRQ! code={}, vaddr={}, irq level: {}"", - Processor::id(), fault.code(), fault.vaddr(), Processor::current().in_irq()); + Processor::id(), fault.code(), fault.vaddr(), Processor::current_in_irq()); dump_kernel_regions(); return PageFaultResponse::ShouldCrash; } diff --git a/Kernel/SanCov.cpp b/Kernel/SanCov.cpp index 90d2fb026242..8e8040a70697 100644 --- a/Kernel/SanCov.cpp +++ b/Kernel/SanCov.cpp @@ -17,7 +17,7 @@ void __sanitizer_cov_trace_pc(void) if (g_in_early_boot) [[unlikely]] return; - if (Processor::current().in_irq()) [[unlikely]] { + if (Processor::current_in_irq()) [[unlikely]] { // Do not trace in interrupts. return; } diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 8f19be9dad37..528eac4a23aa 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -252,16 +252,15 @@ bool Scheduler::pick_next() bool Scheduler::yield() { InterruptDisabler disabler; - auto& proc = Processor::current(); auto current_thread = Thread::current(); - dbgln_if(SCHEDULER_DEBUG, ""Scheduler[{}]: yielding thread {} in_irq={}"", proc.get_id(), *current_thread, proc.in_irq()); + dbgln_if(SCHEDULER_DEBUG, ""Scheduler[{}]: yielding thread {} in_irq={}"", Processor::id(), *current_thread, Processor::current_in_irq()); VERIFY(current_thread != nullptr); - if (proc.in_irq() || Processor::in_critical()) { + if (Processor::current_in_irq() || Processor::in_critical()) { // If we're handling an IRQ we can't switch context, or we're in // a critical section where we don't want to switch contexts, then // delay until exiting the trap or critical section - proc.invoke_scheduler_async(); + Processor::current().invoke_scheduler_async(); return false; } @@ -269,7 +268,7 @@ bool Scheduler::yield() return false; if constexpr (SCHEDULER_DEBUG) - dbgln(""Scheduler[{}]: yield returns to thread {} in_irq={}"", Processor::id(), *current_thread, Processor::current().in_irq()); + dbgln(""Scheduler[{}]: yield returns to thread {} in_irq={}"", Processor::id(), *current_thread, Processor::current_in_irq()); return true; } @@ -462,7 +461,7 @@ void Scheduler::add_time_scheduled(u64 time_to_add, bool is_kernel) void Scheduler::timer_tick(const RegisterState& regs) { VERIFY_INTERRUPTS_DISABLED(); - VERIFY(Processor::current().in_irq()); + VERIFY(Processor::current_in_irq()); auto current_thread = Processor::current_thread(); if (!current_thread) @@ -506,15 +505,14 @@ void Scheduler::timer_tick(const RegisterState& regs) } VERIFY_INTERRUPTS_DISABLED(); - VERIFY(Processor::current().in_irq()); + VERIFY(Processor::current_in_irq()); Processor::current().invoke_scheduler_async(); } void Scheduler::invoke_async() { VERIFY_INTERRUPTS_DISABLED(); - auto& processor = Processor::current(); - VERIFY(!processor.in_irq()); + VERIFY(!Processor::current_in_irq()); // Since this function is called when leaving critical sections (such // as a Spinlock), we need to check if we're not already doing this diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 3c5d4ec18abf..9b7a00d8ecc9 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -157,7 +157,7 @@ Thread::~Thread() void Thread::block(Kernel::Mutex& lock, SpinlockLocker>& lock_lock, u32 lock_count) { - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(this == Thread::current()); ScopedCritical critical; VERIFY(!Memory::s_mm_lock.own_lock()); @@ -238,7 +238,7 @@ u32 Thread::unblock_from_lock(Kernel::Mutex& lock) SpinlockLocker scheduler_lock(g_scheduler_lock); SpinlockLocker block_lock(m_block_lock); VERIFY(m_blocking_lock == &lock); - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(g_scheduler_lock.own_lock()); VERIFY(m_block_lock.own_lock()); VERIFY(m_blocking_lock == &lock); @@ -251,7 +251,7 @@ u32 Thread::unblock_from_lock(Kernel::Mutex& lock) VERIFY(m_state != Thread::Runnable && m_state != Thread::Running); set_state(Thread::Runnable); }; - if (Processor::current().in_irq()) { + if (Processor::current_in_irq()) { Processor::deferred_call_queue([do_unblock = move(do_unblock), self = make_weak_ptr()]() { if (auto this_thread = self.strong_ref()) do_unblock(); @@ -272,7 +272,7 @@ void Thread::unblock_from_blocker(Blocker& blocker) if (!should_be_stopped() && !is_stopped()) unblock(); }; - if (Processor::current().in_irq()) { + if (Processor::current_in_irq()) { Processor::deferred_call_queue([do_unblock = move(do_unblock), self = make_weak_ptr()]() { if (auto this_thread = self.strong_ref()) do_unblock(); @@ -284,7 +284,7 @@ void Thread::unblock_from_blocker(Blocker& blocker) void Thread::unblock(u8 signal) { - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(g_scheduler_lock.own_lock()); VERIFY(m_block_lock.own_lock()); if (m_state != Thread::Blocked) @@ -377,7 +377,7 @@ void Thread::die_if_needed() // Now leave the critical section so that we can also trigger the // actual context switch Processor::clear_critical(); - dbgln(""die_if_needed returned from clear_critical!!! in irq: {}"", Processor::current().in_irq()); + dbgln(""die_if_needed returned from clear_critical!!! in irq: {}"", Processor::current_in_irq()); // We should never get here, but the scoped scheduler lock // will be released by Scheduler::context_switch again VERIFY_NOT_REACHED(); diff --git a/Kernel/Thread.h b/Kernel/Thread.h index c4ee8a04ed28..608483ae1db5 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -847,7 +847,7 @@ class Thread template [[nodiscard]] BlockResult block(const BlockTimeout& timeout, Args&&... args) { - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(this == Thread::current()); ScopedCritical critical; VERIFY(!Memory::s_mm_lock.own_lock()); @@ -889,7 +889,7 @@ class Thread // Process::kill_all_threads may be called at any time, which will mark all // threads to die. In that case timer_was_added = TimerQueue::the().add_timer_without_id(*m_block_timer, block_timeout.clock_id(), block_timeout.absolute_time(), [&]() { - VERIFY(!Processor::current().in_irq()); + VERIFY(!Processor::current_in_irq()); VERIFY(!g_scheduler_lock.own_lock()); VERIFY(!m_block_lock.own_lock()); // NOTE: this may execute on the same or any other processor! diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index 6d9f6c6bf106..5cc391a41305 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -403,7 +403,7 @@ void TimeManagement::increment_time_since_boot() void TimeManagement::system_timer_tick(const RegisterState& regs) { - if (Processor::current().in_irq() <= 1) { + if (Processor::current_in_irq() <= 1) { // Don't expire timers while handling IRQs TimerQueue::the().fire(); }" 55b19c31772213f21f1ab3e76ffca71468ab0f70,2024-11-12 03:26:46,sideshowbarker,libweb: Remove unused append_with_space etc functions from DOM::Node,False,Remove unused append_with_space etc functions from DOM::Node,libweb,"diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index 88db05910f86..02528ac3d75c 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -2472,62 +2472,6 @@ Optional Node::first_valid_id(StringView value, Document const& docu return {}; } -// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_te -ErrorOr Node::append_without_space(StringBuilder x, StringView const& result) -{ - // - If X is empty, copy the result to X. - // - If X is non-empty, copy the result to the end of X. - TRY(x.try_append(result)); - return {}; -} - -// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_te -ErrorOr Node::append_with_space(StringBuilder x, StringView const& result) -{ - // - If X is empty, copy the result to X. - if (x.is_empty()) { - TRY(x.try_append(result)); - } else { - // - If X is non-empty, add a space to the end of X and then copy the result to X after the space. - TRY(x.try_append("" ""sv)); - TRY(x.try_append(result)); - } - return {}; -} - -// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_te -ErrorOr Node::prepend_without_space(StringBuilder x, StringView const& result) -{ - // - If X is empty, copy the result to X. - if (x.is_empty()) { - x.append(result); - } else { - // - If X is non-empty, copy the result to the start of X. - auto temp = TRY(x.to_string()); - x.clear(); - TRY(x.try_append(result)); - TRY(x.try_append(temp)); - } - return {}; -} - -// https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_te -ErrorOr Node::prepend_with_space(StringBuilder x, StringView const& result) -{ - // - If X is empty, copy the result to X. - if (x.is_empty()) { - TRY(x.try_append(result)); - } else { - // - If X is non-empty, copy the result to the start of X, and add a space after the copy. - auto temp = TRY(x.to_string()); - x.clear(); - TRY(x.try_append(result)); - TRY(x.try_append("" ""sv)); - TRY(x.try_append(temp)); - } - return {}; -} - void Node::add_registered_observer(RegisteredObserver& registered_observer) { if (!m_registered_observer_list) diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index da2dc15cb404..7859b9d6d494 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -795,10 +795,6 @@ class Node : public EventTarget { void remove_child_impl(JS::NonnullGCPtr); static Optional first_valid_id(StringView, Document const&); - static ErrorOr append_without_space(StringBuilder, StringView const&); - static ErrorOr append_with_space(StringBuilder, StringView const&); - static ErrorOr prepend_without_space(StringBuilder, StringView const&); - static ErrorOr prepend_with_space(StringBuilder, StringView const&); JS::GCPtr m_parent; JS::GCPtr m_first_child;" 42bdcf182822befd96f8f9fad366f43333b9c05c,2020-09-21 23:46:03,Itamar,hackstudio: Basic C++ autocomplete logic,False,Basic C++ autocomplete logic,hackstudio,"diff --git a/DevTools/HackStudio/CMakeLists.txt b/DevTools/HackStudio/CMakeLists.txt index 7b2b28b1f227..684de9fdf55f 100644 --- a/DevTools/HackStudio/CMakeLists.txt +++ b/DevTools/HackStudio/CMakeLists.txt @@ -1,5 +1,6 @@ set(SOURCES CodeDocument.cpp + CppAutoComplete.cpp CursorTool.cpp Debugger/BacktraceModel.cpp Debugger/DebugInfoWidget.cpp diff --git a/DevTools/HackStudio/CppAutoComplete.cpp b/DevTools/HackStudio/CppAutoComplete.cpp new file mode 100644 index 000000000000..1a7762cee2e0 --- /dev/null +++ b/DevTools/HackStudio/CppAutoComplete.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2020, Itamar S. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include ""CppAutoComplete.h"" +#include +#include + +// #define DEBUG_AUTOCOMPLETE + +namespace HackStudio { +Vector CppAutoComplete::get_suggestions(const String& code, GUI::TextPosition autocomplete_position) +{ + auto lines = code.split('\n', true); + GUI::CppLexer lexer(code); + auto tokens = lexer.lex(); + + auto index_of_target_token = token_in_position(tokens, autocomplete_position); + if (!index_of_target_token.has_value()) + return {}; + + auto suggestions = identifier_prefixes(lines, tokens, index_of_target_token.value()); + +#ifdef DEBUG_AUTOCOMPLETE + for (auto& suggestion : suggestions) { + dbg() << ""suggestion: "" << suggestion; + } +#endif + + return suggestions; +} + +String CppAutoComplete::text_of_token(const Vector lines, const GUI::CppToken& token) +{ + return lines[token.m_start.line].substring(token.m_start.column, token.m_end.column - token.m_start.column + 1); +} + +Optional CppAutoComplete::token_in_position(const Vector& tokens, GUI::TextPosition position) +{ + for (size_t token_index = 0; token_index < tokens.size(); ++token_index) { + auto& token = tokens[token_index]; + if (token.m_start.line != position.line()) + continue; + if (token.m_start.column > position.column() || token.m_end.column < position.column()) + continue; + return token_index; + } + return {}; +} + +Vector CppAutoComplete::identifier_prefixes(const Vector lines, const Vector& tokens, size_t target_token_index) +{ + auto partial_input = text_of_token(lines, tokens[target_token_index]); + Vector suggestions; + + HashTable suggestions_lookup; // To avoid duplicate results + + for (size_t i = 0; i < target_token_index; ++i) { + auto& token = tokens[i]; + if (token.m_type != GUI::CppToken::Type::Identifier) + continue; + auto text = text_of_token(lines, token); + if (text.starts_with(partial_input) && !suggestions_lookup.contains(text)) { + suggestions_lookup.set(text); + suggestions.append(text); + } + } + return suggestions; +} +}; diff --git a/DevTools/HackStudio/CppAutoComplete.h b/DevTools/HackStudio/CppAutoComplete.h new file mode 100644 index 000000000000..9c4bbb3233ad --- /dev/null +++ b/DevTools/HackStudio/CppAutoComplete.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, Itamar S. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include +#include +#include +#include + +namespace HackStudio { +class CppAutoComplete { +public: + CppAutoComplete() = delete; + + static Vector get_suggestions(const String& code, GUI::TextPosition autocomplete_position); + +private: + static Optional token_in_position(const Vector&, GUI::TextPosition); + static String text_of_token(const Vector lines, const GUI::CppToken&); + static Vector identifier_prefixes(const Vector lines, const Vector&, size_t target_token_index); +}; +};" 627eb90086c70b150ab5a4acbd2d906657962cca,2024-11-03 22:21:58,Timothy Flynn,libweb: Update WebDriver's list of collection types,False,Update WebDriver's list of collection types,libweb,"diff --git a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp index c9d7726d818f..c88cf279414a 100644 --- a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp @@ -19,11 +19,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include #include #include #include @@ -60,14 +63,16 @@ static bool is_collection(JS::Object const& value) value.has_parameter_map() // - instance of Array || is(value) + // - instance of DOMTokenList + || is(value) // - instance of FileList || is(value) // - instance of HTMLAllCollection - || false // FIXME + || is(value) // - instance of HTMLCollection || is(value) // - instance of HTMLFormControlsCollection - || false // FIXME + || is(value) // - instance of HTMLOptionsCollection || is(value) // - instance of NodeList" 63c6eae918a3dacdfd3d6946bf0fdc8bd812e899,2024-01-14 00:11:09,Bastiaan van der Plaat,libwebview: Fix sanitizing about scheme URLs,False,Fix sanitizing about scheme URLs,libwebview,"diff --git a/Tests/LibWebView/TestWebViewURL.cpp b/Tests/LibWebView/TestWebViewURL.cpp index 6267c66c16bd..9a3816745c0d 100644 --- a/Tests/LibWebView/TestWebViewURL.cpp +++ b/Tests/LibWebView/TestWebViewURL.cpp @@ -79,3 +79,20 @@ TEST_CASE(http_url) compare_url_parts(""http://abc.def.com#anchor""sv, { ""http://abc.""sv, ""def.com""sv, ""#anchor""sv }); compare_url_parts(""http://abc.def.com?query""sv, { ""http://abc.""sv, ""def.com""sv, ""?query""sv }); } + +TEST_CASE(about_url) +{ + auto is_sanitized_url_the_same = [](StringView url) { + auto sanitized_url = WebView::sanitize_url(url); + if (!sanitized_url.has_value()) + return false; + return sanitized_url->to_string().value() == url; + }; + + EXPECT(!is_sanitized_url_the_same(""about""sv)); + EXPECT(!is_sanitized_url_the_same(""about blabla:""sv)); + EXPECT(!is_sanitized_url_the_same(""blabla about:""sv)); + + EXPECT(is_sanitized_url_the_same(""about:about""sv)); + EXPECT(is_sanitized_url_the_same(""about:version""sv)); +} diff --git a/Userland/Libraries/LibWebView/URL.cpp b/Userland/Libraries/LibWebView/URL.cpp index 17451ba98bf9..8898d2321636 100644 --- a/Userland/Libraries/LibWebView/URL.cpp +++ b/Userland/Libraries/LibWebView/URL.cpp @@ -35,7 +35,7 @@ static Optional create_url_with_url_or_path(String const& url_or_path) static Optional query_public_suffix_list(StringView url_string) { auto out = MUST(String::from_utf8(url_string)); - if (!out.contains(""://""sv)) + if (!out.starts_with_bytes(""about:""sv) && !out.contains(""://""sv)) out = MUST(String::formatted(""https://{}""sv, out)); auto maybe_url = create_url_with_url_or_path(out);" 59b1dfa4e5078d1e86ec9173515f718a847f82ff,2022-11-05 13:59:28,Timothy Flynn,"browser: Rename ""take screenshot"" action to ""take visible screenshot""",False,"Rename ""take screenshot"" action to ""take visible screenshot""",browser,"diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 0a0f056ef92d..729d61dbfc11 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -244,13 +244,13 @@ void BrowserWindow::build_menus() this); m_inspect_dom_node_action->set_status_tip(""Open inspector for this element""); - m_take_screenshot_action = GUI::Action::create( - ""&Take Screenshot""sv, g_icon_bag.filetype_image, [this](auto&) { + m_take_visible_screenshot_action = GUI::Action::create( + ""Take &Visible Screenshot""sv, g_icon_bag.filetype_image, [this](auto&) { if (auto result = take_screenshot(); result.is_error()) GUI::MessageBox::show_error(this, String::formatted(""{}"", result.error())); }, this); - m_take_screenshot_action->set_status_tip(""Save a screenshot of the current tab to the Downloads directory""sv); + m_take_visible_screenshot_action->set_status_tip(""Save a screenshot of the visible portion of the current tab to the Downloads directory""sv); auto& inspect_menu = add_menu(""&Inspect""); inspect_menu.add_action(*m_view_source_action); diff --git a/Userland/Applications/Browser/BrowserWindow.h b/Userland/Applications/Browser/BrowserWindow.h index 89f193a68b73..94ee02cafce3 100644 --- a/Userland/Applications/Browser/BrowserWindow.h +++ b/Userland/Applications/Browser/BrowserWindow.h @@ -39,7 +39,7 @@ class BrowserWindow final : public GUI::Window GUI::Action& view_source_action() { return *m_view_source_action; } GUI::Action& inspect_dom_tree_action() { return *m_inspect_dom_tree_action; } GUI::Action& inspect_dom_node_action() { return *m_inspect_dom_node_action; } - GUI::Action& take_screenshot_action() { return *m_take_screenshot_action; } + GUI::Action& take_visible_screenshot_action() { return *m_take_visible_screenshot_action; } void content_filters_changed(); void proxy_mappings_changed(); @@ -70,7 +70,7 @@ class BrowserWindow final : public GUI::Window RefPtr m_view_source_action; RefPtr m_inspect_dom_tree_action; RefPtr m_inspect_dom_node_action; - RefPtr m_take_screenshot_action; + RefPtr m_take_visible_screenshot_action; CookieJar& m_cookie_jar; WindowActions m_window_actions; diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index e910a3621a49..4af1f6326912 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -405,7 +405,7 @@ Tab::Tab(BrowserWindow& window) m_page_context_menu->add_action(window.inspect_dom_tree_action()); m_page_context_menu->add_action(window.inspect_dom_node_action()); m_page_context_menu->add_separator(); - m_page_context_menu->add_action(window.take_screenshot_action()); + m_page_context_menu->add_action(window.take_visible_screenshot_action()); view().on_context_menu_request = [&](auto& screen_position) { m_page_context_menu->popup(screen_position); };" a0bde822ee3f7219fb3ff61e456335515189669a,2019-06-07 20:44:16,Andreas Kling,ak: Add IterationDecision.h.,False,Add IterationDecision.h.,ak,"diff --git a/AK/IterationDecision.h b/AK/IterationDecision.h new file mode 100644 index 000000000000..26620ee43856 --- /dev/null +++ b/AK/IterationDecision.h @@ -0,0 +1,12 @@ +#pragma once + +namespace AK { + +enum class IterationDecision { + Continue, + Break, +}; + +} + +using AK::IterationDecision;" a24df37713508614cf66d7e83e4fb4f33feb0a68,2021-12-31 04:33:20,davidot,libjs: Convert resolve_this_binding() to ThrowCompletionOr,False,Convert resolve_this_binding() to ThrowCompletionOr,libjs,"diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index e0ee8d534632..eb0f86996625 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -2252,7 +2252,7 @@ Value SpreadExpression::execute(Interpreter& interpreter, GlobalObject& global_o Value ThisExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const { InterpreterNodeScope node_scope { interpreter, *this }; - return interpreter.vm().resolve_this_binding(global_object); + return TRY_OR_DISCARD(interpreter.vm().resolve_this_binding(global_object)); } void ThisExpression::dump(int indent) const diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index d22e20e49fb2..dda7d778ccbc 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -315,7 +315,13 @@ void Jump::execute_impl(Bytecode::Interpreter& interpreter) const void ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const { - interpreter.accumulator() = interpreter.vm().resolve_this_binding(interpreter.global_object()); + auto this_binding_or_error = interpreter.vm().resolve_this_binding(interpreter.global_object()); + if (this_binding_or_error.is_throw_completion()) { + interpreter.vm().throw_exception(interpreter.global_object(), this_binding_or_error.release_error().value()); + return; + } + + interpreter.accumulator() = this_binding_or_error.release_value(); } void Jump::replace_references_impl(BasicBlock const& from, BasicBlock const& to) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 67ab56259829..50472808cd1d 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -503,10 +503,12 @@ void VM::throw_exception(Exception& exception) } // 9.4.4 ResolveThisBinding ( ), https://tc39.es/ecma262/#sec-resolvethisbinding -Value VM::resolve_this_binding(GlobalObject& global_object) +ThrowCompletionOr VM::resolve_this_binding(GlobalObject& global_object) { + // 1. Let envRec be GetThisEnvironment(). auto& environment = get_this_environment(*this); - return TRY_OR_DISCARD(environment.get_this_binding(global_object)); + // 2. Return ? envRec.GetThisBinding(). + return TRY(environment.get_this_binding(global_object)); } String VM::join_arguments(size_t start_index) const diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 46529ef88443..1741b71c5ed9 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -155,7 +155,7 @@ class VM : public RefCounted { return running_execution_context().this_value; } - Value resolve_this_binding(GlobalObject&); + ThrowCompletionOr resolve_this_binding(GlobalObject&); Value last_value() const { return m_last_value; } void set_last_value(Badge, Value value) { m_last_value = value; }" 6856b6168aa5002a36402bc123e280a77a05d29a,2021-11-10 18:26:56,Luke Wilde,libjs: Implement Temporal.ZonedDateTime.prototype.toLocaleString,False,Implement Temporal.ZonedDateTime.prototype.toLocaleString,libjs,"diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index de82aedc34e4..da32e8ec8e2c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -71,6 +71,7 @@ void ZonedDateTimePrototype::initialize(GlobalObject& global_object) define_native_function(vm.names.withCalendar, with_calendar, 1, attr); define_native_function(vm.names.equals, equals, 1, attr); define_native_function(vm.names.toString, to_string, 0, attr); + define_native_function(vm.names.toLocaleString, to_locale_string, 0, attr); define_native_function(vm.names.valueOf, value_of, 0, attr); define_native_function(vm.names.startOfDay, start_of_day, 0, attr); define_native_function(vm.names.toInstant, to_instant, 0, attr); @@ -862,6 +863,18 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_string) return js_string(vm, TRY(temporal_zoned_date_time_to_string(global_object, *zoned_date_time, precision.precision, show_calendar, show_time_zone, show_offset, precision.increment, precision.unit, rounding_mode))); } +// 6.3.42 Temporal.ZonedDateTime.prototype.toLocaleString ( [ locales [ , options ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tolocalestring +// NOTE: This is the minimum toLocaleString implementation for engines without ECMA-402. +JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_locale_string) +{ + // 1. Let zonedDateTime be the this value. + // 2. Perform ? RequireInternalSlot(zonedDateTime, [[InitializedTemporalZonedDateTime]]). + auto* zoned_date_time = TRY(typed_this_object(global_object)); + + // 3. Return ? TemporalZonedDateTimeToString(zonedDateTime, ""auto"", ""auto"", ""auto"", ""auto""). + return js_string(vm, TRY(temporal_zoned_date_time_to_string(global_object, *zoned_date_time, ""auto""sv, ""auto""sv, ""auto""sv, ""auto""sv))); +} + // 6.3.44 Temporal.ZonedDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.valueof JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::value_of) { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h index a290750734b6..297423704f6f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.h @@ -55,6 +55,7 @@ class ZonedDateTimePrototype final : public PrototypeObject { + test(""length is 0"", () => { + expect(Temporal.ZonedDateTime.prototype.toLocaleString).toHaveLength(0); + }); + + test(""basic functionality"", () => { + const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300); + const timeZone = new Temporal.TimeZone(""UTC""); + const zonedDateTime = plainDateTime.toZonedDateTime(timeZone); + expect(zonedDateTime.toLocaleString()).toBe(""2021-11-03T01:33:05.1002003+00:00[UTC]""); + }); +}); + +describe(""errors"", () => { + test(""this value must be a Temporal.ZonedDateTime object"", () => { + expect(() => { + Temporal.ZonedDateTime.prototype.toLocaleString.call(""foo""); + }).toThrowWithMessage(TypeError, ""Not an object of type Temporal.ZonedDateTime""); + }); +});" 41066b009f69a3eaf3ad3196a2ff959853cc9321,2020-07-07 02:47:10,Andreas Kling,libcore: Don't fire Socket::on_ready_to_read if !can_read(),False,Don't fire Socket::on_ready_to_read if !can_read(),libcore,"diff --git a/Libraries/LibCore/Socket.cpp b/Libraries/LibCore/Socket.cpp index e5d5411829c6..c8f07672f24a 100644 --- a/Libraries/LibCore/Socket.cpp +++ b/Libraries/LibCore/Socket.cpp @@ -204,6 +204,8 @@ void Socket::ensure_read_notifier() ASSERT(m_connected); m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this); m_read_notifier->on_ready_to_read = [this] { + if (!can_read()) + return; if (on_ready_to_read) on_ready_to_read(); };" 79d8b9ae755c7d4727fdb6a22d250854ca1ae450,2019-10-04 14:32:42,Vincent Sanders,libc: unistd.h should provide SEEK_SET etc. if stdio.h is not included (#629),False,unistd.h should provide SEEK_SET etc. if stdio.h is not included (#629),libc,"diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h index da0d472d2b2a..6a879684e43d 100644 --- a/Libraries/LibC/unistd.h +++ b/Libraries/LibC/unistd.h @@ -1,3 +1,10 @@ +/* standard symbolic constants and types + * + * values from POSIX standard unix specification + * + * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html + */ + #pragma once #include @@ -12,6 +19,14 @@ __BEGIN_DECLS #define STDOUT_FILENO 1 #define STDERR_FILENO 2 +/* lseek whence values */ +#ifndef _STDIO_H /* also defined in stdio.h */ +#define SEEK_SET 0 /* from beginning of file. */ +#define SEEK_CUR 1 /* from current position in file. */ +#define SEEK_END 2 /* from the end of the file. */ +#endif + + extern char** environ; int get_process_name(char* buffer, int buffer_size);" 3f4fc2c7fb28d488a338225a2b354921ed0a8e4b,2021-12-28 07:36:28,Lady Gegga,base: Add Cyrillic characters to font Katica Regular 10,False,Add Cyrillic characters to font Katica Regular 10,base,"diff --git a/Base/res/fonts/KaticaRegular10.font b/Base/res/fonts/KaticaRegular10.font index bb4ba70fe54d..65d03c434981 100644 Binary files a/Base/res/fonts/KaticaRegular10.font and b/Base/res/fonts/KaticaRegular10.font differ" 59e47c3b11a225674f6b31f041002e88cc08a57e,2021-04-11 21:54:34,Timothy Flynn,base: Add test page for document.cookie,False,Add test page for document.cookie,base,"diff --git a/Base/res/html/misc/cookie.html b/Base/res/html/misc/cookie.html new file mode 100644 index 000000000000..1391bab3ff33 --- /dev/null +++ b/Base/res/html/misc/cookie.html @@ -0,0 +1,15 @@ + + + + +
    
    +
    +    
    +
    diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html
    index da883339fe17..e54552d00b8f 100644
    --- a/Base/res/html/misc/welcome.html
    +++ b/Base/res/html/misc/welcome.html
    @@ -38,6 +38,7 @@ 

    Welcome to the Serenity Browser!

    This page loaded in ms

    Some small test pages: